@stonecrop/graphql-client 0.13.12 → 0.13.14

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.
@@ -1,9 +1,23 @@
1
1
  /**
2
- * Queries for the GraphQL API.
2
+ * GraphQL query documents sent by {@link StonecropClient} to the middleware.
3
+ *
4
+ * These are the client's half of the wire contract with `@stonecrop/graphql-middleware`.
5
+ * They live here as exported constants (rather than inline in the client methods) so the
6
+ * cross-package contract test can validate the exact strings the client sends against the
7
+ * middleware's published SDL — a field the server drops while a query still selects it must
8
+ * fail CI, not production.
9
+ *
3
10
  * @public
4
11
  */
5
- declare const queries: {
6
- getMeta: string;
7
- };
8
- export { queries };
12
+ export declare const GET_META_QUERY = "\n\tquery GetMeta($doctype: String!) {\n\t\tstonecropMeta(doctype: $doctype) {\n\t\t\tname\n\t\t\tslug\n\t\t\tfields {\n\t\t\t\tfieldname\n\t\t\t\tfieldtype\n\t\t\t\tcomponent\n\t\t\t\tlabel\n\t\t\t\twidth\n\t\t\t\talign\n\t\t\t\trequired\n\t\t\t\treadOnly\n\t\t\t\tedit\n\t\t\t\thidden\n\t\t\t\tdefault\n\t\t\t\toptions\n\t\t\t\tmask\n\t\t\t\tprecision\n\t\t\t\tscale\n\t\t\t\tmode\n\t\t\t\tvalidation\n\t\t\t}\n\t\t\tworkflow {\n\t\t\t\tstates\n\t\t\t\tactions {\n\t\t\t\t\tlabel\n\t\t\t\t\trequiredFields\n\t\t\t\t\tallowedStates\n\t\t\t\t}\n\t\t\t}\n\t\t\tinherits\n\t\t}\n\t}\n";
13
+ /**
14
+ * Mutation document for dispatching a workflow action (the server-owned transition).
15
+ * @public
16
+ */
17
+ export declare const RUN_ACTION_MUTATION = "\n\tmutation RunAction($doctype: String!, $action: String!, $args: JSON) {\n\t\tstonecropAction(doctype: $doctype, action: $action, args: $args) {\n\t\t\tsuccess\n\t\t\tdata\n\t\t\terror\n\t\t}\n\t}\n";
18
+ /**
19
+ * Query document for fetching all doctype metadata.
20
+ * @public
21
+ */
22
+ export declare const GET_ALL_META_QUERY = "\n\tquery GetAllMeta {\n\t\tstonecropAllMeta {\n\t\t\tname\n\t\t\tslug\n\t\t\tfields {\n\t\t\t\tfieldname\n\t\t\t\tfieldtype\n\t\t\t\tcomponent\n\t\t\t\tlabel\n\t\t\t\twidth\n\t\t\t\talign\n\t\t\t\trequired\n\t\t\t\treadOnly\n\t\t\t\tedit\n\t\t\t\thidden\n\t\t\t\tdefault\n\t\t\t\toptions\n\t\t\t\tmask\n\t\t\t\tprecision\n\t\t\t\tscale\n\t\t\t\tmode\n\t\t\t\tvalidation\n\t\t\t}\n\t\t\tworkflow {\n\t\t\t\tstates\n\t\t\t\tactions {\n\t\t\t\t\tlabel\n\t\t\t\t\trequiredFields\n\t\t\t\t\tallowedStates\n\t\t\t\t}\n\t\t\t}\n\t\t\tinherits\n\t\t}\n\t}\n";
9
23
  //# sourceMappingURL=queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/queries.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,QAAA,MAAM,OAAO;;CAYZ,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,2kBAmC1B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,6MAQ/B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,2iBAmC9B,CAAA"}
@@ -1,19 +1,100 @@
1
- import { gql } from 'graphql-request';
2
1
  /**
3
- * Queries for the GraphQL API.
2
+ * GraphQL query documents sent by {@link StonecropClient} to the middleware.
3
+ *
4
+ * These are the client's half of the wire contract with `@stonecrop/graphql-middleware`.
5
+ * They live here as exported constants (rather than inline in the client methods) so the
6
+ * cross-package contract test can validate the exact strings the client sends against the
7
+ * middleware's published SDL — a field the server drops while a query still selects it must
8
+ * fail CI, not production.
9
+ *
4
10
  * @public
5
11
  */
6
- const queries = {
7
- getMeta: gql `
8
- query getDoctype($doctype: String!) {
9
- getMeta(doctype: $doctype) {
10
- id
11
- name
12
- workflow
13
- schema
14
- actions
12
+ export const GET_META_QUERY = `
13
+ query GetMeta($doctype: String!) {
14
+ stonecropMeta(doctype: $doctype) {
15
+ name
16
+ slug
17
+ fields {
18
+ fieldname
19
+ fieldtype
20
+ component
21
+ label
22
+ width
23
+ align
24
+ required
25
+ readOnly
26
+ edit
27
+ hidden
28
+ default
29
+ options
30
+ mask
31
+ precision
32
+ scale
33
+ mode
34
+ validation
15
35
  }
36
+ workflow {
37
+ states
38
+ actions {
39
+ label
40
+ requiredFields
41
+ allowedStates
42
+ }
43
+ }
44
+ inherits
45
+ }
46
+ }
47
+ `;
48
+ /**
49
+ * Mutation document for dispatching a workflow action (the server-owned transition).
50
+ * @public
51
+ */
52
+ export const RUN_ACTION_MUTATION = `
53
+ mutation RunAction($doctype: String!, $action: String!, $args: JSON) {
54
+ stonecropAction(doctype: $doctype, action: $action, args: $args) {
55
+ success
56
+ data
57
+ error
58
+ }
59
+ }
60
+ `;
61
+ /**
62
+ * Query document for fetching all doctype metadata.
63
+ * @public
64
+ */
65
+ export const GET_ALL_META_QUERY = `
66
+ query GetAllMeta {
67
+ stonecropAllMeta {
68
+ name
69
+ slug
70
+ fields {
71
+ fieldname
72
+ fieldtype
73
+ component
74
+ label
75
+ width
76
+ align
77
+ required
78
+ readOnly
79
+ edit
80
+ hidden
81
+ default
82
+ options
83
+ mask
84
+ precision
85
+ scale
86
+ mode
87
+ validation
88
+ }
89
+ workflow {
90
+ states
91
+ actions {
92
+ label
93
+ requiredFields
94
+ allowedStates
95
+ }
96
+ }
97
+ inherits
16
98
  }
17
- `,
18
- };
19
- export { queries };
99
+ }
100
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/graphql-client",
3
- "version": "0.13.12",
3
+ "version": "0.13.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -32,8 +32,8 @@
32
32
  "dependencies": {
33
33
  "graphql": "^16.14.0",
34
34
  "pluralize": "^8.0.0",
35
- "@stonecrop/schema": "0.13.12",
36
- "@stonecrop/stonecrop": "0.13.12"
35
+ "@stonecrop/schema": "0.13.14",
36
+ "@stonecrop/stonecrop": "0.13.14"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@microsoft/api-documenter": "^7.30.5",