@nxgt/graphql-validation 0.8.0 → 0.9.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 (37) hide show
  1. package/README.md +49 -0
  2. package/dist/chunks/{index-w9pw7fsk.js → index-5x1yd76p.js} +2 -2
  3. package/dist/chunks/{index-atwkcfg3.js → index-sq3exxg2.js} +25 -4
  4. package/dist/chunks/index-sq3exxg2.js.map +27 -0
  5. package/dist/cli.js +1 -1
  6. package/dist/codegen.js +2 -2
  7. package/dist/constraint-directive.d.ts.map +1 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +57 -11
  11. package/dist/index.js.map +4 -3
  12. package/dist/invalid-input-of.d.ts +19 -0
  13. package/dist/invalid-input-of.d.ts.map +1 -0
  14. package/dist/rules/contains.d.ts.map +1 -1
  15. package/dist/rules/ends-with.d.ts.map +1 -1
  16. package/dist/rules/exclusive-max.d.ts.map +1 -1
  17. package/dist/rules/exclusive-min.d.ts.map +1 -1
  18. package/dist/rules/format.d.ts.map +1 -1
  19. package/dist/rules/max-items.d.ts.map +1 -1
  20. package/dist/rules/max-length.d.ts.map +1 -1
  21. package/dist/rules/max.d.ts.map +1 -1
  22. package/dist/rules/min-items.d.ts.map +1 -1
  23. package/dist/rules/min-length.d.ts.map +1 -1
  24. package/dist/rules/min.d.ts.map +1 -1
  25. package/dist/rules/multiple-of.d.ts.map +1 -1
  26. package/dist/rules/not-contains.d.ts.map +1 -1
  27. package/dist/rules/pattern.d.ts.map +1 -1
  28. package/dist/rules/rule.d.ts +5 -0
  29. package/dist/rules/rule.d.ts.map +1 -1
  30. package/dist/rules/starts-with.d.ts.map +1 -1
  31. package/docs/README.md +1 -1
  32. package/docs/guide/invalid-input.md +50 -0
  33. package/docs/roadmap.md +5 -1
  34. package/graphql/constraint.graphqls +48 -0
  35. package/package.json +1 -1
  36. package/dist/chunks/index-atwkcfg3.js.map +0 -27
  37. /package/dist/chunks/{index-w9pw7fsk.js.map → index-5x1yd76p.js.map} +0 -0
package/README.md CHANGED
@@ -233,6 +233,54 @@ if (!result.success)
233
233
  throw invalidInputError(result.error.issues.map(fieldIssueOf), { translate: t });
234
234
  ```
235
235
 
236
+ For an API that uses `withValidation` or `validated` and answers invalid input
237
+ this way, `invalidInputOf(error, { translate })` converts their
238
+ `BAD_USER_INPUT` refusal (thrown directly, or wrapped by graphql-js with the
239
+ field's location) into the same error, and returns any other error as it is
240
+ (the same object). Each field carries the value the directive declared in
241
+ `params`, under the argument's own key (`{ max }`, `{ exclusiveMin }`, …):
242
+
243
+ ```ts
244
+ import { invalidInputOf } from '@nxgt/graphql-validation';
245
+
246
+ // in a graphql-yoga plugin
247
+ const plugin = {
248
+ onExecute: () => ({
249
+ onExecuteDone: ({ result, setResult }) => {
250
+ if (!('errors' in result) || !result.errors) return;
251
+ setResult({
252
+ ...result,
253
+ errors: result.errors.map((error) => invalidInputOf(error)),
254
+ });
255
+ },
256
+ }),
257
+ };
258
+ ```
259
+
260
+ For `signUp(input: { name: String! @constraint(maxLength: 100) })` sent with a
261
+ 101-character name, the response (without `translate`, so `message` is the
262
+ code) is:
263
+
264
+ ```json
265
+ {
266
+ "data": null,
267
+ "errors": [{
268
+ "message": "validation.errors.invalid-input",
269
+ "path": ["signUp"],
270
+ "extensions": {
271
+ "code": "validation.errors.invalid-input",
272
+ "http": { "status": 400 },
273
+ "fields": [{
274
+ "path": "name",
275
+ "code": "validation.errors.too-long",
276
+ "message": "validation.errors.too-long",
277
+ "params": { "max": 100 }
278
+ }]
279
+ }
280
+ }]
281
+ }
282
+ ```
283
+
236
284
  The codes, and `fieldsError`, are in
237
285
  [Answering invalid input as one error](docs/guide/invalid-input.md).
238
286
 
@@ -349,6 +397,7 @@ the directive declared is this package's. Both at once throw
349
397
  | `fieldsError(code, issues, options?)` | a refusal of your own naming fields, `extensions: { code, params?, http?, fields }`; `options` adds `status` and `params` |
350
398
  | `inputPath(path)` | `['input', 'person', 'firstName']` as `person.firstName`: dotted, the leading `input` argument dropped; a symbol written as `String(key)` |
351
399
  | `fieldIssueOf(issue)` | a Zod issue as a `FieldIssue`: `inputPath(issue.path)` and a code under `validation.errors.` (`too-short`, `too-long`, `out-of-range`, `too-few`, `too-many`, `invalid-format`, `invalid`), no params |
400
+ | `invalidInputOf(error, { translate? })` | a `@constraint` `BAD_USER_INPUT` refusal (direct, or the `originalError` of another error) as `invalidInputError`: fields `{ path, code, params }`, `params` the declared value under the argument's key (`min`, `max`, `exclusiveMin`, `exclusiveMax`, `multipleOf`, `format`; none for `pattern`), `invalid` for an issue with no `constraint`, `originalError` kept; any other error returned as the same object |
352
401
  | `FIELD_CODES` | those codes, keyed `tooShort`, `tooLong`, `outOfRange`, `tooFew`, `tooMany`, `invalidFormat`, `invalid` |
353
402
  | `INVALID_INPUT` | `'validation.errors.invalid-input'` |
354
403
  | `FieldIssue`, `FieldError`, `IssueParams`, `Translate`, `InvalidInputOptions`, `FieldsErrorOptions` | their types: an issue you write, a `fields` entry, its params, your translator, the options |
@@ -4,7 +4,7 @@ import {
4
4
  rules,
5
5
  applyRule,
6
6
  assertOwnConstraint
7
- } from "./index-atwkcfg3.js";
7
+ } from "./index-sq3exxg2.js";
8
8
 
9
9
  // src/formats/all.ts
10
10
  var exports_all = {};
@@ -558,4 +558,4 @@ function assertNoDirectiveArgumentConstrained(inputs, schema) {
558
558
  export { registryOf, constraintsOn2, assertLeafTargets, assertObjectTargets, baseCode, checkConstraints2 };
559
559
 
560
560
  //# debugId=418E0FAAA9B9E68E64756E2164756E21
561
- //# sourceMappingURL=index-w9pw7fsk.js.map
561
+ //# sourceMappingURL=index-5x1yd76p.js.map
@@ -48,6 +48,7 @@ var containsRule = defineRule({
48
48
  argument: "contains",
49
49
  type: "String",
50
50
  target: "string",
51
+ description: "The string must contain this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.",
51
52
  toZod: (schema, value) => schema.includes(value),
52
53
  toCode: (schema, value) => `${schema}.includes(${literal(value)})`,
53
54
  owns: (issue) => issue.format === "includes"
@@ -57,6 +58,7 @@ var endsWithRule = defineRule({
57
58
  argument: "endsWith",
58
59
  type: "String",
59
60
  target: "string",
61
+ description: "The string must end with this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.",
60
62
  toZod: (schema, value) => schema.endsWith(value),
61
63
  toCode: (schema, value) => `${schema}.endsWith(${literal(value)})`,
62
64
  owns: (issue) => issue.format === "ends_with"
@@ -66,6 +68,7 @@ var exclusiveMaxRule = defineRule({
66
68
  argument: "exclusiveMax",
67
69
  type: "Float",
68
70
  target: "number",
71
+ description: "The number must be strictly less than this value (the value itself is refused). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.",
69
72
  toZod: (schema, value) => schema.lt(value),
70
73
  toCode: (schema, value) => `${schema}.lt(${value})`,
71
74
  owns: (issue) => issue.code === "too_big" && issue.origin === "number" && issue.inclusive === false
@@ -75,6 +78,7 @@ var exclusiveMinRule = defineRule({
75
78
  argument: "exclusiveMin",
76
79
  type: "Float",
77
80
  target: "number",
81
+ description: "The number must be strictly greater than this value (the value itself is refused). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.",
78
82
  toZod: (schema, value) => schema.gt(value),
79
83
  toCode: (schema, value) => `${schema}.gt(${value})`,
80
84
  owns: (issue) => issue.code === "too_small" && issue.origin === "number" && issue.inclusive === false
@@ -85,6 +89,7 @@ var formatRule = defineRule({
85
89
  argument: "format",
86
90
  type: "String",
87
91
  target: "string",
92
+ description: "The string must match this named format: byte, date, date-time, email, ipv4, ipv6, uri or uuid, or a format the server registered. An unknown name fails at server startup. Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.",
88
93
  base: true,
89
94
  toZod: (_schema, value, { formats }) => formats.named(value).toZod(),
90
95
  toCode: (_schema, value, { formats, formatCode }) => {
@@ -102,6 +107,7 @@ var maxRule = defineRule({
102
107
  argument: "max",
103
108
  type: "Float",
104
109
  target: "number",
110
+ description: "The number must be less than or equal to this value (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.",
105
111
  toZod: (schema, value) => schema.lte(value),
106
112
  toCode: (schema, value) => `${schema}.lte(${value})`,
107
113
  owns: (issue) => issue.code === "too_big" && issue.origin === "number" && issue.inclusive === true
@@ -111,6 +117,7 @@ var maxItemsRule = defineRule({
111
117
  argument: "maxItems",
112
118
  type: "Int",
113
119
  target: "list",
120
+ description: "The list must hold at most this many items (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to list values.",
114
121
  toZod: (schema, value) => schema.max(value),
115
122
  toCode: (schema, value) => `${schema}.max(${value})`,
116
123
  owns: (issue) => issue.code === "too_big" && issue.origin === "array"
@@ -120,6 +127,7 @@ var maxLengthRule = defineRule({
120
127
  argument: "maxLength",
121
128
  type: "Int",
122
129
  target: "string",
130
+ description: "The string must be at most this many characters long (UTF-16 code units, inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.",
123
131
  toZod: (schema, value) => schema.max(value),
124
132
  toCode: (schema, value) => `${schema}.max(${value})`,
125
133
  owns: (issue) => issue.code === "too_big" && issue.origin === "string"
@@ -129,6 +137,7 @@ var minRule = defineRule({
129
137
  argument: "min",
130
138
  type: "Float",
131
139
  target: "number",
140
+ description: "The number must be greater than or equal to this value (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.",
132
141
  toZod: (schema, value) => schema.gte(value),
133
142
  toCode: (schema, value) => `${schema}.gte(${value})`,
134
143
  owns: (issue) => issue.code === "too_small" && issue.origin === "number" && issue.inclusive === true
@@ -138,6 +147,7 @@ var minItemsRule = defineRule({
138
147
  argument: "minItems",
139
148
  type: "Int",
140
149
  target: "list",
150
+ description: "The list must hold at least this many items (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to list values.",
141
151
  toZod: (schema, value) => schema.min(value),
142
152
  toCode: (schema, value) => `${schema}.min(${value})`,
143
153
  owns: (issue) => issue.code === "too_small" && issue.origin === "array"
@@ -147,6 +157,7 @@ var minLengthRule = defineRule({
147
157
  argument: "minLength",
148
158
  type: "Int",
149
159
  target: "string",
160
+ description: "The string must be at least this many characters long (UTF-16 code units, inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.",
150
161
  toZod: (schema, value) => schema.min(value),
151
162
  toCode: (schema, value) => `${schema}.min(${value})`,
152
163
  owns: (issue) => issue.code === "too_small" && issue.origin === "string"
@@ -156,6 +167,7 @@ var multipleOfRule = defineRule({
156
167
  argument: "multipleOf",
157
168
  type: "Float",
158
169
  target: "number",
170
+ description: "The number must be a whole multiple of this value (for example 5 accepts 0, 5 and 10). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.",
159
171
  toZod: (schema, value) => schema.multipleOf(value),
160
172
  toCode: (schema, value) => `${schema}.multipleOf(${value})`,
161
173
  owns: (issue) => issue.code === "not_multiple_of"
@@ -166,6 +178,7 @@ var notContainsRule = defineRule({
166
178
  argument: "notContains",
167
179
  type: "String",
168
180
  target: "string",
181
+ description: "The string must not contain this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.",
169
182
  toZod: (schema, value) => schema.refine((input) => !input.includes(value), message(value)),
170
183
  toCode: (schema, value) => `${schema}.refine((input) => !input.includes(${literal(value)}), ${literal(message(value))})`,
171
184
  owns: (issue) => issue.code === "custom"
@@ -182,6 +195,7 @@ var patternRule = defineRule({
182
195
  argument: "pattern",
183
196
  type: "String",
184
197
  target: "string",
198
+ description: "The string must match this regular expression (JavaScript syntax, not anchored unless it uses ^ and $). An invalid expression fails at server startup. Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.",
185
199
  toZod: (schema, value) => schema.regex(compile(value)),
186
200
  toCode: (schema, value) => `${schema}.regex(new RegExp(${literal(compile(value).source)}))`,
187
201
  owns: (issue) => issue.format === "regex"
@@ -191,6 +205,7 @@ var startsWithRule = defineRule({
191
205
  argument: "startsWith",
192
206
  type: "String",
193
207
  target: "string",
208
+ description: "The string must start with this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.",
194
209
  toZod: (schema, value) => schema.startsWith(value),
195
210
  toCode: (schema, value) => `${schema}.startsWith(${literal(value)})`,
196
211
  owns: (issue) => issue.format === "starts_with"
@@ -214,8 +229,14 @@ function constraintOf(issue) {
214
229
  }
215
230
 
216
231
  // src/constraint-directive.ts
217
- var constraintTypeDefs2 = `directive @constraint(
218
- ${Object.values(rules).map((rule) => ` ${rule.argument}: ${rule.type}`).join(`
232
+ var constraintTypeDefs2 = `"""
233
+ Validates an argument or an input field when the request arrives, before the resolver runs. A value that breaks a constraint is refused with a BAD_USER_INPUT error whose extensions list each issue with its path and the constraint that refused it; null and omitted values are not checked. Each argument below is one constraint, and they combine on one field.
234
+ """
235
+ directive @constraint(
236
+ ${Object.values(rules).map((rule) => ` """
237
+ ${rule.description}
238
+ """
239
+ ${rule.argument}: ${rule.type}`).join(`
219
240
  `)}
220
241
  ) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
221
242
  `;
@@ -242,5 +263,5 @@ function assertOwnConstraint(directive) {
242
263
 
243
264
  export { __export, RULE_PARAM, rules, applyRule, applyRuleCode, constraintOf, constraintTypeDefs2, assertOwnConstraint };
244
265
 
245
- //# debugId=02497C6067AC4D4564756E2164756E21
246
- //# sourceMappingURL=index-atwkcfg3.js.map
266
+ //# debugId=81ADC34E6A09C39064756E2164756E21
267
+ //# sourceMappingURL=index-sq3exxg2.js.map
@@ -0,0 +1,27 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/constraint-directive.ts", "../src/rules/rule.ts", "../src/rules/contains.ts", "../src/rules/ends-with.ts", "../src/rules/exclusive-max.ts", "../src/rules/exclusive-min.ts", "../src/rules/format.ts", "../src/rules/max.ts", "../src/rules/max-items.ts", "../src/rules/max-length.ts", "../src/rules/min.ts", "../src/rules/min-items.ts", "../src/rules/min-length.ts", "../src/rules/multiple-of.ts", "../src/rules/not-contains.ts", "../src/rules/pattern.ts", "../src/rules/starts-with.ts", "../src/rules/index.ts"],
4
+ "sourcesContent": [
5
+ "import { DirectiveLocation, type GraphQLDirective } from 'graphql';\nimport { rules } from './rules';\n\n/**\n * The SDL of `@constraint`, to add to a schema-first server's `typeDefs`,\n * written from the rules: an argument is declared once its rule exists.\n *\n * Its arguments are graphql-constraint-directive's, minus `uniqueTypeName`\n * (a detail of that package's scalar wrapping). It is allowed on arguments\n * and input fields only, where that package also allows output fields: a\n * resolver's result is the output scalars' job, and a directive that checked\n * nothing there would be a promise broken in silence.\n */\nexport const constraintTypeDefs: string = `\"\"\"\nValidates an argument or an input field when the request arrives, before the resolver runs. A value that breaks a constraint is refused with a BAD_USER_INPUT error whose extensions list each issue with its path and the constraint that refused it; null and omitted values are not checked. Each argument below is one constraint, and they combine on one field.\n\"\"\"\ndirective @constraint(\n${Object.values(rules)\n\t.map(\n\t\t(rule) =>\n\t\t\t`\\t\"\"\"\\n\\t${rule.description}\\n\\t\"\"\"\\n\\t${rule.argument}: ${rule.type}`,\n\t)\n\t.join('\\n')}\n) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION\n`;\n\nconst allowed = new Set<string>([\n\tDirectiveLocation.ARGUMENT_DEFINITION,\n\tDirectiveLocation.INPUT_FIELD_DEFINITION,\n]);\n\n/**\n * Fails when the schema's `@constraint` is not the one\n * {@link constraintTypeDefs} declares — graphql-constraint-directive's, say,\n * kept from a migration. Its extra locations would be accepted and checked\n * by nothing, its extra arguments mean nothing here, and an argument of\n * another type would reach a rule as the wrong kind of value.\n */\nexport function assertOwnConstraint(directive: GraphQLDirective): void {\n\tconst problems = [\n\t\t...(directive.isRepeatable\n\t\t\t? ['repeatable, and only its first use is read']\n\t\t\t: []),\n\t\t...directive.locations\n\t\t\t.filter((location) => !allowed.has(location))\n\t\t\t.map((location) => `allowed on ${location}`),\n\t\t...directive.args.flatMap((arg) => {\n\t\t\tconst rule = (rules as Record<string, { type: string } | undefined>)[\n\t\t\t\targ.name\n\t\t\t];\n\t\t\tif (!rule) return [`declares ${arg.name}, which no rule reads`];\n\t\t\tconst type = String(arg.type);\n\t\t\treturn type === rule.type\n\t\t\t\t? []\n\t\t\t\t: [`declares ${arg.name}: ${type}, not ${rule.type}`];\n\t\t}),\n\t];\n\tif (problems.length > 0) {\n\t\tthrow new Error(\n\t\t\t`This schema's @constraint is not constraintTypeDefs': it is ${problems.join('; ')}. Declare it with constraintTypeDefs.`,\n\t\t);\n\t}\n}\n",
6
+ "import type { z } from 'zod';\nimport type { StringSchema } from '../formats/format';\nimport type { FormatRegistry } from '../formats/registry';\n\n/** The schema each kind of rule narrows. */\nexport interface Targets {\n\tstring: StringSchema;\n\tnumber: z.ZodNumber;\n\tlist: z.ZodArray<z.ZodType>;\n}\n\nexport type Target = keyof Targets;\n\n/**\n * What a rule may read besides its value: the formats `format` resolves\n * against, the built-in ones and the application's own, and, when writing\n * source, how to write one of the application's (`InputCodeOptions.format`).\n */\nexport interface RuleContext {\n\treadonly formats: FormatRegistry;\n\treadonly formatCode?: ((name: string) => string) | undefined;\n}\n\n/** What a `@constraint` argument's value can be. */\ninterface ValueOf {\n\tInt: number;\n\tFloat: number;\n\tString: string;\n}\n\n/**\n * One `@constraint` argument: its GraphQL type in the directive's SDL, the\n * kind of value it narrows, and the same narrowing twice — `toZod` applied to\n * a schema at startup, `toCode` written as source by a code generator. The\n * spec beside each rule proves the two accept and refuse the same values.\n *\n * A `base` rule (only `format`) replaces the schema instead of narrowing it,\n * so a builder applies it before every other rule of its target.\n */\nexport interface Rule<\n\tA extends string = string,\n\tT extends keyof ValueOf = keyof ValueOf,\n\tK extends Target = Target,\n> {\n\treadonly argument: A;\n\treadonly type: T;\n\treadonly target: K;\n\t/**\n\t * The argument's description in the shipped SDL: what it enforces, its\n\t * bounds, the values it applies to and how a refusal reaches the client.\n\t */\n\treadonly description: string;\n\treadonly base?: true;\n\treadonly toZod: (\n\t\tschema: Targets[K],\n\t\tvalue: ValueOf[T],\n\t\tcontext: RuleContext,\n\t) => Targets[K];\n\t/**\n\t * `schema` is the source of the schema this rule narrows. The source names\n\t * zod as a free `z`: the generated file imports it.\n\t */\n\treadonly toCode: (\n\t\tschema: string,\n\t\tvalue: ValueOf[T],\n\t\tcontext: RuleContext,\n\t) => string;\n\t/**\n\t * Whether a Zod issue is this rule's refusal, so the error a client gets\n\t * names the rule (`constraint: 'minLength'`), which does not change with\n\t * Zod's own issue codes.\n\t */\n\treadonly owns: (issue: IssueFields) => boolean;\n}\n\n/** The fields of a Zod issue a rule recognises its refusal by. */\nexport interface IssueFields {\n\treadonly code: string;\n\treadonly origin?: string;\n\treadonly format?: string;\n\treadonly inclusive?: boolean;\n\treadonly params?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * The `params` key that marks an issue as one argument's whatever its code:\n * an application format's issues carry `format` there, so a `.regex()` or a\n * `.refine()` inside one is not read as `pattern` or `notContains`.\n */\nexport const RULE_PARAM = 'nxgtConstraint';\n\n/** Declares a rule, with its argument name kept literal. */\nexport function defineRule<\n\tconst A extends string,\n\tT extends keyof ValueOf,\n\tK extends Target,\n>(rule: Rule<A, T, K>): Rule<A, T, K> {\n\treturn rule;\n}\n\n/** A string literal as source: quotes and escapes included. */\nexport const literal = (value: string): string => JSON.stringify(value);\n",
7
+ "import { defineRule, literal } from './rule';\n\nexport const containsRule = defineRule({\n\targument: 'contains',\n\ttype: 'String',\n\ttarget: 'string',\n\tdescription:\n\t\t'The string must contain this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.',\n\ttoZod: (schema, value) => schema.includes(value),\n\ttoCode: (schema, value) => `${schema}.includes(${literal(value)})`,\n\towns: (issue) => issue.format === 'includes',\n});\n",
8
+ "import { defineRule, literal } from './rule';\n\nexport const endsWithRule = defineRule({\n\targument: 'endsWith',\n\ttype: 'String',\n\ttarget: 'string',\n\tdescription:\n\t\t'The string must end with this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.',\n\ttoZod: (schema, value) => schema.endsWith(value),\n\ttoCode: (schema, value) => `${schema}.endsWith(${literal(value)})`,\n\towns: (issue) => issue.format === 'ends_with',\n});\n",
9
+ "import { defineRule } from './rule';\n\nexport const exclusiveMaxRule = defineRule({\n\targument: 'exclusiveMax',\n\ttype: 'Float',\n\ttarget: 'number',\n\tdescription:\n\t\t'The number must be strictly less than this value (the value itself is refused). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.',\n\ttoZod: (schema, value) => schema.lt(value),\n\ttoCode: (schema, value) => `${schema}.lt(${value})`,\n\towns: (issue) =>\n\t\tissue.code === 'too_big' &&\n\t\tissue.origin === 'number' &&\n\t\tissue.inclusive === false,\n});\n",
10
+ "import { defineRule } from './rule';\n\nexport const exclusiveMinRule = defineRule({\n\targument: 'exclusiveMin',\n\ttype: 'Float',\n\ttarget: 'number',\n\tdescription:\n\t\t'The number must be strictly greater than this value (the value itself is refused). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.',\n\ttoZod: (schema, value) => schema.gt(value),\n\ttoCode: (schema, value) => `${schema}.gt(${value})`,\n\towns: (issue) =>\n\t\tissue.code === 'too_small' &&\n\t\tissue.origin === 'number' &&\n\t\tissue.inclusive === false,\n});\n",
11
+ "import { defineRule, RULE_PARAM } from './rule';\n\n// The string rules' own formats; every other invalid_format is a format's.\nconst NARROWING = new Set(['starts_with', 'ends_with', 'includes', 'regex']);\n\nexport const formatRule = defineRule({\n\targument: 'format',\n\ttype: 'String',\n\ttarget: 'string',\n\tdescription:\n\t\t'The string must match this named format: byte, date, date-time, email, ipv4, ipv6, uri or uuid, or a format the server registered. An unknown name fails at server startup. Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.',\n\tbase: true,\n\ttoZod: (_schema, value, { formats }) => formats.named(value).toZod(),\n\ttoCode: (_schema, value, { formats, formatCode }) => {\n\t\tconst format = formats.named(value);\n\t\tif (format.toCode) return format.toCode();\n\t\tif (formatCode) return formatCode(value);\n\t\tthrow new Error(\n\t\t\t`@constraint(format: \"${value}\") is one of the application's formats: its source is the code generator's to write, through inputCode's format option.`,\n\t\t);\n\t},\n\t// An application format's issues are marked, whatever their code\n\t// (`custom` for a `.refine()`): see FormatRegistry.\n\towns: (issue) =>\n\t\tissue.params?.[RULE_PARAM] === 'format' ||\n\t\t(issue.code === 'invalid_format' && !NARROWING.has(issue.format ?? '')),\n});\n",
12
+ "import { defineRule } from './rule';\n\nexport const maxRule = defineRule({\n\targument: 'max',\n\ttype: 'Float',\n\ttarget: 'number',\n\tdescription:\n\t\t'The number must be less than or equal to this value (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.',\n\ttoZod: (schema, value) => schema.lte(value),\n\ttoCode: (schema, value) => `${schema}.lte(${value})`,\n\towns: (issue) =>\n\t\tissue.code === 'too_big' &&\n\t\tissue.origin === 'number' &&\n\t\tissue.inclusive === true,\n});\n",
13
+ "import { defineRule } from './rule';\n\nexport const maxItemsRule = defineRule({\n\targument: 'maxItems',\n\ttype: 'Int',\n\ttarget: 'list',\n\tdescription:\n\t\t'The list must hold at most this many items (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to list values.',\n\ttoZod: (schema, value) => schema.max(value),\n\ttoCode: (schema, value) => `${schema}.max(${value})`,\n\towns: (issue) => issue.code === 'too_big' && issue.origin === 'array',\n});\n",
14
+ "import { defineRule } from './rule';\n\nexport const maxLengthRule = defineRule({\n\targument: 'maxLength',\n\ttype: 'Int',\n\ttarget: 'string',\n\tdescription:\n\t\t'The string must be at most this many characters long (UTF-16 code units, inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.',\n\ttoZod: (schema, value) => schema.max(value),\n\ttoCode: (schema, value) => `${schema}.max(${value})`,\n\towns: (issue) => issue.code === 'too_big' && issue.origin === 'string',\n});\n",
15
+ "import { defineRule } from './rule';\n\nexport const minRule = defineRule({\n\targument: 'min',\n\ttype: 'Float',\n\ttarget: 'number',\n\tdescription:\n\t\t'The number must be greater than or equal to this value (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.',\n\ttoZod: (schema, value) => schema.gte(value),\n\ttoCode: (schema, value) => `${schema}.gte(${value})`,\n\towns: (issue) =>\n\t\tissue.code === 'too_small' &&\n\t\tissue.origin === 'number' &&\n\t\tissue.inclusive === true,\n});\n",
16
+ "import { defineRule } from './rule';\n\nexport const minItemsRule = defineRule({\n\targument: 'minItems',\n\ttype: 'Int',\n\ttarget: 'list',\n\tdescription:\n\t\t'The list must hold at least this many items (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to list values.',\n\ttoZod: (schema, value) => schema.min(value),\n\ttoCode: (schema, value) => `${schema}.min(${value})`,\n\towns: (issue) => issue.code === 'too_small' && issue.origin === 'array',\n});\n",
17
+ "import { defineRule } from './rule';\n\nexport const minLengthRule = defineRule({\n\targument: 'minLength',\n\ttype: 'Int',\n\ttarget: 'string',\n\tdescription:\n\t\t'The string must be at least this many characters long (UTF-16 code units, inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.',\n\ttoZod: (schema, value) => schema.min(value),\n\ttoCode: (schema, value) => `${schema}.min(${value})`,\n\towns: (issue) => issue.code === 'too_small' && issue.origin === 'string',\n});\n",
18
+ "import { defineRule } from './rule';\n\nexport const multipleOfRule = defineRule({\n\targument: 'multipleOf',\n\ttype: 'Float',\n\ttarget: 'number',\n\tdescription:\n\t\t'The number must be a whole multiple of this value (for example 5 accepts 0, 5 and 10). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.',\n\ttoZod: (schema, value) => schema.multipleOf(value),\n\ttoCode: (schema, value) => `${schema}.multipleOf(${value})`,\n\towns: (issue) => issue.code === 'not_multiple_of',\n});\n",
19
+ "import { defineRule, literal } from './rule';\n\nconst message = (value: string) => `Must not contain ${literal(value)}`;\n\nexport const notContainsRule = defineRule({\n\targument: 'notContains',\n\ttype: 'String',\n\ttarget: 'string',\n\tdescription:\n\t\t'The string must not contain this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.',\n\t// `refine` keeps the schema's own type, so later rules still chain.\n\ttoZod: (schema, value) =>\n\t\tschema.refine((input) => !input.includes(value), message(value)),\n\ttoCode: (schema, value) =>\n\t\t`${schema}.refine((input) => !input.includes(${literal(value)}), ${literal(message(value))})`,\n\towns: (issue) => issue.code === 'custom',\n});\n",
20
+ "import { defineRule, literal } from './rule';\n\n/** The pattern as a RegExp, or an error that names the argument. */\nfunction compile(value: string): RegExp {\n\ttry {\n\t\treturn new RegExp(value);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Invalid @constraint pattern ${literal(value)}: ${(error as Error).message}`,\n\t\t);\n\t}\n}\n\nexport const patternRule = defineRule({\n\targument: 'pattern',\n\ttype: 'String',\n\ttarget: 'string',\n\tdescription:\n\t\t'The string must match this regular expression (JavaScript syntax, not anchored unless it uses ^ and $). An invalid expression fails at server startup. Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.',\n\ttoZod: (schema, value) => schema.regex(compile(value)),\n\ttoCode: (schema, value) =>\n\t\t`${schema}.regex(new RegExp(${literal(compile(value).source)}))`,\n\towns: (issue) => issue.format === 'regex',\n});\n",
21
+ "import { defineRule, literal } from './rule';\n\nexport const startsWithRule = defineRule({\n\targument: 'startsWith',\n\ttype: 'String',\n\ttarget: 'string',\n\tdescription:\n\t\t'The string must start with this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.',\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
+ "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))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AAQ,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": "81ADC34E6A09C39064756E2164756E21",
26
+ "names": []
27
+ }
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  constraintTypeDefs2
4
- } from "./chunks/index-atwkcfg3.js";
4
+ } from "./chunks/index-sq3exxg2.js";
5
5
 
6
6
  // src/typedefs-command.ts
7
7
  import { mkdir, writeFile } from "node:fs/promises";
package/dist/codegen.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  applyRuleCode
3
- } from "./chunks/index-atwkcfg3.js";
3
+ } from "./chunks/index-sq3exxg2.js";
4
4
  import {
5
5
  registryOf,
6
6
  constraintsOn2,
@@ -8,7 +8,7 @@ import {
8
8
  assertObjectTargets,
9
9
  baseCode,
10
10
  checkConstraints2
11
- } from "./chunks/index-w9pw7fsk.js";
11
+ } from "./chunks/index-5x1yd76p.js";
12
12
  // src/builder/input-code.ts
13
13
  import {
14
14
  getNamedType,
@@ -1 +1 @@
1
- {"version":3,"file":"constraint-directive.d.ts","sourceRoot":"","sources":["../src/constraint-directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGnE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAKhC,CAAC;AAOF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAwBrE"}
1
+ {"version":3,"file":"constraint-directive.d.ts","sourceRoot":"","sources":["../src/constraint-directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGnE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAWhC,CAAC;AAOF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAwBrE"}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export type { FormatName } from './formats/index.js';
5
5
  export type { StringSchema } from './formats/format.js';
6
6
  export type { FormatSchemas, OwnFormats } from './formats/registry.js';
7
7
  export { type FieldError, type FieldIssue, type FieldsErrorOptions, fieldsError, INVALID_INPUT, type InvalidInputOptions, type IssueParams, inputPath, invalidInputError, type Translate, } from './invalid-input.js';
8
+ export { invalidInputOf } from './invalid-input-of.js';
8
9
  export { type MaxDepthOptions, maxDepth } from './limits/max-depth.js';
9
10
  export { type MaxFieldsOptions, maxFields } from './limits/max-fields.js';
10
11
  export { type MaxListCostOptions, maxListCost } from './limits/max-list-cost.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,sBAAsB,EAC3B,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,eAAe,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,YAA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AAkB,EACvB,WAAW,EACX,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,SAAS,EACT,iBAAiB,EACjB,KAAK,SAAS,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,eAAe,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EACN,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,SAAS,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,qBAAqB,EAC1B,cAAc,GACd,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  constraintOf,
3
3
  constraintTypeDefs2
4
- } from "./chunks/index-atwkcfg3.js";
4
+ } from "./chunks/index-sq3exxg2.js";
5
5
  import {
6
6
  checkConstraints2
7
- } from "./chunks/index-w9pw7fsk.js";
7
+ } from "./chunks/index-5x1yd76p.js";
8
8
 
9
9
  // src/bad-user-input.ts
10
10
  import { GraphQLError } from "graphql";
@@ -131,9 +131,54 @@ function codeOf(issue) {
131
131
  return FIELD_CODES.invalid;
132
132
  }
133
133
  }
134
+ // src/invalid-input-of.ts
135
+ import { GraphQLError as GraphQLError3 } from "graphql";
136
+ var KINDS = {
137
+ minLength: { code: FIELD_CODES.tooShort, param: "min" },
138
+ maxLength: { code: FIELD_CODES.tooLong, param: "max" },
139
+ min: { code: FIELD_CODES.outOfRange, param: "min" },
140
+ max: { code: FIELD_CODES.outOfRange, param: "max" },
141
+ exclusiveMin: { code: FIELD_CODES.outOfRange, param: "exclusiveMin" },
142
+ exclusiveMax: { code: FIELD_CODES.outOfRange, param: "exclusiveMax" },
143
+ multipleOf: { code: FIELD_CODES.outOfRange, param: "multipleOf" },
144
+ minItems: { code: FIELD_CODES.tooFew, param: "min" },
145
+ maxItems: { code: FIELD_CODES.tooMany, param: "max" },
146
+ format: { code: FIELD_CODES.invalidFormat, param: "format" },
147
+ pattern: { code: FIELD_CODES.invalidFormat }
148
+ };
149
+ function fieldOf(issue) {
150
+ const kind = issue.constraint ? KINDS[issue.constraint] : undefined;
151
+ const path = inputPath(issue.path);
152
+ if (!kind)
153
+ return { path, code: FIELD_CODES.invalid };
154
+ const params = kind.param && issue.value !== undefined ? { [kind.param]: issue.value } : undefined;
155
+ return { path, code: kind.code, ...params && { params } };
156
+ }
157
+ function issuesOf2(error) {
158
+ const source = error.extensions["code"] === "BAD_USER_INPUT" ? error : error.originalError;
159
+ if (!(source instanceof GraphQLError3))
160
+ return;
161
+ if (source.extensions["code"] !== "BAD_USER_INPUT")
162
+ return;
163
+ const issues = source.extensions["issues"];
164
+ return Array.isArray(issues) ? issues : undefined;
165
+ }
166
+ function invalidInputOf(error, options = {}) {
167
+ const issues = issuesOf2(error);
168
+ if (!issues)
169
+ return error;
170
+ return invalidInputError(issues.map(fieldOf), {
171
+ ...options,
172
+ nodes: error.nodes ?? null,
173
+ source: error.source ?? null,
174
+ positions: error.positions ?? null,
175
+ path: error.path ?? null,
176
+ originalError: error
177
+ });
178
+ }
134
179
  // src/limits/max-depth.ts
135
180
  import {
136
- GraphQLError as GraphQLError3
181
+ GraphQLError as GraphQLError4
137
182
  } from "graphql";
138
183
 
139
184
  // src/limits/describe.ts
@@ -271,7 +316,7 @@ function maxDepth(options) {
271
316
  OperationDefinition(operation) {
272
317
  const depth = depthOf(walk, operation.selectionSet);
273
318
  if (depth > limit) {
274
- context.reportError(new GraphQLError3(`${operationLabel(operation)} is ${depth} levels deep, more than the ${limit} allowed`, {
319
+ context.reportError(new GraphQLError4(`${operationLabel(operation)} is ${depth} levels deep, more than the ${limit} allowed`, {
275
320
  nodes: [operation],
276
321
  extensions: { code: "QUERY_TOO_DEEP", depth, limit }
277
322
  }));
@@ -283,7 +328,7 @@ function maxDepth(options) {
283
328
  }
284
329
  // src/limits/max-fields.ts
285
330
  import {
286
- GraphQLError as GraphQLError4
331
+ GraphQLError as GraphQLError5
287
332
  } from "graphql";
288
333
  function countOf(walk, selectionSet) {
289
334
  let total = 0;
@@ -317,7 +362,7 @@ function maxFields(options) {
317
362
  OperationDefinition(operation) {
318
363
  const fields = countOf(walk, operation.selectionSet);
319
364
  if (fields > limit) {
320
- context.reportError(new GraphQLError4(`${operationLabel(operation)} selects ${fields} fields, more than the ${limit} allowed`, {
365
+ context.reportError(new GraphQLError5(`${operationLabel(operation)} selects ${fields} fields, more than the ${limit} allowed`, {
321
366
  nodes: [operation],
322
367
  extensions: { code: "QUERY_TOO_WIDE", fields, limit }
323
368
  }));
@@ -329,7 +374,7 @@ function maxFields(options) {
329
374
  }
330
375
  // src/limits/max-list-cost.ts
331
376
  import {
332
- GraphQLError as GraphQLError5,
377
+ GraphQLError as GraphQLError6,
333
378
  getNamedType,
334
379
  getNullableType,
335
380
  isListType
@@ -341,7 +386,7 @@ import {
341
386
  isObjectType as isObjectType2
342
387
  } from "graphql";
343
388
  var multiply = (a, b) => Math.min(CEILING, a * b);
344
- function fieldOf(cost, parent, name) {
389
+ function fieldOf2(cost, parent, name) {
345
390
  if (parent === cost.schema.getQueryType() && isIntrospectionRoot(name)) {
346
391
  return introspectionRoot(name);
347
392
  }
@@ -577,7 +622,7 @@ function costOf(cost, selectionSet, parent, pending) {
577
622
  continue;
578
623
  if (isIntrospectionRoot(name) && cost.ignoreIntrospection)
579
624
  continue;
580
- const definition = fieldOf(cost, parent, name);
625
+ const definition = fieldOf2(cost, parent, name);
581
626
  if (!definition)
582
627
  continue;
583
628
  total = add(total, fieldCost(cost, parent, selection, definition, pending));
@@ -619,7 +664,7 @@ function maxListCost(options) {
619
664
  OperationDefinition(operation) {
620
665
  const total = costOf(cost, operation.selectionSet, rootType(schema, operation), undefined);
621
666
  if (total > budget) {
622
- context.reportError(new GraphQLError5(`${operationLabel(operation)} costs ${total}, more than the ${budget} allowed`, {
667
+ context.reportError(new GraphQLError6(`${operationLabel(operation)} costs ${total}, more than the ${budget} allowed`, {
623
668
  nodes: [operation],
624
669
  extensions: {
625
670
  code: "QUERY_TOO_COSTLY",
@@ -707,6 +752,7 @@ export {
707
752
  fieldsError,
708
753
  inputPath,
709
754
  invalidInputError,
755
+ invalidInputOf,
710
756
  maxDepth,
711
757
  maxFields,
712
758
  maxListCost,
@@ -714,5 +760,5 @@ export {
714
760
  withValidation
715
761
  };
716
762
 
717
- //# debugId=B1856E23719B140164756E2164756E21
763
+ //# debugId=272206072C5FB7A264756E2164756E21
718
764
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/bad-user-input.ts", "../src/invalid-input.ts", "../src/field-issue-of.ts", "../src/limits/max-depth.ts", "../src/limits/describe.ts", "../src/limits/fragments.ts", "../src/limits/introspection.ts", "../src/limits/max-fields.ts", "../src/limits/max-list-cost.ts", "../src/limits/cost-context.ts", "../src/limits/list-size.ts", "../src/limits/size-reading.ts", "../src/limits/max-list-cost-options.ts", "../src/limits/pending-size.ts", "../src/validated.ts", "../src/with-validation.ts"],
3
+ "sources": ["../src/bad-user-input.ts", "../src/invalid-input.ts", "../src/field-issue-of.ts", "../src/invalid-input-of.ts", "../src/limits/max-depth.ts", "../src/limits/describe.ts", "../src/limits/fragments.ts", "../src/limits/introspection.ts", "../src/limits/max-fields.ts", "../src/limits/max-list-cost.ts", "../src/limits/cost-context.ts", "../src/limits/list-size.ts", "../src/limits/size-reading.ts", "../src/limits/max-list-cost-options.ts", "../src/limits/pending-size.ts", "../src/validated.ts", "../src/with-validation.ts"],
4
4
  "sourcesContent": [
5
5
  "import { GraphQLError } from 'graphql';\nimport type { z } from 'zod';\nimport type { ConstraintArgument } from './rules';\n\n/** One reason an input was refused, at its path inside the arguments. */\nexport interface ValidationIssue {\n\t/** `['input', 'address', 'zip']`: the argument, then the input fields. */\n\treadonly path: readonly (string | number)[];\n\treadonly message: string;\n\t/** Zod's issue code: `too_small`, `invalid_format`, `custom`, ... */\n\treadonly code: string;\n\t/**\n\t * The `@constraint` argument that refused (`minLength`, `format`), when a\n\t * directive did: stable across Zod versions, unlike `code`. Absent for a\n\t * refusal of `validated()`'s own schema.\n\t */\n\treadonly constraint?: ConstraintArgument;\n\t/**\n\t * What that `@constraint` argument was declared with, exactly as written\n\t * (`100` for `maxLength: 100`, `\"email\"` for `format: \"email\"`), so a\n\t * client can say \"at most 100 characters\" without parsing `message`.\n\t * Present exactly when `constraint` is.\n\t */\n\treadonly value?: ConstraintValue;\n}\n\n/** What a `@constraint` argument is declared with: a number or a string. */\nexport type ConstraintValue = string | number;\n\n/** The `extensions` of the error an invalid input becomes. */\nexport type BadUserInputExtensions = {\n\treadonly code: 'BAD_USER_INPUT';\n\treadonly issues: readonly ValidationIssue[];\n};\n\n/**\n * Names the `@constraint` argument behind an issue, and what it was declared\n * with, when there is one.\n */\nexport type ConstraintOf = (\n\tissue: z.core.$ZodIssue,\n) => { argument: ConstraintArgument; value: ConstraintValue } | undefined;\n\nfunction issuesOf(\n\terror: z.ZodError,\n\tconstraintOf?: ConstraintOf,\n): ValidationIssue[] {\n\treturn error.issues.map((issue) => {\n\t\tconst path = issue.path.map((key) =>\n\t\t\ttypeof key === 'number' ? key : String(key),\n\t\t);\n\t\tconst constraint = constraintOf?.(issue);\n\t\treturn constraint\n\t\t\t? {\n\t\t\t\t\tpath,\n\t\t\t\t\tmessage: issue.message,\n\t\t\t\t\tcode: issue.code,\n\t\t\t\t\tconstraint: constraint.argument,\n\t\t\t\t\tvalue: constraint.value,\n\t\t\t\t}\n\t\t\t: { path, message: issue.message, code: issue.code };\n\t});\n}\n\nfunction errorOf(where: string, issues: ValidationIssue[]): GraphQLError {\n\tconst [first] = issues;\n\tconst reason = first\n\t\t? `${first.path.join('.') || 'arguments'}: ${first.message}`\n\t\t: 'refused';\n\tconst extensions: BadUserInputExtensions = { code: 'BAD_USER_INPUT', issues };\n\treturn new GraphQLError(`Invalid arguments for ${where}. ${reason}`, {\n\t\textensions,\n\t});\n}\n\n/**\n * The one error an invalid input becomes: `extensions.code` is\n * `BAD_USER_INPUT`, the code Apollo and most clients already read, and\n * `extensions.issues` lists every reason with its path, so a form can show\n * each one beside its field. The message names the field and the first\n * reason, for a log line.\n */\nexport function badUserInput(where: string, error: z.ZodError): GraphQLError {\n\treturn errorOf(where, issuesOf(error));\n}\n\n/** The parsed arguments, or the error above, its issues named by `constraintOf`. */\nexport async function parseArgs(\n\tschema: z.ZodType,\n\targs: unknown,\n\twhere: string,\n\tconstraintOf?: ConstraintOf,\n): Promise<unknown> {\n\tconst result = await schema.safeParseAsync(args);\n\tif (!result.success)\n\t\tthrow errorOf(where, issuesOf(result.error, constraintOf));\n\treturn result.data;\n}\n",
6
6
  "import { GraphQLError, type GraphQLErrorOptions } from 'graphql';\n\n/** The code of the error `invalidInputError` builds, and its default message. */\nexport const INVALID_INPUT = 'validation.errors.invalid-input';\n\n/** Values a message is built from, such as `{ min: 2 }`. */\nexport type IssueParams = Record<string, string | number>;\n\n/** One field at fault: where it is, why, and what the reason's message needs. */\nexport interface FieldIssue {\n\t/** The field inside the input, dotted: `person.firstName`, `tags.1`. */\n\treadonly path: string;\n\t/** A code your client and your translations know: `validation.errors.too-short`. */\n\treadonly code: string;\n\t/** Values the message needs; an object with no key counts as none. */\n\treadonly params?: IssueParams;\n}\n\n/** One entry of `extensions.fields`: a `FieldIssue` with its message. */\nexport interface FieldError {\n\treadonly path: string;\n\treadonly code: string;\n\t/** `translate(code, params)`, or the code itself without a translator. */\n\treadonly message: string;\n\t/** Present only when the issue had params with at least one key. */\n\treadonly params?: IssueParams;\n}\n\n/** Turns a code (and its params) into the text a person reads. */\nexport type Translate = (code: string, params?: IssueParams) => string;\n\n/** The options of `invalidInputError`: GraphQL's own, and a translator. */\nexport type InvalidInputOptions = GraphQLErrorOptions & {\n\treadonly translate?: Translate;\n};\n\n/** The options of `fieldsError`: also an HTTP status and the error's own params. */\nexport type FieldsErrorOptions = InvalidInputOptions & {\n\t/** `extensions.http.status`, for a server that reads it (409, ...). */\n\treadonly status?: number;\n\treadonly params?: IssueParams;\n};\n\n/** `params` itself, or `undefined` when it holds no key: never `{}`. */\nfunction paramsOf(params: IssueParams | undefined): IssueParams | undefined {\n\treturn params && Object.keys(params).length > 0 ? params : undefined;\n}\n\nfunction messageOf(\n\tcode: string,\n\tparams: IssueParams | undefined,\n\ttranslate: Translate | undefined,\n): string {\n\treturn translate?.(code, params) ?? code;\n}\n\nfunction fieldsOf(\n\tissues: readonly FieldIssue[],\n\ttranslate: Translate | undefined,\n): FieldError[] {\n\treturn issues.map(({ path, code, params: given }) => {\n\t\tconst params = paramsOf(given);\n\t\treturn {\n\t\t\tpath,\n\t\t\tcode,\n\t\t\tmessage: messageOf(code, params, translate),\n\t\t\t...(params && { params }),\n\t\t};\n\t});\n}\n\n/**\n * One 400 error listing every field at fault, for an API that answers invalid\n * input this way: `extensions` is `{ code: 'validation.errors.invalid-input',\n * http: { status: 400 }, fields }`, each field with its translated message\n * (the code itself without `translate`), in the order given. GraphQL's\n * options (`originalError`, `path`, `nodes`, ...) are kept; an `extensions`\n * among them is replaced by this one.\n */\nexport function invalidInputError(\n\tissues: readonly FieldIssue[],\n\toptions: InvalidInputOptions = {},\n): GraphQLError {\n\tconst { translate, ...graphql } = options;\n\treturn new GraphQLError(messageOf(INVALID_INPUT, undefined, translate), {\n\t\t...graphql,\n\t\textensions: {\n\t\t\tcode: INVALID_INPUT,\n\t\t\thttp: { status: 400 },\n\t\t\tfields: fieldsOf(issues, translate),\n\t\t},\n\t});\n}\n\n/**\n * A refusal of your own (a 409 conflict, say) that names the fields at\n * fault: `extensions` is `{ code, params?, http?: { status }, fields }`, the\n * fields worded as `invalidInputError` words them, the message\n * `translate(code, params)` or the code. An `extensions` among the options\n * is replaced by this one.\n */\nexport function fieldsError(\n\tcode: string,\n\tissues: readonly FieldIssue[],\n\toptions: FieldsErrorOptions = {},\n): GraphQLError {\n\tconst { translate, status, params: given, ...graphql } = options;\n\tconst params = paramsOf(given);\n\treturn new GraphQLError(messageOf(code, params, translate), {\n\t\t...graphql,\n\t\textensions: {\n\t\t\tcode,\n\t\t\t...(params && { params }),\n\t\t\t...(status && { http: { status } }),\n\t\t\tfields: fieldsOf(issues, translate),\n\t\t},\n\t});\n}\n\n/**\n * A GraphQL or Zod path as a `FieldIssue` path: dotted, without the leading\n * `input` argument when a field follows it, a symbol written as\n * `String(key)`. `['input', 'person', 'firstName']` is `person.firstName`,\n * `['input', 'tags', 1]` is `tags.1`, `['first']` and `['input']` stay as\n * they are.\n */\nexport function inputPath(path: readonly PropertyKey[]): string {\n\tconst [first, ...rest] = path;\n\treturn (first === 'input' && rest.length > 0 ? rest : path)\n\t\t.map((key) => String(key))\n\t\t.join('.');\n}\n",
7
7
  "import type { z } from 'zod';\nimport { type FieldIssue, inputPath } from './invalid-input';\n\n/**\n * The codes `fieldIssueOf` gives, each under `validation.errors.`: a string's\n * length (`too-short`, `too-long`), a number's or bigint's bound or multiple\n * (`out-of-range`), a list's or set's size (`too-few`, `too-many`), a named\n * format or a pattern (`invalid-format`), anything else (`invalid`).\n */\nexport const FIELD_CODES = {\n\ttooShort: 'validation.errors.too-short',\n\ttooLong: 'validation.errors.too-long',\n\toutOfRange: 'validation.errors.out-of-range',\n\ttooFew: 'validation.errors.too-few',\n\ttooMany: 'validation.errors.too-many',\n\tinvalidFormat: 'validation.errors.invalid-format',\n\tinvalid: 'validation.errors.invalid',\n} as const;\n\n/** The string checks Zod reports as `invalid_format` that are not a format. */\nconst TEXT_CHECKS: ReadonlySet<string> = new Set([\n\t'starts_with',\n\t'ends_with',\n\t'includes',\n]);\n\n/**\n * A Zod issue as a `FieldIssue`, for `invalidInputError`: its path through\n * `inputPath` (dotted, a leading `input` dropped) and one of `FIELD_CODES`,\n * without params. `too-short` / `too-long` for a string's length,\n * `out-of-range` for a number's or bigint's bound or a multiple, `too-few` /\n * `too-many` for a list's or set's size, `invalid-format` for a named format\n * or a pattern, `invalid` for anything else (a prefix, a suffix or a\n * substring included).\n */\nexport function fieldIssueOf(issue: z.core.$ZodIssue): FieldIssue {\n\treturn { path: inputPath(issue.path), code: codeOf(issue) };\n}\n\nfunction codeOf(issue: z.core.$ZodIssue): string {\n\tswitch (issue.code) {\n\t\tcase 'too_small':\n\t\tcase 'too_big': {\n\t\t\tconst small = issue.code === 'too_small';\n\t\t\tswitch (issue.origin) {\n\t\t\t\tcase 'string':\n\t\t\t\t\treturn small ? FIELD_CODES.tooShort : FIELD_CODES.tooLong;\n\t\t\t\tcase 'number':\n\t\t\t\tcase 'bigint':\n\t\t\t\t\treturn FIELD_CODES.outOfRange;\n\t\t\t\tcase 'array':\n\t\t\t\tcase 'set':\n\t\t\t\t\treturn small ? FIELD_CODES.tooFew : FIELD_CODES.tooMany;\n\t\t\t\tdefault:\n\t\t\t\t\treturn FIELD_CODES.invalid;\n\t\t\t}\n\t\t}\n\t\tcase 'not_multiple_of':\n\t\t\treturn FIELD_CODES.outOfRange;\n\t\tcase 'invalid_format':\n\t\t\t// A prefix, a suffix or a substring is not a format: only a named\n\t\t\t// format (`email`, `uuid`, …) or a pattern is.\n\t\t\treturn TEXT_CHECKS.has(issue.format)\n\t\t\t\t? FIELD_CODES.invalid\n\t\t\t\t: FIELD_CODES.invalidFormat;\n\t\tdefault:\n\t\t\treturn FIELD_CODES.invalid;\n\t}\n}\n",
8
+ "import { GraphQLError } from 'graphql';\nimport type { ValidationIssue } from './bad-user-input';\nimport { FIELD_CODES } from './field-issue-of';\nimport {\n\ttype FieldIssue,\n\ttype InvalidInputOptions,\n\ttype IssueParams,\n\tinputPath,\n\tinvalidInputError,\n} from './invalid-input';\nimport type { ConstraintArgument } from './rules';\n\ninterface Kind {\n\treadonly code: string;\n\t/** The param the declared value is passed on as, when there is one. */\n\treadonly param?: string;\n}\n\n/** The code and the param of each `@constraint` argument; `pattern` has none, so a regex never reaches a client. */\nconst KINDS = {\n\tminLength: { code: FIELD_CODES.tooShort, param: 'min' },\n\tmaxLength: { code: FIELD_CODES.tooLong, param: 'max' },\n\tmin: { code: FIELD_CODES.outOfRange, param: 'min' },\n\tmax: { code: FIELD_CODES.outOfRange, param: 'max' },\n\texclusiveMin: { code: FIELD_CODES.outOfRange, param: 'exclusiveMin' },\n\texclusiveMax: { code: FIELD_CODES.outOfRange, param: 'exclusiveMax' },\n\tmultipleOf: { code: FIELD_CODES.outOfRange, param: 'multipleOf' },\n\tminItems: { code: FIELD_CODES.tooFew, param: 'min' },\n\tmaxItems: { code: FIELD_CODES.tooMany, param: 'max' },\n\tformat: { code: FIELD_CODES.invalidFormat, param: 'format' },\n\tpattern: { code: FIELD_CODES.invalidFormat },\n} as const satisfies Partial<Record<ConstraintArgument, Kind>>;\n\nfunction fieldOf(issue: ValidationIssue): FieldIssue {\n\tconst kind: Kind | undefined = issue.constraint\n\t\t? (KINDS as Partial<Record<string, Kind>>)[issue.constraint]\n\t\t: undefined;\n\tconst path = inputPath(issue.path);\n\tif (!kind) return { path, code: FIELD_CODES.invalid };\n\tconst params: IssueParams | undefined =\n\t\tkind.param && issue.value !== undefined\n\t\t\t? { [kind.param]: issue.value }\n\t\t\t: undefined;\n\treturn { path, code: kind.code, ...(params && { params }) };\n}\n\n/** The issues of a `BAD_USER_INPUT` error, direct or wrapped by graphql-js. */\nfunction issuesOf(error: GraphQLError): readonly ValidationIssue[] | undefined {\n\tconst source =\n\t\terror.extensions['code'] === 'BAD_USER_INPUT' ? error : error.originalError;\n\tif (!(source instanceof GraphQLError)) return undefined;\n\tif (source.extensions['code'] !== 'BAD_USER_INPUT') return undefined;\n\tconst issues = source.extensions['issues'];\n\treturn Array.isArray(issues) ? issues : undefined;\n}\n\n/**\n * The `invalidInputError` of a `@constraint` refusal: a `BAD_USER_INPUT`\n * error as `withValidation` / `validated` throw it, or one whose\n * `originalError` is (graphql-js wraps it with the field's location). Each\n * issue becomes a field `{ path, code, params }`: `too-short` / `too-long`\n * (`minLength`, `maxLength`), `out-of-range` (`min`, `max`, `exclusiveMin`,\n * `exclusiveMax`, `multipleOf`), `too-few` / `too-many` (`minItems`,\n * `maxItems`), `invalid-format` (`format`, `pattern`), `invalid` for the rest,\n * an issue with no `constraint` included. `params` is the declared value\n * under the argument's own key (`{ min }`, `{ max }`, `{ exclusiveMin }`,\n * `{ exclusiveMax }`, `{ multipleOf }`, `{ format }`), none for `pattern`.\n * The location (`nodes`, `source`, `positions`, `path`) is kept and\n * `originalError` is the error given. Any other error is returned as it is\n * (the same object).\n */\nexport function invalidInputOf(\n\terror: GraphQLError,\n\toptions: Pick<InvalidInputOptions, 'translate'> = {},\n): GraphQLError {\n\tconst issues = issuesOf(error);\n\tif (!issues) return error;\n\treturn invalidInputError(issues.map(fieldOf), {\n\t\t...options,\n\t\tnodes: error.nodes ?? null,\n\t\tsource: error.source ?? null,\n\t\tpositions: error.positions ?? null,\n\t\tpath: error.path ?? null,\n\t\toriginalError: error,\n\t});\n}\n",
8
9
  "import {\n\tGraphQLError,\n\ttype SelectionSetNode,\n\ttype ValidationContext,\n\ttype ValidationRule,\n} from 'graphql';\nimport { assertInteger, operationLabel } from './describe';\nimport {\n\ttype FragmentWalk,\n\tfragmentValue,\n\tNO_KEY,\n\tnewFragmentWalk,\n} from './fragments';\nimport { isIntrospectionRoot } from './introspection';\n\n/** Options of {@link maxDepth}. */\nexport interface MaxDepthOptions {\n\t/** The deepest nesting of field selections an operation may have (at least 1). */\n\tdepth: number;\n\t/**\n\t * Do not count `__schema` and `__type` (default `false`). Only where\n\t * introspection is disabled or the client is trusted, e.g. GraphiQL in\n\t * development: the standard introspection query (`getIntrospectionQuery()`) is 15 levels deep.\n\t */\n\tignoreIntrospection?: boolean;\n}\n\n/** What a walk of one document needs: the options, and what it has measured so far. */\ninterface DepthContext extends FragmentWalk {\n\tignoreIntrospection: boolean;\n}\n\n/** The depth of `selectionSet`: 0 when it selects no field. */\nfunction depthOf(depth: DepthContext, selectionSet: SelectionSetNode): number {\n\tlet deepest = 0;\n\tfor (const selection of selectionSet.selections) {\n\t\tlet here = 0;\n\t\tif (selection.kind === 'Field') {\n\t\t\tconst name = selection.name.value;\n\t\t\tif (name === '__typename') continue;\n\t\t\tif (depth.ignoreIntrospection && isIntrospectionRoot(name)) continue;\n\t\t\there =\n\t\t\t\t1 +\n\t\t\t\t(selection.selectionSet ? depthOf(depth, selection.selectionSet) : 0);\n\t\t} else if (selection.kind === 'InlineFragment') {\n\t\t\there = depthOf(depth, selection.selectionSet);\n\t\t} else {\n\t\t\there = fragmentDepth(depth, selection.name.value);\n\t\t}\n\t\tif (here > deepest) deepest = here;\n\t}\n\treturn deepest;\n}\n\n/** The depth of the named fragment, measured once. */\nfunction fragmentDepth(depth: DepthContext, name: string): number {\n\treturn fragmentValue(depth, name, NO_KEY, (fragment) =>\n\t\tdepthOf(depth, fragment.selectionSet),\n\t);\n}\n\n/**\n * A graphql-js validation rule refusing an operation nested deeper than\n * `depth` fields: a top-level field is depth 1.\n *\n * Named fragments are followed (each measured once), inline fragments add no\n * depth, and `__typename` does not count. One `GraphQLError` per\n * operation, with `extensions: { code: 'QUERY_TOO_DEEP', depth, limit }`,\n * `depth` being the operation's real depth.\n *\n * ```ts\n * validate(schema, document, [...specifiedRules, maxDepth({ depth: 8 })]);\n * // graphql-yoga: onValidate: ({ addValidationRule }) => addValidationRule(maxDepth({ depth: 8 }))\n * ```\n */\nexport function maxDepth(options: MaxDepthOptions): ValidationRule {\n\tconst limit = options.depth;\n\tassertInteger('maxDepth: depth', limit, 1);\n\treturn (context: ValidationContext) => {\n\t\tconst walk: DepthContext = {\n\t\t\t...newFragmentWalk((name) => context.getFragment(name)),\n\t\t\tignoreIntrospection: options.ignoreIntrospection ?? false,\n\t\t};\n\t\treturn {\n\t\t\tOperationDefinition(operation) {\n\t\t\t\tconst depth = depthOf(walk, operation.selectionSet);\n\t\t\t\tif (depth > limit) {\n\t\t\t\t\tcontext.reportError(\n\t\t\t\t\t\tnew GraphQLError(\n\t\t\t\t\t\t\t`${operationLabel(operation)} is ${depth} levels deep, more than the ${limit} allowed`,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tnodes: [operation],\n\t\t\t\t\t\t\t\textensions: { code: 'QUERY_TOO_DEEP', depth, limit },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t};\n\t};\n}\n",
9
10
  "import type { OperationDefinitionNode } from 'graphql';\n\n/** Costs and counts are plain numbers, held below this so a hostile query never reaches `Infinity`. */\nexport const CEILING = Number.MAX_SAFE_INTEGER;\n\n/** `a + b`, clamped where a number stops being exact. */\nexport const add = (a: number, b: number) => Math.min(CEILING, a + b);\n\n/** `Operation \"Name\"`, or `Operation` for an anonymous one. */\nexport function operationLabel(operation: OperationDefinitionNode): string {\n\treturn operation.name ? `Operation \"${operation.name.value}\"` : 'Operation';\n}\n\n/**\n * Throws a `RangeError` unless `value` is an integer from `min` up to, and\n * excluding, `max` (default: `Number.MAX_SAFE_INTEGER`, where a cost is clamped).\n */\nexport function assertInteger(\n\toption: string,\n\tvalue: number,\n\tmin: number,\n\tmax = CEILING,\n): void {\n\tif (!Number.isInteger(value) || value < min || value >= max) {\n\t\tthrow new RangeError(\n\t\t\t`${option} must be an integer from ${min} to ${max - 1}.`,\n\t\t);\n\t}\n}\n",
10
11
  "import type { FragmentDefinitionNode } from 'graphql';\n\n/** The key of a fragment whose value does not depend on anything but its name. */\nexport const NO_KEY = -1;\n\n/** What the fragment walk of one document keeps: the fragments, and what each was worth. */\nexport interface FragmentWalk {\n\tgetFragment: (name: string) => FragmentDefinitionNode | null | undefined;\n\tvalues: Map<string, Map<number, number>>;\n\tvisiting: Set<string>;\n}\n\n/** An empty walk over the fragments of one document. */\nexport function newFragmentWalk(\n\tgetFragment: FragmentWalk['getFragment'],\n): FragmentWalk {\n\treturn { getFragment, values: new Map(), visiting: new Set() };\n}\n\n/**\n * The value of the named fragment under `key`, computed once. `key` is a number,\n * or a function of what is already known for this fragment (`maxListCost` rounds\n * its pending size by it). A fragment reached while it is being computed is a\n * cycle, NoFragmentCyclesRule's to report: its back-edge adds nothing (0).\n */\nexport function fragmentValue(\n\twalk: FragmentWalk,\n\tname: string,\n\tkey: number | ((known: ReadonlyMap<number, number>) => number),\n\tcompute: (fragment: FragmentDefinitionNode, key: number) => number,\n): number {\n\tlet known = walk.values.get(name);\n\tif (!known) {\n\t\tknown = new Map();\n\t\twalk.values.set(name, known);\n\t}\n\tconst at = typeof key === 'number' ? key : key(known);\n\tconst memo = known.get(at);\n\tif (memo !== undefined) return memo;\n\tconst fragment = walk.getFragment(name);\n\tif (!fragment || walk.visiting.has(name)) return 0;\n\twalk.visiting.add(name);\n\tconst result = compute(fragment, at);\n\twalk.visiting.delete(name);\n\tknown.set(at, result);\n\treturn result;\n}\n",
@@ -19,7 +20,7 @@
19
20
  "import type { GraphQLFieldResolver, GraphQLResolveInfo } from 'graphql';\nimport { z } from 'zod';\nimport { parseArgs } from './bad-user-input';\n\n/** An object schema of the arguments, or its shape. */\nexport type ArgsSchema = z.ZodType<Record<string, unknown>> | z.ZodRawShape;\n\n/** The schema `ArgsSchema` stands for. */\nexport type SchemaOf<S extends ArgsSchema> = S extends z.ZodType\n\t? S\n\t: S extends z.ZodRawShape\n\t\t? // Mapped, not `S & z.ZodRawShape`: the intersection's index signature\n\t\t\t// would type every argument `unknown`.\n\t\t\tz.ZodObject<{ [K in keyof S]: S[K] }>\n\t\t: never;\n\n/**\n * What `validated` takes: the schema, or a function that builds it for each\n * call from the request's context and the field's `info`, for checks that\n * need them (a uniqueness query in the request's database, a rule that\n * depends on the viewer).\n */\nexport type ArgsSchemaFor<S extends ArgsSchema, TContext = unknown> =\n\t| S\n\t| SchemaFactory<S, TContext>;\n\ntype SchemaFactory<S extends ArgsSchema, TContext> = (\n\tcontext: TContext,\n\tinfo: GraphQLResolveInfo,\n) => S | Promise<S>;\n\n/**\n * A resolver whose arguments are checked by `schema` before it runs, for what\n * a `@constraint` cannot say: a rule across arguments, a business refinement,\n * an async check. It receives the parsed arguments (`z.output`), defaults and\n * transforms applied; an invalid input is the same `BAD_USER_INPUT` error as\n * the directives'.\n *\n * ```ts\n * signUp: validated(\n * z.object({ input: signUpSchema }).refine(({ input }) => input.password !== input.email),\n * (_, { input }) => users.create(input),\n * )\n * ```\n *\n * A check that needs the request takes a function in place of the schema:\n * it is called on each call, with the context and `info`, and returns the\n * schema (or a promise of it). What it throws reaches the client as it is,\n * not as `BAD_USER_INPUT`.\n *\n * ```ts\n * rename: validated(\n * (ctx: Context) => ({\n * name: z.string().refine(async (name) => !(await ctx.db.users.exists({ name })), 'taken'),\n * }),\n * (_, { name }, ctx) => ctx.db.users.rename(ctx.viewer, name),\n * )\n * ```\n */\nexport function validated<\n\tS extends ArgsSchema,\n\tTSource = unknown,\n\tTContext = unknown,\n\tTResult = unknown,\n>(\n\tschema: SchemaFactory<S, TContext>,\n\tresolve: (\n\t\tsource: TSource,\n\t\targs: z.output<SchemaOf<S>>,\n\t\tcontext: TContext,\n\t\tinfo: GraphQLResolveInfo,\n\t) => TResult,\n): GraphQLFieldResolver<\n\tTSource,\n\tTContext,\n\tz.input<SchemaOf<S>>,\n\tPromise<Awaited<TResult>>\n>;\nexport function validated<\n\tS extends ArgsSchema,\n\tTSource = unknown,\n\tTContext = unknown,\n\tTResult = unknown,\n>(\n\tschema: S,\n\tresolve: (\n\t\tsource: TSource,\n\t\targs: z.output<SchemaOf<S>>,\n\t\tcontext: TContext,\n\t\tinfo: GraphQLResolveInfo,\n\t) => TResult,\n): GraphQLFieldResolver<\n\tTSource,\n\tTContext,\n\tz.input<SchemaOf<S>>,\n\tPromise<Awaited<TResult>>\n>;\nexport function validated<\n\tS extends ArgsSchema,\n\tTSource = unknown,\n\tTContext = unknown,\n\tTResult = unknown,\n>(\n\tschema: ArgsSchemaFor<S, TContext>,\n\tresolve: (\n\t\tsource: TSource,\n\t\targs: z.output<SchemaOf<S>>,\n\t\tcontext: TContext,\n\t\tinfo: GraphQLResolveInfo,\n\t) => TResult,\n): GraphQLFieldResolver<\n\tTSource,\n\tTContext,\n\tz.input<SchemaOf<S>>,\n\tPromise<Awaited<TResult>>\n>;\nexport function validated<\n\tS extends ArgsSchema,\n\tTSource = unknown,\n\tTContext = unknown,\n\tTResult = unknown,\n>(\n\tschema: ArgsSchemaFor<S, TContext>,\n\tresolve: (\n\t\tsource: TSource,\n\t\targs: z.output<SchemaOf<S>>,\n\t\tcontext: TContext,\n\t\tinfo: GraphQLResolveInfo,\n\t) => TResult,\n): GraphQLFieldResolver<\n\tTSource,\n\tTContext,\n\tz.input<SchemaOf<S>>,\n\tPromise<Awaited<TResult>>\n> {\n\tconst fixed = typeof schema === 'function' ? undefined : zodOf(schema);\n\treturn async (source, args, context, info): Promise<Awaited<TResult>> => {\n\t\tconst where = `${info.parentType.name}.${info.fieldName}`;\n\t\tconst checked =\n\t\t\tfixed ??\n\t\t\tzodOf(await (schema as SchemaFactory<S, TContext>)(context, info));\n\t\tconst parsed = (await parseArgs(checked, args, where)) as z.output<\n\t\t\tSchemaOf<S>\n\t\t>;\n\t\treturn await resolve(source, parsed, context, info);\n\t};\n}\n\n/** The schema itself, or the object schema of a shape. */\nfunction zodOf(schema: ArgsSchema): z.ZodType {\n\t// `_zod`, not `instanceof`: a schema from another copy of zod is still one.\n\treturn (\n\t\t'_zod' in schema ? schema : z.object(schema as z.ZodRawShape)\n\t) as z.ZodType;\n}\n",
20
21
  "import {\n\tdefaultFieldResolver,\n\ttype GraphQLField,\n\ttype GraphQLFieldResolver,\n\ttype GraphQLSchema,\n} from 'graphql';\nimport type { z } from 'zod';\nimport { type ConstraintOf, parseArgs } from './bad-user-input';\nimport { checkConstraints } from './builder/check-constraints';\nimport type { FormatSchemas, OwnFormats } from './formats/registry';\nimport { constraintOf } from './rules';\n\n// Symbol.for: two copies of the package in one tree still wrap a field once.\nconst wrapped = Symbol.for('@nxgt/graphql-validation/wrapped');\n// The formats a schema was wrapped with, kept on the schema itself.\nconst wrappedWith = Symbol.for('@nxgt/graphql-validation/formats');\n\n/** What `withValidation` takes besides the schema. */\nexport interface WithValidationOptions<\n\tF extends FormatSchemas = FormatSchemas,\n> {\n\t/**\n\t * The application's own formats, which `@constraint(format: \"...\")` may\n\t * name beside the built-in ones: one Zod string schema each, keyed by its\n\t * name (lowercase letters, digits and hyphens). A built-in name is a type\n\t * error, and refused at startup.\n\t */\n\treadonly formats?: OwnFormats<F>;\n}\n\ntype Resolver = GraphQLFieldResolver<unknown, unknown> & { [wrapped]?: true };\n\nfunction checking(\n\tschema: z.ZodType,\n\twhere: string,\n\tresolve: Resolver,\n\tconstraintOf: ConstraintOf,\n): Resolver {\n\tconst check: Resolver = async (source, args, context, info) =>\n\t\tawait resolve(\n\t\t\tsource,\n\t\t\tawait parseArgs(schema, args, where, constraintOf),\n\t\t\tcontext,\n\t\t\tinfo,\n\t\t);\n\tcheck[wrapped] = true;\n\treturn check;\n}\n\n/**\n * Wraps a field once. A subscription field is checked in `subscribe`, which\n * runs once per subscription — graphql's default one when the field has none\n * — and its `resolve` runs once per event, with the same arguments, already\n * checked.\n */\nfunction wrap(\n\tfield: GraphQLField<unknown, unknown>,\n\targs: z.ZodType,\n\twhere: string,\n\tsubscription: boolean,\n\tconstraintOf: ConstraintOf,\n): void {\n\tconst subscribe = (field.subscribe ??\n\t\t(subscription ? defaultFieldResolver : undefined)) as Resolver | undefined;\n\tif (subscribe) {\n\t\tif (!subscribe[wrapped])\n\t\t\tfield.subscribe = checking(args, where, subscribe, constraintOf);\n\t\treturn;\n\t}\n\tconst resolve = (field.resolve ?? defaultFieldResolver) as Resolver;\n\tif (!resolve[wrapped])\n\t\tfield.resolve = checking(args, where, resolve, constraintOf);\n}\n\n/**\n * Checks every `@constraint` of `schema` before the resolvers run. Each\n * field with a constrained argument — directly, or anywhere inside an input\n * type it takes — gets its resolver (and its `subscribe`) wrapped: the\n * arguments are parsed by the Zod schema the directives describe, the\n * resolver receives the parsed value, and an invalid input becomes one\n * `BAD_USER_INPUT` error. Fields with nothing to check are left untouched.\n *\n * The schema is built here, once: a constraint that cannot apply (a\n * `minLength` on an `Int`, an unknown format, a bad pattern) throws now, not\n * on the first request. The resolvers are wrapped in place and the same\n * schema is returned, so it goes wherever it went before; calling it twice\n * wraps nothing twice. Call it last, once every resolver is attached: a\n * resolver set on a field afterwards replaces the check.\n *\n * A `@constraint` on an interface's argument must be repeated on each\n * object's field, which is the one that resolves; a field that drops it\n * fails here.\n *\n * The directives are read from the SDL (`astNode`), so a schema built from\n * type definitions — `buildSchema`, `makeExecutableSchema`, Yoga, Apollo —\n * is checked; a code-first schema with no SDL has no `@constraint` to read.\n *\n * `options.formats` adds the application's own formats; wrapping a schema\n * again throws unless the record has the same names, each the very same\n * schema (no formats after some, or some after none, throws too), since its\n * fields are already checked against the first ones.\n */\nexport function withValidation<\n\tS extends GraphQLSchema,\n\t// biome-ignore lint/complexity/noBannedTypes: no formats of its own by default\n\tconst F extends FormatSchemas = {},\n>(schema: S, options: WithValidationOptions<F> = {}): S {\n\tconst formats: FormatSchemas = options.formats ?? {};\n\tconst holder = schema as unknown as { [wrappedWith]?: FormatSchemas };\n\tconst before = holder[wrappedWith];\n\tif (before && !sameFormats(before, formats)) {\n\t\tthrow new Error(\n\t\t\t'withValidation: this schema is already wrapped with other formats. Call withValidation once, with every format.',\n\t\t);\n\t}\n\tconst directive = checkConstraints(\n\t\tschema,\n\t\t(type, field, args, declared) => {\n\t\t\tconst subscription = type === schema.getSubscriptionType();\n\t\t\t// The rule that refused, with the value this field's SDL declares at the path.\n\t\t\tconst named: ConstraintOf = (issue) => {\n\t\t\t\tconst argument = constraintOf(issue);\n\t\t\t\tif (!argument) return undefined;\n\t\t\t\t// Found: the SDL carries the constraints (interfaces repeat theirs,\n\t\t\t\t// assertInterfaceConstraintsKept), so a miss drops `constraint` by design.\n\t\t\t\tconst found = declared(issue.path).find(\n\t\t\t\t\t({ rule }) => rule.argument === argument,\n\t\t\t\t);\n\t\t\t\treturn found && { argument, value: found.value };\n\t\t\t};\n\t\t\twrap(field, args, `${type.name}.${field.name}`, subscription, named);\n\t\t},\n\t\tformats,\n\t);\n\tif (!directive) {\n\t\tthrow new Error(\n\t\t\t'withValidation: this schema declares no @constraint directive. Add constraintTypeDefs to its type definitions.',\n\t\t);\n\t}\n\tif (!before) Object.defineProperty(schema, wrappedWith, { value: formats });\n\treturn schema;\n}\n\n/** The same names, each the very same schema. */\nfunction sameFormats(a: FormatSchemas, b: FormatSchemas): boolean {\n\tconst names = Object.keys(a);\n\treturn (\n\t\tnames.length === Object.keys(b).length &&\n\t\tnames.every((name) => Object.hasOwn(b, name) && a[name] === b[name])\n\t);\n}\n"
21
22
  ],
22
- "mappings": ";;;;;;;;;AAAA;AA2CA,SAAS,QAAQ,CAChB,OACA,cACoB;AAAA,EACpB,OAAO,MAAM,OAAO,IAAI,CAAC,UAAU;AAAA,IAClC,MAAM,OAAO,MAAM,KAAK,IAAI,CAAC,QAC5B,OAAO,QAAQ,WAAW,MAAM,OAAO,GAAG,CAC3C;AAAA,IACA,MAAM,aAAa,eAAe,KAAK;AAAA,IACvC,OAAO,aACJ;AAAA,MACA;AAAA,MACA,SAAS,MAAM;AAAA,MACf,MAAM,MAAM;AAAA,MACZ,YAAY,WAAW;AAAA,MACvB,OAAO,WAAW;AAAA,IACnB,IACC,EAAE,MAAM,SAAS,MAAM,SAAS,MAAM,MAAM,KAAK;AAAA,GACpD;AAAA;AAGF,SAAS,OAAO,CAAC,OAAe,QAAyC;AAAA,EACxE,OAAO,SAAS;AAAA,EAChB,MAAM,SAAS,QACZ,GAAG,MAAM,KAAK,KAAK,GAAG,KAAK,gBAAgB,MAAM,YACjD;AAAA,EACH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AC,WAAW;AAAA,IACf,MAAM,IAAI,MACT,gHACD;AAAA,EACD;AAAA,EACA,IAAI,CAAC;AAAA,IAAQ,OAAO,eAAe,QAAQ,aAAa,EAAE,OAAO,QAAQ,CAAC;AAAA,EAC1E,OAAO;AAAA;AAIR,SAAS,WAAW,CAAC,GAAkB,GAA2B;AAAA,EACjE,MAAM,QAAQ,OAAO,KAAK,CAAC;AAAA,EAC3B,OACC,MAAM,WAAW,OAAO,KAAK,CAAC,EAAE,UAChC,MAAM,MAAM,CAAC,SAAS,OAAO,OAAO,GAAG,IAAI,KAAK,EAAE,UAAU,EAAE,KAAK;AAAA;",
24
+ "debugId": "272206072C5FB7A264756E2164756E21",
24
25
  "names": []
25
26
  }
@@ -0,0 +1,19 @@
1
+ import { GraphQLError } from 'graphql';
2
+ import { type InvalidInputOptions } from './invalid-input.js';
3
+ /**
4
+ * The `invalidInputError` of a `@constraint` refusal: a `BAD_USER_INPUT`
5
+ * error as `withValidation` / `validated` throw it, or one whose
6
+ * `originalError` is (graphql-js wraps it with the field's location). Each
7
+ * issue becomes a field `{ path, code, params }`: `too-short` / `too-long`
8
+ * (`minLength`, `maxLength`), `out-of-range` (`min`, `max`, `exclusiveMin`,
9
+ * `exclusiveMax`, `multipleOf`), `too-few` / `too-many` (`minItems`,
10
+ * `maxItems`), `invalid-format` (`format`, `pattern`), `invalid` for the rest,
11
+ * an issue with no `constraint` included. `params` is the declared value
12
+ * under the argument's own key (`{ min }`, `{ max }`, `{ exclusiveMin }`,
13
+ * `{ exclusiveMax }`, `{ multipleOf }`, `{ format }`), none for `pattern`.
14
+ * The location (`nodes`, `source`, `positions`, `path`) is kept and
15
+ * `originalError` is the error given. Any other error is returned as it is
16
+ * (the same object).
17
+ */
18
+ export declare function invalidInputOf(error: GraphQLError, options?: Pick<InvalidInputOptions, 'translate'>): GraphQLError;
19
+ //# sourceMappingURL=invalid-input-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-input-of.d.ts","sourceRoot":"","sources":["../src/invalid-input-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAEN,KAAK,mBAAmB,EAIxB,MAAM,iBAAiB,CAAC;AA+CzB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAM,GAClD,YAAY,CAWd"}
@@ -1 +1 @@
1
- {"version":3,"file":"contains.d.ts","sourceRoot":"","sources":["../../src/rules/contains.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,uDAOvB,CAAC"}
1
+ {"version":3,"file":"contains.d.ts","sourceRoot":"","sources":["../../src/rules/contains.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,uDASvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ends-with.d.ts","sourceRoot":"","sources":["../../src/rules/ends-with.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,uDAOvB,CAAC"}
1
+ {"version":3,"file":"ends-with.d.ts","sourceRoot":"","sources":["../../src/rules/ends-with.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,uDASvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exclusive-max.d.ts","sourceRoot":"","sources":["../../src/rules/exclusive-max.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,0DAU3B,CAAC"}
1
+ {"version":3,"file":"exclusive-max.d.ts","sourceRoot":"","sources":["../../src/rules/exclusive-max.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,0DAY3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exclusive-min.d.ts","sourceRoot":"","sources":["../../src/rules/exclusive-min.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,0DAU3B,CAAC"}
1
+ {"version":3,"file":"exclusive-min.d.ts","sourceRoot":"","sources":["../../src/rules/exclusive-min.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,0DAY3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/rules/format.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,qDAmBrB,CAAC"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/rules/format.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,qDAqBrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"max-items.d.ts","sourceRoot":"","sources":["../../src/rules/max-items.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,kDAOvB,CAAC"}
1
+ {"version":3,"file":"max-items.d.ts","sourceRoot":"","sources":["../../src/rules/max-items.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,kDASvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"max-length.d.ts","sourceRoot":"","sources":["../../src/rules/max-length.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,qDAOxB,CAAC"}
1
+ {"version":3,"file":"max-length.d.ts","sourceRoot":"","sources":["../../src/rules/max-length.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,qDASxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"max.d.ts","sourceRoot":"","sources":["../../src/rules/max.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,iDAUlB,CAAC"}
1
+ {"version":3,"file":"max.d.ts","sourceRoot":"","sources":["../../src/rules/max.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,iDAYlB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"min-items.d.ts","sourceRoot":"","sources":["../../src/rules/min-items.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,kDAOvB,CAAC"}
1
+ {"version":3,"file":"min-items.d.ts","sourceRoot":"","sources":["../../src/rules/min-items.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,kDASvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"min-length.d.ts","sourceRoot":"","sources":["../../src/rules/min-length.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,qDAOxB,CAAC"}
1
+ {"version":3,"file":"min-length.d.ts","sourceRoot":"","sources":["../../src/rules/min-length.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,qDASxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"min.d.ts","sourceRoot":"","sources":["../../src/rules/min.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,iDAUlB,CAAC"}
1
+ {"version":3,"file":"min.d.ts","sourceRoot":"","sources":["../../src/rules/min.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,iDAYlB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"multiple-of.d.ts","sourceRoot":"","sources":["../../src/rules/multiple-of.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,wDAOzB,CAAC"}
1
+ {"version":3,"file":"multiple-of.d.ts","sourceRoot":"","sources":["../../src/rules/multiple-of.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,wDASzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"not-contains.d.ts","sourceRoot":"","sources":["../../src/rules/not-contains.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,0DAU1B,CAAC"}
1
+ {"version":3,"file":"not-contains.d.ts","sourceRoot":"","sources":["../../src/rules/not-contains.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,0DAY1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/rules/pattern.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,sDAQtB,CAAC"}
1
+ {"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/rules/pattern.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,sDAUtB,CAAC"}
@@ -36,6 +36,11 @@ export interface Rule<A extends string = string, T extends keyof ValueOf = keyof
36
36
  readonly argument: A;
37
37
  readonly type: T;
38
38
  readonly target: K;
39
+ /**
40
+ * The argument's description in the shipped SDL: what it enforces, its
41
+ * bounds, the values it applies to and how a refusal reaches the client.
42
+ */
43
+ readonly description: string;
39
44
  readonly base?: true;
40
45
  readonly toZod: (schema: Targets[K], value: ValueOf[T], context: RuleContext) => Targets[K];
41
46
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/rules/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,4CAA4C;AAC5C,MAAM,WAAW,OAAO;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC;IACpB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;AAEnC;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;CAC7D;AAED,oDAAoD;AACpD,UAAU,OAAO;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,IAAI,CACpB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,C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,OAAO,GAAI,OAAO,MAAM,KAAG,MAA+B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"starts-with.d.ts","sourceRoot":"","sources":["../../src/rules/starts-with.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,yDAOzB,CAAC"}
1
+ {"version":3,"file":"starts-with.d.ts","sourceRoot":"","sources":["../../src/rules/starts-with.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,yDASzB,CAAC"}
package/docs/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  | Page | Read it when |
6
6
  | --- | --- |
7
7
  | [Constraints](guide/constraints.md) | you write `@constraint` in your schema: setup with `withValidation`, every argument and its Zod equivalent, the formats and your own, lists and nested inputs |
8
- | [Answering invalid input as one error](guide/invalid-input.md) | your API answers invalid input as one 400 error with a list of fields (`invalidInputError`, `fieldIssueOf` for a Zod parse), or a refusal such as a 409 names the fields at fault (`fieldsError`) |
8
+ | [Answering invalid input as one error](guide/invalid-input.md) | your API answers invalid input as one 400 error with a list of fields (`invalidInputError`, `fieldIssueOf` for a Zod parse, `invalidInputOf` for a `@constraint` refusal), or a refusal such as a 409 names the fields at fault (`fieldsError`) |
9
9
  | [Limiting the depth and cost of a query](guide/query-limits.md) | a schema has list cycles and you want to refuse a query nested too deep, too costly or too wide (`maxDepth`, `maxListCost`, `maxFields`), with graphql-js `validate` or graphql-yoga |
10
10
  | [Errors](guide/errors.md) | you handle the `BAD_USER_INPUT` error in a client, build it yourself with `badUserInput`, or add rules a directive cannot say with `validated` |
11
11
 
@@ -146,6 +146,50 @@ const issueOf = (issue: z.core.$ZodIssue): FieldIssue =>
146
146
  : fieldIssueOf(issue);
147
147
  ```
148
148
 
149
+ ## From a `@constraint` refusal
150
+
151
+ `invalidInputOf(error, { translate })` turns the `BAD_USER_INPUT`
152
+ error of `withValidation` / `validated`, thrown directly or wrapped by
153
+ graphql-js (its `originalError`), into `invalidInputError`'s shape, so a
154
+ server answers one error whatever raised it. Any other error comes back as
155
+ it is, and the given error becomes the new one's `originalError`; the
156
+ location (`nodes`, `source`, `positions`, `path`) is kept.
157
+
158
+ | `@constraint` argument | `code` (under `validation.errors.`) | `params` |
159
+ | --- | --- | --- |
160
+ | `minLength` / `maxLength` | `too-short` / `too-long` | `{ min }` / `{ max }` |
161
+ | `min` / `max` | `out-of-range` | `{ min }` / `{ max }` |
162
+ | `exclusiveMin` / `exclusiveMax` | `out-of-range` | `{ exclusiveMin }` / `{ exclusiveMax }` |
163
+ | `multipleOf` | `out-of-range` | `{ multipleOf }` |
164
+ | `minItems` / `maxItems` | `too-few` / `too-many` | `{ min }` / `{ max }` |
165
+ | `format` | `invalid-format` | `{ format }` (`'email'`) |
166
+ | `pattern` | `invalid-format` | none, the regex never reaches a client |
167
+ | `startsWith`, `endsWith`, `contains`, `notContains`, or an issue with no `constraint` | `invalid` | none |
168
+
169
+ The exclusive bounds keep their own keys, so a message can say "more than
170
+ {exclusiveMin}" rather than "at least {min}" for a refused `0`.
171
+
172
+ ```ts
173
+ import { invalidInputOf } from '@nxgt/graphql-validation';
174
+
175
+ const plugin = {
176
+ onExecute: () => ({
177
+ onExecuteDone: ({ result, setResult }) => {
178
+ if (!('errors' in result) || !result.errors) return;
179
+ setResult({
180
+ ...result,
181
+ errors: result.errors.map((error) =>
182
+ invalidInputOf(error, { translate: t }),
183
+ ),
184
+ });
185
+ },
186
+ }),
187
+ };
188
+ // maxLength: 100 refused:
189
+ // fields: [{ path: 'person.name', code: 'validation.errors.too-long',
190
+ // message: '…', params: { max: 100 } }]
191
+ ```
192
+
149
193
  `inputPath` turns a GraphQL or Zod path into a dotted one, dropping the
150
194
  leading `input` argument: `inputPath(['input', 'person', 'firstName'])` is
151
195
  `person.firstName`, `['input', 'tags', 1]` is `tags.1`; a path that does not
@@ -216,6 +260,12 @@ interface FieldError {
216
260
 
217
261
  type Translate = (code: string, params?: IssueParams) => string;
218
262
 
263
+ /** A `@constraint` refusal as `invalidInputError`; any other error as it is. */
264
+ declare function invalidInputOf(
265
+ error: GraphQLError,
266
+ options?: { readonly translate?: Translate },
267
+ ): GraphQLError;
268
+
219
269
  type InvalidInputOptions = GraphQLErrorOptions & { readonly translate?: Translate };
220
270
  type FieldsErrorOptions = InvalidInputOptions & {
221
271
  readonly status?: number;
package/docs/roadmap.md CHANGED
@@ -14,10 +14,14 @@ Nothing planned yet.
14
14
 
15
15
  - **Emit the invalid-input shape directly.** An option for `withValidation`
16
16
  and `validated` to raise the `invalidInputError` shape in place of
17
- `BAD_USER_INPUT`, so an API using it needs no mapping of its own.
17
+ `BAD_USER_INPUT`, so an API using it needs no mapping of its own. Today
18
+ `invalidInputOf` converts the refusal after the fact.
18
19
 
19
20
  ## Shipped
20
21
 
22
+ - **Constraint refusals as invalid input** — `invalidInputOf` converts a
23
+ `@constraint` `BAD_USER_INPUT` refusal into `invalidInputError`, with the
24
+ declared value as `params`.
21
25
  - **Relay connection sizing** — `maxListCost` sizes the `edges` and `nodes` of
22
26
  a connection from the connection field's size argument (`items(first: 100)
23
27
  { edges { … } }`), not `defaultFirst`.
@@ -1,20 +1,68 @@
1
1
  # The @constraint directive of @nxgt/graphql-validation, for your IDE.
2
2
  # Generated by `nxgt-graphql-validation typedefs`: do not edit.
3
3
 
4
+ """
5
+ Validates an argument or an input field when the request arrives, before the resolver runs. A value that breaks a constraint is refused with a BAD_USER_INPUT error whose extensions list each issue with its path and the constraint that refused it; null and omitted values are not checked. Each argument below is one constraint, and they combine on one field.
6
+ """
4
7
  directive @constraint(
8
+ """
9
+ The string must contain this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.
10
+ """
5
11
  contains: String
12
+ """
13
+ The string must end with this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.
14
+ """
6
15
  endsWith: String
16
+ """
17
+ The number must be strictly less than this value (the value itself is refused). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.
18
+ """
7
19
  exclusiveMax: Float
20
+ """
21
+ The number must be strictly greater than this value (the value itself is refused). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.
22
+ """
8
23
  exclusiveMin: Float
24
+ """
25
+ The string must match this named format: byte, date, date-time, email, ipv4, ipv6, uri or uuid, or a format the server registered. An unknown name fails at server startup. Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.
26
+ """
9
27
  format: String
28
+ """
29
+ The list must hold at most this many items (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to list values.
30
+ """
10
31
  maxItems: Int
32
+ """
33
+ The string must be at most this many characters long (UTF-16 code units, inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.
34
+ """
11
35
  maxLength: Int
36
+ """
37
+ The number must be less than or equal to this value (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.
38
+ """
12
39
  max: Float
40
+ """
41
+ The list must hold at least this many items (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to list values.
42
+ """
13
43
  minItems: Int
44
+ """
45
+ The string must be at least this many characters long (UTF-16 code units, inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.
46
+ """
14
47
  minLength: Int
48
+ """
49
+ The number must be greater than or equal to this value (inclusive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.
50
+ """
15
51
  min: Float
52
+ """
53
+ The number must be a whole multiple of this value (for example 5 accepts 0, 5 and 10). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to Int and Float values.
54
+ """
16
55
  multipleOf: Float
56
+ """
57
+ The string must not contain this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.
58
+ """
17
59
  notContains: String
60
+ """
61
+ The string must match this regular expression (JavaScript syntax, not anchored unless it uses ^ and $). An invalid expression fails at server startup. Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.
62
+ """
18
63
  pattern: String
64
+ """
65
+ The string must start with this text (case-sensitive). Refused otherwise with a BAD_USER_INPUT error naming the constraint. Applies to String and ID values.
66
+ """
19
67
  startsWith: String
20
68
  ) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/graphql-validation",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Validate GraphQL arguments and input fields with @constraint directives, checked by Zod schemas, for graphql 16 and 17",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,27 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/constraint-directive.ts", "../src/rules/rule.ts", "../src/rules/contains.ts", "../src/rules/ends-with.ts", "../src/rules/exclusive-max.ts", "../src/rules/exclusive-min.ts", "../src/rules/format.ts", "../src/rules/max.ts", "../src/rules/max-items.ts", "../src/rules/max-length.ts", "../src/rules/min.ts", "../src/rules/min-items.ts", "../src/rules/min-length.ts", "../src/rules/multiple-of.ts", "../src/rules/not-contains.ts", "../src/rules/pattern.ts", "../src/rules/starts-with.ts", "../src/rules/index.ts"],
4
- "sourcesContent": [
5
- "import { DirectiveLocation, type GraphQLDirective } from 'graphql';\nimport { rules } from './rules';\n\n/**\n * The SDL of `@constraint`, to add to a schema-first server's `typeDefs`,\n * written from the rules: an argument is declared once its rule exists.\n *\n * Its arguments are graphql-constraint-directive's, minus `uniqueTypeName`\n * (a detail of that package's scalar wrapping). It is allowed on arguments\n * and input fields only, where that package also allows output fields: a\n * resolver's result is the output scalars' job, and a directive that checked\n * nothing there would be a promise broken in silence.\n */\nexport const constraintTypeDefs: string = `directive @constraint(\n${Object.values(rules)\n\t.map((rule) => `\\t${rule.argument}: ${rule.type}`)\n\t.join('\\n')}\n) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION\n`;\n\nconst allowed = new Set<string>([\n\tDirectiveLocation.ARGUMENT_DEFINITION,\n\tDirectiveLocation.INPUT_FIELD_DEFINITION,\n]);\n\n/**\n * Fails when the schema's `@constraint` is not the one\n * {@link constraintTypeDefs} declares — graphql-constraint-directive's, say,\n * kept from a migration. Its extra locations would be accepted and checked\n * by nothing, its extra arguments mean nothing here, and an argument of\n * another type would reach a rule as the wrong kind of value.\n */\nexport function assertOwnConstraint(directive: GraphQLDirective): void {\n\tconst problems = [\n\t\t...(directive.isRepeatable\n\t\t\t? ['repeatable, and only its first use is read']\n\t\t\t: []),\n\t\t...directive.locations\n\t\t\t.filter((location) => !allowed.has(location))\n\t\t\t.map((location) => `allowed on ${location}`),\n\t\t...directive.args.flatMap((arg) => {\n\t\t\tconst rule = (rules as Record<string, { type: string } | undefined>)[\n\t\t\t\targ.name\n\t\t\t];\n\t\t\tif (!rule) return [`declares ${arg.name}, which no rule reads`];\n\t\t\tconst type = String(arg.type);\n\t\t\treturn type === rule.type\n\t\t\t\t? []\n\t\t\t\t: [`declares ${arg.name}: ${type}, not ${rule.type}`];\n\t\t}),\n\t];\n\tif (problems.length > 0) {\n\t\tthrow new Error(\n\t\t\t`This schema's @constraint is not constraintTypeDefs': it is ${problems.join('; ')}. Declare it with constraintTypeDefs.`,\n\t\t);\n\t}\n}\n",
6
- "import type { z } from 'zod';\nimport type { StringSchema } from '../formats/format';\nimport type { FormatRegistry } from '../formats/registry';\n\n/** The schema each kind of rule narrows. */\nexport interface Targets {\n\tstring: StringSchema;\n\tnumber: z.ZodNumber;\n\tlist: z.ZodArray<z.ZodType>;\n}\n\nexport type Target = keyof Targets;\n\n/**\n * What a rule may read besides its value: the formats `format` resolves\n * against, the built-in ones and the application's own, and, when writing\n * source, how to write one of the application's (`InputCodeOptions.format`).\n */\nexport interface RuleContext {\n\treadonly formats: FormatRegistry;\n\treadonly formatCode?: ((name: string) => string) | undefined;\n}\n\n/** What a `@constraint` argument's value can be. */\ninterface ValueOf {\n\tInt: number;\n\tFloat: number;\n\tString: string;\n}\n\n/**\n * One `@constraint` argument: its GraphQL type in the directive's SDL, the\n * kind of value it narrows, and the same narrowing twice — `toZod` applied to\n * a schema at startup, `toCode` written as source by a code generator. The\n * spec beside each rule proves the two accept and refuse the same values.\n *\n * A `base` rule (only `format`) replaces the schema instead of narrowing it,\n * so a builder applies it before every other rule of its target.\n */\nexport interface Rule<\n\tA extends string = string,\n\tT extends keyof ValueOf = keyof ValueOf,\n\tK extends Target = Target,\n> {\n\treadonly argument: A;\n\treadonly type: T;\n\treadonly target: K;\n\treadonly base?: true;\n\treadonly toZod: (\n\t\tschema: Targets[K],\n\t\tvalue: ValueOf[T],\n\t\tcontext: RuleContext,\n\t) => Targets[K];\n\t/**\n\t * `schema` is the source of the schema this rule narrows. The source names\n\t * zod as a free `z`: the generated file imports it.\n\t */\n\treadonly toCode: (\n\t\tschema: string,\n\t\tvalue: ValueOf[T],\n\t\tcontext: RuleContext,\n\t) => string;\n\t/**\n\t * Whether a Zod issue is this rule's refusal, so the error a client gets\n\t * names the rule (`constraint: 'minLength'`), which does not change with\n\t * Zod's own issue codes.\n\t */\n\treadonly owns: (issue: IssueFields) => boolean;\n}\n\n/** The fields of a Zod issue a rule recognises its refusal by. */\nexport interface IssueFields {\n\treadonly code: string;\n\treadonly origin?: string;\n\treadonly format?: string;\n\treadonly inclusive?: boolean;\n\treadonly params?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * The `params` key that marks an issue as one argument's whatever its code:\n * an application format's issues carry `format` there, so a `.regex()` or a\n * `.refine()` inside one is not read as `pattern` or `notContains`.\n */\nexport const RULE_PARAM = 'nxgtConstraint';\n\n/** Declares a rule, with its argument name kept literal. */\nexport function defineRule<\n\tconst A extends string,\n\tT extends keyof ValueOf,\n\tK extends Target,\n>(rule: Rule<A, T, K>): Rule<A, T, K> {\n\treturn rule;\n}\n\n/** A string literal as source: quotes and escapes included. */\nexport const literal = (value: string): string => JSON.stringify(value);\n",
7
- "import { defineRule, literal } from './rule';\n\nexport const containsRule = defineRule({\n\targument: 'contains',\n\ttype: 'String',\n\ttarget: 'string',\n\ttoZod: (schema, value) => schema.includes(value),\n\ttoCode: (schema, value) => `${schema}.includes(${literal(value)})`,\n\towns: (issue) => issue.format === 'includes',\n});\n",
8
- "import { defineRule, literal } from './rule';\n\nexport const endsWithRule = defineRule({\n\targument: 'endsWith',\n\ttype: 'String',\n\ttarget: 'string',\n\ttoZod: (schema, value) => schema.endsWith(value),\n\ttoCode: (schema, value) => `${schema}.endsWith(${literal(value)})`,\n\towns: (issue) => issue.format === 'ends_with',\n});\n",
9
- "import { defineRule } from './rule';\n\nexport const exclusiveMaxRule = defineRule({\n\targument: 'exclusiveMax',\n\ttype: 'Float',\n\ttarget: 'number',\n\ttoZod: (schema, value) => schema.lt(value),\n\ttoCode: (schema, value) => `${schema}.lt(${value})`,\n\towns: (issue) =>\n\t\tissue.code === 'too_big' &&\n\t\tissue.origin === 'number' &&\n\t\tissue.inclusive === false,\n});\n",
10
- "import { defineRule } from './rule';\n\nexport const exclusiveMinRule = defineRule({\n\targument: 'exclusiveMin',\n\ttype: 'Float',\n\ttarget: 'number',\n\ttoZod: (schema, value) => schema.gt(value),\n\ttoCode: (schema, value) => `${schema}.gt(${value})`,\n\towns: (issue) =>\n\t\tissue.code === 'too_small' &&\n\t\tissue.origin === 'number' &&\n\t\tissue.inclusive === false,\n});\n",
11
- "import { defineRule, RULE_PARAM } from './rule';\n\n// The string rules' own formats; every other invalid_format is a format's.\nconst NARROWING = new Set(['starts_with', 'ends_with', 'includes', 'regex']);\n\nexport const formatRule = defineRule({\n\targument: 'format',\n\ttype: 'String',\n\ttarget: 'string',\n\tbase: true,\n\ttoZod: (_schema, value, { formats }) => formats.named(value).toZod(),\n\ttoCode: (_schema, value, { formats, formatCode }) => {\n\t\tconst format = formats.named(value);\n\t\tif (format.toCode) return format.toCode();\n\t\tif (formatCode) return formatCode(value);\n\t\tthrow new Error(\n\t\t\t`@constraint(format: \"${value}\") is one of the application's formats: its source is the code generator's to write, through inputCode's format option.`,\n\t\t);\n\t},\n\t// An application format's issues are marked, whatever their code\n\t// (`custom` for a `.refine()`): see FormatRegistry.\n\towns: (issue) =>\n\t\tissue.params?.[RULE_PARAM] === 'format' ||\n\t\t(issue.code === 'invalid_format' && !NARROWING.has(issue.format ?? '')),\n});\n",
12
- "import { defineRule } from './rule';\n\nexport const maxRule = defineRule({\n\targument: 'max',\n\ttype: 'Float',\n\ttarget: 'number',\n\ttoZod: (schema, value) => schema.lte(value),\n\ttoCode: (schema, value) => `${schema}.lte(${value})`,\n\towns: (issue) =>\n\t\tissue.code === 'too_big' &&\n\t\tissue.origin === 'number' &&\n\t\tissue.inclusive === true,\n});\n",
13
- "import { defineRule } from './rule';\n\nexport const maxItemsRule = defineRule({\n\targument: 'maxItems',\n\ttype: 'Int',\n\ttarget: 'list',\n\ttoZod: (schema, value) => schema.max(value),\n\ttoCode: (schema, value) => `${schema}.max(${value})`,\n\towns: (issue) => issue.code === 'too_big' && issue.origin === 'array',\n});\n",
14
- "import { defineRule } from './rule';\n\nexport const maxLengthRule = defineRule({\n\targument: 'maxLength',\n\ttype: 'Int',\n\ttarget: 'string',\n\ttoZod: (schema, value) => schema.max(value),\n\ttoCode: (schema, value) => `${schema}.max(${value})`,\n\towns: (issue) => issue.code === 'too_big' && issue.origin === 'string',\n});\n",
15
- "import { defineRule } from './rule';\n\nexport const minRule = defineRule({\n\targument: 'min',\n\ttype: 'Float',\n\ttarget: 'number',\n\ttoZod: (schema, value) => schema.gte(value),\n\ttoCode: (schema, value) => `${schema}.gte(${value})`,\n\towns: (issue) =>\n\t\tissue.code === 'too_small' &&\n\t\tissue.origin === 'number' &&\n\t\tissue.inclusive === true,\n});\n",
16
- "import { defineRule } from './rule';\n\nexport const minItemsRule = defineRule({\n\targument: 'minItems',\n\ttype: 'Int',\n\ttarget: 'list',\n\ttoZod: (schema, value) => schema.min(value),\n\ttoCode: (schema, value) => `${schema}.min(${value})`,\n\towns: (issue) => issue.code === 'too_small' && issue.origin === 'array',\n});\n",
17
- "import { defineRule } from './rule';\n\nexport const minLengthRule = defineRule({\n\targument: 'minLength',\n\ttype: 'Int',\n\ttarget: 'string',\n\ttoZod: (schema, value) => schema.min(value),\n\ttoCode: (schema, value) => `${schema}.min(${value})`,\n\towns: (issue) => issue.code === 'too_small' && issue.origin === 'string',\n});\n",
18
- "import { defineRule } from './rule';\n\nexport const multipleOfRule = defineRule({\n\targument: 'multipleOf',\n\ttype: 'Float',\n\ttarget: 'number',\n\ttoZod: (schema, value) => schema.multipleOf(value),\n\ttoCode: (schema, value) => `${schema}.multipleOf(${value})`,\n\towns: (issue) => issue.code === 'not_multiple_of',\n});\n",
19
- "import { defineRule, literal } from './rule';\n\nconst message = (value: string) => `Must not contain ${literal(value)}`;\n\nexport const notContainsRule = defineRule({\n\targument: 'notContains',\n\ttype: 'String',\n\ttarget: 'string',\n\t// `refine` keeps the schema's own type, so later rules still chain.\n\ttoZod: (schema, value) =>\n\t\tschema.refine((input) => !input.includes(value), message(value)),\n\ttoCode: (schema, value) =>\n\t\t`${schema}.refine((input) => !input.includes(${literal(value)}), ${literal(message(value))})`,\n\towns: (issue) => issue.code === 'custom',\n});\n",
20
- "import { defineRule, literal } from './rule';\n\n/** The pattern as a RegExp, or an error that names the argument. */\nfunction compile(value: string): RegExp {\n\ttry {\n\t\treturn new RegExp(value);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Invalid @constraint pattern ${literal(value)}: ${(error as Error).message}`,\n\t\t);\n\t}\n}\n\nexport const patternRule = defineRule({\n\targument: 'pattern',\n\ttype: 'String',\n\ttarget: 'string',\n\ttoZod: (schema, value) => schema.regex(compile(value)),\n\ttoCode: (schema, value) =>\n\t\t`${schema}.regex(new RegExp(${literal(compile(value).source)}))`,\n\towns: (issue) => issue.format === 'regex',\n});\n",
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
- "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 Con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