@financial-times/cp-content-pipeline-schema 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/lib/generated/index.d.ts +68 -5
- package/lib/model/CapiResponse.d.ts +4 -2
- package/lib/model/CapiResponse.js +23 -6
- package/lib/model/CapiResponse.js.map +1 -1
- package/lib/model/schemas/capi/article.d.ts +29 -26
- package/lib/model/schemas/capi/article.js +1 -0
- package/lib/model/schemas/capi/article.js.map +1 -1
- package/lib/model/schemas/capi/audio.d.ts +9 -6
- package/lib/model/schemas/capi/audio.js +1 -0
- package/lib/model/schemas/capi/audio.js.map +1 -1
- package/lib/model/schemas/capi/base-schema.d.ts +29 -26
- package/lib/model/schemas/capi/base-schema.js +14 -7
- package/lib/model/schemas/capi/base-schema.js.map +1 -1
- package/lib/model/schemas/capi/content-package.d.ts +29 -26
- package/lib/model/schemas/capi/content-package.js +1 -0
- package/lib/model/schemas/capi/content-package.js.map +1 -1
- package/lib/model/schemas/capi/index.js +3 -0
- package/lib/model/schemas/capi/index.js.map +1 -1
- package/lib/model/schemas/capi/live-blog-package.d.ts +29 -26
- package/lib/model/schemas/capi/live-blog-package.js +1 -0
- package/lib/model/schemas/capi/live-blog-package.js.map +1 -1
- package/lib/model/schemas/capi/placeholder.d.ts +1043 -0
- package/lib/model/schemas/capi/placeholder.js +37 -0
- package/lib/model/schemas/capi/placeholder.js.map +1 -0
- package/lib/resolvers/content.d.ts +7 -3
- package/lib/resolvers/content.js +6 -2
- package/lib/resolvers/content.js.map +1 -1
- package/lib/resolvers/index.d.ts +8 -4
- package/lib/resolvers/scalars.d.ts +2 -2
- package/lib/resolvers/scalars.js +1 -0
- package/lib/resolvers/scalars.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/index.ts +75 -4
- package/src/model/CapiResponse.ts +46 -7
- package/src/model/schemas/capi/article.ts +1 -0
- package/src/model/schemas/capi/audio.ts +1 -0
- package/src/model/schemas/capi/base-schema.ts +22 -15
- package/src/model/schemas/capi/content-package.ts +1 -0
- package/src/model/schemas/capi/index.ts +3 -0
- package/src/model/schemas/capi/live-blog-package.ts +1 -0
- package/src/model/schemas/capi/placeholder.ts +41 -0
- package/src/resolvers/content.ts +10 -2
- package/src/resolvers/scalars.ts +2 -0
- package/src/types/internal-content.d.ts +8 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/typedefs/content.graphql +27 -1
package/src/resolvers/content.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Topper } from '../model/Topper'
|
|
|
2
2
|
import { Byline } from '../model/Byline'
|
|
3
3
|
import {
|
|
4
4
|
ArticleResolvers,
|
|
5
|
+
PlaceholderResolvers,
|
|
5
6
|
AudioResolvers,
|
|
6
7
|
ContentPackageResolvers,
|
|
7
8
|
ContentResolvers,
|
|
@@ -13,8 +14,9 @@ const resolvers = {
|
|
|
13
14
|
Content: {
|
|
14
15
|
__resolveType: (parent) => {
|
|
15
16
|
const type = parent.type()
|
|
17
|
+
|
|
16
18
|
if (type === 'Content') {
|
|
17
|
-
return 'Article'
|
|
19
|
+
return parent.isPlaceholder() ? 'Placeholder' : 'Article'
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
if (type === 'MediaResource') {
|
|
@@ -61,13 +63,18 @@ const resolvers = {
|
|
|
61
63
|
containedIn: (parent) => parent.containedIn(),
|
|
62
64
|
},
|
|
63
65
|
|
|
66
|
+
Placeholder: {
|
|
67
|
+
containedIn: (parent) => parent.containedIn(),
|
|
68
|
+
},
|
|
69
|
+
|
|
64
70
|
LiveBlogPackage: {
|
|
65
71
|
liveBlogPosts: (parent) => parent.liveBlogPosts(),
|
|
66
72
|
realtime: (parent) => parent.realtime(),
|
|
67
73
|
},
|
|
68
74
|
|
|
69
75
|
ContentPackage: {
|
|
70
|
-
contains: (parent) => parent.contains(),
|
|
76
|
+
contains: (parent, args) => parent.contains(args),
|
|
77
|
+
containsLength: (parent) => parent.containsLength(),
|
|
71
78
|
},
|
|
72
79
|
|
|
73
80
|
Audio: {
|
|
@@ -78,6 +85,7 @@ const resolvers = {
|
|
|
78
85
|
},
|
|
79
86
|
} satisfies {
|
|
80
87
|
Article: ArticleResolvers
|
|
88
|
+
Placeholder: PlaceholderResolvers
|
|
81
89
|
Content: ContentResolvers
|
|
82
90
|
LiveBlogPackage: LiveBlogPackageResolvers
|
|
83
91
|
ContentPackage: ContentPackageResolvers
|
package/src/resolvers/scalars.ts
CHANGED
|
@@ -110,6 +110,7 @@ export const RichTextSource = new LiteralUnionScalar<
|
|
|
110
110
|
export const ContentType = new LiteralUnionScalar<
|
|
111
111
|
[
|
|
112
112
|
'Article',
|
|
113
|
+
'Placeholder',
|
|
113
114
|
'Video',
|
|
114
115
|
'Audio',
|
|
115
116
|
'LiveBlogPackage',
|
|
@@ -122,6 +123,7 @@ export const ContentType = new LiteralUnionScalar<
|
|
|
122
123
|
name: 'ContentType',
|
|
123
124
|
values: [
|
|
124
125
|
'Article',
|
|
126
|
+
'Placeholder',
|
|
125
127
|
'Video',
|
|
126
128
|
'Audio',
|
|
127
129
|
'LiveBlogPackage',
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from '../model/schemas/capi/base-schema'
|
|
14
14
|
|
|
15
15
|
import { articleSchema } from '../model/schemas/capi/article'
|
|
16
|
+
import { placeholderSchema } from '../model/schemas/capi/placeholder'
|
|
16
17
|
|
|
17
18
|
import { liveBlogPackageSchema } from '../model/schemas/capi/live-blog-package'
|
|
18
19
|
import { audioSchema } from '../model/schemas/capi/audio'
|
|
@@ -21,6 +22,7 @@ import { videoSchema } from '../model/schemas/capi/video'
|
|
|
21
22
|
import { contentPackageSchema } from '../model/schemas/capi/content-package'
|
|
22
23
|
|
|
23
24
|
type Article = z.infer<typeof articleSchema>
|
|
25
|
+
type Placeholder = z.infer<typeof placeholderSchema>
|
|
24
26
|
type LiveBlogPackage = z.infer<typeof liveBlogPackageSchema>
|
|
25
27
|
type ContentPackage = z.infer<typeof contentPackageSchema>
|
|
26
28
|
type Audio = z.infer<typeof audioSchema>
|
|
@@ -38,4 +40,9 @@ type LeadImage = z.infer<typeof LeadImage>
|
|
|
38
40
|
type ImageSet = z.infer<typeof ImageSet>
|
|
39
41
|
type MainImage = z.infer<typeof MainImage>
|
|
40
42
|
|
|
41
|
-
type ContentTypeSchemas =
|
|
43
|
+
type ContentTypeSchemas =
|
|
44
|
+
| Article
|
|
45
|
+
| Placeholder
|
|
46
|
+
| LiveBlogPackage
|
|
47
|
+
| ContentPackage
|
|
48
|
+
| Audio
|