UNPKG

@wepublish/api

Version:
1,119 lines 63.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GraphQLEmbedBlock = exports.GraphQLPublicCommentBlock = exports.GraphQLCommentBlock = exports.GraphQLCommentBlockFilter = exports.GraphQLEventBlock = exports.GraphQLEventBlockFilter = exports.GraphQLPollBlock = exports.GraphQLHTMLBlock = exports.GraphQLBildwurfAdBlock = exports.GraphQLTikTokVideoBlock = exports.GraphQLPolisConversationBlock = exports.GraphQLSoundCloudTrackBlock = exports.GraphQLYouTubeVideoBlock = exports.GraphQLVimeoVideoBlock = exports.GraphQLTwitterTweetBlock = exports.GraphQLInstagramPostBlock = exports.GraphQLFacebookVideoBlock = exports.GraphQLFacebookPostBlock = exports.GraphQLImageGalleryBlock = exports.GraphQLImageBlock = exports.GraphQLGalleryImageEdge = exports.GraphQLPublicTeaserGridFlexBlock = exports.GraphQLPublicFlexTeaser = exports.GraphQLPublicFlexAlignment = exports.GraphQLPublicTeaserGridBlock = exports.GraphQLTeaserListBlockInput = exports.GraphQLPublicTeaserListBlock = exports.GraphQLTeaserListBlock = exports.GraphQLTeaserListBlockFilterInput = exports.GraphQLTeaserListBlockFilter = exports.GraphQLTeaserType = exports.GraphQLPublicTeaser = exports.GraphQLPublicCustomTeaser = exports.GraphQLPublicEventTeaser = exports.GraphQLPublicPageTeaser = exports.GraphQLPublicPeerArticleTeaser = exports.GraphQLPublicArticleTeaser = exports.GraphQLTeaserGridFlexBlock = exports.GraphQLFlexTeaser = exports.GraphQLFlexGridAlignmentInput = exports.GraphQLFlexGridAlignment = exports.GraphQLTeaserGridBlock = exports.GraphQLTeaser = exports.GraphQLCustomTeaser = exports.GraphQLEventTeaser = exports.GraphQLPageTeaser = exports.GraphQLPeerArticleTeaser = exports.GraphQLArticleTeaser = exports.GraphQLRichTextBlock = exports.GraphQLTeaserStyle = void 0; exports.GraphQLPublicBlock = exports.GraphQLBlock = exports.GraphQLBlockInput = exports.GraphQLTeaserGridFlexBlockInput = exports.GraphQLFlexTeaserInput = exports.GraphQLTeaserGridBlockInput = exports.GraphQLTeaserInput = exports.GraphQLCustomTeaserInput = exports.GraphQLEventTeaserInput = exports.GraphQLPageTeaserInput = exports.GraphQLPeerArticleTeaserInput = exports.GraphQLArticleTeaserInput = exports.GraphQLCommentBlockInput = exports.GraphQLCommentBlockInputFilter = exports.GraphQLEventBlockInput = exports.GraphQLEventBlockInputFilter = exports.GraphQLPollBlockInput = exports.GraphQLHTMLBlockInput = exports.GraphQLEmbedBlockInput = exports.GraphQLBildwurfAdBlockInput = exports.GraphQLTikTokVideoBlockInput = exports.GraphQLPolisConversationBlockInput = exports.GraphQLSoundCloudTrackBlockInput = exports.GraphQLYouTubeVideoBlockInput = exports.GraphQLVimeoVideoBlockInput = exports.GraphQLTwitterTweetBlockInput = exports.GraphQLInstagramPostBlockInput = exports.GraphQLFacebookVideoBlockInput = exports.GraphQLFacebookPostBlockInput = exports.GraphQLLinkPageBreakBlockInput = exports.GraphQLQuoteBlockInput = exports.GraphQLListicleBlockInput = exports.GraphQLListicleItemInput = exports.GraphQLImageGalleryBlockInput = exports.GraphQLGalleryImageEdgeInput = exports.GraphQLImageBlockInput = exports.GraphQLTitleBlockInput = exports.GraphQLRichTextBlockInput = exports.GraphQLQuoteBlock = exports.GraphQLTitleBlock = exports.GraphQLLinkPageBreakBlock = exports.GraphQLListicleBlock = exports.GraphQLListicleItem = void 0; const tslib_1 = require("tslib"); const graphql_1 = require("graphql"); const image_1 = require("./image"); const api_1 = require("../../../richtext-api/src"); const block_1 = require("../db/block"); const utility_1 = require("../utility"); const article_1 = require("./article"); const page_1 = require("./page"); const peer_1 = require("./peer"); const poll_1 = require("./poll/poll"); const comment_1 = require("./comment/comment"); const common_1 = require("./common"); const event_1 = require("./event/event"); const article_public_queries_1 = require("./article/article.public-queries"); const article_2 = require("../db/article"); const api_2 = require("../../../utils-api/src"); const page_public_queries_1 = require("./page/page.public-queries"); const page_2 = require("../db/page"); const event_query_1 = require("./event/event.query"); const article_queries_1 = require("./article/article.queries"); const page_queries_1 = require("./page/page.queries"); exports.GraphQLTeaserStyle = new graphql_1.GraphQLEnumType({ name: 'TeaserStyle', values: { DEFAULT: { value: block_1.TeaserStyle.Default }, LIGHT: { value: block_1.TeaserStyle.Light }, TEXT: { value: block_1.TeaserStyle.Text } } }); const resolveBlockStyleIdToName = ({ blockStyle }, _, { loaders }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { if (!blockStyle) { return; } const style = yield loaders.blockStyleById.load(blockStyle); return style === null || style === void 0 ? void 0 : style.name; }); exports.GraphQLRichTextBlock = new graphql_1.GraphQLObjectType({ name: 'RichTextBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, richText: { type: new graphql_1.GraphQLNonNull(api_1.GraphQLRichText) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.RichText; }) }); exports.GraphQLArticleTeaser = new graphql_1.GraphQLObjectType({ name: 'ArticleTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, article: { type: article_1.GraphQLArticle, resolve: (0, utility_1.createProxyingResolver)(({ articleID }, args, { loaders }) => { return loaders.articles.load(articleID); }) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => value.type === block_1.TeaserType.Article) }); exports.GraphQLPeerArticleTeaser = new graphql_1.GraphQLObjectType({ name: 'PeerArticleTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, peer: { type: peer_1.GraphQLPeer, resolve: (0, utility_1.createProxyingResolver)(({ peerID }, args, { loaders }) => { return loaders.peer.load(peerID); }) }, articleID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID) }, article: { type: article_1.GraphQLArticle, resolve: (0, utility_1.createProxyingResolver)(({ peerID, articleID }, args, context, info) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return (0, utility_1.delegateToPeerSchema)(peerID, true, context, { fieldName: 'article', args: { id: articleID }, info }); })) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => value.type === block_1.TeaserType.PeerArticle) }); exports.GraphQLPageTeaser = new graphql_1.GraphQLObjectType({ name: 'PageTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, page: { type: page_1.GraphQLPage, resolve: (0, utility_1.createProxyingResolver)(({ pageID }, args, { loaders }) => { return loaders.pages.load(pageID); }) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => value.type === block_1.TeaserType.Page) }); exports.GraphQLEventTeaser = new graphql_1.GraphQLObjectType({ name: 'EventTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, event: { type: event_1.GraphQLEvent, resolve: (0, utility_1.createProxyingResolver)(({ eventID }, args, { loaders }) => { return loaders.eventById.load(eventID); }) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => value.type === block_1.TeaserType.Event) }); exports.GraphQLCustomTeaser = new graphql_1.GraphQLObjectType({ name: 'CustomTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, contentUrl: { type: graphql_1.GraphQLString }, properties: { type: new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(common_1.GraphQLMetadataProperty)) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => value.type === block_1.TeaserType.Custom) }); exports.GraphQLTeaser = new graphql_1.GraphQLUnionType({ name: 'Teaser', types: [ exports.GraphQLArticleTeaser, exports.GraphQLPeerArticleTeaser, exports.GraphQLPageTeaser, exports.GraphQLCustomTeaser, exports.GraphQLEventTeaser ] }); exports.GraphQLTeaserGridBlock = new graphql_1.GraphQLObjectType({ name: 'TeaserGridBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, teasers: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(exports.GraphQLTeaser)) }, numColumns: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.TeaserGrid; }) }); exports.GraphQLFlexGridAlignment = new graphql_1.GraphQLObjectType({ name: 'FlexAlignment', fields: { i: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, x: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, y: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, w: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, h: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, static: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLBoolean) } } }); exports.GraphQLFlexGridAlignmentInput = new graphql_1.GraphQLInputObjectType({ name: 'FlexAlignmentInput', fields: { i: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, x: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, y: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, w: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, h: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, static: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLBoolean) } } }); exports.GraphQLFlexTeaser = new graphql_1.GraphQLObjectType({ name: 'FlexTeaser', fields: { alignment: { type: new graphql_1.GraphQLNonNull(exports.GraphQLFlexGridAlignment) }, teaser: { type: exports.GraphQLTeaser } } }); exports.GraphQLTeaserGridFlexBlock = new graphql_1.GraphQLObjectType({ name: 'TeaserGridFlexBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, flexTeasers: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(exports.GraphQLFlexTeaser)) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.TeaserGridFlex; }) }); exports.GraphQLPublicArticleTeaser = new graphql_1.GraphQLObjectType({ name: 'ArticleTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, article: { type: article_1.GraphQLPublicArticle, resolve: (0, utility_1.createProxyingResolver)(({ articleID }, args, { loaders }) => { return loaders.publicArticles.load(articleID); }) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.TeaserType.Article; }) }); exports.GraphQLPublicPeerArticleTeaser = new graphql_1.GraphQLObjectType({ name: 'PeerArticleTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, peer: { type: peer_1.GraphQLPeer, resolve: (0, utility_1.createProxyingResolver)(({ peerID }, args, { loaders }) => { return loaders.peer.load(peerID); }) }, articleID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID) }, article: { type: article_1.GraphQLPublicArticle, resolve: (0, utility_1.createProxyingResolver)(({ peerID, articleID }, args, context, info) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const [peer, article] = yield Promise.all([ context.loaders.peer.load(peerID), (0, utility_1.delegateToPeerSchema)(peerID, false, context, { fieldName: 'article', args: { id: articleID }, info }) ]); return Object.assign(Object.assign({}, article), { peeredArticleURL: peer && article ? context.urlAdapter.getPeeredArticleURL(peer, article) : null }); })) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.TeaserType.PeerArticle; }) }); exports.GraphQLPublicPageTeaser = new graphql_1.GraphQLObjectType({ name: 'PageTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, page: { type: page_1.GraphQLPublicPage, resolve: (0, utility_1.createProxyingResolver)(({ pageID }, args, { loaders }) => { return loaders.publicPagesByID.load(pageID); }) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.TeaserType.Page; }) }); exports.GraphQLPublicEventTeaser = new graphql_1.GraphQLObjectType({ name: 'EventTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, event: { type: event_1.GraphQLEvent, resolve: (0, utility_1.createProxyingResolver)(({ eventID }, args, { loaders }) => { return loaders.eventById.load(eventID); }) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.TeaserType.Event; }) }); exports.GraphQLPublicCustomTeaser = new graphql_1.GraphQLObjectType({ name: 'CustomTeaser', fields: () => ({ style: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserStyle) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _, { loaders }) => imageID ? loaders.images.load(imageID) : null) }, preTitle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString }, contentUrl: { type: graphql_1.GraphQLString }, properties: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(common_1.GraphQLMetadataPropertyPublic))) } }), isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.TeaserType.Custom; }) }); exports.GraphQLPublicTeaser = new graphql_1.GraphQLUnionType({ name: 'Teaser', types: [ exports.GraphQLPublicArticleTeaser, exports.GraphQLPublicPeerArticleTeaser, exports.GraphQLPublicPageTeaser, exports.GraphQLPublicEventTeaser, exports.GraphQLPublicCustomTeaser ] }); exports.GraphQLTeaserType = new graphql_1.GraphQLEnumType({ name: 'TeaserType', values: { [block_1.TeaserType.Article]: { value: block_1.TeaserType.Article }, [block_1.TeaserType.PeerArticle]: { value: block_1.TeaserType.PeerArticle }, [block_1.TeaserType.Event]: { value: block_1.TeaserType.Event }, [block_1.TeaserType.Page]: { value: block_1.TeaserType.Page }, [block_1.TeaserType.Custom]: { value: block_1.TeaserType.Custom } } }); exports.GraphQLTeaserListBlockFilter = new graphql_1.GraphQLObjectType({ name: 'TeaserListBlockFilter', fields: { tags: { type: new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(graphql_1.GraphQLID)) } } }); exports.GraphQLTeaserListBlockFilterInput = new graphql_1.GraphQLInputObjectType({ name: 'TeaserListBlockFilterInput', fields: { tags: { type: new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(graphql_1.GraphQLID)) } } }); exports.GraphQLTeaserListBlock = new graphql_1.GraphQLObjectType({ name: 'TeaserListBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, teaserType: { type: exports.GraphQLTeaserType }, filter: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserListBlockFilter) }, take: { type: graphql_1.GraphQLInt }, skip: { type: graphql_1.GraphQLInt }, teasers: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(exports.GraphQLTeaser)), resolve: (0, utility_1.createProxyingResolver)(({ filter, skip, take, teaserType }, _, { loaders, prisma }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { if (teaserType === block_1.TeaserType.Article) { const articles = yield (0, article_queries_1.getArticles)({ published: true, tags: filter.tags }, article_2.ArticleSort.PublishedAt, api_2.SortOrder.Descending, undefined, skip, take, prisma.article); articles.nodes.forEach(article => loaders.articles.prime(article.id, article)); return articles.nodes.map(article => ({ articleID: article.id, style: block_1.TeaserStyle.Default, type: block_1.TeaserType.Article, imageID: null, lead: null, title: null })); } if (teaserType === block_1.TeaserType.Page) { const pages = yield (0, page_queries_1.getPages)({ tags: filter.tags }, page_2.PageSort.PublishedAt, api_2.SortOrder.Descending, undefined, skip, take, prisma.page); pages.nodes.forEach(page => loaders.pages.prime(page.id, page)); return pages.nodes.map(page => ({ pageID: page.id, style: block_1.TeaserStyle.Default, type: block_1.TeaserType.Page, imageID: null, lead: null, title: null })); } if (teaserType === block_1.TeaserType.Event) { const pages = yield (0, event_query_1.getEvents)({ tags: filter.tags }, event_query_1.EventSort.StartsAt, api_2.SortOrder.Descending, undefined, skip, take, prisma.event); pages.nodes.forEach(event => loaders.eventById.prime(event.id, event)); return pages.nodes.map(event => ({ eventID: event.id, style: block_1.TeaserStyle.Default, type: block_1.TeaserType.Event, imageID: null, lead: null, title: null })); } return []; })) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.TeaserList; }) }); exports.GraphQLPublicTeaserListBlock = new graphql_1.GraphQLObjectType({ name: 'TeaserListBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, teaserType: { type: exports.GraphQLTeaserType }, filter: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserListBlockFilter) }, take: { type: graphql_1.GraphQLInt }, skip: { type: graphql_1.GraphQLInt }, teasers: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(exports.GraphQLPublicTeaser)), resolve: (0, utility_1.createProxyingResolver)(({ filter, skip, take, teaserType }, _, { loaders, prisma }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { if (teaserType === block_1.TeaserType.Article) { const articles = yield (0, article_public_queries_1.getPublishedArticles)({ tags: filter.tags }, article_2.ArticleSort.PublishedAt, api_2.SortOrder.Descending, undefined, skip, take, prisma.article); articles.nodes.forEach(article => loaders.publicArticles.prime(article.id, article)); return articles.nodes.map(article => ({ articleID: article.id, style: block_1.TeaserStyle.Default, type: block_1.TeaserType.Article, imageID: null, lead: null, title: null })); } if (teaserType === block_1.TeaserType.Page) { const pages = yield (0, page_public_queries_1.getPublishedPages)({ tags: filter.tags }, page_2.PageSort.PublishedAt, api_2.SortOrder.Descending, undefined, skip, take, prisma.page); pages.nodes.forEach(page => loaders.publicPagesByID.prime(page.id, page)); return pages.nodes.map(page => ({ pageID: page.id, style: block_1.TeaserStyle.Default, type: block_1.TeaserType.Page, imageID: null, lead: null, title: null })); } if (teaserType === block_1.TeaserType.Event) { const pages = yield (0, event_query_1.getEvents)({ tags: filter.tags }, event_query_1.EventSort.StartsAt, api_2.SortOrder.Descending, undefined, skip, take, prisma.event); pages.nodes.forEach(event => loaders.eventById.prime(event.id, event)); return pages.nodes.map(event => ({ eventID: event.id, style: block_1.TeaserStyle.Default, type: block_1.TeaserType.Event, imageID: null, lead: null, title: null })); } return []; })) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.TeaserList; }) }); exports.GraphQLTeaserListBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'TeaserListBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, teaserType: { type: exports.GraphQLTeaserType }, filter: { type: new graphql_1.GraphQLNonNull(exports.GraphQLTeaserListBlockFilterInput) }, take: { type: graphql_1.GraphQLInt }, skip: { type: graphql_1.GraphQLInt } } }); exports.GraphQLPublicTeaserGridBlock = new graphql_1.GraphQLObjectType({ name: 'TeaserGridBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, teasers: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(exports.GraphQLPublicTeaser)) }, numColumns: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.TeaserGrid; }) }); exports.GraphQLPublicFlexAlignment = new graphql_1.GraphQLObjectType({ name: 'FlexAlignment', fields: { x: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, y: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, w: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) }, h: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt) } } }); exports.GraphQLPublicFlexTeaser = new graphql_1.GraphQLObjectType({ name: 'FlexTeaser', fields: { alignment: { type: new graphql_1.GraphQLNonNull(exports.GraphQLPublicFlexAlignment) }, teaser: { type: exports.GraphQLPublicTeaser } } }); exports.GraphQLPublicTeaserGridFlexBlock = new graphql_1.GraphQLObjectType({ name: 'TeaserGridFlexBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, flexTeasers: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(exports.GraphQLPublicFlexTeaser))) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.TeaserGridFlex; }) }); exports.GraphQLGalleryImageEdge = new graphql_1.GraphQLObjectType({ name: 'GalleryImageEdge', fields: { caption: { type: graphql_1.GraphQLString }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, args, { loaders }) => { return imageID ? loaders.images.load(imageID) : null; }) } } }); exports.GraphQLImageBlock = new graphql_1.GraphQLObjectType({ name: 'ImageBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _args, { loaders }) => { return imageID ? loaders.images.load(imageID) : null; }) }, caption: { type: graphql_1.GraphQLString } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Image; }) }); exports.GraphQLImageGalleryBlock = new graphql_1.GraphQLObjectType({ name: 'ImageGalleryBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, images: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(exports.GraphQLGalleryImageEdge))) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.ImageGallery; }) }); exports.GraphQLFacebookPostBlock = new graphql_1.GraphQLObjectType({ name: 'FacebookPostBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, userID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, postID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.FacebookPost; }) }); exports.GraphQLFacebookVideoBlock = new graphql_1.GraphQLObjectType({ name: 'FacebookVideoBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, userID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, videoID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.FacebookVideo; }) }); exports.GraphQLInstagramPostBlock = new graphql_1.GraphQLObjectType({ name: 'InstagramPostBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, postID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.InstagramPost; }) }); exports.GraphQLTwitterTweetBlock = new graphql_1.GraphQLObjectType({ name: 'TwitterTweetBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, userID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, tweetID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.TwitterTweet; }) }); exports.GraphQLVimeoVideoBlock = new graphql_1.GraphQLObjectType({ name: 'VimeoVideoBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, videoID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.VimeoVideo; }) }); exports.GraphQLYouTubeVideoBlock = new graphql_1.GraphQLObjectType({ name: 'YouTubeVideoBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, videoID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.YouTubeVideo; }) }); exports.GraphQLSoundCloudTrackBlock = new graphql_1.GraphQLObjectType({ name: 'SoundCloudTrackBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, trackID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.SoundCloudTrack; }) }); exports.GraphQLPolisConversationBlock = new graphql_1.GraphQLObjectType({ name: 'PolisConversationBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, conversationID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.PolisConversation; }) }); exports.GraphQLTikTokVideoBlock = new graphql_1.GraphQLObjectType({ name: 'TikTokVideoBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, videoID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, userID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.TikTokVideo; }) }); exports.GraphQLBildwurfAdBlock = new graphql_1.GraphQLObjectType({ name: 'BildwurfAdBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, zoneID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.BildwurfAd; }) }); exports.GraphQLHTMLBlock = new graphql_1.GraphQLObjectType({ name: 'HTMLBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, html: { type: graphql_1.GraphQLString } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.HTML; }) }); exports.GraphQLPollBlock = new graphql_1.GraphQLObjectType({ name: 'PollBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, poll: { type: poll_1.GraphQLFullPoll, resolve: ({ pollId }, _, { loaders: { pollById } }) => pollById.load(pollId) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Poll; }) }); exports.GraphQLEventBlockFilter = new graphql_1.GraphQLObjectType({ name: 'EventBlockFilter', fields: { tags: { type: new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(graphql_1.GraphQLID)) }, events: { type: new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(graphql_1.GraphQLID)) } } }); exports.GraphQLEventBlock = new graphql_1.GraphQLObjectType({ name: 'EventBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, filter: { type: new graphql_1.GraphQLNonNull(exports.GraphQLEventBlockFilter) }, events: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(event_1.GraphQLEvent))), resolve: ({ filter }, _, { prisma }) => { var _a, _b; return prisma.event.findMany({ where: { OR: [ { tags: { some: { tagId: { in: (_a = filter.tags) !== null && _a !== void 0 ? _a : [] } } } }, { id: { in: (_b = filter.events) !== null && _b !== void 0 ? _b : [] } } ] } }); } } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Event; }) }); exports.GraphQLCommentBlockFilter = new graphql_1.GraphQLObjectType({ name: 'CommentBlockFilter', fields: { item: { type: graphql_1.GraphQLID }, tags: { type: new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(graphql_1.GraphQLID)) }, comments: { type: new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(graphql_1.GraphQLID)) } } }); exports.GraphQLCommentBlock = new graphql_1.GraphQLObjectType({ name: 'CommentBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, filter: { type: new graphql_1.GraphQLNonNull(exports.GraphQLCommentBlockFilter) }, comments: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(comment_1.GraphQLComment))), resolve: ({ filter }, _, { prisma }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { var _a, _b, _c; return prisma.comment.findMany({ where: { itemID: (_a = filter.item) !== null && _a !== void 0 ? _a : '', OR: [ { tags: { some: { tagId: { in: (_b = filter.tags) !== null && _b !== void 0 ? _b : [] } } } }, { id: { in: (_c = filter.comments) !== null && _c !== void 0 ? _c : [] } } ] }, include: { revisions: { orderBy: { createdAt: 'asc' } } } }); }) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Comment; }) }); exports.GraphQLPublicCommentBlock = new graphql_1.GraphQLObjectType({ name: 'CommentBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, comments: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(comment_1.GraphQLPublicComment))), resolve: ({ filter }, _, { prisma }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { var _d, _e, _f; const comments = yield prisma.comment.findMany({ where: { itemID: (_d = filter.item) !== null && _d !== void 0 ? _d : undefined, OR: [ { tags: { some: { tagId: { in: (_e = filter.tags) !== null && _e !== void 0 ? _e : [] } } } }, { id: { in: (_f = filter.comments) !== null && _f !== void 0 ? _f : [] } } ] }, include: { revisions: { orderBy: { createdAt: 'asc' } }, overriddenRatings: true } }); return comments.map((_a) => { var { revisions } = _a, comment = tslib_1.__rest(_a, ["revisions"]); return (Object.assign({ text: revisions[revisions.length - 1].text }, comment)); }); }) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Comment; }) }); exports.GraphQLEmbedBlock = new graphql_1.GraphQLObjectType({ name: 'EmbedBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, url: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, width: { type: graphql_1.GraphQLInt }, height: { type: graphql_1.GraphQLInt }, styleCustom: { type: graphql_1.GraphQLString }, sandbox: { type: graphql_1.GraphQLString } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Embed; }) }); exports.GraphQLListicleItem = new graphql_1.GraphQLObjectType({ name: 'ListicleItem', fields: { title: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _args, { loaders }) => { return imageID ? loaders.images.load(imageID) : null; }) }, richText: { type: new graphql_1.GraphQLNonNull(api_1.GraphQLRichText) } } }); exports.GraphQLListicleBlock = new graphql_1.GraphQLObjectType({ name: 'ListicleBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, items: { type: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(exports.GraphQLListicleItem))) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Listicle; }) }); exports.GraphQLLinkPageBreakBlock = new graphql_1.GraphQLObjectType({ name: 'LinkPageBreakBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, text: { type: graphql_1.GraphQLString }, richText: { type: new graphql_1.GraphQLNonNull(api_1.GraphQLRichText) }, linkURL: { type: graphql_1.GraphQLString }, linkText: { type: graphql_1.GraphQLString }, linkTarget: { type: graphql_1.GraphQLString }, hideButton: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLBoolean) }, styleOption: { type: graphql_1.GraphQLString }, layoutOption: { type: graphql_1.GraphQLString }, templateOption: { type: graphql_1.GraphQLString }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _args, { loaders }) => { return imageID ? loaders.images.load(imageID) : null; }) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.LinkPageBreak; }) }); exports.GraphQLTitleBlock = new graphql_1.GraphQLObjectType({ name: 'TitleBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Title; }) }); exports.GraphQLQuoteBlock = new graphql_1.GraphQLObjectType({ name: 'QuoteBlock', fields: { blockStyle: { type: graphql_1.GraphQLString, resolve: resolveBlockStyleIdToName }, quote: { type: graphql_1.GraphQLString }, author: { type: graphql_1.GraphQLString }, image: { type: image_1.GraphQLImage, resolve: (0, utility_1.createProxyingResolver)(({ imageID }, _args, { loaders }) => { return imageID ? loaders.images.load(imageID) : null; }) } }, isTypeOf: (0, utility_1.createProxyingIsTypeOf)(value => { return value.type === block_1.BlockType.Quote; }) }); exports.GraphQLRichTextBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'RichTextBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, richText: { type: new graphql_1.GraphQLNonNull(api_1.GraphQLRichText) } } }); exports.GraphQLTitleBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'TitleBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, title: { type: graphql_1.GraphQLString }, lead: { type: graphql_1.GraphQLString } } }); exports.GraphQLImageBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'ImageBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, caption: { type: graphql_1.GraphQLString }, imageID: { type: graphql_1.GraphQLID } } }); exports.GraphQLGalleryImageEdgeInput = new graphql_1.GraphQLInputObjectType({ name: 'GalleryImageEdgeInput', fields: { caption: { type: graphql_1.GraphQLString }, imageID: { type: graphql_1.GraphQLID } } }); exports.GraphQLImageGalleryBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'ImageGalleryBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, images: { type: new graphql_1.GraphQLList(exports.GraphQLGalleryImageEdgeInput) } } }); exports.GraphQLListicleItemInput = new graphql_1.GraphQLInputObjectType({ name: 'ListicleItemInput', fields: { title: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, imageID: { type: graphql_1.GraphQLID }, richText: { type: new graphql_1.GraphQLNonNull(api_1.GraphQLRichText) } } }); exports.GraphQLListicleBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'ListicleBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, items: { type: new graphql_1.GraphQLList(exports.GraphQLListicleItemInput) } } }); exports.GraphQLQuoteBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'QuoteBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, quote: { type: graphql_1.GraphQLString }, author: { type: graphql_1.GraphQLString }, imageID: { type: graphql_1.GraphQLID } } }); exports.GraphQLLinkPageBreakBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'LinkPageBreakBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, text: { type: graphql_1.GraphQLString }, richText: { type: new graphql_1.GraphQLNonNull(api_1.GraphQLRichText) }, linkURL: { type: graphql_1.GraphQLString }, linkText: { type: graphql_1.GraphQLString }, linkTarget: { type: graphql_1.GraphQLString }, hideButton: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLBoolean) }, styleOption: { type: graphql_1.GraphQLString }, templateOption: { type: graphql_1.GraphQLString }, layoutOption: { type: graphql_1.GraphQLString }, imageID: { type: graphql_1.GraphQLID } } }); exports.GraphQLFacebookPostBlockInput = new graphql_1.GraphQLInputObjectType({ name: 'FacebookPostBlockInput', fields: { blockStyle: { type: graphql_1.GraphQLString }, userID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) }, postID: { type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString) } } }); exports.GraphQLFacebookVideoBlockInput = new graphql_1.GraphQLInputObjectT