@smthrs/plan 0.0.0-stage → 1.0.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +189 -0
- package/LICENSE +21 -0
- package/README.md +230 -2
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/dist/cjs/CachePolicy.d.ts +131 -0
- package/dist/cjs/CachePolicy.d.ts.map +1 -0
- package/dist/cjs/CachePolicy.js +50 -0
- package/dist/cjs/CachePolicy.js.map +7 -0
- package/dist/cjs/Effects.d.ts +258 -0
- package/dist/cjs/Effects.d.ts.map +1 -0
- package/dist/cjs/Effects.js +76 -0
- package/dist/cjs/Effects.js.map +7 -0
- package/dist/cjs/FileSet.d.ts +366 -0
- package/dist/cjs/FileSet.d.ts.map +1 -0
- package/dist/cjs/FileSet.js +196 -0
- package/dist/cjs/FileSet.js.map +7 -0
- package/dist/cjs/GraphBuildError.d.ts +120 -0
- package/dist/cjs/GraphBuildError.d.ts.map +1 -0
- package/dist/cjs/GraphBuildError.js +71 -0
- package/dist/cjs/GraphBuildError.js.map +7 -0
- package/dist/cjs/KeyMaterial.d.ts +107 -0
- package/dist/cjs/KeyMaterial.d.ts.map +1 -0
- package/dist/cjs/KeyMaterial.js +64 -0
- package/dist/cjs/KeyMaterial.js.map +7 -0
- package/dist/cjs/Node.d.ts +685 -0
- package/dist/cjs/Node.d.ts.map +1 -0
- package/dist/cjs/Node.js +230 -0
- package/dist/cjs/Node.js.map +7 -0
- package/dist/cjs/Placement.d.ts +117 -0
- package/dist/cjs/Placement.d.ts.map +1 -0
- package/dist/cjs/Placement.js +46 -0
- package/dist/cjs/Placement.js.map +7 -0
- package/dist/cjs/Plan.d.ts +489 -0
- package/dist/cjs/Plan.d.ts.map +1 -0
- package/dist/cjs/Plan.js +511 -0
- package/dist/cjs/Plan.js.map +7 -0
- package/dist/cjs/PlanDiff.d.ts +77 -0
- package/dist/cjs/PlanDiff.d.ts.map +1 -0
- package/dist/cjs/PlanDiff.js +149 -0
- package/dist/cjs/PlanDiff.js.map +7 -0
- package/dist/cjs/Planned.d.ts +121 -0
- package/dist/cjs/Planned.d.ts.map +1 -0
- package/dist/cjs/Planned.js +72 -0
- package/dist/cjs/Planned.js.map +7 -0
- package/dist/cjs/Repetition.d.ts +31 -0
- package/dist/cjs/Repetition.d.ts.map +1 -0
- package/dist/cjs/Repetition.js +36 -0
- package/dist/cjs/Repetition.js.map +7 -0
- package/dist/cjs/Scheduling.d.ts +89 -0
- package/dist/cjs/Scheduling.d.ts.map +1 -0
- package/dist/cjs/Scheduling.js +76 -0
- package/dist/cjs/Scheduling.js.map +7 -0
- package/dist/cjs/StepKey.d.ts +354 -0
- package/dist/cjs/StepKey.d.ts.map +1 -0
- package/dist/cjs/StepKey.js +313 -0
- package/dist/cjs/StepKey.js.map +7 -0
- package/dist/cjs/index.d.ts +91 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +59 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/ConflictAnnotation.d.ts +59 -0
- package/dist/cjs/internal/ConflictAnnotation.d.ts.map +1 -0
- package/dist/cjs/internal/ConflictAnnotation.js +247 -0
- package/dist/cjs/internal/ConflictAnnotation.js.map +7 -0
- package/dist/cjs/internal/EffectCandidates.d.ts +19 -0
- package/dist/cjs/internal/EffectCandidates.d.ts.map +1 -0
- package/dist/cjs/internal/EffectCandidates.js +92 -0
- package/dist/cjs/internal/EffectCandidates.js.map +7 -0
- package/dist/cjs/internal/JsonMirror.d.ts +34 -0
- package/dist/cjs/internal/JsonMirror.d.ts.map +1 -0
- package/dist/cjs/internal/JsonMirror.js +195 -0
- package/dist/cjs/internal/JsonMirror.js.map +7 -0
- package/dist/cjs/internal/SchemaIdentity.d.ts +140 -0
- package/dist/cjs/internal/SchemaIdentity.d.ts.map +1 -0
- package/dist/cjs/internal/SchemaIdentity.js +718 -0
- package/dist/cjs/internal/SchemaIdentity.js.map +7 -0
- package/dist/cjs/internal/effects.d.ts +245 -0
- package/dist/cjs/internal/effects.d.ts.map +1 -0
- package/dist/cjs/internal/effects.js +290 -0
- package/dist/cjs/internal/effects.js.map +7 -0
- package/dist/cjs/internal/node.d.ts +526 -0
- package/dist/cjs/internal/node.d.ts.map +1 -0
- package/dist/cjs/internal/node.js +313 -0
- package/dist/cjs/internal/node.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/PlanFixtures.d.ts +127 -0
- package/dist/cjs/test/PlanFixtures.d.ts.map +1 -0
- package/dist/cjs/test/PlanFixtures.js +59 -0
- package/dist/cjs/test/PlanFixtures.js.map +7 -0
- package/dist/esm/CachePolicy.d.ts +131 -0
- package/dist/esm/CachePolicy.d.ts.map +1 -0
- package/dist/esm/CachePolicy.js +117 -0
- package/dist/esm/CachePolicy.js.map +1 -0
- package/dist/esm/Effects.d.ts +258 -0
- package/dist/esm/Effects.d.ts.map +1 -0
- package/dist/esm/Effects.js +178 -0
- package/dist/esm/Effects.js.map +1 -0
- package/dist/esm/FileSet.d.ts +366 -0
- package/dist/esm/FileSet.d.ts.map +1 -0
- package/dist/esm/FileSet.js +398 -0
- package/dist/esm/FileSet.js.map +1 -0
- package/dist/esm/GraphBuildError.d.ts +120 -0
- package/dist/esm/GraphBuildError.d.ts.map +1 -0
- package/dist/esm/GraphBuildError.js +145 -0
- package/dist/esm/GraphBuildError.js.map +1 -0
- package/dist/esm/KeyMaterial.d.ts +107 -0
- package/dist/esm/KeyMaterial.d.ts.map +1 -0
- package/dist/esm/KeyMaterial.js +92 -0
- package/dist/esm/KeyMaterial.js.map +1 -0
- package/dist/esm/Node.d.ts +685 -0
- package/dist/esm/Node.d.ts.map +1 -0
- package/dist/esm/Node.js +591 -0
- package/dist/esm/Node.js.map +1 -0
- package/dist/esm/Placement.d.ts +117 -0
- package/dist/esm/Placement.d.ts.map +1 -0
- package/dist/esm/Placement.js +65 -0
- package/dist/esm/Placement.js.map +1 -0
- package/dist/esm/Plan.d.ts +489 -0
- package/dist/esm/Plan.d.ts.map +1 -0
- package/dist/esm/Plan.js +718 -0
- package/dist/esm/Plan.js.map +1 -0
- package/dist/esm/PlanDiff.d.ts +77 -0
- package/dist/esm/PlanDiff.d.ts.map +1 -0
- package/dist/esm/PlanDiff.js +205 -0
- package/dist/esm/PlanDiff.js.map +1 -0
- package/dist/esm/Planned.d.ts +121 -0
- package/dist/esm/Planned.d.ts.map +1 -0
- package/dist/esm/Planned.js +147 -0
- package/dist/esm/Planned.js.map +1 -0
- package/dist/esm/Repetition.d.ts +31 -0
- package/dist/esm/Repetition.d.ts.map +1 -0
- package/dist/esm/Repetition.js +24 -0
- package/dist/esm/Repetition.js.map +1 -0
- package/dist/esm/Scheduling.d.ts +89 -0
- package/dist/esm/Scheduling.d.ts.map +1 -0
- package/dist/esm/Scheduling.js +82 -0
- package/dist/esm/Scheduling.js.map +1 -0
- package/dist/esm/StepKey.d.ts +354 -0
- package/dist/esm/StepKey.d.ts.map +1 -0
- package/dist/esm/StepKey.js +503 -0
- package/dist/esm/StepKey.js.map +1 -0
- package/dist/esm/index.d.ts +91 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +91 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/ConflictAnnotation.d.ts +59 -0
- package/dist/esm/internal/ConflictAnnotation.d.ts.map +1 -0
- package/dist/esm/internal/ConflictAnnotation.js +332 -0
- package/dist/esm/internal/ConflictAnnotation.js.map +1 -0
- package/dist/esm/internal/EffectCandidates.d.ts +19 -0
- package/dist/esm/internal/EffectCandidates.d.ts.map +1 -0
- package/dist/esm/internal/EffectCandidates.js +86 -0
- package/dist/esm/internal/EffectCandidates.js.map +1 -0
- package/dist/esm/internal/JsonMirror.d.ts +34 -0
- package/dist/esm/internal/JsonMirror.d.ts.map +1 -0
- package/dist/esm/internal/JsonMirror.js +204 -0
- package/dist/esm/internal/JsonMirror.js.map +1 -0
- package/dist/esm/internal/SchemaIdentity.d.ts +140 -0
- package/dist/esm/internal/SchemaIdentity.d.ts.map +1 -0
- package/dist/esm/internal/SchemaIdentity.js +1002 -0
- package/dist/esm/internal/SchemaIdentity.js.map +1 -0
- package/dist/esm/internal/effects.d.ts +245 -0
- package/dist/esm/internal/effects.d.ts.map +1 -0
- package/dist/esm/internal/effects.js +459 -0
- package/dist/esm/internal/effects.js.map +1 -0
- package/dist/esm/internal/node.d.ts +526 -0
- package/dist/esm/internal/node.d.ts.map +1 -0
- package/dist/esm/internal/node.js +565 -0
- package/dist/esm/internal/node.js.map +1 -0
- package/dist/esm/test/PlanFixtures.d.ts +127 -0
- package/dist/esm/test/PlanFixtures.d.ts.map +1 -0
- package/dist/esm/test/PlanFixtures.js +60 -0
- package/dist/esm/test/PlanFixtures.js.map +1 -0
- package/docs/README.md +167 -0
- package/docs/api.md +1485 -0
- package/docs/concepts/authoring-ast.md +204 -0
- package/docs/concepts/effects-and-conflicts.md +135 -0
- package/docs/concepts/plan-value.md +168 -0
- package/docs/concepts/step-keys.md +179 -0
- package/docs/guides/author-a-node-graph.md +182 -0
- package/docs/guides/compile-a-plan.md +146 -0
- package/docs/guides/declare-file-effects.md +143 -0
- package/docs/guides/diff-two-plans.md +310 -0
- package/docs/installation.md +75 -0
- package/docs/quickstart.md +128 -0
- package/docs/testing.md +73 -0
- package/docs/troubleshooting.md +314 -0
- package/package.json +255 -3
- package/src/CachePolicy.ts +143 -0
- package/src/Effects.ts +302 -0
- package/src/FileSet.ts +493 -0
- package/src/GraphBuildError.ts +156 -0
- package/src/KeyMaterial.ts +111 -0
- package/src/Node.ts +974 -0
- package/src/Placement.ts +99 -0
- package/src/Plan.ts +911 -0
- package/src/PlanDiff.ts +244 -0
- package/src/Planned.ts +208 -0
- package/src/Repetition.ts +33 -0
- package/src/Scheduling.ts +154 -0
- package/src/StepKey.ts +736 -0
- package/src/index.ts +103 -0
- package/src/internal/ConflictAnnotation.ts +374 -0
- package/src/internal/EffectCandidates.ts +89 -0
- package/src/internal/JsonMirror.ts +255 -0
- package/src/internal/SchemaIdentity.ts +1096 -0
- package/src/internal/effects.ts +543 -0
- package/src/internal/node.ts +859 -0
- package/src/test/PlanFixtures.ts +76 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/SchemaIdentity.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The schema identity projection: the JSON-Schema-shaped document a schema\n * contributes to a step key.\n *\n * A call node folds what its callee accepts and produces into the material a\n * step key is derived from, and a catch node folds its filter the same way. A\n * projection that printed differently under another `effect` release would\n * re-key every recorded step in every journal at once. `effect` is a peer\n * range, so the application picks the release; the projection therefore\n * cannot be the installed `Schema.toJsonSchemaDocument`. `effect@4.0.4`\n * already changed what that emitter prints for `Schema.Int`, `isMinLength`,\n * `isPattern`, repeated bounds, `oneOf` unions and shared definitions.\n *\n * This module owns the bytes instead. It reads the schema through two public\n * functions, `Schema.toCodecJson` and `Schema.toRepresentation`, and prints\n * the result with the emitter and the check fragments fixed below, which\n * reproduce `Schema.toJsonSchemaDocument(schema, options)` of\n * `effect@4.0.0-rc.115` for both values of `onExcessProperty`.\n *\n * It is for identity only. Where a JSON Schema is shown to a model or a\n * person, the installed emitter is the right one.\n *\n * What still moves an identity, by design: a release that changes a schema's\n * JSON codec or its representation changes what the schema accepts on the\n * wire. Three limits follow from what the representation carries:\n *\n * - A built-in check contributes the constraint its id and payload name. A\n * `toJsonSchema` annotation passed to a built-in check constructor is not\n * consulted; one on a `makeFilter` check is.\n * - A built-in check this module does not list falls back to the installed\n * check's own `toJsonSchema` annotation.\n * - `Schema.brand` is not part of the representation from `effect@4.0.4` on.\n * Under rc.115 a schema that takes a definition (an `identifier` or a\n * recursive schema) and appeared both branded and unbranded in one document\n * got two definitions; it now gets one.\n *\n * Provenance: {@link fromRepresentation} and its helpers are adapted from\n * `effect@4.0.0-rc.115` (MIT, Copyright (c) 2023 Effectful Technologies Inc;\n * the notice is in this package's `THIRD_PARTY_NOTICES.md`), files\n * `src/internal/schema/toJsonSchemaDocument.ts`, `src/JsonSchema.ts`\n * (`rewriteRefs`), `src/JsonPointer.ts` and `src/SchemaAST.ts` (`isJson`).\n * Changes: `onExcessProperty` is the only option; one root; a built-in\n * check's fragment comes from {@link builtinChecks}, not from\n * the installed annotation; an approximate check result contributes its\n * schema.\n *\n * @since 1.0.0\n */\n\nimport type * as JsonSchema from \"effect/JsonSchema\"\nimport * as Schema from \"effect/Schema\"\nimport type * as SchemaAST from \"effect/SchemaAST\"\nimport * as SchemaRepresentation from \"effect/SchemaRepresentation\"\n\n/** @private */\ntype Fragment = JsonSchema.JsonSchema\n\n/** @private */\ntype Path = ReadonlyArray<string | number>\n\n/** @private */\ntype Representation = SchemaRepresentation.Representation\n\n/** @private */\ntype Check = SchemaRepresentation.Check\n\n/** @private */\ntype CheckInput = SchemaRepresentation.ToJsonSchema.CheckInput\n\n/**\n * The document a schema's identity is: exactly what rc.115 returned from\n * `Schema.toJsonSchemaDocument`, key order included.\n *\n * @since 1.0.0\n * @private\n */\nexport type Document = JsonSchema.Document<\"draft-2020-12\">\n\n/**\n * How an object schema treats a key it does not declare, which is the one\n * emitter option a declaration's identity is taken under. It has rc.115's\n * meaning and rc.115's default: `\"ignore\"` leaves such keys open, `\"error\"`\n * closes them.\n *\n * @since 1.0.0\n * @private\n */\nexport interface Options {\n readonly onExcessProperty?: \"ignore\" | \"error\" | undefined\n}\n\n/**\n * A schema a step key cannot be derived from: one with no JSON Schema form or\n * no representation, or one whose built-in check the installed `effect`\n * describes differently from the releases this package supports. The message\n * is the one `effect@4.0.0-rc.115` gave for the same schema, where it gave one.\n *\n * @since 1.0.0\n * @category errors\n */\nexport class SchemaIdentityError extends Schema.TaggedError<SchemaIdentityError>()(\"@smthrs/plan/SchemaIdentityError\", {\n message: Schema.String\n}) {}\n\n/** @private */\nconst invalid = (message: string, path: Path): SchemaIdentityError =>\n new SchemaIdentityError({\n message: path.length === 0\n ? message\n : `${message}\\n at ${path.map((key) => `[${typeof key === \"string\" ? JSON.stringify(key) : key}]`).join(\"\")}`\n })\n\n/** @private */\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value)\n\n/**\n * Assigns an own property, `__proto__` included: a struct may declare a field\n * by that name, and plain assignment would set the prototype instead.\n *\n * @private\n */\nconst assignProperty = (target: Record<string, unknown>, key: string, value: unknown): void => {\n if (key === \"__proto__\") {\n Object.defineProperty(target, key, { value, writable: true, enumerable: true, configurable: true })\n } else {\n target[key] = value\n }\n}\n\n/**\n * Whether a value is JSON: finite numbers, plain objects, no cycles. An\n * annotation that is not JSON never reaches the document.\n *\n * @private\n */\nconst isJson = (value: unknown, path: ReadonlySet<object> = new Set()): boolean => {\n if (typeof value !== \"object\" || value === null) {\n return value === null || typeof value === \"string\" || typeof value === \"boolean\" ||\n (typeof value === \"number\" && Number.isFinite(value))\n }\n if (path.has(value)) return false\n const members = Array.isArray(value) ? Array.from<unknown>(value) : plainValues(value)\n if (members === undefined) return false\n const inner = new Set(path).add(value)\n return members.every((member) => isJson(member, inner))\n}\n\n/** @private */\nconst plainValues = (value: object): ReadonlyArray<unknown> | undefined => {\n const prototype: unknown = Object.getPrototypeOf(value)\n // A plain object from another realm has a different `Object.prototype`,\n // but that prototype still has a null prototype.\n return prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null\n ? Object.values(value)\n : undefined\n}\n\n/**\n * Structural equality of two emitted schemas, ignoring key order. `NaN`\n * equals itself: an author's fragment may carry one, and two definitions that\n * differ in nothing else are one definition.\n *\n * @private\n */\nconst sameJson = (left: unknown, right: unknown): boolean => {\n if (Array.isArray(left) && Array.isArray(right)) {\n return left.length === right.length && left.every((member, index) => sameJson(member, right[index]))\n }\n if (isObject(left) && isObject(right)) {\n const keys = Object.keys(left)\n return keys.length === Object.keys(right).length &&\n keys.every((key) => Object.hasOwn(right, key) && sameJson(left[key], right[key]))\n }\n return left === right || (left !== left && right !== right)\n}\n\n/** @private */\nconst escapeRegExp = (text: string): string => text.replace(/[/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\")\n\n/** @private */\nconst unescapeToken = (token: string): string => token.replace(/~1/g, \"/\").replace(/~0/g, \"~\")\n\n/** @private */\nconst definitionReference = (key: string): string =>\n `#/$defs/${encodeURI(key.replace(/~/g, \"~0\").replace(/\\//g, \"~1\")).replace(/#/g, \"%23\")}`\n\n/**\n * The JSON Pointer a URI fragment names, or `undefined` when it names none.\n *\n * @private\n */\nconst decodeUriFragment = (fragment: string): string | undefined => {\n if (fragment.length === 0 || fragment === \"#\") return \"\"\n if (!fragment.startsWith(\"#\")) return undefined\n const encoded = fragment.slice(1)\n try {\n if (encodeURI(encoded).replace(/%25/g, \"%\").replace(/#/g, \"%23\") !== encoded) return undefined\n const pointer = decodeURIComponent(encoded)\n return pointer.startsWith(\"/\") && !/~(?:[^01]|$)/.test(pointer) ? pointer : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * Copies a schema, rewriting every `$ref` and `$dynamicRef` in a schema\n * position. Values that are data (`enum`, `const`, `default`, `examples`) are\n * not walked.\n *\n * @private\n */\nconst rewriteRefs = (node: Fragment, rewrite: (reference: string) => string): Fragment => {\n const walk = (value: unknown): unknown => isObject(value) ? rewriteRefs(value, rewrite) : value\n const out: Fragment = {}\n for (const key of Object.keys(node)) {\n const value = node[key]\n let transformed = value\n switch (key) {\n case \"$defs\":\n case \"properties\":\n case \"patternProperties\":\n case \"dependentSchemas\":\n if (isObject(value)) {\n const mapped: Fragment = {}\n for (const name of Object.keys(value)) assignProperty(mapped, name, walk(value[name]))\n transformed = mapped\n }\n break\n case \"allOf\":\n case \"anyOf\":\n case \"oneOf\":\n case \"prefixItems\":\n if (Array.isArray(value)) transformed = value.map(walk)\n break\n case \"not\":\n case \"additionalProperties\":\n case \"propertyNames\":\n case \"unevaluatedProperties\":\n case \"items\":\n case \"contains\":\n case \"unevaluatedItems\":\n case \"if\":\n case \"then\":\n case \"else\":\n case \"contentSchema\":\n transformed = walk(value)\n }\n assignProperty(out, key, transformed)\n }\n if (typeof out[\"$ref\"] === \"string\") out[\"$ref\"] = rewrite(out[\"$ref\"])\n if (typeof out[\"$dynamicRef\"] === \"string\") out[\"$dynamicRef\"] = rewrite(out[\"$dynamicRef\"])\n return out\n}\n\n/**\n * The annotations a JSON Schema states, in the order rc.115 printed them.\n *\n * @private\n */\nconst ordinaryAnnotations = (annotations: Schema.Annotations.Annotations | undefined): Fragment | undefined => {\n if (annotations === undefined) return undefined\n const out: Fragment = {}\n if (typeof annotations[\"title\"] === \"string\") out[\"title\"] = annotations[\"title\"]\n if (typeof annotations[\"description\"] === \"string\") out[\"description\"] = annotations[\"description\"]\n if (isJson(annotations[\"default\"])) out[\"default\"] = annotations[\"default\"]\n if (Array.isArray(annotations[\"examples\"]) && isJson(annotations[\"examples\"])) {\n out[\"examples\"] = annotations[\"examples\"]\n }\n if (typeof annotations[\"readOnly\"] === \"boolean\") out[\"readOnly\"] = annotations[\"readOnly\"]\n if (typeof annotations[\"writeOnly\"] === \"boolean\") out[\"writeOnly\"] = annotations[\"writeOnly\"]\n if (typeof annotations[\"format\"] === \"string\") out[\"format\"] = annotations[\"format\"]\n if (typeof annotations[\"contentEncoding\"] === \"string\") out[\"contentEncoding\"] = annotations[\"contentEncoding\"]\n if (typeof annotations[\"contentMediaType\"] === \"string\") out[\"contentMediaType\"] = annotations[\"contentMediaType\"]\n if (isJson(annotations[\"contentSchema\"])) out[\"contentSchema\"] = annotations[\"contentSchema\"]\n return Object.keys(out).length === 0 ? undefined : out\n}\n\n/** @private */\nconst finitePattern = \"[+-]?\\\\d*\\\\.?\\\\d+(?:[Ee][+-]?\\\\d+)?\"\n\n/** @private */\nconst stringPattern = \"[\\\\s\\\\S]*?\"\n\n/** @private */\nconst bigIntPattern = \"^-?\\\\d+$\"\n\n/** @private */\nconst symbolPattern = \"^Symbol\\\\(([\\\\s\\\\S]*)\\\\)$\"\n\n/** @private */\nconst uuidPattern = (version: number | null): string =>\n version === null\n ? \"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|\" +\n \"00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$\"\n : `^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`\n\n/**\n * One field of a built-in check's payload. A release that renamed or retyped\n * it would otherwise print `undefined` into an identity, so it is refused.\n *\n * @private\n */\nconst field = <A>(id: string, payload: unknown, name: string, is: (value: unknown) => value is A): A => {\n const value = isObject(payload) ? payload[name] : undefined\n if (!is(value)) {\n throw new SchemaIdentityError({\n message: `Cannot derive a schema identity: check ${id} carries no usable \"${name}\" in its payload. ` +\n \"The installed effect release describes this check differently from the releases @smthrs/plan supports.\"\n })\n }\n return value\n}\n\n/** @private */\nconst isNumber = (value: unknown): value is number => typeof value === \"number\"\n\n/** @private */\nconst isString = (value: unknown): value is string => typeof value === \"string\"\n\n/** @private */\nconst isVersion = (value: unknown): value is number | null => value === null || typeof value === \"number\"\n\n/** @private */\nconst isFlag = (value: unknown): value is boolean | undefined => value === undefined || typeof value === \"boolean\"\n\n/**\n * What a built-in check prints: its payload and the JSON type it refines in,\n * a fragment out. `null` is a check that prints nothing.\n *\n * @private\n */\ntype BuiltinCheck = ((id: string, payload: unknown, input: CheckInput) => Fragment) | null\n\n/** @private */\nconst pattern = (source: string): BuiltinCheck => () => ({ pattern: source })\n\n/** @private */\nconst literalPattern = (name: string, source: (escaped: string) => string): BuiltinCheck => (id, payload) => ({\n pattern: new RegExp(source(escapeRegExp(field(id, payload, name, isString)))).source\n})\n\n/** @private */\nconst bound = (keyword: string, name: string = keyword): BuiltinCheck => (id, payload) => ({\n [keyword]: field(id, payload, name, isNumber)\n})\n\n/** @private */\nconst length = (name: string, array: string, string: string): BuiltinCheck => (id, payload, input) => ({\n [input.type === \"array\" ? array : string]: field(id, payload, name, isNumber)\n})\n\n/** @private */\nconst empty: BuiltinCheck = () => ({})\n\n/**\n * Every built-in check, keyed by the id its representation carries, with the\n * fragment `effect@4.0.0-rc.115` printed for it.\n *\n * The three code-point checks did not exist under rc.115; they print what\n * `effect@4.0.4` introduced them with. The date, big integer and size checks\n * print nothing but still carry their own annotations, which is what the\n * empty fragment keeps.\n *\n * @private\n */\nconst builtinChecks: ReadonlyMap<string, BuiltinCheck> = new Map<string, BuiltinCheck>([\n [\"effect/schema/isTrimmed\", pattern(\"^\\\\S[\\\\s\\\\S]*\\\\S$|^\\\\S$|^$\")],\n [\"effect/schema/isPattern\", (id, payload) => ({ pattern: field(id, payload, \"source\", isString) })],\n [\"effect/schema/isStringFinite\", pattern(`^${finitePattern}$`)],\n [\"effect/schema/isStringBigInt\", pattern(bigIntPattern)],\n [\"effect/schema/isStringSymbol\", pattern(symbolPattern)],\n [\"effect/schema/isUUID\", (id, payload) => ({\n pattern: uuidPattern(field(id, payload, \"version\", isVersion)),\n format: \"uuid\"\n })],\n [\"effect/schema/isGUID\", pattern(\"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$\")],\n [\"effect/schema/isULID\", pattern(\"^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$\")],\n [\"effect/schema/isBase64\", pattern(\"^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$\")],\n [\"effect/schema/isBase64Url\", pattern(\"^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$\")],\n [\"effect/schema/isStartingWith\", literalPattern(\"startsWith\", (escaped) => `^${escaped}`)],\n [\"effect/schema/isEndingWith\", literalPattern(\"endsWith\", (escaped) => `${escaped}$`)],\n [\"effect/schema/isIncluding\", literalPattern(\"includes\", (escaped) => escaped)],\n [\"effect/schema/isUppercased\", pattern(\"^[^a-z]*$\")],\n [\"effect/schema/isLowercased\", pattern(\"^[^A-Z]*$\")],\n [\"effect/schema/isCapitalized\", pattern(\"^(?:[^a-z][\\\\s\\\\S]*)?$\")],\n [\"effect/schema/isUncapitalized\", pattern(\"^(?:[^A-Z][\\\\s\\\\S]*)?$\")],\n [\"effect/schema/isFinite\", () => ({ type: \"number\" })],\n [\"effect/schema/isInt\", () => ({ type: \"integer\" })],\n [\"effect/schema/isGreaterThan\", bound(\"exclusiveMinimum\")],\n [\"effect/schema/isGreaterThanOrEqualTo\", bound(\"minimum\")],\n [\"effect/schema/isLessThan\", bound(\"exclusiveMaximum\")],\n [\"effect/schema/isLessThanOrEqualTo\", bound(\"maximum\")],\n [\"effect/schema/isBetween\", (id, payload) => ({\n [field(id, payload, \"exclusiveMinimum\", isFlag) ? \"exclusiveMinimum\" : \"minimum\"]: field(\n id,\n payload,\n \"minimum\",\n isNumber\n ),\n [field(id, payload, \"exclusiveMaximum\", isFlag) ? \"exclusiveMaximum\" : \"maximum\"]: field(\n id,\n payload,\n \"maximum\",\n isNumber\n )\n })],\n [\"effect/schema/isMultipleOf\", bound(\"multipleOf\", \"divisor\")],\n [\"effect/schema/isGreaterThanDate\", empty],\n [\"effect/schema/isGreaterThanOrEqualToDate\", empty],\n [\"effect/schema/isLessThanDate\", empty],\n [\"effect/schema/isLessThanOrEqualToDate\", empty],\n [\"effect/schema/isBetweenDate\", empty],\n [\"effect/schema/isGreaterThanBigInt\", empty],\n [\"effect/schema/isGreaterThanOrEqualToBigInt\", empty],\n [\"effect/schema/isLessThanBigInt\", empty],\n [\"effect/schema/isLessThanOrEqualToBigInt\", empty],\n [\"effect/schema/isBetweenBigInt\", empty],\n [\"effect/schema/isMinLength\", length(\"minLength\", \"minItems\", \"minLength\")],\n [\"effect/schema/isMaxLength\", length(\"maxLength\", \"maxItems\", \"maxLength\")],\n [\"effect/schema/isBetweenLength\", (id, payload, input) => {\n const minimum = field(id, payload, \"minimum\", isNumber)\n const maximum = field(id, payload, \"maximum\", isNumber)\n return input.type === \"array\"\n ? { allOf: [{ minItems: minimum }, { maxItems: maximum }] }\n : { allOf: [{ minLength: minimum }, { maxLength: maximum }] }\n }],\n [\"effect/schema/isMinCodePoints\", bound(\"minLength\", \"minCodePoints\")],\n [\"effect/schema/isMaxCodePoints\", bound(\"maxLength\", \"maxCodePoints\")],\n [\"effect/schema/isBetweenCodePoints\", (id, payload) => ({\n allOf: [\n { minLength: field(id, payload, \"minimum\", isNumber) },\n { maxLength: field(id, payload, \"maximum\", isNumber) }\n ]\n })],\n [\"effect/schema/isMinSize\", empty],\n [\"effect/schema/isMaxSize\", empty],\n [\"effect/schema/isBetweenSize\", empty],\n [\"effect/schema/isMinProperties\", bound(\"minProperties\")],\n [\"effect/schema/isMaxProperties\", bound(\"maxProperties\")],\n [\"effect/schema/isBetweenProperties\", (id, payload) => ({\n minProperties: field(id, payload, \"minimum\", isNumber),\n maxProperties: field(id, payload, \"maximum\", isNumber)\n })],\n [\"effect/schema/isPropertyNames\", (_id, _payload, input) => ({ propertyNames: input.schemas[0] })],\n [\"effect/schema/isUnique\", () => ({ uniqueItems: true })],\n [\"effect/schema/isUniqueKey\", null]\n])\n\n/**\n * The ids {@link builtinChecks} lists, for the test that holds the list\n * against the checks the installed `effect` can revive.\n *\n * @since 1.0.0\n * @private\n */\nexport const builtinCheckIds: ReadonlyArray<string> = [...builtinChecks.keys()]\n\n/** @private */\nconst isCheckCallback = (value: unknown): value is SchemaRepresentation.ToJsonSchema.Check =>\n typeof value === \"function\"\n\n/** @private */\nconst isApproximate = (\n output: SchemaRepresentation.ToJsonSchema.CheckOutput\n): output is readonly [schema: Fragment, approximate: true] => Array.isArray(output)\n\n/**\n * What prints a check, if anything does: the owned fragment for a built-in\n * check, otherwise the author's own `toJsonSchema` annotation.\n *\n * @private\n */\nconst fragmentSource = (check: Check): ((input: CheckInput) => Fragment) | undefined => {\n const representation = check.representation\n const builtin = representation === undefined ? undefined : builtinChecks.get(representation.id)\n if (representation !== undefined && builtin !== undefined) {\n return builtin === null ? undefined : (input) => builtin(representation.id, representation.payload, input)\n }\n const callback = check.annotations?.[\"toJsonSchema\"]\n if (!isCheckCallback(callback)) return undefined\n return (input) => {\n const output = callback(input)\n return isApproximate(output) ? output[0] : output\n }\n}\n\n/** @private */\ntype NumberType = \"number\" | \"integer\"\n\n/** @private */\nconst extractNumberType = (schema: Fragment): { readonly type: NumberType | undefined; readonly schema: Fragment } => {\n let type: NumberType | undefined = schema[\"type\"] === \"number\" || schema[\"type\"] === \"integer\"\n ? schema[\"type\"]\n : undefined\n let out = schema\n if (type !== undefined) {\n out = { ...schema }\n delete out[\"type\"]\n }\n const allOf = out[\"allOf\"]\n if (Array.isArray(allOf)) {\n const members: Array<Fragment> = []\n let changed = false\n for (const member of allOf) {\n const extracted = extractNumberType(member)\n if (extracted.type !== undefined) {\n changed = true\n if (type === undefined || extracted.type === \"integer\") type = extracted.type\n }\n if (Object.keys(extracted.schema).length > 0) members.push(extracted.schema)\n }\n if (changed) {\n const { allOf: _, ...rest } = out\n out = members.length === 0 ? rest : { ...rest, allOf: members }\n }\n }\n return { type, schema: out }\n}\n\n/** @private */\nconst isNumberEncoding = (schema: Fragment): boolean => {\n const anyOf = schema[\"anyOf\"]\n if (!Array.isArray(anyOf) || anyOf.length !== 2 || !isObject(anyOf[0]) || anyOf[0][\"type\"] !== \"number\") return false\n const special: unknown = anyOf[1]\n if (!isObject(special) || special[\"type\"] !== \"string\") return false\n const values = special[\"enum\"]\n return Array.isArray(values) && values.length === 3 && values.includes(\"NaN\") && values.includes(\"Infinity\") &&\n values.includes(\"-Infinity\")\n}\n\n// Keep this allowlist closed: applicators and dependent keywords can change meaning when moved across schema objects.\n/** @private */\nconst inlineableCheckKeywords =\n \"|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|\"\n\n// `format` and `content*` can affect validation, so they are not treated as pure annotations.\n/** @private */\nconst promotableAnnotationKeywords = \"|title|description|default|examples|readOnly|writeOnly|\"\n\n/** @private */\nconst inlineableAnnotatedCheckKeywords = inlineableCheckKeywords + promotableAnnotationKeywords\n\n/** @private */\nconst hasOnlyKeywords = (schema: Fragment, allowed: string): boolean =>\n Object.keys(schema).every((key) => allowed.includes(`|${key}|`))\n\n/** @private */\nconst hasNoCollisions = (left: Fragment, rightKeys: ReadonlyArray<string>): boolean =>\n typeof left[\"$ref\"] !== \"string\" && rightKeys.every((key) => !Object.hasOwn(left, key))\n\n/**\n * Adds a constraint to a schema: inline when no keyword collides, otherwise\n * under `allOf`. A repeated bound is never merged into the tighter one.\n *\n * @private\n */\nconst appendJsonSchema = (left: Fragment, right: Fragment, inlineCheck?: true): Fragment => {\n if (Object.keys(left).length === 0) return right\n const rightKeys = Object.keys(right)\n if (rightKeys.length === 0) return left\n const leftType = left[\"type\"] === \"number\" || left[\"type\"] === \"integer\" ? left[\"type\"] : undefined\n const numberEncoding = isNumberEncoding(left)\n if (leftType !== undefined || numberEncoding) {\n const extracted = extractNumberType(right)\n if (extracted.type !== undefined) {\n const type = leftType === \"integer\" || extracted.type === \"integer\" ? \"integer\" : \"number\"\n const base: Fragment = { ...left, type }\n if (numberEncoding) delete base[\"anyOf\"]\n const extractedKeys = Object.keys(extracted.schema)\n if (extractedKeys.length === 0) return base\n return hasOnlyKeywords(extracted.schema, promotableAnnotationKeywords) && hasNoCollisions(base, extractedKeys)\n ? { ...base, ...extracted.schema }\n : appendJsonSchema(base, extracted.schema, inlineCheck)\n }\n }\n if (inlineCheck && hasNoCollisions(left, rightKeys)) return { ...left, ...right }\n const rightAllOf = right[\"allOf\"]\n const members: ReadonlyArray<unknown> = Array.isArray(rightAllOf) && rightKeys.length === 1 ? rightAllOf : [right]\n const leftAllOf = left[\"allOf\"]\n if (Array.isArray(leftAllOf)) return { ...left, allOf: [...leftAllOf, ...members] }\n if (typeof left[\"$ref\"] === \"string\") return { allOf: [left, ...members] }\n return { ...left, allOf: members }\n}\n\n/** @private */\nconst jsonSchemaTypes: ReadonlySet<unknown> = new Set([\n \"string\",\n \"number\",\n \"boolean\",\n \"array\",\n \"object\",\n \"null\",\n \"integer\"\n])\n\n/** @private */\nconst isJsonSchemaType = (input: unknown): input is JsonSchema.Type => jsonSchemaTypes.has(input)\n\n/**\n * Collapses a union of single-type enums into one enum, the way a union of\n * literals reads.\n *\n * @private\n */\nconst compactEnums = (schemas: ReadonlyArray<Fragment>): Fragment | undefined => {\n let sharedType: unknown = undefined\n const values: Array<unknown> = []\n for (const schema of schemas) {\n const members = schema[\"enum\"]\n if (\n Object.keys(schema).length !== 2 || schema[\"type\"] === undefined || !Array.isArray(members) ||\n members.length === 0\n ) {\n return undefined\n }\n if (sharedType === undefined) sharedType = schema[\"type\"]\n else if (schema[\"type\"] !== sharedType) return undefined\n for (const value of members) {\n if (values.includes(value)) return undefined\n values.push(value)\n }\n }\n return { type: sharedType, enum: values }\n}\n\n/** @private */\nconst partPattern = (part: Representation): string => {\n switch (part._tag) {\n case \"Literal\":\n return escapeRegExp(String(part.literal))\n case \"String\":\n return stringPattern\n case \"Number\":\n return finitePattern\n case \"TemplateLiteral\":\n return part.parts.map(partPattern).join(\"\")\n case \"Union\":\n return `(?:${part.types.map(partPattern).join(\"|\")})`\n default:\n throw invalid(\"Invalid schema representation document\", [])\n }\n}\n\n/** @private */\nconst neverSchema: Fragment = { not: {} }\n\n/**\n * Refuses a representation kind this module does not print. A later `effect`\n * release that adds one fails here by name, not as a missing property.\n *\n * @private\n */\nconst unsupported = (representation: never, path: Path): never => {\n throw invalid(`Unsupported schema representation ${(representation as { readonly _tag: string })._tag}`, path)\n}\n\n/**\n * Prints a representation document as the JSON Schema document rc.115\n * printed for it under the same options.\n *\n * Reserved for {@link schemaIdentity} and for the tests that hand it a\n * representation no schema produces.\n *\n * @since 1.0.0\n * @private\n */\nexport const fromRepresentation = (document: SchemaRepresentation.Document, options?: Options): Document => {\n const closed = options?.onExcessProperty === \"error\"\n const references = document.references\n // A key maps to its compiled schema, to the key it is an alias of, or to\n // `null` while it is compiling.\n const definitionStates = new Map<string, Fragment | string | null>()\n const compiledRepresentations = new WeakMap<Representation, Fragment>()\n const fallbackDefinitions = new Map<string, Array<string>>()\n\n const compileDefinition = (key: string, path: Path): string => {\n const compiled = definitionStates.get(key)\n if (compiled !== undefined) return typeof compiled === \"string\" ? compiled : key\n const representation = Object.hasOwn(references, key) ? references[key] : undefined\n if (representation === undefined) throw invalid(`Invalid reference ${key}`, [...path, \"$ref\"])\n\n definitionStates.set(key, null)\n const schema = recur(representation, [\"references\", key])\n\n const fallback = identifierFallback(representation)\n if (fallback !== undefined) {\n const candidates = fallbackDefinitions.get(fallback)\n const match = candidates?.find((candidate) => sameJson(definitionStates.get(candidate), schema))\n if (match === undefined) {\n if (candidates === undefined) fallbackDefinitions.set(fallback, [key])\n else candidates.push(key)\n } else {\n definitionStates.set(key, match)\n return match\n }\n }\n definitionStates.set(key, schema)\n return key\n }\n\n const finalize = (schema: Fragment): Fragment =>\n rewriteRefs(schema, (reference) => {\n const pointer = decodeUriFragment(reference)\n if (pointer === undefined) {\n if (/^#(?:\\/|%2f)/i.test(reference)) {\n throw new SchemaIdentityError({ message: `Invalid JSON Pointer URI fragment ${JSON.stringify(reference)}` })\n }\n return reference\n }\n if (!pointer.startsWith(\"/$defs/\")) return reference\n const separator = pointer.indexOf(\"/\", 7)\n const canonical = definitionStates.get(unescapeToken(pointer.slice(7, separator < 0 ? undefined : separator)))\n if (typeof canonical !== \"string\") return reference\n // URI-encoded slashes separate pointer tokens; only ~1 represents a slash within a token.\n return reference.replace(/^#(?:\\/|%2f).*?(?:\\/|%2f).*?(?=\\/|%2f|$)/i, definitionReference(canonical))\n })\n\n const identifierFallback = (representation: Representation): string | undefined => {\n if (representation._tag === \"Reference\") return undefined\n const last = representation.checks.at(-1)\n const annotations = last === undefined ? representation.annotations : last.annotations\n const fallback = annotations?.[\"~identifier\"]\n return typeof annotations?.[\"identifier\"] !== \"string\" && typeof fallback === \"string\" ? fallback : undefined\n }\n\n const compileCheck = (\n check: Check,\n type: JsonSchema.Type | undefined,\n path: Path\n ): readonly [schema: Fragment, inline?: true] | undefined => {\n const source = fragmentSource(check)\n if (source !== undefined) {\n const schemas = check.representation?.schemas?.map((schema, index) =>\n recur(schema, [...path, \"representation\", \"schemas\", index])\n ) ?? []\n const fragment = source({ type, schemas })\n const ordinary = ordinaryAnnotations(check.annotations)\n const schema = ordinary === undefined ? fragment : { ...fragment, ...ordinary }\n const allowed = ordinary === undefined ? inlineableCheckKeywords : inlineableAnnotatedCheckKeywords\n return check._tag === \"Filter\" && hasOnlyKeywords(schema, allowed) &&\n (ordinary === undefined || hasOnlyKeywords(ordinary, promotableAnnotationKeywords))\n ? [schema, true]\n : [schema]\n }\n if (check._tag === \"Filter\") return undefined\n\n const allOf: Array<Fragment> = []\n check.checks.forEach((child, index) => {\n const compiled = compileCheck(child, type, [...path, \"checks\", index])\n if (compiled !== undefined) allOf.push(compiled[0])\n })\n if (allOf.length === 0) return undefined\n const ordinary = ordinaryAnnotations(check.annotations)\n return [ordinary === undefined ? { allOf } : { allOf, ...ordinary }]\n }\n\n const recur = (representation: Representation, path: Path): Fragment => {\n if (representation._tag === \"Reference\") {\n return { $ref: definitionReference(compileDefinition(representation.$ref, path)) }\n }\n const cached = compiledRepresentations.get(representation)\n if (cached !== undefined) return cached\n\n let output = on(representation, path)\n const ordinary = ordinaryAnnotations(representation.annotations)\n if (ordinary !== undefined) output = { ...output, ...ordinary }\n representation.checks.forEach((check, index) => {\n const compiled = compileCheck(\n check,\n isJsonSchemaType(output[\"type\"]) ? output[\"type\"] : undefined,\n [...path, \"checks\", index]\n )\n if (compiled !== undefined) output = appendJsonSchema(output, ...compiled)\n })\n compiledRepresentations.set(representation, output)\n return output\n }\n\n const annotated = (compiled: Fragment, annotations: Schema.Annotations.Annotations | undefined): Fragment => {\n const ordinary = ordinaryAnnotations(annotations)\n return ordinary === undefined ? compiled : appendJsonSchema(compiled, ordinary)\n }\n\n const on = (representation: Exclude<Representation, SchemaRepresentation.Reference>, path: Path): Fragment => {\n switch (representation._tag) {\n case \"Any\":\n case \"Unknown\":\n case \"Declaration\":\n return {}\n case \"ObjectKeyword\":\n return { anyOf: [{ type: \"object\" }, { type: \"array\" }] }\n case \"Void\":\n case \"Undefined\":\n case \"Null\":\n return { type: \"null\" }\n case \"BigInt\":\n return { type: \"string\", allOf: [{ pattern: bigIntPattern }] }\n case \"Symbol\":\n return { type: \"string\", allOf: [{ pattern: symbolPattern }] }\n case \"UniqueSymbol\":\n return Symbol.keyFor(representation.symbol) === undefined\n ? { not: {} }\n : { type: \"string\", enum: [String(representation.symbol)] }\n case \"Suspend\":\n return recur(representation.thunk, [...path, \"thunk\"])\n case \"Never\":\n return { not: {} }\n case \"String\":\n return { type: \"string\" }\n case \"Number\":\n return { anyOf: [{ type: \"number\" }, { type: \"string\", enum: [\"NaN\", \"Infinity\", \"-Infinity\"] }] }\n case \"Boolean\":\n return { type: \"boolean\" }\n case \"Literal\": {\n const literal = representation.literal\n return typeof literal === \"bigint\"\n ? { type: \"string\", enum: [String(literal)] }\n : { type: typeof literal, enum: [literal] }\n }\n case \"Enum\": {\n const types = representation.enums.map(([title, literal], index) => {\n if (typeof literal === \"number\" && !Number.isFinite(literal)) {\n throw invalid(`Invalid numeric enum value ${String(literal)}`, [...path, \"enums\", index, 1])\n }\n return { type: typeof literal, enum: [literal], title }\n })\n return types.length === 0 ? { not: {} } : { anyOf: types }\n }\n case \"TemplateLiteral\":\n return { type: \"string\", pattern: `^${representation.parts.map(partPattern).join(\"\")}$` }\n case \"Arrays\": {\n const rest = representation.rest[0]\n if (representation.rest.length > 1) {\n throw invalid(\"Invalid schema representation document\", [...path, \"rest\"])\n }\n const out: Fragment = { type: \"array\" }\n let minItems = representation.elements.length\n const prefixItems = representation.elements.map((element, index) => {\n if (element.isOptional) minItems--\n return annotated(recur(element.type, [...path, \"elements\", index, \"type\"]), element.annotations)\n })\n if (prefixItems.length > 0) {\n out[\"prefixItems\"] = prefixItems\n out[\"maxItems\"] = representation.elements.length\n if (minItems > 0) out[\"minItems\"] = minItems\n } else {\n out[\"items\"] = false\n }\n if (rest !== undefined) {\n delete out[\"maxItems\"]\n const items = recur(rest, [...path, \"rest\", 0])\n if (Object.keys(items).length > 0) out[\"items\"] = items\n else delete out[\"items\"]\n }\n return out\n }\n case \"Objects\": {\n if (representation.propertySignatures.length === 0 && representation.indexSignatures.length === 0) {\n return { not: { type: \"null\" } }\n }\n const out: Fragment = { type: \"object\" }\n const properties: Record<string, Fragment> = {}\n const required: Array<string> = []\n representation.propertySignatures.forEach((property, index) => {\n const name = property.name\n if (typeof name !== \"string\") {\n throw invalid(\"Invalid schema representation document\", [...path, \"propertySignatures\", index, \"name\"])\n }\n assignProperty(\n properties,\n name,\n annotated(recur(property.type, [...path, \"propertySignatures\", index, \"type\"]), property.annotations)\n )\n if (!property.isOptional) required.push(name)\n })\n if (representation.propertySignatures.length > 0) out[\"properties\"] = properties\n if (required.length > 0) out[\"required\"] = required\n const patternProperties: Record<string, Fragment | false> = {}\n const additionalPropertySchemas: Array<Fragment | false> = []\n const indexValueSchemas: Array<Fragment | false> = []\n let hasUnrepresentableIndexPattern = false\n representation.indexSignatures.forEach((signature, index) => {\n const compiled = recur(signature.type, [...path, \"indexSignatures\", index, \"type\"])\n const type = sameJson(compiled, neverSchema) ? false : compiled\n indexValueSchemas.push(type)\n const patterns = parameterPatterns(\n signature.parameter,\n [...path, \"indexSignatures\", index, \"parameter\"],\n new Set()\n )\n if (patterns === undefined) {\n hasUnrepresentableIndexPattern = true\n } else if (patterns.length === 0) {\n additionalPropertySchemas.push(type)\n } else {\n for (const key of patterns) {\n const previous = Object.hasOwn(patternProperties, key) ? patternProperties[key] : undefined\n assignProperty(\n patternProperties,\n key,\n previous === undefined\n ? type\n : previous === false || type === false\n ? false\n : appendJsonSchema(previous, type)\n )\n }\n }\n })\n const hasPatternProperties = Object.keys(patternProperties).length > 0\n if (hasPatternProperties) out[\"patternProperties\"] = patternProperties\n const additional = additionalPropertySchemas.map((type) => ({ type: \"object\", additionalProperties: type }))\n if (hasUnrepresentableIndexPattern && closed) {\n const propertyNames: Array<Fragment> = []\n if (representation.propertySignatures.length > 0) propertyNames.push({ enum: Object.keys(properties) })\n representation.indexSignatures.forEach((signature, index) => {\n propertyNames.push(recur(signature.parameter, [...path, \"indexSignatures\", index, \"parameter\"]))\n })\n out[\"propertyNames\"] = propertyNames.length === 1 ? propertyNames[0] : { anyOf: propertyNames }\n out[\"additionalProperties\"] = indexValueSchemas.length === 1\n ? indexValueSchemas[0]\n : { anyOf: indexValueSchemas }\n if (additional.length > 0) out[\"allOf\"] = additional\n } else if (additional.length === 0) {\n out[\"additionalProperties\"] = hasUnrepresentableIndexPattern || !closed\n } else if (\n additionalPropertySchemas.length === 1 && representation.propertySignatures.length === 0 &&\n !hasPatternProperties\n ) {\n out[\"additionalProperties\"] = additionalPropertySchemas[0]\n } else {\n out[\"allOf\"] = additional\n }\n const additionalProperties = out[\"additionalProperties\"]\n if (isObject(additionalProperties) && Object.keys(additionalProperties).length === 0) {\n delete out[\"additionalProperties\"]\n }\n return out\n }\n case \"Union\": {\n const types = representation.types.map((type, index) => recur(type, [...path, \"types\", index]))\n if (types.length === 0) return { not: {} }\n const mode = representation.options?.mode ?? \"anyOf\"\n if (mode === \"anyOf\" && types.length > 1) {\n const compacted = compactEnums(types)\n if (compacted !== undefined) return compacted\n }\n return mode === \"anyOf\" ? { anyOf: types } : { oneOf: types }\n }\n default:\n return unsupported(representation, path)\n }\n }\n\n const parameterPatterns = (\n parameter: Representation,\n path: Path,\n seenReferences: ReadonlySet<string>\n ): ReadonlyArray<string> | undefined => {\n switch (parameter._tag) {\n case \"Reference\": {\n const target = Object.hasOwn(references, parameter.$ref) ? references[parameter.$ref] : undefined\n if (target === undefined) throw invalid(`Invalid reference ${parameter.$ref}`, [...path, \"$ref\"])\n compileDefinition(parameter.$ref, path)\n if (seenReferences.has(parameter.$ref)) return undefined\n return parameterPatterns(target, [\"references\", parameter.$ref], new Set(seenReferences).add(parameter.$ref))\n }\n case \"String\": {\n const check = parameter.checks[0]\n if (check === undefined) return []\n if (parameter.checks.length !== 1 || check._tag !== \"Filter\" || fragmentSource(check) === undefined) {\n return undefined\n }\n const schema = recur(parameter, path)\n const key = schema[\"pattern\"]\n return schema[\"type\"] === \"string\" && typeof key === \"string\" &&\n hasOnlyKeywords(schema, \"|type|pattern|title|description|default|examples|readOnly|writeOnly|\")\n ? [key]\n : undefined\n }\n case \"TemplateLiteral\":\n return parameter.checks.length === 0 ? [`^${parameter.parts.map(partPattern).join(\"\")}$`] : undefined\n case \"Union\": {\n if (parameter.types.length === 0 || parameter.checks.length > 0 || parameter.options?.mode === \"oneOf\") {\n return undefined\n }\n const patterns: Array<string> = []\n for (const [index, member] of parameter.types.entries()) {\n const memberPatterns = parameterPatterns(member, [...path, \"types\", index], seenReferences)\n if (memberPatterns === undefined) return undefined\n if (memberPatterns.length === 0) return []\n patterns.push(...memberPatterns)\n }\n return patterns\n }\n default:\n throw invalid(\"Invalid schema representation document\", path)\n }\n }\n\n const referenceKeys = Object.keys(references)\n for (const key of referenceKeys) compileDefinition(key, [\"references\", key])\n const schema = finalize(recur(document.representation, [\"representation\"]))\n const definitions: Record<string, Fragment> = {}\n for (const key of referenceKeys) {\n const compiled = definitionStates.get(key)\n if (isObject(compiled)) assignProperty(definitions, key, finalize(compiled))\n }\n return { dialect: \"draft-2020-12\", schema, definitions }\n}\n\n/**\n * The identity a schema contributes: a pure function of the schema and the\n * option, and of nothing the installed `effect` release prints. It takes the\n * place of `Schema.toJsonSchemaDocument(schema, options)` wherever the\n * document is hashed, compared or pinned.\n *\n * Throws what rc.115 threw for a schema with no JSON Schema form: more than\n * one rest element, a record key that is neither a string nor a template, a\n * `toJsonSchema` annotation that throws.\n *\n * @since 1.0.0\n * @private\n */\nexport const schemaIdentity = (schema: Schema.Top, options?: Options): Document =>\n fromRepresentation(Schema.toRepresentation(Schema.toCodecJson(schema)), options)\n\n/**\n * The six built-in checks `effect` renamed after `4.0.0-rc.115`, from the id\n * a later release writes to the id rc.115 wrote. Their payloads and\n * annotations did not change.\n *\n * @private\n */\nconst rc115CheckIds: ReadonlyMap<string, string> = new Map([\n [\"effect/schema/isStartingWith\", \"effect/schema/isStartsWith\"],\n [\"effect/schema/isEndingWith\", \"effect/schema/isEndsWith\"],\n [\"effect/schema/isIncluding\", \"effect/schema/isIncludes\"],\n [\"effect/schema/isBetweenLength\", \"effect/schema/isLengthBetween\"],\n [\"effect/schema/isBetweenSize\", \"effect/schema/isSizeBetween\"],\n [\"effect/schema/isBetweenProperties\", \"effect/schema/isPropertiesLengthBetween\"]\n])\n\n/**\n * A copy of an encoded representation with every renamed check id written\n * back as rc.115 wrote it. Only an element of a `checks` array is a check.\n * `annotations` and `payload` hold an author's data, which may have any\n * shape, so they are copied as they are. Key order is kept, so the bytes\n * match.\n *\n * @private\n */\nconst withRc115CheckIds = (value: Schema.Json, isCheck = false): Schema.Json => {\n if (Array.isArray(value)) return value.map((member) => withRc115CheckIds(member, isCheck))\n if (!isObject(value)) return value\n const out: Record<string, Schema.Json> = {}\n for (const [key, member] of Object.entries(value as Readonly<Record<string, Schema.Json>>)) {\n if (key === \"annotations\" || key === \"payload\") {\n assignProperty(out, key, member)\n continue\n }\n const renamed = isCheck && key === \"representation\" && isObject(member) && typeof member[\"id\"] === \"string\"\n ? rc115CheckIds.get(member[\"id\"])\n : undefined\n assignProperty(\n out,\n key,\n renamed === undefined\n ? withRc115CheckIds(member, key === \"checks\")\n : withRc115CheckIds({ ...(member as Readonly<Record<string, Schema.Json>>), id: renamed })\n )\n }\n return out\n}\n\n/**\n * The representation identity of a schema AST: what\n * `SchemaRepresentation.toJson(SchemaRepresentation.toRepresentation(ast))`\n * returned under `effect@4.0.0-rc.115`, key order included. A sealed action's\n * step key hashes it, so it must not move with the installed `effect`.\n *\n * The installed release encodes the representation; this writes back the six\n * check ids renamed after rc.115. One difference cannot be undone: from\n * `effect@4.0.4` on, `Schema.brand` is not part of the AST, so the `brands`\n * annotation rc.115 wrote is absent and a declaration with a brand re-keys\n * once.\n *\n * Throws what rc.115 threw for an AST with no representation, such as one\n * whose check carries no `representation` annotation.\n *\n * @since 1.0.0\n * @private\n */\nexport const representationIdentity = (ast: SchemaAST.AST): Schema.Json =>\n withRc115CheckIds(SchemaRepresentation.toJson(SchemaRepresentation.toRepresentation(ast)))\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkDA,aAAwB;AAExB,2BAAsC;AAgD/B,MAAM,4BAA4B,OAAO,YAAiC,EAAE,oCAAoC;AAAA,EACrH,SAAS,OAAO;AAClB,CAAC,EAAE;AAAC;AAGJ,MAAM,UAAU,CAAC,SAAiB,SAChC,IAAI,oBAAoB;AAAA,EACtB,SAAS,KAAK,WAAW,IACrB,UACA,GAAG,OAAO;AAAA,OAAU,KAAK,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,WAAW,KAAK,UAAU,GAAG,IAAI,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC;AAChH,CAAC;AAGH,MAAM,WAAW,CAAC,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAQrE,MAAM,iBAAiB,CAAC,QAAiC,KAAa,UAAyB;AAC7F,MAAI,QAAQ,aAAa;AACvB,WAAO,eAAe,QAAQ,KAAK,EAAE,OAAO,UAAU,MAAM,YAAY,MAAM,cAAc,KAAK,CAAC;AAAA,EACpG,OAAO;AACL,WAAO,GAAG,IAAI;AAAA,EAChB;AACF;AAQA,MAAM,SAAS,CAAC,OAAgB,OAA4B,oBAAI,IAAI,MAAe;AACjF,MAAI,OAAO,UAAU,YAAY,U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,8BAA8B,0BAA0B;AAAA,EACzD,CAAC,6BAA6B,0BAA0B;AAAA,EACxD,CAAC,iCAAiC,+BAA+B;AAAA,EACjE,CAAC,+BAA+B,6BAA6B;AAAA,EAC7D,CAAC,qCAAqC,yCAAyC;AACjF,CAAC;AAWD,MAAM,oBAAoB,CAAC,OAAoB,UAAU,UAAuB;AAC9E,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,CAAC,WAAW,kBAAkB,QAAQ,OAAO,CAAC;AACzF,MAAI,CAAC,SAAS,KAAK,EAAG,QAAO;AAC7B,QAAM,MAAmC,CAAC;AAC1C,aAAW,CAAC,KAAK,MAAM,KAAK,OAAO,QAAQ,KAA8C,GAAG;AAC1F,QAAI,QAAQ,iBAAiB,QAAQ,WAAW;AAC9C,qBAAe,KAAK,KAAK,MAAM;AAC/B;AAAA,IACF;AACA,UAAM,UAAU,WAAW,QAAQ,oBAAoB,SAAS,MAAM,KAAK,OAAO,OAAO,IAAI,MAAM,WAC/F,cAAc,IAAI,OAAO,IAAI,CAAC,IAC9B;AACJ;AAAA,MACE;AAAA,MACA;AAAA,MACA,YAAY,SACR,kBAAkB,QAAQ,QAAQ,QAAQ,IAC1C,kBAAkB,EAAE,GAAI,QAAkD,IAAI,QAAQ,CAAC;AAAA,IAC7F;AAAA,EACF;AACA,SAAO;AACT;AAoBO,MAAM,yBAAyB,CAAC,QACrC,kBAAkB,qBAAqB,OAAO,qBAAqB,iBAAiB,GAAG,CAAC,CAAC;",
|
|
6
|
+
"names": ["schema", "ordinary"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path indexing shared by effect matching and the graph's write-conflict pass.
|
|
3
|
+
*
|
|
4
|
+
* The pattern grammar is exhaustive: an entry ending in `*` matches by string
|
|
5
|
+
* prefix and every other entry matches itself alone. Every path is read a
|
|
6
|
+
* bounded number of times: once to look for a dot segment, once to detect a
|
|
7
|
+
* pattern, and once per comparison a binary search needs while the distinct
|
|
8
|
+
* paths are sorted and each pattern's prefix is located. After that a path is
|
|
9
|
+
* an integer rank and every match is an integer comparison, so matching two
|
|
10
|
+
* declarations costs their combined length plus the matches, whatever the
|
|
11
|
+
* paths' lengths or how many patterns nest. An envelope is prepared once for
|
|
12
|
+
* every step it encloses: its exact entries go into a set and its covering
|
|
13
|
+
* patterns collapse to disjoint sorted prefixes, so a step path costs one
|
|
14
|
+
* lookup and one binary search however wide the envelope is.
|
|
15
|
+
*
|
|
16
|
+
* Governing contract: `packages/smithers/flows/plan/docs/api.md`, published as
|
|
17
|
+
* https://smithers.sh/docs/reference/api/plan.
|
|
18
|
+
*
|
|
19
|
+
* @since 1.0.0-rc.0
|
|
20
|
+
*/
|
|
21
|
+
import type * as Effects from "../Effects.ts";
|
|
22
|
+
/**
|
|
23
|
+
* Whether `path` contains a whole `.` or `..` segment.
|
|
24
|
+
*
|
|
25
|
+
* A path with no `.` costs one native search. Otherwise the segments from the
|
|
26
|
+
* one holding the first `.` onward are scanned once, without allocating.
|
|
27
|
+
*
|
|
28
|
+
* @since 1.0.0-rc.0
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
export declare const hasDotSegment: (path: string) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether an entry is a pattern: only a trailing `*` makes one.
|
|
34
|
+
*
|
|
35
|
+
* @since 1.0.0-rc.0
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
export declare const isGlob: (entry: string) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The string prefix a pattern matches by: everything for `*` and `**`,
|
|
41
|
+
* `prefix/` for `prefix/**`, and `prefix` for `prefix*`.
|
|
42
|
+
*
|
|
43
|
+
* @since 1.0.0-rc.0
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
export declare const globPrefix: (glob: string) => string;
|
|
47
|
+
/**
|
|
48
|
+
* The distinct paths of one or more declarations in code-unit order, with
|
|
49
|
+
* what matching needs to know about each: its rank, whether it carries a dot
|
|
50
|
+
* segment, whether it is a pattern that can cover anything, and for such a
|
|
51
|
+
* pattern the rank interval its prefix covers.
|
|
52
|
+
*
|
|
53
|
+
* @since 1.0.0-rc.0
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
export interface PathIndex {
|
|
57
|
+
readonly paths: ReadonlyArray<string>;
|
|
58
|
+
readonly rank: ReadonlyMap<string, number>;
|
|
59
|
+
readonly dotted: Uint8Array;
|
|
60
|
+
readonly glob: Uint8Array;
|
|
61
|
+
readonly low: Int32Array;
|
|
62
|
+
readonly high: Int32Array;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Indexes the union of the given path lists.
|
|
66
|
+
*
|
|
67
|
+
* @since 1.0.0-rc.0
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
export declare const indexPaths: (lists: Iterable<ReadonlyArray<string>>) => PathIndex;
|
|
71
|
+
/**
|
|
72
|
+
* One declaration's paths as ranks of a {@link PathIndex}: every path in
|
|
73
|
+
* ascending rank order, and the patterns whose prefix intervals are not
|
|
74
|
+
* contained in another of the declaration's patterns. Those intervals are
|
|
75
|
+
* disjoint and ascending, so enumerating them visits each covered rank once.
|
|
76
|
+
*
|
|
77
|
+
* @since 1.0.0-rc.0
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
export interface Ranked {
|
|
81
|
+
readonly ranks: Int32Array;
|
|
82
|
+
readonly globs: Int32Array;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Ranks a declaration's paths against an index that contains them.
|
|
86
|
+
*
|
|
87
|
+
* @since 1.0.0-rc.0
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
export declare const rankPaths: (index: PathIndex, paths: ReadonlyArray<string>) => Ranked;
|
|
91
|
+
/**
|
|
92
|
+
* The ranks of the paths two write declarations share, ascending: a path of
|
|
93
|
+
* `b` that `a` names or covers, and a path of `a` that `b` covers unless it is
|
|
94
|
+
* the same pattern or itself covers that pattern. This is the pairwise
|
|
95
|
+
* definition, exact paths matched through the merge of two sorted rank lists
|
|
96
|
+
* and each covering pattern enumerating the ranks of the other declaration
|
|
97
|
+
* inside its interval. Each of the three passes yields an ascending list, so
|
|
98
|
+
* the result is their merge and no sort is needed.
|
|
99
|
+
*
|
|
100
|
+
* @since 1.0.0-rc.0
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
export declare const overlapRanks: (index: PathIndex, a: Ranked, b: Ranked) => Array<number>;
|
|
104
|
+
/**
|
|
105
|
+
* One envelope list prepared for repeated coverage checks: its distinct
|
|
106
|
+
* entries, matched exactly through a set, and the prefixes of its covering
|
|
107
|
+
* patterns with every pattern nested under another collapsed into the
|
|
108
|
+
* outermost. The kept prefixes are disjoint and sorted, so the only prefix
|
|
109
|
+
* that can cover a path is the greatest one not greater than the path, and
|
|
110
|
+
* one binary search finds it.
|
|
111
|
+
*
|
|
112
|
+
* @since 1.0.0-rc.0
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
export interface Prepared {
|
|
116
|
+
readonly exact: ReadonlySet<string>;
|
|
117
|
+
readonly prefixes: ReadonlyArray<string>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Prepares one envelope list. Each entry is read a bounded number of times:
|
|
121
|
+
* once into the set, once to detect a pattern, and for a pattern once to take
|
|
122
|
+
* its prefix and once to test that prefix for a dot segment, plus the
|
|
123
|
+
* comparisons that sort the prefixes and one prefix comparison that collapses
|
|
124
|
+
* a nested one.
|
|
125
|
+
*
|
|
126
|
+
* @since 1.0.0-rc.0
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
export declare const prepare: (paths: ReadonlyArray<string>) => Prepared;
|
|
130
|
+
/**
|
|
131
|
+
* Whether a prepared list names or covers `path`. A path carrying a dot
|
|
132
|
+
* segment is never covered, so the path is scanned once for one and, when
|
|
133
|
+
* clean, looked up once and compared against at most one prefix.
|
|
134
|
+
*
|
|
135
|
+
* @since 1.0.0-rc.0
|
|
136
|
+
* @private
|
|
137
|
+
*/
|
|
138
|
+
export declare const covered: (prepared: Prepared, path: string) => boolean;
|
|
139
|
+
/**
|
|
140
|
+
* The fields of a declaration that narrowing reads. Structural, so this module
|
|
141
|
+
* needs nothing from the public module built on it.
|
|
142
|
+
*
|
|
143
|
+
* @since 1.0.0-rc.0
|
|
144
|
+
* @private
|
|
145
|
+
*/
|
|
146
|
+
export interface DeclarationLike {
|
|
147
|
+
readonly reads: ReadonlyArray<string>;
|
|
148
|
+
readonly writes: ReadonlyArray<string>;
|
|
149
|
+
readonly mode: Effects.Mode;
|
|
150
|
+
readonly tier?: Effects.Tier | undefined;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* An envelope prepared once for every step it encloses.
|
|
154
|
+
*
|
|
155
|
+
* @since 1.0.0-rc.0
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
export interface PreparedEnvelope {
|
|
159
|
+
readonly reads: Prepared;
|
|
160
|
+
readonly writes: Prepared;
|
|
161
|
+
readonly mode: Effects.Mode;
|
|
162
|
+
readonly tier: Effects.Tier;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The outcome of narrowing a step against a prepared envelope, shaped as the
|
|
166
|
+
* public `NarrowResult`.
|
|
167
|
+
*
|
|
168
|
+
* @since 1.0.0-rc.0
|
|
169
|
+
* @private
|
|
170
|
+
*/
|
|
171
|
+
export type NarrowOutcome = Effects.NarrowResult;
|
|
172
|
+
/**
|
|
173
|
+
* Prepares both lists of an envelope.
|
|
174
|
+
*
|
|
175
|
+
* @since 1.0.0-rc.0
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
export declare const prepareEnvelope: (envelope: DeclarationLike) => PreparedEnvelope;
|
|
179
|
+
/**
|
|
180
|
+
* Verifies that a step stays within a prepared envelope: every read and write
|
|
181
|
+
* path must be covered by the matching list, the mode may only tighten, and
|
|
182
|
+
* the tier may only narrow. Each step path costs one coverage check.
|
|
183
|
+
*
|
|
184
|
+
* @since 1.0.0-rc.0
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
export declare const narrowPrepared: (envelope: PreparedEnvelope, step: DeclarationLike) => NarrowOutcome;
|
|
188
|
+
/**
|
|
189
|
+
* Maximum length, in UTF-16 code units, of one effect path a graph build
|
|
190
|
+
* admits before it refuses the plan as too large. 4096 is `PATH_MAX`
|
|
191
|
+
* on Linux, the longest path a supported host can open, so no path that names
|
|
192
|
+
* a file is refused. Every per-character cost of a build is bounded by it:
|
|
193
|
+
* the one dot-segment scan each path gets, the comparisons that sort the
|
|
194
|
+
* distinct paths, and the comparisons that locate each pattern's prefix. The
|
|
195
|
+
* length is read before any character is, so an over-long path costs one
|
|
196
|
+
* property read.
|
|
197
|
+
*
|
|
198
|
+
* @category limits
|
|
199
|
+
* @since 1.0.0-rc.0
|
|
200
|
+
*/
|
|
201
|
+
export declare const maximumPathLength = 4096;
|
|
202
|
+
/**
|
|
203
|
+
* Maximum number of patterns, entries ending in `*`, one read list or one
|
|
204
|
+
* write list of an effect declaration may carry before a graph build refuses
|
|
205
|
+
* the plan as too large. A pattern never costs a match more than a
|
|
206
|
+
* literal path does: its prefix is located once by binary search, patterns
|
|
207
|
+
* nested under another collapse into the outermost before the paths they
|
|
208
|
+
* cover are enumerated, and every match after that is an integer comparison.
|
|
209
|
+
* What a pattern costs beyond a literal is that search, two binary searches
|
|
210
|
+
* of at most 16 comparisons each over a plan at the builder's plan-wide path
|
|
211
|
+
* ceiling,
|
|
212
|
+
* every comparison reading up to {@link maximumPathLength} code units.
|
|
213
|
+
* 128 keeps that term, 4,096 comparisons per list, below the sort that admits
|
|
214
|
+
* a per-declaration list of literal paths, while still letting one
|
|
215
|
+
* declaration name a subtree per package of a large monorepo. The count is
|
|
216
|
+
* read from the last character of each path as it is admitted, so a pattern
|
|
217
|
+
* past the limit costs one character read.
|
|
218
|
+
*
|
|
219
|
+
* @category limits
|
|
220
|
+
* @since 1.0.0-rc.0
|
|
221
|
+
*/
|
|
222
|
+
export declare const maximumGlobs = 128;
|
|
223
|
+
/**
|
|
224
|
+
* Copies one declaration's paths, refusing before the copy grows past
|
|
225
|
+
* `limit`. A real array is refused by its length before a member is read; any
|
|
226
|
+
* other iterable is copied one path at a time and refused as soon as it
|
|
227
|
+
* exceeds the limit, so a caller-assembled declaration cannot dodge the bound
|
|
228
|
+
* by hiding its size from `length`. Each path is then refused by its length
|
|
229
|
+
* before any character is read, and by the count of patterns the list has
|
|
230
|
+
* carried so far, so an over-long path or a pattern past the limit costs one
|
|
231
|
+
* property read.
|
|
232
|
+
*
|
|
233
|
+
* @private
|
|
234
|
+
* @since 1.0.0-rc.0
|
|
235
|
+
*/
|
|
236
|
+
export declare const copyPaths: (paths: ReadonlyArray<string>, limit: number, refuse: () => Error) => Array<string>;
|
|
237
|
+
/**
|
|
238
|
+
* Snapshots a declaration into graph-owned data, copying at most `limit`
|
|
239
|
+
* paths in total across its reads and writes.
|
|
240
|
+
*
|
|
241
|
+
* @private
|
|
242
|
+
* @since 1.0.0-rc.0
|
|
243
|
+
*/
|
|
244
|
+
export declare const boundedEffects: (declaration: Effects.Declaration, limit: number, refuse: () => Error) => Effects.Declaration;
|
|
245
|
+
//# sourceMappingURL=effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../../src/internal/effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAA;AAM7C;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,OAc5C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,KAAG,OAAsD,CAAA;AAE7F;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,MACyD,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