@nxgt/graphql-codegen-msw 0.2.1 → 0.3.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/README.md +52 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -6
- package/dist/index.js.map +5 -5
- package/dist/naming.d.ts +1 -1
- package/dist/naming.d.ts.map +1 -1
- package/dist/operations.d.ts +3 -5
- package/dist/operations.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +64 -11
- package/dist/runtime/index.js.map +7 -6
- package/dist/runtime/mock-operation.d.ts +11 -1
- package/dist/runtime/mock-operation.d.ts.map +1 -1
- package/dist/runtime/mock-subscription.d.ts +28 -0
- package/dist/runtime/mock-subscription.d.ts.map +1 -0
- package/dist/runtime/refusals.d.ts +1 -1
- package/dist/runtime/refusals.d.ts.map +1 -1
- package/docs/README.md +1 -1
- package/docs/guide/handlers.md +51 -4
- package/docs/roadmap.md +5 -4
- package/docs/troubleshooting.md +10 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @nxgt/graphql-codegen-msw
|
|
2
2
|
|
|
3
3
|
A [graphql-codegen](https://the-guild.dev/graphql/codegen) plugin that writes
|
|
4
|
-
one typed [msw](https://mswjs.io) 3 handler per named query
|
|
5
|
-
your documents
|
|
4
|
+
one typed [msw](https://mswjs.io) 3 handler per named query, mutation and
|
|
5
|
+
subscription of your documents (subscriptions are streamed over SSE through an
|
|
6
|
+
executor): `mockUserQuery(resolver, options?)`, built on msw's
|
|
6
7
|
`graphql.link(endpoint)`. Each handler checks the variables it receives with
|
|
7
8
|
the Zod schema
|
|
8
9
|
[`@nxgt/graphql-codegen-zod`](https://www.npmjs.com/package/@nxgt/graphql-codegen-zod)
|
|
@@ -246,6 +247,49 @@ test('shows the user', async () => {
|
|
|
246
247
|
Under Bun, msw 3's `setupServer` intercepts no `fetch`: see
|
|
247
248
|
[Under Bun](docs/guide/handlers.md#under-bun).
|
|
248
249
|
|
|
250
|
+
### Subscriptions over SSE
|
|
251
|
+
|
|
252
|
+
A named `subscription` gets `mock<Name>Subscription(execute, options?)`, an
|
|
253
|
+
msw `HttpHandler` that answers only a POST to the endpoint with
|
|
254
|
+
`Accept: text/event-stream` whose operation is that subscription. It checks
|
|
255
|
+
the variables as a query's are, then hands the request to `execute`, which
|
|
256
|
+
streams it. Pass `createExecutor({ schema })` from
|
|
257
|
+
[`@nxgt/msw-graphql`](https://www.npmjs.com/package/@nxgt/msw-graphql) (0.4.0
|
|
258
|
+
or later) and the stream comes from the schema's `Subscription` resolvers
|
|
259
|
+
(graphql-sse distinct connections: `next` events, then `complete`), with no
|
|
260
|
+
wrapper around `fetch`. Any other request, this subscription sent without the
|
|
261
|
+
event-stream `Accept` included, goes on to the next handler.
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
import { createExecutor } from '@nxgt/msw-graphql';
|
|
265
|
+
import { buildMockSchema } from '@nxgt/msw-graphql/schema';
|
|
266
|
+
import { mockItemChangedSubscription } from './generated/msw';
|
|
267
|
+
|
|
268
|
+
const typeDefs = `
|
|
269
|
+
type Item { id: ID!, name: String! }
|
|
270
|
+
type Query { item(id: ID!): Item }
|
|
271
|
+
type Subscription { itemChanged(id: ID!): Item }
|
|
272
|
+
`;
|
|
273
|
+
|
|
274
|
+
const schema = buildMockSchema({
|
|
275
|
+
typeDefs,
|
|
276
|
+
resolvers: {
|
|
277
|
+
Subscription: {
|
|
278
|
+
itemChanged: {
|
|
279
|
+
subscribe: async function* (_, { id }) {
|
|
280
|
+
yield { itemChanged: { id, name: 'first' } };
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
server.use(mockItemChangedSubscription(createExecutor({ schema })));
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
`execute` is any `(input: { query, variables, operationName, request }) =>
|
|
291
|
+
Promise<Response>`; this package does not depend on `@nxgt/msw-graphql`.
|
|
292
|
+
|
|
249
293
|
## Options
|
|
250
294
|
|
|
251
295
|
| Option | Type | Default | Effect |
|
|
@@ -263,8 +307,9 @@ Each is detailed in [Handlers](docs/guide/handlers.md).
|
|
|
263
307
|
## Traps
|
|
264
308
|
|
|
265
309
|
- A handler is written for a **named** query or mutation. An anonymous
|
|
266
|
-
operation has no name for msw to match
|
|
267
|
-
|
|
310
|
+
operation has no name for msw to match. A subscription's handler streams
|
|
311
|
+
over SSE only, through the executor you give it; msw's own WebSocket
|
|
312
|
+
subscription handler is not generated.
|
|
268
313
|
- Take the types from the client preset or `typescript-operations` (the wire
|
|
269
314
|
types), not from codegen-zod's file, whose result types are decoded (a
|
|
270
315
|
`DateTime` is a `Date` there).
|
|
@@ -286,8 +331,9 @@ Every error and its fix is in [Troubleshooting](docs/troubleshooting.md).
|
|
|
286
331
|
The package exports `plugin` and the `CodegenMswConfig` and `DocumentFile`
|
|
287
332
|
types from `.`; graphql-codegen finds `plugin` by the package name. The
|
|
288
333
|
generated file's runtime is `./runtime`: `mockOperation`,
|
|
289
|
-
`invalidInputRefusal`, `badUserInputRefusal`, `errorResponse`,
|
|
290
|
-
`isGraphQLError` and their types
|
|
334
|
+
`mockSubscription`, `invalidInputRefusal`, `badUserInputRefusal`, `errorResponse`,
|
|
335
|
+
`isGraphQLError` and their types (`MockedSubscription`,
|
|
336
|
+
`SubscriptionExecutor` among them), and, re-exported from
|
|
291
337
|
`@nxgt/graphql-validation`, `invalidInputError`, `fieldsError`,
|
|
292
338
|
`fieldIssueOf`, `inputPath`, `Translate`, `FieldIssue` and `FieldError`.
|
|
293
339
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAO/D,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK/D;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACrB,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,MAAM,GAAE,gBAAqB,GAC3B,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAO/D,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK/D;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACrB,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,MAAM,GAAE,gBAAqB,GAC3B,MAAM,CA6ER"}
|
package/dist/index.js
CHANGED
|
@@ -218,7 +218,7 @@ function mockedOperations(documents) {
|
|
|
218
218
|
return documents.flatMap((file) => file.document?.definitions ?? []).filter((node) => node.kind === Kind2.OPERATION_DEFINITION).flatMap((node) => {
|
|
219
219
|
const name = node.name?.value;
|
|
220
220
|
const kind = node.operation;
|
|
221
|
-
if (!name
|
|
221
|
+
if (!name)
|
|
222
222
|
return [];
|
|
223
223
|
return [{ name, kind, node }];
|
|
224
224
|
});
|
|
@@ -285,21 +285,37 @@ function plugin(schema, documents, config = {}) {
|
|
|
285
285
|
...handlers
|
|
286
286
|
]);
|
|
287
287
|
const any = operations.length > 0;
|
|
288
|
-
const
|
|
288
|
+
const plain = operations.some(({ kind }) => kind !== "subscription");
|
|
289
|
+
const handler = plain ? imports.type("msw/graphql", "GraphQLHandler") : "";
|
|
290
|
+
const subscribing = operations.some(({ kind }) => kind === "subscription");
|
|
291
|
+
const subscription = {
|
|
292
|
+
handler: subscribing ? imports.type("msw", "HttpHandler") : "",
|
|
293
|
+
executor: subscribing ? imports.type(RUNTIME, "SubscriptionExecutor") : "",
|
|
294
|
+
mock: subscribing ? imports.value(RUNTIME, "mockSubscription") : ""
|
|
295
|
+
};
|
|
289
296
|
const runtime = {
|
|
290
|
-
resolver:
|
|
297
|
+
resolver: plain ? imports.type(RUNTIME, "GraphQLMockResolver") : "",
|
|
291
298
|
options: any ? imports.type(RUNTIME, "MockOptions") : "",
|
|
292
299
|
invalidInput: imports.type(RUNTIME, "InvalidInput"),
|
|
293
300
|
inputTypes: any ? imports.type(RUNTIME, "InputTypes") : "",
|
|
294
|
-
mock:
|
|
301
|
+
mock: plain ? imports.value(RUNTIME, "mockOperation") : ""
|
|
295
302
|
};
|
|
296
303
|
const refusal = refusalCode(options, imports);
|
|
297
304
|
const blocks = operations.map((operation) => {
|
|
298
305
|
const { name, kind } = operation;
|
|
306
|
+
const factory = naming.handler(name, kind);
|
|
307
|
+
if (kind === "subscription") {
|
|
308
|
+
const schema = imports.value(options.schemasImport, naming.schema(naming.variables(name, kind)));
|
|
309
|
+
return subscriptionBlock(operation, factory, {
|
|
310
|
+
...subscription,
|
|
311
|
+
options: runtime.options,
|
|
312
|
+
schema
|
|
313
|
+
});
|
|
314
|
+
}
|
|
299
315
|
const result = imports.type(options.typesImport, naming.result(name, kind));
|
|
300
316
|
const variables = imports.type(options.typesImport, naming.variables(name, kind));
|
|
301
317
|
const schema = imports.value(options.schemasImport, naming.schema(naming.variables(name, kind)));
|
|
302
|
-
return handlerBlock(operation,
|
|
318
|
+
return handlerBlock(operation, factory, {
|
|
303
319
|
...runtime,
|
|
304
320
|
handler,
|
|
305
321
|
result,
|
|
@@ -344,6 +360,19 @@ function inputTypesBlock(schema, operations, type) {
|
|
|
344
360
|
].join(`
|
|
345
361
|
`);
|
|
346
362
|
}
|
|
363
|
+
function subscriptionBlock({ name, node }, factory, names) {
|
|
364
|
+
const operation = `{ type: "subscription", name: ${JSON.stringify(name)}, variables: ${names.schema}, variableTypes: ${variableTypesCode(node)}, inputTypes, endpoint, invalidInput }`;
|
|
365
|
+
return [
|
|
366
|
+
`/** Mocks the ${name} subscription: a POST with \`Accept: text/event-stream\` is streamed by \`execute\` once the variables pass \`${names.schema}\`. */`,
|
|
367
|
+
`export function ${factory}(`,
|
|
368
|
+
` execute: ${names.executor},`,
|
|
369
|
+
` options?: ${names.options},`,
|
|
370
|
+
`): ${names.handler} {`,
|
|
371
|
+
` return ${names.mock}(${operation}, execute, options);`,
|
|
372
|
+
"}"
|
|
373
|
+
].join(`
|
|
374
|
+
`);
|
|
375
|
+
}
|
|
347
376
|
function handlerBlock({ name, kind, node }, factory, names) {
|
|
348
377
|
const operation = `{ type: ${JSON.stringify(kind)}, name: ${JSON.stringify(name)}, variables: ${names.schema}, variableTypes: ${variableTypesCode(node)}, inputTypes, endpoint, invalidInput }`;
|
|
349
378
|
return [
|
|
@@ -361,5 +390,5 @@ export {
|
|
|
361
390
|
plugin
|
|
362
391
|
};
|
|
363
392
|
|
|
364
|
-
//# debugId=
|
|
393
|
+
//# debugId=A301100766A457D164756E2164756E21
|
|
365
394
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/** One name imported from a module: its local name, and whether it is a type only. */\ninterface Imported {\n\treadonly local: string;\n\treadonly type: boolean;\n}\n\n/**\n * The named imports of the generated file, one line per module in the order\n * they were first asked for, an alias when a name is taken. A module whose\n * every name is a type is written `import type`.\n */\nexport class Imports {\n\treadonly #byModule = new Map<string, Map<string, Imported>>();\n\treadonly #taken: Set<string>;\n\n\t/** `reserved`: the names the file declares, which no import may take. */\n\tconstructor(reserved: Iterable<string> = []) {\n\t\tthis.#taken = new Set(reserved);\n\t}\n\n\t/** The local name of the value `exported` from `module`. */\n\tvalue(module: string, exported: string): string {\n\t\treturn this.#add(module, exported, false);\n\t}\n\n\t/** The local name of the type `exported` from `module`. */\n\ttype(module: string, exported: string): string {\n\t\treturn this.#add(module, exported, true);\n\t}\n\n\t#add(module: string, exported: string, type: boolean): string {\n\t\tconst names = this.#byModule.get(module) ?? new Map<string, Imported>();\n\t\tthis.#byModule.set(module, names);\n\t\tconst known = names.get(exported);\n\t\tif (known) {\n\t\t\tif (!type && known.type) names.set(exported, { ...known, type: false });\n\t\t\treturn known.local;\n\t\t}\n\t\tlet local = exported;\n\t\tfor (let n = 2; this.#taken.has(local); n++) local = `${exported}${n}`;\n\t\tthis.#taken.add(local);\n\t\tnames.set(exported, { local, type });\n\t\treturn local;\n\t}\n\n\t/** The import lines, double-quoted as every string the file holds. */\n\tlines(): string[] {\n\t\treturn [...this.#byModule].map(([module, names]) => {\n\t\t\tconst all = [...names];\n\t\t\tconst typeOnly = all.every(([, { type }]) => type);\n\t\t\tconst specifiers = all.map(([exported, { local, type }]) => {\n\t\t\t\tconst name = exported === local ? local : `${exported} as ${local}`;\n\t\t\t\treturn type && !typeOnly ? `type ${name}` : name;\n\t\t\t});\n\t\t\treturn `import ${typeOnly ? 'type ' : ''}{ ${specifiers.join(', ')} } from ${JSON.stringify(module)};`;\n\t\t});\n\t}\n}\n",
|
|
6
6
|
"import {\n\ttype GraphQLInputField,\n\ttype GraphQLNamedType,\n\ttype GraphQLSchema,\n\tgetNamedType,\n\tisEnumType,\n\tisInputObjectType,\n\tisNonNullType,\n\tisRequiredInputField,\n\tisSpecifiedScalarType,\n\tKind,\n\ttype OperationDefinitionNode,\n\tprint,\n\ttype TypeNode,\n} from 'graphql';\n\n// What the generated file tells the runtime of the variables, from the\n// schema at generation time, so the mock words a value graphql refuses as\n// graphql-yoga does: each variable's type, and every input type the\n// variables reach (the runtime's `InputTypes`, an internal shape).\n\n/** `{ first: \"Int = 10\", role: \"Role\" }`: each variable's type and default, as written. */\nexport function variableTypesCode(node: OperationDefinitionNode): string {\n\tconst entries = (node.variableDefinitions ?? []).map((definition) => {\n\t\tconst type = print(definition.type);\n\t\tconst source = definition.defaultValue\n\t\t\t? `${type} = ${print(definition.defaultValue)}`\n\t\t\t: type;\n\t\treturn `${definition.variable.name.value}: ${JSON.stringify(source)}`;\n\t});\n\treturn entries.length > 0 ? `{ ${entries.join(', ')} }` : '{}';\n}\n\n/**\n * The `inputTypes` object's source: every type the operations' variables\n * reach, input objects followed field by field, sorted by name so the file\n * does not move when the documents are reordered; a scalar on one line, an\n * input object's fields and an enum's values one per line.\n */\nexport function inputTypesCode(\n\tschema: GraphQLSchema,\n\toperations: readonly OperationDefinitionNode[],\n): string {\n\tconst reached = new Map<string, GraphQLNamedType>();\n\tconst visit = (type: GraphQLNamedType | undefined): void => {\n\t\tif (!type || reached.has(type.name)) return;\n\t\treached.set(type.name, type);\n\t\tif (isInputObjectType(type))\n\t\t\tfor (const field of Object.values(type.getFields()))\n\t\t\t\tvisit(getNamedType(field.type));\n\t};\n\tfor (const operation of operations)\n\t\tfor (const definition of operation.variableDefinitions ?? [])\n\t\t\tvisit(schema.getType(namedTypeOf(definition.type)) ?? undefined);\n\tconst entries = [...reached.values()]\n\t\t.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0))\n\t\t.map((type) => `\\t${type.name}: ${entryCode(type)},`);\n\treturn entries.length > 0 ? `{\\n${entries.join('\\n')}\\n}` : '{}';\n}\n\nfunction namedTypeOf(type: TypeNode): string {\n\treturn type.kind === Kind.NAMED_TYPE\n\t\t? type.name.value\n\t\t: namedTypeOf(type.type);\n}\n\n/**\n * One type's entry: a scalar on its line, an input object one field per\n * line and an enum one value per line, so a schema change moves the lines\n * it changes only.\n */\nfunction entryCode(type: GraphQLNamedType): string {\n\tif (isInputObjectType(type)) {\n\t\tconst fields = Object.values(type.getFields()).map(\n\t\t\t(field) => `${field.name}: ${JSON.stringify(fieldSource(field))}`,\n\t\t);\n\t\treturn block([\n\t\t\t'kind: \"input\"',\n\t\t\t`fields: ${block(fields, 2)}`,\n\t\t\t...(type.isOneOf ? ['oneOf: true'] : []),\n\t\t]);\n\t}\n\tif (isEnumType(type)) {\n\t\tconst values = type.getValues().map((value) => JSON.stringify(value.name));\n\t\treturn block(['kind: \"enum\"', `values: ${list(values, 2)}`]);\n\t}\n\treturn isSpecifiedScalarType(type)\n\t\t? '{ kind: \"builtin\" }'\n\t\t: '{ kind: \"scalar\" }';\n}\n\n/** `{ … }`, one property per line at `depth` tabs, its brace one tab less. */\nfunction block(properties: readonly string[], depth = 1): string {\n\treturn wrapped('{', '}', properties, depth);\n}\n\n/** `[ … ]`, one item per line, as `block`. */\nfunction list(items: readonly string[], depth: number): string {\n\treturn wrapped('[', ']', items, depth);\n}\n\nfunction wrapped(\n\topen: string,\n\tclose: string,\n\titems: readonly string[],\n\tdepth: number,\n): string {\n\tif (items.length === 0) return `${open}${close}`;\n\tconst indent = '\\t'.repeat(depth + 1);\n\tconst lines = items.map((item) => `${indent}${item},`);\n\treturn `${open}\\n${lines.join('\\n')}\\n${'\\t'.repeat(depth)}${close}`;\n}\n\n/**\n * `\"Int! = 1\"`: the field's type, and its default when it has one. Only a\n * non-null field's default changes what graphql refuses (it is then not\n * required); a schema built in code has no default to print, written `…`.\n */\nfunction fieldSource(field: GraphQLInputField): string {\n\tconst type = String(field.type);\n\tconst literal = field.astNode?.defaultValue;\n\tif (literal) return `${type} = ${print(literal)}`;\n\treturn isNonNullType(field.type) && !isRequiredInputField(field)\n\t\t? `${type} = …`\n\t\t: type;\n}\n",
|
|
7
|
-
"import * as changeCase from 'change-case';\nimport type { CodegenMswConfig } from './config';\n\n/** The operation kinds a handler is written for. */\nexport type MockedKind = 'query' | 'mutation';\n\n/**\n * The names the generated file uses: each type as `typescript-operations`\n * names it, each schema as `@nxgt/graphql-codegen-zod` names it (the type's\n * name behind `schemaPrefix`), and each handler `mock` and the operation's\n * converted name. Kept as codegen-zod's `naming.ts` (AGENTS.md lists the\n * copy): the spec generates both files and imports one from the other.\n */\nexport class Naming {\n\treadonly #config: CodegenMswConfig;\n\treadonly #convert: (name: string) => string;\n\n\tconstructor(config: CodegenMswConfig) {\n\t\tthis.#config = config;\n\t\tthis.#convert = converter(config.namingConvention);\n\t}\n\n\t/** An operation's variables type name: `SignUpMutationVariables`. */\n\tvariables(operation: string, kind: MockedKind): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${operation}${this.#suffix(operation, kind)}Variables`),\n\t\t);\n\t}\n\n\t/** An operation's result type name: `SignUpMutation`. */\n\tresult(operation: string, kind: MockedKind): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${operation}${this.#suffix(operation, kind)}`),\n\t\t);\n\t}\n\n\t/** The schema of the type named `type`: `zSignUpMutationVariables`. */\n\tschema(type: string): string {\n\t\treturn `${this.#config.schemaPrefix ?? 'z'}${type}`;\n\t}\n\n\t/** An operation's handler factory: `mockSignUpMutation`, no type prefix or suffix. */\n\thandler(operation: string, kind: MockedKind): string {\n\t\treturn `mock${this.#convert(`${operation}${this.#suffix(operation, kind)}`)}`;\n\t}\n\n\t/** As visitor-plugin-common's `getOperationSuffix`. */\n\t#suffix(operation: string, kind: MockedKind): string {\n\t\tconst type = changeCase.pascalCase(kind);\n\t\tconst { omitOperationSuffix, dedupeOperationSuffix } = this.#config;\n\t\treturn omitOperationSuffix ||\n\t\t\t(dedupeOperationSuffix &&\n\t\t\t\toperation.toLowerCase().endsWith(type.toLowerCase()))\n\t\t\t? ''\n\t\t\t: type;\n\t}\n\n\t#wrap(name: string): string {\n\t\treturn `${this.#config.typesPrefix ?? ''}${name}${this.#config.typesSuffix ?? ''}`;\n\t}\n}\n\ntype Convention = NonNullable<CodegenMswConfig['namingConvention']>;\ntype Case = (name: string) => string;\n\nconst lowerCaseFirst: Case = (name) =>\n\tname.charAt(0).toLowerCase() + name.slice(1);\nconst upperCaseFirst: Case = (name) =>\n\tname.charAt(0).toUpperCase() + name.slice(1);\n\n/**\n * The cases a `namingConvention` string can name, by module: change-case-all\n * 2's names (what the typescript plugins resolve), and change-case 5's.\n */\nconst cases: Readonly<Record<string, Readonly<Record<string, Case>>>> = {\n\t'change-case-all': {\n\t\tcamelCase: changeCase.camelCase,\n\t\tcapitalCase: changeCase.capitalCase,\n\t\tconstantCase: changeCase.constantCase,\n\t\tdotCase: changeCase.dotCase,\n\t\theaderCase: changeCase.trainCase,\n\t\tnoCase: changeCase.noCase,\n\t\tparamCase: changeCase.kebabCase,\n\t\tpascalCase: changeCase.pascalCase,\n\t\tpathCase: changeCase.pathCase,\n\t\tsentenceCase: changeCase.sentenceCase,\n\t\tsnakeCase: changeCase.snakeCase,\n\t\tlowerCase: (name) => name.toLowerCase(),\n\t\tupperCase: (name) => name.toUpperCase(),\n\t\tlowerCaseFirst,\n\t\tupperCaseFirst,\n\t},\n\t'change-case': {\n\t\tcamelCase: changeCase.camelCase,\n\t\tcapitalCase: changeCase.capitalCase,\n\t\tconstantCase: changeCase.constantCase,\n\t\tdotCase: changeCase.dotCase,\n\t\tkebabCase: changeCase.kebabCase,\n\t\tnoCase: changeCase.noCase,\n\t\tpascalCase: changeCase.pascalCase,\n\t\tpascalSnakeCase: changeCase.pascalSnakeCase,\n\t\tpathCase: changeCase.pathCase,\n\t\tsentenceCase: changeCase.sentenceCase,\n\t\tsnakeCase: changeCase.snakeCase,\n\t\ttrainCase: changeCase.trainCase,\n\t},\n};\n\n/** Applies `fn` to each part between underscores, or to the whole name. */\nconst byPart =\n\t(fn: Case, transformUnderscore: boolean): Case =>\n\t(name) =>\n\t\ttransformUnderscore ? fn(name) : name.split('_').map(fn).join('_');\n\n/**\n * A `namingConvention` as `@graphql-codegen/visitor-plugin-common`'s\n * `convertFactory` reads it for type names: undefined is PascalCase per\n * part; `'keep'`; a `'change-case-all#<case>'` string or a function, per\n * part; an object's `typeNames`, on the whole name, or, without\n * `typeNames`, PascalCase per part unless `transformUnderscore` is true.\n */\nfunction converter(convention: Convention | undefined): Case {\n\tif (convention === undefined) return byPart(changeCase.pascalCase, false);\n\tif (convention === 'keep') return (name) => name;\n\tif (typeof convention === 'function') return byPart(convention, false);\n\tif (typeof convention === 'string')\n\t\treturn byPart(caseNamed(convention), false);\n\tconst { typeNames, transformUnderscore } = convention;\n\tif (typeNames === 'keep') return (name) => name;\n\tif (typeNames === undefined)\n\t\treturn byPart(changeCase.pascalCase, transformUnderscore ?? false);\n\tconst fn = typeof typeNames === 'function' ? typeNames : caseNamed(typeNames);\n\treturn byPart(fn, true);\n}\n\nfunction caseNamed(spec: string): Case {\n\tconst [module = '', name = ''] = spec.split('#');\n\tconst fn = cases[module]?.[name];\n\tif (fn) return fn;\n\tthrow new Error(\n\t\t`@nxgt/graphql-codegen-msw: namingConvention \"${spec}\" is not one this plugin reads. Use 'keep', a function, or 'change-case-all#<case>' with one of ${Object.keys(cases['change-case-all'] ?? {}).join(', ')}.`,\n\t);\n}\n",
|
|
8
|
-
"import { Kind, type OperationDefinitionNode } from 'graphql';\nimport type { DocumentFile } from './config';\nimport type { MockedKind } from './naming';\n\n/** A named query or
|
|
7
|
+
"import * as changeCase from 'change-case';\nimport type { CodegenMswConfig } from './config';\n\n/** The operation kinds a handler is written for. */\nexport type MockedKind = 'query' | 'mutation' | 'subscription';\n\n/**\n * The names the generated file uses: each type as `typescript-operations`\n * names it, each schema as `@nxgt/graphql-codegen-zod` names it (the type's\n * name behind `schemaPrefix`), and each handler `mock` and the operation's\n * converted name. Kept as codegen-zod's `naming.ts` (AGENTS.md lists the\n * copy): the spec generates both files and imports one from the other.\n */\nexport class Naming {\n\treadonly #config: CodegenMswConfig;\n\treadonly #convert: (name: string) => string;\n\n\tconstructor(config: CodegenMswConfig) {\n\t\tthis.#config = config;\n\t\tthis.#convert = converter(config.namingConvention);\n\t}\n\n\t/** An operation's variables type name: `SignUpMutationVariables`. */\n\tvariables(operation: string, kind: MockedKind): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${operation}${this.#suffix(operation, kind)}Variables`),\n\t\t);\n\t}\n\n\t/** An operation's result type name: `SignUpMutation`. */\n\tresult(operation: string, kind: MockedKind): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${operation}${this.#suffix(operation, kind)}`),\n\t\t);\n\t}\n\n\t/** The schema of the type named `type`: `zSignUpMutationVariables`. */\n\tschema(type: string): string {\n\t\treturn `${this.#config.schemaPrefix ?? 'z'}${type}`;\n\t}\n\n\t/** An operation's handler factory: `mockSignUpMutation`, no type prefix or suffix. */\n\thandler(operation: string, kind: MockedKind): string {\n\t\treturn `mock${this.#convert(`${operation}${this.#suffix(operation, kind)}`)}`;\n\t}\n\n\t/** As visitor-plugin-common's `getOperationSuffix`. */\n\t#suffix(operation: string, kind: MockedKind): string {\n\t\tconst type = changeCase.pascalCase(kind);\n\t\tconst { omitOperationSuffix, dedupeOperationSuffix } = this.#config;\n\t\treturn omitOperationSuffix ||\n\t\t\t(dedupeOperationSuffix &&\n\t\t\t\toperation.toLowerCase().endsWith(type.toLowerCase()))\n\t\t\t? ''\n\t\t\t: type;\n\t}\n\n\t#wrap(name: string): string {\n\t\treturn `${this.#config.typesPrefix ?? ''}${name}${this.#config.typesSuffix ?? ''}`;\n\t}\n}\n\ntype Convention = NonNullable<CodegenMswConfig['namingConvention']>;\ntype Case = (name: string) => string;\n\nconst lowerCaseFirst: Case = (name) =>\n\tname.charAt(0).toLowerCase() + name.slice(1);\nconst upperCaseFirst: Case = (name) =>\n\tname.charAt(0).toUpperCase() + name.slice(1);\n\n/**\n * The cases a `namingConvention` string can name, by module: change-case-all\n * 2's names (what the typescript plugins resolve), and change-case 5's.\n */\nconst cases: Readonly<Record<string, Readonly<Record<string, Case>>>> = {\n\t'change-case-all': {\n\t\tcamelCase: changeCase.camelCase,\n\t\tcapitalCase: changeCase.capitalCase,\n\t\tconstantCase: changeCase.constantCase,\n\t\tdotCase: changeCase.dotCase,\n\t\theaderCase: changeCase.trainCase,\n\t\tnoCase: changeCase.noCase,\n\t\tparamCase: changeCase.kebabCase,\n\t\tpascalCase: changeCase.pascalCase,\n\t\tpathCase: changeCase.pathCase,\n\t\tsentenceCase: changeCase.sentenceCase,\n\t\tsnakeCase: changeCase.snakeCase,\n\t\tlowerCase: (name) => name.toLowerCase(),\n\t\tupperCase: (name) => name.toUpperCase(),\n\t\tlowerCaseFirst,\n\t\tupperCaseFirst,\n\t},\n\t'change-case': {\n\t\tcamelCase: changeCase.camelCase,\n\t\tcapitalCase: changeCase.capitalCase,\n\t\tconstantCase: changeCase.constantCase,\n\t\tdotCase: changeCase.dotCase,\n\t\tkebabCase: changeCase.kebabCase,\n\t\tnoCase: changeCase.noCase,\n\t\tpascalCase: changeCase.pascalCase,\n\t\tpascalSnakeCase: changeCase.pascalSnakeCase,\n\t\tpathCase: changeCase.pathCase,\n\t\tsentenceCase: changeCase.sentenceCase,\n\t\tsnakeCase: changeCase.snakeCase,\n\t\ttrainCase: changeCase.trainCase,\n\t},\n};\n\n/** Applies `fn` to each part between underscores, or to the whole name. */\nconst byPart =\n\t(fn: Case, transformUnderscore: boolean): Case =>\n\t(name) =>\n\t\ttransformUnderscore ? fn(name) : name.split('_').map(fn).join('_');\n\n/**\n * A `namingConvention` as `@graphql-codegen/visitor-plugin-common`'s\n * `convertFactory` reads it for type names: undefined is PascalCase per\n * part; `'keep'`; a `'change-case-all#<case>'` string or a function, per\n * part; an object's `typeNames`, on the whole name, or, without\n * `typeNames`, PascalCase per part unless `transformUnderscore` is true.\n */\nfunction converter(convention: Convention | undefined): Case {\n\tif (convention === undefined) return byPart(changeCase.pascalCase, false);\n\tif (convention === 'keep') return (name) => name;\n\tif (typeof convention === 'function') return byPart(convention, false);\n\tif (typeof convention === 'string')\n\t\treturn byPart(caseNamed(convention), false);\n\tconst { typeNames, transformUnderscore } = convention;\n\tif (typeNames === 'keep') return (name) => name;\n\tif (typeNames === undefined)\n\t\treturn byPart(changeCase.pascalCase, transformUnderscore ?? false);\n\tconst fn = typeof typeNames === 'function' ? typeNames : caseNamed(typeNames);\n\treturn byPart(fn, true);\n}\n\nfunction caseNamed(spec: string): Case {\n\tconst [module = '', name = ''] = spec.split('#');\n\tconst fn = cases[module]?.[name];\n\tif (fn) return fn;\n\tthrow new Error(\n\t\t`@nxgt/graphql-codegen-msw: namingConvention \"${spec}\" is not one this plugin reads. Use 'keep', a function, or 'change-case-all#<case>' with one of ${Object.keys(cases['change-case-all'] ?? {}).join(', ')}.`,\n\t);\n}\n",
|
|
8
|
+
"import { Kind, type OperationDefinitionNode } from 'graphql';\nimport type { DocumentFile } from './config';\nimport type { MockedKind } from './naming';\n\n/** A named query, mutation or subscription of the documents. */\nexport interface MockedOperationNode {\n\treadonly name: string;\n\treadonly kind: MockedKind;\n\treadonly node: OperationDefinitionNode;\n}\n\n/**\n * Every named operation, in document order. An anonymous operation has no\n * name to match: it gets no handler.\n */\nexport function mockedOperations(\n\tdocuments: readonly DocumentFile[],\n): MockedOperationNode[] {\n\treturn documents\n\t\t.flatMap((file) => file.document?.definitions ?? [])\n\t\t.filter(\n\t\t\t(node): node is OperationDefinitionNode =>\n\t\t\t\tnode.kind === Kind.OPERATION_DEFINITION,\n\t\t)\n\t\t.flatMap((node) => {\n\t\t\tconst name = node.name?.value;\n\t\t\tconst kind = node.operation;\n\t\t\tif (!name) return [];\n\t\t\treturn [{ name, kind: kind as MockedKind, node }];\n\t\t});\n}\n",
|
|
9
9
|
"import type { CodegenMswConfig } from './config';\n\n/** The plugin's name, before each of its messages. */\nconst NAME = '@nxgt/graphql-codegen-msw';\n\n/** How an invalid input is answered, as the config names it. */\nexport type InvalidInputChoice =\n\t| { readonly kind: 'invalid-input'; readonly translate?: ModuleExport }\n\t| { readonly kind: 'bad-user-input' }\n\t| { readonly kind: 'own'; readonly fn: ModuleExport };\n\n/** A `'<module>#<export>'` option, split. */\nexport interface ModuleExport {\n\treadonly module: string;\n\treadonly exported: string;\n}\n\n/** The options the plugin cannot write a file without, checked. */\nexport interface CheckedOptions {\n\treadonly endpoint: string;\n\treadonly schemasImport: string;\n\treadonly typesImport: string;\n\treadonly invalidInput: InvalidInputChoice;\n}\n\n/**\n * The config, checked before anything is written: each required option is\n * set, and `invalidInput` and `translate` say something this plugin reads.\n * Each message names the option and what to write; each has an entry in\n * docs/troubleshooting.md, headed by it.\n */\nexport function checkedOptions(config: CodegenMswConfig): CheckedOptions {\n\tconst endpoint = required(\n\t\tconfig,\n\t\t'endpoint',\n\t\t`set it to the URL your client sends its operations to, e.g. endpoint: 'https://api.example.com/graphql', or a path msw matches on any origin: '*/graphql'`,\n\t);\n\tconst schemasImport = required(\n\t\tconfig,\n\t\t'schemasImport',\n\t\t`point it at the file @nxgt/graphql-codegen-zod writes, as this file imports it, e.g. schemasImport: './zod'`,\n\t);\n\tconst typesImport = required(\n\t\tconfig,\n\t\t'typesImport',\n\t\t`point it at the module that exports each operation's result and variables types, as this file imports it: './graphql' for the client preset, or the file typescript-operations writes`,\n\t);\n\treturn {\n\t\tendpoint,\n\t\tschemasImport,\n\t\ttypesImport,\n\t\tinvalidInput: invalidInputOf(config),\n\t};\n}\n\nfunction required(\n\tconfig: CodegenMswConfig,\n\toption: 'endpoint' | 'schemasImport' | 'typesImport',\n\twhat: string,\n): string {\n\tconst value: unknown = config[option];\n\tif (typeof value === 'string' && value.trim() !== '') return value;\n\tthrow new Error(`${NAME}: ${option} is not set; ${what}.`);\n}\n\nfunction invalidInputOf(config: CodegenMswConfig): InvalidInputChoice {\n\tconst choice = config.invalidInput ?? 'invalid-input';\n\tconst translate =\n\t\tconfig.translate === undefined\n\t\t\t? undefined\n\t\t\t: moduleExport('translate', config.translate, './i18n#translate');\n\tif (choice === 'invalid-input')\n\t\treturn translate ? { kind: choice, translate } : { kind: choice };\n\tif (translate) {\n\t\tthrow new Error(\n\t\t\t`${NAME}: translate words the default invalidInput's messages only, and invalidInput is \"${choice}\". Remove translate, or translate inside your own function.`,\n\t\t);\n\t}\n\tif (choice === 'bad-user-input') return { kind: choice };\n\treturn {\n\t\tkind: 'own',\n\t\tfn: moduleExport('invalidInput', choice, './invalid-input#invalidInput'),\n\t};\n}\n\n/** `'<module>#<export>'` split in two, or an error naming the option. */\nfunction moduleExport(\n\toption: string,\n\tvalue: string,\n\texample: string,\n): ModuleExport {\n\tconst at = value.lastIndexOf('#');\n\tif (at <= 0 || at === value.length - 1) {\n\t\tconst choices =\n\t\t\toption === 'invalidInput' ? `'invalid-input', 'bad-user-input' or ` : '';\n\t\tthrow new Error(\n\t\t\t`${NAME}: ${option} is \"${value}\"; write ${choices}'<module>#<export>', e.g. '${example}'.`,\n\t\t);\n\t}\n\treturn { module: value.slice(0, at), exported: value.slice(at + 1) };\n}\n",
|
|
10
|
-
"import type { GraphQLSchema } from 'graphql';\nimport type { CodegenMswConfig, DocumentFile } from './config';\nimport { Imports } from './imports';\nimport { inputTypesCode, variableTypesCode } from './input-types';\nimport { Naming } from './naming';\nimport { type MockedOperationNode, mockedOperations } from './operations';\nimport { type CheckedOptions, checkedOptions } from './options';\n\nexport type { CodegenMswConfig, DocumentFile } from './config';\n\n/** Where the generated file takes `mockOperation` and the refusals from. */\nconst RUNTIME = '@nxgt/graphql-codegen-msw/runtime';\n\n/**\n * The graphql-codegen plugin: one msw handler factory per named query and\n * mutation of `documents`, `mock<Operation>(resolver, options?)`, typed with\n * the operation's result and variables types, its variables checked with\n * `@nxgt/graphql-codegen-zod`'s schema before the resolver runs. The schema\n * gives the input types the variables reach, written once as `inputTypes`\n * for the answer to a value graphql refuses.\n */\nexport function plugin(\n\tschema: GraphQLSchema,\n\tdocuments: readonly DocumentFile[],\n\tconfig: CodegenMswConfig = {},\n): string {\n\tconst options = checkedOptions(config);\n\tconst naming = new Naming(config);\n\tconst operations = mockedOperations(documents);\n\tconst handlers = operations.map(({ name, kind }) =>\n\t\tnaming.handler(name, kind),\n\t);\n\tconst twice = handlers.find(\n\t\t(handler, index) => handlers.indexOf(handler) !== index,\n\t);\n\tif (twice) {\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-msw: the file would declare ${twice} twice: two operations give it the same name. Rename one of them.`,\n\t\t);\n\t}\n\tconst imports = new Imports([\n\t\t'endpoint',\n\t\t'invalidInput',\n\t\t'inputTypes',\n\t\t...handlers,\n\t]);\n\t// Only what the file uses is imported: no operation, no handler types.\n\tconst any = operations.length > 0;\n\tconst handler =
|
|
10
|
+
"import type { GraphQLSchema } from 'graphql';\nimport type { CodegenMswConfig, DocumentFile } from './config';\nimport { Imports } from './imports';\nimport { inputTypesCode, variableTypesCode } from './input-types';\nimport { Naming } from './naming';\nimport { type MockedOperationNode, mockedOperations } from './operations';\nimport { type CheckedOptions, checkedOptions } from './options';\n\nexport type { CodegenMswConfig, DocumentFile } from './config';\n\n/** Where the generated file takes `mockOperation` and the refusals from. */\nconst RUNTIME = '@nxgt/graphql-codegen-msw/runtime';\n\n/**\n * The graphql-codegen plugin: one msw handler factory per named query and\n * mutation of `documents`, `mock<Operation>(resolver, options?)`, typed with\n * the operation's result and variables types, its variables checked with\n * `@nxgt/graphql-codegen-zod`'s schema before the resolver runs. The schema\n * gives the input types the variables reach, written once as `inputTypes`\n * for the answer to a value graphql refuses.\n */\nexport function plugin(\n\tschema: GraphQLSchema,\n\tdocuments: readonly DocumentFile[],\n\tconfig: CodegenMswConfig = {},\n): string {\n\tconst options = checkedOptions(config);\n\tconst naming = new Naming(config);\n\tconst operations = mockedOperations(documents);\n\tconst handlers = operations.map(({ name, kind }) =>\n\t\tnaming.handler(name, kind),\n\t);\n\tconst twice = handlers.find(\n\t\t(handler, index) => handlers.indexOf(handler) !== index,\n\t);\n\tif (twice) {\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-msw: the file would declare ${twice} twice: two operations give it the same name. Rename one of them.`,\n\t\t);\n\t}\n\tconst imports = new Imports([\n\t\t'endpoint',\n\t\t'invalidInput',\n\t\t'inputTypes',\n\t\t...handlers,\n\t]);\n\t// Only what the file uses is imported: no operation, no handler types.\n\tconst any = operations.length > 0;\n\tconst plain = operations.some(({ kind }) => kind !== 'subscription');\n\tconst handler = plain ? imports.type('msw/graphql', 'GraphQLHandler') : '';\n\tconst subscribing = operations.some(({ kind }) => kind === 'subscription');\n\tconst subscription = {\n\t\thandler: subscribing ? imports.type('msw', 'HttpHandler') : '',\n\t\texecutor: subscribing ? imports.type(RUNTIME, 'SubscriptionExecutor') : '',\n\t\tmock: subscribing ? imports.value(RUNTIME, 'mockSubscription') : '',\n\t};\n\tconst runtime = {\n\t\tresolver: plain ? imports.type(RUNTIME, 'GraphQLMockResolver') : '',\n\t\toptions: any ? imports.type(RUNTIME, 'MockOptions') : '',\n\t\tinvalidInput: imports.type(RUNTIME, 'InvalidInput'),\n\t\tinputTypes: any ? imports.type(RUNTIME, 'InputTypes') : '',\n\t\tmock: plain ? imports.value(RUNTIME, 'mockOperation') : '',\n\t};\n\tconst refusal = refusalCode(options, imports);\n\tconst blocks = operations.map((operation) => {\n\t\tconst { name, kind } = operation;\n\t\tconst factory = naming.handler(name, kind);\n\t\tif (kind === 'subscription') {\n\t\t\tconst schema = imports.value(\n\t\t\t\toptions.schemasImport,\n\t\t\t\tnaming.schema(naming.variables(name, kind)),\n\t\t\t);\n\t\t\treturn subscriptionBlock(operation, factory, {\n\t\t\t\t...subscription,\n\t\t\t\toptions: runtime.options,\n\t\t\t\tschema,\n\t\t\t});\n\t\t}\n\t\tconst result = imports.type(options.typesImport, naming.result(name, kind));\n\t\tconst variables = imports.type(\n\t\t\toptions.typesImport,\n\t\t\tnaming.variables(name, kind),\n\t\t);\n\t\tconst schema = imports.value(\n\t\t\toptions.schemasImport,\n\t\t\tnaming.schema(naming.variables(name, kind)),\n\t\t);\n\t\treturn handlerBlock(operation, factory, {\n\t\t\t...runtime,\n\t\t\thandler,\n\t\t\tresult,\n\t\t\tvariables,\n\t\t\tschema,\n\t\t});\n\t});\n\treturn `${[\n\t\timports.lines().join('\\n'),\n\t\t`/** Where the client sends its operations; a handler's \\`options.endpoint\\` overrides it. */\\nexport const endpoint = ${JSON.stringify(options.endpoint)};`,\n\t\t`/** How an invalid input is answered, without calling the resolver. */\\nexport const invalidInput: ${runtime.invalidInput} = ${refusal};`,\n\t\t...(any ? [inputTypesBlock(schema, operations, runtime.inputTypes)] : []),\n\t\t...blocks,\n\t].join('\\n\\n')}\\n`;\n}\n\n/** The source of the `invalidInput` constant, its imports added. */\nfunction refusalCode(options: CheckedOptions, imports: Imports): string {\n\tconst choice = options.invalidInput;\n\tif (choice.kind === 'bad-user-input')\n\t\treturn imports.value(RUNTIME, 'badUserInputRefusal');\n\tif (choice.kind === 'own')\n\t\treturn imports.value(choice.fn.module, choice.fn.exported);\n\tconst refusal = imports.value(RUNTIME, 'invalidInputRefusal');\n\tif (!choice.translate) return `${refusal}()`;\n\tconst translate = imports.value(\n\t\tchoice.translate.module,\n\t\tchoice.translate.exported,\n\t);\n\treturn `${refusal}({ ${translate === 'translate' ? translate : `translate: ${translate}`} })`;\n}\n\n/** The file's private `inputTypes`, which every handler passes on. */\nfunction inputTypesBlock(\n\tschema: GraphQLSchema,\n\toperations: readonly MockedOperationNode[],\n\ttype: string,\n): string {\n\tconst code = inputTypesCode(\n\t\tschema,\n\t\toperations.map(({ node }) => node),\n\t);\n\treturn [\n\t\t'/**',\n\t\t' * The input types the variables reach, from the schema: how a handler words',\n\t\t' * a value graphql refuses. Internal: its shape may change in any version.',\n\t\t' */',\n\t\t`const inputTypes: ${type} = ${code};`,\n\t].join('\\n');\n}\n\n/** The local names one handler's source uses. */\ninterface HandlerNames {\n\treadonly handler: string;\n\treadonly resolver: string;\n\treadonly options: string;\n\treadonly mock: string;\n\treadonly result: string;\n\treadonly variables: string;\n\treadonly schema: string;\n}\n\n/** The local names one subscription handler's source uses. */\ninterface SubscriptionNames {\n\treadonly handler: string;\n\treadonly executor: string;\n\treadonly options: string;\n\treadonly mock: string;\n\treadonly schema: string;\n}\n\nfunction subscriptionBlock(\n\t{ name, node }: MockedOperationNode,\n\tfactory: string,\n\tnames: SubscriptionNames,\n): string {\n\tconst operation = `{ type: \"subscription\", name: ${JSON.stringify(name)}, variables: ${names.schema}, variableTypes: ${variableTypesCode(node)}, inputTypes, endpoint, invalidInput }`;\n\treturn [\n\t\t`/** Mocks the ${name} subscription: a POST with \\`Accept: text/event-stream\\` is streamed by \\`execute\\` once the variables pass \\`${names.schema}\\`. */`,\n\t\t`export function ${factory}(`,\n\t\t`\\texecute: ${names.executor},`,\n\t\t`\\toptions?: ${names.options},`,\n\t\t`): ${names.handler} {`,\n\t\t`\\treturn ${names.mock}(${operation}, execute, options);`,\n\t\t'}',\n\t].join('\\n');\n}\n\nfunction handlerBlock(\n\t{ name, kind, node }: MockedOperationNode,\n\tfactory: string,\n\tnames: HandlerNames,\n): string {\n\tconst operation = `{ type: ${JSON.stringify(kind)}, name: ${JSON.stringify(name)}, variables: ${names.schema}, variableTypes: ${variableTypesCode(node)}, inputTypes, endpoint, invalidInput }`;\n\treturn [\n\t\t`/** Mocks the ${name} ${kind}: \\`resolver\\` answers once the variables pass \\`${names.schema}\\`. */`,\n\t\t`export function ${factory}(`,\n\t\t`\\tresolver: ${names.resolver}<${names.result}, ${names.variables}>,`,\n\t\t`\\toptions?: ${names.options},`,\n\t\t`): ${names.handler} {`,\n\t\t`\\treturn ${names.mock}(${operation}, resolver, options);`,\n\t\t'}',\n\t].join('\\n');\n}\n"
|
|
11
11
|
],
|
|
12
|
-
"mappings": ";AAWO,MAAM,QAAQ;AAAA,EACX,YAAY,IAAI;AAAA,EAChB;AAAA,EAGT,WAAW,CAAC,WAA6B,CAAC,GAAG;AAAA,IAC5C,KAAK,SAAS,IAAI,IAAI,QAAQ;AAAA;AAAA,EAI/B,KAAK,CAAC,QAAgB,UAA0B;AAAA,IAC/C,OAAO,KAAK,KAAK,QAAQ,UAAU,KAAK;AAAA;AAAA,EAIzC,IAAI,CAAC,QAAgB,UAA0B;AAAA,IAC9C,OAAO,KAAK,KAAK,QAAQ,UAAU,IAAI;AAAA;AAAA,EAGxC,IAAI,CAAC,QAAgB,UAAkB,MAAuB;AAAA,IAC7D,MAAM,QAAQ,KAAK,UAAU,IAAI,M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SACA,OACS;AAAA,EACT,MAAM,YAAY,WAAW,KAAK,UAAU,IAAI,YAAY,KAAK,UAAU,IAAI,iBAAiB,MAAM,0BAA0B,kBAAkB,IAAI;AAAA,EACtJ,OAAO;AAAA,IACN,iBAAiB,QAAQ,wDAAwD,MAAM;AAAA,IACvF,mBAAmB;AAAA,IACnB,cAAe,MAAM,YAAY,MAAM,WAAW,MAAM;AAAA,IACxD,cAAe,MAAM;AAAA,IACrB,MAAM,MAAM;AAAA,IACZ,WAAY,MAAM,QAAQ;AAAA,IAC1B;AAAA,EACD,EAAE,KAAK;AAAA,CAAI;AAAA;",
|
|
13
|
+
"debugId": "A301100766A457D164756E2164756E21",
|
|
14
14
|
"names": []
|
|
15
15
|
}
|
package/dist/naming.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CodegenMswConfig } from './config.js';
|
|
2
2
|
/** The operation kinds a handler is written for. */
|
|
3
|
-
export type MockedKind = 'query' | 'mutation';
|
|
3
|
+
export type MockedKind = 'query' | 'mutation' | 'subscription';
|
|
4
4
|
/**
|
|
5
5
|
* The names the generated file uses: each type as `typescript-operations`
|
|
6
6
|
* names it, each schema as `@nxgt/graphql-codegen-zod` names it (the type's
|
package/dist/naming.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../src/naming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../src/naming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;AAE/D;;;;;;GAMG;AACH,qBAAa,MAAM;;gBAIN,MAAM,EAAE,gBAAgB;IAKpC,qEAAqE;IACrE,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM;IAMtD,yDAAyD;IACzD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM;IAMnD,uEAAuE;IACvE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI5B,sFAAsF;IACtF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM;CAkBpD"}
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { type OperationDefinitionNode } from 'graphql';
|
|
2
2
|
import type { DocumentFile } from './config.js';
|
|
3
3
|
import type { MockedKind } from './naming.js';
|
|
4
|
-
/** A named query or
|
|
4
|
+
/** A named query, mutation or subscription of the documents. */
|
|
5
5
|
export interface MockedOperationNode {
|
|
6
6
|
readonly name: string;
|
|
7
7
|
readonly kind: MockedKind;
|
|
8
8
|
readonly node: OperationDefinitionNode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Every named
|
|
12
|
-
*
|
|
13
|
-
* HTTP request msw's `query` or `mutation` handler answers: neither gets a
|
|
14
|
-
* handler.
|
|
11
|
+
* Every named operation, in document order. An anonymous operation has no
|
|
12
|
+
* name to match: it gets no handler.
|
|
15
13
|
*/
|
|
16
14
|
export declare function mockedOperations(documents: readonly DocumentFile[]): MockedOperationNode[];
|
|
17
15
|
//# sourceMappingURL=operations.d.ts.map
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,gEAAgE;AAChE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,SAAS,YAAY,EAAE,GAChC,mBAAmB,EAAE,CAavB"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { type FieldError, type FieldIssue, fieldIssueOf, fieldsError, inputPath, invalidInputError, type Translate, } from '@nxgt/graphql-validation';
|
|
2
2
|
export type { InputType, InputTypes } from './coercion/index.js';
|
|
3
3
|
export { type GraphQLMockInfo, type GraphQLMockResolver, type MockedOperation, type MockOptions, mockOperation, } from './mock-operation.js';
|
|
4
|
+
export { type MockedSubscription, mockSubscription, type SubscriptionExecutor, } from './mock-subscription.js';
|
|
4
5
|
export { badUserInputRefusal, type InvalidInput, type InvalidInputAnswer, invalidInputRefusal, type RefusedOperation, } from './refusals.js';
|
|
5
6
|
export { type AnyGraphQLError, errorResponse, isGraphQLError, } from './response.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,UAAU,EACf,YAAY,EACZ,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,KAAK,SAAS,GACd,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,aAAa,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,KAAK,gBAAgB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,KAAK,eAAe,EACpB,aAAa,EACb,cAAc,GACd,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,UAAU,EACf,YAAY,EACZ,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,KAAK,SAAS,GACd,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,aAAa,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,kBAAkB,EACvB,gBAAgB,EAChB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,KAAK,gBAAgB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,KAAK,eAAe,EACpB,aAAa,EACb,cAAc,GACd,MAAM,YAAY,CAAC"}
|
package/dist/runtime/index.js
CHANGED
|
@@ -553,15 +553,9 @@ function mockOperation(operation, resolver, options = {}) {
|
|
|
553
553
|
const link = graphql.link(endpoint);
|
|
554
554
|
const where = { type: operation.type, name: operation.name };
|
|
555
555
|
return link[operation.type](operation.name, async (info) => {
|
|
556
|
-
const
|
|
557
|
-
if (
|
|
558
|
-
|
|
559
|
-
const refused = coercionErrors(issues, info, operation);
|
|
560
|
-
if (refused.length > 0)
|
|
561
|
-
return errorResponse(refused, { status: COERCION_STATUS });
|
|
562
|
-
const { error, status } = await operation.invalidInput(issues, where);
|
|
563
|
-
return errorResponse(error, { status });
|
|
564
|
-
}
|
|
556
|
+
const refusal = await refuseInvalid(operation, info, where);
|
|
557
|
+
if (refusal)
|
|
558
|
+
return refusal;
|
|
565
559
|
try {
|
|
566
560
|
const answer = await resolver(info);
|
|
567
561
|
assertNotIterator(answer, operation.name);
|
|
@@ -573,11 +567,69 @@ function mockOperation(operation, resolver, options = {}) {
|
|
|
573
567
|
}
|
|
574
568
|
}, handlerOptions);
|
|
575
569
|
}
|
|
570
|
+
async function refuseInvalid(operation, info, where) {
|
|
571
|
+
const checked = await operation.variables.safeParseAsync(info.variables);
|
|
572
|
+
if (checked.success)
|
|
573
|
+
return;
|
|
574
|
+
const { issues } = checked.error;
|
|
575
|
+
const refused = coercionErrors(issues, info, operation);
|
|
576
|
+
if (refused.length > 0)
|
|
577
|
+
return errorResponse(refused, { status: COERCION_STATUS });
|
|
578
|
+
const { error, status } = await operation.invalidInput(issues, where);
|
|
579
|
+
return errorResponse(error, { status });
|
|
580
|
+
}
|
|
576
581
|
function assertNotIterator(answer, name) {
|
|
577
582
|
if (typeof answer === "object" && answer !== null && !(answer instanceof Response) && typeof answer.next === "function") {
|
|
578
583
|
throw new TypeError(`@nxgt/graphql-codegen-msw: the resolver of ${name} returned an iterator (a generator function?). Each request's variables are checked before the resolver runs, which msw cannot do once it keeps an iterator: answer each request from a plain function, or register one handler per answer with { once: true }.`);
|
|
579
584
|
}
|
|
580
585
|
}
|
|
586
|
+
// src/runtime/mock-subscription.ts
|
|
587
|
+
import { Kind as Kind2, parse as parse2 } from "graphql";
|
|
588
|
+
import { http } from "msw";
|
|
589
|
+
function mockSubscription(operation, execute, options = {}) {
|
|
590
|
+
const { endpoint = operation.endpoint, ...handlerOptions } = options;
|
|
591
|
+
const where = { type: operation.type, name: operation.name };
|
|
592
|
+
return http.post(endpoint, async ({ request }) => {
|
|
593
|
+
if (!(request.headers.get("accept") ?? "").includes("text/event-stream"))
|
|
594
|
+
return;
|
|
595
|
+
const body = await bodyOf(request.clone());
|
|
596
|
+
if (!body || !isNamedSubscription(body, operation.name))
|
|
597
|
+
return;
|
|
598
|
+
const info = {
|
|
599
|
+
query: body.query,
|
|
600
|
+
operationName: body.operationName ?? operation.name,
|
|
601
|
+
variables: body.variables ?? {}
|
|
602
|
+
};
|
|
603
|
+
const refusal = await refuseInvalid(operation, info, where);
|
|
604
|
+
if (refusal)
|
|
605
|
+
return refusal;
|
|
606
|
+
return execute({
|
|
607
|
+
query: body.query,
|
|
608
|
+
variables: body.variables ?? null,
|
|
609
|
+
operationName: body.operationName ?? null,
|
|
610
|
+
request
|
|
611
|
+
});
|
|
612
|
+
}, handlerOptions);
|
|
613
|
+
}
|
|
614
|
+
async function bodyOf(request) {
|
|
615
|
+
try {
|
|
616
|
+
const body = await request.json();
|
|
617
|
+
if (typeof body === "object" && body !== null && typeof body.query === "string")
|
|
618
|
+
return body;
|
|
619
|
+
} catch {}
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
function isNamedSubscription(body, name) {
|
|
623
|
+
let document;
|
|
624
|
+
try {
|
|
625
|
+
document = parse2(body.query);
|
|
626
|
+
} catch {
|
|
627
|
+
return false;
|
|
628
|
+
}
|
|
629
|
+
const operations = document.definitions.filter((node) => node.kind === Kind2.OPERATION_DEFINITION);
|
|
630
|
+
const selected = body.operationName ? operations.find((node) => node.name?.value === body.operationName) : operations.length === 1 ? operations[0] : undefined;
|
|
631
|
+
return selected?.operation === "subscription" && selected.name?.value === name;
|
|
632
|
+
}
|
|
581
633
|
// src/runtime/refusals.ts
|
|
582
634
|
import {
|
|
583
635
|
badUserInput,
|
|
@@ -605,8 +657,9 @@ export {
|
|
|
605
657
|
invalidInputError2 as invalidInputError,
|
|
606
658
|
invalidInputRefusal,
|
|
607
659
|
isGraphQLError,
|
|
608
|
-
mockOperation
|
|
660
|
+
mockOperation,
|
|
661
|
+
mockSubscription
|
|
609
662
|
};
|
|
610
663
|
|
|
611
|
-
//# debugId=
|
|
664
|
+
//# debugId=91FE470D788D891964756E2164756E21
|
|
612
665
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/runtime/index.ts", "../src/runtime/mock-operation.ts", "../src/runtime/coercion/index.ts", "../src/runtime/coercion/document.ts", "../src/runtime/coercion/issues.ts", "../src/runtime/coercion/cross-inspect.ts", "../src/runtime/coercion/inspect.ts", "../src/runtime/coercion/suggestions.ts", "../src/runtime/coercion/messages.ts", "../src/runtime/coercion/validate.ts", "../src/runtime/response.ts", "../src/runtime/refusals.ts"],
|
|
3
|
+
"sources": ["../src/runtime/index.ts", "../src/runtime/mock-operation.ts", "../src/runtime/coercion/index.ts", "../src/runtime/coercion/document.ts", "../src/runtime/coercion/issues.ts", "../src/runtime/coercion/cross-inspect.ts", "../src/runtime/coercion/inspect.ts", "../src/runtime/coercion/suggestions.ts", "../src/runtime/coercion/messages.ts", "../src/runtime/coercion/validate.ts", "../src/runtime/response.ts", "../src/runtime/mock-subscription.ts", "../src/runtime/refusals.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"// What an `invalidInput` of your own builds its answer with, from\n// `@nxgt/graphql-validation`, so an application needs no direct import of it.\nexport {\n\ttype FieldError,\n\ttype FieldIssue,\n\tfieldIssueOf,\n\tfieldsError,\n\tinputPath,\n\tinvalidInputError,\n\ttype Translate,\n} from '@nxgt/graphql-validation';\nexport type { InputType, InputTypes } from './coercion';\nexport {\n\ttype GraphQLMockInfo,\n\ttype GraphQLMockResolver,\n\ttype MockedOperation,\n\ttype MockOptions,\n\tmockOperation,\n} from './mock-operation';\nexport {\n\tbadUserInputRefusal,\n\ttype InvalidInput,\n\ttype InvalidInputAnswer,\n\tinvalidInputRefusal,\n\ttype RefusedOperation,\n} from './refusals';\nexport {\n\ttype AnyGraphQLError,\n\terrorResponse,\n\tisGraphQLError,\n} from './response';\n",
|
|
6
|
-
"import type {\n\tPath,\n\tRequestHandlerOptions,\n\tResponseResolverInfo,\n\tResponseResolverReturnType,\n} from 'msw';\nimport {\n\ttype GraphQLHandler,\n\ttype GraphQLQuery,\n\ttype GraphQLResponseBody,\n\ttype GraphQLVariables,\n\tgraphql,\n} from 'msw/graphql';\nimport type { z } from 'zod';\nimport { COERCION_STATUS, coercionErrors, type InputTypes } from './coercion';\nimport type { InvalidInput } from './refusals';\nimport { errorResponse, isGraphQLError } from './response';\n\n/**\n * What a resolver receives: msw's own resolver info for a GraphQL\n * operation (`variables`, `query`, `operationName`, `request`, `cookies`,\n * `requestId`, `finalize`), `variables` typed with the operation's\n * variables type. They are the variables as sent: checked, not parsed.\n */\nexport type GraphQLMockInfo<Variables extends GraphQLVariables> =\n\tResponseResolverInfo<{\n\t\tquery: string;\n\t\toperationName: string;\n\t\tvariables: Variables;\n\t\tcookies: Record<string, string>;\n\t}>;\n\n/**\n * A handler's resolver, as msw's `graphql.link(...).query(name, resolver)`\n * takes one, without its generator form: return\n * `HttpResponse.json({ data })`, an `errorResponse(...)`, or nothing to\n * let the next handler answer; throw a `GraphQLError` to answer with it.\n */\nexport type GraphQLMockResolver<\n\tResult extends GraphQLQuery,\n\tVariables extends GraphQLVariables,\n> = (\n\tinfo: GraphQLMockInfo<Variables>,\n) =>\n\t| ResponseResolverReturnType<GraphQLResponseBody<Result>>\n\t| Promise<ResponseResolverReturnType<GraphQLResponseBody<Result>>>;\n\n/** A handler's options: msw's (`once`), and an endpoint for this handler only. */\nexport interface MockOptions extends RequestHandlerOptions {\n\t/** Overrides the generated `endpoint` for this handler: a URL or a path msw matches. */\n\treadonly endpoint?: Path;\n}\n\n/** One operation, as the generated file describes it. */\nexport interface MockedOperation {\n\treadonly type: 'query' | 'mutation';\n\t/** The operation's name in the document: `SignUp`. */\n\treadonly name: string;\n\t/** The variables' schema, from `@nxgt/graphql-codegen-zod`: `zSignUpMutationVariables`. */\n\treadonly variables: z.ZodType;\n\t/**\n\t * Each variable's GraphQL type, with its default: `{ first: \"Int = 10\" }`.\n\t * Internal: written by the plugin for the coercion answer, its form may\n\t * change in any version together with the generated file. Defaults to\n\t * `{}`: no variable is walked, and every refusal goes to `invalidInput`.\n\t */\n\treadonly variableTypes?: Readonly<Record<string, string>> | undefined;\n\t/**\n\t * The input types the variables reach, from the schema. Internal, as\n\t * `variableTypes`; defaults to `{}`.\n\t */\n\treadonly inputTypes?: InputTypes | undefined;\n\treadonly endpoint: Path;\n\treadonly invalidInput: InvalidInput;\n}\n\n/**\n * An msw handler for one operation: `graphql.link(endpoint)`'s `query` or\n * `mutation` by the operation's name. Its variables are checked with the\n * operation's schema first, without calling `resolver` when they fail: a\n * value graphql refuses while coercing the variables (missing, null, of\n * the wrong type, an unknown enum value or field, an Int beyond 32 bits, a\n * value a custom scalar refuses) is answered as graphql-yoga answers it\n * (`coercionErrors`, status 400), whatever `invalidInput` is; any other\n * invalid input with `invalidInput`'s error and status. A `GraphQLError`\n * the resolver throws is answered as `errorResponse` answers it; anything\n * else it throws is msw's to answer (a 500).\n */\nexport function mockOperation<\n\tResult extends GraphQLQuery,\n\tVariables extends GraphQLVariables,\n>(\n\toperation: MockedOperation,\n\tresolver: GraphQLMockResolver<Result, Variables>,\n\toptions: MockOptions = {},\n): GraphQLHandler {\n\tconst { endpoint = operation.endpoint, ...handlerOptions } = options;\n\tconst link = graphql.link(endpoint);\n\tconst where = { type: operation.type, name: operation.name };\n\treturn link[operation.type](\n\t\toperation.name,\n\t\tasync (info) => {\n\t\t\tconst
|
|
5
|
+
"// What an `invalidInput` of your own builds its answer with, from\n// `@nxgt/graphql-validation`, so an application needs no direct import of it.\nexport {\n\ttype FieldError,\n\ttype FieldIssue,\n\tfieldIssueOf,\n\tfieldsError,\n\tinputPath,\n\tinvalidInputError,\n\ttype Translate,\n} from '@nxgt/graphql-validation';\nexport type { InputType, InputTypes } from './coercion';\nexport {\n\ttype GraphQLMockInfo,\n\ttype GraphQLMockResolver,\n\ttype MockedOperation,\n\ttype MockOptions,\n\tmockOperation,\n} from './mock-operation';\nexport {\n\ttype MockedSubscription,\n\tmockSubscription,\n\ttype SubscriptionExecutor,\n} from './mock-subscription';\nexport {\n\tbadUserInputRefusal,\n\ttype InvalidInput,\n\ttype InvalidInputAnswer,\n\tinvalidInputRefusal,\n\ttype RefusedOperation,\n} from './refusals';\nexport {\n\ttype AnyGraphQLError,\n\terrorResponse,\n\tisGraphQLError,\n} from './response';\n",
|
|
6
|
+
"import type {\n\tPath,\n\tRequestHandlerOptions,\n\tResponseResolverInfo,\n\tResponseResolverReturnType,\n} from 'msw';\nimport {\n\ttype GraphQLHandler,\n\ttype GraphQLQuery,\n\ttype GraphQLResponseBody,\n\ttype GraphQLVariables,\n\tgraphql,\n} from 'msw/graphql';\nimport type { z } from 'zod';\nimport { COERCION_STATUS, coercionErrors, type InputTypes } from './coercion';\nimport type { InvalidInput, RefusedOperation } from './refusals';\nimport { errorResponse, isGraphQLError } from './response';\n\n/**\n * What a resolver receives: msw's own resolver info for a GraphQL\n * operation (`variables`, `query`, `operationName`, `request`, `cookies`,\n * `requestId`, `finalize`), `variables` typed with the operation's\n * variables type. They are the variables as sent: checked, not parsed.\n */\nexport type GraphQLMockInfo<Variables extends GraphQLVariables> =\n\tResponseResolverInfo<{\n\t\tquery: string;\n\t\toperationName: string;\n\t\tvariables: Variables;\n\t\tcookies: Record<string, string>;\n\t}>;\n\n/**\n * A handler's resolver, as msw's `graphql.link(...).query(name, resolver)`\n * takes one, without its generator form: return\n * `HttpResponse.json({ data })`, an `errorResponse(...)`, or nothing to\n * let the next handler answer; throw a `GraphQLError` to answer with it.\n */\nexport type GraphQLMockResolver<\n\tResult extends GraphQLQuery,\n\tVariables extends GraphQLVariables,\n> = (\n\tinfo: GraphQLMockInfo<Variables>,\n) =>\n\t| ResponseResolverReturnType<GraphQLResponseBody<Result>>\n\t| Promise<ResponseResolverReturnType<GraphQLResponseBody<Result>>>;\n\n/** A handler's options: msw's (`once`), and an endpoint for this handler only. */\nexport interface MockOptions extends RequestHandlerOptions {\n\t/** Overrides the generated `endpoint` for this handler: a URL or a path msw matches. */\n\treadonly endpoint?: Path;\n}\n\n/** One operation, as the generated file describes it. */\nexport interface MockedOperation {\n\treadonly type: 'query' | 'mutation';\n\t/** The operation's name in the document: `SignUp`. */\n\treadonly name: string;\n\t/** The variables' schema, from `@nxgt/graphql-codegen-zod`: `zSignUpMutationVariables`. */\n\treadonly variables: z.ZodType;\n\t/**\n\t * Each variable's GraphQL type, with its default: `{ first: \"Int = 10\" }`.\n\t * Internal: written by the plugin for the coercion answer, its form may\n\t * change in any version together with the generated file. Defaults to\n\t * `{}`: no variable is walked, and every refusal goes to `invalidInput`.\n\t */\n\treadonly variableTypes?: Readonly<Record<string, string>> | undefined;\n\t/**\n\t * The input types the variables reach, from the schema. Internal, as\n\t * `variableTypes`; defaults to `{}`.\n\t */\n\treadonly inputTypes?: InputTypes | undefined;\n\treadonly endpoint: Path;\n\treadonly invalidInput: InvalidInput;\n}\n\n/**\n * An msw handler for one operation: `graphql.link(endpoint)`'s `query` or\n * `mutation` by the operation's name. Its variables are checked with the\n * operation's schema first, without calling `resolver` when they fail: a\n * value graphql refuses while coercing the variables (missing, null, of\n * the wrong type, an unknown enum value or field, an Int beyond 32 bits, a\n * value a custom scalar refuses) is answered as graphql-yoga answers it\n * (`coercionErrors`, status 400), whatever `invalidInput` is; any other\n * invalid input with `invalidInput`'s error and status. A `GraphQLError`\n * the resolver throws is answered as `errorResponse` answers it; anything\n * else it throws is msw's to answer (a 500).\n */\nexport function mockOperation<\n\tResult extends GraphQLQuery,\n\tVariables extends GraphQLVariables,\n>(\n\toperation: MockedOperation,\n\tresolver: GraphQLMockResolver<Result, Variables>,\n\toptions: MockOptions = {},\n): GraphQLHandler {\n\tconst { endpoint = operation.endpoint, ...handlerOptions } = options;\n\tconst link = graphql.link(endpoint);\n\tconst where = { type: operation.type, name: operation.name };\n\treturn link[operation.type](\n\t\toperation.name,\n\t\tasync (info) => {\n\t\t\tconst refusal = await refuseInvalid(operation, info, where);\n\t\t\tif (refusal) return refusal;\n\t\t\ttry {\n\t\t\t\tconst answer = await resolver(info as GraphQLMockInfo<Variables>);\n\t\t\t\tassertNotIterator(answer, operation.name);\n\t\t\t\treturn answer;\n\t\t\t} catch (error) {\n\t\t\t\tif (isGraphQLError(error)) return errorResponse(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t},\n\t\thandlerOptions,\n\t);\n}\n\n/**\n * The answer to variables `operation.variables` refuses, or `undefined`\n * when they pass: a value graphql refuses while coercing is answered as\n * graphql-yoga answers it (status 400), any other with `invalidInput`.\n */\nexport async function refuseInvalid(\n\toperation: Pick<\n\t\tMockedOperation,\n\t\t'variables' | 'variableTypes' | 'inputTypes' | 'invalidInput'\n\t>,\n\tinfo: { query: string; operationName: string; variables: unknown },\n\twhere: RefusedOperation,\n): Promise<Response | undefined> {\n\tconst checked = await operation.variables.safeParseAsync(info.variables);\n\tif (checked.success) return undefined;\n\tconst { issues } = checked.error;\n\t// The API refuses these while coercing the variables, before its own\n\t// validation: whatever invalidInput says.\n\tconst refused = coercionErrors(issues, info, operation);\n\tif (refused.length > 0)\n\t\treturn errorResponse(refused, { status: COERCION_STATUS });\n\t// A status no response can carry is ignored, as errorResponse ignores\n\t// it: the error's own, else 200.\n\tconst { error, status } = await operation.invalidInput(issues, where);\n\treturn errorResponse(error, { status });\n}\n\n/**\n * msw would keep a generator's iterator and answer the next requests from\n * it without calling this handler's resolver again, so their variables would\n * go unchecked: refused instead.\n */\nfunction assertNotIterator(answer: unknown, name: string): void {\n\tif (\n\t\ttypeof answer === 'object' &&\n\t\tanswer !== null &&\n\t\t!(answer instanceof Response) &&\n\t\ttypeof (answer as { next?: unknown }).next === 'function'\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`@nxgt/graphql-codegen-msw: the resolver of ${name} returned an iterator (a generator function?). Each request's variables are checked before the resolver runs, which msw cannot do once it keeps an iterator: answer each request from a plain function, or register one handler per answer with { once: true }.`,\n\t\t);\n\t}\n}\n",
|
|
7
7
|
"// What graphql-yoga refuses while it coerces the variables, before any\n// resolver runs: a missing or null value for a non-null type, a value of the\n// wrong type, an unknown enum value, an unknown input field, an Int beyond\n// 32 bits, a value a custom scalar refuses. Measured on graphql-yoga 5.24\n// (@graphql-tools/executor 2, graphql 17): one error per problem,\n// `{ message, locations }`, status 400 whatever the Accept header. Only a\n// custom scalar's refusal has `extensions`: the `INVALID_SCALAR` ones\n// `zodScalar` puts in its error, which graphql keeps on the variable's.\n//\n// How coercion is decided: the variables are walked as graphql walks them\n// (`validate.ts`), over the input types the generated file describes from\n// the schema. A built-in scalar, an enum, an input object and the non-null\n// and list wrappers are judged as graphql judges them, from the declared\n// type and the value sent, never from a Zod issue; a custom scalar refuses\n// exactly where the operation's Zod schema has an issue at its position.\n// So the answer is graphql-yoga's whenever graphql would refuse, and empty\n// otherwise, when the issues are the API's own validation.\nimport type { GraphQLFormattedError, VariableDefinitionNode } from 'graphql';\nimport { GraphQLError } from 'graphql';\nimport type { z } from 'zod';\nimport {\n\tdeclared,\n\tdefinitionsOf,\n\ttype InputTypes,\n\tprintType,\n} from './document';\nimport { placed } from './issues';\nimport { variableRefusal } from './messages';\nimport { type Problem, validateValue, type Walk } from './validate';\n\nexport type { InputType, InputTypes } from './document';\nexport { STALE_FILE } from './validate';\n\n/** The status graphql-yoga answers a variable coercion error with. */\nexport const COERCION_STATUS = 400;\n\n/**\n * What the generated file says of an operation's variables. Without them\n * (a hand-written handler), no variable is walked.\n */\nexport interface DeclaredVariables {\n\t/** Each variable's type, with its default: `{ first: \"Int = 10\" }`. */\n\treadonly variableTypes?: Readonly<Record<string, string>> | undefined;\n\treadonly inputTypes?: InputTypes | undefined;\n}\n\n/** The request whose variables the operation's schema refused. */\nexport interface CoercedRequest {\n\treadonly query: string;\n\treadonly operationName: string;\n\treadonly variables: unknown;\n}\n\n/**\n * The errors graphql-yoga answers the request's variables with, in its\n * order (variables in declaration order, an object's fields in the\n * schema's, unknown fields last), each located at the variable's\n * definition in the query sent; empty when graphql takes every variable.\n */\nexport function coercionErrors(\n\tissues: readonly z.core.$ZodIssue[],\n\trequest: CoercedRequest,\n\toperation: DeclaredVariables,\n): GraphQLFormattedError[] {\n\tconst definitions = definitionsOf(request.query, request.operationName);\n\tconst sent =\n\t\ttypeof request.variables === 'object' && request.variables !== null\n\t\t\t? (request.variables as Record<string, unknown>)\n\t\t\t: {};\n\tconst walked = placed(issues);\n\tconst { variableTypes = {}, inputTypes = {} } = operation;\n\treturn Object.entries(variableTypes).flatMap(([name, source]) =>\n\t\tvariableMessages(name, source, sent, {\n\t\t\ttypes: inputTypes,\n\t\t\tissues: walked,\n\t\t\tproblems: [],\n\t\t}).map((refused) => located(refused, definitions.get(name))),\n\t);\n}\n\n/** One variable's messages, as @graphql-tools/executor's `getVariableValues` words them. */\nfunction variableMessages(\n\tname: string,\n\tsource: string,\n\tsent: Record<string, unknown>,\n\twalk: Walk,\n): Refused[] {\n\tconst { type, hasDefault } = declared(source);\n\tif (!Object.hasOwn(sent, name))\n\t\treturn type.kind === 'non-null' && !hasDefault\n\t\t\t? [{ message: variableRefusal.notProvided(name, printType(type)) }]\n\t\t\t: [];\n\tconst value = sent[name];\n\tif (value === null && type.kind === 'non-null')\n\t\treturn [{ message: variableRefusal.isNull(name, printType(type)) }];\n\tvalidateValue(walk, value, type, { path: [], zodPath: [name] });\n\treturn walk.problems.map(\n\t\t({ path, value: found, reason, extensions }: Problem) => ({\n\t\t\tmessage: variableRefusal.invalidValue(name, found, path, reason),\n\t\t\t...(extensions === undefined ? {} : { extensions }),\n\t\t}),\n\t);\n}\n\n/** One refusal: its message, and the `extensions` a custom scalar's error carries. */\ninterface Refused {\n\treadonly message: string;\n\treadonly extensions?: Record<string, unknown>;\n}\n\nfunction located(\n\t{ message, extensions }: Refused,\n\tdefinition: VariableDefinitionNode | undefined,\n): GraphQLFormattedError {\n\treturn new GraphQLError(message, {\n\t\t...(definition ? { nodes: definition } : {}),\n\t\t...(extensions === undefined ? {} : { extensions }),\n\t}).toJSON();\n}\n",
|
|
8
8
|
"import {\n\tKind,\n\ttype OperationDefinitionNode,\n\tparse,\n\ttype VariableDefinitionNode,\n} from 'graphql';\n\n/**\n * One GraphQL type the variables reach, as the generated file describes it\n * from the schema: a built-in scalar (`String`, `Int`, `Float`, `Boolean`,\n * `ID`), a custom scalar, an enum and its values, or an input object and\n * the type of each field (`\"[String!]\"`, `\"Int! = 1\"` with a default).\n *\n * Internal: written by the plugin and read by the coercion answer only. Its\n * form may change in any version, together with the generated file.\n */\nexport type InputType =\n\t| { readonly kind: 'builtin' }\n\t| { readonly kind: 'scalar' }\n\t| { readonly kind: 'enum'; readonly values: readonly string[] }\n\t| {\n\t\t\treadonly kind: 'input';\n\t\t\treadonly fields: Readonly<Record<string, string>>;\n\t\t\treadonly oneOf?: true;\n\t };\n\n/** The input types of one generated file, by name. Internal, as `InputType`. */\nexport type InputTypes = Readonly<Record<string, InputType>>;\n\n/** A type as graphql-js walks it: non-null and list wrappers around a name. */\nexport type TypeRef =\n\t| { readonly kind: 'non-null'; readonly of: TypeRef }\n\t| { readonly kind: 'list'; readonly of: TypeRef }\n\t| { readonly kind: 'named'; readonly name: string };\n\n/** A variable's or an input field's declaration: its type, and whether it has a default. */\nexport interface Declared {\n\treadonly type: TypeRef;\n\treadonly hasDefault: boolean;\n}\n\n/** `\"[Int!]! = [1]\"` read: the type before ` = `, a default after it. */\nexport function declared(source: string): Declared {\n\tconst at = source.indexOf(' = ');\n\tconst printed = at === -1 ? source : source.slice(0, at);\n\treturn { type: typeRef(printed.trim()), hasDefault: at !== -1 };\n}\n\nfunction typeRef(printed: string): TypeRef {\n\tif (printed.endsWith('!'))\n\t\treturn { kind: 'non-null', of: typeRef(printed.slice(0, -1)) };\n\tif (printed.startsWith('[') && printed.endsWith(']'))\n\t\treturn { kind: 'list', of: typeRef(printed.slice(1, -1)) };\n\treturn { kind: 'named', name: printed };\n}\n\n/** A type as graphql-js prints it in a message: `[Int!]!`. */\nexport function printType(type: TypeRef): string {\n\tswitch (type.kind) {\n\t\tcase 'non-null':\n\t\t\treturn `${printType(type.of)}!`;\n\t\tcase 'list':\n\t\t\treturn `[${printType(type.of)}]`;\n\t\tdefault:\n\t\t\treturn type.name;\n\t}\n}\n\n/**\n * The variables' definitions of the operation named `name` in the query the\n * client sent, by variable: where each error is located. Empty when the\n * query does not parse.\n */\nexport function definitionsOf(\n\tquery: string,\n\tname: string,\n): ReadonlyMap<string, VariableDefinitionNode> {\n\tlet operations: OperationDefinitionNode[];\n\ttry {\n\t\toperations = parse(query).definitions.filter(\n\t\t\t(node): node is OperationDefinitionNode =>\n\t\t\t\tnode.kind === Kind.OPERATION_DEFINITION,\n\t\t);\n\t} catch {\n\t\treturn new Map();\n\t}\n\tconst operation =\n\t\toperations.find((node) => node.name?.value === name) ?? operations[0];\n\treturn new Map(\n\t\t(operation?.variableDefinitions ?? []).map((node) => [\n\t\t\tnode.variable.name.value,\n\t\t\tnode,\n\t\t]),\n\t);\n}\n",
|
|
9
9
|
"import type { z } from 'zod';\n\n/** A Zod issue and its whole path inside the variables. */\nexport interface PlacedIssue {\n\treadonly path: readonly (string | number)[];\n\treadonly issue: z.core.$ZodIssue;\n}\n\n/**\n * Every issue with its whole path, a union's own issue followed by each of\n * its branches' (`@oneOf` and nested unions): a custom scalar's refusal may\n * sit in either branch. A list's item issues come from the pipe after its\n * shaping union, outside any union.\n */\nexport function placed(\n\tissues: readonly z.core.$ZodIssue[],\n\tprefix: readonly (string | number)[] = [],\n): PlacedIssue[] {\n\treturn issues.flatMap((issue) => {\n\t\tconst path = [...prefix, ...issue.path.map(segment)];\n\t\tconst own = { path, issue };\n\t\tif (issue.code !== 'invalid_union') return [own];\n\t\treturn [own, ...issue.errors.flatMap((branch) => placed(branch, path))];\n\t});\n}\n\nfunction segment(key: PropertyKey): string | number {\n\treturn typeof key === 'number' ? key : String(key);\n}\n\n/**\n * The first issue at `path` or below it: what a custom scalar's schema\n * refused there. A scalar built with `zodScalar` refuses with its schema's\n * first issue, which the client's schema, the same one, reports first too.\n */\nexport function issueAt(\n\tissues: readonly PlacedIssue[],\n\tpath: readonly (string | number)[],\n): z.core.$ZodIssue | undefined {\n\treturn issues.find(\n\t\t(placedIssue) =>\n\t\t\tplacedIssue.path.length >= path.length &&\n\t\t\tpath.every((key, index) => placedIssue.path[index] === key),\n\t)?.issue;\n}\n",
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
"/*!\n * Messages ported from graphql-js 17.0.2 (src/type/scalars.ts,\n * src/type/definition.ts), https://github.com/graphql/graphql-js\n * Copyright (c) GraphQL Contributors\n * and from @graphql-tools/executor 2.0.3 (execution/validateInputValue,\n * execution/values), https://github.com/ardatan/graphql-tools\n * Copyright (c) 2020 The Guild, Inc.\n * @license MIT\n */\n\n// How graphql 17 words a value it refuses, as graphql-yoga 5 with\n// @graphql-tools/executor 2 answers it: the leaf scalars' and enums' own\n// messages, printed with graphql's `inspect`, and the input object's and\n// the variable's prefix, which the executor words and prints with\n// `cross-inspect`.\nimport type { z } from 'zod';\nimport { crossInspect } from './cross-inspect';\nimport { inspect } from './inspect';\nimport { didYouMean, suggestionList } from './suggestions';\n\nconst INT_MAX = 2_147_483_647;\nconst INT_MIN = -2_147_483_648;\n\n/** Why a built-in scalar refuses `value`, or undefined when it takes it. */\nexport function builtinRefusal(\n\tname: string,\n\tvalue: unknown,\n): string | undefined {\n\tconst found = inspect(value);\n\tswitch (name) {\n\t\tcase 'String':\n\t\t\treturn typeof value === 'string'\n\t\t\t\t? undefined\n\t\t\t\t: `String cannot represent a non string value: ${found}`;\n\t\tcase 'Boolean':\n\t\t\treturn typeof value === 'boolean'\n\t\t\t\t? undefined\n\t\t\t\t: `Boolean cannot represent a non boolean value: ${found}`;\n\t\tcase 'Float':\n\t\t\treturn typeof value === 'number' && Number.isFinite(value)\n\t\t\t\t? undefined\n\t\t\t\t: `Float cannot represent non numeric value: ${found}`;\n\t\tcase 'ID':\n\t\t\treturn typeof value === 'string' || Number.isInteger(value)\n\t\t\t\t? undefined\n\t\t\t\t: `ID cannot represent value: ${found}`;\n\t\tcase 'Int':\n\t\t\treturn intRefusal(value);\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/** Int's bound is decided from the declared type, never from a Zod issue. */\nfunction intRefusal(value: unknown): string | undefined {\n\tif (typeof value !== 'number' || !Number.isInteger(value))\n\t\treturn `Int cannot represent non-integer value: ${inspect(value)}`;\n\tif (value > INT_MAX || value < INT_MIN)\n\t\treturn `Int cannot represent non 32-bit signed integer value: ${inspect(value)}`;\n\treturn undefined;\n}\n\n/** Why the enum `name` refuses `value`, with graphql's suggestions. */\nexport function enumRefusal(\n\tname: string,\n\tvalues: readonly string[],\n\tvalue: unknown,\n): string | undefined {\n\tif (typeof value !== 'string') {\n\t\tconst found = inspect(value);\n\t\treturn `Enum \"${name}\" cannot represent non-string value: ${found}.${suggest(found, values)}`;\n\t}\n\tif (values.includes(value)) return undefined;\n\treturn `Value \"${value}\" does not exist in \"${name}\" enum.${suggest(value, values)}`;\n}\n\nfunction suggest(value: string, values: readonly string[]): string {\n\treturn didYouMean(suggestionList(value, values), 'the enum value');\n}\n\n/**\n * Why a custom scalar refuses the value, and the `extensions` it carries, as\n * a scalar built with `zodScalar` (`@nxgt/graphql-scalars`) words it: its\n * schema's first issue, which the client's schema, the same one, reports too.\n */\nexport function scalarRefusal(\n\tname: string,\n\tissue: z.core.$ZodIssue | undefined,\n): { reason: string; extensions: Record<string, unknown> } | undefined {\n\treturn (\n\t\tissue && {\n\t\t\treason: `${name} cannot represent this input: ${issue.message}`,\n\t\t\t// What `zodScalar` puts in its error, which graphql keeps on the\n\t\t\t// variable's.\n\t\t\textensions: { code: 'INVALID_SCALAR', scalar: name, reason: issue.code },\n\t\t}\n\t);\n}\n\n/** The input object messages, by what is wrong with the object. */\nexport const objectRefusal = {\n\tnotAnObject: (type: string, value: unknown) =>\n\t\t`Expected value of type \"${type}\" to be an object, found: ${crossInspect(value)}.`,\n\tmissingField: (type: string, field: string, object: unknown) =>\n\t\t`Expected value of type \"${type}\" to include required field \"${field}\", found: ${crossInspect(object)}.`,\n\tunknownField: (\n\t\ttype: string,\n\t\tfield: string,\n\t\tknown: readonly string[],\n\t\tobject: unknown,\n\t) => {\n\t\tconst suggestion = didYouMean(suggestionList(field, known));\n\t\treturn `Expected value of type \"${type}\" not to include unknown field \"${field}\"${suggestion ? `.${suggestion} Found` : ', found'}: ${crossInspect(object)}.`;\n\t},\n\toneOf: (type: string) =>\n\t\t`Within OneOf Input Object type \"${type}\", exactly one field must be specified, and the value for that field must be non-null.`,\n\tnotProvided: (type: string) =>\n\t\t`Expected a value of non-null type \"${type}\" to be provided.`,\n\tisNull: (type: string) =>\n\t\t`Expected value of non-null type \"${type}\" not to be null.`,\n};\n\n/** The messages about a variable itself, before its value is walked. */\nexport const variableRefusal = {\n\tnotProvided: (name: string, type: string) =>\n\t\t`Variable \"$${name}\" of required type \"${type}\" was not provided.`,\n\tisNull: (name: string, type: string) =>\n\t\t`Variable \"$${name}\" of non-null type \"${type}\" must not be null.`,\n\t/** `Variable \"$input\" got invalid value 1 at \"input.tags[0]\"; <reason>` */\n\tinvalidValue: (\n\t\tname: string,\n\t\tvalue: unknown,\n\t\tpath: readonly (string | number)[],\n\t\treason: string,\n\t) => {\n\t\tconst at =\n\t\t\tpath.length > 0\n\t\t\t\t? ` at \"${name}${path.map((key) => (typeof key === 'number' ? `[${key}]` : `.${key}`)).join('')}\"`\n\t\t\t\t: '';\n\t\treturn `Variable \"$${name}\" got invalid value ${crossInspect(value)}${at}; ${reason}`;\n\t},\n};\n",
|
|
14
14
|
"/*!\n * Ported from @graphql-tools/executor 2.0.3 (execution/validateInputValue),\n * https://github.com/ardatan/graphql-tools\n * Copyright (c) 2020 The Guild, Inc.\n * itself a copy of graphql-js 17's validateInputValue,\n * https://github.com/graphql/graphql-js\n * Copyright (c) GraphQL Contributors\n * @license MIT\n */\n\n// @graphql-tools/executor 2.0.3's copy of graphql 17's `validateInputValue`,\n// the one it runs on each variable, walked over the generated input types:\n// the same problems, at the same paths, in the same order.\nimport {\n\tdeclared,\n\ttype InputType,\n\ttype InputTypes,\n\tprintType,\n\ttype TypeRef,\n} from './document';\nimport { issueAt, type PlacedIssue } from './issues';\nimport {\n\tbuiltinRefusal,\n\tenumRefusal,\n\tobjectRefusal,\n\tscalarRefusal,\n} from './messages';\n\ntype Path = readonly (string | number)[];\ntype InputObject = Extract<InputType, { kind: 'input' }>;\n\n/** One value graphql refuses: where, the value there, and why. */\nexport interface Problem {\n\treadonly path: Path;\n\treadonly value: unknown;\n\treadonly reason: string;\n\t/** What the refusing scalar puts in its error's `extensions`. */\n\treadonly extensions?: Record<string, unknown>;\n}\n\n/** What a walk reads, and the problems it found so far. */\nexport interface Walk {\n\treadonly types: InputTypes;\n\treadonly issues: readonly PlacedIssue[];\n\treadonly problems: Problem[];\n}\n\n/** Where a walk stands: graphql's path below the variable, and the Zod schema's. */\ninterface At {\n\treadonly path: Path;\n\t/**\n\t * From the variable's name. It differs from graphql's where a single\n\t * value stands for a list: the schema wraps it (`[0]`), graphql does not.\n\t */\n\treadonly zodPath: Path;\n}\n\n/** Walks `value` at `type`, recording each problem in `walk.problems`. */\nexport function validateValue(\n\twalk: Walk,\n\tvalue: unknown,\n\ttype: TypeRef,\n\tat: At,\n): void {\n\tif (type.kind === 'non-null') {\n\t\tif (value === undefined)\n\t\t\treport(walk, at, value, objectRefusal.notProvided(printType(type)));\n\t\telse if (value === null)\n\t\t\treport(walk, at, value, objectRefusal.isNull(printType(type)));\n\t\telse validateValue(walk, value, type.of, at);\n\t} else if (value === null || value === undefined) {\n\t\t// A nullable type takes null, and an absent field is the object's.\n\t} else if (type.kind === 'list') {\n\t\tvalidateList(walk, value, type.of, at);\n\t} else {\n\t\tvalidateNamed(walk, value, type.name, at);\n\t}\n}\n\nfunction validateList(walk: Walk, value: unknown, item: TypeRef, at: At): void {\n\tif (!Array.isArray(value)) {\n\t\tvalidateValue(walk, value, item, { ...at, zodPath: [...at.zodPath, 0] });\n\t\treturn;\n\t}\n\tvalue.forEach((element, index) => {\n\t\tvalidateValue(walk, element, item, {\n\t\t\tpath: [...at.path, index],\n\t\t\tzodPath: [...at.zodPath, index],\n\t\t});\n\t});\n}\n\n/** The spec scalars, judged as built-ins even when the file omits them. */\nconst BUILT_INS: ReadonlySet<string> = new Set([\n\t'String',\n\t'Int',\n\t'Float',\n\t'Boolean',\n\t'ID',\n]);\n\nfunction validateNamed(walk: Walk, value: unknown, name: string, at: At): void {\n\t// A name the generated file does not describe is judged as a custom\n\t// scalar is: refused only where the Zod schema refused it.\n\tconst named: InputType =\n\t\twalk.types[name] ??\n\t\t(BUILT_INS.has(name) ? { kind: 'builtin' } : { kind: 'scalar' });\n\tif (named.kind === 'input') {\n\t\tvalidateObject(walk, value, name, named, at);\n\t\treturn;\n\t}\n\tconst refusal = leafRefusal(walk, value, name, named, at);\n\tif (refusal !== undefined)\n\t\treport(walk, at, value, refusal.reason, refusal.extensions);\n}\n\nfunction leafRefusal(\n\twalk: Walk,\n\tvalue: unknown,\n\tname: string,\n\tnamed: Exclude<InputType, InputObject>,\n\tat: At,\n): { reason: string; extensions?: Record<string, unknown> } | undefined {\n\tswitch (named.kind) {\n\t\tcase 'builtin':\n\t\t\treturn plain(builtinRefusal(name, value));\n\t\tcase 'enum':\n\t\t\treturn plain(enumRefusal(name, named.values, value));\n\t\tcase 'scalar':\n\t\t\treturn scalarRefusal(name, issueAt(walk.issues, at.zodPath));\n\t\tdefault:\n\t\t\t// A kind this runtime does not know: the file was written by\n\t\t\t// another version of the plugin.\n\t\t\tthrow new Error(STALE_FILE);\n\t}\n}\n\nfunction plain(reason: string | undefined): { reason: string } | undefined {\n\treturn reason === undefined ? undefined : { reason };\n}\n\n/** Thrown on an input type whose `kind` this runtime does not know. */\nexport const STALE_FILE =\n\t'@nxgt/graphql-codegen-msw: the generated file was written by another version than the runtime; regenerate it';\n\nfunction validateObject(\n\twalk: Walk,\n\tvalue: unknown,\n\tname: string,\n\ttype: InputObject,\n\tat: At,\n): void {\n\tif (typeof value !== 'object' || value === null || Array.isArray(value)) {\n\t\treport(walk, at, value, objectRefusal.notAnObject(name, value));\n\t\treturn;\n\t}\n\tconst object = value as Record<string, unknown>;\n\tfor (const [field, source] of Object.entries(type.fields)) {\n\t\tconst { type: fieldType, hasDefault } = declared(source);\n\t\tconst fieldValue = Object.hasOwn(object, field) ? object[field] : undefined;\n\t\tif (fieldValue !== undefined)\n\t\t\tvalidateValue(walk, fieldValue, fieldType, {\n\t\t\t\tpath: [...at.path, field],\n\t\t\t\tzodPath: [...at.zodPath, field],\n\t\t\t});\n\t\telse if (fieldType.kind === 'non-null' && !hasDefault)\n\t\t\treport(walk, at, object, objectRefusal.missingField(name, field, object));\n\t}\n\tconst names = Object.keys(type.fields);\n\tconst known: string[] = [];\n\tfor (const key of Object.keys(object)) {\n\t\tif (object[key] === undefined) continue;\n\t\tif (Object.hasOwn(type.fields, key)) known.push(key);\n\t\telse\n\t\t\treport(\n\t\t\t\twalk,\n\t\t\t\tat,\n\t\t\t\tobject,\n\t\t\t\tobjectRefusal.unknownField(name, key, names, object),\n\t\t\t);\n\t}\n\tif (type.oneOf) validateOneOf(walk, object, name, known, at);\n}\n\n/** A `@oneOf` input object: exactly one field, and not null. */\nfunction validateOneOf(\n\twalk: Walk,\n\tobject: Record<string, unknown>,\n\tname: string,\n\tknown: readonly string[],\n\tat: At,\n): void {\n\tconst [only] = known;\n\tif (known.length !== 1 || only === undefined)\n\t\treport(walk, at, object, objectRefusal.oneOf(name));\n\telse if (object[only] === null)\n\t\treport(\n\t\t\twalk,\n\t\t\t{ ...at, path: [...at.path, only] },\n\t\t\tobject,\n\t\t\tobjectRefusal.oneOf(name),\n\t\t);\n}\n\nfunction report(\n\twalk: Walk,\n\tat: At,\n\tvalue: unknown,\n\treason: string,\n\textensions?: Record<string, unknown>,\n): void {\n\twalk.problems.push({\n\t\tpath: at.path,\n\t\tvalue,\n\t\treason,\n\t\t...(extensions === undefined ? {} : { extensions }),\n\t});\n}\n",
|
|
15
15
|
"import type { GraphQLError, GraphQLFormattedError } from 'graphql';\nimport { HttpResponse } from 'msw';\n\n/** An error as a resolver throws it, or as it goes on the wire. */\nexport type AnyGraphQLError = GraphQLError | GraphQLFormattedError;\n\n/**\n * Whether `value` is a `GraphQLError`, from any copy of `graphql`: by its\n * name (or its `[object GraphQLError]` tag, which a subclass with its own\n * `name` keeps) and its `toJSON`, never `instanceof`, so an error your\n * application built with its own `graphql` is one too.\n */\nexport function isGraphQLError(value: unknown): value is GraphQLError {\n\treturn (\n\t\tvalue instanceof Error &&\n\t\t(value.name === 'GraphQLError' ||\n\t\t\tObject.prototype.toString.call(value) === '[object GraphQLError]') &&\n\t\ttypeof (value as { toJSON?: unknown }).toJSON === 'function'\n\t);\n}\n\n/**\n * `error` as the response carries it: a `GraphQLError`'s `toJSON()`, or\n * itself, without `extensions.http` and `extensions.unexpected`, which\n * graphql-yoga keeps for itself and never sends (an `extensions` left empty\n * goes too).\n */\nexport function formatted(error: AnyGraphQLError): GraphQLFormattedError {\n\tconst json = isGraphQLError(error) ? error.toJSON() : error;\n\tconst { extensions, ...rest } = json;\n\tif (extensions === undefined) return json;\n\tconst { http: _http, unexpected: _unexpected, ...kept } = extensions;\n\treturn Object.keys(kept).length > 0 ? { ...rest, extensions: kept } : rest;\n}\n\n/**\n * `status` when a response can carry it: an integer from 200 to 599 other\n * than 204, 205 and 304, which have no body.\n */\nfunction validStatus(status: unknown): number | undefined {\n\treturn typeof status === 'number' &&\n\t\tNumber.isInteger(status) &&\n\t\tstatus >= 200 &&\n\t\tstatus <= 599 &&\n\t\tstatus !== 204 &&\n\t\tstatus !== 205 &&\n\t\tstatus !== 304\n\t\t? status\n\t\t: undefined;\n}\n\n/** `extensions.http.status`, when it is a status a response can carry. */\nexport function statusOf(error: AnyGraphQLError): number | undefined {\n\tconst http = (error.extensions as { http?: { status?: unknown } } | undefined)\n\t\t?.http;\n\treturn validStatus(http?.status);\n}\n\n/**\n * A GraphQL response holding `errors` only, as graphql-yoga answers one:\n * `{ errors }`, each error without its `extensions.http` (see `formatted`),\n * at `status` when a response can carry it, else the highest\n * `extensions.http.status` among the errors, else 200. What a resolver\n * returns to refuse, as your server would:\n * `return errorResponse(fieldsError('conflict', fields, { status: 409 }))`.\n */\nexport function errorResponse(\n\terror: AnyGraphQLError | readonly AnyGraphQLError[],\n\tinit: { readonly status?: number } = {},\n): HttpResponse<{ errors: GraphQLFormattedError[] }> {\n\tconst errors = (Array.isArray(error) ? error : [error]) as AnyGraphQLError[];\n\tconst statuses = errors\n\t\t.map(statusOf)\n\t\t.filter((status) => status !== undefined);\n\tconst status =\n\t\tvalidStatus(init.status) ??\n\t\t(statuses.length > 0 ? Math.max(...statuses) : 200);\n\treturn HttpResponse.json({ errors: errors.map(formatted) }, { status });\n}\n",
|
|
16
|
-
"import {
|
|
16
|
+
"import { type DocumentNode, Kind, parse } from 'graphql';\nimport { type HttpHandler, http } from 'msw';\nimport type { MockedOperation, MockOptions } from './mock-operation';\nimport { refuseInvalid } from './mock-operation';\n\n/**\n * What a subscription handler hands the request to: the shape of\n * `@nxgt/msw-graphql`'s `Executor` (`createExecutor({ schema })`), which\n * streams the schema's `Subscription` resolvers as graphql-sse distinct\n * connections. Declared here so this package needs no dependency on it.\n */\nexport type SubscriptionExecutor = (input: {\n\tquery: string;\n\tvariables?: Record<string, unknown> | null;\n\toperationName?: string | null;\n\trequest: Request;\n}) => Promise<Response>;\n\n/** One subscription, as the generated file describes it. */\nexport interface MockedSubscription extends Omit<MockedOperation, 'type'> {\n\treadonly type: 'subscription';\n}\n\ninterface Body {\n\treadonly query: string;\n\treadonly variables?: Record<string, unknown> | null;\n\treadonly operationName?: string | null;\n}\n\n/**\n * An msw handler for one subscription: a POST to the endpoint that asks for\n * `Accept: text/event-stream` and whose operation is the subscription named\n * `operation.name`. Its variables are checked as a query's are, then the\n * request goes to `execute`, whose response (the event stream) is the\n * answer. Any other request, including this subscription sent without the\n * event-stream `Accept`, is left to the next handler.\n */\nexport function mockSubscription(\n\toperation: MockedSubscription,\n\texecute: SubscriptionExecutor,\n\toptions: MockOptions = {},\n): HttpHandler {\n\tconst { endpoint = operation.endpoint, ...handlerOptions } = options;\n\tconst where = { type: operation.type, name: operation.name };\n\treturn http.post(\n\t\tendpoint,\n\t\tasync ({ request }) => {\n\t\t\tif (!(request.headers.get('accept') ?? '').includes('text/event-stream'))\n\t\t\t\treturn undefined;\n\t\t\tconst body = await bodyOf(request.clone());\n\t\t\tif (!body || !isNamedSubscription(body, operation.name)) return undefined;\n\t\t\tconst info = {\n\t\t\t\tquery: body.query,\n\t\t\t\toperationName: body.operationName ?? operation.name,\n\t\t\t\tvariables: body.variables ?? {},\n\t\t\t};\n\t\t\tconst refusal = await refuseInvalid(operation, info, where);\n\t\t\tif (refusal) return refusal;\n\t\t\treturn execute({\n\t\t\t\tquery: body.query,\n\t\t\t\tvariables: body.variables ?? null,\n\t\t\t\toperationName: body.operationName ?? null,\n\t\t\t\trequest,\n\t\t\t});\n\t\t},\n\t\thandlerOptions,\n\t);\n}\n\nasync function bodyOf(request: Request): Promise<Body | undefined> {\n\ttry {\n\t\tconst body: unknown = await request.json();\n\t\tif (\n\t\t\ttypeof body === 'object' &&\n\t\t\tbody !== null &&\n\t\t\ttypeof (body as { query?: unknown }).query === 'string'\n\t\t)\n\t\t\treturn body as Body;\n\t} catch {\n\t\t// Not JSON: not ours.\n\t}\n\treturn undefined;\n}\n\n/** Whether the operation the body selects is the subscription `name`. */\nfunction isNamedSubscription(body: Body, name: string): boolean {\n\tlet document: DocumentNode;\n\ttry {\n\t\tdocument = parse(body.query);\n\t} catch {\n\t\treturn false;\n\t}\n\tconst operations = document.definitions.filter(\n\t\t(node) => node.kind === Kind.OPERATION_DEFINITION,\n\t);\n\tconst selected = body.operationName\n\t\t? operations.find((node) => node.name?.value === body.operationName)\n\t\t: operations.length === 1\n\t\t\t? operations[0]\n\t\t\t: undefined;\n\treturn (\n\t\tselected?.operation === 'subscription' && selected.name?.value === name\n\t);\n}\n",
|
|
17
|
+
"import {\n\tbadUserInput,\n\tfieldIssueOf,\n\tinvalidInputError,\n\ttype Translate,\n} from '@nxgt/graphql-validation';\nimport { z } from 'zod';\nimport type { AnyGraphQLError } from './response';\n\n/** The operation whose variables were refused. */\nexport interface RefusedOperation {\n\treadonly type: 'query' | 'mutation' | 'subscription';\n\t/** The operation's name in the document: `SignUp`. */\n\treadonly name: string;\n}\n\n/** What an invalid input is answered with: the one error, and the HTTP status. */\nexport interface InvalidInputAnswer {\n\treadonly error: AnyGraphQLError;\n\treadonly status: number;\n}\n\n/**\n * Answers an invalid input: the issues of the variables' Zod schema (each\n * `path` starting with the variable's name) and the operation, to the error\n * and status the handler responds with. The resolver is not called.\n */\nexport type InvalidInput = (\n\tissues: readonly z.core.$ZodIssue[],\n\toperation: RefusedOperation,\n) => InvalidInputAnswer | Promise<InvalidInputAnswer>;\n\n/**\n * The default answer: `invalidInputError`'s one 400 error, its `fields` the\n * issues in order through `fieldIssueOf` (`@nxgt/graphql-validation`'s),\n * each message `translate(code)`, or the code without a translator.\n */\nexport function invalidInputRefusal(\n\toptions: { readonly translate?: Translate } = {},\n): InvalidInput {\n\tconst { translate } = options;\n\treturn (issues) => ({\n\t\terror: invalidInputError(\n\t\t\tissues.map(fieldIssueOf),\n\t\t\ttranslate ? { translate } : {},\n\t\t),\n\t\tstatus: 400,\n\t});\n}\n\n/**\n * The answer `withValidation` gives: one `BAD_USER_INPUT` error,\n * `Invalid arguments for <operation>. <path>: <first message>`, its\n * `extensions.issues` each with its path inside the variables; status 200,\n * as a GraphQL server answers a resolver's error.\n */\nexport const badUserInputRefusal: InvalidInput = (issues, operation) => ({\n\terror: badUserInput(operation.name, new z.ZodError([...issues])),\n\tstatus: 200,\n});\n"
|
|
17
18
|
],
|
|
18
|
-
"mappings": ";AAEA;AAAA,kBAGC;AAAA;AAAA;AAAA,uBAGA;AAAA;;;ACFD;AAAA;AAAA;;;ACYA;;;AClBA;AAAA;AAAA;AAAA;AA0CO,SAAS,QAAQ,CAAC,QAA0B;AAAA,EAClD,MAAM,KAAK,OAAO,QAAQ,KAAK;AAAA,EAC/B,MAAM,UAAU,OAAO,KAAK,SAAS,OAAO,MAAM,GAAG,EAAE;AAAA,EACvD,OAAO,EAAE,MAAM,QAAQ,QAAQ,KAAK,CAAC,GAAG,YAAY,OAAO,GAAG;AAAA;AAG/D,SAAS,OAAO,CAAC,SAA0B;AAAA,EAC1C,IAAI,QAAQ,SAAS,GAAG;AAAA,IACvB,OAAO,EAAE,MAAM,YAAY,IAAI,QAAQ,QAAQ,MAAM,GAAG,EAAE,CAAC,EAAE;AAAA,EAC9D,IAAI,QAAQ,WAAW,GAAG,KAAK,QAAQ,SAAS,GAAG;AAAA,IAClD,OAAO,EAAE,MAAM,QAAQ,IAAI,QAAQ,QAAQ,MAAM,GAAG,EAAE,CAAC,EAAE;AAAA,EAC1D,OAAO,EAAE,MAAM,SAAS,MAAM,QAAQ;AAAA;AAIhC,SAAS,SAAS,CAAC,MAAuB;AAAA,EAChD,QAAQ,KAAK;AAAA,SACP;AAAA,MACJ,OAAO,GAAG,UAAU,KAAK,EAAE;AAAA,SACvB;AAAA,MACJ,OAAO,IAAI,UAAU,KAAK,EAAE;AAAA;AAAA,MAE5B,OAAO,KAAK;AAAA;AAAA;AASR,SAAS,aAAa,CAC5B,OACA,MAC8C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,IACH,aAAa,MAA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AY;AAAA,IACnB,OAAO,kBACN,OAAO,IAAI,YAAY,GACvB,YAAY,EAAE,UAAU,IAAI,CAAC,CAC9B;AAAA,IACA,QAAQ;AAAA,EACT;AAAA;AASM,IAAM,sBAAoC,CAAC,QAAQ,eAAe;AAAA,EACxE,OAAO,aAAa,UAAU,MAAM,IAAI,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC;AAAA,EAC/D,QAAQ;AACT;",
|
|
20
|
+
"debugId": "91FE470D788D891964756E2164756E21",
|
|
20
21
|
"names": []
|
|
21
22
|
}
|
|
@@ -2,7 +2,7 @@ import type { Path, RequestHandlerOptions, ResponseResolverInfo, ResponseResolve
|
|
|
2
2
|
import { type GraphQLHandler, type GraphQLQuery, type GraphQLResponseBody, type GraphQLVariables } from 'msw/graphql';
|
|
3
3
|
import type { z } from 'zod';
|
|
4
4
|
import { type InputTypes } from './coercion/index.js';
|
|
5
|
-
import type { InvalidInput } from './refusals.js';
|
|
5
|
+
import type { InvalidInput, RefusedOperation } from './refusals.js';
|
|
6
6
|
/**
|
|
7
7
|
* What a resolver receives: msw's own resolver info for a GraphQL
|
|
8
8
|
* operation (`variables`, `query`, `operationName`, `request`, `cookies`,
|
|
@@ -62,4 +62,14 @@ export interface MockedOperation {
|
|
|
62
62
|
* else it throws is msw's to answer (a 500).
|
|
63
63
|
*/
|
|
64
64
|
export declare function mockOperation<Result extends GraphQLQuery, Variables extends GraphQLVariables>(operation: MockedOperation, resolver: GraphQLMockResolver<Result, Variables>, options?: MockOptions): GraphQLHandler;
|
|
65
|
+
/**
|
|
66
|
+
* The answer to variables `operation.variables` refuses, or `undefined`
|
|
67
|
+
* when they pass: a value graphql refuses while coercing is answered as
|
|
68
|
+
* graphql-yoga answers it (status 400), any other with `invalidInput`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function refuseInvalid(operation: Pick<MockedOperation, 'variables' | 'variableTypes' | 'inputTypes' | 'invalidInput'>, info: {
|
|
71
|
+
query: string;
|
|
72
|
+
operationName: string;
|
|
73
|
+
variables: unknown;
|
|
74
|
+
}, where: RefusedOperation): Promise<Response | undefined>;
|
|
65
75
|
//# sourceMappingURL=mock-operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-operation.d.ts","sourceRoot":"","sources":["../../src/runtime/mock-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,IAAI,EACJ,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,MAAM,KAAK,CAAC;AACb,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EAErB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"mock-operation.d.ts","sourceRoot":"","sources":["../../src/runtime/mock-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,IAAI,EACJ,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,MAAM,KAAK,CAAC;AACb,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EAErB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGjE;;;;;GAKG;AACH,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,gBAAgB,IAC7D,oBAAoB,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS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c,CAoBhB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,IAAI,CACd,eAAe,EACf,WAAW,GAAG,eAAe,GAAG,YAAY,GAAG,cAAc,CAC7D,EACD,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,EAClE,KAAK,EAAE,gBAAgB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAa/B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type HttpHandler } from 'msw';
|
|
2
|
+
import type { MockedOperation, MockOptions } from './mock-operation.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a subscription handler hands the request to: the shape of
|
|
5
|
+
* `@nxgt/msw-graphql`'s `Executor` (`createExecutor({ schema })`), which
|
|
6
|
+
* streams the schema's `Subscription` resolvers as graphql-sse distinct
|
|
7
|
+
* connections. Declared here so this package needs no dependency on it.
|
|
8
|
+
*/
|
|
9
|
+
export type SubscriptionExecutor = (input: {
|
|
10
|
+
query: string;
|
|
11
|
+
variables?: Record<string, unknown> | null;
|
|
12
|
+
operationName?: string | null;
|
|
13
|
+
request: Request;
|
|
14
|
+
}) => Promise<Response>;
|
|
15
|
+
/** One subscription, as the generated file describes it. */
|
|
16
|
+
export interface MockedSubscription extends Omit<MockedOperation, 'type'> {
|
|
17
|
+
readonly type: 'subscription';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* An msw handler for one subscription: a POST to the endpoint that asks for
|
|
21
|
+
* `Accept: text/event-stream` and whose operation is the subscription named
|
|
22
|
+
* `operation.name`. Its variables are checked as a query's are, then the
|
|
23
|
+
* request goes to `execute`, whose response (the event stream) is the
|
|
24
|
+
* answer. Any other request, including this subscription sent without the
|
|
25
|
+
* event-stream `Accept`, is left to the next handler.
|
|
26
|
+
*/
|
|
27
|
+
export declare function mockSubscription(operation: MockedSubscription, execute: SubscriptionExecutor, options?: MockOptions): HttpHandler;
|
|
28
|
+
//# sourceMappingURL=mock-subscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-subscription.d.ts","sourceRoot":"","sources":["../../src/runtime/mock-subscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAQ,MAAM,KAAK,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGrE;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;CACjB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAExB,4DAA4D;AAC5D,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IACxE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC9B;AAQD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,WAAgB,GACvB,WAAW,CA0Bb"}
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import type { AnyGraphQLError } from './response.js';
|
|
4
4
|
/** The operation whose variables were refused. */
|
|
5
5
|
export interface RefusedOperation {
|
|
6
|
-
readonly type: 'query' | 'mutation';
|
|
6
|
+
readonly type: 'query' | 'mutation' | 'subscription';
|
|
7
7
|
/** The operation's name in the document: `SignUp`. */
|
|
8
8
|
readonly name: string;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refusals.d.ts","sourceRoot":"","sources":["../../src/runtime/refusals.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,kDAAkD;AAClD,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"refusals.d.ts","sourceRoot":"","sources":["../../src/runtime/refusals.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,kDAAkD;AAClD,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IACrD,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAC1B,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,EACnC,SAAS,EAAE,gBAAgB,KACvB,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,GAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAO,GAC9C,YAAY,CASd;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,YAGhC,CAAC"}
|
package/docs/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Page | Read it when |
|
|
6
6
|
| --- | --- |
|
|
7
|
-
| [Handlers](guide/handlers.md) | you want to know what the plugin writes: the handlers, where their types and schemas come from, naming, the endpoint, the resolver, how an invalid input is answered (`invalid-input`, `bad-user-input`, your own), tests under Node and Bun, and the runtime |
|
|
7
|
+
| [Handlers](guide/handlers.md) | you want to know what the plugin writes: the handlers, where their types and schemas come from, naming, the endpoint, the resolver, how an invalid input is answered (`invalid-input`, `bad-user-input`, your own), subscriptions over SSE, tests under Node and Bun, and the runtime |
|
|
8
8
|
|
|
9
9
|
## Reference
|
|
10
10
|
|
package/docs/guide/handlers.md
CHANGED
|
@@ -558,13 +558,60 @@ test('a missing user', async () => {
|
|
|
558
558
|
## What gets no handler
|
|
559
559
|
|
|
560
560
|
- **An anonymous operation**: msw matches by name, and has none to match.
|
|
561
|
-
- **A subscription**: msw 3 mocks subscriptions over WebSocket
|
|
562
|
-
(`graphql-transport-ws`) only, through another resolver shape. See the
|
|
563
|
-
[roadmap](../roadmap.md).
|
|
564
561
|
- **A fragment**: it is not an operation.
|
|
565
562
|
|
|
566
563
|
Persisted queries (a request with a hash and no query text) and batched
|
|
567
|
-
requests (an array of operations in one POST) are not matched either
|
|
564
|
+
requests (an array of operations in one POST) are not matched either: a body
|
|
565
|
+
without a `query` string, or an array, falls through to the next handler, a
|
|
566
|
+
subscription handler's included.
|
|
567
|
+
|
|
568
|
+
## Subscriptions over SSE
|
|
569
|
+
|
|
570
|
+
A named `subscription` gets `mock<Name>Subscription(execute, options?)`, an
|
|
571
|
+
msw `HttpHandler` that answers only a POST to the endpoint with
|
|
572
|
+
`Accept: text/event-stream` whose operation is that subscription. It checks
|
|
573
|
+
the variables as a query's are, then hands the request to `execute`, which
|
|
574
|
+
streams it. Pass `createExecutor({ schema })` from
|
|
575
|
+
[`@nxgt/msw-graphql`](https://www.npmjs.com/package/@nxgt/msw-graphql) (0.4.0
|
|
576
|
+
or later) and the stream comes from the schema's `Subscription` resolvers
|
|
577
|
+
(graphql-sse distinct connections: `next` events, then `complete`), with no
|
|
578
|
+
wrapper around `fetch`. Any other request, this subscription sent without the
|
|
579
|
+
event-stream `Accept` included, goes on to the next handler.
|
|
580
|
+
|
|
581
|
+
```ts
|
|
582
|
+
import { createExecutor } from '@nxgt/msw-graphql';
|
|
583
|
+
import { buildMockSchema } from '@nxgt/msw-graphql/schema';
|
|
584
|
+
import { mockItemChangedSubscription } from './generated/msw';
|
|
585
|
+
|
|
586
|
+
const typeDefs = `
|
|
587
|
+
type Item { id: ID!, name: String! }
|
|
588
|
+
type Query { item(id: ID!): Item }
|
|
589
|
+
type Subscription { itemChanged(id: ID!): Item }
|
|
590
|
+
`;
|
|
591
|
+
|
|
592
|
+
const schema = buildMockSchema({
|
|
593
|
+
typeDefs,
|
|
594
|
+
resolvers: {
|
|
595
|
+
Subscription: {
|
|
596
|
+
itemChanged: {
|
|
597
|
+
subscribe: async function* (_, { id }) {
|
|
598
|
+
yield { itemChanged: { id, name: 'first' } };
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
},
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
server.use(mockItemChangedSubscription(createExecutor({ schema })));
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
`execute` is any `(input: { query, variables, operationName, request }) =>
|
|
609
|
+
Promise<Response>`; this package does not depend on `@nxgt/msw-graphql`.
|
|
610
|
+
|
|
611
|
+
The handler is `mockSubscription` from the runtime; a `SubscriptionExecutor`
|
|
612
|
+
is the type of `execute`. An invalid input is refused before the stream with a
|
|
613
|
+
real status and a JSON `{ errors }`, as for a query. msw 3's WebSocket
|
|
614
|
+
subscriptions (`graphql-transport-ws`) are not generated.
|
|
568
615
|
|
|
569
616
|
## The runtime
|
|
570
617
|
|
package/docs/roadmap.md
CHANGED
|
@@ -15,10 +15,8 @@ Candidates, not commitments.
|
|
|
15
15
|
|
|
16
16
|
## Later
|
|
17
17
|
|
|
18
|
-
- **
|
|
19
|
-
|
|
20
|
-
input has no HTTP status there. `@nxgt/graphql-client` subscribes over SSE,
|
|
21
|
-
which msw's GraphQL subscription handler does not intercept.
|
|
18
|
+
- **msw WebSocket subscriptions** (`graphql-transport-ws`), with a resolver
|
|
19
|
+
that publishes rather than answers; SSE subscriptions are shipped.
|
|
22
20
|
- **Persisted queries**: matching a request that carries a hash and no query
|
|
23
21
|
text (`documentId`, APQ).
|
|
24
22
|
- **Batched requests**: answering an array of operations posted at once.
|
|
@@ -31,6 +29,9 @@ Candidates, not commitments.
|
|
|
31
29
|
|
|
32
30
|
## Shipped
|
|
33
31
|
|
|
32
|
+
- **Subscription handlers** — `mock<Name>Subscription(execute)` streams a
|
|
33
|
+
subscription sent with `Accept: text/event-stream` through
|
|
34
|
+
`@nxgt/msw-graphql`'s executor, from the schema's `Subscription` resolvers.
|
|
34
35
|
- **The first release** — 0.1.0. One typed msw 3 handler per named query
|
|
35
36
|
and mutation, its variables checked with `@nxgt/graphql-codegen-zod`'s
|
|
36
37
|
schemas, a value the API cannot coerce answered as graphql-yoga answers it
|
package/docs/troubleshooting.md
CHANGED
|
@@ -128,10 +128,8 @@ would collide, as their types do in the typescript plugins' files.
|
|
|
128
128
|
|
|
129
129
|
**When:** an operation is in the documents, but the generated file has no
|
|
130
130
|
`mock…` for it.
|
|
131
|
-
**Why:** it is anonymous (msw matches by name)
|
|
132
|
-
|
|
133
|
-
**Fix:** name the operation. For a subscription, use msw's own
|
|
134
|
-
`graphql.link(endpoint).subscription(name, resolver)`.
|
|
131
|
+
**Why:** it is anonymous (msw matches by name).
|
|
132
|
+
**Fix:** name the operation.
|
|
135
133
|
|
|
136
134
|
## The generated file
|
|
137
135
|
|
|
@@ -302,3 +300,11 @@ schema, and their shape may change with this package.
|
|
|
302
300
|
and `toJSON`) is answered as a GraphQL error; anything else is msw's, which
|
|
303
301
|
answers 500.
|
|
304
302
|
**Fix:** throw a `GraphQLError`, or return `errorResponse(...)`.
|
|
303
|
+
|
|
304
|
+
### A subscription handler never answers
|
|
305
|
+
|
|
306
|
+
**When:** `mock<Name>Subscription(execute)` is registered, but the request
|
|
307
|
+
falls through to the next handler or is unhandled.
|
|
308
|
+
**Why:** it answers only a POST with `Accept: text/event-stream` whose
|
|
309
|
+
operation is that subscription, named in the document (or by `operationName`).
|
|
310
|
+
**Fix:** send the header, and name the subscription operation.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxgt/graphql-codegen-msw",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A graphql-codegen plugin that writes one typed msw 3 handler per named query and
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A graphql-codegen plugin that writes one typed msw 3 handler per named query, mutation and subscription, its variables checked by the Zod schemas of @nxgt/graphql-codegen-zod and an invalid input answered as your API answers it",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@nxgt/graphql-validation": "^0.
|
|
62
|
+
"@nxgt/graphql-validation": "^0.8.0",
|
|
63
63
|
"change-case": "^5.4.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@graphql-codegen/typescript": "6.1.2",
|
|
67
67
|
"@graphql-codegen/typescript-operations": "6.1.10",
|
|
68
68
|
"@mswjs/interceptors": "0.45.7",
|
|
69
|
-
"@nxgt/graphql-codegen-zod": "^0.
|
|
69
|
+
"@nxgt/graphql-codegen-zod": "^0.4.0",
|
|
70
70
|
"@types/bun": "^1.4.0",
|
|
71
71
|
"graphql": "16.11.0",
|
|
72
72
|
"msw": "3.0.3",
|