@financial-times/cp-content-pipeline-schema 0.7.27 → 0.7.28
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 +12 -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 +4 -5
- 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/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/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
package/src/resolvers/concept.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { IResolvers } from '@graphql-tools/utils'
|
|
2
|
-
import type { QueryContext } from '..'
|
|
3
|
-
import { Concept, URLArguments } from '../model/Concept'
|
|
4
1
|
import { ConceptResolvers } from '../generated'
|
|
5
2
|
|
|
6
3
|
const resolvers: { Concept: ConceptResolvers } = {
|
|
7
4
|
Concept: {
|
|
8
5
|
apiUrl: (parent) => parent.apiUrl(),
|
|
9
6
|
directType: (parent) => parent.directType(),
|
|
7
|
+
isPackageBrand: (parent) => parent.isPackageBrand(),
|
|
10
8
|
id: (parent) => parent.uuid(),
|
|
11
9
|
predicate: (parent) => parent.predicate(),
|
|
12
10
|
prefLabel: (parent) => parent.prefLabel(),
|
package/src/resolvers/content.ts
CHANGED
|
@@ -26,12 +26,20 @@ const resolvers = {
|
|
|
26
26
|
body(parent) {
|
|
27
27
|
return new RichText('bodyXML', parent.bodyXML(), parent)
|
|
28
28
|
},
|
|
29
|
-
topper: (parent,
|
|
30
|
-
byline(parent) {
|
|
29
|
+
topper: (parent, _, context) => new Topper(parent, context),
|
|
30
|
+
byline(parent, args, context) {
|
|
31
|
+
const vanity = Boolean(args.vanity)
|
|
31
32
|
const bylineText = parent.byline()
|
|
33
|
+
|
|
32
34
|
if (!bylineText) return null
|
|
33
35
|
const authorUrlMapping = parent.getAuthorUrlMapping()
|
|
34
|
-
|
|
36
|
+
|
|
37
|
+
return new Byline(
|
|
38
|
+
bylineText,
|
|
39
|
+
vanity,
|
|
40
|
+
authorUrlMapping,
|
|
41
|
+
context
|
|
42
|
+
).buildBylineTree()
|
|
35
43
|
},
|
|
36
44
|
url: (parent, args) =>
|
|
37
45
|
args.relative
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module '@financial-times/n-display-metadata' {
|
|
2
|
-
import { Annotation } from './internal-content'
|
|
2
|
+
import { Annotation, ContentTypeSchemas } from './internal-content'
|
|
3
3
|
|
|
4
4
|
export interface FlagsMetadata {
|
|
5
5
|
isOpinion: boolean
|
|
@@ -15,6 +15,7 @@ declare module '@financial-times/n-display-metadata' {
|
|
|
15
15
|
|
|
16
16
|
export interface Content {
|
|
17
17
|
annotations: Annotation[]
|
|
18
|
+
containedIn: ContentTypeSchemas | null
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function teaser(content: Content): TeaserMetadata
|