Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Updates revision
updateRevision: resolveUpdate(pageFetcher),
// Publish revision (must be given an exact revision ID to publish)
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
args.data = { published: true };
return resolveUpdate(pageFetcher)(_, args, ctx, info);
},
// Delete a revision
deleteRevision: resolveDelete(pageFetcher),
// Creates a new element
createElement: resolveCreate(elementFetcher),
// Updates an element
updateElement: resolveUpdate(elementFetcher),
// Deletes an element
deleteElement: resolveDelete(elementFetcher)
},
PageBuilderPageSettings: {
_empty: () => ""
}
}
};
getPage: resolveGet(pageFetcher),
listPages: listPages(pageFetcher),
listPublishedPages,
getPublishedPage,
getHomePage,
getNotFoundPage,
getErrorPage,
listElements: resolveList(elementFetcher),
searchTags: searchTags,
oembedData: oembed
},
PageBuilderMutation: {
// Creates a new page
createPage: resolveCreate(pageFetcher),
// Deletes the entire page
deletePage: resolveDelete(pageFetcher),
// Sets given page as home page.
setHomePage,
// Creates a revision from the given revision
createRevisionFrom: createRevisionFrom(pageFetcher),
// Updates revision
updateRevision: resolveUpdate(pageFetcher),
// Publish revision (must be given an exact revision ID to publish)
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
args.data = { published: true };
return resolveUpdate(pageFetcher)(_, args, ctx, info);
},
// Delete a revision
deleteRevision: resolveDelete(pageFetcher),
// Creates a new element
createElement: resolveCreate(elementFetcher),
// Deletes the entire page
deletePage: resolveDelete(pageFetcher),
// Sets given page as home page.
setHomePage,
// Creates a revision from the given revision
createRevisionFrom: createRevisionFrom(pageFetcher),
// Updates revision
updateRevision: resolveUpdate(pageFetcher),
// Publish revision (must be given an exact revision ID to publish)
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
args.data = { published: true };
return resolveUpdate(pageFetcher)(_, args, ctx, info);
},
// Delete a revision
deleteRevision: resolveDelete(pageFetcher),
// Creates a new element
createElement: resolveCreate(elementFetcher),
// Updates an element
updateElement: resolveUpdate(elementFetcher),
// Deletes an element
deleteElement: resolveDelete(elementFetcher)
},
PageBuilderPageSettings: {
_empty: () => ""
}
}
};
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
args.data = { published: true };
return resolveUpdate(pageFetcher)(_, args, ctx, info);
},
// Delete a revision
getErrorPage,
listElements: resolveList(elementFetcher),
searchTags: searchTags,
oembedData: oembed
},
PageBuilderMutation: {
// Creates a new page
createPage: resolveCreate(pageFetcher),
// Deletes the entire page
deletePage: resolveDelete(pageFetcher),
// Sets given page as home page.
setHomePage,
// Creates a revision from the given revision
createRevisionFrom: createRevisionFrom(pageFetcher),
// Updates revision
updateRevision: resolveUpdate(pageFetcher),
// Publish revision (must be given an exact revision ID to publish)
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
args.data = { published: true };
return resolveUpdate(pageFetcher)(_, args, ctx, info);
},
// Delete a revision
deleteRevision: resolveDelete(pageFetcher),
// Creates a new element
createElement: resolveCreate(elementFetcher),
// Updates an element
updateElement: resolveUpdate(elementFetcher),
// Deletes an element
deleteElement: resolveDelete(elementFetcher)
},
PageBuilderPageSettings: {
// Creates a revision from the given revision
createRevisionFrom: createRevisionFrom(pageFetcher),
// Updates revision
updateRevision: resolveUpdate(pageFetcher),
// Publish revision (must be given an exact revision ID to publish)
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
args.data = { published: true };
return resolveUpdate(pageFetcher)(_, args, ctx, info);
},
// Delete a revision
deleteRevision: resolveDelete(pageFetcher),
// Creates a new element
createElement: resolveCreate(elementFetcher),
// Updates an element
updateElement: resolveUpdate(elementFetcher),
// Deletes an element
deleteElement: resolveDelete(elementFetcher)
},
PageBuilderPageSettings: {
_empty: () => ""
}
}
};
},
PageBuilderQuery: {
getPage: resolveGet(pageFetcher),
listPages: listPages(pageFetcher),
listPublishedPages,
getPublishedPage,
getHomePage,
getNotFoundPage,
getErrorPage,
listElements: resolveList(elementFetcher),
searchTags: searchTags,
oembedData: oembed
},
PageBuilderMutation: {
// Creates a new page
createPage: resolveCreate(pageFetcher),
// Deletes the entire page
deletePage: resolveDelete(pageFetcher),
// Sets given page as home page.
setHomePage,
// Creates a revision from the given revision
createRevisionFrom: createRevisionFrom(pageFetcher),
// Updates revision
updateRevision: resolveUpdate(pageFetcher),
// Publish revision (must be given an exact revision ID to publish)
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
args.data = { published: true };
return resolveUpdate(pageFetcher)(_, args, ctx, info);
},
// Delete a revision
deleteRevision: resolveDelete(pageFetcher),
// Sets given page as home page.
setHomePage,
// Creates a revision from the given revision
createRevisionFrom: createRevisionFrom(pageFetcher),
// Updates revision
updateRevision: resolveUpdate(pageFetcher),
// Publish revision (must be given an exact revision ID to publish)
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
args.data = { published: true };
return resolveUpdate(pageFetcher)(_, args, ctx, info);
},
// Delete a revision
deleteRevision: resolveDelete(pageFetcher),
// Creates a new element
createElement: resolveCreate(elementFetcher),
// Updates an element
updateElement: resolveUpdate(elementFetcher),
// Deletes an element
deleteElement: resolveDelete(elementFetcher)
},
PageBuilderPageSettings: {
_empty: () => ""
}
}
};
createdBy(page) {
return { __typename: "SecurityUser", id: page.createdBy };
},
updatedBy(page) {
return { __typename: "SecurityUser", id: page.updatedBy };
}
},
PageBuilderQuery: {
getPage: resolveGet(pageFetcher),
listPages: listPages(pageFetcher),
listPublishedPages,
getPublishedPage,
getHomePage,
getNotFoundPage,
getErrorPage,
listElements: resolveList(elementFetcher),
searchTags: searchTags,
oembedData: oembed
},
PageBuilderMutation: {
// Creates a new page
createPage: resolveCreate(pageFetcher),
// Deletes the entire page
deletePage: resolveDelete(pageFetcher),
// Sets given page as home page.
setHomePage,
// Creates a revision from the given revision
createRevisionFrom: createRevisionFrom(pageFetcher),
// Updates revision
updateRevision: resolveUpdate(pageFetcher),
// Publish revision (must be given an exact revision ID to publish)
publishRevision: (_: any, args: Object, ctx: Object, info: Object) => {
export const createCmsField = () => {
schema.addType(CategoryType);
schema.addType(CategoryQueryType);
schema.addType(PageType);
schema.addType(PageQueryType);
schema.addType(RevisionType);
schema.addType(RevisionQueryType);
// Create Cms field to group related types and fields
const CmsType = new GraphQLObjectType({
name: "Cms",
fields: () => ({
Categories: createCategoryQueryField(),
Pages: createPageQueryField(),
Revisions: createRevisionQueryField()
})
});
schema.addType(CmsType);