@distilled.cloud/core 1.0.0-rc.12 → 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
package/src/xml.ts ADDED
@@ -0,0 +1,339 @@
1
+ import * as Data from "effect/Data";
2
+ import * as Effect from "effect/Effect";
3
+
4
+ export type XmlValue = string | XmlObject | XmlValue[];
5
+ export interface XmlObject {
6
+ [name: string]: XmlValue;
7
+ }
8
+
9
+ export class XmlParseError extends Data.TaggedError("XmlParseError")<{
10
+ readonly message: string;
11
+ /** UTF-16 offset in the original input; line and column are one-based. */
12
+ readonly offset: number;
13
+ readonly line: number;
14
+ readonly column: number;
15
+ }> {}
16
+
17
+ export interface XmlParseOptions {
18
+ /** Maximum open elements, including the root. Defaults to 256. */
19
+ readonly maxDepth?: number;
20
+ /** Maximum input length in UTF-16 code units. Defaults to 64 Mi. */
21
+ readonly maxLength?: number;
22
+ }
23
+
24
+ // XML 1.0 (Fifth Edition) NameStartChar / NameChar, including astral names.
25
+ const namePattern =
26
+ // XML NameChar explicitly includes combining marks as individual code points.
27
+ // eslint-disable-next-line no-misleading-character-class
28
+ /[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}.\-0-9\u00B7\u0300-\u036F\u203F-\u2040]*/uy;
29
+ const invalidCharacter =
30
+ // XML 1.0 forbids these literal controls and unpaired surrogates.
31
+ // eslint-disable-next-line no-control-regex
32
+ /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/u;
33
+ const xmlSpace = /^[\t\n\r ]*$/;
34
+ const declarationPattern =
35
+ /^xml[\t\n\r ]+version[\t\n\r ]*=[\t\n\r ]*(?:"1\.0"|'1\.0')(?:[\t\n\r ]+encoding[\t\n\r ]*=[\t\n\r ]*(?:"[A-Za-z][A-Za-z0-9._-]*"|'[A-Za-z][A-Za-z0-9._-]*'))?(?:[\t\n\r ]+standalone[\t\n\r ]*=[\t\n\r ]*(?:"(?:yes|no)"|'(?:yes|no)'))?[\t\n\r ]*$/;
36
+
37
+ interface Element {
38
+ name: string;
39
+ object: XmlObject;
40
+ text: string[];
41
+ hasChildren: boolean;
42
+ hasAttributes: boolean;
43
+ hasCdata: boolean;
44
+ }
45
+
46
+ /**
47
+ * Parse DTD-free XML 1.0. Values remain strings;
48
+ * repeated children become arrays, attributes use @_ and mixed text uses #text.
49
+ * Names are preserved verbatim (no namespace resolution). Comments and PIs are
50
+ * ignored. Text whitespace is preserved, except layout-only text in containers.
51
+ * Empty HTTP bodies produce {}. This is not a DOM or a validating DTD processor.
52
+ * Throws XmlParseError for malformed input or exceeded limits.
53
+ * The iterative scanner allocates no Effects while traversing the document.
54
+ */
55
+ export function parseXmlSync(
56
+ xml: string,
57
+ options: XmlParseOptions = {},
58
+ ): XmlObject {
59
+ let pos = xml.charCodeAt(0) === 0xfeff ? 1 : 0;
60
+ const start = pos;
61
+ const maxDepth = options.maxDepth ?? 256;
62
+ const maxLength = options.maxLength ?? 64 * 1024 * 1024;
63
+ const stack: Element[] = [];
64
+ const document: XmlObject = Object.create(null);
65
+ let hasRoot = false;
66
+
67
+ function fail(message: string, offset = pos): never {
68
+ offset = Math.min(offset, xml.length);
69
+ const lines = xml.slice(0, offset).split(/\r\n|[\r\n]/);
70
+ const line = lines.length;
71
+ const column = lines[line - 1].length + 1;
72
+ throw new XmlParseError({
73
+ message: `${message} at ${line}:${column}`,
74
+ offset,
75
+ line,
76
+ column,
77
+ });
78
+ }
79
+
80
+ if (!Number.isSafeInteger(maxDepth) || maxDepth < 1) fail("Invalid maxDepth");
81
+ if (!Number.isSafeInteger(maxLength) || maxLength < 0)
82
+ fail("Invalid maxLength");
83
+ if (xml.length > maxLength) fail("XML input length limit exceeded", 0);
84
+ const invalid = invalidCharacter.exec(xml);
85
+ if (invalid) fail("Invalid XML character", invalid.index);
86
+ if (xmlSpace.test(xml.slice(start))) return document;
87
+
88
+ function skipSpace(): boolean {
89
+ const before = pos;
90
+ while (pos < xml.length) {
91
+ const c = xml.charCodeAt(pos);
92
+ if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;
93
+ pos++;
94
+ }
95
+ return pos !== before;
96
+ }
97
+
98
+ function readName(): string {
99
+ namePattern.lastIndex = pos;
100
+ const match = namePattern.exec(xml);
101
+ if (!match) fail("Expected XML name");
102
+ pos = namePattern.lastIndex;
103
+ return match[0];
104
+ }
105
+
106
+ function decode(raw: string, offset: number, attribute = false): string {
107
+ const parts: string[] = [];
108
+ let from = 0;
109
+ while (from < raw.length) {
110
+ const amp = raw.indexOf("&", from);
111
+ const end = amp < 0 ? raw.length : amp;
112
+ const literal = raw.slice(from, end);
113
+ parts.push(
114
+ attribute
115
+ ? literal.replace(/\r\n|[\t\r\n]/g, " ")
116
+ : literal.replace(/\r\n?/g, "\n"),
117
+ );
118
+ if (amp < 0) break;
119
+ const semi = raw.indexOf(";", amp + 1);
120
+ if (semi < 0) fail("Unterminated entity reference", offset + amp);
121
+ const entity = raw.slice(amp + 1, semi);
122
+ switch (entity) {
123
+ case "amp":
124
+ parts.push("&");
125
+ break;
126
+ case "lt":
127
+ parts.push("<");
128
+ break;
129
+ case "gt":
130
+ parts.push(">");
131
+ break;
132
+ case "quot":
133
+ parts.push('"');
134
+ break;
135
+ case "apos":
136
+ parts.push("'");
137
+ break;
138
+ default: {
139
+ if (!/^#(?:[0-9]+|x[0-9a-fA-F]+)$/.test(entity)) {
140
+ fail("Unknown or invalid entity reference", offset + amp);
141
+ }
142
+ const code =
143
+ entity[1] === "x"
144
+ ? Number.parseInt(entity.slice(2), 16)
145
+ : Number.parseInt(entity.slice(1), 10);
146
+ if (
147
+ !(
148
+ code === 9 ||
149
+ code === 10 ||
150
+ code === 13 ||
151
+ (code >= 0x20 && code <= 0xd7ff) ||
152
+ (code >= 0xe000 && code <= 0xfffd) ||
153
+ (code >= 0x10000 && code <= 0x10ffff)
154
+ )
155
+ ) {
156
+ fail("Invalid character reference", offset + amp);
157
+ }
158
+ parts.push(String.fromCodePoint(code));
159
+ }
160
+ }
161
+ from = semi + 1;
162
+ }
163
+ return parts.join("");
164
+ }
165
+
166
+ function finish(element: Element): void {
167
+ const text = element.text.join("");
168
+ let value: XmlValue;
169
+ if (!element.hasChildren && !element.hasAttributes) {
170
+ value = text;
171
+ } else {
172
+ if (
173
+ text &&
174
+ (!element.hasChildren || element.hasCdata || !xmlSpace.test(text))
175
+ ) {
176
+ element.object["#text"] = text;
177
+ }
178
+ value = element.object;
179
+ }
180
+ const parent = stack[stack.length - 1];
181
+ const target = parent ? parent.object : document;
182
+ if (parent) parent.hasChildren = true;
183
+ if (!Object.hasOwn(target, element.name)) target[element.name] = value;
184
+ else {
185
+ const previous = target[element.name];
186
+ if (Array.isArray(previous)) previous.push(value);
187
+ else target[element.name] = [previous, value];
188
+ }
189
+ }
190
+
191
+ while (pos < xml.length) {
192
+ if (xml[pos] !== "<") {
193
+ const offset = pos;
194
+ const next = xml.indexOf("<", pos);
195
+ pos = next < 0 ? xml.length : next;
196
+ const raw = xml.slice(offset, pos);
197
+ const element = stack[stack.length - 1];
198
+ if (!element) {
199
+ if (!xmlSpace.test(raw)) fail("Text outside root element", offset);
200
+ } else {
201
+ const cdataEnd = raw.indexOf("]]>");
202
+ if (cdataEnd >= 0)
203
+ fail("Unexpected CDATA terminator", offset + cdataEnd);
204
+ element.text.push(decode(raw, offset));
205
+ }
206
+ continue;
207
+ }
208
+
209
+ if (xml.startsWith("<!--", pos)) {
210
+ const end = xml.indexOf("-->", pos + 4);
211
+ if (end < 0) fail("Unterminated comment");
212
+ const comment = xml.slice(pos + 4, end);
213
+ if (comment.includes("--") || comment.endsWith("-"))
214
+ fail("Invalid comment");
215
+ pos = end + 3;
216
+ } else if (xml.startsWith("<![CDATA[", pos)) {
217
+ const element = stack[stack.length - 1];
218
+ if (!element) fail("CDATA outside root element");
219
+ const end = xml.indexOf("]]>", pos + 9);
220
+ if (end < 0) fail("Unterminated CDATA");
221
+ element.text.push(xml.slice(pos + 9, end).replace(/\r\n?/g, "\n"));
222
+ element.hasCdata = true;
223
+ pos = end + 3;
224
+ } else if (xml.startsWith("<?", pos)) {
225
+ const offset = pos;
226
+ pos += 2;
227
+ const target = readName();
228
+ if (!xml.startsWith("?>", pos) && !skipSpace())
229
+ fail("Expected PI whitespace");
230
+ const end = xml.indexOf("?>", pos);
231
+ if (end < 0) fail("Unterminated processing instruction", offset);
232
+ if (target.toLowerCase() === "xml") {
233
+ if (
234
+ offset !== start ||
235
+ !declarationPattern.test(xml.slice(offset + 2, end))
236
+ ) {
237
+ fail("Invalid or misplaced XML declaration", offset);
238
+ }
239
+ }
240
+ pos = end + 2;
241
+ } else if (xml.startsWith("<!", pos)) {
242
+ fail("DTDs and markup declarations are not supported");
243
+ } else if (xml.startsWith("</", pos)) {
244
+ pos += 2;
245
+ const name = readName();
246
+ skipSpace();
247
+ if (xml[pos] !== ">") fail("Expected closing tag terminator");
248
+ const element = stack.pop();
249
+ if (!element || element.name !== name) fail("Mismatched closing tag");
250
+ pos++;
251
+ finish(element);
252
+ } else {
253
+ if (stack.length >= maxDepth) fail("XML depth limit exceeded");
254
+ if (stack.length === 0) {
255
+ if (hasRoot) fail("Multiple root elements");
256
+ hasRoot = true;
257
+ }
258
+ pos++;
259
+ const element: Element = {
260
+ name: readName(),
261
+ object: Object.create(null),
262
+ text: [],
263
+ hasChildren: false,
264
+ hasAttributes: false,
265
+ hasCdata: false,
266
+ };
267
+ while (true) {
268
+ const spaced = skipSpace();
269
+ if (xml.startsWith("/>", pos)) {
270
+ pos += 2;
271
+ finish(element);
272
+ break;
273
+ }
274
+ if (xml[pos] === ">") {
275
+ pos++;
276
+ stack.push(element);
277
+ break;
278
+ }
279
+ if (!spaced) fail("Expected whitespace or tag terminator");
280
+ const name = readName();
281
+ const key = `@_${name}`;
282
+ if (Object.hasOwn(element.object, key)) fail("Duplicate attribute");
283
+ skipSpace();
284
+ if (xml[pos++] !== "=") fail("Expected attribute equals sign");
285
+ skipSpace();
286
+ const quote = xml[pos++];
287
+ if (quote !== '"' && quote !== "'") fail("Expected quoted attribute");
288
+ const end = xml.indexOf(quote, pos);
289
+ if (end < 0) fail("Unterminated attribute");
290
+ const raw = xml.slice(pos, end);
291
+ if (raw.includes("<")) fail("Unescaped '<' in attribute");
292
+ element.object[key] = decode(raw, pos, true);
293
+ element.hasAttributes = true;
294
+ pos = end + 1;
295
+ }
296
+ }
297
+ }
298
+ if (stack.length) fail("Unclosed element");
299
+ if (!hasRoot) fail("Missing root element");
300
+ return document;
301
+ }
302
+
303
+ /** Parse XML lazily, reporting malformed documents in the typed error channel. */
304
+ export const parseXml = (
305
+ xml: string,
306
+ options?: XmlParseOptions,
307
+ ): Effect.Effect<XmlObject, XmlParseError> =>
308
+ Effect.suspend(() => {
309
+ try {
310
+ return Effect.succeed(parseXmlSync(xml, options));
311
+ } catch (error) {
312
+ if (error instanceof XmlParseError) return Effect.fail(error);
313
+ throw error;
314
+ }
315
+ });
316
+
317
+ const xmlEscapes: Record<string, string> = {
318
+ "&": "&amp;",
319
+ "<": "&lt;",
320
+ ">": "&gt;",
321
+ '"': "&quot;",
322
+ "'": "&apos;",
323
+ };
324
+
325
+ /**
326
+ * Escape special XML characters in a string.
327
+ */
328
+ export const escapeXml = (s: string): string =>
329
+ s.replace(/[&<>"']/g, (c) => xmlEscapes[c]);
330
+
331
+ // =============================================================================
332
+ // XML Tag Helpers
333
+ // =============================================================================
334
+
335
+ /**
336
+ * Wrap content in an XML tag with optional xmlns attribute.
337
+ */
338
+ export const wrapTag = (tag: string, content: string, xmlns?: string): string =>
339
+ `<${tag}${xmlns ? ` xmlns="${escapeXml(xmlns)}"` : ""}>${content}</${tag}>`;
@@ -1,249 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import * as G from "./graphql.ts";
3
- import type { GraphQLModel } from "./codegen/graphql-client.ts";
4
- declare const ProjectNotFound_base: Schema.Class<ProjectNotFound, Schema.TaggedStruct<"ProjectNotFound", {
5
- message: Schema.String;
6
- code: Schema.optional<Schema.String>;
7
- path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
8
- locations: Schema.optional<Schema.$Array<Schema.Struct<{
9
- readonly line: Schema.Number;
10
- readonly column: Schema.Number;
11
- }>>>;
12
- extensions: Schema.optional<Schema.Unknown>;
13
- traceId: Schema.optional<Schema.String>;
14
- status: Schema.optional<Schema.Number>;
15
- retryAfter: Schema.optional<Schema.Number>;
16
- }>, import("effect/Cause").YieldableError>;
17
- export declare class ProjectNotFound extends ProjectNotFound_base {
18
- }
19
- declare const ServicesUnavailable_base: Schema.Class<ServicesUnavailable, Schema.TaggedStruct<"ServicesUnavailable", {
20
- message: Schema.String;
21
- code: Schema.optional<Schema.String>;
22
- path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
23
- locations: Schema.optional<Schema.$Array<Schema.Struct<{
24
- readonly line: Schema.Number;
25
- readonly column: Schema.Number;
26
- }>>>;
27
- extensions: Schema.optional<Schema.Unknown>;
28
- traceId: Schema.optional<Schema.String>;
29
- status: Schema.optional<Schema.Number>;
30
- retryAfter: Schema.optional<Schema.Number>;
31
- }>, import("effect/Cause").YieldableError>;
32
- export declare class ServicesUnavailable extends ServicesUnavailable_base {
33
- }
34
- declare const Unauthorized_base: Schema.Class<Unauthorized, Schema.TaggedStruct<"Unauthorized", {
35
- message: Schema.String;
36
- code: Schema.optional<Schema.String>;
37
- path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
38
- locations: Schema.optional<Schema.$Array<Schema.Struct<{
39
- readonly line: Schema.Number;
40
- readonly column: Schema.Number;
41
- }>>>;
42
- extensions: Schema.optional<Schema.Unknown>;
43
- traceId: Schema.optional<Schema.String>;
44
- status: Schema.optional<Schema.Number>;
45
- retryAfter: Schema.optional<Schema.Number>;
46
- }>, import("effect/Cause").YieldableError>;
47
- export declare class Unauthorized extends Unauthorized_base {
48
- }
49
- declare const ProjectDescriptionUnavailable_base: Schema.Class<ProjectDescriptionUnavailable, Schema.TaggedStruct<"ProjectDescriptionUnavailable", {
50
- message: Schema.String;
51
- code: Schema.optional<Schema.String>;
52
- path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
53
- locations: Schema.optional<Schema.$Array<Schema.Struct<{
54
- readonly line: Schema.Number;
55
- readonly column: Schema.Number;
56
- }>>>;
57
- extensions: Schema.optional<Schema.Unknown>;
58
- traceId: Schema.optional<Schema.String>;
59
- status: Schema.optional<Schema.Number>;
60
- retryAfter: Schema.optional<Schema.Number>;
61
- }>, import("effect/Cause").YieldableError>;
62
- export declare class ProjectDescriptionUnavailable extends ProjectDescriptionUnavailable_base {
63
- }
64
- declare const ServiceDescriptionUnavailable_base: Schema.Class<ServiceDescriptionUnavailable, Schema.TaggedStruct<"ServiceDescriptionUnavailable", {
65
- message: Schema.String;
66
- code: Schema.optional<Schema.String>;
67
- path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
68
- locations: Schema.optional<Schema.$Array<Schema.Struct<{
69
- readonly line: Schema.Number;
70
- readonly column: Schema.Number;
71
- }>>>;
72
- extensions: Schema.optional<Schema.Unknown>;
73
- traceId: Schema.optional<Schema.String>;
74
- status: Schema.optional<Schema.Number>;
75
- retryAfter: Schema.optional<Schema.Number>;
76
- }>, import("effect/Cause").YieldableError>;
77
- export declare class ServiceDescriptionUnavailable extends ServiceDescriptionUnavailable_base {
78
- }
79
- declare const PageInfoUnavailable_base: Schema.Class<PageInfoUnavailable, Schema.TaggedStruct<"PageInfoUnavailable", {
80
- message: Schema.String;
81
- code: Schema.optional<Schema.String>;
82
- path: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Number]>>>;
83
- locations: Schema.optional<Schema.$Array<Schema.Struct<{
84
- readonly line: Schema.Number;
85
- readonly column: Schema.Number;
86
- }>>>;
87
- extensions: Schema.optional<Schema.Unknown>;
88
- traceId: Schema.optional<Schema.String>;
89
- status: Schema.optional<Schema.Number>;
90
- retryAfter: Schema.optional<Schema.Number>;
91
- }>, import("effect/Cause").YieldableError>;
92
- export declare class PageInfoUnavailable extends PageInfoUnavailable_base {
93
- }
94
- export declare const errorClasses: {
95
- ProjectNotFound: typeof ProjectNotFound;
96
- ServicesUnavailable: typeof ServicesUnavailable;
97
- Unauthorized: typeof Unauthorized;
98
- ProjectDescriptionUnavailable: typeof ProjectDescriptionUnavailable;
99
- ServiceDescriptionUnavailable: typeof ServiceDescriptionUnavailable;
100
- PageInfoUnavailable: typeof PageInfoUnavailable;
101
- };
102
- export type FixtureSchema = {
103
- query: "Query";
104
- mutation: "Mutation";
105
- subscription: never;
106
- globalErrors: "Unauthorized";
107
- errors: {
108
- ProjectNotFound: ProjectNotFound;
109
- ServicesUnavailable: ServicesUnavailable;
110
- Unauthorized: Unauthorized;
111
- ProjectDescriptionUnavailable: ProjectDescriptionUnavailable;
112
- ServiceDescriptionUnavailable: ServiceDescriptionUnavailable;
113
- PageInfoUnavailable: PageInfoUnavailable;
114
- };
115
- scalars: {
116
- ID: string;
117
- String: string;
118
- Int: number;
119
- Boolean: boolean;
120
- JSON: unknown;
121
- Status: "ACTIVE" | "ARCHIVED";
122
- };
123
- possibleTypes: {
124
- Node: "Project" | "Service";
125
- SearchResult: "Project" | "Service";
126
- };
127
- types: {
128
- Query: {
129
- project: G.Field<{
130
- id: string;
131
- }, "Project", "ProjectNotFound">;
132
- projects: G.Field<{
133
- filter?: {
134
- name?: string | null;
135
- statuses?: Array<"ACTIVE" | "ARCHIVED"> | null;
136
- metadata?: unknown;
137
- } | null;
138
- }, "[Project]!">;
139
- node: G.Field<{
140
- id: string;
141
- }, "Node">;
142
- search: G.Field<{
143
- text: string;
144
- }, "[SearchResult!]!">;
145
- services: G.Field<{
146
- first?: number | null;
147
- after?: string | null;
148
- }, "ServiceConnection!", "ServicesUnavailable">;
149
- ping: G.Field<{}, "Boolean!">;
150
- };
151
- Mutation: {
152
- editProject: G.Field<{
153
- id: string;
154
- name: string;
155
- }, "Project!", "ProjectNotFound">;
156
- deleteProject: G.Field<{
157
- id: string;
158
- }, "Boolean!", "ProjectNotFound">;
159
- };
160
- Project: {
161
- id: G.Field<{}, "ID!">;
162
- name: G.Field<{}, "String!">;
163
- description: G.Field<{}, "String", "ProjectDescriptionUnavailable">;
164
- parent: G.Field<{}, "Project">;
165
- services: G.Field<{
166
- first?: number | null;
167
- after?: string | null;
168
- filter?: {
169
- name?: string | null;
170
- } | null;
171
- }, "ServiceConnection", "ServicesUnavailable">;
172
- };
173
- Service: {
174
- id: G.Field<{}, "ID!">;
175
- parent: G.Field<{}, "Project">;
176
- name: G.Field<{}, "String!">;
177
- description: G.Field<{}, "String", "ServiceDescriptionUnavailable">;
178
- project: G.Field<{}, "Project!">;
179
- status: G.Field<{}, "Status!">;
180
- };
181
- ServiceConnection: {
182
- edges: G.Field<{}, "[ServiceEdge!]!">;
183
- pageInfo: G.Field<{}, "PageInfo!">;
184
- };
185
- ServiceEdge: {
186
- cursor: G.Field<{}, "String!">;
187
- node: G.Field<{}, "Service!">;
188
- };
189
- PageInfo: {
190
- endCursor: G.Field<{}, "String">;
191
- hasNextPage: G.Field<{}, "Boolean!", "PageInfoUnavailable">;
192
- };
193
- Node: {
194
- id: G.Field<{}, "ID!">;
195
- parent: G.Field<{}, "Project">;
196
- };
197
- SearchResult: {};
198
- };
199
- };
200
- export declare const fixtureModel: GraphQLModel;
201
- /** A deliberately small recursive schema for GraphQL compiler/runtime tests. */
202
- export declare const fixtureSDL = "\n scalar JSON\n\n enum Status {\n ACTIVE\n ARCHIVED\n }\n\n input ProjectFilter {\n name: String\n statuses: [Status!] = [ACTIVE]\n metadata: JSON\n }\n\n interface Node {\n id: ID!\n parent: Project\n }\n\n type Project implements Node {\n id: ID!\n name: String!\n description: String\n parent: Project\n services(\n first: Int = 20\n after: String\n filter: ProjectFilter\n ): ServiceConnection\n }\n\n type Service implements Node {\n id: ID!\n parent: Project\n name: String!\n description: String\n project: Project!\n status: Status!\n }\n\n type ServiceConnection {\n edges: [ServiceEdge!]!\n pageInfo: PageInfo!\n }\n\n type ServiceEdge {\n cursor: String!\n node: Service!\n }\n\n type PageInfo {\n endCursor: String\n hasNextPage: Boolean!\n }\n\n union SearchResult = Project | Service\n\n type Query {\n project(id: ID!): Project\n projects(filter: ProjectFilter): [Project]!\n node(id: ID!): Node\n search(text: String!): [SearchResult!]!\n services(first: Int = 20, after: String): ServiceConnection!\n ping: Boolean!\n }\n\n type Mutation {\n editProject(id: ID!, name: String!): Project!\n deleteProject(id: ID!): Boolean!\n }\n";
203
- /** Includes characters that must travel in variables, never in GraphQL text. */
204
- export declare const adversarialArgument = "quoted \"value\" \\ path\nline\t\0 \uD83D\uDE00";
205
- export declare const partialProjectEnvelope: {
206
- readonly data: {
207
- readonly project: {
208
- readonly id: "p1";
209
- readonly services: null;
210
- };
211
- readonly ping: true;
212
- };
213
- readonly errors: readonly [{
214
- readonly message: "Services temporarily unavailable";
215
- readonly path: readonly ["project", "services"];
216
- readonly locations: readonly [{
217
- readonly line: 1;
218
- readonly column: 25;
219
- }];
220
- readonly extensions: {
221
- readonly code: "UNAVAILABLE";
222
- readonly incident: "incident-1";
223
- };
224
- }];
225
- };
226
- export declare const multipleErrorEnvelope: {
227
- readonly data: {
228
- readonly production: null;
229
- readonly staging: {
230
- readonly id: "p2";
231
- readonly services: null;
232
- };
233
- };
234
- readonly errors: readonly [{
235
- readonly message: "Project not found";
236
- readonly path: readonly ["production"];
237
- readonly extensions: {
238
- readonly code: "NOT_FOUND";
239
- };
240
- }, {
241
- readonly message: "Services temporarily unavailable";
242
- readonly path: readonly ["staging", "services"];
243
- readonly extensions: {
244
- readonly code: "UNAVAILABLE";
245
- };
246
- }];
247
- };
248
- export {};
249
- //# sourceMappingURL=graphql.fixture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql.fixture.d.ts","sourceRoot":"","sources":["../src/graphql.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,6BAA6B,CAAC;;;;;;;;;;;;;;AAE9E,qBAAa,eAAgB,SAAQ,oBAGpC;CAAG;;;;;;;;;;;;;;AACJ,qBAAa,mBAAoB,SAAQ,wBAGxC;CAAG;;;;;;;;;;;;;;AACJ,qBAAa,YAAa,SAAQ,iBAGjC;CAAG;;;;;;;;;;;;;;AACJ,qBAAa,6BAA8B,SAAQ,kCAGlD;CAAG;;;;;;;;;;;;;;AACJ,qBAAa,6BAA8B,SAAQ,kCAGlD;CAAG;;;;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