-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(graphql): providing the query no longer prevents updates [TOL-140…
…9] (#288) * fix(graphql): not updating content below collections if the query is provided * chore(examples): update nextjs-graphql example to also provide the query
- Loading branch information
1 parent
ffd70d8
commit b24df04
Showing
9 changed files
with
122 additions
and
84 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
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,6 +1,22 @@ | ||
const COLLECTION_SUFFIX = 'Collection'; | ||
|
||
export function generateTypeName(contentTypeId: string): string { | ||
return contentTypeId.charAt(0).toUpperCase() + contentTypeId.slice(1); | ||
} | ||
|
||
/** Generates the name of the field for a collection */ | ||
export function buildCollectionName(name: string): string { | ||
return `${name}${COLLECTION_SUFFIX}`; | ||
} | ||
|
||
/** | ||
* Extract the name of an entry from the collection (e.g. "postCollection" => "Post") | ||
* Returns undefined if the name doesn't has the collection suffix. | ||
*/ | ||
export function extractNameFromCollectionName(collection: string): string | undefined { | ||
if (!collection.endsWith(COLLECTION_SUFFIX)) { | ||
return undefined; | ||
} | ||
|
||
return generateTypeName(collection.replace(COLLECTION_SUFFIX, '')); | ||
} |
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