@financial-times/cp-content-pipeline-schema 3.1.1 → 3.2.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 +7 -0
- package/lib/generated/index.d.ts +9 -0
- package/lib/model/CapiResponse.d.ts +2 -1
- package/lib/model/CapiResponse.js +9 -4
- package/lib/model/CapiResponse.js.map +1 -1
- package/lib/model/CapiResponse.test.js +20 -0
- package/lib/model/CapiResponse.test.js.map +1 -1
- package/lib/model/schemas/capi/article.d.ts +5 -1
- 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 +2 -0
- package/lib/model/schemas/capi/base-schema.d.ts +5 -0
- package/lib/model/schemas/capi/base-schema.js +1 -0
- package/lib/model/schemas/capi/base-schema.js.map +1 -1
- package/lib/model/schemas/capi/content-package.d.ts +2 -0
- package/lib/model/schemas/capi/custom-code-component.d.ts +3 -0
- package/lib/model/schemas/capi/index.d.ts +13 -0
- package/lib/model/schemas/capi/list.d.ts +2 -2
- package/lib/model/schemas/capi/live-blog-package.d.ts +2 -0
- package/lib/model/schemas/capi/placeholder.d.ts +2 -0
- package/lib/model/schemas/capi/video.d.ts +2 -0
- package/lib/resolvers/content.d.ts +5 -0
- package/lib/resolvers/content.js +7 -0
- package/lib/resolvers/content.js.map +1 -1
- package/lib/resolvers/index.d.ts +5 -0
- package/package.json +1 -1
- package/queries/article.graphql +4 -0
- package/src/generated/index.ts +9 -0
- package/src/model/CapiResponse.test.ts +23 -0
- package/src/model/CapiResponse.ts +12 -4
- package/src/model/schemas/capi/article.ts +1 -0
- package/src/model/schemas/capi/base-schema.ts +1 -0
- package/src/resolvers/content.ts +7 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/typedefs/content.graphql +9 -0
|
@@ -155,6 +155,7 @@ export declare const placeholderSchema: import("zod").ZodObject<import("zod").ob
|
|
|
155
155
|
labelType: string;
|
|
156
156
|
sequence: string;
|
|
157
157
|
}>>;
|
|
158
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
158
159
|
}, "id" | "type" | "types" | "publishedDate" | "annotations" | "webUrl" | "canonicalWebUrl" | "standout" | "firstPublishedDate" | "publishReference" | "lastModified" | "editorialDesk" | "accessLevel" | "canBeSyndicated" | "canBeDistributed" | "topper" | "comments" | "containedIn">>, Pick<{
|
|
159
160
|
mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
|
|
160
161
|
id: import("zod").ZodString;
|
|
@@ -1411,6 +1412,7 @@ export declare const placeholderSchema: import("zod").ZodObject<import("zod").ob
|
|
|
1411
1412
|
labelType: string;
|
|
1412
1413
|
sequence: string;
|
|
1413
1414
|
}>>;
|
|
1415
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
1414
1416
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
1415
1417
|
title: import("zod").ZodString;
|
|
1416
1418
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -155,6 +155,7 @@ export declare const videoSchema: import("zod").ZodObject<import("zod").objectUt
|
|
|
155
155
|
labelType: string;
|
|
156
156
|
sequence: string;
|
|
157
157
|
}>>;
|
|
158
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
158
159
|
}, "id" | "types" | "publishedDate" | "annotations" | "webUrl" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "lastModified" | "editorialDesk" | "accessLevel" | "canBeSyndicated" | "canBeDistributed">>, Pick<{
|
|
159
160
|
mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
|
|
160
161
|
id: import("zod").ZodString;
|
|
@@ -1411,6 +1412,7 @@ export declare const videoSchema: import("zod").ZodObject<import("zod").objectUt
|
|
|
1411
1412
|
labelType: string;
|
|
1412
1413
|
sequence: string;
|
|
1413
1414
|
}>>;
|
|
1415
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
1414
1416
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
1415
1417
|
title: import("zod").ZodString;
|
|
1416
1418
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -33,6 +33,10 @@ declare const resolvers: {
|
|
|
33
33
|
};
|
|
34
34
|
Article: {
|
|
35
35
|
containedIn: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/CapiResponse").CapiResponse | null>;
|
|
36
|
+
publication: (parent: import("../model/CapiResponse").CapiResponse) => string[] | null;
|
|
37
|
+
indicators: (parent: import("../model/CapiResponse").CapiResponse) => {
|
|
38
|
+
isPartnerContent: boolean | null;
|
|
39
|
+
};
|
|
36
40
|
__resolveType?: import("../generated").TypeResolveFn<"Article" | "Placeholder" | "Video" | "Audio" | "LiveBlogPackage" | "LiveBlogPost" | "ContentPackage", import("../model/CapiResponse").CapiResponse, import("..").QueryContext> | undefined;
|
|
37
41
|
accessLevel: import("../generated").Resolver<import("../generated").Maybe<import("../generated").ResolverTypeWrapper<"premium" | "subscribed" | "registered" | "free">>, import("../model/CapiResponse").CapiResponse, import("..").QueryContext, {}>;
|
|
38
42
|
altStandfirst: import("../generated").Resolver<import("../generated").Maybe<import("../generated").ResolverTypeWrapper<import("../generated").AltStandfirst>>, import("../model/CapiResponse").CapiResponse, import("..").QueryContext, {}>;
|
|
@@ -276,6 +280,7 @@ declare const resolvers: {
|
|
|
276
280
|
};
|
|
277
281
|
Indicators: {
|
|
278
282
|
isOpinion: (parent: import("../generated").Indicators) => boolean | null;
|
|
283
|
+
isPartnerContent: (parent: import("../generated").Indicators) => boolean | null;
|
|
279
284
|
};
|
|
280
285
|
Media: {
|
|
281
286
|
url: (parent: import("../generated").Media) => string | null;
|
package/lib/resolvers/content.js
CHANGED
|
@@ -50,6 +50,12 @@ const resolvers = {
|
|
|
50
50
|
Article: {
|
|
51
51
|
...contentResolvers,
|
|
52
52
|
containedIn: (parent) => parent.containedIn(),
|
|
53
|
+
publication: (parent) => parent.publication() ?? null,
|
|
54
|
+
indicators: (parent) => {
|
|
55
|
+
return {
|
|
56
|
+
isPartnerContent: parent.isPartnerContent(),
|
|
57
|
+
};
|
|
58
|
+
},
|
|
53
59
|
},
|
|
54
60
|
Placeholder: {
|
|
55
61
|
...contentResolvers,
|
|
@@ -102,6 +108,7 @@ const resolvers = {
|
|
|
102
108
|
// it from other Indicators types in the next major release.
|
|
103
109
|
Indicators: {
|
|
104
110
|
isOpinion: (parent) => parent.isOpinion ?? null,
|
|
111
|
+
isPartnerContent: (parent) => parent.isPartnerContent ?? null,
|
|
105
112
|
},
|
|
106
113
|
Media: {
|
|
107
114
|
url: (parent) => parent.url ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/resolvers/content.ts"],"names":[],"mappings":";;AAAA,4CAAwC;AAiBxC,2DAA0D;AAE1D,MAAM,gBAAgB,GAAqB;IACzC,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE;IAC7C,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,qBAAqB,EAAE;IACzD,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAC/C,WAAW,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;IACvD,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE;IAC/B,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MA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M,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI;QAC7C,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI;KAChD;IAED,eAAe,EAAE;QACf,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI;QAC/C,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI;KAC9C;CAgBF,CAAA;AAED,kBAAe,SAAS,CAAA"}
|
package/lib/resolvers/index.d.ts
CHANGED
|
@@ -544,6 +544,10 @@ declare const resolvers: {
|
|
|
544
544
|
};
|
|
545
545
|
Article: {
|
|
546
546
|
containedIn: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/CapiResponse").CapiResponse | null>;
|
|
547
|
+
publication: (parent: import("../model/CapiResponse").CapiResponse) => string[] | null;
|
|
548
|
+
indicators: (parent: import("../model/CapiResponse").CapiResponse) => {
|
|
549
|
+
isPartnerContent: boolean | null;
|
|
550
|
+
};
|
|
547
551
|
__resolveType?: import("../generated").TypeResolveFn<"Article" | "Placeholder" | "Video" | "Audio" | "LiveBlogPackage" | "LiveBlogPost" | "ContentPackage", import("../model/CapiResponse").CapiResponse, import("..").QueryContext> | undefined;
|
|
548
552
|
accessLevel: import("../generated").Resolver<import("../generated").Maybe<import("../generated").ResolverTypeWrapper<"premium" | "subscribed" | "registered" | "free">>, import("../model/CapiResponse").CapiResponse, import("..").QueryContext, {}>;
|
|
549
553
|
altStandfirst: import("../generated").Resolver<import("../generated").Maybe<import("../generated").ResolverTypeWrapper<import("../generated").AltStandfirst>>, import("../model/CapiResponse").CapiResponse, import("..").QueryContext, {}>;
|
|
@@ -787,6 +791,7 @@ declare const resolvers: {
|
|
|
787
791
|
};
|
|
788
792
|
Indicators: {
|
|
789
793
|
isOpinion: (parent: import("../generated").Indicators) => boolean | null;
|
|
794
|
+
isPartnerContent: (parent: import("../generated").Indicators) => boolean | null;
|
|
790
795
|
};
|
|
791
796
|
Media: {
|
|
792
797
|
url: (parent: import("../generated").Media) => string | null;
|
package/package.json
CHANGED
package/queries/article.graphql
CHANGED
package/src/generated/index.ts
CHANGED
|
@@ -91,6 +91,8 @@ export type Article = Content & {
|
|
|
91
91
|
readonly firstPublishedDate: Scalars['String']['output'];
|
|
92
92
|
/** The unique identifier of the article - a uuid or a url. */
|
|
93
93
|
readonly id: Scalars['ID']['output'];
|
|
94
|
+
/** An object of several flags indicating the nature of the content */
|
|
95
|
+
readonly indicators?: Maybe<Indicators>;
|
|
94
96
|
/** The concept to use for instant alert CTAs. */
|
|
95
97
|
readonly instantAlertConcept?: Maybe<Concept>;
|
|
96
98
|
/** An image object containing the url and the caption, to be displayed usually before the article content. */
|
|
@@ -99,6 +101,8 @@ export type Article = Content & {
|
|
|
99
101
|
readonly modifiedTimestamp?: Maybe<Scalars['Float']['output']>;
|
|
100
102
|
/** The party that originated the article, eg. 'FT'. */
|
|
101
103
|
readonly originatingParty?: Maybe<Scalars['String']['output']>;
|
|
104
|
+
/** Array of publication IDs this article pertains to, e.g. 88fdde6c-2aa4-4f78-af02-9f680097cfd6 for FT Pink */
|
|
105
|
+
readonly publication?: Maybe<ReadonlyArray<Scalars['String']['output']>>;
|
|
102
106
|
/** A string ID used to trace content publishes through the pipeline, e.g. 'republish_tid_JNhUrBjdXo'. */
|
|
103
107
|
readonly publishReference?: Maybe<Scalars['String']['output']>;
|
|
104
108
|
/** The ISO string date the article was marked as published, eg. '2024-04-03T10:35:52.443Z'. */
|
|
@@ -1039,6 +1043,8 @@ export type ImageWideSourceSetArgs = {
|
|
|
1039
1043
|
export type Indicators = {
|
|
1040
1044
|
/** Whether the content is an opinion piece. */
|
|
1041
1045
|
readonly isOpinion?: Maybe<Scalars['Boolean']['output']>;
|
|
1046
|
+
/** Whether the content is Commercial Partner Content. */
|
|
1047
|
+
readonly isPartnerContent?: Maybe<Scalars['Boolean']['output']>;
|
|
1042
1048
|
};
|
|
1043
1049
|
|
|
1044
1050
|
export type LayoutImage = Reference & {
|
|
@@ -2169,10 +2175,12 @@ export type ArticleResolvers<ContextType = QueryContext, ParentType extends Reso
|
|
|
2169
2175
|
editorialDesk: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
2170
2176
|
firstPublishedDate: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
|
2171
2177
|
id: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
|
|
2178
|
+
indicators: Resolver<Maybe<ResolversTypes['Indicators']>, ParentType, ContextType>;
|
|
2172
2179
|
instantAlertConcept: Resolver<Maybe<ResolversTypes['Concept']>, ParentType, ContextType>;
|
|
2173
2180
|
mainImage: Resolver<Maybe<ResolversTypes['Image']>, ParentType, ContextType>;
|
|
2174
2181
|
modifiedTimestamp: Resolver<Maybe<ResolversTypes['Float']>, ParentType, ContextType>;
|
|
2175
2182
|
originatingParty: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
2183
|
+
publication: Resolver<Maybe<ReadonlyArray<ResolversTypes['String']>>, ParentType, ContextType>;
|
|
2176
2184
|
publishReference: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
2177
2185
|
publishedDate: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
|
2178
2186
|
publishedTimestamp: Resolver<ResolversTypes['Float'], ParentType, ContextType>;
|
|
@@ -2669,6 +2677,7 @@ export type ImageWideResolvers<ContextType = QueryContext, ParentType extends Re
|
|
|
2669
2677
|
|
|
2670
2678
|
export type IndicatorsResolvers<ContextType = QueryContext, ParentType extends ResolversParentTypes['Indicators'] = ResolversParentTypes['Indicators']> = ResolversObject<{
|
|
2671
2679
|
isOpinion: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
2680
|
+
isPartnerContent: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
2672
2681
|
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
|
2673
2682
|
}>;
|
|
2674
2683
|
|
|
@@ -105,4 +105,27 @@ describe('CAPI response', () => {
|
|
|
105
105
|
)
|
|
106
106
|
})
|
|
107
107
|
})
|
|
108
|
+
|
|
109
|
+
describe('Partner content type articles', () => {
|
|
110
|
+
test('should have `isPartnerContent` set correctly as `true` when correct publication id is set', () => {
|
|
111
|
+
const article = cloneDeep({
|
|
112
|
+
...baseCapiObject,
|
|
113
|
+
publication: [
|
|
114
|
+
'http://www.ft.com/thing/724b5e36-6d45-4cf1-b1c2-3f676b21f21b',
|
|
115
|
+
],
|
|
116
|
+
})
|
|
117
|
+
const capiResponse = new CapiResponse(article, context)
|
|
118
|
+
|
|
119
|
+
expect(capiResponse.isPartnerContent()).toBe(true)
|
|
120
|
+
})
|
|
121
|
+
test('should have `isPartnerContent` set correctly as `false` if publication field is not set', () => {
|
|
122
|
+
const article = cloneDeep({
|
|
123
|
+
...baseCapiObject,
|
|
124
|
+
publication: null,
|
|
125
|
+
})
|
|
126
|
+
const capiResponse = new CapiResponse(article, context)
|
|
127
|
+
|
|
128
|
+
expect(capiResponse.isPartnerContent()).toBe(false)
|
|
129
|
+
})
|
|
130
|
+
})
|
|
108
131
|
})
|
|
@@ -321,6 +321,14 @@ export class CapiResponse {
|
|
|
321
321
|
return null
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
isPartnerContent(): boolean | null {
|
|
325
|
+
return Boolean(
|
|
326
|
+
'publication' in this.capiData &&
|
|
327
|
+
this.capiData.publication?.[0] ===
|
|
328
|
+
'http://www.ft.com/thing/724b5e36-6d45-4cf1-b1c2-3f676b21f21b'
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
|
|
324
332
|
canBeSyndicated(): LiteralUnionScalarValues<typeof CanBeSyndicated> {
|
|
325
333
|
return this.capiData.canBeSyndicated
|
|
326
334
|
}
|
|
@@ -840,10 +848,10 @@ export class CapiResponse {
|
|
|
840
848
|
return null
|
|
841
849
|
}
|
|
842
850
|
|
|
843
|
-
|
|
844
|
-
if ('
|
|
845
|
-
return this.capiData.
|
|
851
|
+
publication(): string[] | null {
|
|
852
|
+
if ('publication' in this.capiData && this.capiData.publication) {
|
|
853
|
+
return this.capiData.publication
|
|
846
854
|
}
|
|
847
|
-
return
|
|
855
|
+
return null
|
|
848
856
|
}
|
|
849
857
|
}
|
package/src/resolvers/content.ts
CHANGED
|
@@ -73,6 +73,12 @@ const resolvers = {
|
|
|
73
73
|
Article: {
|
|
74
74
|
...contentResolvers,
|
|
75
75
|
containedIn: (parent) => parent.containedIn(),
|
|
76
|
+
publication: (parent) => parent.publication() ?? null,
|
|
77
|
+
indicators: (parent) => {
|
|
78
|
+
return {
|
|
79
|
+
isPartnerContent: parent.isPartnerContent(),
|
|
80
|
+
}
|
|
81
|
+
},
|
|
76
82
|
},
|
|
77
83
|
|
|
78
84
|
Placeholder: {
|
|
@@ -135,6 +141,7 @@ const resolvers = {
|
|
|
135
141
|
// it from other Indicators types in the next major release.
|
|
136
142
|
Indicators: {
|
|
137
143
|
isOpinion: (parent) => parent.isOpinion ?? null,
|
|
144
|
+
isPartnerContent: (parent) => parent.isPartnerContent ?? null,
|
|
138
145
|
},
|
|
139
146
|
|
|
140
147
|
Media: {
|