@financial-times/cp-content-pipeline-schema 1.4.4 → 1.5.0
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 +17 -0
- package/lib/fixtures/capiObject.js +1 -1
- package/lib/fixtures/capiObject.js.map +1 -1
- package/lib/fixtures/clipSet.d.ts +2 -0
- package/lib/fixtures/clipSet.js +70 -0
- package/lib/fixtures/clipSet.js.map +1 -0
- package/lib/generated/index.d.ts +120 -3
- package/lib/model/CapiResponse.d.ts +2 -2
- package/lib/model/CapiResponse.js +1 -1
- package/lib/model/CapiResponse.js.map +1 -1
- package/lib/model/Clip.d.ts +28 -0
- package/lib/model/Clip.js +51 -0
- package/lib/model/Clip.js.map +1 -0
- package/lib/model/schemas/capi/article.d.ts +602 -9
- package/lib/model/schemas/capi/audio.d.ts +31 -31
- package/lib/model/schemas/capi/base-schema.d.ts +1355 -14
- package/lib/model/schemas/capi/base-schema.js +41 -2
- package/lib/model/schemas/capi/base-schema.js.map +1 -1
- package/lib/model/schemas/capi/content-package.d.ts +3 -3
- package/lib/model/schemas/capi/live-blog-package.d.ts +602 -9
- package/lib/model/schemas/capi/placeholder.d.ts +602 -9
- package/lib/resolvers/clip.d.ts +10 -0
- package/lib/resolvers/clip.js +13 -0
- package/lib/resolvers/clip.js.map +1 -0
- package/lib/resolvers/content-tree/Workarounds.d.ts +10 -2
- package/lib/resolvers/content-tree/nodePredicates.d.ts +3 -3
- package/lib/resolvers/content-tree/references/ClipSet.d.ts +27 -0
- package/lib/resolvers/content-tree/references/ClipSet.js +37 -0
- package/lib/resolvers/content-tree/references/ClipSet.js.map +1 -0
- package/lib/resolvers/content-tree/references/ImageSet.js +3 -2
- package/lib/resolvers/content-tree/references/ImageSet.js.map +1 -1
- package/lib/resolvers/content-tree/references/Reference.d.ts +1 -1
- package/lib/resolvers/content-tree/references/ScrollyImage.js +3 -2
- package/lib/resolvers/content-tree/references/ScrollyImage.js.map +1 -1
- package/lib/resolvers/content-tree/references/index.d.ts +4 -1
- package/lib/resolvers/content-tree/references/index.js +4 -0
- package/lib/resolvers/content-tree/references/index.js.map +1 -1
- package/lib/resolvers/content-tree/tagMappings.js +9 -0
- package/lib/resolvers/content-tree/tagMappings.js.map +1 -1
- package/lib/resolvers/index.d.ts +9 -0
- package/lib/resolvers/index.js +2 -0
- package/lib/resolvers/index.js.map +1 -1
- package/lib/resolvers/scalars.d.ts +2 -0
- package/lib/resolvers/scalars.js +6 -1
- package/lib/resolvers/scalars.js.map +1 -1
- package/package.json +1 -1
- package/src/fixtures/capiObject.ts +1 -1
- package/src/fixtures/clipSet.ts +72 -0
- package/src/generated/index.ts +128 -3
- package/src/model/CapiResponse.ts +3 -2
- package/src/model/Clip.ts +75 -0
- package/src/model/__snapshots__/RichText.test.ts.snap +25 -0
- package/src/model/schemas/capi/base-schema.ts +45 -1
- package/src/resolvers/clip.ts +13 -0
- package/src/resolvers/content-tree/Workarounds.ts +13 -2
- package/src/resolvers/content-tree/references/ClipSet.ts +49 -0
- package/src/resolvers/content-tree/references/ImageSet.ts +9 -5
- package/src/resolvers/content-tree/references/ScrollyImage.ts +9 -5
- package/src/resolvers/content-tree/references/index.ts +6 -0
- package/src/resolvers/content-tree/tagMappings.ts +10 -0
- package/src/resolvers/index.ts +2 -0
- package/src/resolvers/scalars.ts +8 -0
- package/src/types/internal-content.d.ts +4 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/typedefs/clip.graphql +28 -0
- package/typedefs/references/clipSet.graphql +19 -0
- package/typedefs/scalars.graphql +1 -0
|
@@ -7,12 +7,16 @@ export const ScrollyImage = {
|
|
|
7
7
|
picture(parent, _args, context) {
|
|
8
8
|
const isLiveBlog = parent.contentApiData?.type() === 'LiveBlogPost'
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const imageSets = parent.contentApiData
|
|
11
11
|
?.embeds()
|
|
12
|
-
?.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
?.filter((embedded) => embedded.type.includes('ImageSet')) as
|
|
13
|
+
| CAPIImageSet[]
|
|
14
|
+
| []
|
|
15
|
+
|
|
16
|
+
const imageSet = imageSets?.find(
|
|
17
|
+
(embed: CAPIImageSet) =>
|
|
18
|
+
uuidFromUrl(embed.id) === uuidFromUrl(parent.reference.id)
|
|
19
|
+
)
|
|
16
20
|
|
|
17
21
|
return imageSet ? new Picture(imageSet, isLiveBlog, context) : null
|
|
18
22
|
},
|
|
@@ -7,6 +7,7 @@ import { Reference } from './Reference'
|
|
|
7
7
|
|
|
8
8
|
import { Tweet } from './Tweet'
|
|
9
9
|
import { ImageSet } from './ImageSet'
|
|
10
|
+
import { ClipSet } from './ClipSet'
|
|
10
11
|
import { Video } from './Video'
|
|
11
12
|
import { Flourish } from './Flourish'
|
|
12
13
|
import { Recommended } from './Recommended'
|
|
@@ -16,6 +17,7 @@ import { ScrollyImage } from './ScrollyImage'
|
|
|
16
17
|
import {
|
|
17
18
|
FlourishResolvers,
|
|
18
19
|
ImageSetResolvers,
|
|
20
|
+
ClipSetResolvers,
|
|
19
21
|
LayoutImageResolvers,
|
|
20
22
|
RawImageResolvers,
|
|
21
23
|
RecommendedResolvers,
|
|
@@ -35,6 +37,7 @@ export const resolvers: {
|
|
|
35
37
|
Reference: ReferenceResolvers
|
|
36
38
|
Tweet: TweetResolvers
|
|
37
39
|
ImageSet: ImageSetResolvers
|
|
40
|
+
ClipSet: ClipSetResolvers
|
|
38
41
|
VideoReference: VideoReferenceResolvers
|
|
39
42
|
Flourish: FlourishResolvers
|
|
40
43
|
Recommended: RecommendedResolvers
|
|
@@ -45,6 +48,7 @@ export const resolvers: {
|
|
|
45
48
|
Reference,
|
|
46
49
|
Tweet,
|
|
47
50
|
ImageSet,
|
|
51
|
+
ClipSet,
|
|
48
52
|
VideoReference: Video,
|
|
49
53
|
Flourish,
|
|
50
54
|
Recommended,
|
|
@@ -57,6 +61,8 @@ export const mapNodeToReference = {
|
|
|
57
61
|
flourish: 'Flourish',
|
|
58
62
|
tweet: 'Tweet',
|
|
59
63
|
'image-set': 'ImageSet',
|
|
64
|
+
'clip-set': 'ClipSet',
|
|
65
|
+
clip: 'ClipSet',
|
|
60
66
|
video: 'VideoReference',
|
|
61
67
|
recommended: 'Recommended',
|
|
62
68
|
'layout-image': 'LayoutImage',
|
|
@@ -600,6 +600,16 @@ const commonTagMappings: TagMappings = {
|
|
|
600
600
|
level: 'subheading',
|
|
601
601
|
children: everyChildIsType('text', traverse(), 'heading', context),
|
|
602
602
|
}),
|
|
603
|
+
'ft-content[type="http://www.ft.com/ontology/content/ClipSet"]': ($el) => ({
|
|
604
|
+
type: 'clip-set',
|
|
605
|
+
id: $el.attr('url') || '',
|
|
606
|
+
autoplay: getBooleanAttributeValue($el, 'autoplay'),
|
|
607
|
+
loop: getBooleanAttributeValue($el, 'loop'),
|
|
608
|
+
muted: getBooleanAttributeValue($el, 'muted'),
|
|
609
|
+
dataLayout:
|
|
610
|
+
($el.attr('data-layout') as 'full-grid' | 'in-line' | 'mid-grid') ||
|
|
611
|
+
'in-line',
|
|
612
|
+
}),
|
|
603
613
|
}
|
|
604
614
|
|
|
605
615
|
// We can't trust cheerio.attr() method since with attributes like "autoplay"
|
package/src/resolvers/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { default as concept } from './concept'
|
|
|
2
2
|
import { default as content } from './content'
|
|
3
3
|
import { default as core } from './core'
|
|
4
4
|
import { default as image } from './image'
|
|
5
|
+
import { default as clip } from './clip'
|
|
5
6
|
import { default as metaLink } from './meta-link'
|
|
6
7
|
import { default as picture } from './picture'
|
|
7
8
|
import { default as richText } from './richText'
|
|
@@ -16,6 +17,7 @@ const resolvers = {
|
|
|
16
17
|
...content,
|
|
17
18
|
...core,
|
|
18
19
|
...image,
|
|
20
|
+
...clip,
|
|
19
21
|
...metaLink,
|
|
20
22
|
...picture,
|
|
21
23
|
...references,
|
package/src/resolvers/scalars.ts
CHANGED
|
@@ -103,6 +103,13 @@ export const ImageType = new LiteralUnionScalar<['image', 'graphic']>({
|
|
|
103
103
|
values: ['image', 'graphic'],
|
|
104
104
|
})
|
|
105
105
|
|
|
106
|
+
export const ClipFormat = new LiteralUnionScalar<['standard-inline', 'mobile']>(
|
|
107
|
+
{
|
|
108
|
+
name: 'ClipFormat',
|
|
109
|
+
values: ['standard-inline', 'mobile'],
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
|
|
106
113
|
export const RichTextSource = new LiteralUnionScalar<
|
|
107
114
|
['standfirst', 'summary', 'bodyXML']
|
|
108
115
|
>({
|
|
@@ -138,6 +145,7 @@ export const ContentType = new LiteralUnionScalar<
|
|
|
138
145
|
})
|
|
139
146
|
|
|
140
147
|
const resolvers = {
|
|
148
|
+
ClipFormat,
|
|
141
149
|
ImageFormat,
|
|
142
150
|
PackageDesign,
|
|
143
151
|
TopperBackgroundColour,
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
Annotation,
|
|
8
8
|
Image,
|
|
9
9
|
ImageSet,
|
|
10
|
+
Clip,
|
|
11
|
+
ClipSet,
|
|
10
12
|
MainImage,
|
|
11
13
|
LeadImage,
|
|
12
14
|
capiNotificationResponse,
|
|
@@ -39,6 +41,8 @@ type Image = z.infer<typeof Image>
|
|
|
39
41
|
type LeadImage = z.infer<typeof LeadImage>
|
|
40
42
|
type ImageSet = z.infer<typeof ImageSet>
|
|
41
43
|
type MainImage = z.infer<typeof MainImage>
|
|
44
|
+
type Clip = z.infer<typeof Clip>
|
|
45
|
+
type ClipSet = z.infer<typeof ClipSet>
|
|
42
46
|
|
|
43
47
|
type ContentTypeSchemas =
|
|
44
48
|
| Article
|