@financial-times/cp-content-pipeline-client 0.2.8 → 0.3.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.
- package/CHANGELOG.md +20 -0
- package/README.md +103 -0
- package/lib/generated/index.d.ts +1070 -1
- package/lib/generated/index.js +9 -1
- package/lib/generated/index.js.map +1 -1
- package/package.json +2 -2
- package/queries/article.graphql +7 -0
- package/src/generated/index.ts +34 -19
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,26 @@
|
|
|
18
18
|
* devDependencies
|
|
19
19
|
* @financial-times/cp-content-pipeline-schema bumped from ^0.3.3 to ^0.3.4
|
|
20
20
|
|
|
21
|
+
## [0.3.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-client-v0.2.8...cp-content-pipeline-client-v0.3.0) (2022-11-09)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### ⚠ BREAKING CHANGES
|
|
25
|
+
|
|
26
|
+
* This will change the output of concept types that are already in use. For example within teasers
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* return all concept properties ([34e26db](https://github.com/Financial-Times/cp-content-pipeline/commit/34e26dbc9c6164eb23a9e278f2b2298c1b3bec8b))
|
|
31
|
+
* return annotations as part of the article query ([151d59c](https://github.com/Financial-Times/cp-content-pipeline/commit/151d59c5b27cd062a467eca77941a1612ba2320a))
|
|
32
|
+
* return only the uuid for concept ID properties ([7eea0a0](https://github.com/Financial-Times/cp-content-pipeline/commit/7eea0a00c67a92b52fbb5cdf2cc572f0642f3c89))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Dependencies
|
|
36
|
+
|
|
37
|
+
* The following workspace dependencies were updated
|
|
38
|
+
* devDependencies
|
|
39
|
+
* @financial-times/cp-content-pipeline-schema bumped from ^0.3.5 to ^0.4.0
|
|
40
|
+
|
|
21
41
|
## [0.2.8](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-client-v0.2.7...cp-content-pipeline-client-v0.2.8) (2022-11-01)
|
|
22
42
|
|
|
23
43
|
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Provides a JS client for querying the GraphQL API, with a pre-defined query for a complete article, along with type definitions to use in components.
|
|
4
4
|
|
|
5
|
+
The published `cp-content-pipeline-client` package mainly consists of generated code. To understand more about how this package is produced read the ["How this package is produced"](#how-this-package-is-produced) section below
|
|
6
|
+
|
|
5
7
|
## Getting Started
|
|
6
8
|
|
|
7
9
|
Run `npm install` then `npm start` from [the monorepo project root](../../README.md#commands).
|
|
@@ -23,3 +25,104 @@ const { content: articleData } = await client.Article({
|
|
|
23
25
|
useVanities: true,
|
|
24
26
|
})
|
|
25
27
|
```
|
|
28
|
+
|
|
29
|
+
## How this package is produced
|
|
30
|
+
|
|
31
|
+
The published `cp-content-pipeline-client` package mainly consists of generated code which is the output of [@graphql-codegen](https://www.npmjs.com/package/@graphql-codegen/cli).
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### What is used to generate the GraphQL client
|
|
35
|
+
|
|
36
|
+
The generated GraphQL client is produced using the output of the `cp-content-pipeline-schema` package, along with the hand-written queries within the `./queries` directory of the client package.
|
|
37
|
+
|
|
38
|
+
### What is used to generate the TypeScript type definitions
|
|
39
|
+
|
|
40
|
+
The `cp-content-pipeline-client` also exposes TypeScript type definitions. These type definitions are generated using the GraphQL typeDef's for article features within the `cp-content-pipeline-schema` package.
|
|
41
|
+
|
|
42
|
+
### Code generation diagram
|
|
43
|
+
|
|
44
|
+
This diagram visualises how these parts piece together to produce the published `cp-content-pipeline-client`:
|
|
45
|
+
|
|
46
|
+
```mermaid
|
|
47
|
+
flowchart TB
|
|
48
|
+
|
|
49
|
+
subgraph cpContentPipelineSchema[cp-content-pipeline-schema]
|
|
50
|
+
subgraph articleFeatures[Article features]
|
|
51
|
+
id1[Schema, Resolvers & Typedefs for each article feature <br> Article features are things like toppers, teasters, links, pullquotes, etc]:::description
|
|
52
|
+
end
|
|
53
|
+
articleFeatures:::internalComponent
|
|
54
|
+
end
|
|
55
|
+
cpContentPipelineSchema:::internalContainer
|
|
56
|
+
|
|
57
|
+
subgraph cpContentPipelineClient[cp-content-pipeline-client]
|
|
58
|
+
subgraph codegenConfig[Codegen config]
|
|
59
|
+
id2[A codegen config file]:::description
|
|
60
|
+
end
|
|
61
|
+
codegenConfig:::internalComponent
|
|
62
|
+
subgraph articleQuery[Article GraphQL Query]
|
|
63
|
+
id3[A article.graphql file is a hand crafted query for a complete article]:::description
|
|
64
|
+
end
|
|
65
|
+
articleQuery:::internalComponent
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
subgraph toolkitPlugin[Codegen Toolkit Plugin]
|
|
69
|
+
id4[A toolkit plugin wrapper around graphql-codegen.<br>Triggered by commands such as npm start]:::description
|
|
70
|
+
subgraph codegenPackage[graphql-codegen package]
|
|
71
|
+
id5[A third party package that takes GraphQL schemas to produce a variety of outputs]:::description
|
|
72
|
+
end
|
|
73
|
+
codegenPackage:::externalSystem
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
toolkitPlugin:::internalComponent
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
subgraph generatedOuput[Generate Output]
|
|
80
|
+
id6[The generated output of the codegen toolkit plugin<br>The generated output is what gets used when the package is published]:::description
|
|
81
|
+
subgraph graphqlClient[GraphQL Client]
|
|
82
|
+
id7[A client for querying the GraphQL API]:::description
|
|
83
|
+
end
|
|
84
|
+
graphqlClient:::internalComponent
|
|
85
|
+
subgraph tsTypes[Typescript Types]
|
|
86
|
+
id8[TypeScript types generated from the GraphQL schema]:::description
|
|
87
|
+
end
|
|
88
|
+
tsTypes:::internalComponent
|
|
89
|
+
end
|
|
90
|
+
generatedOuput:::internalGrouping
|
|
91
|
+
end
|
|
92
|
+
cpContentPipelineClient:::internalContainer
|
|
93
|
+
|
|
94
|
+
subgraph key[Key]
|
|
95
|
+
subgraph keyPackage[cp-content-pipeline package]
|
|
96
|
+
id9[A package from the cp-content-pipeline monorepo]:::description
|
|
97
|
+
end
|
|
98
|
+
keyPackage:::internalContainer
|
|
99
|
+
|
|
100
|
+
subgraph keyComponent[Package Component]
|
|
101
|
+
id10[A component within a cp-content-pipeline package]:::description
|
|
102
|
+
end
|
|
103
|
+
keyComponent:::internalComponent
|
|
104
|
+
|
|
105
|
+
subgraph keyExternal[External Component]
|
|
106
|
+
id11[An external package/component/dependency]:::description
|
|
107
|
+
end
|
|
108
|
+
keyExternal:::externalSystem
|
|
109
|
+
end
|
|
110
|
+
key:::keyContainer
|
|
111
|
+
|
|
112
|
+
codegenConfig-->codegenPackage
|
|
113
|
+
articleQuery--Codegen uses the article query to generate the client-->codegenPackage
|
|
114
|
+
codegenPackage--Produces the API client-->graphqlClient
|
|
115
|
+
codegenPackage--Produces the TypeScript types---->tsTypes
|
|
116
|
+
articleFeatures--Codegen uses the Schema package to generate the client <br> The typedefs are also used to generate TypeScript Types-->codegenPackage
|
|
117
|
+
|
|
118
|
+
classDef internalContainer fill:#D4DFE8,stroke-width:0px
|
|
119
|
+
classDef internalComponent fill:#BDA8FA,stroke-width:0px
|
|
120
|
+
classDef internalGrouping stroke-width:2px,fill:none,stroke:black
|
|
121
|
+
classDef externalSystem fill:#03A696,stroke-width:1px,stroke:black
|
|
122
|
+
classDef description stroke-width:0px,color:#000,fill:transparent,font-size:13px
|
|
123
|
+
classDef keyContainer fill: transparent, stroke: black,
|
|
124
|
+
|
|
125
|
+
style generatedOuput stroke-dasharray: 5 5
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
|