@nxgt/graphql-validation 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/chunks/{index-w9pw7fsk.js → index-5x1yd76p.js} +2 -2
- package/dist/chunks/{index-atwkcfg3.js → index-sq3exxg2.js} +25 -4
- package/dist/chunks/index-sq3exxg2.js.map +27 -0
- package/dist/cli.js +1 -1
- package/dist/codegen.js +2 -2
- package/dist/constraint-directive.d.ts.map +1 -1
- package/dist/index.js +102 -71
- package/dist/index.js.map +12 -9
- package/dist/limits/cost-context.d.ts +7 -7
- package/dist/limits/cost-context.d.ts.map +1 -1
- package/dist/limits/describe.d.ts +4 -0
- package/dist/limits/describe.d.ts.map +1 -1
- package/dist/limits/fragments.d.ts +19 -0
- package/dist/limits/fragments.d.ts.map +1 -0
- package/dist/limits/list-size.d.ts +2 -0
- package/dist/limits/list-size.d.ts.map +1 -1
- package/dist/limits/max-depth.d.ts.map +1 -1
- package/dist/limits/max-fields.d.ts.map +1 -1
- package/dist/limits/max-list-cost-options.d.ts +38 -0
- package/dist/limits/max-list-cost-options.d.ts.map +1 -0
- package/dist/limits/max-list-cost.d.ts +11 -29
- package/dist/limits/max-list-cost.d.ts.map +1 -1
- package/dist/limits/size-reading.d.ts +22 -0
- package/dist/limits/size-reading.d.ts.map +1 -0
- package/dist/rules/contains.d.ts.map +1 -1
- package/dist/rules/ends-with.d.ts.map +1 -1
- package/dist/rules/exclusive-max.d.ts.map +1 -1
- package/dist/rules/exclusive-min.d.ts.map +1 -1
- package/dist/rules/format.d.ts.map +1 -1
- package/dist/rules/max-items.d.ts.map +1 -1
- package/dist/rules/max-length.d.ts.map +1 -1
- package/dist/rules/max.d.ts.map +1 -1
- package/dist/rules/min-items.d.ts.map +1 -1
- package/dist/rules/min-length.d.ts.map +1 -1
- package/dist/rules/min.d.ts.map +1 -1
- package/dist/rules/multiple-of.d.ts.map +1 -1
- package/dist/rules/not-contains.d.ts.map +1 -1
- package/dist/rules/pattern.d.ts.map +1 -1
- package/dist/rules/rule.d.ts +5 -0
- package/dist/rules/rule.d.ts.map +1 -1
- package/dist/rules/starts-with.d.ts.map +1 -1
- package/docs/guide/query-limits.md +46 -13
- package/docs/roadmap.md +6 -0
- package/docs/troubleshooting.md +26 -9
- package/graphql/constraint.graphqls +48 -0
- package/package.json +1 -1
- package/dist/chunks/index-atwkcfg3.js.map +0 -27
- /package/dist/chunks/{index-w9pw7fsk.js.map → index-5x1yd76p.js.map} +0 -0
package/dist/index.js.map
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
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/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/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/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 {\n\
|
|
9
|
-
"import type { OperationDefinitionNode } from 'graphql';\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 =
|
|
8
|
+
"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
|
+
"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
|
+
"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",
|
|
10
11
|
"import {\n\ttype GraphQLField,\n\ttype GraphQLNamedType,\n\ttype GraphQLSchema,\n\tisEnumType,\n\tisInputObjectType,\n\tisInterfaceType,\n\tisObjectType,\n\tisUnionType,\n\tSchemaMetaFieldDef,\n\tTypeMetaFieldDef,\n} from 'graphql';\n\n/** The meta-fields that read the schema; `__typename` is not one. */\nexport function isIntrospectionRoot(name: string): boolean {\n\treturn name === '__schema' || name === '__type';\n}\n\n/** The definition of `__schema` or `__type`, selected on the query root. */\nexport function introspectionRoot(\n\tname: string,\n): GraphQLField<unknown, unknown> | undefined {\n\tif (name === '__schema') return SchemaMetaFieldDef;\n\tif (name === '__type') return TypeMetaFieldDef;\n\treturn undefined;\n}\n\n/** The largest list the introspection types can return for `schema`, by schema. */\nconst largest = new WeakMap<GraphQLSchema, number>();\n\nconst typeCounts = new WeakMap<GraphQLSchema, number>();\n\nfunction typeCount(schema: GraphQLSchema): number {\n\tlet count = typeCounts.get(schema);\n\tif (count === undefined) {\n\t\tcount = Object.keys(schema.getTypeMap()).length;\n\t\ttypeCounts.set(schema, count);\n\t}\n\treturn count;\n}\n\nfunction largestCount(schema: GraphQLSchema): number {\n\tconst known = largest.get(schema);\n\tif (known !== undefined) return known;\n\tlet max = schema.getDirectives().length;\n\tfor (const directive of schema.getDirectives()) {\n\t\tmax = Math.max(max, directive.args.length, directive.locations.length);\n\t}\n\tfor (const type of Object.values(schema.getTypeMap())) {\n\t\tmax = Math.max(max, countsOf(schema, type));\n\t}\n\tlargest.set(schema, max);\n\treturn max;\n}\n\n/** The longest of a type's fields, input fields, enum values, interfaces, possible types and arguments. */\nfunction countsOf(schema: GraphQLSchema, type: GraphQLNamedType): number {\n\tif (isObjectType(type) || isInterfaceType(type)) {\n\t\tconst fields = Object.values(type.getFields());\n\t\treturn Math.max(\n\t\t\tfields.length,\n\t\t\ttype.getInterfaces().length,\n\t\t\tisInterfaceType(type) ? schema.getPossibleTypes(type).length : 0,\n\t\t\t...fields.map((field) => field.args.length),\n\t\t);\n\t}\n\tif (isInputObjectType(type)) return Object.keys(type.getFields()).length;\n\tif (isEnumType(type)) return type.getValues().length;\n\tif (isUnionType(type)) return type.getTypes().length;\n\treturn 0;\n}\n\n/**\n * The most items the introspection list `parent.field` can hold in `schema`:\n * the number of types for `__Schema.types`, else the largest list anywhere in\n * the schema. Not `defaultFirst`: a query asks no size of them.\n */\nexport function introspectionSize(\n\tschema: GraphQLSchema,\n\tfield: string,\n): number {\n\treturn field === 'types' ? typeCount(schema) : largestCount(schema);\n}\n",
|
|
11
|
-
"import {\n\
|
|
12
|
-
"import {\n\ttype FieldNode,\n\tGraphQLError,\n\ttype GraphQLField,\n\ttype GraphQLNamedType,\n\tgetNamedType,\n\tgetNullableType,\n\tisListType,\n\ttype SelectionSetNode,\n\ttype ValidationContext,\n\ttype ValidationRule,\n} from 'graphql';\nimport {\n\
|
|
13
|
-
"import {\n\ttype
|
|
14
|
-
"import {\n\ttype ArgumentNode,\n\ttype GraphQLField,\n\ttype GraphQLNamedType,\n\ttype GraphQLSchema,\n\tisAbstractType,\n
|
|
12
|
+
"import {\n\tGraphQLError,\n\ttype SelectionSetNode,\n\ttype ValidationContext,\n\ttype ValidationRule,\n} from 'graphql';\nimport { add, 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 maxFields}. */\nexport interface MaxFieldsOptions {\n\t/** The most field selections an operation may have (at least 1). */\n\tlimit: 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()`)\n\t * selects 220 fields.\n\t */\n\tignoreIntrospection?: boolean;\n}\n\n/** What a walk of one document needs: the options, and what it has counted so far. */\ninterface FieldsContext extends FragmentWalk {\n\tignoreIntrospection: boolean;\n}\n\n/** The field selections of `selectionSet`, nested ones included. */\nfunction countOf(walk: FieldsContext, selectionSet: SelectionSetNode): number {\n\tlet total = 0;\n\tfor (const selection of selectionSet.selections) {\n\t\tif (selection.kind === 'Field') {\n\t\t\tif (walk.ignoreIntrospection && isIntrospectionRoot(selection.name.value))\n\t\t\t\tcontinue;\n\t\t\ttotal = add(total, 1);\n\t\t\tif (selection.selectionSet)\n\t\t\t\ttotal = add(total, countOf(walk, selection.selectionSet));\n\t\t} else if (selection.kind === 'InlineFragment') {\n\t\t\ttotal = add(total, countOf(walk, selection.selectionSet));\n\t\t} else {\n\t\t\ttotal = add(total, fragmentCount(walk, selection.name.value));\n\t\t}\n\t}\n\treturn total;\n}\n\n/** The count of the named fragment, walked once. */\nfunction fragmentCount(walk: FieldsContext, name: string): number {\n\treturn fragmentValue(walk, name, NO_KEY, (fragment) =>\n\t\tcountOf(walk, fragment.selectionSet),\n\t);\n}\n\n/**\n * A graphql-js validation rule refusing an operation that selects more than\n * `limit` fields: neither `maxDepth` nor `maxListCost` bounds breadth, so\n * thousands of aliases of a cheap field (or of `__typename`) pass both.\n *\n * Every field node counts 1, aliases and `__typename` included. A named\n * fragment counts at each spread (walked once), an inline fragment counts its\n * contents, and every branch of a union counts: nothing is pruned by type.\n * `@skip` and `@include` are not evaluated, so the count can be over the\n * document's field count. It counts the document, spreads expanded, not what the\n * executor runs: how often a field runs inside a list is `maxListCost`'s.\n * One `GraphQLError` per operation, with\n * `extensions: { code: 'QUERY_TOO_WIDE', fields, limit }`, `fields` being the\n * operation's real count (clamped at `Number.MAX_SAFE_INTEGER`).\n *\n * ```ts\n * validate(schema, document, [...specifiedRules, maxFields({ limit: 500 })]);\n * // graphql-yoga: onValidate: ({ addValidationRule }) => addValidationRule(maxFields({ limit: 500 }))\n * ```\n */\nexport function maxFields(options: MaxFieldsOptions): ValidationRule {\n\tconst limit = options.limit;\n\tassertInteger('maxFields: limit', limit, 1);\n\treturn (context: ValidationContext) => {\n\t\tconst walk: FieldsContext = {\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 fields = countOf(walk, operation.selectionSet);\n\t\t\t\tif (fields > 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)} selects ${fields} fields, 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_WIDE', fields, 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",
|
|
13
|
+
"import {\n\ttype FieldNode,\n\tGraphQLError,\n\ttype GraphQLField,\n\ttype GraphQLNamedType,\n\tgetNamedType,\n\tgetNullableType,\n\tisListType,\n\ttype SelectionSetNode,\n\ttype ValidationContext,\n\ttype ValidationRule,\n} from 'graphql';\nimport {\n\ttype CostContext,\n\tfieldOf,\n\tmemoSize,\n\tmultiply,\n\tNO_PENDING,\n\trootType,\n} from './cost-context';\nimport { add, assertInteger, operationLabel } from './describe';\nimport { fragmentValue, newFragmentWalk } from './fragments';\nimport { introspectionSize, isIntrospectionRoot } from './introspection';\nimport { statedSize } from './list-size';\nimport {\n\tDEFAULT_SIZE_ARGUMENTS,\n\ttype MaxListCostOptions,\n} from './max-list-cost-options';\nimport { listSizeUnder } from './pending-size';\n\nexport type { MaxListCostOptions };\n\n/**\n * The cost of one selected field. `pending` is the size of the field whose\n * return type this selection is on: only a list declaring no size argument\n * takes it, and no field passes it on.\n */\nfunction fieldCost(\n\tcost: CostContext,\n\tparent: GraphQLNamedType | undefined,\n\tselection: FieldNode,\n\tdefinition: GraphQLField<unknown, unknown>,\n\tpending: number | undefined,\n): number {\n\tif (!selection.selectionSet) return 1;\n\tconst name = selection.name.value;\n\tconst type = getNamedType(definition.type);\n\tif (!isListType(getNullableType(definition.type))) {\n\t\t// An object field hands its own size, if it states one, to the lists\n\t\t// selected directly on it; the pending size stops here.\n\t\tconst stated = statedSize(cost, parent, definition, selection.arguments);\n\t\tconst inner = costOf(cost, selection.selectionSet, type, stated);\n\t\treturn add(1, inner);\n\t}\n\tconst inner = costOf(cost, selection.selectionSet, type, undefined);\n\tconst size = parent?.name.startsWith('__')\n\t\t? introspectionSize(cost.schema, name)\n\t\t: listSizeUnder(cost, parent, definition, selection.arguments, pending);\n\treturn add(1, multiply(inner, size));\n}\n\n/** The cost of `selectionSet` selected on `parent`, under the `pending` size of the field they are selected on. */\nfunction costOf(\n\tcost: CostContext,\n\tselectionSet: SelectionSetNode,\n\tparent: GraphQLNamedType | undefined,\n\tpending: number | undefined,\n): number {\n\tlet total = 0;\n\tfor (const selection of selectionSet.selections) {\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 (isIntrospectionRoot(name) && cost.ignoreIntrospection) continue;\n\t\t\tconst definition = fieldOf(cost, parent, name);\n\t\t\t// An unknown field is another rule's to report.\n\t\t\tif (!definition) continue;\n\t\t\ttotal = add(\n\t\t\t\ttotal,\n\t\t\t\tfieldCost(cost, parent, selection, definition, pending),\n\t\t\t);\n\t\t} else if (selection.kind === 'InlineFragment') {\n\t\t\tconst condition = selection.typeCondition\n\t\t\t\t? cost.schema.getType(selection.typeCondition.name.value)\n\t\t\t\t: parent;\n\t\t\ttotal = add(\n\t\t\t\ttotal,\n\t\t\t\tcostOf(cost, selection.selectionSet, condition, pending),\n\t\t\t);\n\t\t} else {\n\t\t\ttotal = add(total, fragmentCost(cost, selection.name.value, pending));\n\t\t}\n\t}\n\treturn total;\n}\n\n/** The cost of the named fragment spread under `pending`, computed once per size. */\nfunction fragmentCost(\n\tcost: CostContext,\n\tname: string,\n\tpending: number | undefined,\n): number {\n\tconst key = (known: ReadonlyMap<number, number>) =>\n\t\tmemoSize(known, pending) ?? NO_PENDING;\n\treturn fragmentValue(cost, name, key, (fragment, at) =>\n\t\tcostOf(\n\t\t\tcost,\n\t\t\tfragment.selectionSet,\n\t\t\tcost.schema.getType(fragment.typeCondition.name.value),\n\t\t\tat === NO_PENDING ? undefined : at,\n\t\t),\n\t);\n}\n\n/**\n * A graphql-js validation rule refusing an operation whose cost is more than\n * `budget`, to stop a client from exploiting list cycles (`Folder.items`,\n * `Item.folder`, `Folder.items`, …) for a cost growing exponentially.\n *\n * The cost of an operation is the sum, over every selected field, of the\n * product of the sizes of the list fields enclosing it: a field costs 1, and a\n * list field multiplies the cost of its sub-selection by its size.\n * `__typename` costs nothing. `__schema` and `__type` are costed like any\n * field, their lists sized by the schema itself (`__Schema.types` is the number\n * of types, the other lists the longest list anywhere in the schema), unless\n * `ignoreIntrospection` is set.\n *\n * The size of a list field is the largest size its `sizeArguments` (default\n * `first`, `last`, `limit`) say. A literal Int, a String holding a canonical\n * integer (`\"1000\"`) or an integral Float (`1e3`) of at least 0 says that\n * number. Anything else (a negative literal, a variable, since validation has\n * no variable values) says the largest of the argument's SDL default when it\n * has a usable one (`defaultFirst` otherwise), its declared bound\n * (`@constraint(max)` or `exclusiveMax`) and, when some definition declares no\n * bound, `variableSize`; an argument not given says its SDL default, or\n * nothing. When nothing is said the size is `defaultFirst`. On an interface\n * the largest default and bound over its possible types is used. Hence no\n * subtree ever costs less than nothing: a negative `first` on one field cannot\n * cancel the cost of its sibling. A field whose type (once unwrapped from\n * non-null) is a list is one list, nested `[[X]]` included.\n *\n * A Relay connection puts the size on a field returning an object, with the\n * list below it (`items(first: 100) { edges { node { id } } }`). A field that\n * is not a list and states a size (by the same reading) hands it to the lists\n * selected directly on its return type, through inline fragments and fragment\n * spreads on that same selection set, and only to those declaring none of the\n * size arguments (`edges`, `nodes`): such a list takes it instead of\n * `defaultFirst`. A list declaring a size argument (`recent(first: Int)`)\n * reads its own, never the pending size. Crossing any other field (an object\n * field, `pageInfo`, a wrapper) ends it. A connection stating nothing hands\n * down nothing: its lists are sized `defaultFirst`.\n *\n * Named fragments are followed, each costed once per pending size (past eight\n * distinct sizes under one fragment a size is rounded up to a power of two, so\n * the work stays linear in the document and a cost only over-counts). Inline fragments and\n * fragments on an abstract type are summed branch by branch, so the cost of a\n * query on an interface or a union is overestimated, never underestimated.\n *\n * One `GraphQLError` per operation, with\n * `extensions: { code: 'QUERY_TOO_COSTLY', cost, limit }`. `cost` is exact up\n * to `Number.MAX_SAFE_INTEGER`, which it never exceeds.\n *\n * ```ts\n * const rule = maxListCost({ budget: 10_000, defaultFirst: 50 });\n * validate(schema, document, [...specifiedRules, rule]);\n * // graphql-yoga: onValidate: ({ addValidationRule }) => addValidationRule(rule)\n * ```\n */\nexport function maxListCost(options: MaxListCostOptions): ValidationRule {\n\tconst { budget, defaultFirst } = options;\n\t// A copy: a caller changing its array later must not desync the schema\n\t// cache keyed by it.\n\tconst sizeArguments = Object.freeze([\n\t\t...(options.sizeArguments ?? DEFAULT_SIZE_ARGUMENTS),\n\t]);\n\tassertInteger('maxListCost: budget', budget, 0);\n\tassertInteger('maxListCost: defaultFirst', defaultFirst, 0);\n\tconst { variableSize } = options;\n\tif (variableSize !== undefined) {\n\t\tassertInteger('maxListCost: variableSize', variableSize, 0);\n\t}\n\n\treturn (context: ValidationContext) => {\n\t\tconst schema = context.getSchema();\n\t\tconst cost: CostContext = {\n\t\t\tschema,\n\t\t\tsizeArguments,\n\t\t\tdefaultFirst,\n\t\t\tvariableSize,\n\t\t\tignoreIntrospection: options.ignoreIntrospection ?? false,\n\t\t\t...newFragmentWalk((name) => context.getFragment(name)),\n\t\t};\n\t\treturn {\n\t\t\tOperationDefinition(operation) {\n\t\t\t\tconst total = costOf(\n\t\t\t\t\tcost,\n\t\t\t\t\toperation.selectionSet,\n\t\t\t\t\trootType(schema, operation),\n\t\t\t\t\tundefined,\n\t\t\t\t);\n\t\t\t\tif (total > budget) {\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)} costs ${total}, more than the ${budget} 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: {\n\t\t\t\t\t\t\t\t\tcode: 'QUERY_TOO_COSTLY',\n\t\t\t\t\t\t\t\t\tcost: total,\n\t\t\t\t\t\t\t\t\tlimit: budget,\n\t\t\t\t\t\t\t\t},\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",
|
|
14
|
+
"import {\n\ttype GraphQLField,\n\ttype GraphQLNamedType,\n\ttype GraphQLSchema,\n\tisInterfaceType,\n\tisObjectType,\n\ttype OperationDefinitionNode,\n} from 'graphql';\nimport { CEILING } from './describe';\nimport { type FragmentWalk, NO_KEY } from './fragments';\nimport { introspectionRoot, isIntrospectionRoot } from './introspection';\nimport type { SizeContext } from './list-size';\n\nexport const multiply = (a: number, b: number) => Math.min(CEILING, a * b);\n\n/** What a walk of one document needs: the options, and what it has measured so far. */\nexport interface CostContext extends SizeContext, FragmentWalk {\n\tignoreIntrospection: boolean;\n}\n\n/** The definition of the field `name` on `parent`, meta-fields of the query root included. */\nexport function fieldOf(\n\tcost: CostContext,\n\tparent: GraphQLNamedType | undefined,\n\tname: string,\n): GraphQLField<unknown, unknown> | undefined {\n\tif (parent === cost.schema.getQueryType() && isIntrospectionRoot(name)) {\n\t\treturn introspectionRoot(name);\n\t}\n\treturn isObjectType(parent) || isInterfaceType(parent)\n\t\t? parent.getFields()[name]\n\t\t: undefined;\n}\n\n/** The type an operation selects on. */\nexport function rootType(\n\tschema: GraphQLSchema,\n\toperation: OperationDefinitionNode,\n) {\n\tconst type =\n\t\toperation.operation === 'query'\n\t\t\t? schema.getQueryType()\n\t\t\t: operation.operation === 'mutation'\n\t\t\t\t? schema.getMutationType()\n\t\t\t\t: schema.getSubscriptionType();\n\treturn type ?? undefined;\n}\n\n/** Distinct pending sizes costed exactly per fragment; further ones are rounded up. */\nconst EXACT_SIZES = 8;\n\n/**\n * The key a fragment is memoized under when no size is pending: the walk's own\n * \"no key\", which no real size can equal (a size is never negative).\n */\nexport const NO_PENDING = NO_KEY;\n\n/**\n * The pending size a fragment is costed under. A fragment spread under many\n * distinct sizes would be costed once per size, quadratic in a hostile\n * document; past `EXACT_SIZES` of them a new size is rounded up to a power of\n * two (a cost never lowers as a size grows, so it only over-counts, by less\n * than twice), which leaves at most `EXACT_SIZES` + 53 costings per fragment.\n */\nexport function memoSize(\n\tknown: ReadonlyMap<number, number>,\n\tpending: number | undefined,\n): number | undefined {\n\tif (pending === undefined || known.has(pending) || known.size < EXACT_SIZES) {\n\t\treturn pending;\n\t}\n\t// Math.log2 rounds near 2^k + d, so the power is checked, not trusted.\n\tlet rounded = 2 ** Math.ceil(Math.log2(Math.max(pending, 1)));\n\tif (rounded < pending) rounded *= 2;\n\treturn Math.min(CEILING, rounded);\n}\n",
|
|
15
|
+
"import {\n\ttype ArgumentNode,\n\ttype GraphQLField,\n\ttype GraphQLNamedType,\n\ttype GraphQLSchema,\n\tisAbstractType,\n} from 'graphql';\nimport { constraintMaxOf, defaultSizeOf, literalSize } from './size-reading';\n\n/** What sizing a list needs: the schema and the options of the rule. */\nexport interface SizeContext {\n\tschema: GraphQLSchema;\n\tsizeArguments: readonly string[];\n\tdefaultFirst: number;\n\t/** What to assume for a size argument given as a variable where some definition declares no bound. */\n\tvariableSize?: number | undefined;\n}\n\n/**\n * What the schema alone says of one list field and the fields implementing it,\n * per size argument (in `sizeArguments` order): the largest default, whether\n * some definition has none, and whether some definition has no default at all.\n */\ninterface Profile {\n\tlargest: (number | undefined)[];\n\t/** Per size argument, the largest bound (`max` or `exclusiveMax`) over the definitions. */\n\tmaxima: (number | undefined)[];\n\t/** Per size argument, whether some definition declares no bound (`max` or `exclusiveMax`). */\n\tsomeNoMax: boolean[];\n\tsomeLack: boolean[];\n\tsomeBare: boolean;\n\t/** Whether some definition declares any of the size arguments. */\n\tdeclares: boolean;\n\t/** Whether some definition declares none of them. */\n\tsomeUndeclared: boolean;\n}\n\nconst profiles = new WeakMap<\n\tGraphQLSchema,\n\tWeakMap<readonly string[], Map<string, Profile>>\n>();\n\nfunction profileOf(\n\tcost: SizeContext,\n\tparent: GraphQLNamedType | undefined,\n\tdefinition: GraphQLField<unknown, unknown>,\n): Profile {\n\tlet bySizes = profiles.get(cost.schema);\n\tif (!bySizes) {\n\t\tbySizes = new WeakMap();\n\t\tprofiles.set(cost.schema, bySizes);\n\t}\n\tlet byField = bySizes.get(cost.sizeArguments);\n\tif (!byField) {\n\t\tbyField = new Map();\n\t\tbySizes.set(cost.sizeArguments, byField);\n\t}\n\tconst key = `${parent?.name}.${definition.name}`;\n\tconst known = byField.get(key);\n\tif (known) return known;\n\n\t// On an interface the object types' own fields count too: each may\n\t// declare another default, and the query cannot say which comes back.\n\tconst definitions = [definition];\n\tif (isAbstractType(parent)) {\n\t\tfor (const type of cost.schema.getPossibleTypes(parent)) {\n\t\t\tconst implemented = type.getFields()[definition.name];\n\t\t\tif (implemented) definitions.push(implemented);\n\t\t}\n\t}\n\tconst profile: Profile = {\n\t\tlargest: cost.sizeArguments.map(() => undefined),\n\t\tmaxima: cost.sizeArguments.map(() => undefined),\n\t\tsomeNoMax: cost.sizeArguments.map(() => false),\n\t\tsomeLack: cost.sizeArguments.map(() => false),\n\t\tsomeBare: false,\n\t\tdeclares: false,\n\t\tsomeUndeclared: false,\n\t};\n\tfor (const field of definitions) {\n\t\tlet any = false;\n\t\tcost.sizeArguments.forEach((name, index) => {\n\t\t\tconst argument = field.args.find((arg) => arg.name === name);\n\t\t\tconst max = constraintMaxOf(argument);\n\t\t\tif (max === undefined) profile.someNoMax[index] = true;\n\t\t\telse profile.maxima[index] = Math.max(profile.maxima[index] ?? 0, max);\n\t\t\tconst size = defaultSizeOf(argument);\n\t\t\tif (size === undefined) {\n\t\t\t\tprofile.someLack[index] = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tany = true;\n\t\t\tprofile.largest[index] = Math.max(profile.largest[index] ?? 0, size);\n\t\t});\n\t\tif (!any) profile.someBare = true;\n\t\tif (field.args.some((arg) => cost.sizeArguments.includes(arg.name))) {\n\t\t\tprofile.declares = true;\n\t\t} else {\n\t\t\tprofile.someUndeclared = true;\n\t\t}\n\t}\n\tbyField.set(key, profile);\n\treturn profile;\n}\n\n/** The size a size argument says, `undefined` when it says nothing. */\nfunction argumentSize(\n\tcost: SizeContext,\n\tprofile: Profile,\n\tindex: number,\n\tnode: ArgumentNode | undefined,\n): number | undefined {\n\tconst largest = profile.largest[index];\n\tif (!node) return largest;\n\tconst literal = literalSize(node.value);\n\tif (literal !== undefined) return literal;\n\t// Given but unusable (a variable, a negative number): the argument's own\n\t// default, else defaultFirst; and no less than the bound the client may send.\n\tconst today = profile.someLack[index]\n\t\t? Math.max(largest ?? 0, cost.defaultFirst)\n\t\t: largest;\n\tconst bound = unusableBound(cost, profile, index);\n\treturn bound === undefined ? today : Math.max(today ?? 0, bound);\n}\n\n/** What an unusable size may be at most: the declared bound (`max` or `exclusiveMax`), and `variableSize` where some definition declares none. */\nfunction unusableBound(\n\tcost: SizeContext,\n\tprofile: Profile,\n\tindex: number,\n): number | undefined {\n\tconst assumed = profile.someNoMax[index] ? cost.variableSize : undefined;\n\tconst declared = profile.maxima[index];\n\tif (assumed === undefined) return declared;\n\treturn Math.max(declared ?? 0, assumed);\n}\n\n/**\n * The size `definition` states on `parent`, as selected by `args`: the largest\n * its size arguments say, `undefined` when none says anything (none given, and\n * none declared with a default). The schema's part is memoized, so a selection\n * costs `sizeArguments.length` steps whatever the number of possible types.\n * A list uses it, and a field returning an object (a Relay connection) hands it\n * to the lists below it.\n */\nexport function statedSize(\n\tcost: SizeContext,\n\tparent: GraphQLNamedType | undefined,\n\tdefinition: GraphQLField<unknown, unknown>,\n\targs: readonly ArgumentNode[] | undefined,\n): number | undefined {\n\tconst profile = profileOf(cost, parent, definition);\n\tlet size: number | undefined;\n\tlet given = false;\n\tcost.sizeArguments.forEach((name, index) => {\n\t\tconst node = args?.find((arg) => arg.name.value === name);\n\t\tif (node) given = true;\n\t\tconst said = argumentSize(cost, profile, index, node);\n\t\tif (said !== undefined) size = Math.max(size ?? 0, said);\n\t});\n\t// Nothing given: a definition without any default is sized defaultFirst.\n\tif (size !== undefined && !given && profile.someBare) {\n\t\treturn Math.max(size, cost.defaultFirst);\n\t}\n\treturn size;\n}\n\n/**\n * Whether `definition` and the fields implementing it declare a size argument:\n * `'all'` of them, `'none'` of them, or `'some'` (an abstract parent whose\n * possible types differ).\n */\nexport function declaration(\n\tcost: SizeContext,\n\tparent: GraphQLNamedType | undefined,\n\tdefinition: GraphQLField<unknown, unknown>,\n): 'all' | 'none' | 'some' {\n\tconst { declares, someUndeclared } = profileOf(cost, parent, definition);\n\tif (!declares) return 'none';\n\treturn someUndeclared ? 'some' : 'all';\n}\n",
|
|
16
|
+
"import type { GraphQLArgument, ValueNode } from 'graphql';\nimport { CEILING } from './describe';\n\nconst CANONICAL_INTEGER = /^(0|[1-9]\\d*)$/;\n\n/**\n * The one reading of a size, wherever it comes from (a literal, a default): a\n * non-negative integral number or bigint, or a canonical-integer string,\n * clamped to the ceiling. Anything else says nothing.\n */\nexport function sizeOf(value: unknown): number | undefined {\n\tif (typeof value === 'string') {\n\t\treturn CANONICAL_INTEGER.test(value)\n\t\t\t? Math.min(Number(value), CEILING)\n\t\t\t: undefined;\n\t}\n\t// A bigint is how a Long scalar's default is held once its real scalar is\n\t// swapped in.\n\tif (typeof value === 'bigint') {\n\t\treturn value >= 0n ? Math.min(Number(value), CEILING) : undefined;\n\t}\n\treturn typeof value === 'number' && Number.isInteger(value) && value >= 0\n\t\t? Math.min(value, CEILING)\n\t\t: undefined;\n}\n\n/** The size a literal gives: an Int, a canonical-integer String or an integral Float (`1e3`). */\nexport function literalSize(value: ValueNode): number | undefined {\n\tif (value.kind === 'IntValue' || value.kind === 'FloatValue') {\n\t\treturn sizeOf(Number(value.value));\n\t}\n\treturn value.kind === 'StringValue' ? sizeOf(value.value) : undefined;\n}\n\n/**\n * An argument's SDL default as a size. graphql 16 holds it as `defaultValue`;\n * graphql 17 as `default`, `{ value }` or `{ literal }`.\n */\nexport function defaultSizeOf(\n\targument: object | undefined,\n): number | undefined {\n\tif (!argument) return undefined;\n\tif ('defaultValue' in argument) {\n\t\tconst size = sizeOf(argument.defaultValue);\n\t\tif (size !== undefined) return size;\n\t}\n\tif (!('default' in argument)) return undefined;\n\tconst fallback = argument.default;\n\tif (typeof fallback !== 'object' || fallback === null) return undefined;\n\tif ('value' in fallback) return sizeOf(fallback.value);\n\tif ('literal' in fallback && typeof fallback.literal === 'object') {\n\t\tconst literal = fallback.literal;\n\t\treturn literal !== null && 'kind' in literal\n\t\t\t? literalSize(literal as ValueNode)\n\t\t\t: undefined;\n\t}\n\treturn undefined;\n}\n\n/** A bound a literal gives: a finite number of at least 0 rounded up, or what `literalSize` reads in a string. */\nfunction boundOf(value: ValueNode): number | undefined {\n\t// Only an invalid schema has a string bound; reading \"100\" as 100 errs high.\n\tif (value.kind === 'StringValue') return literalSize(value);\n\tif (value.kind !== 'IntValue' && value.kind !== 'FloatValue')\n\t\treturn undefined;\n\tconst number = Number(value.value);\n\t// `max: 1e400` overflows to Infinity: an Infinity bound means unbounded.\n\treturn Number.isFinite(number) && number >= 0\n\t\t? Math.min(Math.ceil(number), CEILING)\n\t\t: undefined;\n}\n\n/**\n * The bound of an argument's `@constraint` directive, as a size: what the\n * client may send at most. The largest of `max` and `exclusiveMax` (the value\n * itself, a slight over-count), a fractional one rounded up. Read from the SDL\n * node, so a code-first argument (no `astNode`) declares none.\n */\nexport function constraintMaxOf(\n\targument: GraphQLArgument | undefined,\n): number | undefined {\n\tconst directive = argument?.astNode?.directives?.find(\n\t\t(node) => node.name.value === 'constraint',\n\t);\n\tlet largest: number | undefined;\n\tfor (const node of directive?.arguments ?? []) {\n\t\tif (node.name.value !== 'max' && node.name.value !== 'exclusiveMax') {\n\t\t\tcontinue;\n\t\t}\n\t\tconst bound = boundOf(node.value);\n\t\tif (bound !== undefined && (largest === undefined || bound > largest)) {\n\t\t\tlargest = bound;\n\t\t}\n\t}\n\treturn largest;\n}\n",
|
|
17
|
+
"/** Options of `maxListCost`. */\nexport interface MaxListCostOptions {\n\t/** The most an operation may cost (at least 0). */\n\tbudget: number;\n\t/** The size of a list field whose size cannot be read (an integer of at least 0). */\n\tdefaultFirst: number;\n\t/**\n\t * The argument names that size a list. Each one given, or defaulted in the\n\t * SDL, says a size (an Int, a canonical-integer string or an integral Float)\n\t * and the largest wins. Default `['first', 'last', 'limit']`. One on a\n\t * non-list field also sizes the lists declaring none directly on its return\n\t * type (a Relay connection's `edges` and `nodes`).\n\t */\n\tsizeArguments?: readonly string[];\n\t/**\n\t * Do not cost `__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 is costly (on the order of\n\t * 200,000 on a one-field schema).\n\t */\n\tignoreIntrospection?: boolean;\n\t/**\n\t * What to assume for a size argument the client sends as a variable (or\n\t * writes as an unusable literal): an integer of at least 0. Validation has\n\t * no variable values, and the client may send any value the argument\n\t * accepts, so such a size counts as the largest of its SDL default (else\n\t * `defaultFirst`), its declared bound (`@constraint(max)` or `exclusiveMax`)\n\t * and, where some definition declares no bound, this. It applies to every\n\t * size argument. A declared bound wins over this option only when every\n\t * definition declares one (the interface's field and each possible type's);\n\t * if any lacks one, this applies too and the largest wins. A code-first\n\t * argument has no SDL node, so only this applies to it. The operation's own\n\t * variable default is ignored. Default: none.\n\t */\n\tvariableSize?: number;\n}\n\nexport const DEFAULT_SIZE_ARGUMENTS = ['first', 'last', 'limit'] as const;\n",
|
|
15
18
|
"import type { ArgumentNode, GraphQLField, GraphQLNamedType } from 'graphql';\nimport { declaration, type SizeContext, statedSize } from './list-size';\n\n/**\n * The size of the list `definition` on `parent`. `pending` is the size of the\n * field whose return type this list is selected on (a connection's `first`):\n * a list that declares none of the size arguments takes it, since the size\n * cannot be stated on the list itself. A list that declares one reads its own\n * arguments, else `defaultFirst`, and never the pending size. On an abstract\n * parent some possible types may declare one and others not: the largest of\n * both readings, since the query cannot say which comes back.\n */\nexport function listSizeUnder(\n\tcost: SizeContext,\n\tparent: GraphQLNamedType | undefined,\n\tdefinition: GraphQLField<unknown, unknown>,\n\targs: readonly ArgumentNode[] | undefined,\n\tpending: number | undefined,\n): number {\n\tconst own = () =>\n\t\tstatedSize(cost, parent, definition, args) ?? cost.defaultFirst;\n\tif (pending === undefined) return own();\n\tconst declared = declaration(cost, parent, definition);\n\tif (declared === 'none') return pending;\n\tif (declared === 'all') return own();\n\t// Mixed: a possible type declaring none takes the pending size, another reads its own.\n\treturn Math.max(pending, own());\n}\n",
|
|
16
19
|
"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",
|
|
17
20
|
"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"
|
|
18
21
|
],
|
|
19
|
-
"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,MAAM,aAAqC,EAAE,MAAM,kBAAkB,OAAO;AAAA,EAC5E,OAAO,IAAI,aAAa,yBAAyB,UAAU,UAAU;AAAA,IACpE;AAAA,EACD,CAAC;AAAA;AAUK,SAAS,YAAY,CAAC,OAAe,OAAiC;AAAA,EAC5E,OAAO,QAAQ,OAAO,SAAS,KAAK,CAAC;AAAA;AAItC,eAAsB,SAAS,CAC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
|
|
21
24
|
"names": []
|
|
22
25
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type GraphQLField, type GraphQLNamedType, type GraphQLSchema, type OperationDefinitionNode } from 'graphql';
|
|
2
|
+
import { type FragmentWalk } from './fragments.js';
|
|
2
3
|
import type { SizeContext } from './list-size.js';
|
|
3
|
-
export declare const add: (a: number, b: number) => number;
|
|
4
4
|
export declare const multiply: (a: number, b: number) => number;
|
|
5
5
|
/** What a walk of one document needs: the options, and what it has measured so far. */
|
|
6
|
-
export interface CostContext extends SizeContext {
|
|
6
|
+
export interface CostContext extends SizeContext, FragmentWalk {
|
|
7
7
|
ignoreIntrospection: boolean;
|
|
8
|
-
getFragment: (name: string) => FragmentDefinitionNode | null | undefined;
|
|
9
|
-
fragmentCosts: Map<string, Map<number, number>>;
|
|
10
|
-
costing: Set<string>;
|
|
11
8
|
}
|
|
12
9
|
/** The definition of the field `name` on `parent`, meta-fields of the query root included. */
|
|
13
10
|
export declare function fieldOf(cost: CostContext, parent: GraphQLNamedType | undefined, name: string): GraphQLField<unknown, unknown> | undefined;
|
|
14
11
|
/** The type an operation selects on. */
|
|
15
12
|
export declare function rootType(schema: GraphQLSchema, operation: OperationDefinitionNode): import("graphql").GraphQLObjectType<any, any> | undefined;
|
|
16
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The key a fragment is memoized under when no size is pending: the walk's own
|
|
15
|
+
* "no key", which no real size can equal (a size is never negative).
|
|
16
|
+
*/
|
|
17
17
|
export declare const NO_PENDING = -1;
|
|
18
18
|
/**
|
|
19
19
|
* The pending size a fragment is costed under. A fragment spread under many
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost-context.d.ts","sourceRoot":"","sources":["../../src/limits/cost-context.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,
|
|
1
|
+
{"version":3,"file":"cost-context.d.ts","sourceRoot":"","sources":["../../src/limits/cost-context.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAGlB,KAAK,uBAAuB,EAC5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,WAA6B,CAAC;AAE3E,uFAAuF;AACvF,MAAM,WAAW,WAAY,SAAQ,WAAW,EAAE,YAAY;IAC7D,mBAAmB,EAAE,OAAO,CAAC;CAC7B;AAED,8FAA8F;AAC9F,wBAAgB,OAAO,CACtB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,gBAAgB,GAAG,SAAS,EACpC,IAAI,EAAE,MAAM,GACV,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,CAO5C;AAED,wCAAwC;AACxC,wBAAgB,QAAQ,CACvB,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,uBAAuB,6DASlC;AAKD;;;GAGG;AACH,eAAO,MAAM,UAAU,KAAS,CAAC;AAEjC;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACvB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,OAAO,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { OperationDefinitionNode } from 'graphql';
|
|
2
|
+
/** Costs and counts are plain numbers, held below this so a hostile query never reaches `Infinity`. */
|
|
3
|
+
export declare const CEILING: number;
|
|
4
|
+
/** `a + b`, clamped where a number stops being exact. */
|
|
5
|
+
export declare const add: (a: number, b: number) => number;
|
|
2
6
|
/** `Operation "Name"`, or `Operation` for an anonymous one. */
|
|
3
7
|
export declare function operationLabel(operation: OperationDefinitionNode): string;
|
|
4
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/limits/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,SAAS,EAAE,uBAAuB,GAAG,MAAM,CAEzE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/limits/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,uGAAuG;AACvG,eAAO,MAAM,OAAO,QAA0B,CAAC;AAE/C,yDAAyD;AACzD,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,WAA6B,CAAC;AAEtE,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,SAAS,EAAE,uBAAuB,GAAG,MAAM,CAEzE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,SAAU,GACX,IAAI,CAMN"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FragmentDefinitionNode } from 'graphql';
|
|
2
|
+
/** The key of a fragment whose value does not depend on anything but its name. */
|
|
3
|
+
export declare const NO_KEY = -1;
|
|
4
|
+
/** What the fragment walk of one document keeps: the fragments, and what each was worth. */
|
|
5
|
+
export interface FragmentWalk {
|
|
6
|
+
getFragment: (name: string) => FragmentDefinitionNode | null | undefined;
|
|
7
|
+
values: Map<string, Map<number, number>>;
|
|
8
|
+
visiting: Set<string>;
|
|
9
|
+
}
|
|
10
|
+
/** An empty walk over the fragments of one document. */
|
|
11
|
+
export declare function newFragmentWalk(getFragment: FragmentWalk['getFragment']): FragmentWalk;
|
|
12
|
+
/**
|
|
13
|
+
* The value of the named fragment under `key`, computed once. `key` is a number,
|
|
14
|
+
* or a function of what is already known for this fragment (`maxListCost` rounds
|
|
15
|
+
* its pending size by it). A fragment reached while it is being computed is a
|
|
16
|
+
* cycle, NoFragmentCyclesRule's to report: its back-edge adds nothing (0).
|
|
17
|
+
*/
|
|
18
|
+
export declare function fragmentValue(walk: FragmentWalk, name: string, key: number | ((known: ReadonlyMap<number, number>) => number), compute: (fragment: FragmentDefinitionNode, key: number) => number): number;
|
|
19
|
+
//# sourceMappingURL=fragments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../src/limits/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,kFAAkF;AAClF,eAAO,MAAM,MAAM,KAAK,CAAC;AAEzB,4FAA4F;AAC5F,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,sBAAsB,GAAG,IAAI,GAAG,SAAS,CAAC;IACzE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAC9B,WAAW,EAAE,YAAY,CAAC,aAAa,CAAC,GACtC,YAAY,CAEd;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,EAC9D,OAAO,EAAE,CAAC,QAAQ,EAAE,sBAAsB,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,GAChE,MAAM,CAgBR"}
|
|
@@ -4,6 +4,8 @@ export interface SizeContext {
|
|
|
4
4
|
schema: GraphQLSchema;
|
|
5
5
|
sizeArguments: readonly string[];
|
|
6
6
|
defaultFirst: number;
|
|
7
|
+
/** What to assume for a size argument given as a variable where some definition declares no bound. */
|
|
8
|
+
variableSize?: number | undefined;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* The size `definition` states on `parent`, as selected by `args`: the largest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-size.d.ts","sourceRoot":"","sources":["../../src/limits/list-size.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"list-size.d.ts","sourceRoot":"","sources":["../../src/limits/list-size.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAElB,MAAM,SAAS,CAAC;AAGjB,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,sGAAsG;IACtG,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAyHD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,gBAAgB,GAAG,SAAS,EACpC,UAAU,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,EAC1C,IAAI,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,GACvC,MAAM,GAAG,SAAS,CAepB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,gBAAgB,GAAG,SAAS,EACpC,UAAU,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,GACxC,KAAK,GAAG,MAAM,GAAG,MAAM,CAIzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-depth.d.ts","sourceRoot":"","sources":["../../src/limits/max-depth.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"max-depth.d.ts","sourceRoot":"","sources":["../../src/limits/max-depth.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,SAAS,CAAC;AAUjB,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC/B,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAoCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CA0BjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-fields.d.ts","sourceRoot":"","sources":["../../src/limits/max-fields.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"max-fields.d.ts","sourceRoot":"","sources":["../../src/limits/max-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,SAAS,CAAC;AAUjB,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAChC,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAiCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CA0BnE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Options of `maxListCost`. */
|
|
2
|
+
export interface MaxListCostOptions {
|
|
3
|
+
/** The most an operation may cost (at least 0). */
|
|
4
|
+
budget: number;
|
|
5
|
+
/** The size of a list field whose size cannot be read (an integer of at least 0). */
|
|
6
|
+
defaultFirst: number;
|
|
7
|
+
/**
|
|
8
|
+
* The argument names that size a list. Each one given, or defaulted in the
|
|
9
|
+
* SDL, says a size (an Int, a canonical-integer string or an integral Float)
|
|
10
|
+
* and the largest wins. Default `['first', 'last', 'limit']`. One on a
|
|
11
|
+
* non-list field also sizes the lists declaring none directly on its return
|
|
12
|
+
* type (a Relay connection's `edges` and `nodes`).
|
|
13
|
+
*/
|
|
14
|
+
sizeArguments?: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Do not cost `__schema` and `__type` (default `false`). Only where
|
|
17
|
+
* introspection is disabled or the client is trusted, e.g. GraphiQL in
|
|
18
|
+
* development: the standard introspection query is costly (on the order of
|
|
19
|
+
* 200,000 on a one-field schema).
|
|
20
|
+
*/
|
|
21
|
+
ignoreIntrospection?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* What to assume for a size argument the client sends as a variable (or
|
|
24
|
+
* writes as an unusable literal): an integer of at least 0. Validation has
|
|
25
|
+
* no variable values, and the client may send any value the argument
|
|
26
|
+
* accepts, so such a size counts as the largest of its SDL default (else
|
|
27
|
+
* `defaultFirst`), its declared bound (`@constraint(max)` or `exclusiveMax`)
|
|
28
|
+
* and, where some definition declares no bound, this. It applies to every
|
|
29
|
+
* size argument. A declared bound wins over this option only when every
|
|
30
|
+
* definition declares one (the interface's field and each possible type's);
|
|
31
|
+
* if any lacks one, this applies too and the largest wins. A code-first
|
|
32
|
+
* argument has no SDL node, so only this applies to it. The operation's own
|
|
33
|
+
* variable default is ignored. Default: none.
|
|
34
|
+
*/
|
|
35
|
+
variableSize?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare const DEFAULT_SIZE_ARGUMENTS: readonly ["first", "last", "limit"];
|
|
38
|
+
//# sourceMappingURL=max-list-cost-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max-list-cost-options.d.ts","sourceRoot":"","sources":["../../src/limits/max-list-cost-options.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,MAAM,WAAW,kBAAkB;IAClC,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,qFAAqF;IACrF,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,sBAAsB,qCAAsC,CAAC"}
|
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
import { type ValidationRule } from 'graphql';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
/** The most an operation may cost (at least 0). */
|
|
5
|
-
budget: number;
|
|
6
|
-
/** The size of a list field whose size cannot be read (an integer of at least 0). */
|
|
7
|
-
defaultFirst: number;
|
|
8
|
-
/**
|
|
9
|
-
* The argument names that size a list. Each one given, or defaulted in the
|
|
10
|
-
* SDL, says a size (an Int, a canonical-integer string or an integral Float)
|
|
11
|
-
* and the largest wins. Default `['first', 'last', 'limit']`. One on a
|
|
12
|
-
* non-list field also sizes the lists declaring none directly on its return
|
|
13
|
-
* type (a Relay connection's `edges` and `nodes`).
|
|
14
|
-
*/
|
|
15
|
-
sizeArguments?: readonly string[];
|
|
16
|
-
/**
|
|
17
|
-
* Do not cost `__schema` and `__type` (default `false`). Only where
|
|
18
|
-
* introspection is disabled or the client is trusted, e.g. GraphiQL in
|
|
19
|
-
* development: the standard introspection query is costly (on the order of
|
|
20
|
-
* 200,000 on a one-field schema).
|
|
21
|
-
*/
|
|
22
|
-
ignoreIntrospection?: boolean;
|
|
23
|
-
}
|
|
2
|
+
import { type MaxListCostOptions } from './max-list-cost-options.js';
|
|
3
|
+
export type { MaxListCostOptions };
|
|
24
4
|
/**
|
|
25
5
|
* A graphql-js validation rule refusing an operation whose cost is more than
|
|
26
6
|
* `budget`, to stop a client from exploiting list cycles (`Folder.items`,
|
|
@@ -38,13 +18,15 @@ export interface MaxListCostOptions {
|
|
|
38
18
|
* `first`, `last`, `limit`) say. A literal Int, a String holding a canonical
|
|
39
19
|
* integer (`"1000"`) or an integral Float (`1e3`) of at least 0 says that
|
|
40
20
|
* number. Anything else (a negative literal, a variable, since validation has
|
|
41
|
-
* no variable values) says the argument's SDL default when it
|
|
42
|
-
* `defaultFirst` otherwise
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
21
|
+
* no variable values) says the largest of the argument's SDL default when it
|
|
22
|
+
* has a usable one (`defaultFirst` otherwise), its declared bound
|
|
23
|
+
* (`@constraint(max)` or `exclusiveMax`) and, when some definition declares no
|
|
24
|
+
* bound, `variableSize`; an argument not given says its SDL default, or
|
|
25
|
+
* nothing. When nothing is said the size is `defaultFirst`. On an interface
|
|
26
|
+
* the largest default and bound over its possible types is used. Hence no
|
|
27
|
+
* subtree ever costs less than nothing: a negative `first` on one field cannot
|
|
28
|
+
* cancel the cost of its sibling. A field whose type (once unwrapped from
|
|
29
|
+
* non-null) is a list is one list, nested `[[X]]` included.
|
|
48
30
|
*
|
|
49
31
|
* A Relay connection puts the size on a field returning an object, with the
|
|
50
32
|
* list below it (`items(first: 100) { edges { node { id } } }`). A field that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-list-cost.d.ts","sourceRoot":"","sources":["../../src/limits/max-list-cost.ts"],"names":[],"mappings":"AAAA,OAAO,EAUN,KAAK,cAAc,EACnB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"max-list-cost.d.ts","sourceRoot":"","sources":["../../src/limits/max-list-cost.ts"],"names":[],"mappings":"AAAA,OAAO,EAUN,KAAK,cAAc,EACnB,MAAM,SAAS,CAAC;AAajB,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAoFnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,cAAc,CAmDvE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GraphQLArgument, ValueNode } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* The one reading of a size, wherever it comes from (a literal, a default): a
|
|
4
|
+
* non-negative integral number or bigint, or a canonical-integer string,
|
|
5
|
+
* clamped to the ceiling. Anything else says nothing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sizeOf(value: unknown): number | undefined;
|
|
8
|
+
/** The size a literal gives: an Int, a canonical-integer String or an integral Float (`1e3`). */
|
|
9
|
+
export declare function literalSize(value: ValueNode): number | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* An argument's SDL default as a size. graphql 16 holds it as `defaultValue`;
|
|
12
|
+
* graphql 17 as `default`, `{ value }` or `{ literal }`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function defaultSizeOf(argument: object | undefined): number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The bound of an argument's `@constraint` directive, as a size: what the
|
|
17
|
+
* client may send at most. The largest of `max` and `exclusiveMax` (the value
|
|
18
|
+
* itself, a slight over-count), a fractional one rounded up. Read from the SDL
|
|
19
|
+
* node, so a code-first argument (no `astNode`) declares none.
|
|
20
|
+
*/
|
|
21
|
+
export declare function constraintMaxOf(argument: GraphQLArgument | undefined): number | undefined;
|
|
22
|
+
//# sourceMappingURL=size-reading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size-reading.d.ts","sourceRoot":"","sources":["../../src/limits/size-reading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAK1D;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAczD;AAED,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAKhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC1B,MAAM,GAAG,SAAS,CAiBpB;AAeD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,QAAQ,EAAE,eAAe,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CAepB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contains.d.ts","sourceRoot":"","sources":["../../src/rules/contains.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,
|
|
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,
|
|
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,
|
|
1
|
+
{"version":3,"file":"exclusive-max.d.ts","sourceRoot":"","sources":["../../src/rules/exclusive-max.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,0DAY3B,CAAC"}
|