@cmscraft/schema 0.0.0-stage → 0.3.5
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/README.md +51 -2
- package/dist/types.d.ts +1629 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +352 -0
- package/package.json +47 -5
- package/schema.gql +1726 -0
package/README.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cmscraft/schema
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The public GraphQL schema of the [CMS Craft](https://docs.cms-craft.com) API, as SDL, plus generated TypeScript types.
|
|
4
|
+
Use it to generate a typed client without introspecting the live API.
|
|
5
|
+
|
|
6
|
+
> Free during beta. Paid plans will follow; we will announce pricing and give notice before any charge.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm i -D @cmscraft/schema
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`pnpm add -D @cmscraft/schema` and `yarn add -D @cmscraft/schema` work the same way.
|
|
15
|
+
|
|
16
|
+
## Use as a codegen schema
|
|
17
|
+
|
|
18
|
+
`@cmscraft/schema/schema.gql` is the schema file. Point [GraphQL Code Generator](https://the-guild.dev/graphql/codegen)
|
|
19
|
+
at it:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// codegen.ts
|
|
23
|
+
import type { CodegenConfig } from '@graphql-codegen/cli'
|
|
24
|
+
|
|
25
|
+
const config: CodegenConfig = {
|
|
26
|
+
schema: 'node_modules/@cmscraft/schema/schema.gql',
|
|
27
|
+
documents: ['src/**/*.graphql'],
|
|
28
|
+
generates: {
|
|
29
|
+
'src/generated/graphql.ts': { plugins: ['typescript', 'typescript-operations'] }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default config
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Types
|
|
37
|
+
|
|
38
|
+
The generated schema types are exported from `@cmscraft/schema/types`:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import type { Query } from '@cmscraft/schema/types'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Documentation
|
|
45
|
+
|
|
46
|
+
Endpoint, authentication and API guides: https://docs.cms-craft.com
|
|
47
|
+
|
|
48
|
+
Questions: support@cms-craft.com
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT
|