@financial-times/cp-content-pipeline-schema 3.1.0 → 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 +14 -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/Concept.js +5 -1
- package/lib/model/Concept.js.map +1 -1
- package/lib/model/Concept.test.js +5 -0
- package/lib/model/Concept.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/Concept.test.ts +8 -0
- package/src/model/Concept.ts +7 -1
- 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
|
@@ -157,6 +157,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
157
157
|
labelType: string;
|
|
158
158
|
sequence: string;
|
|
159
159
|
}>>;
|
|
160
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
160
161
|
}, "id" | "type" | "types" | "publishedDate" | "annotations" | "webUrl" | "canonicalWebUrl" | "standout" | "firstPublishedDate" | "publishReference" | "lastModified" | "editorialDesk" | "accessLevel" | "canBeSyndicated" | "canBeDistributed" | "topper" | "comments" | "containedIn">>, Pick<{
|
|
161
162
|
mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
|
|
162
163
|
id: import("zod").ZodString;
|
|
@@ -1413,6 +1414,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
1413
1414
|
labelType: string;
|
|
1414
1415
|
sequence: string;
|
|
1415
1416
|
}>>;
|
|
1417
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
1416
1418
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
1417
1419
|
title: import("zod").ZodString;
|
|
1418
1420
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -2230,6 +2232,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
2230
2232
|
labelType: string;
|
|
2231
2233
|
sequence: string;
|
|
2232
2234
|
}>>;
|
|
2235
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
2233
2236
|
}, "id" | "type" | "types" | "publishedDate" | "annotations" | "webUrl" | "canonicalWebUrl" | "standout" | "firstPublishedDate" | "publishReference" | "lastModified" | "editorialDesk" | "accessLevel" | "canBeSyndicated" | "canBeDistributed" | "topper" | "comments">>, Pick<{
|
|
2234
2237
|
mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
|
|
2235
2238
|
id: import("zod").ZodString;
|
|
@@ -3486,6 +3489,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
3486
3489
|
labelType: string;
|
|
3487
3490
|
sequence: string;
|
|
3488
3491
|
}>>;
|
|
3492
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
3489
3493
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
3490
3494
|
title: import("zod").ZodString;
|
|
3491
3495
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -4267,6 +4271,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
4267
4271
|
labelType: string;
|
|
4268
4272
|
sequence: string;
|
|
4269
4273
|
}>>;
|
|
4274
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
4270
4275
|
}, "id" | "types" | "publishedDate" | "annotations" | "webUrl" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "lastModified" | "editorialDesk" | "accessLevel" | "canBeSyndicated" | "canBeDistributed">>, Pick<{
|
|
4271
4276
|
mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
|
|
4272
4277
|
id: import("zod").ZodString;
|
|
@@ -5523,6 +5528,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
5523
5528
|
labelType: string;
|
|
5524
5529
|
sequence: string;
|
|
5525
5530
|
}>>;
|
|
5531
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
5526
5532
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
5527
5533
|
title: import("zod").ZodString;
|
|
5528
5534
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -5968,6 +5974,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
5968
5974
|
labelType: string;
|
|
5969
5975
|
sequence: string;
|
|
5970
5976
|
}>>;
|
|
5977
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
5971
5978
|
}, "id" | "types" | "publishedDate" | "annotations" | "webUrl" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "lastModified" | "editorialDesk" | "accessLevel" | "canBeSyndicated" | "canBeDistributed">>, Pick<{
|
|
5972
5979
|
mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
|
|
5973
5980
|
id: import("zod").ZodString;
|
|
@@ -7224,6 +7231,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
7224
7231
|
labelType: string;
|
|
7225
7232
|
sequence: string;
|
|
7226
7233
|
}>>;
|
|
7234
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
7227
7235
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
7228
7236
|
title: import("zod").ZodString;
|
|
7229
7237
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -7614,6 +7622,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
7614
7622
|
labelType: string;
|
|
7615
7623
|
sequence: string;
|
|
7616
7624
|
}>>;
|
|
7625
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
7617
7626
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
7618
7627
|
title: import("zod").ZodString;
|
|
7619
7628
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -7777,6 +7786,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
7777
7786
|
labelType: string;
|
|
7778
7787
|
sequence: string;
|
|
7779
7788
|
}>>;
|
|
7789
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
7780
7790
|
}, "types" | "annotations">>, Pick<{
|
|
7781
7791
|
mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
|
|
7782
7792
|
id: import("zod").ZodString;
|
|
@@ -9033,6 +9043,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
9033
9043
|
labelType: string;
|
|
9034
9044
|
sequence: string;
|
|
9035
9045
|
}>>;
|
|
9046
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
9036
9047
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
9037
9048
|
title: import("zod").ZodString;
|
|
9038
9049
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -9572,6 +9583,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
9572
9583
|
labelType: string;
|
|
9573
9584
|
sequence: string;
|
|
9574
9585
|
}>>;
|
|
9586
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
9575
9587
|
}, "id" | "type" | "types" | "publishedDate" | "annotations" | "webUrl" | "canonicalWebUrl" | "standout" | "firstPublishedDate" | "publishReference" | "lastModified" | "editorialDesk" | "accessLevel" | "canBeSyndicated" | "canBeDistributed" | "topper" | "comments" | "tableOfContents">>, Pick<{
|
|
9576
9588
|
mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
|
|
9577
9589
|
id: import("zod").ZodString;
|
|
@@ -10828,6 +10840,7 @@ export declare const schemas: (contentType: LiteralUnionScalarValues<typeof Cont
|
|
|
10828
10840
|
labelType: string;
|
|
10829
10841
|
sequence: string;
|
|
10830
10842
|
}>>;
|
|
10843
|
+
publication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
10831
10844
|
}, "id" | "publishedDate" | "canonicalWebUrl" | "firstPublishedDate" | "publishReference" | "canBeSyndicated" | "canBeDistributed">, Pick<{
|
|
10832
10845
|
title: import("zod").ZodString;
|
|
10833
10846
|
standfirst: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -25,12 +25,12 @@ export declare const listSchema: z.ZodObject<{
|
|
|
25
25
|
publishedDate: string;
|
|
26
26
|
listType: "OpinionAnalysis" | "Promotional" | "Recommended" | "TopStories" | "TopStoriesBeta" | "KeyDevelopments";
|
|
27
27
|
publishReference?: string | undefined;
|
|
28
|
+
publication?: string[] | undefined;
|
|
28
29
|
items?: {
|
|
29
30
|
id: string;
|
|
30
31
|
apiUrl: string;
|
|
31
32
|
}[] | undefined;
|
|
32
33
|
layoutHint?: "landscape" | "standaloneimage" | "bigstory" | "assassination" | undefined;
|
|
33
|
-
publication?: string[] | undefined;
|
|
34
34
|
}, {
|
|
35
35
|
id: string;
|
|
36
36
|
apiUrl: string;
|
|
@@ -38,11 +38,11 @@ export declare const listSchema: z.ZodObject<{
|
|
|
38
38
|
publishedDate: string;
|
|
39
39
|
listType: "OpinionAnalysis" | "Promotional" | "Recommended" | "TopStories" | "TopStoriesBeta" | "KeyDevelopments";
|
|
40
40
|
publishReference?: string | undefined;
|
|
41
|
+
publication?: string[] | undefined;
|
|
41
42
|
items?: {
|
|
42
43
|
id: string;
|
|
43
44
|
apiUrl: string;
|
|
44
45
|
}[] | undefined;
|
|
45
46
|
layoutHint?: "landscape" | "standaloneimage" | "bigstory" | "assassination" | undefined;
|
|
46
|
-
publication?: string[] | undefined;
|
|
47
47
|
}>;
|
|
48
48
|
export type List = z.input<typeof listSchema>;
|
|
@@ -155,6 +155,7 @@ export declare const liveBlogPackageSchema: import("zod").ZodObject<import("zod"
|
|
|
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">>, 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 liveBlogPackageSchema: import("zod").ZodObject<import("zod"
|
|
|
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 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,MAAM,CAAC,OAAO,EAAE;IACrC,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAC7C,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,eAAe,EAAE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AAE,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
|
}
|
|
@@ -73,5 +73,13 @@ describe('Concept model', () => {
|
|
|
73
73
|
'/vanity-url'
|
|
74
74
|
)
|
|
75
75
|
})
|
|
76
|
+
|
|
77
|
+
it('returns the full vanity URL when vanity=true and relative=true but vanity URL host is not www.ft.com', async () => {
|
|
78
|
+
const model = new Concept(topic, context)
|
|
79
|
+
vanityMock.mockResolvedValue('https://professional-monetary-policy-radar.ft.com')
|
|
80
|
+
expect(await model.url({ vanity: true, relative: true })).toEqual(
|
|
81
|
+
'https://professional-monetary-policy-radar.ft.com'
|
|
82
|
+
)
|
|
83
|
+
})
|
|
76
84
|
})
|
|
77
85
|
})
|
package/src/model/Concept.ts
CHANGED
|
@@ -162,7 +162,13 @@ export class Concept {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
if (args?.relative) {
|
|
165
|
-
|
|
165
|
+
const urlObject = new URL(url)
|
|
166
|
+
|
|
167
|
+
if (urlObject.host === 'www.ft.com') {
|
|
168
|
+
return urlObject.pathname
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return url
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
return url
|
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: {
|