@financial-times/cp-content-pipeline-schema 2.5.3 → 2.5.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +187 -41
  3. package/lib/datasources/base.d.ts +1 -0
  4. package/lib/datasources/capi.js +1 -0
  5. package/lib/datasources/capi.js.map +1 -1
  6. package/lib/datasources/instrumented.d.ts +1 -0
  7. package/lib/datasources/instrumented.js +1 -9
  8. package/lib/datasources/instrumented.js.map +1 -1
  9. package/lib/datasources/origami-image.js +1 -0
  10. package/lib/datasources/origami-image.js.map +1 -1
  11. package/lib/datasources/twitter.js +1 -0
  12. package/lib/datasources/twitter.js.map +1 -1
  13. package/lib/datasources/url-management.d.ts +1 -0
  14. package/lib/datasources/url-management.js +2 -0
  15. package/lib/datasources/url-management.js.map +1 -1
  16. package/lib/generated/index.d.ts +546 -2
  17. package/package.json +1 -1
  18. package/src/datasources/base.ts +1 -0
  19. package/src/datasources/capi.ts +1 -0
  20. package/src/datasources/instrumented.ts +1 -11
  21. package/src/datasources/origami-image.ts +3 -0
  22. package/src/datasources/twitter.ts +2 -0
  23. package/src/datasources/url-management.ts +2 -0
  24. package/src/generated/index.ts +546 -2
  25. package/tsconfig.tsbuildinfo +1 -1
  26. package/typedefs/clip.graphql +28 -0
  27. package/typedefs/concept.graphql +21 -2
  28. package/typedefs/content.graphql +441 -36
  29. package/typedefs/core.graphql +6 -0
  30. package/typedefs/image.graphql +210 -15
  31. package/typedefs/picture.graphql +54 -1
  32. package/typedefs/references/clipSet.graphql +34 -1
  33. package/typedefs/references/flourish.graphql +8 -0
  34. package/typedefs/references/imageSet.graphql +6 -0
  35. package/typedefs/references/layoutImage.graphql +3 -0
  36. package/typedefs/references/rawImage.graphql +3 -0
  37. package/typedefs/references/recommended.graphql +3 -0
  38. package/typedefs/references/reference.graphql +1 -0
  39. package/typedefs/references/scrollyImage.graphql +3 -0
  40. package/typedefs/references/tweet.graphql +3 -0
  41. package/typedefs/references/video.graphql +5 -0
  42. package/typedefs/richText.graphql +7 -4
  43. package/typedefs/teaser.graphql +42 -1
  44. package/typedefs/topper.graphql +219 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/cp-content-pipeline-schema",
3
- "version": "2.5.3",
3
+ "version": "2.5.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -3,6 +3,7 @@ import { QueryContext } from '..'
3
3
 
4
4
  export interface BaseDataSource {
5
5
  context: QueryContext
6
+ calls: string[]
6
7
  }
7
8
 
8
9
  export type BaseDataSourceOptions = {
@@ -46,6 +46,7 @@ export class CapiDataSource extends InstrumentedRESTDataSource {
46
46
  cacheOptions: { ttl: this.articleCacheTTL },
47
47
  })
48
48
  this.context.contentRequestedOnce = true
49
+ this.calls.push(uuid)
49
50
 
50
51
  if (this.timeout) {
51
52
  clearTimeout(this.timeout)
@@ -6,7 +6,6 @@ import {
6
6
  AugmentedRequest,
7
7
  } from '@apollo/datasource-rest'
8
8
  import { PrefixingKeyValueCache } from '@apollo/utils.keyvaluecache'
9
- import { SerializedRequest } from '@dotcom-reliability-kit/serialize-request'
10
9
  import { UpstreamServiceError } from '@dotcom-reliability-kit/errors'
11
10
  import { QueryContext } from '..'
12
11
  import { isContextableCache } from '../types/cache'
@@ -19,6 +18,7 @@ export class InstrumentedRESTDataSource
19
18
  startTime?: bigint
20
19
  backendSystemCodes: string[] = []
21
20
  context: QueryContext
21
+ calls: string[] = []
22
22
 
23
23
  constructor({ cache, context }: BaseDataSourceOptions) {
24
24
  const wrappedCache = new PrefixingKeyValueCache(
@@ -70,16 +70,6 @@ export class InstrumentedRESTDataSource
70
70
  1
71
71
  )
72
72
 
73
- this.context.logger.info({
74
- event: 'REQUEST_DATASOURCE',
75
- datasource: this.constructor.name,
76
- request: {
77
- id: this.context.requestId,
78
- url: new URL(path, this.baseURL).href,
79
- method: incomingRequest?.method,
80
- } as SerializedRequest,
81
- })
82
-
83
73
  try {
84
74
  const result = await super.fetch<TResult>(path, incomingRequest)
85
75
  const duration = (process.hrtime.bigint() - startTime) / BigInt(1e6)
@@ -36,6 +36,9 @@ export class OrigamiImageDataSource extends InstrumentedRESTDataSource {
36
36
  const imageMetadata = await this.get(
37
37
  `images/metadata/${encodeURIComponent(url)}?source=next`
38
38
  )
39
+
40
+ this.calls.push(url)
41
+
39
42
  if (this.timeout) {
40
43
  clearTimeout(this.timeout)
41
44
  this.timeout = undefined
@@ -24,6 +24,8 @@ export class TwitterDataSource extends InstrumentedRESTDataSource {
24
24
  try {
25
25
  const tweet = await this.get(`oembed?url=${tweetUrl}&omit_script=true`)
26
26
 
27
+ this.calls.push(tweetUrl)
28
+
27
29
  if (this.timeout) {
28
30
  clearTimeout(this.timeout)
29
31
  this.timeout = undefined
@@ -15,6 +15,7 @@ export class URLManagementDataSource implements BaseDataSource {
15
15
  memoizedResults = new Map<string, Promise<string>>()
16
16
  cache: KeyValueCache
17
17
  context: QueryContext
18
+ calls: string[] = []
18
19
 
19
20
  static clientInitialised = false
20
21
 
@@ -61,6 +62,7 @@ export class URLManagementDataSource implements BaseDataSource {
61
62
  promise = getVanity()
62
63
  this.memoizedResults.set(fromURL, promise)
63
64
 
65
+ this.calls.push(fromURL)
64
66
  return promise
65
67
  }
66
68
  }