@financial-times/cp-content-pipeline-client 0.2.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/.toolkitrc.yml ADDED
@@ -0,0 +1,27 @@
1
+ plugins:
2
+ - '@dotcom-tool-kit/npm'
3
+ - '../../tool-kit/graphql-code-generator'
4
+ - '../../tool-kit/placeholder-hook'
5
+
6
+ hooks:
7
+ build:local:
8
+ - GraphQLCodegen
9
+ run:local:
10
+ - GraphQLCodegenWatch
11
+ test:local:
12
+ - GraphQLCodegenTest
13
+ test:staged:
14
+ - GraphQLCodegenTest
15
+ test:ci:
16
+ - GraphQLCodegenTest
17
+ publish:tag:
18
+ - NpmPublish
19
+
20
+ options:
21
+ '../../tool-kit/graphql-code-generator':
22
+ watchFiles: '../schema/lib/**/*.js'
23
+ '../../tool-kit/placeholder-hook':
24
+ hooks:
25
+ - test:staged
26
+ - test:ci
27
+ - publish:tag
package/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-client-v0.1.0...cp-content-pipeline-client-v0.2.0) (2022-09-27)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * rename "inline" image to "standard"
9
+
10
+ ### Features
11
+
12
+ * add a datasource for getting vanity URLs ([cb638a5](https://github.com/Financial-Times/cp-content-pipeline/commit/cb638a5b48bc7726008189376a27d245a7b642d0))
13
+ * add byline and authors to article query ([43eddc3](https://github.com/Financial-Times/cp-content-pipeline/commit/43eddc3ddd970e49702ff32d8fbaa8095f28e641))
14
+ * add client package with typescript types generated from schema ([c00f07f](https://github.com/Financial-Times/cp-content-pipeline/commit/c00f07f9d9d10f74cdd834ad59efe189f151ede2))
15
+ * add data-image-type attribute to image ([88200bb](https://github.com/Financial-Times/cp-content-pipeline/commit/88200bb366374a6e926124af68564b9a60581508))
16
+ * Add isColumn resolver to Content ([0a2af1a](https://github.com/Financial-Times/cp-content-pipeline/commit/0a2af1ae80d103e2d6d0c5a01338c8488b866e10))
17
+ * Add isEditorsChoice resolver to Content ([813e07b](https://github.com/Financial-Times/cp-content-pipeline/commit/813e07b2a70e0d642768d481e4fb38929da4caa2))
18
+ * Add isExclusive resolver to Content ([cef9675](https://github.com/Financial-Times/cp-content-pipeline/commit/cef9675c5c6d5f98c94c722f855671610ab69916))
19
+ * Add isPodcast resolver to Content ([d76eb78](https://github.com/Financial-Times/cp-content-pipeline/commit/d76eb78909accdec6aa8c654524d1ef89d4eaa56))
20
+ * Add isScoop resolver to Content ([0441fba](https://github.com/Financial-Times/cp-content-pipeline/commit/0441fba34374c69422a2d4a4fed82cd43d68c4e1))
21
+ * add PictureInline variant ([7d3f721](https://github.com/Financial-Times/cp-content-pipeline/commit/7d3f721fec6c9a79a21d076a5517955a15b7089d))
22
+ * allow different image widths and breakpoints ([1210b62](https://github.com/Financial-Times/cp-content-pipeline/commit/1210b62e9f778ee09a9ecd1998bffbefb4234c2d))
23
+ * create byline component and add it to topper ([56d6ed1](https://github.com/Financial-Times/cp-content-pipeline/commit/56d6ed1af1dd31e2f51e95b5e538578d5802a726))
24
+ * generate a typed sdk ([66886db](https://github.com/Financial-Times/cp-content-pipeline/commit/66886db3fdc370336faa45c96d01e824d92a3569))
25
+ * make useVanities a required option ([51eb538](https://github.com/Financial-Times/cp-content-pipeline/commit/51eb53835a767de1917e5375500ca1d7eb326f09))
26
+ * provide all possible resolutions for image sources ([4d9d586](https://github.com/Financial-Times/cp-content-pipeline/commit/4d9d586ec4578bbd9d8d12e5333ad1f5f9f4e1ff))
27
+ * remove PictureResponsiveMobile, and rename PictureSingle ([b25b289](https://github.com/Financial-Times/cp-content-pipeline/commit/b25b289368c424c267ab65c9494a65cb437cf99b))
28
+ * render Layout components ([a134e30](https://github.com/Financial-Times/cp-content-pipeline/commit/a134e301f6eaddd6eb665489b76dfd36097a8903))
29
+ * reserve image width/height to prevent layout shift ([59d2d31](https://github.com/Financial-Times/cp-content-pipeline/commit/59d2d314625f47b73f422ac1a71d7c3afe7fbe6f))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * fix media query output when between widths ([7e1f8c6](https://github.com/Financial-Times/cp-content-pipeline/commit/7e1f8c6ea7d96207656920a7054695255d4a4b38))
35
+ * use system-code header in client package ([fbf9c77](https://github.com/Financial-Times/cp-content-pipeline/commit/fbf9c778d6a06ec486d52c9f6d14af3668537272))
36
+
37
+
38
+ ### Code Refactoring
39
+
40
+ * rename "inline" image to "standard" ([ca530b9](https://github.com/Financial-Times/cp-content-pipeline/commit/ca530b99f745e2a4f6a07249529601f0acdddd52))
41
+
42
+
43
+ ### Dependencies
44
+
45
+ * The following workspace dependencies were updated
46
+ * devDependencies
47
+ * @financial-times/cp-content-pipeline-schema bumped from ^0.0.0 to ^0.2.0
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Content Pipeline GraphQL Client
2
+
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
+
5
+ ## Getting Started
6
+
7
+ Run `npm install` then `npm start` from [the monorepo project root](../../README.md#commands).
8
+
9
+ The project has its own playground ui at the url it's running on.
10
+
11
+ ## Using the Client
12
+
13
+ ```js
14
+ import initContentPipelineClient from '@financial-times/cp-content-pipeline-client'
15
+
16
+ const client = initContentPipelineClient({
17
+ baseUrl: 'http://localhost:3001',
18
+ systemCode: 'cp-content-pipeline',
19
+ })
20
+
21
+ const { content: articleData } = await client.Article({
22
+ uuid: request.params.uuid,
23
+ useVanities: true,
24
+ })
25
+ ```
package/codegen.yml ADDED
@@ -0,0 +1,15 @@
1
+ schema:
2
+ - schema:
3
+ loader: './loader.js'
4
+ documents: queries/*.graphql
5
+ generates:
6
+ src/generated/index.ts:
7
+ plugins:
8
+ - typescript
9
+ - typescript-operations
10
+ - typescript-graphql-request
11
+ config:
12
+ # discourage transforming data in consumers by making properties readonly
13
+ immutableTypes: true
14
+ # make types better-compatible with React, which doesn't like null
15
+ maybeValue: T