@financial-times/cp-content-pipeline-schema 1.3.3 → 1.3.4
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 +8 -0
- package/lib/model/CapiResponse.d.ts +1 -0
- package/lib/model/CapiResponse.js +18 -10
- package/lib/model/CapiResponse.js.map +1 -1
- package/lib/model/schemas/capi/article.d.ts +115 -0
- package/lib/model/schemas/capi/article.js +1 -0
- package/lib/model/schemas/capi/article.js.map +1 -1
- package/lib/model/schemas/capi/base-schema.d.ts +196 -0
- package/lib/model/schemas/capi/base-schema.js +5 -1
- package/lib/model/schemas/capi/base-schema.js.map +1 -1
- package/lib/model/schemas/capi/placeholder.d.ts +115 -0
- package/lib/model/schemas/capi/placeholder.js +1 -0
- package/lib/model/schemas/capi/placeholder.js.map +1 -1
- package/lib/resolvers/teaser.js +1 -1
- package/lib/resolvers/teaser.js.map +1 -1
- package/package.json +1 -1
- package/src/model/CapiResponse.ts +19 -10
- package/src/model/schemas/capi/article.ts +1 -0
- package/src/model/schemas/capi/base-schema.ts +5 -0
- package/src/model/schemas/capi/placeholder.ts +1 -0
- package/src/resolvers/teaser.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -523,6 +523,87 @@ export declare const placeholderSchema: import("zod").ZodObject<{
|
|
|
523
523
|
pixelHeight?: number | undefined;
|
|
524
524
|
};
|
|
525
525
|
}>, "many">>;
|
|
526
|
+
alternativeImages: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
527
|
+
promotionalImage: import("zod").ZodObject<{
|
|
528
|
+
id: import("zod").ZodString;
|
|
529
|
+
type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/Image">;
|
|
530
|
+
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">]>>;
|
|
531
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
532
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
533
|
+
binaryUrl: import("zod").ZodString;
|
|
534
|
+
copyright: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
535
|
+
notice: import("zod").ZodString;
|
|
536
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
537
|
+
notice: string;
|
|
538
|
+
}, {
|
|
539
|
+
notice: string;
|
|
540
|
+
}>>;
|
|
541
|
+
minDisplayWidth: import("zod").ZodOptional<import("zod").ZodString>;
|
|
542
|
+
maxDisplayWidth: import("zod").ZodOptional<import("zod").ZodString>;
|
|
543
|
+
pixelWidth: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
544
|
+
pixelHeight: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
545
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
546
|
+
id: string;
|
|
547
|
+
type: "http://www.ft.com/ontology/content/Image";
|
|
548
|
+
binaryUrl: string;
|
|
549
|
+
format?: "standardInline" | "mobile" | "desktop" | "standard" | "square" | "ftEditSquare" | "wide" | "portrait" | "landscape" | undefined;
|
|
550
|
+
title?: string | undefined;
|
|
551
|
+
description?: string | undefined;
|
|
552
|
+
copyright?: {
|
|
553
|
+
notice: string;
|
|
554
|
+
} | undefined;
|
|
555
|
+
minDisplayWidth?: string | undefined;
|
|
556
|
+
maxDisplayWidth?: string | undefined;
|
|
557
|
+
pixelWidth?: number | undefined;
|
|
558
|
+
pixelHeight?: number | undefined;
|
|
559
|
+
}, {
|
|
560
|
+
id: string;
|
|
561
|
+
type: "http://www.ft.com/ontology/content/Image";
|
|
562
|
+
binaryUrl: string;
|
|
563
|
+
format?: "standardInline" | "mobile" | "desktop" | "standard" | "square" | "ftEditSquare" | "wide" | "portrait" | "landscape" | undefined;
|
|
564
|
+
title?: string | undefined;
|
|
565
|
+
description?: string | undefined;
|
|
566
|
+
copyright?: {
|
|
567
|
+
notice: string;
|
|
568
|
+
} | undefined;
|
|
569
|
+
minDisplayWidth?: string | undefined;
|
|
570
|
+
maxDisplayWidth?: string | undefined;
|
|
571
|
+
pixelWidth?: number | undefined;
|
|
572
|
+
pixelHeight?: number | undefined;
|
|
573
|
+
}>;
|
|
574
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
575
|
+
promotionalImage: {
|
|
576
|
+
id: string;
|
|
577
|
+
type: "http://www.ft.com/ontology/content/Image";
|
|
578
|
+
binaryUrl: string;
|
|
579
|
+
format?: "standardInline" | "mobile" | "desktop" | "standard" | "square" | "ftEditSquare" | "wide" | "portrait" | "landscape" | undefined;
|
|
580
|
+
title?: string | undefined;
|
|
581
|
+
description?: string | undefined;
|
|
582
|
+
copyright?: {
|
|
583
|
+
notice: string;
|
|
584
|
+
} | undefined;
|
|
585
|
+
minDisplayWidth?: string | undefined;
|
|
586
|
+
maxDisplayWidth?: string | undefined;
|
|
587
|
+
pixelWidth?: number | undefined;
|
|
588
|
+
pixelHeight?: number | undefined;
|
|
589
|
+
};
|
|
590
|
+
}, {
|
|
591
|
+
promotionalImage: {
|
|
592
|
+
id: string;
|
|
593
|
+
type: "http://www.ft.com/ontology/content/Image";
|
|
594
|
+
binaryUrl: string;
|
|
595
|
+
format?: "standardInline" | "mobile" | "desktop" | "standard" | "square" | "ftEditSquare" | "wide" | "portrait" | "landscape" | undefined;
|
|
596
|
+
title?: string | undefined;
|
|
597
|
+
description?: string | undefined;
|
|
598
|
+
copyright?: {
|
|
599
|
+
notice: string;
|
|
600
|
+
} | undefined;
|
|
601
|
+
minDisplayWidth?: string | undefined;
|
|
602
|
+
maxDisplayWidth?: string | undefined;
|
|
603
|
+
pixelWidth?: number | undefined;
|
|
604
|
+
pixelHeight?: number | undefined;
|
|
605
|
+
};
|
|
606
|
+
}>>;
|
|
526
607
|
embeds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
527
608
|
id: import("zod").ZodString;
|
|
528
609
|
type: import("zod").ZodLiteral<"http://www.ft.com/ontology/content/ImageSet">;
|
|
@@ -832,6 +913,23 @@ export declare const placeholderSchema: import("zod").ZodObject<{
|
|
|
832
913
|
pixelHeight?: number | undefined;
|
|
833
914
|
};
|
|
834
915
|
}[] | undefined;
|
|
916
|
+
alternativeImages?: {
|
|
917
|
+
promotionalImage: {
|
|
918
|
+
id: string;
|
|
919
|
+
type: "http://www.ft.com/ontology/content/Image";
|
|
920
|
+
binaryUrl: string;
|
|
921
|
+
format?: "standardInline" | "mobile" | "desktop" | "standard" | "square" | "ftEditSquare" | "wide" | "portrait" | "landscape" | undefined;
|
|
922
|
+
title?: string | undefined;
|
|
923
|
+
description?: string | undefined;
|
|
924
|
+
copyright?: {
|
|
925
|
+
notice: string;
|
|
926
|
+
} | undefined;
|
|
927
|
+
minDisplayWidth?: string | undefined;
|
|
928
|
+
maxDisplayWidth?: string | undefined;
|
|
929
|
+
pixelWidth?: number | undefined;
|
|
930
|
+
pixelHeight?: number | undefined;
|
|
931
|
+
};
|
|
932
|
+
} | undefined;
|
|
835
933
|
embeds?: {
|
|
836
934
|
id: string;
|
|
837
935
|
type: "http://www.ft.com/ontology/content/ImageSet";
|
|
@@ -1011,6 +1109,23 @@ export declare const placeholderSchema: import("zod").ZodObject<{
|
|
|
1011
1109
|
pixelHeight?: number | undefined;
|
|
1012
1110
|
};
|
|
1013
1111
|
}[] | undefined;
|
|
1112
|
+
alternativeImages?: {
|
|
1113
|
+
promotionalImage: {
|
|
1114
|
+
id: string;
|
|
1115
|
+
type: "http://www.ft.com/ontology/content/Image";
|
|
1116
|
+
binaryUrl: string;
|
|
1117
|
+
format?: "standardInline" | "mobile" | "desktop" | "standard" | "square" | "ftEditSquare" | "wide" | "portrait" | "landscape" | undefined;
|
|
1118
|
+
title?: string | undefined;
|
|
1119
|
+
description?: string | undefined;
|
|
1120
|
+
copyright?: {
|
|
1121
|
+
notice: string;
|
|
1122
|
+
} | undefined;
|
|
1123
|
+
minDisplayWidth?: string | undefined;
|
|
1124
|
+
maxDisplayWidth?: string | undefined;
|
|
1125
|
+
pixelWidth?: number | undefined;
|
|
1126
|
+
pixelHeight?: number | undefined;
|
|
1127
|
+
};
|
|
1128
|
+
} | undefined;
|
|
1014
1129
|
embeds?: {
|
|
1015
1130
|
id: string;
|
|
1016
1131
|
type: "http://www.ft.com/ontology/content/ImageSet";
|
|
@@ -29,6 +29,7 @@ const placeholderMetadataSchema = base_schema_1.baseMetadataSchema.pick({
|
|
|
29
29
|
const placeholderMediaSchema = base_schema_1.baseMediaSchema.pick({
|
|
30
30
|
mainImage: true,
|
|
31
31
|
leadImages: true,
|
|
32
|
+
alternativeImages: true,
|
|
32
33
|
embeds: true,
|
|
33
34
|
});
|
|
34
35
|
exports.placeholderSchema = placeholderContentSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placeholder.js","sourceRoot":"","sources":["../../../../src/model/schemas/capi/placeholder.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;AAEtB,MAAM,wBAAwB,GAAG,+BAAiB,CAAC,IAAI,CAAC;IACtD,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,iBAAiB,EAAE,IAAI;IACvB,sBAAsB,EAAE,IAAI;CAC7B,CAAC,CAAA;AAEF,MAAM,yBAAyB,GAAG,gCAAkB,CAAC,IAAI,CAAC;IACxD,EAAE,EAAE,IAAI;IACR,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;IACZ,eAAe,EAAE,IAAI;IACrB,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;IACxB,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,IAAI;CAClB,CAAC,CAAA;AAEF,MAAM,sBAAsB,GAAG,6BAAe,CAAC,IAAI,CAAC;IAClD,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;CACb,CAAC,CAAA;AAEW,QAAA,iBAAiB,GAAG,wBAAwB;KACtD,KAAK,CAAC,yBAAyB,CAAC;KAChC,KAAK,CAAC,sBAAsB,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"placeholder.js","sourceRoot":"","sources":["../../../../src/model/schemas/capi/placeholder.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;AAEtB,MAAM,wBAAwB,GAAG,+BAAiB,CAAC,IAAI,CAAC;IACtD,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,iBAAiB,EAAE,IAAI;IACvB,sBAAsB,EAAE,IAAI;CAC7B,CAAC,CAAA;AAEF,MAAM,yBAAyB,GAAG,gCAAkB,CAAC,IAAI,CAAC;IACxD,EAAE,EAAE,IAAI;IACR,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;IACZ,eAAe,EAAE,IAAI;IACrB,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;IACxB,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,IAAI;CAClB,CAAC,CAAA;AAEF,MAAM,sBAAsB,GAAG,6BAAe,CAAC,IAAI,CAAC;IAClD,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;IAChB,iBAAiB,EAAE,IAAI;IACvB,MAAM,EAAE,IAAI;CACb,CAAC,CAAA;AAEW,QAAA,iBAAiB,GAAG,wBAAwB;KACtD,KAAK,CAAC,yBAAyB,CAAC;KAChC,KAAK,CAAC,sBAAsB,CAAC,CAAA"}
|
package/lib/resolvers/teaser.js
CHANGED
|
@@ -11,7 +11,7 @@ const resolvers = {
|
|
|
11
11
|
metaAltLink: (parent) => parent.teaserMetadataLink('altLink'),
|
|
12
12
|
metaPrefixText: (parent) => parent.teaserMetadataText('prefixText'),
|
|
13
13
|
metaSuffixText: (parent) => parent.teaserMetadataText('suffixText'),
|
|
14
|
-
image: (parent) => parent.
|
|
14
|
+
image: (parent) => parent.teaserImage(),
|
|
15
15
|
indicators(parent) {
|
|
16
16
|
return {
|
|
17
17
|
accessLevel: parent.accessLevel(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teaser.js","sourceRoot":"","sources":["../../src/resolvers/teaser.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAAG;IAChB,MAAM,EAAE;QACN,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;QACrD,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CACf,MAAM;aACH,IAAI,EAAE;aACN,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;aACzD,KAAK,CAAC,CAAC,CAAC;QACb,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QACvD,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC;QAC7D,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC;QACnE,cA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AE,MAAM,CAAC,SAAS,EAAE;gBAC7B,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE;gBACzC,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE;gBACjC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;aAC1B,CAAA;QACH,CAAC;QACD,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE;KAC5C;CACoC,CAAA;AAEvC,kBAAe,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
ImageSet,
|
|
3
3
|
Annotation,
|
|
4
4
|
ContentTypeSchemas,
|
|
5
|
+
MainImage,
|
|
5
6
|
} from '../types/internal-content'
|
|
6
7
|
import conceptIds from '@financial-times/n-concept-ids'
|
|
7
8
|
import metadata, { TeaserMetadata } from '@financial-times/n-display-metadata'
|
|
@@ -373,16 +374,24 @@ export class CapiResponse {
|
|
|
373
374
|
}
|
|
374
375
|
|
|
375
376
|
mainImage() {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
this.capiData
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
377
|
+
return this.#createCAPIImage(this.capiData.mainImage)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
teaserImage() {
|
|
381
|
+
// Some content published via methode uses promotionalImage for teasers
|
|
382
|
+
const alternativeImage =
|
|
383
|
+
'alternativeImages' in this.capiData
|
|
384
|
+
? this.capiData.alternativeImages?.promotionalImage
|
|
385
|
+
: undefined
|
|
386
|
+
const image = alternativeImage ?? this.capiData.mainImage
|
|
387
|
+
return this.#createCAPIImage(image)
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
#createCAPIImage(image: MainImage | undefined) {
|
|
391
|
+
if (image?.type === 'http://www.ft.com/ontology/content/Image') {
|
|
392
|
+
return new CAPIImage(image, this.context)
|
|
393
|
+
} else if (image?.type === 'http://www.ft.com/ontology/content/ImageSet') {
|
|
394
|
+
return new CAPIImage(image.members[0], this.context)
|
|
386
395
|
}
|
|
387
396
|
|
|
388
397
|
return null
|
|
@@ -84,6 +84,10 @@ export const LeadImage = z.object({
|
|
|
84
84
|
image: Image,
|
|
85
85
|
})
|
|
86
86
|
|
|
87
|
+
export const AlternativeImage = z.object({
|
|
88
|
+
promotionalImage: BaseImage,
|
|
89
|
+
})
|
|
90
|
+
|
|
87
91
|
export const DataSource = z.object({
|
|
88
92
|
binaryUrl: z.string(),
|
|
89
93
|
duration: z.number(),
|
|
@@ -203,6 +207,7 @@ export const baseContentSchema = z.object({
|
|
|
203
207
|
export const baseMediaSchema = z.object({
|
|
204
208
|
mainImage: MainImage.optional(),
|
|
205
209
|
leadImages: LeadImage.array().optional(),
|
|
210
|
+
alternativeImages: AlternativeImage.optional(),
|
|
206
211
|
embeds: ImageSet.array().optional(),
|
|
207
212
|
dataSource: DataSource.array().optional(),
|
|
208
213
|
})
|
package/src/resolvers/teaser.ts
CHANGED
|
@@ -13,7 +13,7 @@ const resolvers = {
|
|
|
13
13
|
metaAltLink: (parent) => parent.teaserMetadataLink('altLink'),
|
|
14
14
|
metaPrefixText: (parent) => parent.teaserMetadataText('prefixText'),
|
|
15
15
|
metaSuffixText: (parent) => parent.teaserMetadataText('suffixText'),
|
|
16
|
-
image: (parent) => parent.
|
|
16
|
+
image: (parent) => parent.teaserImage(),
|
|
17
17
|
indicators(parent) {
|
|
18
18
|
return {
|
|
19
19
|
accessLevel: parent.accessLevel(),
|