@financial-times/cp-content-pipeline-schema 2.5.3 → 2.6.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +20 -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/fixtures/capiObject.js +1 -1
  17. package/lib/fixtures/capiObject.js.map +1 -1
  18. package/lib/generated/index.d.ts +572 -2
  19. package/lib/model/CapiResponse.d.ts +1 -0
  20. package/lib/model/CapiResponse.js +4 -2
  21. package/lib/model/CapiResponse.js.map +1 -1
  22. package/lib/model/CapiResponse.test.js +7 -0
  23. package/lib/model/CapiResponse.test.js.map +1 -1
  24. package/lib/resolvers/content-tree/Workarounds.d.ts +8 -1
  25. package/lib/resolvers/content-tree/nodePredicates.d.ts +1 -1
  26. package/lib/resolvers/content-tree/tagMappings.js +14 -5
  27. package/lib/resolvers/content-tree/tagMappings.js.map +1 -1
  28. package/lib/resolvers/content.d.ts +8 -0
  29. package/lib/resolvers/content.js +1 -0
  30. package/lib/resolvers/content.js.map +1 -1
  31. package/lib/resolvers/index.d.ts +8 -0
  32. package/package.json +1 -1
  33. package/queries/article.graphql +1 -0
  34. package/src/datasources/base.ts +1 -0
  35. package/src/datasources/capi.ts +1 -0
  36. package/src/datasources/instrumented.ts +1 -11
  37. package/src/datasources/origami-image.ts +3 -0
  38. package/src/datasources/twitter.ts +2 -0
  39. package/src/datasources/url-management.ts +2 -0
  40. package/src/fixtures/capiObject.ts +1 -1
  41. package/src/generated/index.ts +572 -2
  42. package/src/model/CapiResponse.test.ts +9 -0
  43. package/src/model/CapiResponse.ts +4 -3
  44. package/src/resolvers/content-tree/Workarounds.ts +10 -0
  45. package/src/resolvers/content-tree/tagMappings.ts +15 -5
  46. package/src/resolvers/content.ts +1 -0
  47. package/tsconfig.tsbuildinfo +1 -1
  48. package/typedefs/clip.graphql +28 -0
  49. package/typedefs/concept.graphql +21 -2
  50. package/typedefs/content.graphql +465 -36
  51. package/typedefs/core.graphql +6 -0
  52. package/typedefs/image.graphql +210 -15
  53. package/typedefs/picture.graphql +54 -1
  54. package/typedefs/references/clipSet.graphql +34 -1
  55. package/typedefs/references/flourish.graphql +8 -0
  56. package/typedefs/references/imageSet.graphql +6 -0
  57. package/typedefs/references/layoutImage.graphql +3 -0
  58. package/typedefs/references/rawImage.graphql +3 -0
  59. package/typedefs/references/recommended.graphql +3 -0
  60. package/typedefs/references/reference.graphql +1 -0
  61. package/typedefs/references/scrollyImage.graphql +3 -0
  62. package/typedefs/references/tweet.graphql +3 -0
  63. package/typedefs/references/video.graphql +5 -0
  64. package/typedefs/richText.graphql +7 -4
  65. package/typedefs/teaser.graphql +42 -1
  66. package/typedefs/topper.graphql +219 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.6.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-schema-v2.5.4...cp-content-pipeline-schema-v2.6.0) (2024-04-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * add a `publishedTimestamp` field for the Apps canned query, for simpler client processing ([4372ec8](https://github.com/Financial-Times/cp-content-pipeline/commit/4372ec8ce1880c880bda6d13ee1ce26dc68b6af9))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * blockquote author styling ([8740be7](https://github.com/Financial-Times/cp-content-pipeline/commit/8740be7d906a7223d51b69ec737602b350c0a4dd))
14
+ * handle images in pullquotes ([a0dd9ce](https://github.com/Financial-Times/cp-content-pipeline/commit/a0dd9ce798fd379f956bc3ee4ed2d60f474c619d))
15
+
16
+ ## [2.5.4](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-schema-v2.5.3...cp-content-pipeline-schema-v2.5.4) (2024-04-18)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * consolidate REQUEST_DATASOURCE logs into one per request ([567019d](https://github.com/Financial-Times/cp-content-pipeline/commit/567019d5d8f5b1782ff5e2efcd89234021a0ed66))
22
+
3
23
  ## [2.5.3](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-schema-v2.5.2...cp-content-pipeline-schema-v2.5.3) (2024-04-08)
4
24
 
5
25
 
package/README.md CHANGED
@@ -1,10 +1,36 @@
1
- # Schema
1
+ # Content Pipeline Schema
2
2
 
3
- ## What is this?
3
+ The GraphQL schema, data sources, and business logic consumed by the [cp-content-pipeline-api](../api) and [cp-content-pipeline-client](../client). It is not intended for use outside this project.
4
4
 
5
- The GraphQL schema, data sources, and business logic for the content pipeline API. It is consumed by the [API package](../api) and not intended for use outside this project.
5
+ ## Table of Contents
6
6
 
7
- ## Usage
7
+ - [Usage Guide](#usage-guide)
8
+ - [Exports Explained](#exports-explained)
9
+ - [typeDefs](#typeDefs)
10
+ - [articleDocumentQuery](#articleDocumentQuery)
11
+ - [QueryContext](#QueryContext)
12
+ - [initDataSources & DataSources](#initDataSources-&-DataSources)
13
+ - [resolvers](#resolvers)
14
+ - [scalars](#scalars)
15
+ - [Architecture Diagram](#architecture-diagram)
16
+
17
+ ## Usage Guide
18
+
19
+ This package's exports are shown below.
20
+
21
+ ```typescript
22
+ import {
23
+ typeDefs,
24
+ articleDocumentQuery
25
+ QueryContext,
26
+ resolvers,
27
+ scalars,
28
+ initDataSources,
29
+ DataSources,
30
+ } from '@financial-times/cp-content-pipeline-schema'
31
+ ```
32
+
33
+ They are consumed by a GraphQL server framework, for example:
8
34
 
9
35
  ```typescript
10
36
  import { ApolloServer } from 'apollo-server'
@@ -23,41 +49,77 @@ const server = new ApolloServer({
23
49
 
24
50
  See the [API package entry point](../api/src/index.ts) for a more complex example.
25
51
 
26
- ## How does it work?
52
+ ## Exports Explained
27
53
 
28
- This package's exports are shown below. They are consumed by a GraphQL server framework:
54
+ See [GraphQL and Apollo Server Basics](../api/README.md#graphql-and-apollo-server-basics) for more context on the below.
29
55
 
30
- ```typescript
31
- import {
32
- resolvers,
33
- typeDefs,
34
- dataSources,
35
- DataSources,
36
- QueryContext,
37
- articleDocumentQuery
38
- } from '@financial-times/cp-content-pipeline-schema'
56
+ ### `typeDefs`
57
+
58
+ A collection of type definitions that is exported as `typeDefs`. It defines the _shape_ of queries that are executed against our data. These are defined as `.graphql` files in the [`typedefs`](./typedefs/) folder.
59
+
60
+ ### `articleDocumentQuery`
61
+
62
+ A GraphQL query for a complete FT article, that is consumed by the `cp-content-pipeline-api`.
63
+
64
+ ### `QueryContext`
65
+
66
+ An interface that defines the context object sent to each resolver function.
67
+
68
+ ### `initDataSources` & `DataSources`
69
+
70
+ Data sources are used to fetch data from external sources, such as the `content-api (CAPI)`. These are defined in the [data sources directory](src/datasources). Its factory function is `initDataSources` and its type is exported as `DataSources`.
71
+
72
+ #### Type Checking
73
+
74
+ We use [Zod](https://zod.dev/?id=introduction) for our `CAPI` [schemas](./src/model/schemas/capi) to do runtime checks on the incoming data from data sources. We want to ensure that it matches the types defined in our data source schema.
75
+
76
+ There is no agreed schema provided by `CAPI`, so there is a chance it will occasionally be out of date or incorrect.
77
+
78
+ Manual updates will be required to keep it in sync with the responses we receive.
79
+
80
+ We monitor such errors in [Grafana](https://grafana.ft.com/d/zLejY5EVz/cp-content-pipeline-api-alerts?orgId=1&from=1712743002053&to=1712764602053&viewPanel=2) and log such errors to [Splunk](https://financialtimes.splunkcloud.com/en-US/app/search/search?q=search%20index%3Dheroku%20source%3Dcp-content-pipeline-api%20error.code%3DCAPI_SCHEMA_VALIDATION_FAILURE&display.page.search.mode=smart&dispatch.sample_ratio=1&workload_pool=standard_perf&earliest=1706054400&latest=1706227200&display.page.search.tab=events&display.general.type=events&sid=1712764428.6764482) in a non-blocking format, for example:
81
+
82
+ ```json
83
+ {
84
+ "event": "RECOVERABLE_ERROR",
85
+ "error": {
86
+ "code": "CAPI_SCHEMA_VALIDATION_FAILURE",
87
+ "data": {
88
+ "contentId": "http://www.ft.com/thing/31884c4d-2da7-4b43-917e-3180e9eafa3d",
89
+ "contentType": "Article",
90
+ "schemaError": [
91
+ "mainImage.members.[].format": "Invalid literal value, received 'promo', expected one of 'standardInline','mobile','desktop'..."
92
+ ]
93
+ },
94
+ "isOperational": true,
95
+ "message": "The data received from the CAPI data source does not match our data source schema. It is likely that our schema will require updating to handle all possible responses from CAPI."
96
+ }
97
+ }
39
98
  ```
40
99
 
41
- The schema is a collection of type definitions that is exported as `typeDefs`. It defines the 'shape' of queries that are executed against our data. These are defined as `.graphql` files in the [`typedefs`](./typedefs/) folder.
42
100
 
43
- Resolvers define the technique for fetching the types defined in the schema. The resolvers for each part of the schema are defined in the same file the schema definition is in. They are exported as `resolvers`.
101
+ ### `resolvers`
102
+
103
+ The GraphQL resolvers which define the technique for fetching types defined in the schema.
44
104
 
45
- Data sources are used to fetch data from external sources, such as the content API. These are defined in the [data sources directory](src/datasources). Its type is exported as `DataSources`, its factory function is exported as
46
- `dataSources`.
105
+ #### Type Checking
47
106
 
48
- The `QueryContext` type defines the context object sent to each resolver function.
107
+ We use [GraphQL Code Generator](https://graphql-codegen.com) with the [TypeScript Resolvers](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-resolvers) plugin to output TypeScript types for the expected function signatures for the resolvers. This prevents runtime GraphQL errors caused by unexpected data being returned.
49
108
 
50
- The models contain the business logic gluing the data sources and resolvers together. They're defined in the [model](src/model) directory and consumed by the resolvers.
109
+ #### Models
51
110
 
52
- ## Resolver typechecking
111
+ The resolvers accept and return data objects in the form of **models** instead of plain GraphQL objects. The **models** classes encapsulate business logic and interact with the data sources.
53
112
 
54
- To make sure the data we're returning in resolvers is what's expected by the GraphQL schema, we use [GraphQL Code Generator](https://graphql-codegen.com) with the [TypeScript Resolvers](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-resolvers) plugin to output TypeScript types for the expected function signatures for the resolvers. This prevents runtime GraphQL errors caused by unexpected data being returned.
113
+ For example:
55
114
 
56
- Because we use models in the schema to encapsulate business logic, our resolvers need to be returning the model types and accepting them as their parent object, instead of the plain GraphQL objects.
115
+ - The `Teaser.metaLink` field is specified in the schema as the `Concept` GraphQL type
116
+ - We use the [`Concept` model](./src/model/Concept.ts) for it internally
117
+ - The `Teaser.metaLink` resolver accepts an instance of the `Concept` model as its `parent` argument. It returns an instance of the `Concept` model too
118
+ - The `Concept` model is able to access the `dataSources` via its `context`
57
119
 
58
- For example, the `Teaser.metaLink` field is specified in the schema as the `Concept` GraphQL type, but we use the [`Concept` _model_](./src/model/Concept.ts) for it internally, so the `Teaser.metaLink` resolver returns an instance of that model, and `Concepts`'s resolvers are passed that instance as their `parent` argument.
120
+ The[`mappers` option](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-resolvers#use-your-model-types-mappers) in the [config file](../../codegen.js) is how we let the [GraphQL Code Generator](https://graphql-codegen.com) know how to map the models to our resolvers. The `mappers` option is an object whose keys are names of GraphQL types and values the paths of the models.
59
121
 
60
- We need to let GraphQL Code Generator know how to map the GraphQL types to our models, where needed, so the generated resolver types correctly expect models, not GraphQL types. This is done via the [`mappers` option](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-resolvers#use-your-model-types-mappers) in the [config file](../../codegen.js). This is an object whose keys are names of GraphQL types, and values are specifiers for an import of a model type. For the `Concept` example, this looks like:
122
+ For the `Concept` example above, this looks like:
61
123
 
62
124
  ```js
63
125
  {
@@ -67,39 +129,123 @@ We need to let GraphQL Code Generator know how to map the GraphQL types to our m
67
129
 
68
130
  The `as ConceptModel` aliasing is to make sure the name doesn't collide with the `Concept` GraphQL type in the generated code.
69
131
 
70
- GraphQL Code Generator is also [used to generate the client library](../client/README.md#how-this-package-is-produced).
132
+ GraphQL Code Generator is also [used to generate the client library](../client/README.md).
71
133
 
72
- ## Content Tree
134
+ #### Content resolution
73
135
 
74
- ### What is it?
136
+ The most complex resolver is the one for Financial Times article content - the `body()` [resolver](./src/resolvers/content.ts#24). It resolves content in the format of a [content-tree](https://github.com/Financial-Times/content-tree/), a specification for representing content as an abstract syntax tree. It implements the unist spec.
75
137
 
76
- [content-tree](https://github.com/Financial-Times/content-tree/) is a specification for representing Financial Times article content as an abstract tree. It implements the unist spec.
138
+ As of January 2023, the `content-tree` spec defines everything that can appear in the body of an article. In the future, this may extend to other fields (e.g. Topper).
77
139
 
78
140
  It is shared across Spark, Content & Metadata and Customer Products.
79
141
 
80
- ### What is it used for?
142
+ ##### What are content-tree nodes?
81
143
 
82
- As of January 2023, the `content-tree` spec defines everything that can appear in the body of an article. In the future, this may extend to other fields (e.g. Topper)
144
+ Each node in the `content-tree` has a `type` property, which will correspond to a what data is available to that nodes, e.g. `paragraph`, `link`, `image-set`.
83
145
 
84
- ### How do we create the tree?
146
+ ##### How is the tree created?
85
147
 
86
- As of January 2023, the `bodyTree` property is not yet being published to the Content API, so we must convert the `bodyXML` field to a valid content tree.
148
+ As of January 2023, the `bodyTree` property is not yet being published to the Content API, so we convert the `bodyXML` field to a valid content tree within `cp-content-pipeline`.
87
149
 
88
- This is done by the [bodyXMLtoTree](src/resolvers/content-tree/bodyXMLToTree.ts) function. This function uses [cheerio](https://cheerio.js.org/) to parse the XML, and then traverses through the nodes, converting each one to a `content-tree` node.
150
+ This is done by the [bodyXMLtoTree](src/resolvers/content-tree/bodyXMLToTree.ts) function. This function uses [cheerio](https://cheerio.js.org/) to parse the `XML`, and then traverses through the nodes, converting each one to a `content-tree` node.
89
151
 
90
- In order to know how to convert the XML nodes to a `content-tree` one, we provide this function some [tagMappings](src/resolvers/content-tree/tagMappings.ts).
152
+ We provide the `bodyXMLtoTree` function some [tagMappings](src/resolvers/content-tree/tagMappings.ts) to map `XML` nodes to a `content-tree` nodes.
91
153
 
92
- ### What are references?
154
+ ##### References
93
155
 
94
156
  For some `content-tree` nodes, the CMS will not be able to provide all of the information required to render. For example, to render a tweet, we need to fetch the embed code from the Twitter API.
95
157
 
96
158
  In the `content-tree` spec, this additional information will be marked as optional, as it may not be there when the tree is produced.
97
159
 
98
- We provide this additional data to the tree by using an array of `references` - objects containing the extra information needed. These references can be queried using GraphQL, so we can make use of dataSources to fetch data, and other resolvers (e.g. Picture) to share transformation logic.
160
+ We provide this additional data to the tree by using an array of `references` - objects containing the extra information needed. These references can be queried using GraphQL, so we can make use of:
99
161
 
100
- For nodes that require additional information, a file should be created in the [content-tree/references](src/content-tree/references/) folder, containing a GraphQL typeDef and resolver object.
162
+ - `dataSources` to fetch data
163
+ - other resolvers (e.g. `Picture`) to share transformation logic
101
164
 
102
- ### How do I add a new "body" component?
165
+ For nodes that require additional information, a file should be created in the [content-tree/references](src/content-tree/references/) folder, containing a GraphQL `typeDef` and resolver object.
166
+
167
+ ##### Example
168
+
169
+ An example of a very simplified resolution for the `body()` resolver (including the references and the tree) is:
170
+
171
+ ```json
172
+ {
173
+ "structured": {
174
+ "references": {
175
+ ...
176
+ },
177
+ "tree": {
178
+ "type": "body",
179
+ "version": 1,
180
+ "children": [
181
+ {
182
+ "type": "paragraph",
183
+ "children": [
184
+ {
185
+ "type": "text",
186
+ "value": "Some text"
187
+ },
188
+ ]
189
+ },
190
+ {
191
+ "type": "paragraph",
192
+ "children": [
193
+ {
194
+ "type": "text",
195
+ "value": "Some text"
196
+ },
197
+ ]
198
+ }
199
+ ...
200
+ }
201
+ ```
103
202
 
104
- // TODO: agree a process with Spark/CP Platforms/Storytelling and flesh this out.
203
+ ### `scalars`
105
204
 
205
+ The collection of GraphQL types for resolvers which return scalars.
206
+
207
+ ## Architecture Diagram
208
+
209
+ ```mermaid
210
+ flowchart TB
211
+ subgraph typeDefs[typeDefs]
212
+ end
213
+
214
+ subgraph articleDocumentQuery[articleDocumentQuery]
215
+ end
216
+
217
+ subgraph articleJsonData[article content JSON data]
218
+ end
219
+
220
+ subgraph resolvers[resolvers]
221
+ subgraph contentResolvers[content.ts]
222
+ subgraph idResolver["id()"]
223
+ end
224
+ subgraph bodyResolver["body()"]
225
+ end
226
+ subgraph etcResolvers["..."]
227
+ end
228
+ end
229
+ end
230
+
231
+ subgraph bodyXMLToTree["bodyXMLToTree()"]
232
+ end
233
+
234
+ subgraph tagMappings["tagMappings()"]
235
+ end
236
+
237
+ subgraph models[models]
238
+ end
239
+
240
+ subgraph dataSources[dataSources]
241
+ end
242
+
243
+ typeDefs -- structures query --> articleDocumentQuery
244
+ typeDefs -- structures resolvers --> resolvers
245
+ articleDocumentQuery -- once executed (via client or api), the query returns article data--> articleJsonData
246
+ dataSources --> models
247
+ models --> resolvers
248
+ resolvers <-- query initiates resolvers --> articleDocumentQuery
249
+ bodyXMLToTree -- traverses XML and returns content-tree structure --> bodyResolver
250
+ tagMappings -- mappings provided to differentiate nodes --> bodyXMLToTree
251
+ ```
@@ -2,6 +2,7 @@ import { KeyValueCache } from '@apollo/utils.keyvaluecache';
2
2
  import { QueryContext } from '..';
3
3
  export interface BaseDataSource {
4
4
  context: QueryContext;
5
+ calls: string[];
5
6
  }
6
7
  export type BaseDataSourceOptions = {
7
8
  cache: KeyValueCache;
@@ -32,6 +32,7 @@ class CapiDataSource extends instrumented_1.InstrumentedRESTDataSource {
32
32
  cacheOptions: { ttl: this.articleCacheTTL },
33
33
  });
34
34
  this.context.contentRequestedOnce = true;
35
+ this.calls.push(uuid);
35
36
  if (this.timeout) {
36
37
  clearTimeout(this.timeout);
37
38
  this.timeout = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"capi.js","sourceRoot":"","sources":["../../src/datasources/capi.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AACpD,iDAA2D;AAG3D,2DAGuC;A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H,CAAC;CACF;AA3ED,wCA2EC"}
@@ -5,6 +5,7 @@ export declare class InstrumentedRESTDataSource extends RESTDataSource implement
5
5
  startTime?: bigint;
6
6
  backendSystemCodes: string[];
7
7
  context: QueryContext;
8
+ calls: string[];
8
9
  constructor({ cache, context }: BaseDataSourceOptions);
9
10
  get cachePrefix(): string;
10
11
  protected cacheKeyFor(url: URL): string;
@@ -13,6 +13,7 @@ class InstrumentedRESTDataSource extends datasource_rest_1.RESTDataSource {
13
13
  cache: wrappedCache,
14
14
  });
15
15
  this.backendSystemCodes = [];
16
+ this.calls = [];
16
17
  // okay _now_ we can use `this`
17
18
  // also that's a private property so use the [] escape hatch
18
19
  // sorry
@@ -37,15 +38,6 @@ class InstrumentedRESTDataSource extends datasource_rest_1.RESTDataSource {
37
38
  async fetch(path, incomingRequest) {
38
39
  const startTime = process.hrtime.bigint();
39
40
  this.context.metrics?.count(`graphql.datasource.${this.constructor.name}.request.count`, 1);
40
- this.context.logger.info({
41
- event: 'REQUEST_DATASOURCE',
42
- datasource: this.constructor.name,
43
- request: {
44
- id: this.context.requestId,
45
- url: new URL(path, this.baseURL).href,
46
- method: incomingRequest?.method,
47
- },
48
- });
49
41
  try {
50
42
  const result = await super.fetch(path, incomingRequest);
51
43
  const duration = (process.hrtime.bigint() - startTime) / BigInt(1e6);
@@ -1 +1 @@
1
- {"version":3,"file":"instrumented.js","sourceRoot":"","sources":["../../src/datasources/instrumented.ts"],"names":[],"mappings":";;;AAAA,6DAMgC;AAChC,qEAAoE;AAEpE,2DAAqE;AAErE,0CAAmD;AAGnD,MAAa,0BACX,SAAQ,gCAAc;IAOtB,YAAY,EAAE,KAAK,EAAE,OAAO,EAAyB;QACnD,MAAM,YAAY,GAAG,IAAI,4CAAsB,CAC7C,IAAA,0BAAkB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAC9D,sEAAsE,CAAC,yCAAyC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,WAAW,CAAC,IAAI,oBAAoB,EAC/D,MAAM,CAAC,QAAQ,CAAC,CACjB,CAAA;aACF;YAED,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF;AAtGD,gEAsGC"}
@@ -26,6 +26,7 @@ class OrigamiImageDataSource extends instrumented_1.InstrumentedRESTDataSource {
26
26
  async getImageMetadata(url) {
27
27
  try {
28
28
  const imageMetadata = await this.get(`images/metadata/${encodeURIComponent(url)}?source=next`);
29
+ this.calls.push(url);
29
30
  if (this.timeout) {
30
31
  clearTimeout(this.timeout);
31
32
  this.timeout = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"origami-image.js","sourceRoot":"","sources":["../../src/datasources/origami-image.ts"],"names":[],"mappings":";;;AAAA,2DAAqE;AACrE,iDAA2D;AAG3D,MAAM,eAAe,GAAG,IAAI,CAAA,CAAC,YAAY;AAEzC,MAAa,sBAAuB,SAAQ,yCAA0B;IAAtE;;QACE,YAAO,GAAG,gDAAgD,CAAA;QAC1D,uBAAkB,GAAG,CAAC,0BAA0B,CAAC,CAAA;QAEjD,oBAAe,GAAG,IAAI,eAAe,EAAE,CAAA;QACvC,YAAO,GAA8C,SAAS,CAAA;QAE9D,0BAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB;YAC1D,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;YAChD,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,CAAC,SAAS;IAyChC,CAAC;IAvCU,eAAe,CAAC,IAAY,EAAE,OAAyB;QAC9D,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAEpC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAA;QAC5C,IAAI,CAAC,OAAO,GAAG,UAAU,CACvB,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,EAClC,eAAe,CAChB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DC"}
@@ -20,6 +20,7 @@ class TwitterDataSource extends instrumented_1.InstrumentedRESTDataSource {
20
20
  async getTweet(tweetUrl) {
21
21
  try {
22
22
  const tweet = await this.get(`oembed?url=${tweetUrl}&omit_script=true`);
23
+ this.calls.push(tweetUrl);
23
24
  if (this.timeout) {
24
25
  clearTimeout(this.timeout);
25
26
  this.timeout = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"twitter.js","sourceRoot":"","sources":["../../src/datasources/twitter.ts"],"names":[],"mappings":";;;AACA,2DAAqE;AACrE,iDAA2D;AAE3D,MAAM,eAAe,GAAG,IAAI,CAAA,CAAC,YAAY;AACzC,MAAa,iBAAkB,SAAQ,yCAA0B;IAAjE;;QACE,YAAO,GAAG,6BAA6B,CAAA;QACvC,uBAAkB,GAAG,CAAC,oBAAoB,CAAC,CAAA;QAE3C,oBAAe,GAAG,IAAI,eAAe,EAAE,CAAA;QACvC,YAAO,GAA8C,SAAS,CAAA;IAyChE,CAAC;IAvCU,eAAe,CAAC,IAAY,EAAE,OAAyB;QAC9D,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAEpC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAA;QAC5C,IAAI,CAAC,OAAO,GAAG,UAAU,CACvB,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,EAClC,eAAe,CAChB,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAgB;QAC7B,IAAI;YACF,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,cAAc,QAAQ,mBAAmB,CAAC,CAAA;YAEvE,IAAI,IAAI,CAAC,OAAO,EAAE;gBAChB,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;gBAC1B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAA;aACzB;YAED,OAAO,KAAK,CAAA;SACb;QAAC,OAAO,KAAK,EAAE;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EvE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAEzB,IAAI,IAAI,CAAC,OAAO,EAAE;gBAChB,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;gBAC1B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAA;aACzB;YAED,OAAO,KAAK,CAAA;SACb;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE;gBACzD,MAAM,IAAI,6BAAoB,CAAC;oBAC7B,IAAI,EAAE,4BAA4B;oBAClC,OAAO,EAAE,2CAA2C,eAAe,8BAA8B;oBACjG,UAAU,EAAE,GAAG;oBACf,gBAAgB,EAAE,IAAI,CAAC,kBAAkB;iBAC1C,CAAC,CAAA;aACH;YAED,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;IAED,eAAe;QACb,iFAAiF;QACjF,oFAAoF;QACpF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;IACtB,CAAC;CACF;AAhDD,8CAgDC"}
@@ -5,6 +5,7 @@ export declare class URLManagementDataSource implements BaseDataSource {
5
5
  memoizedResults: Map<string, Promise<string>>;
6
6
  cache: KeyValueCache;
7
7
  context: QueryContext;
8
+ calls: string[];
8
9
  static clientInitialised: boolean;
9
10
  constructor({ context, cache }: BaseDataSourceOptions);
10
11
  get(fromURL: string, ttl?: number): Promise<string>;
@@ -11,6 +11,7 @@ const DEFAULT_TTL_IN_SECONDS = 60 * 60; // one hour
11
11
  class URLManagementDataSource {
12
12
  constructor({ context, cache }) {
13
13
  this.memoizedResults = new Map();
14
+ this.calls = [];
14
15
  if (!URLManagementDataSource.clientInitialised) {
15
16
  // n-url-management-api-read-client uses next-metrics histograms
16
17
  // but our custom Graphite client doesn't support that and also
@@ -42,6 +43,7 @@ class URLManagementDataSource {
42
43
  }
43
44
  promise = getVanity();
44
45
  this.memoizedResults.set(fromURL, promise);
46
+ this.calls.push(fromURL);
45
47
  return promise;
46
48
  }
47
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"url-management.js","sourceRoot":"","sources":["../../src/datasources/url-management.ts"],"names":[],"mappings":";;;;;;AAAA,qEAGoC;AAEpC,yHAA2F;AAK3F,MAAM,YAAY,GAAG,cAAc,CAAA;AACnC,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,CAAA,CAAC,WAAW;AAElD,MAAa,uBAAuB;IAOlC,YAAY,EAAE,OAAO,EAAE,KAAK,EAAyB;QANrD,oBAAe,GAAG,IAAI,GAAG,EAA2B,CAAA;QAOlD,IAAI,CAAC,uBAAuB,CAAC,iBAAiB,EAAE;YAC9C,gEAAgE;YAChE,+DAA+D;YAC/D,+DAA+D;YAC/D,0CAA2B,CAAC,IAAI,CAAC;gBAC/B,OAAO,EAAE;oBACP,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK;oBACtB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;iBACnB;aACF,CAAC,CAAA;YACF,uBAAuB,CAAC,iBAAiB,GAAG,IAAI,CAAA;SACjD;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,4CAAsB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,GAAG,CACP,OAAe,EACf,MAAc,sBAAsB;QAEpC,MAAM,SAAS,GAAG,KAAK,IAAqB,EAAE;YAC5C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YAC/C,IAAI,SAAS,EAAE;gBACb,OAAO,SAAS,CAAA;aACjB;YAED,MAAM,YAAY,GAChB,MAAM,0CAA2B,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YAChD,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC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BAAsB;QAEpC,MAAM,SAAS,GAAG,KAAK,IAAqB,EAAE;YAC5C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YAC/C,IAAI,SAAS,EAAE;gBACb,OAAO,SAAS,CAAA;aACjB;YAED,MAAM,YAAY,GAChB,MAAM,0CAA2B,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YAChD,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;YAC1D,OAAO,YAAY,CAAC,KAAK,CAAA;QAC3B,CAAC,CAAA;QAED,IAAI,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAE/C,IAAI,OAAO,EAAE;YACX,OAAO,OAAO,CAAA;SACf;QAED,OAAO,GAAG,SAAS,EAAE,CAAA;QACrB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAE1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACxB,OAAO,OAAO,CAAA;IAChB,CAAC;;AArDH,0DAsDC;AAhDQ,yCAAiB,GAAG,KAAK,CAAA"}
@@ -57,7 +57,7 @@ exports.baseCapiObject = {
57
57
  leadImages: [],
58
58
  accessLevel: 'premium',
59
59
  embeds: [],
60
- publishedDate: '',
60
+ publishedDate: '2024-04-02T10:00:09.935Z',
61
61
  firstPublishedDate: '',
62
62
  };
63
63
  //# sourceMappingURL=capiObject.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capiObject.js","sourceRoot":"","sources":["../../src/fixtures/capiObject.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAoB;IAC7C,EAAE,EAAE,8DAA8D;IAClE,IAAI,EAAE,4CAA4C;IAClD,KAAK,EAAE,CAAC,4CAA4C,CAAC;IACrD,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,4DAA4D;IACnE,UAAU,EAAE,EAAE;IACd,MAAM,EAAE,uBAAuB;IAC/B,OAAO,EAAE,imQAAimQ;IAC1mQ,WAAW,EAAE;QACX;YACE,MAAM,EAAE,+DAA+D;YACvE,UAAU,EAAE,kCAAkC;YAC9C,EAAE,EAAE,+DAA+D;YACnE,SAAS,EAAE,6CAA6C;YACxD,SAAS,EAAE,qBAAqB;YAChC,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,uCAAuC;gBACvC,4CAA4C;gBAC5C,kCAAkC;aACnC;SACF;QACD;YACE,MAAM,EAAE,+DAA+D;YACvE,UAAU,EAAE,kCAAkC;YAC9C,EAAE,EAAE,+DAA+D;YACnE,SAAS,EAAE,0CAA0C;YACrD,SAAS,EAAE,sBAAsB;YACjC,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,uCAAuC;gBACvC,4CAA4C;gBAC5C,kCAAkC;aACnC;SACF;QACD;YACE,EAAE,EAAE,+DAA+D;YACnE,SAAS,EAAE,iDAAiD;YAC5D,SAAS,EAAE,aAAa;YACxB,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,EAAE;YACd,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;SACV;KACF;IACD,SAAS,EAAE;QACT,EAAE,EAAE,EAAE;QACN,IAAI,EAAE,0CAAmD;QACzD,KAAK,EAAE,EAAE;QACT,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,uCAAuC;KACnD;IACD,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,SAAkB;IAC/B,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,kBAAkB,EAAE,EAAE;CACvB,CAAA"}
1
+ {"version":3,"file":"capiObject.js","sourceRoot":"","sources":["../../src/fixtures/capiObject.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAoB;IAC7C,EAAE,EAAE,8DAA8D;IAClE,IAAI,EAAE,4CA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