@financial-times/cp-content-pipeline-schema 2.10.0 → 2.10.2

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.
@@ -1,11 +1,50 @@
1
- export declare const placeholderSchema: import("zod").ZodObject<{
2
- id: import("zod").ZodString;
3
- type: import("zod").ZodOptional<import("zod").ZodString>;
4
- types: import("zod").ZodArray<import("zod").ZodString, "many">;
5
- standfirst: import("zod").ZodOptional<import("zod").ZodString>;
1
+ export declare const placeholderSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<Pick<{
6
2
  title: import("zod").ZodString;
7
- publishedDate: import("zod").ZodString;
8
- annotations: import("zod").ZodArray<import("zod").ZodObject<{
3
+ standfirst: import("zod").ZodOptional<import("zod").ZodString>;
4
+ byline: import("zod").ZodOptional<import("zod").ZodString>;
5
+ bodyXML: import("zod").ZodString;
6
+ summary: import("zod").ZodObject<{
7
+ bodyXML: import("zod").ZodString;
8
+ }, "strip", import("zod").ZodTypeAny, {
9
+ bodyXML: string;
10
+ }, {
11
+ bodyXML: string;
12
+ }>;
13
+ alternativeTitles: import("zod").ZodOptional<import("zod").ZodObject<{
14
+ promotionalTitle: import("zod").ZodString;
15
+ }, "strip", import("zod").ZodTypeAny, {
16
+ promotionalTitle: string;
17
+ }, {
18
+ promotionalTitle: string;
19
+ }>>;
20
+ alternativeStandfirsts: import("zod").ZodOptional<import("zod").ZodObject<{
21
+ promotionalStandfirst: import("zod").ZodOptional<import("zod").ZodString>;
22
+ }, "strip", import("zod").ZodTypeAny, {
23
+ promotionalStandfirst?: string | undefined;
24
+ }, {
25
+ promotionalStandfirst?: string | undefined;
26
+ }>>;
27
+ pinnedPosts: import("zod").ZodArray<import("zod").ZodString, "many">;
28
+ contains: import("zod").ZodArray<import("zod").ZodObject<{
29
+ id: import("zod").ZodString;
30
+ apiUrl: import("zod").ZodString;
31
+ }, "strip", import("zod").ZodTypeAny, {
32
+ id: string;
33
+ apiUrl: string;
34
+ }, {
35
+ id: string;
36
+ apiUrl: string;
37
+ }>, "many">;
38
+ design: import("zod").ZodObject<{
39
+ theme: import("zod").ZodUnion<[import("zod").ZodLiteral<"special-report">, import("zod").ZodLiteral<"extra">, import("zod").ZodLiteral<"basic">, import("zod").ZodLiteral<"extra-wide">]>;
40
+ }, "strip", import("zod").ZodTypeAny, {
41
+ theme: "special-report" | "extra" | "basic" | "extra-wide";
42
+ }, {
43
+ theme: "special-report" | "extra" | "basic" | "extra-wide";
44
+ }>;
45
+ }, "standfirst" | "title" | "byline" | "bodyXML" | "alternativeTitles" | "alternativeStandfirsts">, Pick<{
46
+ id: import("zod").ZodString;
47
+ annotations: import("zod").ZodArray<import("zod").ZodObject<import("zod").objectUtil.extendShape<{
9
48
  id: import("zod").ZodString;
10
49
  apiUrl: import("zod").ZodString;
11
50
  directType: import("zod").ZodString;
@@ -13,8 +52,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
13
52
  type: import("zod").ZodOptional<import("zod").ZodString>;
14
53
  types: import("zod").ZodArray<import("zod").ZodString, "many">;
15
54
  headshot: import("zod").ZodOptional<import("zod").ZodString>;
55
+ }, {
16
56
  predicate: import("zod").ZodString;
17
- }, "strip", import("zod").ZodTypeAny, {
57
+ }>, "strip", import("zod").ZodTypeAny, {
18
58
  id: string;
19
59
  apiUrl: string;
20
60
  directType: string;
@@ -35,6 +75,8 @@ export declare const placeholderSchema: import("zod").ZodObject<{
35
75
  }>, "many">;
36
76
  webUrl: import("zod").ZodOptional<import("zod").ZodString>;
37
77
  canonicalWebUrl: import("zod").ZodOptional<import("zod").ZodString>;
78
+ type: import("zod").ZodOptional<import("zod").ZodString>;
79
+ types: import("zod").ZodArray<import("zod").ZodString, "many">;
38
80
  standout: import("zod").ZodOptional<import("zod").ZodObject<{
39
81
  editorsChoice: import("zod").ZodBoolean;
40
82
  exclusive: import("zod").ZodBoolean;
@@ -48,7 +90,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
48
90
  exclusive: boolean;
49
91
  scoop: boolean;
50
92
  }>>;
93
+ publishedDate: import("zod").ZodString;
51
94
  firstPublishedDate: import("zod").ZodString;
95
+ realtime: import("zod").ZodBoolean;
52
96
  editorialDesk: import("zod").ZodOptional<import("zod").ZodString>;
53
97
  accessLevel: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"premium">, import("zod").ZodLiteral<"subscribed">, import("zod").ZodLiteral<"registered">, import("zod").ZodLiteral<"free">]>>;
54
98
  canBeSyndicated: import("zod").ZodUnion<[import("zod").ZodLiteral<"yes">, import("zod").ZodLiteral<"no">, import("zod").ZodLiteral<"verify">, import("zod").ZodLiteral<"withContributorPayment">, import("zod").ZodLiteral<"unknown">]>;
@@ -95,22 +139,17 @@ export declare const placeholderSchema: import("zod").ZodObject<{
95
139
  id: string;
96
140
  apiUrl: string;
97
141
  }>, "many">>;
98
- byline: import("zod").ZodOptional<import("zod").ZodString>;
99
- bodyXML: import("zod").ZodString;
100
- alternativeTitles: import("zod").ZodOptional<import("zod").ZodObject<{
101
- promotionalTitle: import("zod").ZodString;
102
- }, "strip", import("zod").ZodTypeAny, {
103
- promotionalTitle: string;
104
- }, {
105
- promotionalTitle: string;
106
- }>>;
107
- alternativeStandfirsts: import("zod").ZodOptional<import("zod").ZodObject<{
108
- promotionalStandfirst: import("zod").ZodOptional<import("zod").ZodString>;
142
+ tableOfContents: import("zod").ZodOptional<import("zod").ZodObject<{
143
+ labelType: import("zod").ZodString;
144
+ sequence: import("zod").ZodString;
109
145
  }, "strip", import("zod").ZodTypeAny, {
110
- promotionalStandfirst?: string | undefined;
146
+ labelType: string;
147
+ sequence: string;
111
148
  }, {
112
- promotionalStandfirst?: string | undefined;
149
+ labelType: string;
150
+ sequence: string;
113
151
  }>>;
152
+ }, "id" | "type" | "types" | "publishedDate" | "annotations" | "webUrl" | "canonicalWebUrl" | "standout" | "firstPublishedDate" | "editorialDesk" | "accessLevel" | "canBeSyndicated" | "canBeDistributed" | "topper" | "comments" | "containedIn">>, Pick<{
114
153
  mainImage: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
115
154
  id: import("zod").ZodString;
116
155
  type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/ImageSet">;
@@ -161,8 +200,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
161
200
  maxDisplayWidth?: string | undefined;
162
201
  pixelWidth?: number | undefined;
163
202
  pixelHeight?: number | undefined;
164
- }>, import("zod").ZodObject<{
203
+ }>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
165
204
  id: import("zod").ZodString;
205
+ type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Image">;
166
206
  format: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"standardInline">, import("zod").ZodLiteral<"mobile">, import("zod").ZodLiteral<"desktop">, import("zod").ZodLiteral<"standard">, import("zod").ZodLiteral<"square">, import("zod").ZodLiteral<"ftEditSquare">, import("zod").ZodLiteral<"wide">, import("zod").ZodLiteral<"portrait">, import("zod").ZodLiteral<"landscape">]>>;
167
207
  title: import("zod").ZodOptional<import("zod").ZodString>;
168
208
  description: import("zod").ZodOptional<import("zod").ZodString>;
@@ -178,8 +218,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
178
218
  maxDisplayWidth: import("zod").ZodOptional<import("zod").ZodString>;
179
219
  pixelWidth: import("zod").ZodOptional<import("zod").ZodNumber>;
180
220
  pixelHeight: import("zod").ZodOptional<import("zod").ZodNumber>;
221
+ }, {
181
222
  type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Graphic">;
182
- }, "strip", import("zod").ZodTypeAny, {
223
+ }>, "strip", import("zod").ZodTypeAny, {
183
224
  id: string;
184
225
  type: "http://www.ft.com/ontology/content/Graphic";
185
226
  binaryUrl: string;
@@ -320,8 +361,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
320
361
  maxDisplayWidth?: string | undefined;
321
362
  pixelWidth?: number | undefined;
322
363
  pixelHeight?: number | undefined;
323
- }>, import("zod").ZodObject<{
364
+ }>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
324
365
  id: import("zod").ZodString;
366
+ type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Image">;
325
367
  format: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"standardInline">, import("zod").ZodLiteral<"mobile">, import("zod").ZodLiteral<"desktop">, import("zod").ZodLiteral<"standard">, import("zod").ZodLiteral<"square">, import("zod").ZodLiteral<"ftEditSquare">, import("zod").ZodLiteral<"wide">, import("zod").ZodLiteral<"portrait">, import("zod").ZodLiteral<"landscape">]>>;
326
368
  title: import("zod").ZodOptional<import("zod").ZodString>;
327
369
  description: import("zod").ZodOptional<import("zod").ZodString>;
@@ -337,8 +379,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
337
379
  maxDisplayWidth: import("zod").ZodOptional<import("zod").ZodString>;
338
380
  pixelWidth: import("zod").ZodOptional<import("zod").ZodNumber>;
339
381
  pixelHeight: import("zod").ZodOptional<import("zod").ZodNumber>;
382
+ }, {
340
383
  type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Graphic">;
341
- }, "strip", import("zod").ZodTypeAny, {
384
+ }>, "strip", import("zod").ZodTypeAny, {
342
385
  id: string;
343
386
  type: "http://www.ft.com/ontology/content/Graphic";
344
387
  binaryUrl: string;
@@ -416,8 +459,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
416
459
  maxDisplayWidth?: string | undefined;
417
460
  pixelWidth?: number | undefined;
418
461
  pixelHeight?: number | undefined;
419
- }>, import("zod").ZodObject<{
462
+ }>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
420
463
  id: import("zod").ZodString;
464
+ type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Image">;
421
465
  format: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"standardInline">, import("zod").ZodLiteral<"mobile">, import("zod").ZodLiteral<"desktop">, import("zod").ZodLiteral<"standard">, import("zod").ZodLiteral<"square">, import("zod").ZodLiteral<"ftEditSquare">, import("zod").ZodLiteral<"wide">, import("zod").ZodLiteral<"portrait">, import("zod").ZodLiteral<"landscape">]>>;
422
466
  title: import("zod").ZodOptional<import("zod").ZodString>;
423
467
  description: import("zod").ZodOptional<import("zod").ZodString>;
@@ -433,8 +477,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
433
477
  maxDisplayWidth: import("zod").ZodOptional<import("zod").ZodString>;
434
478
  pixelWidth: import("zod").ZodOptional<import("zod").ZodNumber>;
435
479
  pixelHeight: import("zod").ZodOptional<import("zod").ZodNumber>;
480
+ }, {
436
481
  type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Graphic">;
437
- }, "strip", import("zod").ZodTypeAny, {
482
+ }>, "strip", import("zod").ZodTypeAny, {
438
483
  id: string;
439
484
  type: "http://www.ft.com/ontology/content/Graphic";
440
485
  binaryUrl: string;
@@ -609,6 +654,19 @@ export declare const placeholderSchema: import("zod").ZodObject<{
609
654
  pixelHeight?: number | undefined;
610
655
  };
611
656
  }>>;
657
+ leadFlourish: import("zod").ZodOptional<import("zod").ZodObject<{
658
+ id: import("zod").ZodString;
659
+ type: import("zod").ZodString;
660
+ description: import("zod").ZodString;
661
+ }, "strip", import("zod").ZodTypeAny, {
662
+ id: string;
663
+ type: string;
664
+ description: string;
665
+ }, {
666
+ id: string;
667
+ type: string;
668
+ description: string;
669
+ }>>;
612
670
  embeds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodObject<{
613
671
  id: import("zod").ZodString;
614
672
  type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/ImageSet">;
@@ -659,8 +717,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
659
717
  maxDisplayWidth?: string | undefined;
660
718
  pixelWidth?: number | undefined;
661
719
  pixelHeight?: number | undefined;
662
- }>, import("zod").ZodObject<{
720
+ }>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
663
721
  id: import("zod").ZodString;
722
+ type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Image">;
664
723
  format: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"standardInline">, import("zod").ZodLiteral<"mobile">, import("zod").ZodLiteral<"desktop">, import("zod").ZodLiteral<"standard">, import("zod").ZodLiteral<"square">, import("zod").ZodLiteral<"ftEditSquare">, import("zod").ZodLiteral<"wide">, import("zod").ZodLiteral<"portrait">, import("zod").ZodLiteral<"landscape">]>>;
665
724
  title: import("zod").ZodOptional<import("zod").ZodString>;
666
725
  description: import("zod").ZodOptional<import("zod").ZodString>;
@@ -676,8 +735,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
676
735
  maxDisplayWidth: import("zod").ZodOptional<import("zod").ZodString>;
677
736
  pixelWidth: import("zod").ZodOptional<import("zod").ZodNumber>;
678
737
  pixelHeight: import("zod").ZodOptional<import("zod").ZodNumber>;
738
+ }, {
679
739
  type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Graphic">;
680
- }, "strip", import("zod").ZodTypeAny, {
740
+ }>, "strip", import("zod").ZodTypeAny, {
681
741
  id: string;
682
742
  type: "http://www.ft.com/ontology/content/Graphic";
683
743
  binaryUrl: string;
@@ -788,20 +848,20 @@ export declare const placeholderSchema: import("zod").ZodObject<{
788
848
  pixelWidth: import("zod").ZodOptional<import("zod").ZodNumber>;
789
849
  videoCodec: import("zod").ZodOptional<import("zod").ZodString>;
790
850
  }, "strip", import("zod").ZodTypeAny, {
791
- audioCodec?: string | undefined;
792
851
  binaryUrl?: string | undefined;
852
+ pixelWidth?: number | undefined;
853
+ pixelHeight?: number | undefined;
854
+ audioCodec?: string | undefined;
793
855
  duration?: number | undefined;
794
856
  mediaType?: string | undefined;
795
- pixelHeight?: number | undefined;
796
- pixelWidth?: number | undefined;
797
857
  videoCodec?: string | undefined;
798
858
  }, {
799
- audioCodec?: string | undefined;
800
859
  binaryUrl?: string | undefined;
860
+ pixelWidth?: number | undefined;
861
+ pixelHeight?: number | undefined;
862
+ audioCodec?: string | undefined;
801
863
  duration?: number | undefined;
802
864
  mediaType?: string | undefined;
803
- pixelHeight?: number | undefined;
804
- pixelWidth?: number | undefined;
805
865
  videoCodec?: string | undefined;
806
866
  }>, "many">;
807
867
  poster: import("zod").ZodOptional<import("zod").ZodObject<{
@@ -854,8 +914,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
854
914
  maxDisplayWidth?: string | undefined;
855
915
  pixelWidth?: number | undefined;
856
916
  pixelHeight?: number | undefined;
857
- }>, import("zod").ZodObject<{
917
+ }>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
858
918
  id: import("zod").ZodString;
919
+ type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Image">;
859
920
  format: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"standardInline">, import("zod").ZodLiteral<"mobile">, import("zod").ZodLiteral<"desktop">, import("zod").ZodLiteral<"standard">, import("zod").ZodLiteral<"square">, import("zod").ZodLiteral<"ftEditSquare">, import("zod").ZodLiteral<"wide">, import("zod").ZodLiteral<"portrait">, import("zod").ZodLiteral<"landscape">]>>;
860
921
  title: import("zod").ZodOptional<import("zod").ZodString>;
861
922
  description: import("zod").ZodOptional<import("zod").ZodString>;
@@ -871,8 +932,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
871
932
  maxDisplayWidth: import("zod").ZodOptional<import("zod").ZodString>;
872
933
  pixelWidth: import("zod").ZodOptional<import("zod").ZodNumber>;
873
934
  pixelHeight: import("zod").ZodOptional<import("zod").ZodNumber>;
935
+ }, {
874
936
  type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Graphic">;
875
- }, "strip", import("zod").ZodTypeAny, {
937
+ }>, "strip", import("zod").ZodTypeAny, {
876
938
  id: string;
877
939
  type: "http://www.ft.com/ontology/content/Graphic";
878
940
  binaryUrl: string;
@@ -972,12 +1034,12 @@ export declare const placeholderSchema: import("zod").ZodObject<{
972
1034
  id: string;
973
1035
  type: "http://www.ft.com/ontology/content/Clip";
974
1036
  dataSource: {
975
- audioCodec?: string | undefined;
976
1037
  binaryUrl?: string | undefined;
1038
+ pixelWidth?: number | undefined;
1039
+ pixelHeight?: number | undefined;
1040
+ audioCodec?: string | undefined;
977
1041
  duration?: number | undefined;
978
1042
  mediaType?: string | undefined;
979
- pixelHeight?: number | undefined;
980
- pixelWidth?: number | undefined;
981
1043
  videoCodec?: string | undefined;
982
1044
  }[];
983
1045
  format?: "standardInline" | "mobile" | undefined;
@@ -1019,12 +1081,12 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1019
1081
  id: string;
1020
1082
  type: "http://www.ft.com/ontology/content/Clip";
1021
1083
  dataSource: {
1022
- audioCodec?: string | undefined;
1023
1084
  binaryUrl?: string | undefined;
1085
+ pixelWidth?: number | undefined;
1086
+ pixelHeight?: number | undefined;
1087
+ audioCodec?: string | undefined;
1024
1088
  duration?: number | undefined;
1025
1089
  mediaType?: string | undefined;
1026
- pixelHeight?: number | undefined;
1027
- pixelWidth?: number | undefined;
1028
1090
  videoCodec?: string | undefined;
1029
1091
  }[];
1030
1092
  format?: "standardInline" | "mobile" | undefined;
@@ -1104,12 +1166,12 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1104
1166
  id: string;
1105
1167
  type: "http://www.ft.com/ontology/content/Clip";
1106
1168
  dataSource: {
1107
- audioCodec?: string | undefined;
1108
1169
  binaryUrl?: string | undefined;
1170
+ pixelWidth?: number | undefined;
1171
+ pixelHeight?: number | undefined;
1172
+ audioCodec?: string | undefined;
1109
1173
  duration?: number | undefined;
1110
1174
  mediaType?: string | undefined;
1111
- pixelHeight?: number | undefined;
1112
- pixelWidth?: number | undefined;
1113
1175
  videoCodec?: string | undefined;
1114
1176
  }[];
1115
1177
  format?: "standardInline" | "mobile" | undefined;
@@ -1148,9 +1210,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1148
1210
  description?: string | undefined;
1149
1211
  } | undefined;
1150
1212
  }[];
1213
+ description?: string | undefined;
1151
1214
  caption?: string | undefined;
1152
1215
  dataCopyright?: string | undefined;
1153
- description?: string | undefined;
1154
1216
  displayTitle?: string | undefined;
1155
1217
  contentWarning?: string[] | undefined;
1156
1218
  noAudio?: boolean | undefined;
@@ -1171,12 +1233,12 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1171
1233
  id: string;
1172
1234
  type: "http://www.ft.com/ontology/content/Clip";
1173
1235
  dataSource: {
1174
- audioCodec?: string | undefined;
1175
1236
  binaryUrl?: string | undefined;
1237
+ pixelWidth?: number | undefined;
1238
+ pixelHeight?: number | undefined;
1239
+ audioCodec?: string | undefined;
1176
1240
  duration?: number | undefined;
1177
1241
  mediaType?: string | undefined;
1178
- pixelHeight?: number | undefined;
1179
- pixelWidth?: number | undefined;
1180
1242
  videoCodec?: string | undefined;
1181
1243
  }[];
1182
1244
  format?: "standardInline" | "mobile" | undefined;
@@ -1215,9 +1277,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1215
1277
  description?: string | undefined;
1216
1278
  } | undefined;
1217
1279
  }[];
1280
+ description?: string | undefined;
1218
1281
  caption?: string | undefined;
1219
1282
  dataCopyright?: string | undefined;
1220
- description?: string | undefined;
1221
1283
  displayTitle?: string | undefined;
1222
1284
  contentWarning?: string[] | undefined;
1223
1285
  noAudio?: boolean | undefined;
@@ -1232,7 +1294,23 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1232
1294
  transcript?: string | undefined;
1233
1295
  } | undefined;
1234
1296
  }>]>, "many">>;
1235
- }, "strip", import("zod").ZodTypeAny, {
1297
+ dataSource: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
1298
+ binaryUrl: import("zod").ZodString;
1299
+ duration: import("zod").ZodNumber;
1300
+ filesize: import("zod").ZodNumber;
1301
+ mediaType: import("zod").ZodString;
1302
+ }, "strip", import("zod").ZodTypeAny, {
1303
+ binaryUrl: string;
1304
+ duration: number;
1305
+ mediaType: string;
1306
+ filesize: number;
1307
+ }, {
1308
+ binaryUrl: string;
1309
+ duration: number;
1310
+ mediaType: string;
1311
+ filesize: number;
1312
+ }>, "many">>;
1313
+ }, "mainImage" | "leadImages" | "alternativeImages" | "embeds">>, "strip", import("zod").ZodTypeAny, {
1236
1314
  id: string;
1237
1315
  types: string[];
1238
1316
  title: string;
@@ -1437,12 +1515,12 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1437
1515
  id: string;
1438
1516
  type: "http://www.ft.com/ontology/content/Clip";
1439
1517
  dataSource: {
1440
- audioCodec?: string | undefined;
1441
1518
  binaryUrl?: string | undefined;
1519
+ pixelWidth?: number | undefined;
1520
+ pixelHeight?: number | undefined;
1521
+ audioCodec?: string | undefined;
1442
1522
  duration?: number | undefined;
1443
1523
  mediaType?: string | undefined;
1444
- pixelHeight?: number | undefined;
1445
- pixelWidth?: number | undefined;
1446
1524
  videoCodec?: string | undefined;
1447
1525
  }[];
1448
1526
  format?: "standardInline" | "mobile" | undefined;
@@ -1481,9 +1559,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1481
1559
  description?: string | undefined;
1482
1560
  } | undefined;
1483
1561
  }[];
1562
+ description?: string | undefined;
1484
1563
  caption?: string | undefined;
1485
1564
  dataCopyright?: string | undefined;
1486
- description?: string | undefined;
1487
1565
  displayTitle?: string | undefined;
1488
1566
  contentWarning?: string[] | undefined;
1489
1567
  noAudio?: boolean | undefined;
@@ -1703,12 +1781,12 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1703
1781
  id: string;
1704
1782
  type: "http://www.ft.com/ontology/content/Clip";
1705
1783
  dataSource: {
1706
- audioCodec?: string | undefined;
1707
1784
  binaryUrl?: string | undefined;
1785
+ pixelWidth?: number | undefined;
1786
+ pixelHeight?: number | undefined;
1787
+ audioCodec?: string | undefined;
1708
1788
  duration?: number | undefined;
1709
1789
  mediaType?: string | undefined;
1710
- pixelHeight?: number | undefined;
1711
- pixelWidth?: number | undefined;
1712
1790
  videoCodec?: string | undefined;
1713
1791
  }[];
1714
1792
  format?: "standardInline" | "mobile" | undefined;
@@ -1747,9 +1825,9 @@ export declare const placeholderSchema: import("zod").ZodObject<{
1747
1825
  description?: string | undefined;
1748
1826
  } | undefined;
1749
1827
  }[];
1828
+ description?: string | undefined;
1750
1829
  caption?: string | undefined;
1751
1830
  dataCopyright?: string | undefined;
1752
- description?: string | undefined;
1753
1831
  displayTitle?: string | undefined;
1754
1832
  contentWarning?: string[] | undefined;
1755
1833
  noAudio?: boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/cp-content-pipeline-schema",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -0,0 +1,54 @@
1
+ import { Logger } from '@dotcom-reliability-kit/logger'
2
+ import { CapiDataSource } from './capi'
3
+ import { QueryContext } from '..'
4
+ import { KeyValueCache } from '@apollo/utils.keyvaluecache'
5
+ import { CapiResponse } from '../model/CapiResponse'
6
+ import { ContentTypeSchemas } from '../types/internal-content'
7
+
8
+ const logger = new Logger()
9
+ const metrics = { count: jest.fn() }
10
+
11
+ describe('CapiDataSource', () => {
12
+ describe('cache keys', () => {
13
+ it('should return the same cache key that it actually stored in the cache', async () => {
14
+ const id = '00000000-0000-0000-0000-000000000000'
15
+ const cache = {
16
+ get: jest.fn(),
17
+ set: jest.fn(),
18
+ delete: jest.fn(),
19
+ } satisfies KeyValueCache
20
+ const capi = new CapiDataSource({
21
+ cache,
22
+ context: {
23
+ versions: { api: '1.0.0', schema: '1.0.0' },
24
+ logger,
25
+ metrics,
26
+ } as unknown as QueryContext,
27
+ })
28
+
29
+ jest.spyOn(global, 'fetch').mockResolvedValue(
30
+ new Response(JSON.stringify({ id }), {
31
+ headers: new Headers([['content-type', 'application/json']]),
32
+ })
33
+ )
34
+
35
+ jest
36
+ .spyOn(CapiResponse, 'fromJSON')
37
+ .mockImplementation(
38
+ (content, context) =>
39
+ new CapiResponse(content as ContentTypeSchemas, context)
40
+ )
41
+
42
+ await capi.getContent(id)
43
+
44
+ expect(cache.set).toBeCalled()
45
+ await expect(capi.getHTTPCacheKeyForContent(id)).resolves.toBe(
46
+ cache.set.mock.lastCall?.[0]
47
+ )
48
+ })
49
+ })
50
+
51
+ afterAll(() => {
52
+ jest.resetAllMocks()
53
+ })
54
+ })
@@ -2,9 +2,24 @@ import { CapiResponse } from '../model/CapiResponse'
2
2
  import { InstrumentedRESTDataSource } from './instrumented'
3
3
  import { CapiPerson } from '../types/internal-content'
4
4
  import { AugmentedRequest } from '@apollo/datasource-rest'
5
+ import {
6
+ KeyValueCache,
7
+ PrefixingKeyValueCache,
8
+ } from '@apollo/utils.keyvaluecache'
5
9
 
6
10
  const REQUEST_TIMEOUT = 5000 // 5 seconds
7
11
 
12
+ const isPrefixing = (cache: KeyValueCache): cache is PrefixingKeyValueCache =>
13
+ 'prefix' in cache
14
+
15
+ function getWrappedCacheKey(cache: KeyValueCache): string {
16
+ if (isPrefixing(cache)) {
17
+ return getWrappedCacheKey(cache['wrapped']) + cache['prefix']
18
+ }
19
+
20
+ return ''
21
+ }
22
+
8
23
  export class CapiDataSource extends InstrumentedRESTDataSource {
9
24
  baseURL = process.env.CAPI_URL || 'https://api-t.ft.com/'
10
25
  capiKey = process.env.CAPI_API_KEY || ''
@@ -56,4 +71,18 @@ export class CapiDataSource extends InstrumentedRESTDataSource {
56
71
  cacheOptions: { ttl: this.peopleCacheTTL },
57
72
  })
58
73
  }
74
+
75
+ // replicates the logic implicit in PrefixingKeyValueCache to
76
+ // construct a cache key for an article used to purge Redis
77
+ async getHTTPCacheKeyForContent(uuid: string) {
78
+ const dummyRequest: AugmentedRequest = {
79
+ params: new URLSearchParams(),
80
+ headers: {},
81
+ }
82
+ const cacheKey = this.cacheKeyFor(
83
+ await this.resolveURL(`internalcontent/${uuid}`, dummyRequest)
84
+ )
85
+
86
+ return `${getWrappedCacheKey(this.httpCache['keyValueCache'])}${cacheKey}`
87
+ }
59
88
  }
@@ -10,7 +10,6 @@ const contentPackageContentSchema = baseContentSchema
10
10
  summary: true,
11
11
  alternativeTitles: true,
12
12
  contains: true,
13
- tableOfContents: true,
14
13
  design: true,
15
14
  bodyXML: true,
16
15
  })
@@ -11,7 +11,6 @@ const liveBlogPackageContentSchema = baseContentSchema.pick({
11
11
  alternativeTitles: true,
12
12
  contains: true,
13
13
  pinnedPosts: true,
14
- realtime: true,
15
14
  })
16
15
 
17
16
  const liveBlogPackageMetadataSchema = baseMetadataSchema.pick({