@distilled.cloud/core 1.0.0-rc.11 → 1.0.0-rc.13

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.
Files changed (149) hide show
  1. package/lib/api.d.ts +4 -4
  2. package/lib/api.d.ts.map +1 -1
  3. package/lib/api.js +1 -1
  4. package/lib/api.js.map +1 -1
  5. package/lib/category.js +1 -1
  6. package/lib/category.js.map +1 -1
  7. package/lib/codegen/boolean-string-enums.d.ts +8 -8
  8. package/lib/codegen/boolean-string-enums.d.ts.map +1 -1
  9. package/lib/codegen/boolean-string-enums.js +84 -27
  10. package/lib/codegen/boolean-string-enums.js.map +1 -1
  11. package/lib/codegen/boolean-string-enums.test.js +130 -0
  12. package/lib/codegen/boolean-string-enums.test.js.map +1 -1
  13. package/lib/codegen/cli.js +2 -2
  14. package/lib/codegen/cli.js.map +1 -1
  15. package/lib/codegen/generator.d.ts +20 -3
  16. package/lib/codegen/generator.d.ts.map +1 -1
  17. package/lib/codegen/generator.js +36 -9
  18. package/lib/codegen/generator.js.map +1 -1
  19. package/lib/codegen/generator.test.d.ts +2 -0
  20. package/lib/codegen/generator.test.d.ts.map +1 -0
  21. package/lib/codegen/generator.test.js +126 -0
  22. package/lib/codegen/generator.test.js.map +1 -0
  23. package/lib/codegen/graphql-client.d.ts +7 -1
  24. package/lib/codegen/graphql-client.d.ts.map +1 -1
  25. package/lib/codegen/graphql-client.js +262 -125
  26. package/lib/codegen/graphql-client.js.map +1 -1
  27. package/lib/codegen/graphql-client.test.js +104 -236
  28. package/lib/codegen/graphql-client.test.js.map +1 -1
  29. package/lib/codegen/openapi-binary.test.d.ts +2 -0
  30. package/lib/codegen/openapi-binary.test.d.ts.map +1 -0
  31. package/lib/codegen/openapi-binary.test.js +67 -0
  32. package/lib/codegen/openapi-binary.test.js.map +1 -0
  33. package/lib/codegen/openapi.d.ts +7 -1
  34. package/lib/codegen/openapi.d.ts.map +1 -1
  35. package/lib/codegen/openapi.js +15 -4
  36. package/lib/codegen/openapi.js.map +1 -1
  37. package/lib/codegen/patches.d.ts +16 -1
  38. package/lib/codegen/patches.d.ts.map +1 -1
  39. package/lib/codegen/patches.js +70 -4
  40. package/lib/codegen/patches.js.map +1 -1
  41. package/lib/codegen/patches.test.js +48 -2
  42. package/lib/codegen/patches.test.js.map +1 -1
  43. package/lib/codegen/untagged-unions.test.d.ts +2 -0
  44. package/lib/codegen/untagged-unions.test.d.ts.map +1 -0
  45. package/lib/codegen/untagged-unions.test.js +80 -0
  46. package/lib/codegen/untagged-unions.test.js.map +1 -0
  47. package/lib/errors.d.ts +2 -1
  48. package/lib/errors.d.ts.map +1 -1
  49. package/lib/errors.js +5 -2
  50. package/lib/errors.js.map +1 -1
  51. package/lib/fixtures/xml/upstream-validator.json +397 -0
  52. package/lib/graphql.d.ts +296 -205
  53. package/lib/graphql.d.ts.map +1 -1
  54. package/lib/graphql.js +968 -631
  55. package/lib/graphql.js.map +1 -1
  56. package/lib/graphql.test.js +134 -763
  57. package/lib/graphql.test.js.map +1 -1
  58. package/lib/graphql.types.d.ts +10 -0
  59. package/lib/graphql.types.d.ts.map +1 -1
  60. package/lib/graphql.types.js +4 -44
  61. package/lib/graphql.types.js.map +1 -1
  62. package/lib/index.d.ts +27 -0
  63. package/lib/index.d.ts.map +1 -0
  64. package/lib/index.js +27 -0
  65. package/lib/index.js.map +1 -0
  66. package/lib/pagination.d.ts +2 -1
  67. package/lib/pagination.d.ts.map +1 -1
  68. package/lib/pagination.js +24 -16
  69. package/lib/pagination.js.map +1 -1
  70. package/lib/pagination.test.d.ts +2 -0
  71. package/lib/pagination.test.d.ts.map +1 -0
  72. package/lib/pagination.test.js +134 -0
  73. package/lib/pagination.test.js.map +1 -0
  74. package/lib/protocol-http.d.ts +12 -17
  75. package/lib/protocol-http.d.ts.map +1 -1
  76. package/lib/protocol-http.js +100 -45
  77. package/lib/protocol-http.js.map +1 -1
  78. package/lib/protocol-http.test.js +130 -0
  79. package/lib/protocol-http.test.js.map +1 -1
  80. package/lib/protocol-rest.d.ts +18 -1
  81. package/lib/protocol-rest.d.ts.map +1 -1
  82. package/lib/protocol-rest.js +24 -4
  83. package/lib/protocol-rest.js.map +1 -1
  84. package/lib/query.d.ts +29 -0
  85. package/lib/query.d.ts.map +1 -0
  86. package/lib/query.js +27 -0
  87. package/lib/query.js.map +1 -0
  88. package/lib/response-validation.d.ts +67 -0
  89. package/lib/response-validation.d.ts.map +1 -0
  90. package/lib/response-validation.js +76 -0
  91. package/lib/response-validation.js.map +1 -0
  92. package/lib/response-validation.test.d.ts +2 -0
  93. package/lib/response-validation.test.d.ts.map +1 -0
  94. package/lib/response-validation.test.js +67 -0
  95. package/lib/response-validation.test.js.map +1 -0
  96. package/lib/testing.d.ts +39 -0
  97. package/lib/testing.d.ts.map +1 -0
  98. package/lib/testing.js +41 -0
  99. package/lib/testing.js.map +1 -0
  100. package/lib/trait.d.ts +29 -9
  101. package/lib/trait.d.ts.map +1 -1
  102. package/lib/trait.js +8 -0
  103. package/lib/trait.js.map +1 -1
  104. package/lib/xml.d.ts +44 -0
  105. package/lib/xml.d.ts.map +1 -0
  106. package/lib/xml.js +315 -0
  107. package/lib/xml.js.map +1 -0
  108. package/lib/xml.test.d.ts +2 -0
  109. package/lib/xml.test.d.ts.map +1 -0
  110. package/lib/xml.test.js +211 -0
  111. package/lib/xml.test.js.map +1 -0
  112. package/package.json +4 -4
  113. package/src/api.ts +4 -4
  114. package/src/category.ts +1 -1
  115. package/src/codegen/boolean-string-enums.test.ts +147 -0
  116. package/src/codegen/boolean-string-enums.ts +84 -27
  117. package/src/codegen/cli.ts +2 -2
  118. package/src/codegen/generator.test.ts +151 -0
  119. package/src/codegen/generator.ts +70 -12
  120. package/src/codegen/graphql-client.test.ts +116 -283
  121. package/src/codegen/graphql-client.ts +326 -169
  122. package/src/codegen/openapi-binary.test.ts +98 -0
  123. package/src/codegen/openapi.ts +26 -4
  124. package/src/codegen/patches.test.ts +66 -1
  125. package/src/codegen/patches.ts +84 -4
  126. package/src/codegen/untagged-unions.test.ts +89 -0
  127. package/src/errors.ts +5 -2
  128. package/src/fixtures/xml/upstream-validator.json +397 -0
  129. package/src/graphql.test.ts +174 -948
  130. package/src/graphql.ts +1592 -1167
  131. package/src/graphql.types.ts +92 -163
  132. package/src/index.ts +26 -0
  133. package/src/pagination.test.ts +191 -0
  134. package/src/pagination.ts +35 -25
  135. package/src/protocol-http.test.ts +163 -0
  136. package/src/protocol-http.ts +122 -46
  137. package/src/protocol-rest.ts +62 -13
  138. package/src/query.ts +39 -0
  139. package/src/response-validation.test.ts +95 -0
  140. package/src/response-validation.ts +116 -0
  141. package/src/testing.ts +78 -0
  142. package/src/trait.ts +39 -8
  143. package/src/xml.test.ts +269 -0
  144. package/src/xml.ts +339 -0
  145. package/lib/graphql.fixture.d.ts +0 -249
  146. package/lib/graphql.fixture.d.ts.map +0 -1
  147. package/lib/graphql.fixture.js +0 -240
  148. package/lib/graphql.fixture.js.map +0 -1
  149. package/src/graphql.fixture.ts +0 -371
@@ -1,240 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import * as G from "./graphql.js";
3
- export class ProjectNotFound extends Schema.TaggedError()("ProjectNotFound", G.errorFields) {
4
- }
5
- export class ServicesUnavailable extends Schema.TaggedError()("ServicesUnavailable", G.errorFields) {
6
- }
7
- export class Unauthorized extends Schema.TaggedError()("Unauthorized", G.errorFields) {
8
- }
9
- export class ProjectDescriptionUnavailable extends Schema.TaggedError()("ProjectDescriptionUnavailable", G.errorFields) {
10
- }
11
- export class ServiceDescriptionUnavailable extends Schema.TaggedError()("ServiceDescriptionUnavailable", G.errorFields) {
12
- }
13
- export class PageInfoUnavailable extends Schema.TaggedError()("PageInfoUnavailable", G.errorFields) {
14
- }
15
- export const errorClasses = {
16
- ProjectNotFound,
17
- ServicesUnavailable,
18
- Unauthorized,
19
- ProjectDescriptionUnavailable,
20
- ServiceDescriptionUnavailable,
21
- PageInfoUnavailable,
22
- };
23
- const field = (type, args = {}, errors = []) => ({ type, args, errors });
24
- export const fixtureModel = {
25
- version: 1,
26
- queryType: "Query",
27
- mutationType: "Mutation",
28
- errors: {
29
- ProjectNotFound: { matchers: [{ code: "NOT_FOUND" }] },
30
- ServicesUnavailable: { matchers: [{ code: "UNAVAILABLE" }] },
31
- ProjectDescriptionUnavailable: {
32
- matchers: [{ code: "DESCRIPTION_UNAVAILABLE" }],
33
- },
34
- ServiceDescriptionUnavailable: {
35
- matchers: [{ code: "DESCRIPTION_UNAVAILABLE" }],
36
- },
37
- PageInfoUnavailable: { matchers: [{ code: "PAGE_INFO_UNAVAILABLE" }] },
38
- Unauthorized: {
39
- matchers: [
40
- { code: "UNAUTHENTICATED" },
41
- { code: "INTERNAL_SERVER_ERROR", message: "Not Authorized" },
42
- ],
43
- },
44
- },
45
- globalErrors: ["Unauthorized"],
46
- types: {
47
- ID: { kind: "SCALAR", scalar: "string" },
48
- String: { kind: "SCALAR", scalar: "string" },
49
- Int: { kind: "SCALAR", scalar: "number" },
50
- Boolean: { kind: "SCALAR", scalar: "boolean" },
51
- JSON: { kind: "SCALAR", scalar: "unknown" },
52
- Status: { kind: "ENUM", enumValues: ["ACTIVE", "ARCHIVED"] },
53
- ProjectFilter: {
54
- kind: "INPUT_OBJECT",
55
- inputFields: {
56
- name: { type: "String" },
57
- statuses: { type: "[Status!]", defaultValue: "[ACTIVE]" },
58
- metadata: { type: "JSON" },
59
- },
60
- },
61
- Query: {
62
- kind: "OBJECT",
63
- fields: {
64
- project: field("Project", { id: { type: "ID!" } }, ["ProjectNotFound"]),
65
- projects: field("[Project]!", { filter: { type: "ProjectFilter" } }),
66
- node: field("Node", { id: { type: "ID!" } }),
67
- search: field("[SearchResult!]!", { text: { type: "String!" } }),
68
- services: field("ServiceConnection!", {
69
- first: { type: "Int", defaultValue: "20" },
70
- after: { type: "String" },
71
- }, ["ServicesUnavailable"]),
72
- ping: field("Boolean!"),
73
- },
74
- },
75
- Mutation: {
76
- kind: "OBJECT",
77
- fields: {
78
- editProject: field("Project!", { id: { type: "ID!" }, name: { type: "String!" } }, ["ProjectNotFound"]),
79
- deleteProject: field("Boolean!", { id: { type: "ID!" } }, [
80
- "ProjectNotFound",
81
- ]),
82
- },
83
- },
84
- Project: {
85
- kind: "OBJECT",
86
- interfaces: ["Node"],
87
- fields: {
88
- id: field("ID!"),
89
- name: field("String!"),
90
- description: field("String", {}, ["ProjectDescriptionUnavailable"]),
91
- parent: field("Project"),
92
- services: field("ServiceConnection", {
93
- first: { type: "Int", defaultValue: "20" },
94
- after: { type: "String" },
95
- filter: { type: "ProjectFilter" },
96
- }, ["ServicesUnavailable"]),
97
- },
98
- },
99
- Service: {
100
- kind: "OBJECT",
101
- interfaces: ["Node"],
102
- fields: {
103
- id: field("ID!"),
104
- parent: field("Project"),
105
- name: field("String!"),
106
- description: field("String", {}, ["ServiceDescriptionUnavailable"]),
107
- project: field("Project!"),
108
- status: field("Status!"),
109
- },
110
- },
111
- ServiceConnection: {
112
- kind: "OBJECT",
113
- fields: { edges: field("[ServiceEdge!]!"), pageInfo: field("PageInfo!") },
114
- },
115
- ServiceEdge: {
116
- kind: "OBJECT",
117
- fields: { cursor: field("String!"), node: field("Service!") },
118
- },
119
- PageInfo: {
120
- kind: "OBJECT",
121
- fields: {
122
- endCursor: field("String"),
123
- hasNextPage: field("Boolean!", {}, ["PageInfoUnavailable"]),
124
- },
125
- },
126
- Node: {
127
- kind: "INTERFACE",
128
- fields: { id: field("ID!"), parent: field("Project") },
129
- possibleTypes: ["Project", "Service"],
130
- },
131
- SearchResult: { kind: "UNION", possibleTypes: ["Project", "Service"] },
132
- },
133
- };
134
- /** A deliberately small recursive schema for GraphQL compiler/runtime tests. */
135
- export const fixtureSDL = /* GraphQL */ `
136
- scalar JSON
137
-
138
- enum Status {
139
- ACTIVE
140
- ARCHIVED
141
- }
142
-
143
- input ProjectFilter {
144
- name: String
145
- statuses: [Status!] = [ACTIVE]
146
- metadata: JSON
147
- }
148
-
149
- interface Node {
150
- id: ID!
151
- parent: Project
152
- }
153
-
154
- type Project implements Node {
155
- id: ID!
156
- name: String!
157
- description: String
158
- parent: Project
159
- services(
160
- first: Int = 20
161
- after: String
162
- filter: ProjectFilter
163
- ): ServiceConnection
164
- }
165
-
166
- type Service implements Node {
167
- id: ID!
168
- parent: Project
169
- name: String!
170
- description: String
171
- project: Project!
172
- status: Status!
173
- }
174
-
175
- type ServiceConnection {
176
- edges: [ServiceEdge!]!
177
- pageInfo: PageInfo!
178
- }
179
-
180
- type ServiceEdge {
181
- cursor: String!
182
- node: Service!
183
- }
184
-
185
- type PageInfo {
186
- endCursor: String
187
- hasNextPage: Boolean!
188
- }
189
-
190
- union SearchResult = Project | Service
191
-
192
- type Query {
193
- project(id: ID!): Project
194
- projects(filter: ProjectFilter): [Project]!
195
- node(id: ID!): Node
196
- search(text: String!): [SearchResult!]!
197
- services(first: Int = 20, after: String): ServiceConnection!
198
- ping: Boolean!
199
- }
200
-
201
- type Mutation {
202
- editProject(id: ID!, name: String!): Project!
203
- deleteProject(id: ID!): Boolean!
204
- }
205
- `;
206
- /** Includes characters that must travel in variables, never in GraphQL text. */
207
- export const adversarialArgument = 'quoted "value" \\ path\nline\t\u0000 😀';
208
- export const partialProjectEnvelope = {
209
- data: {
210
- project: { id: "p1", services: null },
211
- ping: true,
212
- },
213
- errors: [
214
- {
215
- message: "Services temporarily unavailable",
216
- path: ["project", "services"],
217
- locations: [{ line: 1, column: 25 }],
218
- extensions: { code: "UNAVAILABLE", incident: "incident-1" },
219
- },
220
- ],
221
- };
222
- export const multipleErrorEnvelope = {
223
- data: {
224
- production: null,
225
- staging: { id: "p2", services: null },
226
- },
227
- errors: [
228
- {
229
- message: "Project not found",
230
- path: ["production"],
231
- extensions: { code: "NOT_FOUND" },
232
- },
233
- {
234
- message: "Services temporarily unavailable",
235
- path: ["staging", "services"],
236
- extensions: { code: "UNAVAILABLE" },
237
- },
238
- ],
239
- };
240
- //# sourceMappingURL=graphql.fixture.js.map
@@ -1 +0,0 @@
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a,EAAE,QAAQ,EAAE,YAAY,EAAE;SAC5D;KACF;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE;QACJ,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KACtC;IACD,MAAM,EAAE;QACN;YACE,OAAO,EAAE,mBAAmB;YAC5B,IAAI,EAAE,CAAC,YAAY,CAAC;YACpB,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;SAClC;QACD;YACE,OAAO,EAAE,kCAAkC;YAC3C,IAAI,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;YAC7B,UAAU,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;SACpC;KACF;CACO,CAAC"}
@@ -1,371 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import * as G from "./graphql.ts";
3
- import type { GraphQLField, GraphQLModel } from "./codegen/graphql-client.ts";
4
-
5
- export class ProjectNotFound extends Schema.TaggedError<ProjectNotFound>()(
6
- "ProjectNotFound",
7
- G.errorFields,
8
- ) {}
9
- export class ServicesUnavailable extends Schema.TaggedError<ServicesUnavailable>()(
10
- "ServicesUnavailable",
11
- G.errorFields,
12
- ) {}
13
- export class Unauthorized extends Schema.TaggedError<Unauthorized>()(
14
- "Unauthorized",
15
- G.errorFields,
16
- ) {}
17
- export class ProjectDescriptionUnavailable extends Schema.TaggedError<ProjectDescriptionUnavailable>()(
18
- "ProjectDescriptionUnavailable",
19
- G.errorFields,
20
- ) {}
21
- export class ServiceDescriptionUnavailable extends Schema.TaggedError<ServiceDescriptionUnavailable>()(
22
- "ServiceDescriptionUnavailable",
23
- G.errorFields,
24
- ) {}
25
- export class PageInfoUnavailable extends Schema.TaggedError<PageInfoUnavailable>()(
26
- "PageInfoUnavailable",
27
- G.errorFields,
28
- ) {}
29
-
30
- export const errorClasses = {
31
- ProjectNotFound,
32
- ServicesUnavailable,
33
- Unauthorized,
34
- ProjectDescriptionUnavailable,
35
- ServiceDescriptionUnavailable,
36
- PageInfoUnavailable,
37
- };
38
-
39
- export type FixtureSchema = {
40
- query: "Query";
41
- mutation: "Mutation";
42
- subscription: never;
43
- globalErrors: "Unauthorized";
44
- errors: {
45
- ProjectNotFound: ProjectNotFound;
46
- ServicesUnavailable: ServicesUnavailable;
47
- Unauthorized: Unauthorized;
48
- ProjectDescriptionUnavailable: ProjectDescriptionUnavailable;
49
- ServiceDescriptionUnavailable: ServiceDescriptionUnavailable;
50
- PageInfoUnavailable: PageInfoUnavailable;
51
- };
52
- scalars: {
53
- ID: string;
54
- String: string;
55
- Int: number;
56
- Boolean: boolean;
57
- JSON: unknown;
58
- Status: "ACTIVE" | "ARCHIVED";
59
- };
60
- possibleTypes: {
61
- Node: "Project" | "Service";
62
- SearchResult: "Project" | "Service";
63
- };
64
- types: {
65
- Query: {
66
- project: G.Field<{ id: string }, "Project", "ProjectNotFound">;
67
- projects: G.Field<
68
- {
69
- filter?: {
70
- name?: string | null;
71
- statuses?: Array<"ACTIVE" | "ARCHIVED"> | null;
72
- metadata?: unknown;
73
- } | null;
74
- },
75
- "[Project]!"
76
- >;
77
- node: G.Field<{ id: string }, "Node">;
78
- search: G.Field<{ text: string }, "[SearchResult!]!">;
79
- services: G.Field<
80
- { first?: number | null; after?: string | null },
81
- "ServiceConnection!",
82
- "ServicesUnavailable"
83
- >;
84
- ping: G.Field<{}, "Boolean!">;
85
- };
86
- Mutation: {
87
- editProject: G.Field<
88
- { id: string; name: string },
89
- "Project!",
90
- "ProjectNotFound"
91
- >;
92
- deleteProject: G.Field<{ id: string }, "Boolean!", "ProjectNotFound">;
93
- };
94
- Project: {
95
- id: G.Field<{}, "ID!">;
96
- name: G.Field<{}, "String!">;
97
- description: G.Field<{}, "String", "ProjectDescriptionUnavailable">;
98
- parent: G.Field<{}, "Project">;
99
- services: G.Field<
100
- {
101
- first?: number | null;
102
- after?: string | null;
103
- filter?: { name?: string | null } | null;
104
- },
105
- "ServiceConnection",
106
- "ServicesUnavailable"
107
- >;
108
- };
109
- Service: {
110
- id: G.Field<{}, "ID!">;
111
- parent: G.Field<{}, "Project">;
112
- name: G.Field<{}, "String!">;
113
- description: G.Field<{}, "String", "ServiceDescriptionUnavailable">;
114
- project: G.Field<{}, "Project!">;
115
- status: G.Field<{}, "Status!">;
116
- };
117
- ServiceConnection: {
118
- edges: G.Field<{}, "[ServiceEdge!]!">;
119
- pageInfo: G.Field<{}, "PageInfo!">;
120
- };
121
- ServiceEdge: {
122
- cursor: G.Field<{}, "String!">;
123
- node: G.Field<{}, "Service!">;
124
- };
125
- PageInfo: {
126
- endCursor: G.Field<{}, "String">;
127
- hasNextPage: G.Field<{}, "Boolean!", "PageInfoUnavailable">;
128
- };
129
- Node: { id: G.Field<{}, "ID!">; parent: G.Field<{}, "Project"> };
130
- SearchResult: {};
131
- };
132
- };
133
-
134
- const field = (
135
- type: string,
136
- args: Record<string, { type: string; defaultValue?: string }> = {},
137
- errors: string[] = [],
138
- ): GraphQLField => ({ type, args, errors });
139
-
140
- export const fixtureModel: GraphQLModel = {
141
- version: 1,
142
- queryType: "Query",
143
- mutationType: "Mutation",
144
- errors: {
145
- ProjectNotFound: { matchers: [{ code: "NOT_FOUND" }] },
146
- ServicesUnavailable: { matchers: [{ code: "UNAVAILABLE" }] },
147
- ProjectDescriptionUnavailable: {
148
- matchers: [{ code: "DESCRIPTION_UNAVAILABLE" }],
149
- },
150
- ServiceDescriptionUnavailable: {
151
- matchers: [{ code: "DESCRIPTION_UNAVAILABLE" }],
152
- },
153
- PageInfoUnavailable: { matchers: [{ code: "PAGE_INFO_UNAVAILABLE" }] },
154
- Unauthorized: {
155
- matchers: [
156
- { code: "UNAUTHENTICATED" },
157
- { code: "INTERNAL_SERVER_ERROR", message: "Not Authorized" },
158
- ],
159
- },
160
- },
161
- globalErrors: ["Unauthorized"],
162
- types: {
163
- ID: { kind: "SCALAR", scalar: "string" },
164
- String: { kind: "SCALAR", scalar: "string" },
165
- Int: { kind: "SCALAR", scalar: "number" },
166
- Boolean: { kind: "SCALAR", scalar: "boolean" },
167
- JSON: { kind: "SCALAR", scalar: "unknown" },
168
- Status: { kind: "ENUM", enumValues: ["ACTIVE", "ARCHIVED"] },
169
- ProjectFilter: {
170
- kind: "INPUT_OBJECT",
171
- inputFields: {
172
- name: { type: "String" },
173
- statuses: { type: "[Status!]", defaultValue: "[ACTIVE]" },
174
- metadata: { type: "JSON" },
175
- },
176
- },
177
- Query: {
178
- kind: "OBJECT",
179
- fields: {
180
- project: field("Project", { id: { type: "ID!" } }, ["ProjectNotFound"]),
181
- projects: field("[Project]!", { filter: { type: "ProjectFilter" } }),
182
- node: field("Node", { id: { type: "ID!" } }),
183
- search: field("[SearchResult!]!", { text: { type: "String!" } }),
184
- services: field(
185
- "ServiceConnection!",
186
- {
187
- first: { type: "Int", defaultValue: "20" },
188
- after: { type: "String" },
189
- },
190
- ["ServicesUnavailable"],
191
- ),
192
- ping: field("Boolean!"),
193
- },
194
- },
195
- Mutation: {
196
- kind: "OBJECT",
197
- fields: {
198
- editProject: field(
199
- "Project!",
200
- { id: { type: "ID!" }, name: { type: "String!" } },
201
- ["ProjectNotFound"],
202
- ),
203
- deleteProject: field("Boolean!", { id: { type: "ID!" } }, [
204
- "ProjectNotFound",
205
- ]),
206
- },
207
- },
208
- Project: {
209
- kind: "OBJECT",
210
- interfaces: ["Node"],
211
- fields: {
212
- id: field("ID!"),
213
- name: field("String!"),
214
- description: field("String", {}, ["ProjectDescriptionUnavailable"]),
215
- parent: field("Project"),
216
- services: field(
217
- "ServiceConnection",
218
- {
219
- first: { type: "Int", defaultValue: "20" },
220
- after: { type: "String" },
221
- filter: { type: "ProjectFilter" },
222
- },
223
- ["ServicesUnavailable"],
224
- ),
225
- },
226
- },
227
- Service: {
228
- kind: "OBJECT",
229
- interfaces: ["Node"],
230
- fields: {
231
- id: field("ID!"),
232
- parent: field("Project"),
233
- name: field("String!"),
234
- description: field("String", {}, ["ServiceDescriptionUnavailable"]),
235
- project: field("Project!"),
236
- status: field("Status!"),
237
- },
238
- },
239
- ServiceConnection: {
240
- kind: "OBJECT",
241
- fields: { edges: field("[ServiceEdge!]!"), pageInfo: field("PageInfo!") },
242
- },
243
- ServiceEdge: {
244
- kind: "OBJECT",
245
- fields: { cursor: field("String!"), node: field("Service!") },
246
- },
247
- PageInfo: {
248
- kind: "OBJECT",
249
- fields: {
250
- endCursor: field("String"),
251
- hasNextPage: field("Boolean!", {}, ["PageInfoUnavailable"]),
252
- },
253
- },
254
- Node: {
255
- kind: "INTERFACE",
256
- fields: { id: field("ID!"), parent: field("Project") },
257
- possibleTypes: ["Project", "Service"],
258
- },
259
- SearchResult: { kind: "UNION", possibleTypes: ["Project", "Service"] },
260
- },
261
- };
262
-
263
- /** A deliberately small recursive schema for GraphQL compiler/runtime tests. */
264
- export const fixtureSDL = /* GraphQL */ `
265
- scalar JSON
266
-
267
- enum Status {
268
- ACTIVE
269
- ARCHIVED
270
- }
271
-
272
- input ProjectFilter {
273
- name: String
274
- statuses: [Status!] = [ACTIVE]
275
- metadata: JSON
276
- }
277
-
278
- interface Node {
279
- id: ID!
280
- parent: Project
281
- }
282
-
283
- type Project implements Node {
284
- id: ID!
285
- name: String!
286
- description: String
287
- parent: Project
288
- services(
289
- first: Int = 20
290
- after: String
291
- filter: ProjectFilter
292
- ): ServiceConnection
293
- }
294
-
295
- type Service implements Node {
296
- id: ID!
297
- parent: Project
298
- name: String!
299
- description: String
300
- project: Project!
301
- status: Status!
302
- }
303
-
304
- type ServiceConnection {
305
- edges: [ServiceEdge!]!
306
- pageInfo: PageInfo!
307
- }
308
-
309
- type ServiceEdge {
310
- cursor: String!
311
- node: Service!
312
- }
313
-
314
- type PageInfo {
315
- endCursor: String
316
- hasNextPage: Boolean!
317
- }
318
-
319
- union SearchResult = Project | Service
320
-
321
- type Query {
322
- project(id: ID!): Project
323
- projects(filter: ProjectFilter): [Project]!
324
- node(id: ID!): Node
325
- search(text: String!): [SearchResult!]!
326
- services(first: Int = 20, after: String): ServiceConnection!
327
- ping: Boolean!
328
- }
329
-
330
- type Mutation {
331
- editProject(id: ID!, name: String!): Project!
332
- deleteProject(id: ID!): Boolean!
333
- }
334
- `;
335
-
336
- /** Includes characters that must travel in variables, never in GraphQL text. */
337
- export const adversarialArgument = 'quoted "value" \\ path\nline\t\u0000 😀';
338
-
339
- export const partialProjectEnvelope = {
340
- data: {
341
- project: { id: "p1", services: null },
342
- ping: true,
343
- },
344
- errors: [
345
- {
346
- message: "Services temporarily unavailable",
347
- path: ["project", "services"],
348
- locations: [{ line: 1, column: 25 }],
349
- extensions: { code: "UNAVAILABLE", incident: "incident-1" },
350
- },
351
- ],
352
- } as const;
353
-
354
- export const multipleErrorEnvelope = {
355
- data: {
356
- production: null,
357
- staging: { id: "p2", services: null },
358
- },
359
- errors: [
360
- {
361
- message: "Project not found",
362
- path: ["production"],
363
- extensions: { code: "NOT_FOUND" },
364
- },
365
- {
366
- message: "Services temporarily unavailable",
367
- path: ["staging", "services"],
368
- extensions: { code: "UNAVAILABLE" },
369
- },
370
- ],
371
- } as const;