-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0135586
commit b9220f4
Showing
8 changed files
with
41 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import { getLanguageFieldName } from '../helpers/config'; | ||
import { PageTreeConfig } from '../types'; | ||
|
||
export const getRawPageMetadataQuery = (config: PageTreeConfig) => `*[_type in [${Object.values(config.pageSchemaTypes) | ||
export const getAllRawPageMetadataQuery = (config: PageTreeConfig) => `*[_type in [${Object.values( | ||
config.pageSchemaTypes, | ||
) | ||
.map(key => `"${key}"`) | ||
.join(', ')}]]{ | ||
${rawPageMetadataFragment(config)} | ||
}`; | ||
|
||
export const getRawPageMetadataQuery = (documentId: string, config: PageTreeConfig) => `*[_id == "${documentId}"]{ | ||
${rawPageMetadataFragment(config)} | ||
}`; | ||
|
||
export const rawPageMetadataFragment = (config: PageTreeConfig) => ` | ||
_id, | ||
_type, | ||
_updatedAt, | ||
parent, | ||
slug, | ||
title, | ||
${getLanguageFieldName(config) ?? ''} | ||
}`; | ||
|
||
export const getDocumentTypeQuery = (documentId: string) => `*[_id == "${documentId}"]{ | ||
_type | ||
}`; | ||
${getLanguageFieldName(config) ?? ''}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters