@financial-times/cp-content-pipeline-schema 0.2.1

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 (100) hide show
  1. package/.toolkitrc.yml +12 -0
  2. package/CHANGELOG.md +72 -0
  3. package/jest.config.js +3 -0
  4. package/lib/concept.d.ts +7 -0
  5. package/lib/concept.js +39 -0
  6. package/lib/concept.js.map +1 -0
  7. package/lib/constants/contentTypes.d.ts +2 -0
  8. package/lib/constants/contentTypes.js +3 -0
  9. package/lib/constants/contentTypes.js.map +1 -0
  10. package/lib/content.d.ts +55 -0
  11. package/lib/content.js +133 -0
  12. package/lib/content.js.map +1 -0
  13. package/lib/content.test.d.ts +1 -0
  14. package/lib/content.test.js +149 -0
  15. package/lib/content.test.js.map +1 -0
  16. package/lib/datasources/capi.d.ts +10 -0
  17. package/lib/datasources/capi.js +28 -0
  18. package/lib/datasources/capi.js.map +1 -0
  19. package/lib/datasources/index.d.ts +9 -0
  20. package/lib/datasources/index.js +9 -0
  21. package/lib/datasources/index.js.map +1 -0
  22. package/lib/datasources/origami-image.d.ts +8 -0
  23. package/lib/datasources/origami-image.js +11 -0
  24. package/lib/datasources/origami-image.js.map +1 -0
  25. package/lib/datasources/url-management.d.ts +11 -0
  26. package/lib/datasources/url-management.js +40 -0
  27. package/lib/datasources/url-management.js.map +1 -0
  28. package/lib/datasources/url-management.test.d.ts +1 -0
  29. package/lib/datasources/url-management.test.js +69 -0
  30. package/lib/datasources/url-management.test.js.map +1 -0
  31. package/lib/helpers/byline.d.ts +1 -0
  32. package/lib/helpers/byline.js +5 -0
  33. package/lib/helpers/byline.js.map +1 -0
  34. package/lib/helpers/imageService.d.ts +8 -0
  35. package/lib/helpers/imageService.js +13 -0
  36. package/lib/helpers/imageService.js.map +1 -0
  37. package/lib/helpers/metadata.d.ts +12 -0
  38. package/lib/helpers/metadata.js +60 -0
  39. package/lib/helpers/metadata.js.map +1 -0
  40. package/lib/helpers/syntaxTree.d.ts +23 -0
  41. package/lib/helpers/syntaxTree.js +23 -0
  42. package/lib/helpers/syntaxTree.js.map +1 -0
  43. package/lib/image.d.ts +25 -0
  44. package/lib/image.js +123 -0
  45. package/lib/image.js.map +1 -0
  46. package/lib/image.test.d.ts +1 -0
  47. package/lib/image.test.js +235 -0
  48. package/lib/image.test.js.map +1 -0
  49. package/lib/index.d.ts +8 -0
  50. package/lib/index.js +69 -0
  51. package/lib/index.js.map +1 -0
  52. package/lib/picture.d.ts +22 -0
  53. package/lib/picture.js +80 -0
  54. package/lib/picture.js.map +1 -0
  55. package/lib/richText.d.ts +14 -0
  56. package/lib/richText.js +48 -0
  57. package/lib/richText.js.map +1 -0
  58. package/lib/tags.d.ts +13 -0
  59. package/lib/tags.js +178 -0
  60. package/lib/tags.js.map +1 -0
  61. package/lib/topper.d.ts +7 -0
  62. package/lib/topper.js +196 -0
  63. package/lib/topper.js.map +1 -0
  64. package/lib/unified-plugins/extract-references.d.ts +7 -0
  65. package/lib/unified-plugins/extract-references.js +36 -0
  66. package/lib/unified-plugins/extract-references.js.map +1 -0
  67. package/lib/unified-plugins/map-to-abstract-types.d.ts +4 -0
  68. package/lib/unified-plugins/map-to-abstract-types.js +17 -0
  69. package/lib/unified-plugins/map-to-abstract-types.js.map +1 -0
  70. package/package.json +43 -0
  71. package/src/__snapshots__/content.test.ts.snap +118 -0
  72. package/src/concept.ts +58 -0
  73. package/src/constants/contentTypes.ts +4 -0
  74. package/src/content.test.ts +163 -0
  75. package/src/content.ts +146 -0
  76. package/src/datasources/capi.ts +28 -0
  77. package/src/datasources/index.ts +11 -0
  78. package/src/datasources/origami-image.ts +10 -0
  79. package/src/datasources/url-management.test.ts +92 -0
  80. package/src/datasources/url-management.ts +65 -0
  81. package/src/helpers/byline.ts +4 -0
  82. package/src/helpers/imageService.ts +31 -0
  83. package/src/helpers/metadata.ts +88 -0
  84. package/src/helpers/syntaxTree.ts +26 -0
  85. package/src/image.test.ts +339 -0
  86. package/src/image.ts +154 -0
  87. package/src/index.ts +87 -0
  88. package/src/picture.ts +98 -0
  89. package/src/richText.ts +62 -0
  90. package/src/tags.ts +237 -0
  91. package/src/topper.ts +228 -0
  92. package/src/types/internal-content.d.ts +78 -0
  93. package/src/types/n-concept-ids.d.ts +16 -0
  94. package/src/types/n-display-metadata.d.ts +1 -0
  95. package/src/types/n-url-management-api-read-client.d.ts +11 -0
  96. package/src/types/next-metrics.d.ts +1 -0
  97. package/src/unified-plugins/extract-references.ts +50 -0
  98. package/src/unified-plugins/map-to-abstract-types.ts +21 -0
  99. package/tsconfig.json +10 -0
  100. package/tsconfig.tsbuildinfo +1 -0
package/lib/tags.js ADDED
@@ -0,0 +1,178 @@
1
+ var _a, _b, _c, _d, _e;
2
+ import { select, matches } from 'hast-util-select';
3
+ import { toText } from 'hast-util-to-text';
4
+ import { gql } from 'graphql-tag';
5
+ import { uuidFromUrl } from './helpers/metadata.js';
6
+ function createTagWithoutReference(name, selector) {
7
+ const tag = class {
8
+ static match(node) {
9
+ return matches(selector, node);
10
+ }
11
+ };
12
+ Object.defineProperty(tag, 'name', { value: name });
13
+ return tag;
14
+ }
15
+ const Recommended = (_a = class Recommended {
16
+ constructor(node) {
17
+ var _a;
18
+ const ftContent = select('FTContent', node);
19
+ const recommendedTitle = select('RecommendedTitle', node);
20
+ if (((_a = ftContent === null || ftContent === void 0 ? void 0 : ftContent.properties) === null || _a === void 0 ? void 0 : _a.url) !== undefined &&
21
+ typeof ftContent.properties.url === 'string') {
22
+ this.uuid = uuidFromUrl(ftContent.properties.url);
23
+ }
24
+ else {
25
+ this.uuid = '';
26
+ }
27
+ this.title = recommendedTitle ? toText(recommendedTitle) : 'Recommended';
28
+ this.teaserTitleOverride = ftContent ? toText(ftContent) : null;
29
+ }
30
+ static match(node) {
31
+ return node.tagName === 'recommended';
32
+ }
33
+ },
34
+ _a.resolve = {
35
+ async teaser(parent, args, context) {
36
+ const content = await context.dataSources.capi.getContent(parent.uuid);
37
+ return {
38
+ ...content,
39
+ title: parent.teaserTitleOverride || content.title,
40
+ };
41
+ },
42
+ },
43
+ _a.typeDef = gql `
44
+ type Recommended {
45
+ teaser: Content!
46
+ title: String!
47
+ }
48
+ `,
49
+ _a);
50
+ const ImageSet = (_b = class ImageSet {
51
+ constructor(node, contentApiData) {
52
+ var _a, _b, _c;
53
+ this.url = '';
54
+ if (typeof ((_a = node === null || node === void 0 ? void 0 : node.properties) === null || _a === void 0 ? void 0 : _a.url) === 'string') {
55
+ this.url = (_b = node.properties.url) !== null && _b !== void 0 ? _b : '';
56
+ }
57
+ const embed = (_c = contentApiData === null || contentApiData === void 0 ? void 0 : contentApiData.embeds) === null || _c === void 0 ? void 0 : _c.find((embed) => uuidFromUrl(embed.id) === uuidFromUrl(this.url));
58
+ this.imageSet = embed;
59
+ }
60
+ static match(node) {
61
+ var _a;
62
+ return (node.tagName === 'ft-content' &&
63
+ ((_a = node.properties) === null || _a === void 0 ? void 0 : _a.type) === 'http://www.ft.com/ontology/content/ImageSet');
64
+ }
65
+ },
66
+ _b.resolve = {
67
+ picture: (parent) => parent.imageSet,
68
+ },
69
+ _b.typeDef = gql `
70
+ type ImageSet {
71
+ picture: Picture!
72
+ }
73
+ `,
74
+ _b);
75
+ const FTContent = (_c = class FTContent {
76
+ constructor(node) {
77
+ var _a, _b, _c, _d;
78
+ if (typeof ((_a = node === null || node === void 0 ? void 0 : node.properties) === null || _a === void 0 ? void 0 : _a.url) === 'string') {
79
+ this.url = (_b = node.properties.url) !== null && _b !== void 0 ? _b : '';
80
+ }
81
+ else {
82
+ this.url = '';
83
+ }
84
+ if (typeof ((_c = node === null || node === void 0 ? void 0 : node.properties) === null || _c === void 0 ? void 0 : _c.type) === 'string') {
85
+ this.type = (_d = node.properties.type) !== null && _d !== void 0 ? _d : '';
86
+ }
87
+ else {
88
+ this.type = '';
89
+ }
90
+ }
91
+ static match(node) {
92
+ return node.tagName === 'ft-content';
93
+ }
94
+ },
95
+ _c.typeDef = gql `
96
+ type FTContent {
97
+ type: String
98
+ url: String
99
+ }
100
+ `,
101
+ _c);
102
+ const LayoutImage = (_d = class LayoutImage {
103
+ constructor(node) {
104
+ var _a, _b, _c, _d;
105
+ this.src = (_a = node.properties) === null || _a === void 0 ? void 0 : _a.src;
106
+ this.id = uuidFromUrl(this.src) || '';
107
+ this.alt = (_b = node.properties) === null || _b === void 0 ? void 0 : _b.alt;
108
+ this.longDesc = (_c = node.properties) === null || _c === void 0 ? void 0 : _c.longDesc;
109
+ this.copyright = (_d = node.properties) === null || _d === void 0 ? void 0 : _d.dataCopyright;
110
+ }
111
+ static match(node) {
112
+ return matches('img', node);
113
+ }
114
+ },
115
+ _d.resolve = {
116
+ picture(parent) {
117
+ return {
118
+ id: 'layout-imageset',
119
+ description: parent.alt,
120
+ type: 'http://www.ft.com/ontology/content/ImageSet',
121
+ members: [
122
+ {
123
+ id: parent.id,
124
+ description: parent.alt,
125
+ title: parent.longDesc,
126
+ binaryUrl: parent.src,
127
+ copyright: {
128
+ notice: parent.copyright,
129
+ },
130
+ type: 'http://www.ft.com/ontology/content/Image',
131
+ },
132
+ ],
133
+ };
134
+ },
135
+ },
136
+ _d.typeDef = gql `
137
+ type LayoutImage {
138
+ picture: Picture!
139
+ }
140
+ `,
141
+ _d);
142
+ const Link = (_e = class Link {
143
+ constructor(node) {
144
+ var _a, _b;
145
+ if (typeof ((_a = node === null || node === void 0 ? void 0 : node.properties) === null || _a === void 0 ? void 0 : _a.href) === 'string') {
146
+ this.href = (_b = node.properties.href) !== null && _b !== void 0 ? _b : '';
147
+ }
148
+ else {
149
+ this.href = '';
150
+ }
151
+ }
152
+ static match(node) {
153
+ return node.tagName === 'a';
154
+ }
155
+ },
156
+ _e.typeDef = gql `
157
+ type Link {
158
+ href: String
159
+ }
160
+ `,
161
+ _e);
162
+ const mapping = {
163
+ Link,
164
+ Experimental: createTagWithoutReference('Experimental', 'experimental'),
165
+ ImageSet,
166
+ FTContent,
167
+ Recommended,
168
+ RecommendedTitle: createTagWithoutReference('RecommendedTitle', 'recommended-title'),
169
+ Paragraph: createTagWithoutReference('Paragraph', 'p'),
170
+ UnorderedList: createTagWithoutReference('UnorderedList', 'ul'),
171
+ ListItem: createTagWithoutReference('ListItem', 'li'),
172
+ Layout: createTagWithoutReference('Layout', '.n-content-layout, .layout'),
173
+ LayoutContainer: createTagWithoutReference('LayoutContainer', '.n-content-layout__container, .layout-container'),
174
+ LayoutSlot: createTagWithoutReference('LayoutSlot', '.n-content-layout__slot, .layout-slot'),
175
+ LayoutImage,
176
+ };
177
+ export default mapping;
178
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../src/tags.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAkBnD,SAAS,yBAAyB,CAChC,IAAY,EACZ,QAAgB;IAEhB,MAAM,GAAG,GAAG;QACV,MAAM,CAAC,KAAK,CAAC,IAAkB;YAC7B,OAAO,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAChC,CAAC;KACF,CAAA;IAED,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAEnD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,WAAW,SAAmB,MAAM,WAAW;QASnD,YAAY,IAAkB;;YAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;YAC3C,MAAM,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAA;YACzD,IACE,CAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAA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AmB,MAAM,IAAI;QAOrC,YAAY,IAAkB;;YAC5B,IAAI,OAAO,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,0CAAE,IAAI,CAAA,KAAK,QAAQ,EAAE;gBAC9C,IAAI,CAAC,IAAI,GAAG,MAAA,IAAI,CAAC,UAAU,CAAC,IAAI,mCAAI,EAAE,CAAA;aACvC;iBAAM;gBACL,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;aACf;QACH,CAAC;QAVD,MAAM,CAAC,KAAK,CAAC,IAAkB;YAC7B,OAAO,IAAI,CAAC,OAAO,KAAK,GAAG,CAAA;QAC7B,CAAC;KAeF;IALQ,UAAO,GAAG,GAAG,CAAA;;;;GAInB;OACF,CAAA;AAED,MAAM,OAAO,GAAmC;IAC9C,IAAI;IACJ,YAAY,EAAE,yBAAyB,CAAC,cAAc,EAAE,cAAc,CAAC;IACvE,QAAQ;IACR,SAAS;IACT,WAAW;IACX,gBAAgB,EAAE,yBAAyB,CACzC,kBAAkB,EAClB,mBAAmB,CACpB;IACD,SAAS,EAAE,yBAAyB,CAAC,WAAW,EAAE,GAAG,CAAC;IACtD,aAAa,EAAE,yBAAyB,CAAC,eAAe,EAAE,IAAI,CAAC;IAC/D,QAAQ,EAAE,yBAAyB,CAAC,UAAU,EAAE,IAAI,CAAC;IACrD,MAAM,EAAE,yBAAyB,CAAC,QAAQ,EAAE,4BAA4B,CAAC;IACzE,eAAe,EAAE,yBAAyB,CACxC,iBAAiB,EACjB,iDAAiD,CAClD;IACD,UAAU,EAAE,yBAAyB,CACnC,YAAY,EACZ,uCAAuC,CACxC;IACD,WAAW;CACZ,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { IResolvers } from '@graphql-tools/utils';
2
+ import type { DataSources } from './datasources/index.js';
3
+ export declare const typeDef: import("graphql").DocumentNode;
4
+ export declare const resolvers: IResolvers<unknown, {
5
+ systemCode: string;
6
+ dataSources: DataSources;
7
+ }, never>;
package/lib/topper.js ADDED
@@ -0,0 +1,196 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { isOpinion, getAuthor, getDisplayConcept, getBrandConcept, } from './helpers/metadata.js';
3
+ import imageServiceUrl from './helpers/imageService.js';
4
+ const BasicTopperFields = `
5
+ headline: String!
6
+ intro: RichText
7
+ backgroundColour: TopperBackgroundColour
8
+ displayConcept: Concept
9
+ `;
10
+ const TopperWithImagesFields = `
11
+ images: TopperImages
12
+ `;
13
+ const TopperWithThemeFields = `
14
+ isLargeHeadline: Boolean
15
+ layout: String
16
+ `;
17
+ const TopperWithHeadshotFields = `
18
+ headshot(width: Int, dpr: Int): String
19
+ `;
20
+ /*
21
+ * List of acceptable topper background colours as supported in Origami https://github.com/Financial-Times/origami/tree/main/components/o-topper#colors
22
+ *
23
+ */
24
+ export const typeDef = gql `
25
+ enum TopperBackgroundColour {
26
+ paper
27
+ wheat
28
+ white
29
+ black
30
+ claret
31
+ oxford
32
+ slate
33
+ crimson
34
+ sky
35
+ }
36
+
37
+ type TopperImages {
38
+ standard: Image
39
+ square: Image
40
+ wide: Image
41
+ fallback: Image
42
+ }
43
+
44
+ interface Topper {
45
+ ${BasicTopperFields}
46
+ }
47
+
48
+ interface TopperWithImages {
49
+ ${TopperWithImagesFields}
50
+ }
51
+
52
+ interface TopperWithTheme {
53
+ ${TopperWithThemeFields}
54
+ }
55
+
56
+ interface TopperWithHeadshot {
57
+ ${TopperWithHeadshotFields}
58
+ }
59
+
60
+ type BasicTopper implements Topper {
61
+ ${BasicTopperFields}
62
+ }
63
+
64
+ type SplitTextTopper implements Topper & TopperWithImages & TopperWithTheme {
65
+ ${BasicTopperFields}
66
+ ${TopperWithImagesFields}
67
+ ${TopperWithThemeFields}
68
+ }
69
+
70
+ type FullBleedTopper implements Topper & TopperWithImages & TopperWithTheme {
71
+ ${BasicTopperFields}
72
+ ${TopperWithImagesFields}
73
+ ${TopperWithThemeFields}
74
+ }
75
+
76
+ type OpinionTopper implements Topper & TopperWithTheme & TopperWithHeadshot {
77
+ ${BasicTopperFields}
78
+ ${TopperWithThemeFields}
79
+ ${TopperWithHeadshotFields}
80
+ columnist: Concept
81
+ }
82
+
83
+ type BrandedTopper implements Topper & TopperWithTheme {
84
+ ${BasicTopperFields}
85
+ ${TopperWithThemeFields}
86
+ brandConcept: Concept
87
+ }
88
+ `;
89
+ export const resolvers = {
90
+ Topper: {
91
+ __resolveType(content) {
92
+ var _a, _b, _c, _d;
93
+ if ((_b = (_a = content.topper) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.startsWith('split')) {
94
+ return 'SplitTextTopper';
95
+ }
96
+ else if ((_d = (_c = content.topper) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.startsWith('full-bleed')) {
97
+ return 'FullBleedTopper';
98
+ }
99
+ else if (isOpinion(content)) {
100
+ return 'OpinionTopper';
101
+ }
102
+ else if (getBrandConcept(content)) {
103
+ return 'BrandedTopper';
104
+ }
105
+ else {
106
+ return 'BasicTopper';
107
+ }
108
+ },
109
+ headline(content) {
110
+ var _a;
111
+ return ((_a = content.topper) === null || _a === void 0 ? void 0 : _a.headline) || content.title;
112
+ },
113
+ intro(content) {
114
+ return content.summary
115
+ ? {
116
+ value: content.summary.bodyXML,
117
+ source: 'summary',
118
+ }
119
+ : {
120
+ value: content.standfirst,
121
+ source: 'standfirst',
122
+ };
123
+ },
124
+ backgroundColour(content) {
125
+ var _a, _b;
126
+ if (((_a = content.topper) === null || _a === void 0 ? void 0 : _a.backgroundColour) &&
127
+ ((_b = content.topper) === null || _b === void 0 ? void 0 : _b.backgroundColour) !== 'auto') {
128
+ return content.topper.backgroundColour;
129
+ }
130
+ else {
131
+ return 'paper';
132
+ }
133
+ },
134
+ displayConcept(content) {
135
+ return getDisplayConcept(content);
136
+ },
137
+ },
138
+ TopperWithImages: {
139
+ images(content) {
140
+ var _a, _b;
141
+ const groupedImages = {};
142
+ content.leadImages.forEach((leadImage) => {
143
+ groupedImages[leadImage.type] = leadImage.image;
144
+ });
145
+ if (((_a = content.mainImage) === null || _a === void 0 ? void 0 : _a.type) ===
146
+ 'http://www.ft.com/ontology/content/ImageSet') {
147
+ groupedImages.fallback = content.mainImage.members[0];
148
+ }
149
+ else if (((_b = content.mainImage) === null || _b === void 0 ? void 0 : _b.type) === 'http://www.ft.com/ontology/content/Image') {
150
+ groupedImages.fallback = content.mainImage;
151
+ }
152
+ return groupedImages;
153
+ },
154
+ },
155
+ TopperWithTheme: {
156
+ isLargeHeadline: () => false,
157
+ layout(content) {
158
+ var _a;
159
+ return ((_a = content.topper) === null || _a === void 0 ? void 0 : _a.layout) || 'branded';
160
+ },
161
+ },
162
+ SplitTextTopper: {
163
+ isLargeHeadline: () => true,
164
+ },
165
+ FullBleedTopper: {
166
+ isLargeHeadline: () => true,
167
+ },
168
+ OpinionTopper: {
169
+ backgroundColour: () => 'sky',
170
+ async headshot(content, args, context) {
171
+ const author = getAuthor(content);
172
+ if (!author)
173
+ return;
174
+ const authorId = author.id.replace(/^https?:\/\/(?:www|api)\.ft\.com\/things?\//, '');
175
+ const peopleData = await context.dataSources.capi.getPerson(authorId);
176
+ if (!peopleData || !peopleData._imageUrl)
177
+ return;
178
+ return imageServiceUrl({
179
+ url: peopleData._imageUrl,
180
+ systemCode: context.systemCode,
181
+ width: args.width || 150,
182
+ dpr: args.dpr,
183
+ });
184
+ },
185
+ columnist(content) {
186
+ return getAuthor(content);
187
+ },
188
+ },
189
+ BrandedTopper: {
190
+ backgroundColour: () => 'wheat',
191
+ brandConcept(content) {
192
+ return getBrandConcept(content);
193
+ },
194
+ },
195
+ };
196
+ //# sourceMappingURL=topper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topper.js","sourceRoot":"","sources":["../src/topper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAGjC,OAAO,EACL,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,e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CACF,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { Element } from 'hast';
2
+ import { Plugin } from 'unified';
3
+ import type { InternalContent } from '../types/internal-content.js';
4
+ declare function extractReferences({ contentApiData, }: {
5
+ contentApiData?: InternalContent;
6
+ }): Plugin<[], Element, Element>;
7
+ export default extractReferences;
@@ -0,0 +1,36 @@
1
+ import { visit } from 'unist-util-visit';
2
+ import tags from '../tags.js';
3
+ function isHastElement(element) {
4
+ return element.type === 'element';
5
+ }
6
+ function extractReferences({ contentApiData, }) {
7
+ return function () {
8
+ const data = this.data();
9
+ return (tree) => {
10
+ const references = [];
11
+ let id = 0;
12
+ visit(tree, (node) => {
13
+ if (isHastElement(node)) {
14
+ const tagName = node.tagName;
15
+ const tag = tags[tagName];
16
+ return Boolean(tag) && tag.hasOwnProperty('resolve');
17
+ }
18
+ return false;
19
+ }, (node) => {
20
+ if (isHastElement(node)) {
21
+ if (node.properties) {
22
+ node.properties.dataReferenceId = id++;
23
+ }
24
+ else {
25
+ node.properties = { dataReferenceId: id++ };
26
+ }
27
+ const Tag = tags[node.tagName];
28
+ references.push(new Tag(node, contentApiData));
29
+ }
30
+ });
31
+ data.references = references;
32
+ };
33
+ };
34
+ }
35
+ export default extractReferences;
36
+ //# sourceMappingURL=extract-references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-references.js","sourceRoot":"","sources":["../../src/unified-plugins/extract-references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAExC,OAAO,IAAa,MAAM,YAAY,CAAA;AAItC,SAAS,aAAa,CAAC,OAAa;IAClC,OAAO,OAAO,CAAC,IAAI,KAAK,SAAS,CAAA;AACnC,CAAC;AAED,SAAS,iBAAiB,CAAC,EACzB,cAAc,GAGf;IACC,OAAO;QACL,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QACxB,OAAO,CAAC,IAAa,EAAE,EAAE;YACvB,MAAM,UAAU,GAAU,EAAE,CAAA;YAE5B,IAAI,EAAE,GAAG,CAAC,CAAA;YACV,KAAK,CACH,IAAI,EACJ,CAAC,IAAS,EAAE,EAAE;gBACZ,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;oBACvB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;oBAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,CAAA;oBACzB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;iBACrD;gBACD,OAAO,KAAK,CAAA;YACd,CAAC,EACD,CAAC,IAAS,EAAE,EAAE;gBACZ,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;oBACvB,IAAI,IAAI,CAAC,UAAU,EAAE;wBACnB,IAAI,CAAC,UAAU,CAAC,eAAe,GAAG,EAAE,EAAE,CAAA;qBACvC;yBAAM;wBACL,IAAI,CAAC,UAAU,GAAG,EAAE,eAAe,EAAE,EAAE,EAAE,EAAE,CAAA;qBAC5C;oBAED,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;oBAC9B,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAA;iBAC/C;YACH,CAAC,CACF,CAAA;YACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC9B,CAAC,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Element } from 'hast';
2
+ import { Plugin } from 'unified';
3
+ declare const mapToAbstractTypes: Plugin<[], Element, Element>;
4
+ export default mapToAbstractTypes;
@@ -0,0 +1,17 @@
1
+ import { visit } from 'unist-util-visit';
2
+ import tags from '../tags.js';
3
+ const mapToAbstractTypes = function () {
4
+ return (tree) => {
5
+ visit(tree, (node) => {
6
+ if (isHastElement(node)) {
7
+ const mappedTag = Object.keys(tags).find((tag) => tags[tag].match(node));
8
+ node.tagName = mappedTag || node.tagName;
9
+ }
10
+ });
11
+ };
12
+ };
13
+ export default mapToAbstractTypes;
14
+ function isHastElement(element) {
15
+ return element.tagName !== undefined;
16
+ }
17
+ //# sourceMappingURL=map-to-abstract-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-to-abstract-types.js","sourceRoot":"","sources":["../../src/unified-plugins/map-to-abstract-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAGxC,OAAO,IAAI,MAAM,YAAY,CAAA;AAE7B,MAAM,kBAAkB,GAAiC;IACvD,OAAO,CAAC,IAAa,EAAE,EAAE;QACvB,KAAK,CAAC,IAAI,EAAE,CAAC,IAAS,EAAE,EAAE;YACxB,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;gBACvB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;gBACxE,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,IAAI,CAAC,OAAO,CAAA;aACzC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC,CAAA;AAED,eAAe,kBAAkB,CAAA;AAEjC,SAAS,aAAa,CAAC,OAAuB;IAC5C,OAAQ,OAAmB,CAAC,OAAO,KAAK,SAAS,CAAA;AACnD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@financial-times/cp-content-pipeline-schema",
3
+ "version": "0.2.1",
4
+ "description": "",
5
+ "main": "lib/index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "dotcom-tool-kit test:local",
9
+ "build": "dotcom-tool-kit build:local",
10
+ "start": "dotcom-tool-kit run:local"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/Financial-Times/cp-content-pipeline.git"
15
+ },
16
+ "license": "ISC",
17
+ "bugs": {
18
+ "url": "https://github.com/Financial-Times/cp-content-pipeline/issues"
19
+ },
20
+ "homepage": "https://github.com/Financial-Times/cp-content-pipeline#readme",
21
+ "dependencies": {
22
+ "@financial-times/n-concept-ids": "^1.21.0",
23
+ "@financial-times/n-display-metadata": "^1.1.1",
24
+ "@financial-times/n-url-management-api-read-client": "^7.0.0",
25
+ "@graphql-tools/utils": "^8.12.0",
26
+ "apollo-datasource-rest": "^3.6.1",
27
+ "apollo-server-caching": "^3.3.0",
28
+ "graphql": "^16.6.0",
29
+ "graphql-tag": "^2.12.6",
30
+ "hast-util-select": "^5.0.2",
31
+ "hast-util-to-text": "^3.1.1",
32
+ "next-metrics": "^7.4.0",
33
+ "rehype-parse": "^8.0.4",
34
+ "unified": "^10.1.2",
35
+ "unist-util-select": "^4.0.1",
36
+ "unist-util-visit": "^4.1.1"
37
+ },
38
+ "devDependencies": {
39
+ "@dotcom-tool-kit/npm": "^2.0.9",
40
+ "@types/graphql": "^14.5.0",
41
+ "@types/hast": "^2.3.4"
42
+ }
43
+ }
@@ -0,0 +1,118 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`byline transformation adds a link around a single known author 1`] = `
4
+ Object {
5
+ "children": Array [
6
+ Object {
7
+ "children": Array [
8
+ Object {
9
+ "type": "text",
10
+ "value": "Chris Giles",
11
+ },
12
+ ],
13
+ "properties": Object {
14
+ "href": "https://www.ft.com/stream/uuid/1d556016-ad16-4fe7-8724-42b3fb15ad28",
15
+ },
16
+ "tagName": "Link",
17
+ "type": "element",
18
+ },
19
+ Object {
20
+ "type": "text",
21
+ "value": " in London",
22
+ },
23
+ ],
24
+ "type": "root",
25
+ }
26
+ `;
27
+
28
+ exports[`byline transformation adds links around multiple known authors 1`] = `
29
+ Object {
30
+ "children": Array [
31
+ Object {
32
+ "children": Array [
33
+ Object {
34
+ "type": "text",
35
+ "value": "Chris Giles",
36
+ },
37
+ ],
38
+ "properties": Object {
39
+ "href": "https://www.ft.com/stream/uuid/1d556016-ad16-4fe7-8724-42b3fb15ad28",
40
+ },
41
+ "tagName": "Link",
42
+ "type": "element",
43
+ },
44
+ Object {
45
+ "type": "text",
46
+ "value": " and ",
47
+ },
48
+ Object {
49
+ "children": Array [
50
+ Object {
51
+ "type": "text",
52
+ "value": "Martin Wolf",
53
+ },
54
+ ],
55
+ "properties": Object {
56
+ "href": "https://www.ft.com/stream/uuid/7c1e1e72-57ae-4461-862a-f8d24dd42e22",
57
+ },
58
+ "tagName": "Link",
59
+ "type": "element",
60
+ },
61
+ Object {
62
+ "type": "text",
63
+ "value": " in London",
64
+ },
65
+ ],
66
+ "type": "root",
67
+ }
68
+ `;
69
+
70
+ exports[`byline transformation ignores extra authors in annotations array 1`] = `
71
+ Object {
72
+ "children": Array [
73
+ Object {
74
+ "children": Array [
75
+ Object {
76
+ "type": "text",
77
+ "value": "Martin Wolf",
78
+ },
79
+ ],
80
+ "properties": Object {
81
+ "href": "https://www.ft.com/stream/uuid/7c1e1e72-57ae-4461-862a-f8d24dd42e22",
82
+ },
83
+ "tagName": "Link",
84
+ "type": "element",
85
+ },
86
+ Object {
87
+ "type": "text",
88
+ "value": " in London",
89
+ },
90
+ ],
91
+ "type": "root",
92
+ }
93
+ `;
94
+
95
+ exports[`byline transformation ignores unknown authors in byline text 1`] = `
96
+ Object {
97
+ "children": Array [
98
+ Object {
99
+ "children": Array [
100
+ Object {
101
+ "type": "text",
102
+ "value": "Chris Giles",
103
+ },
104
+ ],
105
+ "properties": Object {
106
+ "href": "https://www.ft.com/stream/uuid/1d556016-ad16-4fe7-8724-42b3fb15ad28",
107
+ },
108
+ "tagName": "Link",
109
+ "type": "element",
110
+ },
111
+ Object {
112
+ "type": "text",
113
+ "value": " and Nick Ramsbottom in London",
114
+ },
115
+ ],
116
+ "type": "root",
117
+ }
118
+ `;