@financial-times/cp-content-pipeline-schema 2.12.0 → 2.13.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.
@@ -2,7 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.videoSchema = void 0;
4
4
  const base_schema_1 = require("./base-schema");
5
- exports.videoSchema = base_schema_1.baseContentSchema.pick({
5
+ const videoContentSchema = base_schema_1.baseContentSchema.pick({
6
6
  title: true,
7
+ transcript: true,
8
+ alternativeTitles: true,
7
9
  });
10
+ const videoMetadataSchema = base_schema_1.baseMetadataSchema.pick({
11
+ id: true,
12
+ annotations: true,
13
+ webUrl: true,
14
+ canonicalWebUrl: true,
15
+ types: true,
16
+ publishedDate: true,
17
+ firstPublishedDate: true,
18
+ publishReference: true,
19
+ accessLevel: true,
20
+ editorialDesk: true,
21
+ canBeSyndicated: true,
22
+ canBeDistributed: true,
23
+ });
24
+ const videoMediaSchema = base_schema_1.baseMediaSchema.pick({
25
+ mainImage: true,
26
+ });
27
+ exports.videoSchema = videoContentSchema
28
+ .merge(videoMetadataSchema)
29
+ .merge(videoMediaSchema);
8
30
  //# sourceMappingURL=video.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"video.js","sourceRoot":"","sources":["../../../../src/model/schemas/capi/video.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AAEpC,QAAA,WAAW,GAAG,+BAAiB,CAAC,IAAI,CAAC;IAChD,KAAK,EAAE,IAAI;CACZ,CAAC,CAAA"}
1
+ {"version":3,"file":"video.js","sourceRoot":"","sources":["../../../../src/model/schemas/capi/video.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;AAEtB,MAAM,kBAAkB,GAAG,+BAAiB,CAAC,IAAI,CAAC;IAChD,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,iBAAiB,EAAE,IAAI;CACxB,CAAC,CAAA;AAEF,MAAM,mBAAmB,GAAG,gCAAkB,CAAC,IAAI,CAAC;IAClD,EAAE,EAAE,IAAI;IACR,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;IACZ,eAAe,EAAE,IAAI;IACrB,KAAK,EAAE,IAAI;IACX,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,IAAI;IACtB,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;CACvB,CAAC,CAAA;AAEF,MAAM,gBAAgB,GAAG,6BAAe,CAAC,IAAI,CAAC;IAC5C,SAAS,EAAE,IAAI;CAChB,CAAC,CAAA;AAEW,QAAA,WAAW,GAAG,kBAAkB;KAC1C,KAAK,CAAC,mBAAmB,CAAC;KAC1B,KAAK,CAAC,gBAAgB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/cp-content-pipeline-schema",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -223,6 +223,9 @@ export class CapiResponse {
223
223
  )
224
224
  }
225
225
  body() {
226
+ if (this.type() === 'Video' && 'transcript' in this.capiData) {
227
+ return new RichText('transcript', this.capiData.transcript ?? null, this)
228
+ }
226
229
  return new RichText('bodyXML', this.bodyXML(), this)
227
230
  }
228
231
  bodyXML(): string | null {
@@ -263,6 +263,7 @@ export const baseContentSchema = z.object({
263
263
  z.literal('extra-wide'),
264
264
  ]),
265
265
  }),
266
+ transcript: z.string().optional(),
266
267
  })
267
268
 
268
269
  export const baseMediaSchema = z.object({
@@ -1,5 +1,34 @@
1
- import { baseContentSchema } from './base-schema'
1
+ import {
2
+ baseContentSchema,
3
+ baseMediaSchema,
4
+ baseMetadataSchema,
5
+ } from './base-schema'
2
6
 
3
- export const videoSchema = baseContentSchema.pick({
7
+ const videoContentSchema = baseContentSchema.pick({
4
8
  title: true,
9
+ transcript: true,
10
+ alternativeTitles: true,
5
11
  })
12
+
13
+ const videoMetadataSchema = baseMetadataSchema.pick({
14
+ id: true,
15
+ annotations: true,
16
+ webUrl: true,
17
+ canonicalWebUrl: true,
18
+ types: true,
19
+ publishedDate: true,
20
+ firstPublishedDate: true,
21
+ publishReference: true,
22
+ accessLevel: true,
23
+ editorialDesk: true,
24
+ canBeSyndicated: true,
25
+ canBeDistributed: true,
26
+ })
27
+
28
+ const videoMediaSchema = baseMediaSchema.pick({
29
+ mainImage: true,
30
+ })
31
+
32
+ export const videoSchema = videoContentSchema
33
+ .merge(videoMetadataSchema)
34
+ .merge(videoMediaSchema)
@@ -52,3 +52,4 @@ type ContentTypeSchemas =
52
52
  | LiveBlogPackage
53
53
  | ContentPackage
54
54
  | Audio
55
+ | Video