@financial-times/cp-content-pipeline-schema 0.7.27 → 0.7.29
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 +19 -0
- package/lib/fixtures/dummyContext.d.ts +3 -0
- package/lib/fixtures/dummyContext.js +24 -0
- package/lib/fixtures/dummyContext.js.map +1 -0
- package/lib/generated/index.d.ts +36 -13
- package/lib/model/Byline.d.ts +6 -3
- package/lib/model/Byline.js +14 -9
- package/lib/model/Byline.js.map +1 -1
- package/lib/model/Byline.test.js +19 -14
- package/lib/model/Byline.test.js.map +1 -1
- package/lib/model/CapiResponse.d.ts +5 -6
- package/lib/model/CapiResponse.js +15 -15
- package/lib/model/CapiResponse.js.map +1 -1
- package/lib/model/CapiResponse.test.js +8 -19
- package/lib/model/CapiResponse.test.js.map +1 -1
- package/lib/model/schemas/capi/content-package.d.ts +8 -8
- package/lib/model/schemas/capi/content-package.js +8 -2
- package/lib/model/schemas/capi/content-package.js.map +1 -1
- package/lib/resolvers/concept.js +1 -0
- package/lib/resolvers/concept.js.map +1 -1
- package/lib/resolvers/content.d.ts +4 -4
- package/lib/resolvers/content.js +4 -3
- package/lib/resolvers/content.js.map +1 -1
- package/lib/resolvers/index.d.ts +8 -8
- package/lib/resolvers/teaser.d.ts +4 -4
- package/package.json +1 -1
- package/src/fixtures/dummyContext.ts +28 -0
- package/src/generated/index.ts +50 -13
- package/src/model/Byline.test.ts +16 -14
- package/src/model/Byline.ts +27 -19
- package/src/model/CapiResponse.test.ts +1 -25
- package/src/model/CapiResponse.ts +20 -21
- package/src/model/schemas/capi/content-package.ts +17 -9
- package/src/resolvers/concept.ts +1 -3
- package/src/resolvers/content.ts +11 -3
- package/src/types/internal-content.d.ts +2 -0
- package/src/types/n-display-metadata.d.ts +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/typedefs/concept.graphql +4 -3
- package/typedefs/content.graphql +7 -7
|
@@ -6,23 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const CapiResponse_1 = require("./CapiResponse");
|
|
7
7
|
const capiObject_1 = require("../fixtures/capiObject");
|
|
8
8
|
const clone_deep_1 = __importDefault(require("clone-deep"));
|
|
9
|
-
const
|
|
10
|
-
const context = {
|
|
11
|
-
dataSources: {
|
|
12
|
-
capi: {
|
|
13
|
-
getContent: (id) => Promise.resolve(new CapiResponse_1.CapiResponse((0, clone_deep_1.default)({
|
|
14
|
-
...capiObject_1.baseCapiObject,
|
|
15
|
-
id,
|
|
16
|
-
publishedDate: new Date(now + parseInt(id.slice(-1), 10)).toISOString(),
|
|
17
|
-
}), {})),
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
9
|
+
const dummyContext_1 = __importDefault(require("../fixtures/dummyContext"));
|
|
21
10
|
describe('CAPI response', () => {
|
|
22
11
|
describe('Content ID', () => {
|
|
23
12
|
test('returns the UUID', () => {
|
|
24
13
|
const article = (0, clone_deep_1.default)(capiObject_1.baseCapiObject);
|
|
25
|
-
const capiResponse = new CapiResponse_1.CapiResponse(article,
|
|
14
|
+
const capiResponse = new CapiResponse_1.CapiResponse(article, dummyContext_1.default);
|
|
26
15
|
expect(capiResponse.id()).toEqual('3071cae8-a27c-4ab4-a0d4-7bb00df1d477');
|
|
27
16
|
});
|
|
28
17
|
});
|
|
@@ -39,7 +28,7 @@ describe('CAPI response', () => {
|
|
|
39
28
|
prefLabel: straighQuoteAuthorName,
|
|
40
29
|
},
|
|
41
30
|
];
|
|
42
|
-
const capiResponse = new CapiResponse_1.CapiResponse(article,
|
|
31
|
+
const capiResponse = new CapiResponse_1.CapiResponse(article, dummyContext_1.default);
|
|
43
32
|
expect(capiResponse.getAuthorUrlMapping().get(curlyQuoteAuthorName)).toBeDefined();
|
|
44
33
|
expect(capiResponse.getAuthorUrlMapping().get(straighQuoteAuthorName)).toBeUndefined();
|
|
45
34
|
});
|
|
@@ -48,7 +37,7 @@ describe('CAPI response', () => {
|
|
|
48
37
|
test(`uses first entry in types if there's no type`, () => {
|
|
49
38
|
const article = (0, clone_deep_1.default)(capiObject_1.baseCapiObject);
|
|
50
39
|
delete article.type;
|
|
51
|
-
const capiResponseArticle = new CapiResponse_1.CapiResponse(article,
|
|
40
|
+
const capiResponseArticle = new CapiResponse_1.CapiResponse(article, dummyContext_1.default);
|
|
52
41
|
expect(capiResponseArticle.type()).toEqual('Article');
|
|
53
42
|
});
|
|
54
43
|
test('converts valid content types to their name', async () => {
|
|
@@ -57,8 +46,8 @@ describe('CAPI response', () => {
|
|
|
57
46
|
...capiObject_1.baseCapiObject,
|
|
58
47
|
type: 'http://www.ft.com/ontology/content/LiveBlogPackage',
|
|
59
48
|
});
|
|
60
|
-
const capiResponseArticle = new CapiResponse_1.CapiResponse(article,
|
|
61
|
-
const capiResponseLiveBlogPackage = new CapiResponse_1.CapiResponse(liveBlogPackage,
|
|
49
|
+
const capiResponseArticle = new CapiResponse_1.CapiResponse(article, dummyContext_1.default);
|
|
50
|
+
const capiResponseLiveBlogPackage = new CapiResponse_1.CapiResponse(liveBlogPackage, dummyContext_1.default);
|
|
62
51
|
expect(capiResponseArticle.type()).toEqual('Article');
|
|
63
52
|
expect(capiResponseLiveBlogPackage.type()).toEqual('LiveBlogPackage');
|
|
64
53
|
});
|
|
@@ -67,7 +56,7 @@ describe('CAPI response', () => {
|
|
|
67
56
|
...capiObject_1.baseCapiObject,
|
|
68
57
|
type: 'http://www.ft.com/ontology/content/Unknown',
|
|
69
58
|
});
|
|
70
|
-
const capiResponse = new CapiResponse_1.CapiResponse(unknown,
|
|
59
|
+
const capiResponse = new CapiResponse_1.CapiResponse(unknown, dummyContext_1.default);
|
|
71
60
|
expect(() => capiResponse.type()).toThrowError('Content type is invalid: http://www.ft.com/ontology/content/Unknown');
|
|
72
61
|
});
|
|
73
62
|
});
|
|
@@ -91,7 +80,7 @@ describe('CAPI response', () => {
|
|
|
91
80
|
},
|
|
92
81
|
],
|
|
93
82
|
});
|
|
94
|
-
const capiResponse = new CapiResponse_1.CapiResponse(liveBlogPackage,
|
|
83
|
+
const capiResponse = new CapiResponse_1.CapiResponse(liveBlogPackage, dummyContext_1.default);
|
|
95
84
|
const liveBlogPosts = await capiResponse.liveBlogPosts();
|
|
96
85
|
expect(liveBlogPosts[0].id()).toEqual('00000000-0000-0000-0000-000000000002');
|
|
97
86
|
expect(liveBlogPosts[1].id()).toEqual('00000000-0000-0000-0000-000000000001');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CapiResponse.test.js","sourceRoot":"","sources":["../../src/model/CapiResponse.test.ts"],"names":[],"mappings":";;;;;AAAA,iDAA6C;AAC7C,uDAAuD;
|
|
1
|
+
{"version":3,"file":"CapiResponse.test.js","sourceRoot":"","sources":["../../src/model/CapiResponse.test.ts"],"names":[],"mappings":";;;;;AAAA,iDAA6C;AAC7C,uDAAuD;AACvD,4DAAkC;AAClC,4EAA8C;AAE9C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC5B,MAAM,OAAO,GAAG,IAAA,oBAAS,EAAC,2BAAc,CAAC,CAAA;YACzC,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,OAAO,EAAE,sBAAO,CAAC,CAAA;YAEvD,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAA;QAC3E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,IAAI,CAAC,iEAAiE,EAAE,GAAG,EAAE;YAC3E,MAAM,sBAAsB,GAAG,iBAAiB,CAAA;YAChD,MAAM,oBAAoB,GAAG,iBAAiB,CAAA;YAE9C,MAAM,OAAO,GAAG,IAAA,oBAAS,EAAC,2BAAc,CAAC,CAAA;YACzC,OA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E,EAAE,CAAC,CAAC,OAAO,CACnC,sCAAsC,CACvC,CAAA;YACD,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CACnC,sCAAsC,CACvC,CAAA;YACD,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CACnC,sCAAsC,CACvC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -76,13 +76,13 @@ export declare const contentPackageSchema: import("zod").ZodObject<{
|
|
|
76
76
|
enabled: boolean;
|
|
77
77
|
}>;
|
|
78
78
|
bodyXML: import("zod").ZodString;
|
|
79
|
-
summary: import("zod").ZodObject<{
|
|
79
|
+
summary: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
80
80
|
bodyXML: import("zod").ZodString;
|
|
81
81
|
}, "strip", import("zod").ZodTypeAny, {
|
|
82
82
|
bodyXML: string;
|
|
83
83
|
}, {
|
|
84
84
|
bodyXML: string;
|
|
85
|
-
}
|
|
85
|
+
}>>;
|
|
86
86
|
alternativeTitles: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
87
87
|
promotionalTitle: import("zod").ZodString;
|
|
88
88
|
}, "strip", import("zod").ZodTypeAny, {
|
|
@@ -552,9 +552,6 @@ export declare const contentPackageSchema: import("zod").ZodObject<{
|
|
|
552
552
|
enabled: boolean;
|
|
553
553
|
};
|
|
554
554
|
bodyXML: string;
|
|
555
|
-
summary: {
|
|
556
|
-
bodyXML: string;
|
|
557
|
-
};
|
|
558
555
|
contains: {
|
|
559
556
|
id: string;
|
|
560
557
|
apiUrl: string;
|
|
@@ -570,6 +567,9 @@ export declare const contentPackageSchema: import("zod").ZodObject<{
|
|
|
570
567
|
backgroundBox?: boolean | undefined;
|
|
571
568
|
textShadow?: boolean | undefined;
|
|
572
569
|
} | undefined;
|
|
570
|
+
summary?: {
|
|
571
|
+
bodyXML: string;
|
|
572
|
+
} | undefined;
|
|
573
573
|
alternativeTitles?: {
|
|
574
574
|
promotionalTitle: string;
|
|
575
575
|
} | undefined;
|
|
@@ -696,9 +696,6 @@ export declare const contentPackageSchema: import("zod").ZodObject<{
|
|
|
696
696
|
enabled: boolean;
|
|
697
697
|
};
|
|
698
698
|
bodyXML: string;
|
|
699
|
-
summary: {
|
|
700
|
-
bodyXML: string;
|
|
701
|
-
};
|
|
702
699
|
contains: {
|
|
703
700
|
id: string;
|
|
704
701
|
apiUrl: string;
|
|
@@ -714,6 +711,9 @@ export declare const contentPackageSchema: import("zod").ZodObject<{
|
|
|
714
711
|
backgroundBox?: boolean | undefined;
|
|
715
712
|
textShadow?: boolean | undefined;
|
|
716
713
|
} | undefined;
|
|
714
|
+
summary?: {
|
|
715
|
+
bodyXML: string;
|
|
716
|
+
} | undefined;
|
|
717
717
|
alternativeTitles?: {
|
|
718
718
|
promotionalTitle: string;
|
|
719
719
|
} | undefined;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.contentPackageSchema = void 0;
|
|
4
4
|
const base_schema_1 = require("./base-schema");
|
|
5
|
-
const contentPackageContentSchema = base_schema_1.baseContentSchema
|
|
5
|
+
const contentPackageContentSchema = base_schema_1.baseContentSchema
|
|
6
|
+
.pick({
|
|
6
7
|
title: true,
|
|
7
8
|
summary: true,
|
|
8
9
|
alternativeTitles: true,
|
|
@@ -10,7 +11,12 @@ const contentPackageContentSchema = base_schema_1.baseContentSchema.pick({
|
|
|
10
11
|
tableOfContents: true,
|
|
11
12
|
design: true,
|
|
12
13
|
bodyXML: true,
|
|
13
|
-
})
|
|
14
|
+
})
|
|
15
|
+
.merge(base_schema_1.baseContentSchema
|
|
16
|
+
.pick({
|
|
17
|
+
summary: true,
|
|
18
|
+
})
|
|
19
|
+
.partial());
|
|
14
20
|
const contentPackageMetadataSchema = base_schema_1.baseMetadataSchema.pick({
|
|
15
21
|
id: true,
|
|
16
22
|
annotations: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-package.js","sourceRoot":"","sources":["../../../../src/model/schemas/capi/content-package.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;AAEtB,MAAM,2BAA2B,GAAG,+BAAiB,
|
|
1
|
+
{"version":3,"file":"content-package.js","sourceRoot":"","sources":["../../../../src/model/schemas/capi/content-package.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;AAEtB,MAAM,2BAA2B,GAAG,+BAAiB;KAClD,IAAI,CAAC;IACJ,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,iBAAiB,EAAE,IAAI;IACvB,QAAQ,EAAE,IAAI;IACd,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;CACd,CAAC;KACD,KAAK,CACJ,+BAAiB;KACd,IAAI,CAAC;IACJ,OAAO,EAAE,IAAI;CACd,CAAC;KACD,OAAO,EAAE,CACb,CAAA;AAEH,MAAM,4BAA4B,GAAG,gCAAkB,CAAC,IAAI,CAAC;IAC3D,EAAE,EAAE,IAAI;IACR,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;IACZ,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;CACf,CAAC,CAAA;AAEF,MAAM,yBAAyB,GAAG,6BAAe,CAAC,IAAI,CAAC;IACrD,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;CACjB,CAAC,CAAA;AAEW,QAAA,oBAAoB,GAAG,2BAA2B;KAC5D,KAAK,CAAC,4BAA4B,CAAC;KACnC,KAAK,CAAC,yBAAyB,CAAC,CAAA"}
|
package/lib/resolvers/concept.js
CHANGED
|
@@ -4,6 +4,7 @@ const resolvers = {
|
|
|
4
4
|
Concept: {
|
|
5
5
|
apiUrl: (parent) => parent.apiUrl(),
|
|
6
6
|
directType: (parent) => parent.directType(),
|
|
7
|
+
isPackageBrand: (parent) => parent.isPackageBrand(),
|
|
7
8
|
id: (parent) => parent.uuid(),
|
|
8
9
|
predicate: (parent) => parent.predicate(),
|
|
9
10
|
prefLabel: (parent) => parent.prefLabel(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concept.js","sourceRoot":"","sources":["../../src/resolvers/concept.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"concept.js","sourceRoot":"","sources":["../../src/resolvers/concept.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAAkC;IAC/C,OAAO,EAAE;QACP,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE;QACnC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE;QAC3C,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE;QACnD,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE;QAC7B,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE;QACzC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE;QACzC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE;QAC/B,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;QACjC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;KAC9C;CACF,CAAA;AAED,kBAAe,SAAS,CAAA"}
|
|
@@ -4,14 +4,14 @@ declare const resolvers: {
|
|
|
4
4
|
Content: {
|
|
5
5
|
__resolveType: (parent: import("../model/CapiResponse").CapiResponse) => "Article" | "Video" | "Audio" | "LiveBlogPackage" | "LiveBlogPost" | "ContentPackage";
|
|
6
6
|
body(parent: import("../model/CapiResponse").CapiResponse): RichText;
|
|
7
|
-
topper: (parent: import("../model/CapiResponse").CapiResponse,
|
|
8
|
-
byline(parent: import("../model/CapiResponse").CapiResponse): {
|
|
7
|
+
topper: (parent: import("../model/CapiResponse").CapiResponse, _: {}, context: import("..").QueryContext) => Topper;
|
|
8
|
+
byline(parent: import("../model/CapiResponse").CapiResponse, args: Partial<import("../generated").ContentBylineArgs>, context: import("..").QueryContext): Promise<{
|
|
9
9
|
tree: {
|
|
10
10
|
type: string;
|
|
11
11
|
children: (import("./content-tree/Workarounds").AuthorLink | import("@financial-times/content-tree").ContentTree.Text)[];
|
|
12
12
|
};
|
|
13
13
|
references: never[];
|
|
14
|
-
} | null;
|
|
14
|
+
}> | null;
|
|
15
15
|
url: (parent: import("../model/CapiResponse").CapiResponse, args: Partial<import("../generated").ContentUrlArgs>) => Promise<string>;
|
|
16
16
|
type: (parent: import("../model/CapiResponse").CapiResponse) => "Article" | "Video" | "Audio" | "LiveBlogPackage" | "LiveBlogPost" | "ContentPackage" | "Content" | "MediaResource";
|
|
17
17
|
mainImage: (parent: import("../model/CapiResponse").CapiResponse) => import("../model/Image").CAPIImage | null;
|
|
@@ -32,7 +32,7 @@ declare const resolvers: {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
Article: {
|
|
35
|
-
containedIn: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/CapiResponse").CapiResponse
|
|
35
|
+
containedIn: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/CapiResponse").CapiResponse | null>;
|
|
36
36
|
};
|
|
37
37
|
LiveBlogPackage: {
|
|
38
38
|
liveBlogPosts: (parent: import("../model/CapiResponse").CapiResponse) => Promise<[] | import("../model/CapiResponse").CapiResponse[]>;
|
package/lib/resolvers/content.js
CHANGED
|
@@ -18,13 +18,14 @@ const resolvers = {
|
|
|
18
18
|
body(parent) {
|
|
19
19
|
return new RichText_1.RichText('bodyXML', parent.bodyXML(), parent);
|
|
20
20
|
},
|
|
21
|
-
topper: (parent,
|
|
22
|
-
byline(parent) {
|
|
21
|
+
topper: (parent, _, context) => new Topper_1.Topper(parent, context),
|
|
22
|
+
byline(parent, args, context) {
|
|
23
|
+
const vanity = Boolean(args.vanity);
|
|
23
24
|
const bylineText = parent.byline();
|
|
24
25
|
if (!bylineText)
|
|
25
26
|
return null;
|
|
26
27
|
const authorUrlMapping = parent.getAuthorUrlMapping();
|
|
27
|
-
return new Byline_1.Byline(bylineText, authorUrlMapping).buildBylineTree();
|
|
28
|
+
return new Byline_1.Byline(bylineText, vanity, authorUrlMapping, context).buildBylineTree();
|
|
28
29
|
},
|
|
29
30
|
url: (parent, args) => args.relative
|
|
30
31
|
? parent.relativeUrl(args?.vanity)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/resolvers/content.ts"],"names":[],"mappings":";;AAAA,4CAAwC;AACxC,4CAAwC;AAQxC,gDAA4C;AAE5C,MAAM,SAAS,GAAG;IAChB,OAAO,EAAE;QACP,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE;YACxB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;YAC1B,IAAI,IAAI,KAAK,SAAS,EAAE;gBACtB,OAAO,SAAS,CAAA;aACjB;YAED,IAAI,IAAI,KAAK,eAAe,EAAE;gBAC5B,OAAO,OAAO,CAAA;aACf;YAED,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,CAAC,MAAM;YACT,OAAO,IAAI,mBAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAA;QAC1D,CAA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E;QAChB,uDAAuD;QACvD,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,KAAK,YAAY,CAAC;YACrE,IAAI;KACP;CAOF,CAAA;AAED,kBAAe,SAAS,CAAA"}
|
package/lib/resolvers/index.d.ts
CHANGED
|
@@ -41,10 +41,10 @@ declare const resolvers: {
|
|
|
41
41
|
Teaser: {
|
|
42
42
|
url: (parent: import("../model/CapiResponse").CapiResponse, args: Partial<import("../generated").TeaserUrlArgs>) => Promise<string>;
|
|
43
43
|
type: (parent: import("../model/CapiResponse").CapiResponse) => string;
|
|
44
|
-
metaLink: (parent: import("../model/CapiResponse").CapiResponse) => import("../model/Concept").Concept | null
|
|
45
|
-
metaAltLink: (parent: import("../model/CapiResponse").CapiResponse) => import("../model/Concept").Concept | null
|
|
46
|
-
metaPrefixText: (parent: import("../model/CapiResponse").CapiResponse) => string | null
|
|
47
|
-
metaSuffixText: (parent: import("../model/CapiResponse").CapiResponse) => string | null
|
|
44
|
+
metaLink: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/Concept").Concept | null>;
|
|
45
|
+
metaAltLink: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/Concept").Concept | null>;
|
|
46
|
+
metaPrefixText: (parent: import("../model/CapiResponse").CapiResponse) => Promise<string | null>;
|
|
47
|
+
metaSuffixText: (parent: import("../model/CapiResponse").CapiResponse) => Promise<string | null>;
|
|
48
48
|
image: (parent: import("../model/CapiResponse").CapiResponse) => import("../model/Image").CAPIImage | null;
|
|
49
49
|
indicators(parent: import("../model/CapiResponse").CapiResponse): {
|
|
50
50
|
accessLevel: "premium" | "subscribed" | "registered" | "free";
|
|
@@ -108,14 +108,14 @@ declare const resolvers: {
|
|
|
108
108
|
Content: {
|
|
109
109
|
__resolveType: (parent: import("../model/CapiResponse").CapiResponse) => "Article" | "Video" | "Audio" | "LiveBlogPackage" | "LiveBlogPost" | "ContentPackage";
|
|
110
110
|
body(parent: import("../model/CapiResponse").CapiResponse): import("../model/RichText").RichText;
|
|
111
|
-
topper: (parent: import("../model/CapiResponse").CapiResponse,
|
|
112
|
-
byline(parent: import("../model/CapiResponse").CapiResponse): {
|
|
111
|
+
topper: (parent: import("../model/CapiResponse").CapiResponse, _: {}, context: import("..").QueryContext) => import("../model/Topper").Topper;
|
|
112
|
+
byline(parent: import("../model/CapiResponse").CapiResponse, args: Partial<import("../generated").ContentBylineArgs>, context: import("..").QueryContext): Promise<{
|
|
113
113
|
tree: {
|
|
114
114
|
type: string;
|
|
115
115
|
children: (import("./content-tree/Workarounds").AuthorLink | import("@financial-times/content-tree").ContentTree.Text)[];
|
|
116
116
|
};
|
|
117
117
|
references: never[];
|
|
118
|
-
} | null;
|
|
118
|
+
}> | null;
|
|
119
119
|
url: (parent: import("../model/CapiResponse").CapiResponse, args: Partial<import("../generated").ContentUrlArgs>) => Promise<string>;
|
|
120
120
|
type: (parent: import("../model/CapiResponse").CapiResponse) => "Article" | "Video" | "Audio" | "LiveBlogPackage" | "LiveBlogPost" | "ContentPackage" | "Content" | "MediaResource";
|
|
121
121
|
mainImage: (parent: import("../model/CapiResponse").CapiResponse) => import("../model/Image").CAPIImage | null;
|
|
@@ -136,7 +136,7 @@ declare const resolvers: {
|
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
138
|
Article: {
|
|
139
|
-
containedIn: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/CapiResponse").CapiResponse
|
|
139
|
+
containedIn: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/CapiResponse").CapiResponse | null>;
|
|
140
140
|
};
|
|
141
141
|
LiveBlogPackage: {
|
|
142
142
|
liveBlogPosts: (parent: import("../model/CapiResponse").CapiResponse) => Promise<[] | import("../model/CapiResponse").CapiResponse[]>;
|
|
@@ -2,10 +2,10 @@ declare const resolvers: {
|
|
|
2
2
|
Teaser: {
|
|
3
3
|
url: (parent: import("../model/CapiResponse").CapiResponse, args: Partial<import("../generated").TeaserUrlArgs>) => Promise<string>;
|
|
4
4
|
type: (parent: import("../model/CapiResponse").CapiResponse) => string;
|
|
5
|
-
metaLink: (parent: import("../model/CapiResponse").CapiResponse) => import("../model/Concept").Concept | null
|
|
6
|
-
metaAltLink: (parent: import("../model/CapiResponse").CapiResponse) => import("../model/Concept").Concept | null
|
|
7
|
-
metaPrefixText: (parent: import("../model/CapiResponse").CapiResponse) => string | null
|
|
8
|
-
metaSuffixText: (parent: import("../model/CapiResponse").CapiResponse) => string | null
|
|
5
|
+
metaLink: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/Concept").Concept | null>;
|
|
6
|
+
metaAltLink: (parent: import("../model/CapiResponse").CapiResponse) => Promise<import("../model/Concept").Concept | null>;
|
|
7
|
+
metaPrefixText: (parent: import("../model/CapiResponse").CapiResponse) => Promise<string | null>;
|
|
8
|
+
metaSuffixText: (parent: import("../model/CapiResponse").CapiResponse) => Promise<string | null>;
|
|
9
9
|
image: (parent: import("../model/CapiResponse").CapiResponse) => import("../model/Image").CAPIImage | null;
|
|
10
10
|
indicators(parent: import("../model/CapiResponse").CapiResponse): {
|
|
11
11
|
accessLevel: "premium" | "subscribed" | "registered" | "free";
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CapiResponse } from '../model/CapiResponse'
|
|
2
|
+
import { baseCapiObject } from './capiObject'
|
|
3
|
+
import cloneDeep from 'clone-deep'
|
|
4
|
+
import { QueryContext } from '..'
|
|
5
|
+
const now = Date.now()
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
dataSources: {
|
|
9
|
+
vanityUrls: {
|
|
10
|
+
get: (url: string) => Promise.resolve(url),
|
|
11
|
+
},
|
|
12
|
+
capi: {
|
|
13
|
+
getContent: (id: string) =>
|
|
14
|
+
Promise.resolve(
|
|
15
|
+
new CapiResponse(
|
|
16
|
+
cloneDeep({
|
|
17
|
+
...baseCapiObject,
|
|
18
|
+
id,
|
|
19
|
+
publishedDate: new Date(
|
|
20
|
+
now + parseInt(id.slice(-1), 10)
|
|
21
|
+
).toISOString(),
|
|
22
|
+
}),
|
|
23
|
+
{} as unknown as QueryContext
|
|
24
|
+
)
|
|
25
|
+
),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} as unknown as QueryContext
|
package/src/generated/index.ts
CHANGED
|
@@ -70,6 +70,11 @@ export type Article = Content & {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
|
|
73
|
+
export type ArticleBylineArgs = {
|
|
74
|
+
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
|
|
73
78
|
export type ArticleUrlArgs = {
|
|
74
79
|
relative?: InputMaybe<Scalars['Boolean']['input']>;
|
|
75
80
|
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
@@ -100,6 +105,11 @@ export type Audio = Content & {
|
|
|
100
105
|
};
|
|
101
106
|
|
|
102
107
|
|
|
108
|
+
export type AudioBylineArgs = {
|
|
109
|
+
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
|
|
103
113
|
export type AudioUrlArgs = {
|
|
104
114
|
relative?: InputMaybe<Scalars['Boolean']['input']>;
|
|
105
115
|
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
@@ -130,13 +140,14 @@ export type BrandedTopper = Topper & TopperWithBrand & TopperWithTheme & {
|
|
|
130
140
|
};
|
|
131
141
|
|
|
132
142
|
export type Concept = {
|
|
133
|
-
readonly apiUrl
|
|
143
|
+
readonly apiUrl?: Maybe<Scalars['String']['output']>;
|
|
134
144
|
readonly directType?: Maybe<Scalars['String']['output']>;
|
|
135
145
|
readonly id: Scalars['ID']['output'];
|
|
136
|
-
readonly
|
|
146
|
+
readonly isPackageBrand?: Maybe<Scalars['Boolean']['output']>;
|
|
147
|
+
readonly predicate?: Maybe<Scalars['String']['output']>;
|
|
137
148
|
readonly prefLabel: Scalars['String']['output'];
|
|
138
149
|
readonly type?: Maybe<Scalars['String']['output']>;
|
|
139
|
-
readonly types
|
|
150
|
+
readonly types?: Maybe<ReadonlyArray<Scalars['String']['output']>>;
|
|
140
151
|
readonly url: Scalars['String']['output'];
|
|
141
152
|
};
|
|
142
153
|
|
|
@@ -170,6 +181,11 @@ export type Content = {
|
|
|
170
181
|
};
|
|
171
182
|
|
|
172
183
|
|
|
184
|
+
export type ContentBylineArgs = {
|
|
185
|
+
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
|
|
173
189
|
export type ContentUrlArgs = {
|
|
174
190
|
relative?: InputMaybe<Scalars['Boolean']['input']>;
|
|
175
191
|
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
@@ -201,6 +217,11 @@ export type ContentPackage = Content & {
|
|
|
201
217
|
};
|
|
202
218
|
|
|
203
219
|
|
|
220
|
+
export type ContentPackageBylineArgs = {
|
|
221
|
+
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
|
|
204
225
|
export type ContentPackageUrlArgs = {
|
|
205
226
|
relative?: InputMaybe<Scalars['Boolean']['input']>;
|
|
206
227
|
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
@@ -512,6 +533,11 @@ export type LiveBlogPackage = Content & {
|
|
|
512
533
|
};
|
|
513
534
|
|
|
514
535
|
|
|
536
|
+
export type LiveBlogPackageBylineArgs = {
|
|
537
|
+
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
|
|
515
541
|
export type LiveBlogPackageUrlArgs = {
|
|
516
542
|
relative?: InputMaybe<Scalars['Boolean']['input']>;
|
|
517
543
|
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
@@ -541,6 +567,11 @@ export type LiveBlogPost = Content & {
|
|
|
541
567
|
};
|
|
542
568
|
|
|
543
569
|
|
|
570
|
+
export type LiveBlogPostBylineArgs = {
|
|
571
|
+
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
|
|
544
575
|
export type LiveBlogPostUrlArgs = {
|
|
545
576
|
relative?: InputMaybe<Scalars['Boolean']['input']>;
|
|
546
577
|
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
@@ -808,6 +839,11 @@ export type Video = Content & {
|
|
|
808
839
|
};
|
|
809
840
|
|
|
810
841
|
|
|
842
|
+
export type VideoBylineArgs = {
|
|
843
|
+
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
|
|
811
847
|
export type VideoUrlArgs = {
|
|
812
848
|
relative?: InputMaybe<Scalars['Boolean']['input']>;
|
|
813
849
|
vanity?: InputMaybe<Scalars['Boolean']['input']>;
|
|
@@ -1077,7 +1113,7 @@ export type ArticleResolvers<ContextType = QueryContext, ParentType extends Reso
|
|
|
1077
1113
|
annotations?: Resolver<Maybe<ReadonlyArray<Maybe<ResolversTypes['Concept']>>>, ParentType, ContextType>;
|
|
1078
1114
|
body?: Resolver<Maybe<ResolversTypes['RichText']>, ParentType, ContextType>;
|
|
1079
1115
|
bodyXML?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1080
|
-
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType
|
|
1116
|
+
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType, Partial<ArticleBylineArgs>>;
|
|
1081
1117
|
canBeSyndicated?: Resolver<Maybe<ResolversTypes['CanBeSyndicated']>, ParentType, ContextType>;
|
|
1082
1118
|
commentsEnabled?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
1083
1119
|
containedIn?: Resolver<Maybe<ResolversTypes['Content']>, ParentType, ContextType>;
|
|
@@ -1102,7 +1138,7 @@ export type AudioResolvers<ContextType = QueryContext, ParentType extends Resolv
|
|
|
1102
1138
|
annotations?: Resolver<Maybe<ReadonlyArray<Maybe<ResolversTypes['Concept']>>>, ParentType, ContextType>;
|
|
1103
1139
|
body?: Resolver<Maybe<ResolversTypes['RichText']>, ParentType, ContextType>;
|
|
1104
1140
|
bodyXML?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1105
|
-
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType
|
|
1141
|
+
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType, Partial<AudioBylineArgs>>;
|
|
1106
1142
|
canBeSyndicated?: Resolver<Maybe<ResolversTypes['CanBeSyndicated']>, ParentType, ContextType>;
|
|
1107
1143
|
commentsEnabled?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
1108
1144
|
design?: Resolver<Maybe<ResolversTypes['Design']>, ParentType, ContextType>;
|
|
@@ -1151,13 +1187,14 @@ export interface CanBeSyndicatedScalarConfig extends GraphQLScalarTypeConfig<Res
|
|
|
1151
1187
|
}
|
|
1152
1188
|
|
|
1153
1189
|
export type ConceptResolvers<ContextType = QueryContext, ParentType extends ResolversParentTypes['Concept'] = ResolversParentTypes['Concept']> = ResolversObject<{
|
|
1154
|
-
apiUrl?: Resolver<ResolversTypes['String']
|
|
1190
|
+
apiUrl?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1155
1191
|
directType?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1156
1192
|
id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
|
|
1157
|
-
|
|
1193
|
+
isPackageBrand?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
1194
|
+
predicate?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1158
1195
|
prefLabel?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
|
1159
1196
|
type?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1160
|
-
types?: Resolver<ReadonlyArray<ResolversTypes['String']
|
|
1197
|
+
types?: Resolver<Maybe<ReadonlyArray<ResolversTypes['String']>>, ParentType, ContextType>;
|
|
1161
1198
|
url?: Resolver<ResolversTypes['String'], ParentType, ContextType, Partial<ConceptUrlArgs>>;
|
|
1162
1199
|
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
|
1163
1200
|
}>;
|
|
@@ -1170,7 +1207,7 @@ export type ContentResolvers<ContextType = QueryContext, ParentType extends Reso
|
|
|
1170
1207
|
annotations?: Resolver<Maybe<ReadonlyArray<Maybe<ResolversTypes['Concept']>>>, ParentType, ContextType>;
|
|
1171
1208
|
body?: Resolver<Maybe<ResolversTypes['RichText']>, ParentType, ContextType>;
|
|
1172
1209
|
bodyXML?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1173
|
-
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType
|
|
1210
|
+
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType, Partial<ContentBylineArgs>>;
|
|
1174
1211
|
canBeSyndicated?: Resolver<Maybe<ResolversTypes['CanBeSyndicated']>, ParentType, ContextType>;
|
|
1175
1212
|
commentsEnabled?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
1176
1213
|
design?: Resolver<Maybe<ResolversTypes['Design']>, ParentType, ContextType>;
|
|
@@ -1193,7 +1230,7 @@ export type ContentPackageResolvers<ContextType = QueryContext, ParentType exten
|
|
|
1193
1230
|
annotations?: Resolver<Maybe<ReadonlyArray<Maybe<ResolversTypes['Concept']>>>, ParentType, ContextType>;
|
|
1194
1231
|
body?: Resolver<Maybe<ResolversTypes['RichText']>, ParentType, ContextType>;
|
|
1195
1232
|
bodyXML?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1196
|
-
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType
|
|
1233
|
+
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType, Partial<ContentPackageBylineArgs>>;
|
|
1197
1234
|
canBeSyndicated?: Resolver<Maybe<ResolversTypes['CanBeSyndicated']>, ParentType, ContextType>;
|
|
1198
1235
|
commentsEnabled?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
1199
1236
|
contains?: Resolver<Maybe<ReadonlyArray<Maybe<ResolversTypes['Teaser']>>>, ParentType, ContextType>;
|
|
@@ -1479,7 +1516,7 @@ export type LiveBlogPackageResolvers<ContextType = QueryContext, ParentType exte
|
|
|
1479
1516
|
annotations?: Resolver<Maybe<ReadonlyArray<Maybe<ResolversTypes['Concept']>>>, ParentType, ContextType>;
|
|
1480
1517
|
body?: Resolver<Maybe<ResolversTypes['RichText']>, ParentType, ContextType>;
|
|
1481
1518
|
bodyXML?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1482
|
-
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType
|
|
1519
|
+
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType, Partial<LiveBlogPackageBylineArgs>>;
|
|
1483
1520
|
canBeSyndicated?: Resolver<Maybe<ResolversTypes['CanBeSyndicated']>, ParentType, ContextType>;
|
|
1484
1521
|
commentsEnabled?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
1485
1522
|
design?: Resolver<Maybe<ResolversTypes['Design']>, ParentType, ContextType>;
|
|
@@ -1505,7 +1542,7 @@ export type LiveBlogPostResolvers<ContextType = QueryContext, ParentType extends
|
|
|
1505
1542
|
annotations?: Resolver<Maybe<ReadonlyArray<Maybe<ResolversTypes['Concept']>>>, ParentType, ContextType>;
|
|
1506
1543
|
body?: Resolver<Maybe<ResolversTypes['RichText']>, ParentType, ContextType>;
|
|
1507
1544
|
bodyXML?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1508
|
-
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType
|
|
1545
|
+
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType, Partial<LiveBlogPostBylineArgs>>;
|
|
1509
1546
|
canBeSyndicated?: Resolver<Maybe<ResolversTypes['CanBeSyndicated']>, ParentType, ContextType>;
|
|
1510
1547
|
commentsEnabled?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
1511
1548
|
design?: Resolver<Maybe<ResolversTypes['Design']>, ParentType, ContextType>;
|
|
@@ -1765,7 +1802,7 @@ export type VideoResolvers<ContextType = QueryContext, ParentType extends Resolv
|
|
|
1765
1802
|
annotations?: Resolver<Maybe<ReadonlyArray<Maybe<ResolversTypes['Concept']>>>, ParentType, ContextType>;
|
|
1766
1803
|
body?: Resolver<Maybe<ResolversTypes['RichText']>, ParentType, ContextType>;
|
|
1767
1804
|
bodyXML?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
1768
|
-
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType
|
|
1805
|
+
byline?: Resolver<Maybe<ResolversTypes['StructuredContent']>, ParentType, ContextType, Partial<VideoBylineArgs>>;
|
|
1769
1806
|
canBeSyndicated?: Resolver<Maybe<ResolversTypes['CanBeSyndicated']>, ParentType, ContextType>;
|
|
1770
1807
|
commentsEnabled?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
|
|
1771
1808
|
design?: Resolver<Maybe<ResolversTypes['Design']>, ParentType, ContextType>;
|
package/src/model/Byline.test.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Byline } from './Byline'
|
|
2
|
+
import context from '../fixtures/dummyContext'
|
|
3
|
+
const vanity = true
|
|
2
4
|
|
|
3
5
|
describe('byline transformation', () => {
|
|
4
6
|
test('adds a link around a single known author', async () => {
|
|
@@ -10,8 +12,8 @@ describe('byline transformation', () => {
|
|
|
10
12
|
],
|
|
11
13
|
])
|
|
12
14
|
|
|
13
|
-
const byline = new Byline(bylineText, authorUrlMapping)
|
|
14
|
-
const result = byline.buildBylineTree()
|
|
15
|
+
const byline = new Byline(bylineText, vanity, authorUrlMapping, context)
|
|
16
|
+
const result = await byline.buildBylineTree()
|
|
15
17
|
expect(result).toMatchSnapshot()
|
|
16
18
|
})
|
|
17
19
|
|
|
@@ -28,8 +30,8 @@ describe('byline transformation', () => {
|
|
|
28
30
|
],
|
|
29
31
|
])
|
|
30
32
|
|
|
31
|
-
const byline = new Byline(bylineText, authorUrlMapping)
|
|
32
|
-
const result = byline.buildBylineTree()
|
|
33
|
+
const byline = new Byline(bylineText, vanity, authorUrlMapping, context)
|
|
34
|
+
const result = await byline.buildBylineTree()
|
|
33
35
|
expect(result).toMatchSnapshot()
|
|
34
36
|
})
|
|
35
37
|
|
|
@@ -42,8 +44,8 @@ describe('byline transformation', () => {
|
|
|
42
44
|
],
|
|
43
45
|
])
|
|
44
46
|
|
|
45
|
-
const byline = new Byline(bylineText, authorUrlMapping)
|
|
46
|
-
const result = byline.buildBylineTree()
|
|
47
|
+
const byline = new Byline(bylineText, vanity, authorUrlMapping, context)
|
|
48
|
+
const result = await byline.buildBylineTree()
|
|
47
49
|
expect(result).toMatchSnapshot()
|
|
48
50
|
})
|
|
49
51
|
|
|
@@ -60,8 +62,8 @@ describe('byline transformation', () => {
|
|
|
60
62
|
],
|
|
61
63
|
])
|
|
62
64
|
|
|
63
|
-
const byline = new Byline(bylineText, authorUrlMapping)
|
|
64
|
-
const result = byline.buildBylineTree()
|
|
65
|
+
const byline = new Byline(bylineText, vanity, authorUrlMapping, context)
|
|
66
|
+
const result = await byline.buildBylineTree()
|
|
65
67
|
expect(result).toMatchSnapshot()
|
|
66
68
|
})
|
|
67
69
|
|
|
@@ -69,8 +71,8 @@ describe('byline transformation', () => {
|
|
|
69
71
|
const bylineText = 'Chris Giles and Nick Ramsbottom in London'
|
|
70
72
|
const authorUrlMapping: Map<string, string> = new Map([])
|
|
71
73
|
|
|
72
|
-
const byline = new Byline(bylineText, authorUrlMapping)
|
|
73
|
-
const result = byline.buildBylineTree()
|
|
74
|
+
const byline = new Byline(bylineText, vanity, authorUrlMapping, context)
|
|
75
|
+
const result = await byline.buildBylineTree()
|
|
74
76
|
|
|
75
77
|
expect(result).toMatchSnapshot()
|
|
76
78
|
})
|
|
@@ -83,8 +85,8 @@ describe('byline transformation', () => {
|
|
|
83
85
|
'https://www.ft.com/stream/uuid/1d556016-ad16-4fe7-8724-eeeeeeeeeeee',
|
|
84
86
|
],
|
|
85
87
|
])
|
|
86
|
-
const byline = new Byline(bylineText, authorUrlMapping)
|
|
87
|
-
const result = byline.buildBylineTree()
|
|
88
|
+
const byline = new Byline(bylineText, vanity, authorUrlMapping, context)
|
|
89
|
+
const result = await byline.buildBylineTree()
|
|
88
90
|
|
|
89
91
|
expect(result).toMatchSnapshot()
|
|
90
92
|
})
|
|
@@ -97,8 +99,8 @@ describe('byline transformation', () => {
|
|
|
97
99
|
'https://www.ft.com/stream/uuid/1d556016-ad16-4fe7-8724-eeeeeeeeeeee',
|
|
98
100
|
],
|
|
99
101
|
])
|
|
100
|
-
const byline = new Byline(bylineText, authorUrlMapping)
|
|
101
|
-
const result = byline.buildBylineTree()
|
|
102
|
+
const byline = new Byline(bylineText, vanity, authorUrlMapping, context)
|
|
103
|
+
const result = await byline.buildBylineTree()
|
|
102
104
|
|
|
103
105
|
expect(result).toMatchSnapshot()
|
|
104
106
|
})
|