@nxgt/graphql-validation 0.5.0 → 0.6.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.
Files changed (35) hide show
  1. package/README.md +54 -6
  2. package/dist/bad-user-input.d.ts +17 -2
  3. package/dist/bad-user-input.d.ts.map +1 -1
  4. package/dist/builder/check-constraints.d.ts +4 -2
  5. package/dist/builder/check-constraints.d.ts.map +1 -1
  6. package/dist/builder/declared.d.ts +12 -0
  7. package/dist/builder/declared.d.ts.map +1 -0
  8. package/dist/chunks/{index-xcaf9kes.js → index-atwkcfg3.js} +5 -5
  9. package/dist/chunks/{index-xcaf9kes.js.map → index-atwkcfg3.js.map} +2 -2
  10. package/dist/chunks/{index-twevz7yc.js → index-w9pw7fsk.js} +68 -34
  11. package/dist/chunks/{index-twevz7yc.js.map → index-w9pw7fsk.js.map} +6 -5
  12. package/dist/cli.js +1 -1
  13. package/dist/codegen.js +2 -2
  14. package/dist/index.d.ts +3 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +380 -10
  17. package/dist/index.js.map +10 -5
  18. package/dist/limits/describe.d.ts +9 -0
  19. package/dist/limits/describe.d.ts.map +1 -0
  20. package/dist/limits/introspection.d.ts +12 -0
  21. package/dist/limits/introspection.d.ts.map +1 -0
  22. package/dist/limits/list-size.d.ts +15 -0
  23. package/dist/limits/list-size.d.ts.map +1 -0
  24. package/dist/limits/max-depth.d.ts +28 -0
  25. package/dist/limits/max-depth.d.ts.map +1 -0
  26. package/dist/limits/max-list-cost.d.ts +62 -0
  27. package/dist/limits/max-list-cost.d.ts.map +1 -0
  28. package/dist/with-validation.d.ts.map +1 -1
  29. package/docs/README.md +1 -0
  30. package/docs/guide/constraints.md +3 -3
  31. package/docs/guide/errors.md +12 -3
  32. package/docs/guide/query-limits.md +206 -0
  33. package/docs/roadmap.md +4 -0
  34. package/docs/troubleshooting.md +53 -0
  35. package/package.json +1 -1
package/README.md CHANGED
@@ -151,8 +151,8 @@ formats, or none, it throws. Without `formats`, nothing changes. Details in
151
151
  "extensions": {
152
152
  "code": "BAD_USER_INPUT",
153
153
  "issues": [
154
- { "path": ["input", "email"], "message": "Invalid email address", "code": "invalid_format", "constraint": "format" },
155
- { "path": ["input", "age"], "message": "Too small: expected number to be >=18", "code": "too_small", "constraint": "min" }
154
+ { "path": ["input", "email"], "message": "Invalid email address", "code": "invalid_format", "constraint": "format", "value": "email" },
155
+ { "path": ["input", "age"], "message": "Too small: expected number to be >=18", "code": "too_small", "constraint": "min", "value": 18 }
156
156
  ]
157
157
  }
158
158
  }
@@ -161,7 +161,9 @@ formats, or none, it throws. Without `formats`, nothing changes. Details in
161
161
  ```
162
162
 
163
163
  `issues[].path` is relative to the arguments, and `issues[].constraint` names the
164
- `@constraint` argument that refused. Mapping issues to form fields is
164
+ `@constraint` argument that refused, with `issues[].value` the value it was
165
+ declared with (`18` for `min: 18`): "at least 18" without parsing `message`.
166
+ Mapping issues to form fields is
165
167
  in [Errors](docs/guide/errors.md).
166
168
 
167
169
  ### Rules a directive cannot say
@@ -234,6 +236,49 @@ if (!result.success)
234
236
  The codes, and `fieldsError`, are in
235
237
  [Answering invalid input as one error](docs/guide/invalid-input.md).
236
238
 
239
+ ### Limiting the depth and cost of a query
240
+
241
+ A schema with list cycles (`Folder.items` returns items, `Item.folder` returns
242
+ its folder) lets a client nest a query whose cost grows exponentially.
243
+ `maxDepth` and `maxListCost` are graphql-js validation rules that refuse such a
244
+ query before any resolver runs.
245
+
246
+ ```ts
247
+ import { maxDepth, maxListCost } from '@nxgt/graphql-validation';
248
+ import { parse, specifiedRules, validate } from 'graphql';
249
+
250
+ const rules = [maxDepth({ depth: 8 }), maxListCost({ budget: 10_000, defaultFirst: 50 })];
251
+ const errors = validate(schema, parse(query), [...specifiedRules, ...rules]);
252
+ ```
253
+
254
+ ```ts
255
+ // graphql-yoga
256
+ import { maxDepth, maxListCost } from '@nxgt/graphql-validation';
257
+ import { createYoga } from 'graphql-yoga';
258
+
259
+ const yoga = createYoga({
260
+ schema,
261
+ plugins: [
262
+ {
263
+ onValidate: ({ addValidationRule }) => {
264
+ addValidationRule(maxDepth({ depth: 8 }));
265
+ addValidationRule(maxListCost({ budget: 10_000, defaultFirst: 50 }));
266
+ },
267
+ },
268
+ ],
269
+ });
270
+ ```
271
+
272
+ One `GraphQLError` per operation: `extensions: { code: 'QUERY_TOO_DEEP', depth,
273
+ limit }` or `{ code: 'QUERY_TOO_COSTLY', cost, limit }`. A list field is sized by
274
+ its `first`, `last` or `limit` argument; a variable, a negative number or no
275
+ argument uses the argument's SDL default, else `defaultFirst`. A size is an
276
+ Int, a canonical-integer string or an integral Float; the largest of several
277
+ size arguments wins. Introspection is
278
+ counted too; add `ignoreIntrospection: true` where it is trusted (GraphiQL in
279
+ development). See
280
+ [Limiting the depth and cost of a query](docs/guide/query-limits.md).
281
+
237
282
  ## IDE support
238
283
 
239
284
  An IDE's GraphQL plugin (JetBrains GraphQL, VS Code GraphQL) reads your `.graphql`
@@ -284,7 +329,10 @@ the directive declared is this package's. Both at once throw
284
329
  | `FIELD_CODES` | those codes, keyed `tooShort`, `tooLong`, `outOfRange`, `tooFew`, `tooMany`, `invalidFormat`, `invalid` |
285
330
  | `INVALID_INPUT` | `'validation.errors.invalid-input'` |
286
331
  | `FieldIssue`, `FieldError`, `IssueParams`, `Translate`, `InvalidInputOptions`, `FieldsErrorOptions` | their types: an issue you write, a `fields` entry, its params, your translator, the options |
287
- | `ValidationIssue`, `BadUserInputExtensions` | the types of `extensions.issues` and `extensions` |
332
+ | `ValidationIssue`, `ConstraintValue`, `BadUserInputExtensions` | the types of `extensions.issues`, of an issue's `value`, and of `extensions` |
333
+ | `maxDepth({ depth, ignoreIntrospection? })` | a graphql-js validation rule refusing an operation nested deeper than `depth` fields, `extensions.code` `QUERY_TOO_DEEP`; introspection counts (the standard query is 15 levels) unless `ignoreIntrospection` |
334
+ | `maxListCost({ budget, defaultFirst, sizeArguments?, ignoreIntrospection? })` | a graphql-js validation rule refusing an operation whose list-weighted cost is over `budget`, `extensions.code` `QUERY_TOO_COSTLY`; `sizeArguments` names the arguments sizing a list (default `first`, `last`, `limit`, the largest wins); `ignoreIntrospection` skips `__schema` and `__type` |
335
+ | `MaxDepthOptions`, `MaxListCostOptions` | their options |
288
336
  | `ConstraintArgument` | the type of `issues[].constraint`: `'minLength' \| 'format' \| ...` |
289
337
  | `ArgsSchema`, `ArgsSchemaFor`, `SchemaOf` | the types `validated` accepts: the schema or shape, and that or the function building it from the context |
290
338
  | `WithValidationOptions`, `FormatSchemas`, `OwnFormats`, `StringSchema`, `FormatName` | the types of `withValidation`'s options: a record of string schemas, with no built-in format name (`FormatName`) |
@@ -295,7 +343,7 @@ refuses the schemas `withValidation` refuses. A server does not need it.
295
343
 
296
344
  | Export | Is |
297
345
  | --- | --- |
298
- | `checkConstraints(schema, onArgs?, formats?)` | runs every startup check of `withValidation` without wrapping anything; returns the `@constraint` directive, or `undefined` when the schema declares none. `formats` is the record `withValidation` takes, checked the same way |
346
+ | `checkConstraints(schema, onArgs?, formats?)` | runs every startup check of `withValidation` without wrapping anything (`onArgs(type, field, args, declared)`: `declared(path)` lists the `Constraint`s the field's SDL writes where a Zod issue's `path` points); returns the `@constraint` directive, or `undefined` when the schema declares none. `formats` is the record `withValidation` takes, checked the same way |
299
347
  | `constraintsOn(directive, node)` | the `Constraint`s written on an argument or input field (`arg.astNode`), `format` first |
300
348
  | `inputCode(type, constraints, where, named, options?, formats?)` | the schema of that argument or field as source, `z` a free identifier: built-in scalars and lists written in full, nullable types `.nullish()`; every other named type (enum, input object, custom scalar) is what `named(type)` returns. A constraint that cannot apply throws the startup message, naming `where`. `options` (`InputCodeOptions`): `list({ type, code, single })` returns each list's source, given `code` (the array with every rule) and `single` (the list's named type, non-null, without rules), e.g. to take a single value as graphql does: `single`, wrapped, piped into `code`. `format(name)` returns the source of one of your formats, since only the generator knows where your record is imported from: a reference to your schema, which the other rules narrow (`formatSchemas.siret.max(14)`); built-in formats never reach it. `formats`: the record `withValidation` takes, checked the same way, so its names are known; a field using one of them without the `format` option throws `@constraint(format: "<name>") is one of the application's formats: its source is the code generator's to write, through inputCode's format option.` |
301
349
  | `FormatSchemas` | the type of that record |
@@ -343,6 +391,6 @@ Every startup error and its fix is in [Troubleshooting](docs/troubleshooting.md)
343
391
  ## Documentation
344
392
 
345
393
  - [Documentation index](docs/README.md)
346
- - Guides: [Constraints](docs/guide/constraints.md), [Errors](docs/guide/errors.md), [Answering invalid input as one error](docs/guide/invalid-input.md)
394
+ - Guides: [Constraints](docs/guide/constraints.md), [Errors](docs/guide/errors.md), [Answering invalid input as one error](docs/guide/invalid-input.md), [Limiting the depth and cost of a query](docs/guide/query-limits.md)
347
395
  - [Troubleshooting](docs/troubleshooting.md)
348
396
  - [Roadmap](docs/roadmap.md): schemas that read the context, emitting the invalid-input shape directly
@@ -14,14 +14,29 @@ export interface ValidationIssue {
14
14
  * refusal of `validated()`'s own schema.
15
15
  */
16
16
  readonly constraint?: ConstraintArgument;
17
+ /**
18
+ * What that `@constraint` argument was declared with, exactly as written
19
+ * (`100` for `maxLength: 100`, `"email"` for `format: "email"`), so a
20
+ * client can say "at most 100 characters" without parsing `message`.
21
+ * Present exactly when `constraint` is.
22
+ */
23
+ readonly value?: ConstraintValue;
17
24
  }
25
+ /** What a `@constraint` argument is declared with: a number or a string. */
26
+ export type ConstraintValue = string | number;
18
27
  /** The `extensions` of the error an invalid input becomes. */
19
28
  export type BadUserInputExtensions = {
20
29
  readonly code: 'BAD_USER_INPUT';
21
30
  readonly issues: readonly ValidationIssue[];
22
31
  };
23
- /** Names the `@constraint` argument behind an issue, when there is one. */
24
- export type ConstraintOf = (issue: z.core.$ZodIssue) => ConstraintArgument | undefined;
32
+ /**
33
+ * Names the `@constraint` argument behind an issue, and what it was declared
34
+ * with, when there is one.
35
+ */
36
+ export type ConstraintOf = (issue: z.core.$ZodIssue) => {
37
+ argument: ConstraintArgument;
38
+ value: ConstraintValue;
39
+ } | undefined;
25
40
  /**
26
41
  * The one error an invalid input becomes: `extensions.code` is
27
42
  * `BAD_USER_INPUT`, the code Apollo and most clients already read, and
@@ -1 +1 @@
1
- {"version":3,"file":"bad-user-input.d.ts","sourceRoot":"","sources":["../src/bad-user-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,8DAA8D;AAC9D,MAAM,MAAM,sBAAsB,GAAG;IACpC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CAC5C,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,CAC1B,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,KACnB,kBAAkB,GAAG,SAAS,CAAC;AA4BpC;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,YAAY,CAE3E;AAED,oFAAoF;AACpF,wBAAsB,SAAS,CAC9B,MAAM,EAAE,CAAC,CAAC,OAAO,EACjB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,YAAY,GACzB,OAAO,CAAC,OAAO,CAA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,EACjB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,YAAY,GACzB,OAAO,CAAC,OAAO,CAAC,CAKlB"}
@@ -1,13 +1,15 @@
1
1
  import { type GraphQLDirective, type GraphQLField, type GraphQLObjectType, type GraphQLSchema } from 'graphql';
2
2
  import type { z } from 'zod';
3
3
  import { type FormatSchemas } from '../formats/registry.js';
4
+ import { type Constraint } from './constraints.js';
4
5
  /**
5
6
  * Runs every check `withValidation` makes at startup, so a code generator
6
7
  * refuses the same schemas: the declaration is `constraintTypeDefs`', every
7
8
  * constraint applies where it is written (in every input type), none sits on
8
9
  * a directive's argument, objects keep their interfaces' constraints, and no
9
10
  * default value breaks its own. `onArgs` receives each object field's
10
- * arguments schema, for a field with something to check.
11
+ * arguments schema, for a field with something to check, and `declared`
12
+ * the `@constraint`s the field's SDL writes where an issue's path points.
11
13
  *
12
14
  * `formats` are the application's own, which `@constraint(format: "...")`
13
15
  * may name beside the built-in ones; they are checked first (name, no
@@ -16,5 +18,5 @@ import { type FormatSchemas } from '../formats/registry.js';
16
18
  * Returns the `@constraint` directive, or `undefined` when the schema
17
19
  * declares none (and so carries no constraint).
18
20
  */
19
- export declare function checkConstraints(schema: GraphQLSchema, onArgs?: (type: GraphQLObjectType, field: GraphQLField<unknown, unknown>, args: z.ZodType) => void, formats?: FormatSchemas): GraphQLDirective | undefined;
21
+ export declare function checkConstraints(schema: GraphQLSchema, onArgs?: (type: GraphQLObjectType, field: GraphQLField<unknown, unknown>, args: z.ZodType, declared: (path: readonly PropertyKey[]) => readonly Constraint[]) => void, formats?: FormatSchemas): GraphQLDirective | undefined;
20
22
  //# sourceMappingURL=check-constraints.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"check-constraints.d.ts","sourceRoot":"","sources":["../../src/builder/check-constraints.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAGlB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,qBAAqB,CAAC;AAKrE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,CACR,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,EACrC,IAAI,EAAE,CAAC,CAAC,OAAO,KACX,IAAI,EACT,OAAO,CAAC,EAAE,aAAa,GACrB,gBAAgB,GAAG,SAAS,CAyB9B"}
1
+ {"version":3,"file":"check-constraints.d.ts","sourceRoot":"","sources":["../../src/builder/check-constraints.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAGlB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,eAAe,CAAC;AAI/D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,CACR,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,EACrC,IAAI,EAAE,CAAC,CAAC,OAAO,EACf,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,KAAK,SAAS,UAAU,EAAE,KAC7D,IAAI,EACT,OAAO,CAAC,EAAE,aAAa,GACrB,gBAAgB,GAAG,SAAS,CA0B9B"}
@@ -0,0 +1,12 @@
1
+ import { type GraphQLField } from 'graphql';
2
+ import { type Constraint } from './constraints.js';
3
+ import type { InputSchemas } from './input-schema.js';
4
+ /**
5
+ * The `@constraint` arguments written where a Zod issue's `path` points, in
6
+ * a field's arguments: the argument or input field it ends on, or, under a
7
+ * list, the list's own rules (`minItems`, `maxItems`) at the list and its
8
+ * items' at an index, as `InputSchemas` splits them. Empty when the path
9
+ * leaves the declared types.
10
+ */
11
+ export declare function declaredAt(inputs: InputSchemas, field: GraphQLField<unknown, unknown>, path: readonly PropertyKey[]): readonly Constraint[];
12
+ //# sourceMappingURL=declared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared.d.ts","sourceRoot":"","sources":["../../src/builder/declared.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EAMjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,EACrC,IAAI,EAAE,SAAS,WAAW,EAAE,GAC1B,SAAS,UAAU,EAAE,CAyBvB"}
@@ -13,9 +13,6 @@ var __export = (target, all) => {
13
13
  });
14
14
  };
15
15
 
16
- // src/constraint-directive.ts
17
- import { DirectiveLocation } from "graphql";
18
-
19
16
  // src/rules/all.ts
20
17
  var exports_all = {};
21
18
  __export(exports_all, {
@@ -36,6 +33,9 @@ __export(exports_all, {
36
33
  startsWithRule: () => startsWithRule
37
34
  });
38
35
 
36
+ // src/constraint-directive.ts
37
+ import { DirectiveLocation } from "graphql";
38
+
39
39
  // src/rules/rule.ts
40
40
  var RULE_PARAM = "nxgtConstraint";
41
41
  function defineRule(rule) {
@@ -242,5 +242,5 @@ function assertOwnConstraint(directive) {
242
242
 
243
243
  export { __export, RULE_PARAM, rules, applyRule, applyRuleCode, constraintOf, constraintTypeDefs2, assertOwnConstraint };
244
244
 
245
- //# debugId=AD9C9BDBBBE92EA564756E2164756E21
246
- //# sourceMappingURL=index-xcaf9kes.js.map
245
+ //# debugId=02497C6067AC4D4564756E2164756E21
246
+ //# sourceMappingURL=index-atwkcfg3.js.map
@@ -21,7 +21,7 @@
21
21
  "import { defineRule, literal } from './rule';\n\nexport const startsWithRule = defineRule({\n\targument: 'startsWith',\n\ttype: 'String',\n\ttarget: 'string',\n\ttoZod: (schema, value) => schema.startsWith(value),\n\ttoCode: (schema, value) => `${schema}.startsWith(${literal(value)})`,\n\towns: (issue) => issue.format === 'starts_with',\n});\n",
22
22
  "import type { z } from 'zod';\nimport * as all from './all';\nimport { type IssueFields, RULE_PARAM, type RuleContext } from './rule';\n\n/**\n * One of the rules, as its own type: a builder narrows it on `target`, so a\n * number schema never reaches a string rule.\n */\nexport type RegisteredRule = (typeof all)[keyof typeof all];\n\n/** An argument `@constraint` takes. */\nexport type ConstraintArgument = RegisteredRule['argument'];\n\n/**\n * Every rule, keyed by its `@constraint` argument. Derived from what\n * `./all` exports, so a new rule is one file and one line there, and the\n * directive's SDL follows.\n */\nexport const rules = Object.fromEntries(\n\tObject.values(all).map((rule) => [rule.argument, rule]),\n) as {\n\treadonly [A in ConstraintArgument]: Extract<RegisteredRule, { argument: A }>;\n};\n\n/**\n * Applies a rule to a schema its caller has already matched to the rule's\n * target: the one place the rule's typed `toZod` meets a schema built from\n * GraphQL types, which the compiler cannot relate.\n */\nexport function applyRule(\n\trule: RegisteredRule,\n\tschema: z.ZodType,\n\tvalue: string | number,\n\tcontext: RuleContext,\n): z.ZodType {\n\tconst toZod = rule.toZod as unknown as (\n\t\tschema: z.ZodType,\n\t\tvalue: string | number,\n\t\tcontext: RuleContext,\n\t) => z.ZodType;\n\treturn toZod(schema, value, context);\n}\n\n/** `applyRule` for source: the rule's typed `toCode` on a schema's source. */\nexport function applyRuleCode(\n\trule: RegisteredRule,\n\tsource: string,\n\tvalue: string | number,\n\tcontext: RuleContext,\n): string {\n\tconst toCode = rule.toCode as (\n\t\tschema: string,\n\t\tvalue: string | number,\n\t\tcontext: RuleContext,\n\t) => string;\n\treturn toCode(source, value, context);\n}\n\n/**\n * The `@constraint` argument whose rule refused with this issue, if any: the\n * one the issue is marked with (an application format's), else the one rule\n * that owns its shape.\n */\nexport function constraintOf(\n\tissue: z.core.$ZodIssue,\n): ConstraintArgument | undefined {\n\tconst fields = issue as unknown as IssueFields;\n\tconst marked = fields.params?.[RULE_PARAM];\n\tif (typeof marked === 'string' && Object.hasOwn(rules, marked))\n\t\treturn marked as ConstraintArgument;\n\treturn Object.values(rules).find((rule) => rule.owns(fields))?.argument;\n}\n"
23
23
  ],
24
- "mappings": ";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACoFO,IAAM,aAAa;AAGnB,SAAS,UAIf,CAAC,MAAoC;AAAA,EACrC,OAAO;AAAA;AAID,IAAM,UAAU,CAAC,UAA0B,KAAK,UAAU,KAAK;;;AC9F/D,IAAM,eAAe,WAAW;AAAA,EACtC,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO,CAAC,QAAQ,UAAU,OAAO,SAAS,KAAK;AAAA,EAC/C,QAAQ,CAAC,QAAQ,UAAU,GAAG,mBAAmB,QAAQ,KAAK;AAAA,EAC9D,MAAM,CAAC,UAAU,MAAM,WAAW;AACnC,CAAC;;ACPM,IAAM,eAAe,WAAW;AAAA,EACtC,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO,CAAC,QAAQ,UAAU,OAAO,SAAS,KAAK;AAAA,EAC/C,QAAQ,CAAC,QAAQ,UAAU,GAAG,mBAAmB,QAAQ,KAAK;AAAA,EAC9D,MAAM,CAAC,UAAU,MAAM,WAAW;AACnC,CAAC;;ACPM,IAAM,mBAAmB,WAAW;AAAA,EAC1C,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO,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AAC,SAAS,IAAK,KAAK,aAAa,KAAK,MAAM,EAChD,KAAK;AAAA,CAAI;AAAA;AAAA;AAIX,IAAM,UAAU,IAAI,IAAY;AAAA,EAC/B,kBAAkB;AAAA,EAClB,kBAAkB;AACnB,CAAC;AASM,SAAS,mBAAmB,CAAC,WAAmC;AAAA,EACtE,MAAM,WAAW;AAAA,IAChB,GAAI,UAAU,eACX,CAAC,4CAA4C,IAC7C,CAAC;AAAA,IACJ,GAAG,UAAU,UACX,OAAO,CAAC,aAAa,CAAC,QAAQ,IAAI,QAAQ,CAAC,EAC3C,IAAI,CAAC,aAAa,cAAc,UAAU;AAAA,IAC5C,GAAG,UAAU,KAAK,QAAQ,CAAC,QAAQ;AAAA,MAClC,MAAM,OAAQ,MACb,IAAI;AAAA,MAEL,IAAI,CAAC;AAAA,QAAM,OAAO,CAAC,YAAY,IAAI,2BAA2B;AAAA,MAC9D,MAAM,OAAO,OAAO,IAAI,IAAI;AAAA,MAC5B,OAAO,SAAS,KAAK,OAClB,CAAC,IACD,CAAC,YAAY,IAAI,SAAS,aAAa,KAAK,MAAM;AAAA,KACrD;AAAA,EACF;AAAA,EACA,IAAI,SAAS,SAAS,GAAG;AAAA,IACxB,MAAM,IAAI,MACT,+DAA+D,SAAS,KAAK,IAAI,wCAClF;AAAA,EACD;AAAA;",
25
+ "debugId": "02497C6067AC4D4564756E2164756E21",
26
26
  "names": []
27
27
  }
@@ -4,27 +4,7 @@ import {
4
4
  rules,
5
5
  applyRule,
6
6
  assertOwnConstraint
7
- } from "./index-xcaf9kes.js";
8
-
9
- // src/builder/constraints.ts
10
- import {
11
- getDirectiveValues
12
- } from "graphql";
13
- function constraintsOn2(directive, node) {
14
- if (!directive || !node)
15
- return [];
16
- const values = getDirectiveValues(directive, { directives: node.directives ?? [] }) ?? {};
17
- return Object.entries(values).filter(([, value]) => value !== undefined && value !== null).map(([argument, value]) => ({
18
- rule: rules[argument],
19
- value
20
- })).sort((a, b) => Number(Boolean(b.rule.base)) - Number(Boolean(a.rule.base)));
21
- }
22
-
23
- // src/builder/check-constraints.ts
24
- import {
25
- isInterfaceType,
26
- isObjectType
27
- } from "graphql";
7
+ } from "./index-atwkcfg3.js";
28
8
 
29
9
  // src/formats/all.ts
30
10
  var exports_all = {};
@@ -39,6 +19,12 @@ __export(exports_all, {
39
19
  uuidFormat: () => uuidFormat
40
20
  });
41
21
 
22
+ // src/builder/check-constraints.ts
23
+ import {
24
+ isInterfaceType,
25
+ isObjectType
26
+ } from "graphql";
27
+
42
28
  // src/formats/byte.ts
43
29
  import { z } from "zod";
44
30
 
@@ -276,6 +262,22 @@ function registryOf(own) {
276
262
 
277
263
  // src/builder/args-schema.ts
278
264
  import { z as z10 } from "zod";
265
+
266
+ // src/builder/constraints.ts
267
+ import {
268
+ getDirectiveValues
269
+ } from "graphql";
270
+ function constraintsOn2(directive, node) {
271
+ if (!directive || !node)
272
+ return [];
273
+ const values = getDirectiveValues(directive, { directives: node.directives ?? [] }) ?? {};
274
+ return Object.entries(values).filter(([, value]) => value !== undefined && value !== null).map(([argument, value]) => ({
275
+ rule: rules[argument],
276
+ value
277
+ })).sort((a, b) => Number(Boolean(b.rule.base)) - Number(Boolean(a.rule.base)));
278
+ }
279
+
280
+ // src/builder/args-schema.ts
279
281
  function argsSchemaOf(inputs, parent, field) {
280
282
  if (!field.args.some((arg) => inputs.needsCheck(arg)))
281
283
  return;
@@ -307,12 +309,44 @@ function assertInterfaceConstraintsKept(inputs, type) {
307
309
  }
308
310
  }
309
311
 
310
- // src/builder/input-schema.ts
312
+ // src/builder/declared.ts
311
313
  import {
312
314
  getNamedType,
313
315
  isInputObjectType,
314
316
  isListType,
315
- isNonNullType,
317
+ isNonNullType
318
+ } from "graphql";
319
+ function declaredAt(inputs, field, path) {
320
+ const [name, ...rest] = path;
321
+ const arg = field.args.find((candidate) => candidate.name === name);
322
+ if (!arg)
323
+ return [];
324
+ let type = arg.type;
325
+ let constraints = constraintsOn2(inputs.directive, arg.astNode);
326
+ for (const key of rest) {
327
+ const unwrapped = isNonNullType(type) ? type.ofType : type;
328
+ if (isListType(unwrapped) && typeof key === "number") {
329
+ constraints = constraints.filter(({ rule }) => rule.target !== "list");
330
+ type = unwrapped.ofType;
331
+ continue;
332
+ }
333
+ const named = getNamedType(unwrapped);
334
+ const next = !isListType(unwrapped) && isInputObjectType(named) ? named.getFields()[String(key)] : undefined;
335
+ if (!next)
336
+ return [];
337
+ type = next.type;
338
+ constraints = constraintsOn2(inputs.directive, next.astNode);
339
+ }
340
+ const onList = isListType(isNonNullType(type) ? type.ofType : type);
341
+ return constraints.filter(({ rule }) => rule.target === "list" === onList);
342
+ }
343
+
344
+ // src/builder/input-schema.ts
345
+ import {
346
+ getNamedType as getNamedType2,
347
+ isInputObjectType as isInputObjectType2,
348
+ isListType as isListType2,
349
+ isNonNullType as isNonNullType2,
316
350
  valueFromAST
317
351
  } from "graphql";
318
352
  import { z as z12 } from "zod";
@@ -392,7 +426,7 @@ class InputSchemas {
392
426
  constructor(schema, formats = registryOf()) {
393
427
  this.#context = { formats };
394
428
  this.directive = schema.getDirective("constraint") ?? undefined;
395
- const objects = Object.values(schema.getTypeMap()).filter(isInputObjectType);
429
+ const objects = Object.values(schema.getTypeMap()).filter(isInputObjectType2);
396
430
  for (let changed = true;changed; ) {
397
431
  changed = false;
398
432
  for (const type of objects) {
@@ -407,12 +441,12 @@ class InputSchemas {
407
441
  }
408
442
  }
409
443
  isConstrained(type) {
410
- const named = getNamedType(type);
411
- return isInputObjectType(named) && this.#constrained.has(named.name);
444
+ const named = getNamedType2(type);
445
+ return isInputObjectType2(named) && this.#constrained.has(named.name);
412
446
  }
413
447
  buildAll(schema) {
414
448
  for (const type of Object.values(schema.getTypeMap())) {
415
- if (isInputObjectType(type))
449
+ if (isInputObjectType2(type))
416
450
  this.#object(type);
417
451
  }
418
452
  }
@@ -446,14 +480,14 @@ class InputSchemas {
446
480
  }
447
481
  }
448
482
  #typed(type, constraints, where) {
449
- if (isNonNullType(type))
483
+ if (isNonNullType2(type))
450
484
  return this.#required(type.ofType, constraints, where);
451
485
  return this.#required(type, constraints, where).nullish();
452
486
  }
453
487
  #required(type, constraints, where) {
454
- if (isNonNullType(type))
488
+ if (isNonNullType2(type))
455
489
  return this.#required(type.ofType, constraints, where);
456
- if (isListType(type)) {
490
+ if (isListType2(type)) {
457
491
  const own = constraints.filter(({ rule }) => rule.target === "list");
458
492
  const items = constraints.filter(({ rule }) => rule.target !== "list");
459
493
  let list = z12.array(this.#typed(type.ofType, items, where));
@@ -461,7 +495,7 @@ class InputSchemas {
461
495
  list = applyRule(rule, list, value, this.#context);
462
496
  return list;
463
497
  }
464
- if (isInputObjectType(type)) {
498
+ if (isInputObjectType2(type)) {
465
499
  assertObjectTargets(type.name, constraints, where);
466
500
  return this.#object(type);
467
501
  }
@@ -505,7 +539,7 @@ function checkConstraints2(schema, onArgs, formats) {
505
539
  for (const field of Object.values(type.getFields())) {
506
540
  const args = argsSchemaOf(inputs, type.name, field);
507
541
  if (args)
508
- onArgs?.(type, field, args);
542
+ onArgs?.(type, field, args, (path) => declaredAt(inputs, field, path));
509
543
  }
510
544
  }
511
545
  inputs.checkDefaults();
@@ -523,5 +557,5 @@ function assertNoDirectiveArgumentConstrained(inputs, schema) {
523
557
 
524
558
  export { registryOf, constraintsOn2, assertLeafTargets, assertObjectTargets, baseCode, checkConstraints2 };
525
559
 
526
- //# debugId=F2C2C0D2BA61CB1B64756E2164756E21
527
- //# sourceMappingURL=index-twevz7yc.js.map
560
+ //# debugId=418E0FAAA9B9E68E64756E2164756E21
561
+ //# sourceMappingURL=index-w9pw7fsk.js.map
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/builder/constraints.ts", "../src/builder/check-constraints.ts", "../src/formats/byte.ts", "../src/formats/format.ts", "../src/formats/date.ts", "../src/formats/date-time.ts", "../src/formats/email.ts", "../src/formats/ipv4.ts", "../src/formats/ipv6.ts", "../src/formats/uri.ts", "../src/formats/uuid.ts", "../src/formats/index.ts", "../src/formats/marked.ts", "../src/formats/registry.ts", "../src/builder/args-schema.ts", "../src/builder/input-schema.ts", "../src/builder/leaf.ts"],
3
+ "sources": ["../src/builder/check-constraints.ts", "../src/formats/byte.ts", "../src/formats/format.ts", "../src/formats/date.ts", "../src/formats/date-time.ts", "../src/formats/email.ts", "../src/formats/ipv4.ts", "../src/formats/ipv6.ts", "../src/formats/uri.ts", "../src/formats/uuid.ts", "../src/formats/index.ts", "../src/formats/marked.ts", "../src/formats/registry.ts", "../src/builder/args-schema.ts", "../src/builder/constraints.ts", "../src/builder/declared.ts", "../src/builder/input-schema.ts", "../src/builder/leaf.ts"],
4
4
  "sourcesContent": [
5
- "import {\n\ttype DirectiveNode,\n\ttype GraphQLDirective,\n\tgetDirectiveValues,\n} from 'graphql';\nimport { type RegisteredRule, rules } from '../rules';\n\n/** One `@constraint` argument written on an argument or an input field. */\nexport interface Constraint {\n\treadonly rule: RegisteredRule;\n\treadonly value: string | number;\n}\n\n/**\n * The constraints written on a node, base rules (`format`) first so the\n * others narrow the schema they produce. Empty when the schema declares no\n * `@constraint` or the node carries none.\n */\nexport function constraintsOn(\n\tdirective: GraphQLDirective | undefined,\n\tnode:\n\t\t| { readonly directives?: ReadonlyArray<DirectiveNode> | undefined }\n\t\t| null\n\t\t| undefined,\n): Constraint[] {\n\tif (!directive || !node) return [];\n\tconst values =\n\t\tgetDirectiveValues(directive, { directives: node.directives ?? [] }) ?? {};\n\treturn Object.entries(values)\n\t\t.filter(([, value]) => value !== undefined && value !== null)\n\t\t.map(([argument, value]) => ({\n\t\t\trule: rules[argument as keyof typeof rules],\n\t\t\tvalue: value as string | number,\n\t\t}))\n\t\t.sort(\n\t\t\t(a, b) => Number(Boolean(b.rule.base)) - Number(Boolean(a.rule.base)),\n\t\t);\n}\n",
6
- "import {\n\ttype GraphQLDirective,\n\ttype GraphQLField,\n\ttype GraphQLObjectType,\n\ttype GraphQLSchema,\n\tisInterfaceType,\n\tisObjectType,\n} from 'graphql';\nimport type { z } from 'zod';\nimport { assertOwnConstraint } from '../constraint-directive';\nimport { type FormatSchemas, registryOf } from '../formats/registry';\nimport { argsSchemaOf, assertInterfaceConstraintsKept } from './args-schema';\nimport { constraintsOn } from './constraints';\nimport { InputSchemas } from './input-schema';\n\n/**\n * Runs every check `withValidation` makes at startup, so a code generator\n * refuses the same schemas: the declaration is `constraintTypeDefs`', every\n * constraint applies where it is written (in every input type), none sits on\n * a directive's argument, objects keep their interfaces' constraints, and no\n * default value breaks its own. `onArgs` receives each object field's\n * arguments schema, for a field with something to check.\n *\n * `formats` are the application's own, which `@constraint(format: \"...\")`\n * may name beside the built-in ones; they are checked first (name, no\n * built-in replaced, a Zod string schema each).\n *\n * Returns the `@constraint` directive, or `undefined` when the schema\n * declares none (and so carries no constraint).\n */\nexport function checkConstraints(\n\tschema: GraphQLSchema,\n\tonArgs?: (\n\t\ttype: GraphQLObjectType,\n\t\tfield: GraphQLField<unknown, unknown>,\n\t\targs: z.ZodType,\n\t) => void,\n\tformats?: FormatSchemas,\n): GraphQLDirective | undefined {\n\tconst inputs = new InputSchemas(schema, registryOf(formats));\n\tif (!inputs.directive) return undefined;\n\tassertOwnConstraint(inputs.directive);\n\tinputs.buildAll(schema);\n\tassertNoDirectiveArgumentConstrained(inputs, schema);\n\tfor (const type of Object.values(schema.getTypeMap())) {\n\t\tif (type.name.startsWith('__')) continue;\n\t\t// An interface's fields resolve on its objects: built for their errors only.\n\t\tif (isInterfaceType(type)) {\n\t\t\tfor (const field of Object.values(type.getFields()))\n\t\t\t\targsSchemaOf(inputs, type.name, field);\n\t\t}\n\t\tif (!isObjectType(type)) continue;\n\t\tassertInterfaceConstraintsKept(inputs, type);\n\t\tfor (const field of Object.values(type.getFields()) as GraphQLField<\n\t\t\tunknown,\n\t\t\tunknown\n\t\t>[]) {\n\t\t\tconst args = argsSchemaOf(inputs, type.name, field);\n\t\t\tif (args) onArgs?.(type, field, args);\n\t\t}\n\t}\n\tinputs.checkDefaults();\n\treturn inputs.directive;\n}\n\n/**\n * Fails on a `@constraint` written on a directive's argument: graphql allows\n * it there (ARGUMENT_DEFINITION), but no resolver receives that argument, so\n * it would check nothing.\n */\nfunction assertNoDirectiveArgumentConstrained(\n\tinputs: InputSchemas,\n\tschema: GraphQLSchema,\n): void {\n\tfor (const directive of schema.getDirectives()) {\n\t\tfor (const arg of directive.args) {\n\t\t\tif (constraintsOn(inputs.directive, arg.astNode).length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`@constraint on @${directive.name}(${arg.name}:) checks nothing: a directive's argument reaches no resolver. Remove it.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n",
5
+ "import {\n\ttype GraphQLDirective,\n\ttype GraphQLField,\n\ttype GraphQLObjectType,\n\ttype GraphQLSchema,\n\tisInterfaceType,\n\tisObjectType,\n} from 'graphql';\nimport type { z } from 'zod';\nimport { assertOwnConstraint } from '../constraint-directive';\nimport { type FormatSchemas, registryOf } from '../formats/registry';\nimport { argsSchemaOf, assertInterfaceConstraintsKept } from './args-schema';\nimport { type Constraint, constraintsOn } from './constraints';\nimport { declaredAt } from './declared';\nimport { InputSchemas } from './input-schema';\n\n/**\n * Runs every check `withValidation` makes at startup, so a code generator\n * refuses the same schemas: the declaration is `constraintTypeDefs`', every\n * constraint applies where it is written (in every input type), none sits on\n * a directive's argument, objects keep their interfaces' constraints, and no\n * default value breaks its own. `onArgs` receives each object field's\n * arguments schema, for a field with something to check, and `declared`\n * the `@constraint`s the field's SDL writes where an issue's path points.\n *\n * `formats` are the application's own, which `@constraint(format: \"...\")`\n * may name beside the built-in ones; they are checked first (name, no\n * built-in replaced, a Zod string schema each).\n *\n * Returns the `@constraint` directive, or `undefined` when the schema\n * declares none (and so carries no constraint).\n */\nexport function checkConstraints(\n\tschema: GraphQLSchema,\n\tonArgs?: (\n\t\ttype: GraphQLObjectType,\n\t\tfield: GraphQLField<unknown, unknown>,\n\t\targs: z.ZodType,\n\t\tdeclared: (path: readonly PropertyKey[]) => readonly Constraint[],\n\t) => void,\n\tformats?: FormatSchemas,\n): GraphQLDirective | undefined {\n\tconst inputs = new InputSchemas(schema, registryOf(formats));\n\tif (!inputs.directive) return undefined;\n\tassertOwnConstraint(inputs.directive);\n\tinputs.buildAll(schema);\n\tassertNoDirectiveArgumentConstrained(inputs, schema);\n\tfor (const type of Object.values(schema.getTypeMap())) {\n\t\tif (type.name.startsWith('__')) continue;\n\t\t// An interface's fields resolve on its objects: built for their errors only.\n\t\tif (isInterfaceType(type)) {\n\t\t\tfor (const field of Object.values(type.getFields()))\n\t\t\t\targsSchemaOf(inputs, type.name, field);\n\t\t}\n\t\tif (!isObjectType(type)) continue;\n\t\tassertInterfaceConstraintsKept(inputs, type);\n\t\tfor (const field of Object.values(type.getFields()) as GraphQLField<\n\t\t\tunknown,\n\t\t\tunknown\n\t\t>[]) {\n\t\t\tconst args = argsSchemaOf(inputs, type.name, field);\n\t\t\tif (args)\n\t\t\t\tonArgs?.(type, field, args, (path) => declaredAt(inputs, field, path));\n\t\t}\n\t}\n\tinputs.checkDefaults();\n\treturn inputs.directive;\n}\n\n/**\n * Fails on a `@constraint` written on a directive's argument: graphql allows\n * it there (ARGUMENT_DEFINITION), but no resolver receives that argument, so\n * it would check nothing.\n */\nfunction assertNoDirectiveArgumentConstrained(\n\tinputs: InputSchemas,\n\tschema: GraphQLSchema,\n): void {\n\tfor (const directive of schema.getDirectives()) {\n\t\tfor (const arg of directive.args) {\n\t\t\tif (constraintsOn(inputs.directive, arg.astNode).length > 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`@constraint on @${directive.name}(${arg.name}:) checks nothing: a directive's argument reaches no resolver. Remove it.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n",
7
6
  "import { z } from 'zod';\nimport { defineFormat } from './format';\n\nexport const byteFormat = defineFormat({\n\tname: 'byte',\n\ttoZod: () => z.base64(),\n\ttoCode: () => 'z.base64()',\n});\n",
8
7
  "import type { z } from 'zod';\nimport type { Narrow } from './marked';\n\n/** A string schema, plain or a format (`z.email()` is not a `z.ZodString`). */\nexport type StringSchema = z.ZodString | z.ZodStringFormat;\n\n/**\n * One value of `@constraint(format: \"...\")`: the schema it stands for, as a\n * schema at startup and, for a built-in one, as source for a code generator.\n * A format of the application's own has no `toCode`: the generator writes a\n * reference to the application's schema instead.\n */\nexport interface Format<N extends string = string> {\n\treadonly name: N;\n\treadonly toZod: () => StringSchema;\n\treadonly toCode?: () => string;\n\t/**\n\t * An application's format, narrowed by the rules written after it\n\t * (`leafSchema` hands them): they run inside it, after its checks, so\n\t * they see its abort even once it went async. A built-in format has none:\n\t * the rules are chained on `toZod()`.\n\t */\n\treadonly narrowed?: (narrow: Narrow) => StringSchema;\n}\n\n/** A format this package ships: written twice, as a schema and as source. */\nexport interface BuiltInFormat<N extends string = string> extends Format<N> {\n\treadonly toCode: () => string;\n}\n\n/** Declares a built-in format, with its name kept literal. */\nexport function defineFormat<const N extends string>(\n\tformat: BuiltInFormat<N>,\n): BuiltInFormat<N> {\n\treturn format;\n}\n",
9
8
  "import { z } from 'zod';\nimport { defineFormat } from './format';\n\nexport const dateFormat = defineFormat({\n\tname: 'date',\n\ttoZod: () => z.iso.date(),\n\ttoCode: () => 'z.iso.date()',\n});\n",
@@ -17,10 +16,12 @@
17
16
  "import { z } from 'zod';\nimport { RULE_PARAM } from '../rules/rule';\nimport type { StringSchema } from './format';\n\n/** The rules written after a format, applied to the schema they narrow. */\nexport type Narrow = (schema: StringSchema) => z.ZodType;\n\n/** The issues of a refused run, as the value `.catch()` hands on. */\nclass Refused {\n\tconstructor(readonly issues: readonly z.core.$ZodIssue[]) {}\n}\n\n/** Where our own refinements mark the issues they add. */\nconst SENTINEL = 'nxgtSentinel';\n\n/**\n * The application's schema as a plain string schema, narrowed by the rules\n * written after it (`narrow`), each of its issues re-raised as it was (code,\n * message, and an abort that stops those rules) and marked as the format's:\n * a `.regex()` inside it is the format's refusal, not `pattern`'s. The value\n * is checked, never changed: a schema that still returns another value (a\n * custom `.check()` setting `payload.value`, which `rewrites` cannot see)\n * throws, naming the format, as a resolver's bug would.\n *\n * Only zod's public API runs the schema, whatever zod 4 copy it comes from:\n * `safeParseAsync`, `check` pushing to `ctx.issues`, `refine` (with\n * `when`), `catch`, and the issues they return. A zod release that changes\n * its internals changes nothing here.\n *\n * - **Once per value, never a dropped promise.** The schema runs through\n * `safeParseAsync` only, never a synchronous `safeParse` that would start\n * an async check and drop its promise. A `.catch()` and a `.refine()`\n * chained last tell, as soon as the call returns, whether the run\n * finished synchronously (zod runs a schema's checks within the call\n * until one returns a promise): then its result is used at once, so a\n * synchronous parse (a default value's check at startup) still works.\n * Otherwise the promise is returned to the enclosing parse, with a\n * handler, and `onAsync` is told: a synchronous parse throws zod's async\n * error and `checkDefaults` names the format.\n * - **An abort** is read from two refinements chained after the schema's\n * checks: a plain one, which zod skips after any issue that does not\n * continue (`abort: true`, an issue a `.check()` pushed with no\n * `continue`), and one with a `when`, skipped only after `continue:\n * false`. Each marks a refused run's issues when it ran. The issues are\n * then replayed, with that same `continue`, through a `z.string()`\n * narrowed by the rules, so zod itself decides which rules run, as it does\n * on the client where they are chained on the schema.\n * - **Once async**, zod on the client runs the rules before the async\n * check's issues arrive, whatever its abort: the rules run here too, and\n * the format's issues come first.\n */\nexport function marked(\n\tname: string,\n\tschema: StringSchema,\n\tonAsync: () => void,\n): (narrow: Narrow) => StringSchema {\n\tlet done = false;\n\tlet outcome: unknown;\n\tconst probe = schema\n\t\t.check((ctx) => {\n\t\t\tif (ctx.issues.length > 0) ctx.issues.push(marker('plain', ctx.value));\n\t\t})\n\t\t.refine(() => false, {\n\t\t\tparams: { [SENTINEL]: 'when' },\n\t\t\twhen: (payload) => payload.issues.length > 0,\n\t\t})\n\t\t.catch((ctx) => new Refused(ctx.error.issues) as unknown as string)\n\t\t.refine((value) => {\n\t\t\tdone = true;\n\t\t\toutcome = value;\n\t\t\treturn true;\n\t\t});\n\n\treturn (narrow) => {\n\t\tlet stored: z.core.$ZodRawIssue[] = [];\n\t\tconst replay = narrow(\n\t\t\tz.string().check((ctx) => {\n\t\t\t\tctx.issues.push(...stored);\n\t\t\t}),\n\t\t);\n\n\t\tconst raise = (\n\t\t\tctx: z.core.ParsePayload<string>,\n\t\t\tresult: unknown,\n\t\t\tasync: boolean,\n\t\t) => {\n\t\t\tlet next: boolean | undefined = true;\n\t\t\tif (result instanceof Refused) {\n\t\t\t\tconst kinds = new Set(result.issues.map(sentinelOf));\n\t\t\t\t// Both ran: every issue continues. Only the `when` one: an issue\n\t\t\t\t// that does not continue. Neither: an explicit abort.\n\t\t\t\tif (!async && !kinds.has('plain'))\n\t\t\t\t\tnext = kinds.has('when') ? undefined : false;\n\t\t\t\tstored = result.issues\n\t\t\t\t\t.filter((issue) => sentinelOf(issue) === undefined)\n\t\t\t\t\t.map((issue) => raw(issue, ctx.value, next, 'format'));\n\t\t\t} else if (result !== ctx.value) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The format \"${name}\" rewrote the value it checked: a format checks the value and never changes it, so the server and the client check the value as it was sent. Refuse what is not canonical with .regex() or .refine() instead of setting payload.value in a .check().`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet replayed: z.ZodSafeParseResult<unknown>;\n\t\t\ttry {\n\t\t\t\treplayed = replay.safeParse(ctx.value);\n\t\t\t} finally {\n\t\t\t\tstored = [];\n\t\t\t}\n\t\t\tif (replayed.success) return;\n\t\t\tfor (const issue of replayed.error.issues) {\n\t\t\t\tconst own = paramsOf(issue)?.[RULE_PARAM] === 'format';\n\t\t\t\tctx.issues.push(raw(issue, ctx.value, own ? next : true));\n\t\t\t}\n\t\t};\n\n\t\treturn z.string().check((ctx) => {\n\t\t\tdone = false;\n\t\t\toutcome = undefined;\n\t\t\tconst pending = probe.safeParseAsync(ctx.value);\n\t\t\tif (done) {\n\t\t\t\tpending.catch(() => {});\n\t\t\t\traise(ctx, outcome, false);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst later = pending.then((result) =>\n\t\t\t\traise(ctx, result.success ? result.data : undefined, true),\n\t\t\t);\n\t\t\tlater.catch(() => {});\n\t\t\tonAsync();\n\t\t\treturn later;\n\t\t}) as unknown as StringSchema;\n\t};\n}\n\nfunction marker(kind: string, value: string): z.core.$ZodRawIssue {\n\treturn {\n\t\tcode: 'custom',\n\t\tmessage: '',\n\t\tinput: value,\n\t\tparams: { [SENTINEL]: kind },\n\t\tcontinue: true,\n\t};\n}\n\nfunction paramsOf(\n\tissue: z.core.$ZodIssue,\n): Record<string, unknown> | undefined {\n\treturn 'params' in issue\n\t\t? (issue.params as Record<string, unknown> | undefined)\n\t\t: undefined;\n}\n\nfunction sentinelOf(issue: z.core.$ZodIssue): unknown {\n\treturn paramsOf(issue)?.[SENTINEL];\n}\n\n/** A finalised issue raised again; marked `constraint` when given. */\nfunction raw(\n\tissue: z.core.$ZodIssue,\n\tinput: string,\n\tnext: boolean | undefined,\n\tconstraint?: string,\n): z.core.$ZodRawIssue {\n\tconst params = constraint\n\t\t? { ...paramsOf(issue), [RULE_PARAM]: constraint }\n\t\t: paramsOf(issue);\n\tconst { continue: _, ...rest } = issue as z.core.$ZodIssue & {\n\t\tcontinue?: boolean;\n\t};\n\treturn {\n\t\t...rest,\n\t\tinput,\n\t\t...(params && { params }),\n\t\t...(next !== undefined && { continue: next }),\n\t} as z.core.$ZodRawIssue;\n}\n",
18
17
  "import type { Format, StringSchema } from './format';\nimport { formats as builtIns, type FormatName } from './index';\nimport { marked } from './marked';\n\n/**\n * The application's own formats, keyed by the name `@constraint(format:\n * \"...\")` gives them: each a Zod string schema, `z.string()` or a string\n * format (`z.email()`), narrowed (`.regex()`, `.refine()`) but never\n * transformed nor rewritten (`.trim()`, `.toLowerCase()`, `z.url()`,\n * `z.coerce.string()`), so the resolver receives what was sent.\n */\nexport type FormatSchemas = { readonly [name: string]: StringSchema };\n\n/**\n * `F` with every key that names a built-in format typed `never`, so\n * replacing one is a type error before it is a startup error. The keys are\n * optional: a record typed wider than its literal (`FormatSchemas`,\n * `Record<string, z.ZodString>`) may hold none of them, and passes.\n */\nexport type OwnFormats<F extends FormatSchemas> = F & {\n\treadonly [K in keyof F & FormatName]?: never;\n};\n\nconst NAME = /^[a-z][a-z0-9-]*$/;\n\n/**\n * Every format `@constraint(format: \"...\")` can name: the built-in ones,\n * then the application's own. A lookup is one `Map` read, however many\n * formats there are.\n */\nexport class FormatRegistry {\n\treadonly #formats = new Map<string, Format>();\n\t#async: string | undefined;\n\n\t/**\n\t * Fails, naming the format, on a bad name, a built-in's name, a schema\n\t * that is not a string's, one zod cannot run, or one that rewrites the\n\t * value.\n\t */\n\tconstructor(own: FormatSchemas = {}) {\n\t\tfor (const format of Object.values(builtIns))\n\t\t\tthis.#formats.set(format.name, format);\n\t\tfor (const [name, schema] of Object.entries(own)) {\n\t\t\tif (!NAME.test(name)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid format name ${JSON.stringify(name)}: write it in lowercase letters, digits and hyphens, starting with a letter.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (this.#formats.has(name)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The format \"${name}\" is built in: give yours another name.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!isStringSchema(schema)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The format \"${name}\" is not a Zod string schema: write z.string() or a string format such as z.email(), narrowed with .regex() or .refine(), never transformed.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!runnable(schema)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The format \"${name}\" cannot be run: its definition reads type: 'string' but it has no safeParseAsync, check, refine or catch, so it is not a schema of zod 4's classic API. Pass the schema z.string() or a string format returns, not an object shaped like one.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (rewrites(schema)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The format \"${name}\" rewrites the value (.trim(), .toLowerCase(), .toUpperCase(), .normalize(), .slugify(), .overwrite(), z.url(), z.httpUrl() or z.coerce.string()): refuse what is not canonical with .regex() or .refine() instead, so the server and the client check the value as it was sent.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst narrowed = marked(name, schema, () => {\n\t\t\t\tthis.#async = name;\n\t\t\t});\n\t\t\tconst own = narrowed((schema) => schema);\n\t\t\tthis.#formats.set(name, { name, toZod: () => own, narrowed });\n\t\t}\n\t}\n\n\t/** The format named `name`, or an error that lists the known ones. */\n\tnamed(name: string): Format {\n\t\tconst format = this.#formats.get(name);\n\t\tif (format) return format;\n\t\tthrow new Error(\n\t\t\t`Unknown @constraint format \"${name}\". Known formats: ${[...this.#formats.keys()].join(', ')}.`,\n\t\t);\n\t}\n\n\t/**\n\t * The format of the application that last went async, then forgotten: read\n\t * right after a synchronous parse threw zod's `$ZodAsyncError`, it names the\n\t * format that made it throw (zod stops at the first check that returns a\n\t * promise, and only an application's format can).\n\t */\n\ttakeAsync(): string | undefined {\n\t\tconst name = this.#async;\n\t\tthis.#async = undefined;\n\t\treturn name;\n\t}\n}\n\n/**\n * Whether a value is a Zod string schema, read from its definition rather\n * than `instanceof`, so a schema from another copy of zod is recognised. A\n * transform or a codec is a pipe, `.optional()` an optional: neither passes.\n */\nfunction isStringSchema(value: unknown): value is StringSchema {\n\treturn definition(value)?.type === 'string';\n}\n\n/**\n * Whether zod can run the schema through the public API `marked` uses on\n * every value, so a definition alone (an object that only reads `type:\n * 'string'`) fails startup rather than each request.\n */\nfunction runnable(schema: StringSchema): boolean {\n\tconst api = schema as unknown as Record<string, unknown>;\n\treturn ['safeParseAsync', 'check', 'refine', 'catch'].every(\n\t\t(method) => typeof api[method] === 'function',\n\t);\n}\n\n/**\n * Whether a string schema rewrites the value it checks, though it stays\n * `type: 'string'`: `z.coerce.string()` (`coerce: true`) turns a number\n * into a string; `z.url()`, `z.httpUrl()` and `.url()` (`format: 'url'`, as\n * the schema or as one of its checks) trim the value and drop its tabs and\n * newlines, or normalise it; `.trim()`, `.toLowerCase()`, `.toUpperCase()`,\n * `.normalize()`, `.slugify()` and `.overwrite()` are each a check whose\n * definition reads `check: 'overwrite'`. Every other string format of zod 4\n * only checks. `format: 'url'` is read as the format's name, so a\n * `z.stringFormat('url', …)` of the application's is refused too. The\n * server checks the value as sent; a client chaining rules on a rewriting\n * schema would check the rewritten one. A custom check that sets the value\n * cannot be read here: `marked` catches it when it runs.\n */\nfunction rewrites(schema: StringSchema): boolean {\n\tconst def = definition(schema);\n\tif (def?.coerce || def?.format === 'url') return true;\n\treturn (def?.checks ?? []).some((check) => {\n\t\tconst own = definition(check);\n\t\treturn own?.check === 'overwrite' || own?.format === 'url';\n\t});\n}\n\ntype Definition = {\n\ttype?: unknown;\n\tcoerce?: unknown;\n\tformat?: unknown;\n\tcheck?: unknown;\n\tchecks?: readonly unknown[];\n};\n\nfunction definition(value: unknown): Definition | undefined {\n\treturn (value as { _zod?: { def?: Definition } } | null)?._zod?.def;\n}\n\nconst builtInRegistry = new FormatRegistry();\nconst registries = new WeakMap<FormatSchemas, FormatRegistry>();\n\n/**\n * The registry of a set of formats, built (and checked) once per record: a\n * code generator hands the same record for every field.\n */\nexport function registryOf(own?: FormatSchemas): FormatRegistry {\n\tif (!own) return builtInRegistry;\n\tlet registry = registries.get(own);\n\tif (!registry) {\n\t\tregistry = new FormatRegistry(own);\n\t\tregistries.set(own, registry);\n\t}\n\treturn registry;\n}\n",
19
18
  "import type { GraphQLArgument, GraphQLField, GraphQLObjectType } from 'graphql';\nimport { z } from 'zod';\nimport { constraintsOn } from './constraints';\nimport type { InputSchemas } from './input-schema';\n\n/**\n * The schema of a field's arguments, or `undefined` when none of them can\n * break a constraint, so a field with nothing to check is left untouched.\n * `parent` is the type's name, for errors: `Mutation.signUp(input:)`.\n */\nexport function argsSchemaOf(\n\tinputs: InputSchemas,\n\tparent: string,\n\tfield: GraphQLField<unknown, unknown>,\n): z.ZodType | undefined {\n\tif (!field.args.some((arg) => inputs.needsCheck(arg))) return undefined;\n\treturn z.object(\n\t\tObject.fromEntries(\n\t\t\tfield.args.map((arg) => [\n\t\t\t\targ.name,\n\t\t\t\tinputs.of(arg, `${parent}.${field.name}(${arg.name}:)`),\n\t\t\t]),\n\t\t),\n\t);\n}\n\n/** The constraints of an argument as written, sorted: `maxLength: 5, min: 1`. */\nfunction signature(inputs: InputSchemas, arg: GraphQLArgument): string {\n\treturn constraintsOn(inputs.directive, arg.astNode)\n\t\t.map(({ rule, value }) => `${rule.argument}: ${JSON.stringify(value)}`)\n\t\t.sort()\n\t\t.join(', ');\n}\n\n/** A signature as it reads in an error. */\nconst written = (signature: string) =>\n\tsignature ? `@constraint(${signature})` : 'no @constraint';\n\n/**\n * Fails when an object type's field does not repeat the `@constraint` its\n * interface writes on an argument. The object's field is the one that\n * resolves, and graphql lets it redeclare the argument bare: the interface's\n * constraint would then check nothing, in silence.\n */\nexport function assertInterfaceConstraintsKept(\n\tinputs: InputSchemas,\n\ttype: GraphQLObjectType,\n): void {\n\tfor (const contract of type.getInterfaces()) {\n\t\tfor (const [name, declared] of Object.entries(contract.getFields())) {\n\t\t\tconst field = type.getFields()[name];\n\t\t\tfor (const arg of declared.args) {\n\t\t\t\tconst wanted = signature(inputs, arg);\n\t\t\t\tif (!wanted) continue;\n\t\t\t\tconst own = field?.args.find(\n\t\t\t\t\t({ name: argName }) => argName === arg.name,\n\t\t\t\t);\n\t\t\t\tconst found = own ? signature(inputs, own) : wanted;\n\t\t\t\tif (found !== wanted) {\n\t\t\t\t\tconst verb = found ? 'differs on' : 'is not repeated on';\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`@constraint on ${contract.name}.${name}(${arg.name}:) ${verb} ${type.name}.${name}(${arg.name}:), which resolves it (${written(wanted)} there, ${written(found)} here). Write the same @constraint on both.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n",
19
+ "import {\n\ttype DirectiveNode,\n\ttype GraphQLDirective,\n\tgetDirectiveValues,\n} from 'graphql';\nimport { type RegisteredRule, rules } from '../rules';\n\n/** One `@constraint` argument written on an argument or an input field. */\nexport interface Constraint {\n\treadonly rule: RegisteredRule;\n\treadonly value: string | number;\n}\n\n/**\n * The constraints written on a node, base rules (`format`) first so the\n * others narrow the schema they produce. Empty when the schema declares no\n * `@constraint` or the node carries none.\n */\nexport function constraintsOn(\n\tdirective: GraphQLDirective | undefined,\n\tnode:\n\t\t| { readonly directives?: ReadonlyArray<DirectiveNode> | undefined }\n\t\t| null\n\t\t| undefined,\n): Constraint[] {\n\tif (!directive || !node) return [];\n\tconst values =\n\t\tgetDirectiveValues(directive, { directives: node.directives ?? [] }) ?? {};\n\treturn Object.entries(values)\n\t\t.filter(([, value]) => value !== undefined && value !== null)\n\t\t.map(([argument, value]) => ({\n\t\t\trule: rules[argument as keyof typeof rules],\n\t\t\tvalue: value as string | number,\n\t\t}))\n\t\t.sort(\n\t\t\t(a, b) => Number(Boolean(b.rule.base)) - Number(Boolean(a.rule.base)),\n\t\t);\n}\n",
20
+ "import {\n\ttype GraphQLField,\n\ttype GraphQLInputType,\n\tgetNamedType,\n\tisInputObjectType,\n\tisListType,\n\tisNonNullType,\n} from 'graphql';\nimport { type Constraint, constraintsOn } from './constraints';\nimport type { InputSchemas } from './input-schema';\n\n/**\n * The `@constraint` arguments written where a Zod issue's `path` points, in\n * a field's arguments: the argument or input field it ends on, or, under a\n * list, the list's own rules (`minItems`, `maxItems`) at the list and its\n * items' at an index, as `InputSchemas` splits them. Empty when the path\n * leaves the declared types.\n */\nexport function declaredAt(\n\tinputs: InputSchemas,\n\tfield: GraphQLField<unknown, unknown>,\n\tpath: readonly PropertyKey[],\n): readonly Constraint[] {\n\tconst [name, ...rest] = path;\n\tconst arg = field.args.find((candidate) => candidate.name === name);\n\tif (!arg) return [];\n\tlet type: GraphQLInputType = arg.type;\n\tlet constraints = constraintsOn(inputs.directive, arg.astNode);\n\tfor (const key of rest) {\n\t\tconst unwrapped = isNonNullType(type) ? type.ofType : type;\n\t\tif (isListType(unwrapped) && typeof key === 'number') {\n\t\t\tconstraints = constraints.filter(({ rule }) => rule.target !== 'list');\n\t\t\ttype = unwrapped.ofType;\n\t\t\tcontinue;\n\t\t}\n\t\tconst named = getNamedType(unwrapped);\n\t\tconst next =\n\t\t\t!isListType(unwrapped) && isInputObjectType(named)\n\t\t\t\t? named.getFields()[String(key)]\n\t\t\t\t: undefined;\n\t\tif (!next) return [];\n\t\ttype = next.type;\n\t\tconstraints = constraintsOn(inputs.directive, next.astNode);\n\t}\n\t// Ending on a list: its own rules; an item or a leaf: the rest.\n\tconst onList = isListType(isNonNullType(type) ? type.ofType : type);\n\treturn constraints.filter(({ rule }) => (rule.target === 'list') === onList);\n}\n",
20
21
  "import {\n\ttype ConstValueNode,\n\ttype GraphQLArgument,\n\ttype GraphQLDirective,\n\ttype GraphQLInputField,\n\ttype GraphQLInputObjectType,\n\ttype GraphQLInputType,\n\ttype GraphQLSchema,\n\tgetNamedType,\n\tisInputObjectType,\n\tisListType,\n\tisNonNullType,\n\tvalueFromAST,\n} from 'graphql';\nimport { z } from 'zod';\nimport { type FormatRegistry, registryOf } from '../formats/registry';\nimport { applyRule } from '../rules';\nimport type { RuleContext } from '../rules/rule';\nimport { type Constraint, constraintsOn } from './constraints';\nimport { assertObjectTargets, leafSchema } from './leaf';\n\n/**\n * Builds the schemas of the arguments and input fields of one GraphQL\n * schema, once each: an input type is walked a single time however many\n * fields use it, and a recursive one (`input Filter { and: [Filter!] }`) is\n * reached through `z.lazy`.\n */\nexport class InputSchemas {\n\treadonly directive: GraphQLDirective | undefined;\n\treadonly #context: RuleContext;\n\treadonly #objects = new Map<string, z.ZodType>();\n\treadonly #defaults: {\n\t\tschema: z.ZodType;\n\t\tliteral: ConstValueNode;\n\t\ttype: GraphQLInputType;\n\t\twhere: string;\n\t}[] = [];\n\t/** The input types a value can break a constraint inside. */\n\treadonly #constrained = new Set<string>();\n\n\t/** `formats`: the built-in ones by default, the application's added. */\n\tconstructor(schema: GraphQLSchema, formats: FormatRegistry = registryOf()) {\n\t\tthis.#context = { formats };\n\t\tthis.directive = schema.getDirective('constraint') ?? undefined;\n\t\tconst objects = Object.values(schema.getTypeMap()).filter(\n\t\t\tisInputObjectType,\n\t\t);\n\t\t// A fixpoint, not a memoised walk: in a cycle, a type visited while it\n\t\t// is still being decided would be cached as unconstrained for good.\n\t\tfor (let changed = true; changed; ) {\n\t\t\tchanged = false;\n\t\t\tfor (const type of objects) {\n\t\t\t\tif (this.#constrained.has(type.name)) continue;\n\t\t\t\tconst constrained = Object.values(type.getFields()).some(\n\t\t\t\t\t(field) =>\n\t\t\t\t\t\tconstraintsOn(this.directive, field.astNode).length > 0 ||\n\t\t\t\t\t\tthis.isConstrained(field.type),\n\t\t\t\t);\n\t\t\t\tif (constrained) {\n\t\t\t\t\tthis.#constrained.add(type.name);\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Whether a value of this type can break a constraint anywhere inside. */\n\tisConstrained(type: GraphQLInputType): boolean {\n\t\tconst named = getNamedType(type);\n\t\treturn isInputObjectType(named) && this.#constrained.has(named.name);\n\t}\n\n\t/**\n\t * Builds every constrained input type, reached by an argument or not, so\n\t * a constraint that cannot apply fails at startup wherever it is written.\n\t */\n\tbuildAll(schema: GraphQLSchema): void {\n\t\tfor (const type of Object.values(schema.getTypeMap())) {\n\t\t\tif (isInputObjectType(type)) this.#object(type);\n\t\t}\n\t}\n\n\t/** Whether an argument or input field needs checking at all. */\n\tneedsCheck(input: GraphQLArgument | GraphQLInputField): boolean {\n\t\treturn (\n\t\t\tconstraintsOn(this.directive, input.astNode).length > 0 ||\n\t\t\tthis.isConstrained(input.type)\n\t\t);\n\t}\n\n\t/** The schema of one argument or input field, `where` naming it in errors. */\n\tof(input: GraphQLArgument | GraphQLInputField, where: string): z.ZodType {\n\t\tconst schema = this.#typed(\n\t\t\tinput.type,\n\t\t\tconstraintsOn(this.directive, input.astNode),\n\t\t\twhere,\n\t\t);\n\t\tconst literal = input.astNode?.defaultValue;\n\t\tif (literal)\n\t\t\tthis.#defaults.push({ schema, literal, type: input.type, where });\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Fails when a default value breaks its own constraint: every request that\n\t * leaves the value out would be refused for something the client never\n\t * sent. Run once every schema is built, so a recursive type is complete.\n\t */\n\tcheckDefaults(): void {\n\t\tfor (const { schema, literal, type, where } of this.#defaults.splice(0)) {\n\t\t\t// Coerced as graphql coerces it: a single value for a list, an input\n\t\t\t// object's own field defaults. One graphql refuses is its to report.\n\t\t\tconst value = valueFromAST(literal, type);\n\t\t\tif (value === undefined) continue;\n\t\t\tlet result: z.ZodSafeParseResult<unknown>;\n\t\t\ttry {\n\t\t\t\tresult = schema.safeParse(value);\n\t\t\t} catch (error) {\n\t\t\t\t// Thrown by this zod: only the formats' wrapper, ours, goes async.\n\t\t\t\tif (!(error instanceof z.core.$ZodAsyncError)) throw error;\n\t\t\t\tconst format = this.#context.formats.takeAsync();\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The default value of ${where} cannot be checked at startup: ${format ? `the format \"${format}\"` : 'its format'} checks asynchronously, and a default value is checked synchronously. Drop the default, or move the async check out of the format into validated().`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!result.success) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The default value of ${where} breaks its @constraint: ${result.error.issues[0]?.message}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t#typed(\n\t\ttype: GraphQLInputType,\n\t\tconstraints: readonly Constraint[],\n\t\twhere: string,\n\t): z.ZodType {\n\t\tif (isNonNullType(type))\n\t\t\treturn this.#required(type.ofType, constraints, where);\n\t\treturn this.#required(type, constraints, where).nullish();\n\t}\n\n\t#required(\n\t\ttype: GraphQLInputType,\n\t\tconstraints: readonly Constraint[],\n\t\twhere: string,\n\t): z.ZodType {\n\t\tif (isNonNullType(type))\n\t\t\treturn this.#required(type.ofType, constraints, where);\n\t\tif (isListType(type)) {\n\t\t\t// minItems and maxItems are the list's; every other rule is its items'.\n\t\t\tconst own = constraints.filter(({ rule }) => rule.target === 'list');\n\t\t\tconst items = constraints.filter(({ rule }) => rule.target !== 'list');\n\t\t\tlet list: z.ZodType = z.array(this.#typed(type.ofType, items, where));\n\t\t\tfor (const { rule, value } of own)\n\t\t\t\tlist = applyRule(rule, list, value, this.#context);\n\t\t\treturn list;\n\t\t}\n\t\tif (isInputObjectType(type)) {\n\t\t\tassertObjectTargets(type.name, constraints, where);\n\t\t\treturn this.#object(type);\n\t\t}\n\t\treturn leafSchema(type, constraints, where, this.#context);\n\t}\n\n\t#object(type: GraphQLInputObjectType): z.ZodType {\n\t\tif (!this.isConstrained(type)) return z.unknown();\n\t\tconst built = this.#objects.get(type.name);\n\t\tif (built) return built;\n\t\t// Registered before the walk, so a field that comes back here ends.\n\t\tlet schema: z.ZodType | undefined;\n\t\tthis.#objects.set(\n\t\t\ttype.name,\n\t\t\tz.lazy(() => schema as z.ZodType),\n\t\t);\n\t\tschema = z.object(\n\t\t\tObject.fromEntries(\n\t\t\t\tObject.values(type.getFields()).map((field) => [\n\t\t\t\t\tfield.name,\n\t\t\t\t\tthis.of(field, `${type.name}.${field.name}`),\n\t\t\t\t]),\n\t\t\t),\n\t\t);\n\t\tthis.#objects.set(type.name, schema);\n\t\treturn schema;\n\t}\n}\n",
21
22
  "import {\n\tGraphQLBoolean,\n\tGraphQLFloat,\n\tGraphQLID,\n\tGraphQLInt,\n\ttype GraphQLLeafType,\n\tGraphQLString,\n} from 'graphql';\nimport { z } from 'zod';\nimport { applyRule, rules } from '../rules';\nimport type { RuleContext, Target } from '../rules/rule';\nimport type { Constraint } from './constraints';\n\n/** The kind of value each built-in scalar holds once graphql parsed it. */\nconst kinds: Record<string, Exclude<Target, 'list'>> = {\n\t[GraphQLString.name]: 'string',\n\t[GraphQLID.name]: 'string',\n\t[GraphQLInt.name]: 'number',\n\t[GraphQLFloat.name]: 'number',\n};\n\nfunction baseOf(type: GraphQLLeafType): z.ZodType {\n\tif (type.name === GraphQLInt.name) return z.number().int();\n\treturn kinds[type.name] === 'number' ? z.number() : z.string();\n}\n\n/**\n * Fails unless every constraint applies to a value of `type`: `minLength` on\n * an `Int`, anything on a custom scalar or an enum, fails, naming `where`.\n * The runtime and the code generator refuse the same schemas with the same\n * message.\n */\nexport function assertLeafTargets(\n\ttype: GraphQLLeafType,\n\tconstraints: readonly Constraint[],\n\twhere: string,\n): void {\n\tconst misplaced = constraints.find(({ rule }) => rule.target === 'list');\n\tif (misplaced) throw misplacedOn(misplaced, where, type.name);\n\tconst kind = kinds[type.name];\n\tconst wrong = constraints.find(({ rule }) => rule.target !== kind);\n\tif (wrong) throw misplacedOn(wrong, where, type.name);\n}\n\n/** Fails when an input object carries a constraint: none applies to it. */\nexport function assertObjectTargets(\n\ttypeName: string,\n\tconstraints: readonly Constraint[],\n\twhere: string,\n): void {\n\tconst first =\n\t\tconstraints.find(({ rule }) => rule.target === 'list') ?? constraints[0];\n\tif (first) throw misplacedOn(first, where, typeName);\n}\n\nfunction misplacedOn(\n\t{ rule }: Constraint,\n\twhere: string,\n\ttypeName: string,\n): Error {\n\treturn new Error(\n\t\t`@constraint(${rule.argument}) on ${where} needs ${describeTarget(rule.target)}, not ${typeName}.`,\n\t);\n}\n\n/**\n * The schema of a scalar or enum value with its constraints applied. A leaf\n * without any is left as graphql parsed it. A constraint that cannot apply\n * fails here, at startup.\n */\nexport function leafSchema(\n\ttype: GraphQLLeafType,\n\tconstraints: readonly Constraint[],\n\twhere: string,\n\tcontext: RuleContext,\n): z.ZodType {\n\tif (constraints.length === 0) return z.unknown();\n\tassertLeafTargets(type, constraints, where);\n\tconst [first, ...rest] = constraints;\n\tconst narrow = (schema: z.ZodType) =>\n\t\trest.reduce(\n\t\t\t(narrowed, { rule, value }) => applyRule(rule, narrowed, value, context),\n\t\t\tschema,\n\t\t);\n\t// An application's format runs the rules after it inside itself.\n\tconst narrowed =\n\t\tfirst?.rule === rules.format\n\t\t\t? context.formats.named(String(first.value)).narrowed\n\t\t\t: undefined;\n\tif (narrowed) return narrowed(narrow);\n\treturn constraints.reduce(\n\t\t(schema, { rule, value }) => applyRule(rule, schema, value, context),\n\t\tbaseOf(type),\n\t);\n}\n\n/** The source of a built-in scalar's schema, before its constraints. */\nexport function baseCode(type: GraphQLLeafType): string | undefined {\n\t// graphql's Int is 32-bit: the client refuses what it refuses.\n\tif (type.name === GraphQLInt.name) return 'z.int32()';\n\tif (type.name === GraphQLFloat.name) return 'z.number()';\n\tif (type.name === GraphQLBoolean.name) return 'z.boolean()';\n\treturn kinds[type.name] === 'string' ? 'z.string()' : undefined;\n}\n\n/** What a rule's target reads as in an error. */\nexport function describeTarget(target: Target): string {\n\tif (target === 'string') return 'a String or an ID';\n\tif (target === 'number') return 'an Int or a Float';\n\treturn 'a list';\n}\n"
22
23
  ],
23
- "mappings": ";;;;;;;;;AAAA;AAAA;AAAA;AAkBO,SAAS,cAAa,CAC5B,WACA,MAIe;AAAA,EACf,IAAI,CAAC,aAAa,CAAC;AAAA,IAAM,OAAO,CAAC;AAAA,EACjC,MAAM,SACL,mBAAmB,WAAW,EAAE,YAAY,KAAK,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC;AAAA,EAC1E,OAAO,OAAO,QAAQ,MAAM,EAC1B,OAAO,IAAI,WAAW,UAAU,aAAa,UAAU,IAAI,EAC3D,IAAI,EAAE,UAAU,YAAY;AAAA,IAC5B,MAAM,MAAM;AAAA,IACZ;AAAA,EACD,EAAE,EACD,KACA,CAAC,GAAG,MAAM,OAAO,QAAQ,EAAE,KAAK,IAAI,CAAC,IAAI,OAAO,QAAQ,EAAE,KAAK,IAAI,CAAC,CACrE;AAAA;;;ACpCF;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;ACAA;;;AC+BO,SAAS,YAAoC,CACnD,QACmB;AAAA,EACnB,OAAO;AAAA;;;AD/BD,IAAM,aAAa,aAAa;AAAA,EACtC,MAAM;AAAA,EACN,OAAO,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