@smthrs/plan 1.0.0-rc.5 → 1.0.0-rc.7
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 +2 -0
- package/README.md +18 -18
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/dist/cjs/KeyMaterial.d.ts +1 -1
- package/dist/cjs/KeyMaterial.js.map +1 -1
- package/dist/cjs/Node.d.ts +71 -0
- package/dist/cjs/Node.d.ts.map +1 -1
- package/dist/cjs/Node.js +7 -0
- package/dist/cjs/Node.js.map +2 -2
- package/dist/cjs/StepKey.d.ts +1 -1
- package/dist/cjs/StepKey.js.map +1 -1
- 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/node.d.ts +1 -1
- package/dist/cjs/internal/node.d.ts.map +1 -1
- package/dist/cjs/internal/node.js +2 -1
- package/dist/cjs/internal/node.js.map +2 -2
- package/dist/esm/KeyMaterial.d.ts +1 -1
- package/dist/esm/KeyMaterial.js +1 -1
- package/dist/esm/KeyMaterial.js.map +1 -1
- package/dist/esm/Node.d.ts +71 -0
- package/dist/esm/Node.d.ts.map +1 -1
- package/dist/esm/Node.js +46 -0
- package/dist/esm/Node.js.map +1 -1
- package/dist/esm/StepKey.d.ts +1 -1
- package/dist/esm/StepKey.js +1 -1
- package/dist/esm/StepKey.js.map +1 -1
- 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/node.d.ts +1 -1
- package/dist/esm/internal/node.d.ts.map +1 -1
- package/dist/esm/internal/node.js +3 -2
- package/dist/esm/internal/node.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/api.md +11 -1
- package/docs/concepts/authoring-ast.md +2 -1
- package/docs/guides/diff-two-plans.md +158 -13
- package/docs/installation.md +3 -3
- package/package.json +9 -8
- package/src/KeyMaterial.ts +1 -1
- package/src/Node.ts +79 -0
- package/src/StepKey.ts +1 -1
- package/src/internal/SchemaIdentity.ts +1096 -0
- package/src/internal/node.ts +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaIdentity.js","sourceRoot":"","sources":["../../../src/internal/SchemaIdentity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAA;AAuCnE;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAoB,SAAQ,MAAM,CAAC,WAAW,EAAuB,CAAC,kCAAkC,EAAE;IACrH,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC;CAAG;AAEL,eAAe;AACf,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,IAAU,EAAuB,EAAE,CACnE,IAAI,mBAAmB,CAAC;IACtB,OAAO,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC;QACxB,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,GAAG,OAAO,UAAU,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;CACjH,CAAC,CAAA;AAEJ,eAAe;AACf,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI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A;IAC1F,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAClC,MAAM,GAAG,GAAgC,EAAE,CAAA;IAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAA8C,CAAC,EAAE,CAAC;QAC3F,IAAI,GAAG,KAAK,aAAa,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YAC/C,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;YAChC,SAAQ;QACV,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,IAAI,GAAG,KAAK,gBAAgB,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,QAAQ;YACzG,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC,CAAC,SAAS,CAAA;QACb,cAAc,CACZ,GAAG,EACH,GAAG,EACH,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,iBAAiB,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,CAAC;YAC7C,CAAC,CAAC,iBAAiB,CAAC,EAAE,GAAI,MAAgD,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAC7F,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAkB,EAAe,EAAE,CACxE,iBAAiB,CAAC,oBAAoB,CAAC,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA","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"]}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* The functions an author does write — a mapper, a continuation, a branch
|
|
11
11
|
* predicate — live in `WeakMap`s keyed by the AST node they belong to, and the
|
|
12
12
|
* AST keeps only a {@link FunctionIdentity} digest of their source. The digest
|
|
13
|
-
* is what enters content identity (https://
|
|
13
|
+
* is what enters content identity (https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md); the
|
|
14
14
|
* `WeakMap` is what the run reaches for when it has the real value in hand, and
|
|
15
15
|
* it drops with the AST it is keyed by.
|
|
16
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/internal/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/internal/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAKtC;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAG,oBAA6B,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAA;AAElC;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,OAAQ,SAAQ,SAAS;IACxC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,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OG;AACH,eAAO,MAAM,MAAM,GACjB,SAAS,MAAM,EACf,OAAO,OAAO,EACd,WAAW,SAAS,EACpB,QAAQ,OAAO,EACf,MAAM,OAAO,EACb,WAAW,OAAO,KACjB,MAWF,CAAA;AAwCD;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,EAAE,cAAc,OAAO,EAAE,SAAS,OAAO,EAAE,SAAS,MAAM,CAAC,GAAG,KAAG,KAetG,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,aAAa,OAAO,EAAE,MAAM,MAAM,EAAE,MAAM,QAAQ,EAAE,SAAS,OAAO,KAAG,QAI/F,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,aAAa,OAAO,EAAE,QAAQ,MAAM,EAAE,SAAS,OAAO,KAAG,UAInF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,OAAO,GAAG,GAAG,KAAG,SAAS,GAAG,SAAgC,CAAA;AAE3F;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,KAAG,SAAS,GAAG,SAAgC,CAAA;AAEpF;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,KAAK,KAAK,KAAG,MAAM,CAAC,GAAG,GAAG,SAA6B,CAAA;AAE9E;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,UAAU,GAAG,QAAQ,KAAG,OAAgC,CAAA;AAEzF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,OAAO,EAAE,UAAU,MAAM,KAAG,OAmB7D,CAAA"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* The functions an author does write — a mapper, a continuation, a branch
|
|
11
11
|
* predicate — live in `WeakMap`s keyed by the AST node they belong to, and the
|
|
12
12
|
* AST keeps only a {@link FunctionIdentity} digest of their source. The digest
|
|
13
|
-
* is what enters content identity (https://
|
|
13
|
+
* is what enters content identity (https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md); the
|
|
14
14
|
* `WeakMap` is what the run reaches for when it has the real value in hand, and
|
|
15
15
|
* it drops with the AST it is keyed by.
|
|
16
16
|
*
|
|
@@ -30,6 +30,7 @@ import { identity } from "effect/Function";
|
|
|
30
30
|
import { pipeArguments } from "effect/Pipeable";
|
|
31
31
|
import * as Schema from "effect/Schema";
|
|
32
32
|
import { jsonMirror } from "./JsonMirror.js";
|
|
33
|
+
import { schemaIdentity } from "./SchemaIdentity.js";
|
|
33
34
|
/**
|
|
34
35
|
* The runtime type identifier every node carries.
|
|
35
36
|
*
|
|
@@ -460,7 +461,7 @@ export const catch_ = (subject, protectedAst, failure, filter) => {
|
|
|
460
461
|
...(filter === undefined
|
|
461
462
|
? {}
|
|
462
463
|
: {
|
|
463
|
-
filter:
|
|
464
|
+
filter: schemaIdentity(filter, { onExcessProperty: "error" }),
|
|
464
465
|
filterIdentity: filterIdentity(filter)
|
|
465
466
|
})
|
|
466
467
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/internal/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,oBAA6B,CAAA;AAyKnD;;;;;;;;;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I,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,QAAQ,KAAK,SAAS;YAAE,UAAU,CAAC,GAAG,CAAC,WAAqB,EAAE,QAAQ,CAAC,CAAA;IAC7E,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC/B,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,WAAoB,EAAE,MAAM,CAAC,CAAA;IACrE,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACzD,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,MAAM,KAAK,SAAS;YAAE,YAAY,CAAC,GAAG,CAAC,WAAoC,EAAE,MAAM,CAAC,CAAA;IAC1F,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA","sourcesContent":["/**\n * The node AST, and the side tables the functions hang off.\n *\n * Two invariants shape every declaration here. The AST is **closure-free**\n * and keeps payloads as inert JSON mirrors, so a valid plan can be shipped,\n * stored, diffed, and rendered without the process that built it; control flow is\n * **structure**, so a branch stores both arms as ASTs rather than a function\n * that would have to be run to find out what comes next.\n *\n * The functions an author does write — a mapper, a continuation, a branch\n * predicate — live in `WeakMap`s keyed by the AST node they belong to, and the\n * AST keeps only a {@link FunctionIdentity} digest of their source. The digest\n * is what enters content identity (https://smithers.sh/docs/concepts/content-addressing); the\n * `WeakMap` is what the run reaches for when it has the real value in hand, and\n * it drops with the AST it is keyed by.\n *\n * Adapted from `@smthrs/core` (`packages/smithers/flows/core`)\n * `internal/node.ts`. `Dynamic` does not come across — a model call is an\n * ordinary action here — and neither do annotations, which are `Context`\n * values and would break serializability. Scheduling priority is the one thing that does cross, as\n * the plain JSON field {@link Scheduled.priority} rather than as an\n * annotation, because the scheduler has to read it out of a stored plan.\n *\n * @since 0.1.0\n */\n\nimport { isRecord } from \"@smthrs/canonical/Record\"\nimport { digestSync } from \"@smthrs/crypto\"\nimport * as Identity from \"@smthrs/crypto/Identity\"\nimport { identity } from \"effect/Function\"\nimport { pipeArguments } from \"effect/Pipeable\"\nimport * as Schema from \"effect/Schema\"\nimport type { Node } from \"../Node.ts\"\nimport type * as Planned from \"../Planned.ts\"\nimport { jsonMirror } from \"./JsonMirror.ts\"\n\n/**\n * The runtime type identifier every node carries.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const TypeId = \"~@smthrs/plan/Node\" as const\n\n/**\n * The type-level form of {@link TypeId}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type TypeId = typeof TypeId\n\n/**\n * What every AST variant carries besides its own shape: an optional scheduling\n * priority.\n *\n * A priority is JSON, not a `Context` annotation, which is why it can live in\n * the AST at all: the whole point of dropping core's annotations was to keep a\n * plan shippable, storable, and diffable. It is a scheduling HINT — the plan\n * compiler copies it onto the node draft and the scheduler orders ready work by\n * it, while key material never reads it, so raising a priority reorders work\n * without re-keying a single step.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Scheduled {\n readonly priority?: number | undefined\n}\n\n/**\n * A constant, known before anything runs.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Succeed extends Scheduled {\n readonly _tag: \"Succeed\"\n readonly value: unknown\n}\n\n/**\n * A constant typed failure, known before anything runs.\n *\n * The error is an inert JSON mirror for the same reason {@link Succeed.value}\n * is: a stored plan has to carry what the node produces without the process\n * that built it.\n *\n * @since 1.0.0\n * @private\n * @slop\n */\nexport interface Fail extends Scheduled {\n readonly _tag: \"Fail\"\n readonly error: unknown\n}\n\n/**\n * Independent children, combined by name. Width is fixed here, at plan time:\n * there is no dynamic fan-out.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface All extends Scheduled {\n readonly _tag: \"All\"\n readonly nodes: Readonly<Record<string, NodeAst>>\n}\n\n/**\n * How a {@link Race} settles: `race` on the first member to settle, `any` on\n * the first member to succeed, and `quorum` once `count` members succeed.\n *\n * @since 1.0.0\n * @private\n */\nexport type RaceMode = \"race\" | \"any\" | \"quorum\"\n\n/**\n * Independent children that settle early: the join decides as soon as its\n * {@link RaceMode} can, and the members it did not wait for are interrupted.\n * `count` is the successes a quorum needs, and 1 for `race` and `any`.\n *\n * @since 1.0.0\n * @private\n */\nexport interface Race extends Scheduled {\n readonly _tag: \"Race\"\n readonly mode: RaceMode\n readonly count: number\n readonly nodes: Readonly<Record<string, NodeAst>>\n}\n\n/**\n * A deferred pure transformation of an upstream result. `map` transforms; it\n * never decides.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Map extends Scheduled {\n readonly _tag: \"Map\"\n readonly first: NodeAst\n readonly mapper: FunctionIdentity\n}\n\n/**\n * A continuation after an upstream node. `next` is present when the author\n * supplied a node directly instead of a builder, in which case the topology is\n * already known and nothing has to be evaluated to reveal it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface AndThen extends Scheduled {\n readonly _tag: \"AndThen\"\n readonly first: NodeAst\n readonly continuation: FunctionIdentity\n readonly next?: NodeAst | undefined\n}\n\n/**\n * A decision whose arms are static topology. The predicate runs at run time on\n * the real value; both arms are already ASTs, so the exit condition and the\n * handoff site are visible before anything runs.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Branch extends Scheduled {\n readonly _tag: \"Branch\"\n readonly subject: string\n readonly first: NodeAst\n readonly predicate: FunctionIdentity\n readonly then: NodeAst\n readonly else: NodeAst\n}\n\n/**\n * A protected graph and its statically planned typed-failure continuation.\n *\n * The symbolic error `subject` is minted per catch node rather than shared,\n * mirroring {@link Branch}. Failure arms are built before the graph assigns\n * ids, so a nested arm that captured an outer error would resolve it to the\n * inner catch's protected node under one shared token.\n *\n * An absent filter catches the entire typed error channel, while a present\n * schema catches only values it accepts. This mirrors Effect's typed-error\n * boundary and keeps defects outside normal recovery. The serializable AST carries the schema identity; the live schema\n * remains in a side table beside the AST.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Catch extends Scheduled {\n readonly _tag: \"Catch\"\n readonly subject: string\n readonly protected: NodeAst\n readonly failure: NodeAst\n readonly filter?: unknown | undefined\n readonly filterIdentity?: FunctionIdentity | undefined\n}\n\n/**\n * How a flow call joins the caller's plan: `inline` splices the callee's body\n * in, `boundary` makes it one child execution, and `handoff` names the next\n * trampoline round. Why the child call is a mode rather than a second AST tag\n * is in `docs/concepts/authoring-ast.md`.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const CallMode = Schema.Literals([\"inline\", \"boundary\", \"handoff\"])\n\n/**\n * How a flow call joins the caller's plan.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type CallMode = typeof CallMode.Type\n\n/**\n * A call to another flow. The AST keeps the callee's tag and the payload;\n * the declaration itself is in the side table, because a flow value carries\n * schemas and a body and is not JSON.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface FlowCall extends Scheduled {\n readonly _tag: \"FlowCall\"\n readonly flow: string\n readonly mode: CallMode\n readonly payload: unknown\n}\n\n/**\n * A call to an action: the atom that does work. Same split as\n * {@link FlowCall}, and no mode — an action is always one node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface ActionCall extends Scheduled {\n readonly _tag: \"ActionCall\"\n readonly action: string\n readonly payload: unknown\n}\n\n/**\n * The algorithms a {@link FunctionIdentity} may name. The tag is versioned so a\n * change to identity semantics re-keys everything derived from one, rather than\n * colliding with it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const IdentityAlgorithm = Schema.Literals([\n \"sha256-source-ephemeral/v4\",\n \"sha256-source-captures/v5\",\n \"static-node/v1\"\n])\n\n/**\n * The algorithms a {@link FunctionIdentity} may name.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type IdentityAlgorithm = typeof IdentityAlgorithm.Type\n\n/**\n * The serializable stand-in for a function. Captured functions digest their\n * exact source and declared inert captures. Unannotated functions additionally\n * carry process-local, per-object entropy so indistinguishable closure sources\n * fail closed instead of sharing a cache key. The tag it names is\n * {@link IdentityAlgorithm}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface FunctionIdentity {\n readonly _tag: \"FunctionIdentity\"\n readonly algorithm: IdentityAlgorithm\n readonly digest: string\n}\n\n/**\n * Brands an operation with every inert value it closes over, so its identity\n * covers what it computes with and not only its source.\n *\n * `@smthrs/crypto` owns the captures, nested metadata, and freezing contract.\n *\n * @since 0.1.0\n * @private\n */\nexport const capture = Identity.capture\n\n/**\n * The serializable form of a planned value embedded in an AST value or\n * payload. The strict proxy itself cannot enter the AST because serializing it\n * is deliberately a build error.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface PlannedReference {\n readonly _tag: \"PlannedReference\"\n readonly node: string\n readonly path: ReadonlyArray<string>\n}\n\n// A bundled runtime and a dynamically loaded flow may contain separate\n// compatible package copies. Share only live object metadata: JSON round trips\n// still lose executable bindings, and structural lookalikes remain inert.\nconst stateKey = Symbol.for(\"@smthrs/plan/Node/live/v1\")\ninterface LiveState {\n readonly references: WeakSet<object>\n readonly nodes: WeakSet<object>\n readonly operations: WeakMap<AndThen | Map, Operation>\n readonly predicates: WeakMap<Branch, Predicate>\n readonly filters: WeakMap<Catch, Schema.Top>\n readonly declarations: WeakMap<ActionCall | FlowCall, unknown>\n}\nconst globals = globalThis as typeof globalThis & { [stateKey]?: LiveState }\nconst liveState = globals[stateKey] ??= {\n references: new WeakSet(),\n nodes: new WeakSet(),\n operations: new WeakMap(),\n predicates: new WeakMap(),\n filters: new WeakMap(),\n declarations: new WeakMap()\n}\n\n/** The AST references minted by this module; structural lookalikes are data. */\nconst plannedReferences = liveState.references\n\nconst makePlannedReference = (reference: Planned.Reference): PlannedReference => {\n const value = Object.freeze({\n _tag: \"PlannedReference\" as const,\n node: reference.node,\n path: Object.freeze([...reference.path])\n })\n plannedReferences.add(value)\n return value\n}\n\n/**\n * Reads an AST-owned planned reference without trusting its public data shape.\n *\n * @since 1.0.0\n * @private\n */\nexport const plannedReference = (value: unknown): PlannedReference | undefined =>\n typeof value === \"object\" && value !== null && plannedReferences.has(value)\n ? value as PlannedReference\n : undefined\n\n/**\n * Every AST variant.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type NodeAst = Succeed | Fail | All | Race | Map | AndThen | Branch | Catch | FlowCall | ActionCall\n\ntype Operation = (value: unknown) => unknown\n\ntype Predicate = (value: unknown) => boolean\n\nconst operations = liveState.operations\nconst predicates = liveState.predicates\nconst filters = liveState.filters\nconst declarations = liveState.declarations\n\n/**\n * The JSON mirror of an AST payload. A planned value becomes an AST-owned\n * {@link PlannedReference}, so the AST stays inert JSON.\n *\n * @private\n */\nconst payloadMirror = (input: unknown): unknown =>\n jsonMirror(input, (_value, reference) => makePlannedReference(reference))\n\n/**\n * Digests a function's exact source as UTF-8 with SHA-256. Exact source matters:\n * whitespace inside a string literal is behavior, and normalizing it before\n * hashing can make different functions share an identity. Unless its inert\n * captures were declared with {@link capture}, the digest also includes\n * process-local, per-function entropy: JavaScript cannot inspect a closure, so\n * source-only identity would permit incorrect cache hits.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const functionIdentity: (operation: unknown) => FunctionIdentity = Identity.functionIdentity\n\n/**\n * The prototype every node shares, so `pipe` is one function rather than one\n * closure per node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const NodeProto = {\n [TypeId]: {\n _A: identity,\n _E: identity,\n _R: identity\n },\n pipe() {\n // eslint-disable-next-line prefer-rest-params -- `pipeArguments` takes the arguments object itself.\n return pipeArguments(this, arguments)\n }\n}\n\n/**\n * Every node {@link makeNode} built, so a node this module made is recognized\n * in constant time without walking its AST again.\n */\nconst liveNodes = liveState.nodes\n\n/** Recognizes the algorithms {@link IdentityAlgorithm} declares, and nothing else. */\nconst isIdentityAlgorithm = Schema.is(IdentityAlgorithm)\n\n/** Recognizes the modes {@link CallMode} declares, and nothing else. */\nconst isCallMode = Schema.is(CallMode)\n\n/** Recognizes the modes {@link RaceMode} names, and nothing else. @private */\nconst isRaceMode = (value: unknown): value is RaceMode => value === \"race\" || value === \"any\" || value === \"quorum\"\n\n/**\n * Whether `count` is a successes target a {@link Race} of `members` can reach:\n * a quorum needs between one and every member, and the other modes need one.\n *\n * @since 1.0.0\n * @private\n */\nexport const isRaceCount = (mode: RaceMode, count: unknown, members: number): boolean =>\n members > 0 && Number.isSafeInteger(count) &&\n (mode === \"quorum\" ? (count as number) >= 1 && (count as number) <= members : count === 1)\n\n/** @private */\nconst isFunctionIdentity = (value: unknown): value is FunctionIdentity =>\n isRecord(value) && value._tag === \"FunctionIdentity\" && isIdentityAlgorithm(value.algorithm) &&\n typeof value.digest === \"string\"\n\n/** One position of the {@link isNodeAst} walk: an AST to check, or one whose children are all checked. @private */\ntype AstVisit = { readonly enter: unknown } | { readonly exit: object }\n\n/**\n * Checks whether a value has the shape of a {@link NodeAst}: what a JSON round\n * trip of a genuine AST produces, and nothing looser. Every variant's own\n * fields are checked, and every child is walked. The walk is an explicit stack\n * rather than recursion, so an arbitrarily deep AST cannot overflow the native\n * stack, and it tracks the ancestors of the position it has reached, so a\n * cyclic object is refused rather than walked forever while a shared sub-AST\n * still passes.\n *\n * @since 1.0.0\n * @private\n */\nexport const isNodeAst = (value: unknown): value is NodeAst => {\n const ancestors = new Set<object>()\n const pending: Array<AstVisit> = [{ enter: value }]\n while (pending.length > 0) {\n const visit = pending.pop()!\n if (\"exit\" in visit) {\n ancestors.delete(visit.exit)\n continue\n }\n const ast = visit.enter\n if (!isRecord(ast) || ancestors.has(ast)) return false\n if (ast.priority !== undefined && !Number.isSafeInteger(ast.priority)) return false\n const children: Array<unknown> = []\n switch (ast._tag) {\n case \"Succeed\":\n case \"Fail\":\n break\n case \"All\": {\n if (!isRecord(ast.nodes) || Array.isArray(ast.nodes)) return false\n for (const child of Object.values(ast.nodes)) children.push(child)\n break\n }\n case \"Race\": {\n if (!isRecord(ast.nodes) || Array.isArray(ast.nodes)) return false\n const members = Object.values(ast.nodes)\n if (!isRaceMode(ast.mode) || !isRaceCount(ast.mode, ast.count, members.length)) return false\n for (const child of members) children.push(child)\n break\n }\n case \"Map\": {\n if (!isFunctionIdentity(ast.mapper)) return false\n children.push(ast.first)\n break\n }\n case \"AndThen\": {\n if (!isFunctionIdentity(ast.continuation)) return false\n children.push(ast.first)\n if (ast.next !== undefined) children.push(ast.next)\n break\n }\n case \"Branch\": {\n if (typeof ast.subject !== \"string\" || !isFunctionIdentity(ast.predicate)) return false\n children.push(ast.first, ast.then, ast.else)\n break\n }\n case \"Catch\": {\n if (typeof ast.subject !== \"string\") return false\n if (ast.filterIdentity !== undefined && !isFunctionIdentity(ast.filterIdentity)) return false\n children.push(ast.protected, ast.failure)\n break\n }\n case \"FlowCall\": {\n if (typeof ast.flow !== \"string\" || !isCallMode(ast.mode)) return false\n break\n }\n case \"ActionCall\": {\n if (typeof ast.action !== \"string\") return false\n break\n }\n default:\n return false\n }\n if (children.length > 0) {\n ancestors.add(ast)\n pending.push({ exit: ast })\n for (const child of children) pending.push({ enter: child })\n }\n }\n return true\n}\n\n/**\n * Checks whether a value is a node.\n *\n * A node this module built is recognized by registration. A node that crossed\n * a serialization boundary, an object whose prototype is {@link NodeProto} and\n * whose own `ast` data property passes {@link isNodeAst}, is recognized by that\n * shape: `@smthrs/flow` hands a rehydrated AST back as a node, and the side\n * tables are all a round trip loses. The {@link TypeId} marker is an exported\n * string any object can carry, so it counts for nothing on its own, and an\n * `ast` that is missing, malformed, cyclic, or an accessor is refused because\n * every combinator reads it as trusted topology. A proxy is judged by the\n * shape it forwards.\n *\n * @since 1.0.0\n * @private\n */\nexport const isNode = (value: unknown): value is Node<unknown, unknown, any> => {\n if (typeof value !== \"object\" || value === null) return false\n if (liveNodes.has(value)) return true\n if (Object.getPrototypeOf(value) !== NodeProto) return false\n const ast = Object.getOwnPropertyDescriptor(value, \"ast\")\n return ast !== undefined && \"value\" in ast && isNodeAst(ast.value)\n}\n\n/**\n * Wraps an AST as a node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const makeNode = <A = unknown, E = never, R = never>(ast: NodeAst): Node<A, E, R> => {\n const node: Node<A, E, R> = Object.assign(Object.create(NodeProto), { ast })\n liveNodes.add(node)\n return node\n}\n\n/**\n * Constructs a {@link Succeed}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const succeed = (input: unknown): Succeed => ({ _tag: \"Succeed\", value: payloadMirror(input) })\n\n/**\n * Constructs a {@link Fail}.\n *\n * @since 1.0.0\n * @private\n * @slop\n */\nexport const fail = (error: unknown): Fail => ({ _tag: \"Fail\", error: payloadMirror(error) })\n\n/**\n * Constructs an {@link All}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const all = (nodes: Readonly<Record<string, NodeAst>>): All => ({ _tag: \"All\", nodes })\n\n/**\n * Constructs a {@link Race}.\n *\n * @since 1.0.0\n * @private\n */\nexport const race = (mode: RaceMode, count: number, nodes: Readonly<Record<string, NodeAst>>): Race => ({\n _tag: \"Race\",\n mode,\n count,\n nodes\n})\n\n/**\n * Constructs a {@link Map}, filing the mapper under the AST it belongs to.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const map = (first: NodeAst, operation: Operation, source: unknown): Map => {\n const ast: Map = { _tag: \"Map\", first, mapper: functionIdentity(source) }\n operations.set(ast, operation)\n return ast\n}\n\n/**\n * Constructs an {@link AndThen} from a builder. The builder is evaluated once\n * against a planned value when the graph is built, never here.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const andThen = (first: NodeAst, operation: Operation, source: unknown): AndThen => {\n const ast: AndThen = { _tag: \"AndThen\", first, continuation: functionIdentity(source) }\n operations.set(ast, operation)\n return ast\n}\n\n/**\n * Constructs an {@link AndThen} from a node the author supplied directly. There\n * is no function to digest, so the continuation carries a fixed marker.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const andThenNode = (first: NodeAst, next: NodeAst): AndThen => ({\n _tag: \"AndThen\",\n first,\n continuation: { _tag: \"FunctionIdentity\", algorithm: \"static-node/v1\", digest: digestSync(\"static-node\") },\n next\n})\n\n/**\n * Constructs a {@link Branch}. Both arms arrive already evaluated, because a\n * branch that had to be run to reveal its topology would not be a plan.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const branch = (\n subject: string,\n first: NodeAst,\n predicate: Predicate,\n source: unknown,\n then: NodeAst,\n otherwise: NodeAst\n): Branch => {\n const ast: Branch = {\n _tag: \"Branch\",\n subject,\n first,\n predicate: functionIdentity(source),\n then,\n else: otherwise\n }\n predicates.set(ast, predicate)\n return ast\n}\n\n/**\n * JSON Schema does not describe arbitrary checks, declaration parsers, or\n * suspended schema factories. Include every function reachable from the\n * schema AST, preserving declared captures and treating opaque wrappers as\n * ephemeral. The iterative walk also covers nested checks and cyclic ASTs.\n *\n * @private\n */\nconst filterIdentity = (filter: Schema.Top): FunctionIdentity => {\n const identities: Array<readonly [string, FunctionIdentity]> = []\n const pending: Array<readonly [string, unknown]> = [[\"$\", filter.ast]]\n const seen = new WeakSet<object>()\n while (pending.length > 0) {\n const [path, current] = pending.pop()!\n if (typeof current === \"function\") {\n identities.push([path, functionIdentity(current)])\n } else if (typeof current === \"object\" && current !== null && !seen.has(current)) {\n seen.add(current)\n const descriptors = Object.getOwnPropertyDescriptors(current)\n for (const key of Object.keys(descriptors).sort()) {\n const descriptor = descriptors[key]!\n if (\"value\" in descriptor) pending.push([`${path}/${JSON.stringify(key)}`, descriptor.value])\n else {\n if (descriptor.get !== undefined) pending.push([`${path}/${JSON.stringify(key)}/get`, descriptor.get])\n if (descriptor.set !== undefined) pending.push([`${path}/${JSON.stringify(key)}/set`, descriptor.set])\n }\n }\n }\n }\n return {\n _tag: \"FunctionIdentity\",\n algorithm: identities.some(([, identity]) => identity.algorithm === \"sha256-source-ephemeral/v4\")\n ? \"sha256-source-ephemeral/v4\"\n : \"sha256-source-captures/v5\",\n digest: digestSync(JSON.stringify(identities))\n }\n}\n\n/**\n * Constructs a {@link Catch} whose failure topology is already evaluated.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const catch_ = (subject: string, protectedAst: NodeAst, failure: NodeAst, filter?: Schema.Top): Catch => {\n const ast: Catch = {\n _tag: \"Catch\",\n subject,\n protected: protectedAst,\n failure,\n ...(filter === undefined\n ? {}\n : {\n filter: Schema.toJsonSchemaDocument(filter, { onExcessProperty: \"error\" }),\n filterIdentity: filterIdentity(filter)\n })\n }\n if (filter !== undefined) filters.set(ast, filter)\n return ast\n}\n\n/**\n * Constructs a {@link FlowCall}, filing the flow declaration beside it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const flowCall = (declaration: unknown, flow: string, mode: CallMode, payload: unknown): FlowCall => {\n const ast: FlowCall = { _tag: \"FlowCall\", flow, mode, payload: payloadMirror(payload) }\n declarations.set(ast, declaration)\n return ast\n}\n\n/**\n * Constructs an {@link ActionCall}, filing the action declaration beside\n * it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const actionCall = (declaration: unknown, action: string, payload: unknown): ActionCall => {\n const ast: ActionCall = { _tag: \"ActionCall\", action, payload: payloadMirror(payload) }\n declarations.set(ast, declaration)\n return ast\n}\n\n/**\n * The deferred function of a map or a continuation.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const operation = (ast: AndThen | Map): Operation | undefined => operations.get(ast)\n\n/**\n * The run-time predicate of a branch.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const predicate = (ast: Branch): Predicate | undefined => predicates.get(ast)\n\n/**\n * The optional error schema filter of a catch node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const filter = (ast: Catch): Schema.Top | undefined => filters.get(ast)\n\n/**\n * The flow or action declaration a call node names.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const declaration = (ast: ActionCall | FlowCall): unknown => declarations.get(ast)\n\n/**\n * Copies an AST with a scheduling priority attached.\n *\n * The copy is shallow and the side tables are re-filed against it, because a\n * function, a predicate, a filter schema, and a declaration are keyed by the\n * exact AST object they belong to: a copy that left them behind would silently\n * lose the continuation the graph walk has to evaluate.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const withPriority = (ast: NodeAst, priority: number): NodeAst => {\n const prioritized = { ...ast, priority }\n if (ast._tag === \"AndThen\" || ast._tag === \"Map\") {\n const deferred = operations.get(ast)\n if (deferred !== undefined) operations.set(prioritized as AndThen | Map, deferred)\n }\n if (ast._tag === \"Branch\") {\n const decision = predicates.get(ast)\n if (decision !== undefined) predicates.set(prioritized as Branch, decision)\n }\n if (ast._tag === \"Catch\") {\n const schema = filters.get(ast)\n if (schema !== undefined) filters.set(prioritized as Catch, schema)\n }\n if (ast._tag === \"ActionCall\" || ast._tag === \"FlowCall\") {\n const target = declarations.get(ast)\n if (target !== undefined) declarations.set(prioritized as ActionCall | FlowCall, target)\n }\n return prioritized\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/internal/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MA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,CAAA;IACpF,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,QAAQ,KAAK,SAAS;YAAE,UAAU,CAAC,GAAG,CAAC,WAAqB,EAAE,QAAQ,CAAC,CAAA;IAC7E,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC/B,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,WAAoB,EAAE,MAAM,CAAC,CAAA;IACrE,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACzD,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACpC,IAAI,MAAM,KAAK,SAAS;YAAE,YAAY,CAAC,GAAG,CAAC,WAAoC,EAAE,MAAM,CAAC,CAAA;IAC1F,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA","sourcesContent":["/**\n * The node AST, and the side tables the functions hang off.\n *\n * Two invariants shape every declaration here. The AST is **closure-free**\n * and keeps payloads as inert JSON mirrors, so a valid plan can be shipped,\n * stored, diffed, and rendered without the process that built it; control flow is\n * **structure**, so a branch stores both arms as ASTs rather than a function\n * that would have to be run to find out what comes next.\n *\n * The functions an author does write — a mapper, a continuation, a branch\n * predicate — live in `WeakMap`s keyed by the AST node they belong to, and the\n * AST keeps only a {@link FunctionIdentity} digest of their source. The digest\n * is what enters content identity (https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md); the\n * `WeakMap` is what the run reaches for when it has the real value in hand, and\n * it drops with the AST it is keyed by.\n *\n * Adapted from `@smthrs/core` (`packages/smithers/flows/core`)\n * `internal/node.ts`. `Dynamic` does not come across — a model call is an\n * ordinary action here — and neither do annotations, which are `Context`\n * values and would break serializability. Scheduling priority is the one thing that does cross, as\n * the plain JSON field {@link Scheduled.priority} rather than as an\n * annotation, because the scheduler has to read it out of a stored plan.\n *\n * @since 0.1.0\n */\n\nimport { isRecord } from \"@smthrs/canonical/Record\"\nimport { digestSync } from \"@smthrs/crypto\"\nimport * as Identity from \"@smthrs/crypto/Identity\"\nimport { identity } from \"effect/Function\"\nimport { pipeArguments } from \"effect/Pipeable\"\nimport * as Schema from \"effect/Schema\"\nimport type { Node } from \"../Node.ts\"\nimport type * as Planned from \"../Planned.ts\"\nimport { jsonMirror } from \"./JsonMirror.ts\"\nimport { schemaIdentity } from \"./SchemaIdentity.ts\"\n\n/**\n * The runtime type identifier every node carries.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const TypeId = \"~@smthrs/plan/Node\" as const\n\n/**\n * The type-level form of {@link TypeId}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type TypeId = typeof TypeId\n\n/**\n * What every AST variant carries besides its own shape: an optional scheduling\n * priority.\n *\n * A priority is JSON, not a `Context` annotation, which is why it can live in\n * the AST at all: the whole point of dropping core's annotations was to keep a\n * plan shippable, storable, and diffable. It is a scheduling HINT — the plan\n * compiler copies it onto the node draft and the scheduler orders ready work by\n * it, while key material never reads it, so raising a priority reorders work\n * without re-keying a single step.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Scheduled {\n readonly priority?: number | undefined\n}\n\n/**\n * A constant, known before anything runs.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Succeed extends Scheduled {\n readonly _tag: \"Succeed\"\n readonly value: unknown\n}\n\n/**\n * A constant typed failure, known before anything runs.\n *\n * The error is an inert JSON mirror for the same reason {@link Succeed.value}\n * is: a stored plan has to carry what the node produces without the process\n * that built it.\n *\n * @since 1.0.0\n * @private\n * @slop\n */\nexport interface Fail extends Scheduled {\n readonly _tag: \"Fail\"\n readonly error: unknown\n}\n\n/**\n * Independent children, combined by name. Width is fixed here, at plan time:\n * there is no dynamic fan-out.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface All extends Scheduled {\n readonly _tag: \"All\"\n readonly nodes: Readonly<Record<string, NodeAst>>\n}\n\n/**\n * How a {@link Race} settles: `race` on the first member to settle, `any` on\n * the first member to succeed, and `quorum` once `count` members succeed.\n *\n * @since 1.0.0\n * @private\n */\nexport type RaceMode = \"race\" | \"any\" | \"quorum\"\n\n/**\n * Independent children that settle early: the join decides as soon as its\n * {@link RaceMode} can, and the members it did not wait for are interrupted.\n * `count` is the successes a quorum needs, and 1 for `race` and `any`.\n *\n * @since 1.0.0\n * @private\n */\nexport interface Race extends Scheduled {\n readonly _tag: \"Race\"\n readonly mode: RaceMode\n readonly count: number\n readonly nodes: Readonly<Record<string, NodeAst>>\n}\n\n/**\n * A deferred pure transformation of an upstream result. `map` transforms; it\n * never decides.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Map extends Scheduled {\n readonly _tag: \"Map\"\n readonly first: NodeAst\n readonly mapper: FunctionIdentity\n}\n\n/**\n * A continuation after an upstream node. `next` is present when the author\n * supplied a node directly instead of a builder, in which case the topology is\n * already known and nothing has to be evaluated to reveal it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface AndThen extends Scheduled {\n readonly _tag: \"AndThen\"\n readonly first: NodeAst\n readonly continuation: FunctionIdentity\n readonly next?: NodeAst | undefined\n}\n\n/**\n * A decision whose arms are static topology. The predicate runs at run time on\n * the real value; both arms are already ASTs, so the exit condition and the\n * handoff site are visible before anything runs.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Branch extends Scheduled {\n readonly _tag: \"Branch\"\n readonly subject: string\n readonly first: NodeAst\n readonly predicate: FunctionIdentity\n readonly then: NodeAst\n readonly else: NodeAst\n}\n\n/**\n * A protected graph and its statically planned typed-failure continuation.\n *\n * The symbolic error `subject` is minted per catch node rather than shared,\n * mirroring {@link Branch}. Failure arms are built before the graph assigns\n * ids, so a nested arm that captured an outer error would resolve it to the\n * inner catch's protected node under one shared token.\n *\n * An absent filter catches the entire typed error channel, while a present\n * schema catches only values it accepts. This mirrors Effect's typed-error\n * boundary and keeps defects outside normal recovery. The serializable AST carries the schema identity; the live schema\n * remains in a side table beside the AST.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Catch extends Scheduled {\n readonly _tag: \"Catch\"\n readonly subject: string\n readonly protected: NodeAst\n readonly failure: NodeAst\n readonly filter?: unknown | undefined\n readonly filterIdentity?: FunctionIdentity | undefined\n}\n\n/**\n * How a flow call joins the caller's plan: `inline` splices the callee's body\n * in, `boundary` makes it one child execution, and `handoff` names the next\n * trampoline round. Why the child call is a mode rather than a second AST tag\n * is in `docs/concepts/authoring-ast.md`.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const CallMode = Schema.Literals([\"inline\", \"boundary\", \"handoff\"])\n\n/**\n * How a flow call joins the caller's plan.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type CallMode = typeof CallMode.Type\n\n/**\n * A call to another flow. The AST keeps the callee's tag and the payload;\n * the declaration itself is in the side table, because a flow value carries\n * schemas and a body and is not JSON.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface FlowCall extends Scheduled {\n readonly _tag: \"FlowCall\"\n readonly flow: string\n readonly mode: CallMode\n readonly payload: unknown\n}\n\n/**\n * A call to an action: the atom that does work. Same split as\n * {@link FlowCall}, and no mode — an action is always one node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface ActionCall extends Scheduled {\n readonly _tag: \"ActionCall\"\n readonly action: string\n readonly payload: unknown\n}\n\n/**\n * The algorithms a {@link FunctionIdentity} may name. The tag is versioned so a\n * change to identity semantics re-keys everything derived from one, rather than\n * colliding with it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const IdentityAlgorithm = Schema.Literals([\n \"sha256-source-ephemeral/v4\",\n \"sha256-source-captures/v5\",\n \"static-node/v1\"\n])\n\n/**\n * The algorithms a {@link FunctionIdentity} may name.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type IdentityAlgorithm = typeof IdentityAlgorithm.Type\n\n/**\n * The serializable stand-in for a function. Captured functions digest their\n * exact source and declared inert captures. Unannotated functions additionally\n * carry process-local, per-object entropy so indistinguishable closure sources\n * fail closed instead of sharing a cache key. The tag it names is\n * {@link IdentityAlgorithm}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface FunctionIdentity {\n readonly _tag: \"FunctionIdentity\"\n readonly algorithm: IdentityAlgorithm\n readonly digest: string\n}\n\n/**\n * Brands an operation with every inert value it closes over, so its identity\n * covers what it computes with and not only its source.\n *\n * `@smthrs/crypto` owns the captures, nested metadata, and freezing contract.\n *\n * @since 0.1.0\n * @private\n */\nexport const capture = Identity.capture\n\n/**\n * The serializable form of a planned value embedded in an AST value or\n * payload. The strict proxy itself cannot enter the AST because serializing it\n * is deliberately a build error.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface PlannedReference {\n readonly _tag: \"PlannedReference\"\n readonly node: string\n readonly path: ReadonlyArray<string>\n}\n\n// A bundled runtime and a dynamically loaded flow may contain separate\n// compatible package copies. Share only live object metadata: JSON round trips\n// still lose executable bindings, and structural lookalikes remain inert.\nconst stateKey = Symbol.for(\"@smthrs/plan/Node/live/v1\")\ninterface LiveState {\n readonly references: WeakSet<object>\n readonly nodes: WeakSet<object>\n readonly operations: WeakMap<AndThen | Map, Operation>\n readonly predicates: WeakMap<Branch, Predicate>\n readonly filters: WeakMap<Catch, Schema.Top>\n readonly declarations: WeakMap<ActionCall | FlowCall, unknown>\n}\nconst globals = globalThis as typeof globalThis & { [stateKey]?: LiveState }\nconst liveState = globals[stateKey] ??= {\n references: new WeakSet(),\n nodes: new WeakSet(),\n operations: new WeakMap(),\n predicates: new WeakMap(),\n filters: new WeakMap(),\n declarations: new WeakMap()\n}\n\n/** The AST references minted by this module; structural lookalikes are data. */\nconst plannedReferences = liveState.references\n\nconst makePlannedReference = (reference: Planned.Reference): PlannedReference => {\n const value = Object.freeze({\n _tag: \"PlannedReference\" as const,\n node: reference.node,\n path: Object.freeze([...reference.path])\n })\n plannedReferences.add(value)\n return value\n}\n\n/**\n * Reads an AST-owned planned reference without trusting its public data shape.\n *\n * @since 1.0.0\n * @private\n */\nexport const plannedReference = (value: unknown): PlannedReference | undefined =>\n typeof value === \"object\" && value !== null && plannedReferences.has(value)\n ? value as PlannedReference\n : undefined\n\n/**\n * Every AST variant.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type NodeAst = Succeed | Fail | All | Race | Map | AndThen | Branch | Catch | FlowCall | ActionCall\n\ntype Operation = (value: unknown) => unknown\n\ntype Predicate = (value: unknown) => boolean\n\nconst operations = liveState.operations\nconst predicates = liveState.predicates\nconst filters = liveState.filters\nconst declarations = liveState.declarations\n\n/**\n * The JSON mirror of an AST payload. A planned value becomes an AST-owned\n * {@link PlannedReference}, so the AST stays inert JSON.\n *\n * @private\n */\nconst payloadMirror = (input: unknown): unknown =>\n jsonMirror(input, (_value, reference) => makePlannedReference(reference))\n\n/**\n * Digests a function's exact source as UTF-8 with SHA-256. Exact source matters:\n * whitespace inside a string literal is behavior, and normalizing it before\n * hashing can make different functions share an identity. Unless its inert\n * captures were declared with {@link capture}, the digest also includes\n * process-local, per-function entropy: JavaScript cannot inspect a closure, so\n * source-only identity would permit incorrect cache hits.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const functionIdentity: (operation: unknown) => FunctionIdentity = Identity.functionIdentity\n\n/**\n * The prototype every node shares, so `pipe` is one function rather than one\n * closure per node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const NodeProto = {\n [TypeId]: {\n _A: identity,\n _E: identity,\n _R: identity\n },\n pipe() {\n // eslint-disable-next-line prefer-rest-params -- `pipeArguments` takes the arguments object itself.\n return pipeArguments(this, arguments)\n }\n}\n\n/**\n * Every node {@link makeNode} built, so a node this module made is recognized\n * in constant time without walking its AST again.\n */\nconst liveNodes = liveState.nodes\n\n/** Recognizes the algorithms {@link IdentityAlgorithm} declares, and nothing else. */\nconst isIdentityAlgorithm = Schema.is(IdentityAlgorithm)\n\n/** Recognizes the modes {@link CallMode} declares, and nothing else. */\nconst isCallMode = Schema.is(CallMode)\n\n/** Recognizes the modes {@link RaceMode} names, and nothing else. @private */\nconst isRaceMode = (value: unknown): value is RaceMode => value === \"race\" || value === \"any\" || value === \"quorum\"\n\n/**\n * Whether `count` is a successes target a {@link Race} of `members` can reach:\n * a quorum needs between one and every member, and the other modes need one.\n *\n * @since 1.0.0\n * @private\n */\nexport const isRaceCount = (mode: RaceMode, count: unknown, members: number): boolean =>\n members > 0 && Number.isSafeInteger(count) &&\n (mode === \"quorum\" ? (count as number) >= 1 && (count as number) <= members : count === 1)\n\n/** @private */\nconst isFunctionIdentity = (value: unknown): value is FunctionIdentity =>\n isRecord(value) && value._tag === \"FunctionIdentity\" && isIdentityAlgorithm(value.algorithm) &&\n typeof value.digest === \"string\"\n\n/** One position of the {@link isNodeAst} walk: an AST to check, or one whose children are all checked. @private */\ntype AstVisit = { readonly enter: unknown } | { readonly exit: object }\n\n/**\n * Checks whether a value has the shape of a {@link NodeAst}: what a JSON round\n * trip of a genuine AST produces, and nothing looser. Every variant's own\n * fields are checked, and every child is walked. The walk is an explicit stack\n * rather than recursion, so an arbitrarily deep AST cannot overflow the native\n * stack, and it tracks the ancestors of the position it has reached, so a\n * cyclic object is refused rather than walked forever while a shared sub-AST\n * still passes.\n *\n * @since 1.0.0\n * @private\n */\nexport const isNodeAst = (value: unknown): value is NodeAst => {\n const ancestors = new Set<object>()\n const pending: Array<AstVisit> = [{ enter: value }]\n while (pending.length > 0) {\n const visit = pending.pop()!\n if (\"exit\" in visit) {\n ancestors.delete(visit.exit)\n continue\n }\n const ast = visit.enter\n if (!isRecord(ast) || ancestors.has(ast)) return false\n if (ast.priority !== undefined && !Number.isSafeInteger(ast.priority)) return false\n const children: Array<unknown> = []\n switch (ast._tag) {\n case \"Succeed\":\n case \"Fail\":\n break\n case \"All\": {\n if (!isRecord(ast.nodes) || Array.isArray(ast.nodes)) return false\n for (const child of Object.values(ast.nodes)) children.push(child)\n break\n }\n case \"Race\": {\n if (!isRecord(ast.nodes) || Array.isArray(ast.nodes)) return false\n const members = Object.values(ast.nodes)\n if (!isRaceMode(ast.mode) || !isRaceCount(ast.mode, ast.count, members.length)) return false\n for (const child of members) children.push(child)\n break\n }\n case \"Map\": {\n if (!isFunctionIdentity(ast.mapper)) return false\n children.push(ast.first)\n break\n }\n case \"AndThen\": {\n if (!isFunctionIdentity(ast.continuation)) return false\n children.push(ast.first)\n if (ast.next !== undefined) children.push(ast.next)\n break\n }\n case \"Branch\": {\n if (typeof ast.subject !== \"string\" || !isFunctionIdentity(ast.predicate)) return false\n children.push(ast.first, ast.then, ast.else)\n break\n }\n case \"Catch\": {\n if (typeof ast.subject !== \"string\") return false\n if (ast.filterIdentity !== undefined && !isFunctionIdentity(ast.filterIdentity)) return false\n children.push(ast.protected, ast.failure)\n break\n }\n case \"FlowCall\": {\n if (typeof ast.flow !== \"string\" || !isCallMode(ast.mode)) return false\n break\n }\n case \"ActionCall\": {\n if (typeof ast.action !== \"string\") return false\n break\n }\n default:\n return false\n }\n if (children.length > 0) {\n ancestors.add(ast)\n pending.push({ exit: ast })\n for (const child of children) pending.push({ enter: child })\n }\n }\n return true\n}\n\n/**\n * Checks whether a value is a node.\n *\n * A node this module built is recognized by registration. A node that crossed\n * a serialization boundary, an object whose prototype is {@link NodeProto} and\n * whose own `ast` data property passes {@link isNodeAst}, is recognized by that\n * shape: `@smthrs/flow` hands a rehydrated AST back as a node, and the side\n * tables are all a round trip loses. The {@link TypeId} marker is an exported\n * string any object can carry, so it counts for nothing on its own, and an\n * `ast` that is missing, malformed, cyclic, or an accessor is refused because\n * every combinator reads it as trusted topology. A proxy is judged by the\n * shape it forwards.\n *\n * @since 1.0.0\n * @private\n */\nexport const isNode = (value: unknown): value is Node<unknown, unknown, any> => {\n if (typeof value !== \"object\" || value === null) return false\n if (liveNodes.has(value)) return true\n if (Object.getPrototypeOf(value) !== NodeProto) return false\n const ast = Object.getOwnPropertyDescriptor(value, \"ast\")\n return ast !== undefined && \"value\" in ast && isNodeAst(ast.value)\n}\n\n/**\n * Wraps an AST as a node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const makeNode = <A = unknown, E = never, R = never>(ast: NodeAst): Node<A, E, R> => {\n const node: Node<A, E, R> = Object.assign(Object.create(NodeProto), { ast })\n liveNodes.add(node)\n return node\n}\n\n/**\n * Constructs a {@link Succeed}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const succeed = (input: unknown): Succeed => ({ _tag: \"Succeed\", value: payloadMirror(input) })\n\n/**\n * Constructs a {@link Fail}.\n *\n * @since 1.0.0\n * @private\n * @slop\n */\nexport const fail = (error: unknown): Fail => ({ _tag: \"Fail\", error: payloadMirror(error) })\n\n/**\n * Constructs an {@link All}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const all = (nodes: Readonly<Record<string, NodeAst>>): All => ({ _tag: \"All\", nodes })\n\n/**\n * Constructs a {@link Race}.\n *\n * @since 1.0.0\n * @private\n */\nexport const race = (mode: RaceMode, count: number, nodes: Readonly<Record<string, NodeAst>>): Race => ({\n _tag: \"Race\",\n mode,\n count,\n nodes\n})\n\n/**\n * Constructs a {@link Map}, filing the mapper under the AST it belongs to.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const map = (first: NodeAst, operation: Operation, source: unknown): Map => {\n const ast: Map = { _tag: \"Map\", first, mapper: functionIdentity(source) }\n operations.set(ast, operation)\n return ast\n}\n\n/**\n * Constructs an {@link AndThen} from a builder. The builder is evaluated once\n * against a planned value when the graph is built, never here.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const andThen = (first: NodeAst, operation: Operation, source: unknown): AndThen => {\n const ast: AndThen = { _tag: \"AndThen\", first, continuation: functionIdentity(source) }\n operations.set(ast, operation)\n return ast\n}\n\n/**\n * Constructs an {@link AndThen} from a node the author supplied directly. There\n * is no function to digest, so the continuation carries a fixed marker.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const andThenNode = (first: NodeAst, next: NodeAst): AndThen => ({\n _tag: \"AndThen\",\n first,\n continuation: { _tag: \"FunctionIdentity\", algorithm: \"static-node/v1\", digest: digestSync(\"static-node\") },\n next\n})\n\n/**\n * Constructs a {@link Branch}. Both arms arrive already evaluated, because a\n * branch that had to be run to reveal its topology would not be a plan.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const branch = (\n subject: string,\n first: NodeAst,\n predicate: Predicate,\n source: unknown,\n then: NodeAst,\n otherwise: NodeAst\n): Branch => {\n const ast: Branch = {\n _tag: \"Branch\",\n subject,\n first,\n predicate: functionIdentity(source),\n then,\n else: otherwise\n }\n predicates.set(ast, predicate)\n return ast\n}\n\n/**\n * JSON Schema does not describe arbitrary checks, declaration parsers, or\n * suspended schema factories. Include every function reachable from the\n * schema AST, preserving declared captures and treating opaque wrappers as\n * ephemeral. The iterative walk also covers nested checks and cyclic ASTs.\n *\n * @private\n */\nconst filterIdentity = (filter: Schema.Top): FunctionIdentity => {\n const identities: Array<readonly [string, FunctionIdentity]> = []\n const pending: Array<readonly [string, unknown]> = [[\"$\", filter.ast]]\n const seen = new WeakSet<object>()\n while (pending.length > 0) {\n const [path, current] = pending.pop()!\n if (typeof current === \"function\") {\n identities.push([path, functionIdentity(current)])\n } else if (typeof current === \"object\" && current !== null && !seen.has(current)) {\n seen.add(current)\n const descriptors = Object.getOwnPropertyDescriptors(current)\n for (const key of Object.keys(descriptors).sort()) {\n const descriptor = descriptors[key]!\n if (\"value\" in descriptor) pending.push([`${path}/${JSON.stringify(key)}`, descriptor.value])\n else {\n if (descriptor.get !== undefined) pending.push([`${path}/${JSON.stringify(key)}/get`, descriptor.get])\n if (descriptor.set !== undefined) pending.push([`${path}/${JSON.stringify(key)}/set`, descriptor.set])\n }\n }\n }\n }\n return {\n _tag: \"FunctionIdentity\",\n algorithm: identities.some(([, identity]) => identity.algorithm === \"sha256-source-ephemeral/v4\")\n ? \"sha256-source-ephemeral/v4\"\n : \"sha256-source-captures/v5\",\n digest: digestSync(JSON.stringify(identities))\n }\n}\n\n/**\n * Constructs a {@link Catch} whose failure topology is already evaluated.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const catch_ = (subject: string, protectedAst: NodeAst, failure: NodeAst, filter?: Schema.Top): Catch => {\n const ast: Catch = {\n _tag: \"Catch\",\n subject,\n protected: protectedAst,\n failure,\n ...(filter === undefined\n ? {}\n : {\n filter: schemaIdentity(filter, { onExcessProperty: \"error\" }),\n filterIdentity: filterIdentity(filter)\n })\n }\n if (filter !== undefined) filters.set(ast, filter)\n return ast\n}\n\n/**\n * Constructs a {@link FlowCall}, filing the flow declaration beside it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const flowCall = (declaration: unknown, flow: string, mode: CallMode, payload: unknown): FlowCall => {\n const ast: FlowCall = { _tag: \"FlowCall\", flow, mode, payload: payloadMirror(payload) }\n declarations.set(ast, declaration)\n return ast\n}\n\n/**\n * Constructs an {@link ActionCall}, filing the action declaration beside\n * it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const actionCall = (declaration: unknown, action: string, payload: unknown): ActionCall => {\n const ast: ActionCall = { _tag: \"ActionCall\", action, payload: payloadMirror(payload) }\n declarations.set(ast, declaration)\n return ast\n}\n\n/**\n * The deferred function of a map or a continuation.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const operation = (ast: AndThen | Map): Operation | undefined => operations.get(ast)\n\n/**\n * The run-time predicate of a branch.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const predicate = (ast: Branch): Predicate | undefined => predicates.get(ast)\n\n/**\n * The optional error schema filter of a catch node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const filter = (ast: Catch): Schema.Top | undefined => filters.get(ast)\n\n/**\n * The flow or action declaration a call node names.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const declaration = (ast: ActionCall | FlowCall): unknown => declarations.get(ast)\n\n/**\n * Copies an AST with a scheduling priority attached.\n *\n * The copy is shallow and the side tables are re-filed against it, because a\n * function, a predicate, a filter schema, and a declaration are keyed by the\n * exact AST object they belong to: a copy that left them behind would silently\n * lose the continuation the graph walk has to evaluate.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const withPriority = (ast: NodeAst, priority: number): NodeAst => {\n const prioritized = { ...ast, priority }\n if (ast._tag === \"AndThen\" || ast._tag === \"Map\") {\n const deferred = operations.get(ast)\n if (deferred !== undefined) operations.set(prioritized as AndThen | Map, deferred)\n }\n if (ast._tag === \"Branch\") {\n const decision = predicates.get(ast)\n if (decision !== undefined) predicates.set(prioritized as Branch, decision)\n }\n if (ast._tag === \"Catch\") {\n const schema = filters.get(ast)\n if (schema !== undefined) filters.set(prioritized as Catch, schema)\n }\n if (ast._tag === \"ActionCall\" || ast._tag === \"FlowCall\") {\n const target = declarations.get(ast)\n if (target !== undefined) declarations.set(prioritized as ActionCall | FlowCall, target)\n }\n return prioritized\n}\n"]}
|
package/docs/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Compiling asks Effect for its `Crypto` service, which a platform package
|
|
|
41
41
|
supplies:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
pnpm add @effect/platform-node
|
|
44
|
+
pnpm add @effect/platform-node @effect/platform-node-shared
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
[Installation](./installation.md) covers the import forms, the package
|
package/docs/api.md
CHANGED
|
@@ -930,7 +930,7 @@ The node reference a branch arm's symbolic subject carries, and the prefix each
|
|
|
930
930
|
|
|
931
931
|
### Engine members
|
|
932
932
|
|
|
933
|
-
`flowCall`, `actionCall`, `declaration`, `continuation`, `mapper`, `predicate`, `catchFilter`, and `
|
|
933
|
+
`flowCall`, `actionCall`, `declaration`, `continuation`, `mapper`, `predicate`, `catchFilter`, `functionIdentity`, `schemaIdentity`, and `representationIdentity` exist for [`@smthrs/flow`](/api/flow), which owns flow and action authoring. They are supported names, not authoring API.
|
|
934
934
|
|
|
935
935
|
```ts
|
|
936
936
|
const flowCall: <A = unknown, E = never, R = never>(
|
|
@@ -954,10 +954,20 @@ const mapper: (ast: Ast) => ((value: unknown) => unknown) | undefined
|
|
|
954
954
|
const predicate: (ast: Ast) => ((value: unknown) => boolean) | undefined
|
|
955
955
|
const catchFilter: (ast: Ast) => Schema.Top | undefined
|
|
956
956
|
const functionIdentity: (operation: unknown) => FunctionIdentity
|
|
957
|
+
const schemaIdentity: (schema: Schema.Top, options?: SchemaIdentityOptions) => SchemaIdentity
|
|
958
|
+
type SchemaIdentity = JsonSchema.Document<"draft-2020-12">
|
|
959
|
+
type SchemaIdentityOptions = { readonly onExcessProperty?: "ignore" | "error" | undefined }
|
|
960
|
+
const representationIdentity: (ast: SchemaAST.AST) => Schema.Json
|
|
957
961
|
```
|
|
958
962
|
|
|
959
963
|
`flowCall` and `actionCall` validate nothing: an unknown tag becomes a call node the graph keeps as a leaf. `declaration`, `continuation`, `mapper`, `predicate`, and `catchFilter` answer `undefined` for the wrong variant and for an AST rehydrated from JSON, whose side tables did not survive serialization. `functionIdentity` throws a `TypeError` when handed anything but a function.
|
|
960
964
|
|
|
965
|
+
`schemaIdentity` returns the document a schema contributes to a step key: what the callee of a call accepts and produces, and what a `catch` filters on. The document has the shape of `Schema.toJsonSchemaDocument(schema, options)`, and this package prints it. `onExcessProperty` has the meaning and the default it has there; a step key takes the identity under `"error"`, which closes every object over the keys it declares. The installed `effect` does not, because `effect` is a peer range and a later release prints a different document for the same schema: for a string, `effect@4.0.4` prints `minLength: 3` for `isMinLength(5)` where `effect@4.0.0-rc.115` printed `minLength: 5`, adds a `minimum` and a `maximum` to `Schema.Int`, and prints an `isPattern` pattern only when the expression has the `u` flag. A document that moved with the dependency would re-key every recorded step. `schemaIdentity` prints what `effect@4.0.0-rc.115` printed, under every release this package supports. Use it for identity only. A JSON Schema you show to a model or a person comes from `Schema.toJsonSchemaDocument`.
|
|
966
|
+
|
|
967
|
+
The identity has three limits. A built-in check such as `Schema.isMinLength` contributes the constraint its name and arguments state, so a `toJsonSchema` annotation passed to a built-in check is not read; one on a `Schema.makeFilter` check is. `Schema.brand` contributes nothing, because from `effect@4.0.4` on a brand is not part of the schema: a declaration that uses one schema with an `identifier`, or one recursive schema, both with and without a brand got two definitions under `effect@4.0.0-rc.115` and gets one now, so it re-keys once. And a codec's behavior contributes nothing, so an author who changes what a transformation does renames the declaration to re-key its calls. `schemaIdentity` throws `Node.SchemaIdentityError`, tagged `@smthrs/plan/SchemaIdentityError`, for a schema that has no JSON Schema form, such as a record keyed by a number.
|
|
968
|
+
|
|
969
|
+
`representationIdentity` returns what a sealed action's step key folds in for its success and error schemas: `SchemaRepresentation.toJson(SchemaRepresentation.toRepresentation(ast))` as `effect@4.0.0-rc.115` wrote it. A later release renamed six built-in checks, `isStartsWith`, `isEndsWith`, `isIncludes`, `isLengthBetween`, `isSizeBetween` and `isPropertiesLengthBetween`; the identity writes their rc.115 ids back. A brand cannot be written back, so a sealed action whose success or error schema carries `Schema.brand` re-keys once. `representationIdentity` throws for an AST that has no representation, such as one with a `Schema.makeFilter` check.
|
|
970
|
+
|
|
961
971
|
## Planned
|
|
962
972
|
|
|
963
973
|
[src/Planned.ts](https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/src/Planned.ts)
|
|
@@ -196,7 +196,8 @@ the flow tag, payload, and declaration side table in every one of them.
|
|
|
196
196
|
## The engine members
|
|
197
197
|
|
|
198
198
|
`Node.flowCall`, `actionCall`, `declaration`, `continuation`, `mapper`,
|
|
199
|
-
`predicate`, `catchFilter`,
|
|
199
|
+
`predicate`, `catchFilter`, `functionIdentity`, `schemaIdentity`, and
|
|
200
|
+
`representationIdentity` exist for
|
|
200
201
|
[`@smthrs/flow`](/api/flow), which owns flow and action authoring. They are
|
|
201
202
|
supported names, not authoring API: they validate nothing, and several of them
|
|
202
203
|
answer `undefined` for an AST that was rehydrated from JSON, because the side
|