document-model 6.2.3-dev.1 → 6.2.3-dev.100

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.
@@ -0,0 +1,53 @@
1
+ import { a as SCALAR_DEFINITION_VERSION, c as ScalarRepresentation, d as scalarDefinitionVersion, f as ScalarLiteralNode, i as DescribedScalarDefinition, l as ScalarValue, n as getCatalogScalar, o as ScalarCoercion, r as scalarCatalog, s as ScalarDefinition, t as documentModelScalars, u as isScalarDefinition } from "./catalog-B3nJD57s.js";
2
+ import { StoredScalarDefinition } from "@powerhousedao/shared/document-model";
3
+ import { z } from "zod";
4
+ //#region src/scalars/representation.d.ts
5
+ type JsonRepresentation = Exclude<ScalarRepresentation, "opaque">;
6
+ //#endregion
7
+ //#region src/scalars/define-scalar.d.ts
8
+ type Json = string | number | boolean | null | Json[] | {
9
+ [key: string]: Json;
10
+ };
11
+ type OutputIsAny = {
12
+ "defineScalar refuses this schema: its output is any": never;
13
+ };
14
+ type AcceptsMissingValue = {
15
+ "defineScalar refuses this schema: it accepts a missing value; nullability belongs in the SDL": never;
16
+ };
17
+ type OutputCanBeNull = {
18
+ "defineScalar refuses this schema: its output can be null; nullability belongs in the SDL": never;
19
+ };
20
+ type OutputIsNotJson = {
21
+ "defineScalar refuses this schema: its output must be JSON": never;
22
+ };
23
+ type OutputFailsSchema = {
24
+ "defineScalar refuses this schema: its output must pass the schema again": never;
25
+ };
26
+ type TakesMissingValue<S extends z.ZodType> = S["_zod"]["optin"] extends "defaulted" ? true : S["_zod"]["optout"] extends "optional" ? true : unknown extends z.input<S> ? false : undefined extends z.input<S> ? true : false;
27
+ type CanonicalSchema<S extends z.ZodType> = 0 extends 1 & z.output<S> ? OutputIsAny : TakesMissingValue<S> extends true ? AcceptsMissingValue : z.output<S> extends Json ? null extends z.output<S> ? OutputCanBeNull : z.output<S> extends z.input<S> ? S : OutputFailsSchema : OutputIsNotJson;
28
+ type ScalarInput<TName extends string, S extends z.ZodType> = {
29
+ name: TName;
30
+ schema: S & CanonicalSchema<S>;
31
+ description?: string;
32
+ example?: NoInfer<z.input<S>>;
33
+ /** Only for a schema whose JSON shape zod cannot state, such as `z.custom`. */
34
+ representation?: JsonRepresentation;
35
+ };
36
+ export declare function defineScalar<TName extends string, S extends z.ZodType>(input: ScalarInput<TName, S>): DescribedScalarDefinition<TName, z.output<S>>;
37
+ //#endregion
38
+ //#region src/scalars/stored-definition.d.ts
39
+ /** The metadata a stored definition records for a `defineScalar` binding. */
40
+ export declare function storedScalarDefinition(definition: ScalarDefinition): StoredScalarDefinition;
41
+ //#endregion
42
+ //#region src/scalars/model-scalars.d.ts
43
+ /**
44
+ * @experimental The `defineScalar` definitions a materialized model was
45
+ * compiled with, by name. A stored definition records only their metadata, so
46
+ * this is the only place their validators survive. Empty for a model that
47
+ * `materialize` did not make.
48
+ */
49
+ export declare function modelPackageScalars(model: unknown): ReadonlyMap<string, ScalarDefinition>;
50
+ //#endregion
51
+ export { type DescribedScalarDefinition, SCALAR_DEFINITION_VERSION, type ScalarCoercion, type ScalarDefinition, type ScalarLiteralNode, type ScalarRepresentation, type ScalarValue, documentModelScalars, getCatalogScalar, isScalarDefinition, scalarCatalog, scalarDefinitionVersion };
52
+ export {};
53
+ //# sourceMappingURL=scalars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalars.d.ts","names":[],"sources":["../src/scalars/representation.ts","../src/scalars/define-scalar.ts","../src/scalars/stored-definition.ts","../src/scalars/model-scalars.ts"],"mappings":";;;;KAKY,qBAAqB,QAAQ;;;KCIpC,0CAA0C;GAAY,cAAc;;KAEpE;EACH;;KAEG;EACH;;KAEG;EACH;;KAEG;EACH;;KAEG;EACH;;KAMG,kBAAkB,UAAU,EAAE,WACjC,gDAEI,gEAEkB,EAAE,MAAM,+BAEJ,EAAE,MAAM;KAI/B,gBAAgB,UAAU,EAAE,yBAAyB,EAAE,OAAO,KAC/D,cACA,kBAAkB,kBAChB,sBACA,EAAE,OAAO,WAAW,oBACL,EAAE,OAAO,KACpB,kBACA,EAAE,OAAO,WAAW,EAAE,MAAM,KAC1B,IACA,oBACJ;KAEH,YAAY,sBAAsB,UAAU,EAAE;EACjD,MAAM;EACN,QAAQ,IAAI,gBAAgB;EAC5B;EACA,UAAU,QAAQ,EAAE,MAAM;;EAE1B,iBAAiB;;wBAwDH,aAAa,sBAAsB,UAAU,EAAE,SAC7D,OAAO,YAAY,OAAO,KACzB,0BAA0B,OAAO,EAAE,OAAO;;;;wBCjH7B,uBACd,YAAY,mBACX;;;;;;;;;wBCaa,oBACd,iBACC,oBAAoB"}
@@ -0,0 +1,146 @@
1
+ import { a as getCatalogScalar, c as SCALAR_DEFINITION_VERSION, i as documentModelScalars, l as isScalarDefinition, o as scalarCatalog, r as storedScalarDefinition, s as defineCatalogScalar, t as modelPackageScalars, u as scalarDefinitionVersion } from "./model-scalars-BzEq3l83.js";
2
+ import { z } from "zod";
3
+ //#region src/scalars/representation.ts
4
+ const shapeOfJsonType = {
5
+ null: "null",
6
+ string: "string",
7
+ number: "number",
8
+ integer: "number",
9
+ boolean: "boolean",
10
+ object: "json-object",
11
+ array: "json"
12
+ };
13
+ function shapeOfValue(value) {
14
+ if (value === null) return "null";
15
+ if (Array.isArray(value)) return "json";
16
+ if (typeof value === "object") return "json-object";
17
+ return shapeOfJsonType[typeof value];
18
+ }
19
+ /**
20
+ * The shapes a value of `node` can have, or `undefined` when zod states none.
21
+ * A union allows each branch's shapes; an intersection only those every
22
+ * stated member allows. `root` holds the `$defs` a local `$ref` names.
23
+ */
24
+ function jsonShapes(node, root, visiting = /* @__PURE__ */ new Set()) {
25
+ if (typeof node !== "object" || node === null || visiting.has(node)) return;
26
+ const inner = /* @__PURE__ */ new Set([...visiting, node]);
27
+ const record = node;
28
+ const { type, anyOf, oneOf, allOf } = record;
29
+ const stated = [];
30
+ const statedValues = (shapes) => {
31
+ if (!shapes.includes(void 0)) stated.push(new Set(shapes));
32
+ };
33
+ const not = record.not;
34
+ if (typeof not === "object" && not !== null && Object.keys(not).length === 0) stated.push(/* @__PURE__ */ new Set());
35
+ if (typeof type === "string" || Array.isArray(type)) statedValues([type].flat().map((name) => shapeOfJsonType[String(name)]));
36
+ if (Array.isArray(record.enum)) statedValues(record.enum.map(shapeOfValue));
37
+ if ("const" in record) statedValues([shapeOfValue(record.const)]);
38
+ const ref = record.$ref;
39
+ if (typeof ref === "string" && ref.startsWith("#/$defs/")) {
40
+ const defs = root.$defs;
41
+ const name = ref.slice(8).replaceAll("~1", "/").replaceAll("~0", "~");
42
+ const shapes = jsonShapes(defs?.[name], root, inner);
43
+ if (shapes) stated.push(shapes);
44
+ }
45
+ const branches = anyOf ?? oneOf;
46
+ if (Array.isArray(branches)) {
47
+ const shapes = branches.map((branch) => jsonShapes(branch, root, inner));
48
+ if (!shapes.includes(void 0)) stated.push(new Set(shapes.flatMap((set) => [...set ?? []])));
49
+ }
50
+ if (Array.isArray(allOf)) for (const member of allOf) {
51
+ const shapes = jsonShapes(member, root, inner);
52
+ if (shapes) stated.push(shapes);
53
+ }
54
+ if (stated.length === 0) return void 0;
55
+ const [first, ...rest] = stated;
56
+ return new Set([...first].filter((shape) => rest.every((set) => set.has(shape))));
57
+ }
58
+ /**
59
+ * The representation zod states for every output value of `schema`, or
60
+ * `undefined` when it cannot state one. One shape is that representation;
61
+ * several are `json`.
62
+ */
63
+ function statedRepresentation(schema) {
64
+ const jsonSchema = outputJsonSchema(schema);
65
+ const stated = jsonShapes(jsonSchema, jsonSchema);
66
+ if (stated === void 0) return void 0;
67
+ const shapes = [...stated].filter((shape) => shape !== "null");
68
+ if (shapes.length === 0) return void 0;
69
+ const [only, ...rest] = shapes;
70
+ return rest.length === 0 ? only : "json";
71
+ }
72
+ function outputJsonSchema(schema) {
73
+ try {
74
+ return z.toJSONSchema(schema, {
75
+ io: "output",
76
+ unrepresentable: "any"
77
+ });
78
+ } catch {
79
+ return {};
80
+ }
81
+ }
82
+ //#endregion
83
+ //#region src/scalars/define-scalar.ts
84
+ const inputKeys = /* @__PURE__ */ new Set([
85
+ "name",
86
+ "schema",
87
+ "description",
88
+ "example",
89
+ "representation"
90
+ ]);
91
+ const jsonRepresentations = /* @__PURE__ */ new Set([
92
+ "string",
93
+ "number",
94
+ "boolean",
95
+ "json-object",
96
+ "json"
97
+ ]);
98
+ const graphqlBuiltIns = /* @__PURE__ */ new Set([
99
+ "Int",
100
+ "Float",
101
+ "String",
102
+ "Boolean",
103
+ "ID"
104
+ ]);
105
+ const catalogNames = new Set(scalarCatalog.map((definition) => definition.name));
106
+ const graphqlName = /^[_A-Za-z][_0-9A-Za-z]*$/;
107
+ const refusals = [
108
+ (input) => {
109
+ const unknownKeys = Object.keys(input).filter((key) => !inputKeys.has(key));
110
+ return unknownKeys.length > 0 ? `unknown input key ${unknownKeys.join(", ")}; defineScalar accepts only name, schema, description, example and representation` : void 0;
111
+ },
112
+ ({ name }) => typeof name !== "string" || !graphqlName.test(name) || name.startsWith("__") ? "the name is not a valid GraphQL name" : void 0,
113
+ ({ name }) => graphqlBuiltIns.has(name) ? "the name is a GraphQL built-in scalar" : void 0,
114
+ ({ name }) => catalogNames.has(name) ? "the name is a catalog scalar" : void 0,
115
+ ({ schema }) => schema._zod.optin === "defaulted" || schema._zod.optout === "optional" ? "the schema accepts a missing value; nullability belongs in the SDL" : void 0
116
+ ];
117
+ function defineScalar(input) {
118
+ for (const refusal of refusals) {
119
+ const reason = refusal(input);
120
+ if (reason !== void 0) throw new Error(`Cannot define scalar "${String(input.name)}": ${reason}.`);
121
+ }
122
+ const { example, representation, ...definition } = input;
123
+ const schema = input.schema;
124
+ const parsedExample = example === void 0 ? void 0 : schema.safeParse(example);
125
+ if (parsedExample?.success === false) throw new Error(`Cannot define scalar "${input.name}": the example fails the schema: ${z.prettifyError(parsedExample.error)}`);
126
+ return defineCatalogScalar({
127
+ ...definition,
128
+ schema,
129
+ ...parsedExample && { example: parsedExample.data },
130
+ typescriptType: null,
131
+ zodSource: null,
132
+ representation: scalarRepresentation(input.name, schema, representation)
133
+ });
134
+ }
135
+ function scalarRepresentation(name, schema, declared) {
136
+ const derived = statedRepresentation(schema);
137
+ if (declared === void 0) return derived ?? "json";
138
+ if (!jsonRepresentations.has(declared)) throw new Error(`Cannot define scalar "${name}": representation must be one of ${[...jsonRepresentations].join(", ")}.`);
139
+ const representation = declared;
140
+ if (derived !== void 0 && derived !== representation) throw new Error(`Cannot define scalar "${name}": the schema's values are ${derived}, so representation cannot be ${representation}.`);
141
+ return representation;
142
+ }
143
+ //#endregion
144
+ export { SCALAR_DEFINITION_VERSION, defineScalar, documentModelScalars, getCatalogScalar, isScalarDefinition, modelPackageScalars, scalarCatalog, scalarDefinitionVersion, storedScalarDefinition };
145
+
146
+ //# sourceMappingURL=scalars.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalars.js","names":[],"sources":["../src/scalars/representation.ts","../src/scalars/define-scalar.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { ScalarRepresentation } from \"./types.js\";\n\n// defineScalar refuses a schema whose output is not JSON, so a package\n// scalar's values are never opaque.\nexport type JsonRepresentation = Exclude<ScalarRepresentation, \"opaque\">;\n\n// \"null\" is tracked through intersections and dropped before deciding: the\n// SDL owns nullability, so a null value never decides a representation.\ntype JsonShape = JsonRepresentation | \"null\";\n\nconst shapeOfJsonType: Readonly<Record<string, JsonShape | undefined>> = {\n null: \"null\",\n string: \"string\",\n number: \"number\",\n integer: \"number\",\n boolean: \"boolean\",\n object: \"json-object\",\n array: \"json\",\n};\n\nfunction shapeOfValue(value: unknown): JsonShape | undefined {\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"json\";\n if (typeof value === \"object\") return \"json-object\";\n return shapeOfJsonType[typeof value];\n}\n\n/**\n * The shapes a value of `node` can have, or `undefined` when zod states none.\n * A union allows each branch's shapes; an intersection only those every\n * stated member allows. `root` holds the `$defs` a local `$ref` names.\n */\nfunction jsonShapes(\n node: unknown,\n root: Readonly<Record<string, unknown>>,\n visiting: ReadonlySet<unknown> = new Set(),\n): ReadonlySet<JsonShape> | undefined {\n if (typeof node !== \"object\" || node === null || visiting.has(node)) {\n return undefined;\n }\n const inner = new Set([...visiting, node]);\n const record = node as Record<string, unknown>;\n const { type, anyOf, oneOf, allOf } = record;\n const stated: ReadonlySet<JsonShape>[] = [];\n const statedValues = (shapes: (JsonShape | undefined)[]) => {\n if (!shapes.includes(undefined)) {\n stated.push(new Set(shapes as JsonShape[]));\n }\n };\n // zod writes z.never() as { not: {} }, which no value matches.\n const not = record.not;\n if (\n typeof not === \"object\" &&\n not !== null &&\n Object.keys(not).length === 0\n ) {\n stated.push(new Set());\n }\n if (typeof type === \"string\" || Array.isArray(type)) {\n statedValues([type].flat().map((name) => shapeOfJsonType[String(name)]));\n }\n if (Array.isArray(record.enum)) statedValues(record.enum.map(shapeOfValue));\n if (\"const\" in record) statedValues([shapeOfValue(record.const)]);\n const ref = record.$ref;\n if (typeof ref === \"string\" && ref.startsWith(\"#/$defs/\")) {\n const defs = root.$defs as Record<string, unknown> | undefined;\n // A JSON Pointer token escapes \"~\" as \"~0\" and \"/\" as \"~1\".\n const name = ref\n .slice(\"#/$defs/\".length)\n .replaceAll(\"~1\", \"/\")\n .replaceAll(\"~0\", \"~\");\n const shapes = jsonShapes(defs?.[name], root, inner);\n if (shapes) stated.push(shapes);\n }\n const branches = anyOf ?? oneOf;\n if (Array.isArray(branches)) {\n const shapes = branches.map((branch) => jsonShapes(branch, root, inner));\n if (!shapes.includes(undefined)) {\n stated.push(new Set(shapes.flatMap((set) => [...(set ?? [])])));\n }\n }\n if (Array.isArray(allOf)) {\n for (const member of allOf) {\n const shapes = jsonShapes(member, root, inner);\n if (shapes) stated.push(shapes);\n }\n }\n if (stated.length === 0) return undefined;\n const [first, ...rest] = stated;\n return new Set(\n [...first].filter((shape) => rest.every((set) => set.has(shape))),\n );\n}\n\n/**\n * The representation zod states for every output value of `schema`, or\n * `undefined` when it cannot state one. One shape is that representation;\n * several are `json`.\n */\nexport function statedRepresentation(\n schema: z.ZodType,\n): JsonRepresentation | undefined {\n const jsonSchema = outputJsonSchema(schema);\n const stated = jsonShapes(jsonSchema, jsonSchema);\n if (stated === undefined) return undefined;\n const shapes = [...stated].filter((shape) => shape !== \"null\");\n if (shapes.length === 0) return undefined;\n const [only, ...rest] = shapes;\n return rest.length === 0 ? only : \"json\";\n}\n\nfunction outputJsonSchema(schema: z.ZodType): Record<string, unknown> {\n try {\n return z.toJSONSchema(schema, { io: \"output\", unrepresentable: \"any\" });\n } catch {\n return {};\n }\n}\n","import { z } from \"zod\";\nimport { scalarCatalog } from \"./catalog.js\";\nimport { defineCatalogScalar } from \"./define-catalog-scalar.js\";\nimport {\n type JsonRepresentation,\n statedRepresentation,\n} from \"./representation.js\";\nimport type { DescribedScalarDefinition } from \"./types.js\";\n\ntype Json = string | number | boolean | null | Json[] | { [key: string]: Json };\n\ntype OutputIsAny = {\n \"defineScalar refuses this schema: its output is any\": never;\n};\ntype AcceptsMissingValue = {\n \"defineScalar refuses this schema: it accepts a missing value; nullability belongs in the SDL\": never;\n};\ntype OutputCanBeNull = {\n \"defineScalar refuses this schema: its output can be null; nullability belongs in the SDL\": never;\n};\ntype OutputIsNotJson = {\n \"defineScalar refuses this schema: its output must be JSON\": never;\n};\ntype OutputFailsSchema = {\n \"defineScalar refuses this schema: its output must pass the schema again\": never;\n};\n\n// zod marks .default() and .prefault() with optin \"defaulted\" and .optional()\n// and .nullish() with optout \"optional\". z.coerce and z.preprocess take\n// `unknown`, which includes undefined, so for them only the markers count.\ntype TakesMissingValue<S extends z.ZodType> =\n S[\"_zod\"][\"optin\"] extends \"defaulted\"\n ? true\n : S[\"_zod\"][\"optout\"] extends \"optional\"\n ? true\n : unknown extends z.input<S>\n ? false\n : undefined extends z.input<S>\n ? true\n : false;\n\ntype CanonicalSchema<S extends z.ZodType> = 0 extends 1 & z.output<S>\n ? OutputIsAny\n : TakesMissingValue<S> extends true\n ? AcceptsMissingValue\n : z.output<S> extends Json\n ? null extends z.output<S>\n ? OutputCanBeNull\n : z.output<S> extends z.input<S>\n ? S\n : OutputFailsSchema\n : OutputIsNotJson;\n\ntype ScalarInput<TName extends string, S extends z.ZodType> = {\n name: TName;\n schema: S & CanonicalSchema<S>;\n description?: string;\n example?: NoInfer<z.input<S>>;\n /** Only for a schema whose JSON shape zod cannot state, such as `z.custom`. */\n representation?: JsonRepresentation;\n};\n\nconst inputKeys = new Set([\n \"name\",\n \"schema\",\n \"description\",\n \"example\",\n \"representation\",\n]);\nconst jsonRepresentations: ReadonlySet<unknown> = new Set<JsonRepresentation>([\n \"string\",\n \"number\",\n \"boolean\",\n \"json-object\",\n \"json\",\n]);\nconst graphqlBuiltIns: ReadonlySet<unknown> = new Set([\n \"Int\",\n \"Float\",\n \"String\",\n \"Boolean\",\n \"ID\",\n]);\nconst catalogNames: ReadonlySet<unknown> = new Set(\n scalarCatalog.map((definition) => definition.name),\n);\nconst graphqlName = /^[_A-Za-z][_0-9A-Za-z]*$/;\n\ntype Refusal = (\n input: Readonly<Record<string, unknown>> & { readonly schema: z.ZodType },\n) => string | undefined;\n\nconst refusals: readonly Refusal[] = [\n (input) => {\n const unknownKeys = Object.keys(input).filter((key) => !inputKeys.has(key));\n return unknownKeys.length > 0\n ? `unknown input key ${unknownKeys.join(\", \")}; defineScalar accepts only name, schema, description, example and representation`\n : undefined;\n },\n ({ name }) =>\n typeof name !== \"string\" || !graphqlName.test(name) || name.startsWith(\"__\")\n ? \"the name is not a valid GraphQL name\"\n : undefined,\n ({ name }) =>\n graphqlBuiltIns.has(name)\n ? \"the name is a GraphQL built-in scalar\"\n : undefined,\n ({ name }) =>\n catalogNames.has(name) ? \"the name is a catalog scalar\" : undefined,\n ({ schema }) =>\n schema._zod.optin === \"defaulted\" || schema._zod.optout === \"optional\"\n ? \"the schema accepts a missing value; nullability belongs in the SDL\"\n : undefined,\n];\n\nexport function defineScalar<TName extends string, S extends z.ZodType>(\n input: ScalarInput<TName, S>,\n): DescribedScalarDefinition<TName, z.output<S>> {\n for (const refusal of refusals) {\n const reason = refusal(input);\n if (reason !== undefined) {\n throw new Error(\n `Cannot define scalar \"${String(input.name)}\": ${reason}.`,\n );\n }\n }\n const { example, representation, ...definition } = input;\n // TypeScript cannot relate a generic S to its own z.output<S>.\n const schema = input.schema as z.ZodType<z.output<S>>;\n const parsedExample =\n example === undefined ? undefined : schema.safeParse(example);\n if (parsedExample?.success === false) {\n throw new Error(\n `Cannot define scalar \"${input.name}\": the example fails the schema: ${z.prettifyError(parsedExample.error)}`,\n );\n }\n return defineCatalogScalar({\n ...definition,\n schema,\n ...(parsedExample && { example: parsedExample.data }),\n typescriptType: null,\n zodSource: null,\n representation: scalarRepresentation(input.name, schema, representation),\n });\n}\n\nfunction scalarRepresentation(\n name: string,\n schema: z.ZodType,\n declared: unknown,\n): JsonRepresentation {\n const derived = statedRepresentation(schema);\n if (declared === undefined) return derived ?? \"json\";\n if (!jsonRepresentations.has(declared)) {\n throw new Error(\n `Cannot define scalar \"${name}\": representation must be one of ${[...jsonRepresentations].join(\", \")}.`,\n );\n }\n const representation = declared as JsonRepresentation;\n if (derived !== undefined && derived !== representation) {\n throw new Error(\n `Cannot define scalar \"${name}\": the schema's values are ${derived}, so representation cannot be ${representation}.`,\n );\n }\n return representation;\n}\n"],"mappings":";;;AAWA,MAAM,kBAAmE;CACvE,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,OAAO;AACT;AAEA,SAAS,aAAa,OAAuC;CAC3D,IAAI,UAAU,MAAM,OAAO;CAC3B,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CACjC,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,OAAO,gBAAgB,OAAO;AAChC;;;;;;AAOA,SAAS,WACP,MACA,MACA,2BAAiC,IAAI,IAAI,GACL;CACpC,IAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,SAAS,IAAI,IAAI,GAChE;CAEF,MAAM,wBAAQ,IAAI,IAA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AG,mBAAmB,CAAC,CAAC,KAAK,IAAI,EAAE,EACvG;CAEF,MAAM,iBAAiB;CACvB,IAAI,YAAY,KAAA,KAAa,YAAY,gBACvC,MAAM,IAAI,MACR,yBAAyB,KAAK,6BAA6B,QAAQ,gCAAgC,eAAe,EACpH;CAEF,OAAO;AACT"}
@@ -0,0 +1,389 @@
1
+ import { DefinitionCheckProfile, DefinitionCheckReport, DefinitionCheckSkipReason, DefinitionDiagnostic, DefinitionPath, DefinitionSource, DocumentModelDefinition, DocumentModelModule, DocumentModelPHState, Sha256Digest, UpgradeManifest } from "@powerhousedao/shared/document-model";
2
+ //#region src/definition/kernel/diagnostics.d.ts
3
+ /** @experimental A source as `specifier#/export/path`, each segment escaped as a JSON Pointer token. */
4
+ export declare function formatDefinitionSource(source: DefinitionSource): string;
5
+ /** @experimental One line: code, severity and phase, location, message, expected, received, related and repair. */
6
+ export declare function formatDefinitionDiagnostic(diagnostic: DefinitionDiagnostic): string;
7
+ //#endregion
8
+ //#region src/definition/tooling/adapters/types.d.ts
9
+ /**
10
+ * @experimental The shape both authoring paths normalize into. A consumer
11
+ * reads it without learning which adapter produced it.
12
+ */
13
+ type NormalizedDocumentModelArtifact = {
14
+ readonly kind: "powerhouse.document-model-artifact";
15
+ readonly source: DefinitionSource;
16
+ readonly documentType: string;
17
+ readonly version: number;
18
+ readonly definition: DocumentModelDefinition;
19
+ readonly digest: Sha256Digest;
20
+ readonly documentModel: DocumentModelPHState;
21
+ };
22
+ /** @experimental */
23
+ type NormalizedDocumentModelResult = {
24
+ readonly artifacts: readonly NormalizedDocumentModelArtifact[];
25
+ readonly upgradeManifest: UpgradeManifest<readonly number[]> | null;
26
+ readonly diagnostics: readonly DefinitionDiagnostic[];
27
+ };
28
+ //#endregion
29
+ //#region src/definition/tooling/adapters/code-first-document-model-source-adapter.d.ts
30
+ /**
31
+ * @experimental Normalizes one materialized code-first module, or a family
32
+ * and its versions in order. A family reports every malformed member: a
33
+ * valid sibling never makes a broken one pass.
34
+ */
35
+ export declare function adaptCodeFirstDocumentModelSource(value: unknown, source: DefinitionSource): NormalizedDocumentModelResult;
36
+ //#endregion
37
+ //#region src/definition/tooling/definition-source-types.d.ts
38
+ /**
39
+ * @experimental The selected sources, exactly as a definition report carries
40
+ * them. Defined from the stored report type so the two cannot disagree.
41
+ */
42
+ type DefinitionSourceSet = DefinitionCheckReport["sourceSet"];
43
+ /** @experimental Where the selected source list came from. */
44
+ type DefinitionSourceOrigin = DefinitionSourceSet["origin"];
45
+ /**
46
+ * @experimental The loader's one substitutable dependency: something that
47
+ * turns a package-relative TypeScript path into a module namespace. Codegen
48
+ * supplies a Vite environment; a build can supply its own module graph.
49
+ */
50
+ interface TypeScriptSourceImportInterface {
51
+ importModule(request: {
52
+ readonly packageRoot: string;
53
+ readonly specifier: `./${string}`;
54
+ readonly packageRevision: Sha256Digest;
55
+ readonly signal?: AbortSignal;
56
+ }): Promise<Readonly<Record<string, unknown>>>;
57
+ disposeRevision?(packageRevision?: Sha256Digest): Promise<void> | void;
58
+ }
59
+ /** @experimental */
60
+ type DefinitionSourceSelectionRequest = {
61
+ readonly configFile?: string;
62
+ readonly allowMissingConfig?: boolean;
63
+ };
64
+ /** @experimental */
65
+ type DefinitionSourceLoadRequest = DefinitionSourceSelectionRequest & {
66
+ /**
67
+ * Binds the imported bytes this load may reuse. A definition digest is not
68
+ * enough: editing a reducer helper leaves every definition digest unchanged.
69
+ */
70
+ readonly packageRevision: Sha256Digest;
71
+ readonly signal?: AbortSignal;
72
+ };
73
+ /** @experimental A selection, resolved without importing anything. */
74
+ type DefinitionSourceResolution = {
75
+ readonly packageRoot: string;
76
+ readonly sourceSet: DefinitionSourceSet;
77
+ readonly diagnostics: readonly DefinitionDiagnostic[];
78
+ } & ({
79
+ readonly status: "ready" | "failed";
80
+ readonly skipReason?: never;
81
+ } | {
82
+ readonly status: "skipped";
83
+ readonly skipReason: DefinitionCheckSkipReason;
84
+ });
85
+ /** @experimental One value the traversal recognized, and where it was found. */
86
+ type LoadedDefinition<TValue> = {
87
+ readonly source: DefinitionSource;
88
+ readonly path: DefinitionPath;
89
+ readonly value: TValue;
90
+ };
91
+ /** @experimental */
92
+ type LoadedDefinitionSet = DefinitionSourceResolution & {
93
+ readonly documentModels: readonly LoadedDefinition<DocumentModelModule>[];
94
+ readonly upgradeManifests: readonly LoadedDefinition<UpgradeManifest<readonly number[]>>[];
95
+ };
96
+ //#endregion
97
+ //#region src/definition/tooling/definition-source-loader.d.ts
98
+ /**
99
+ * @experimental Imports the selected definition sources and finds the
100
+ * materialized document models, families and upgrade manifests they export.
101
+ * It folds aliases, reports two values that claim one `documentType@version`,
102
+ * and returns everything sorted by source, so neither config order nor
103
+ * import completion order changes a result. Validity belongs to the
104
+ * adapters; registration belongs to the host.
105
+ */
106
+ export declare class DefinitionSourceLoader {
107
+ #private;
108
+ constructor(importer: TypeScriptSourceImportInterface);
109
+ resolve(request: DefinitionSourceSelectionRequest): DefinitionSourceResolution;
110
+ normalizeDefinitionSources(request: DefinitionSourceLoadRequest): Promise<LoadedDefinitionSet>;
111
+ /**
112
+ * @experimental Imports one package module through the same importer and
113
+ * package revision as the selected sources, so a module both reach is
114
+ * evaluated once. A module outside the package root is refused as an
115
+ * outside source is. Experimental: tooling uses it for the project scalars
116
+ * module while code-first projects are introduced.
117
+ */
118
+ importPackageModule(request: DefinitionSourceLoadRequest & {
119
+ readonly specifier: `./${string}`;
120
+ }): Promise<{
121
+ readonly ok: true;
122
+ readonly namespace: Readonly<Record<string, unknown>>;
123
+ } | {
124
+ readonly ok: false;
125
+ readonly diagnostics: readonly DefinitionDiagnostic[];
126
+ }>;
127
+ dispose(): Promise<void>;
128
+ }
129
+ //#endregion
130
+ //#region src/definition/tooling/definition-source-resolution.d.ts
131
+ /**
132
+ * @experimental The selection a command would load, resolved without
133
+ * importing anything and without any machine-specific path but the root.
134
+ */
135
+ export declare function resolveDefinitionSelection(request: DefinitionSourceSelectionRequest): DefinitionSourceResolution;
136
+ //#endregion
137
+ //#region src/definition/tooling/adapters/producer.d.ts
138
+ /**
139
+ * Maps a path a check reports in normalized coordinates (served data under
140
+ * `documentModel/global`, definition data under `specifications`) to where
141
+ * the source's author edits it.
142
+ */
143
+ type DefinitionRelocation = (path: DefinitionPath) => DefinitionPath;
144
+ type ProducedDefinitions = {
145
+ readonly artifacts: readonly NormalizedDocumentModelArtifact[];
146
+ readonly diagnostics: readonly DefinitionDiagnostic[];
147
+ /** By source specifier. A source authored in normalized coordinates has none. */
148
+ readonly relocations: ReadonlyMap<string, DefinitionRelocation>;
149
+ };
150
+ type DefinitionProducerInput = {
151
+ readonly loader: DefinitionSourceLoader;
152
+ readonly configFile: string;
153
+ readonly packageRevision: Sha256Digest;
154
+ readonly signal?: AbortSignal;
155
+ /** Absolute. */
156
+ readonly packageRoot: string;
157
+ /** The selected code-first sources, imported once for every producer. */
158
+ readonly loaded: LoadedDefinitionSet;
159
+ /** Absolute and inside the package; absent when the configured directory cannot be read. */
160
+ readonly documentModelsDir?: string;
161
+ };
162
+ type DefinitionProducer = (input: DefinitionProducerInput) => ProducedDefinitions | Promise<ProducedDefinitions>;
163
+ //#endregion
164
+ //#region src/definition/tooling/report/types.d.ts
165
+ /** A code-first declaration under the document models directory that no `definitionSources` entry reaches. */
166
+ type UnregisteredDefinition = {
167
+ readonly kind: "document-model";
168
+ /** `./<documentModelsDir>/<name>/`. */
169
+ readonly unit: `./${string}`;
170
+ /** The module an entry should name to register it. */
171
+ readonly specifier: `./${string}`;
172
+ /** Whether a selected source evaluated its declaring files without exporting its model. */
173
+ readonly reason: "unreached" | "not-exported";
174
+ };
175
+ /**
176
+ * @experimental What every registered check reads. A wider input, such as
177
+ * ph-cli's release evidence, lets a later layer register checks that need
178
+ * more, without changing the runner.
179
+ */
180
+ type DefinitionCheckInput = {
181
+ readonly sourceSet: DefinitionSourceSet;
182
+ /** Sorted by document type, version and source. */
183
+ readonly artifacts: readonly NormalizedDocumentModelArtifact[];
184
+ readonly unregistered: readonly UnregisteredDefinition[];
185
+ };
186
+ /** What the check runner and inspection need besides the check input. */
187
+ type LoadedDefinitionProject = DefinitionCheckInput & {
188
+ readonly skipReason?: DefinitionCheckSkipReason;
189
+ /** Load and adapter diagnostics, with package-relative text. */
190
+ readonly diagnostics: readonly DefinitionDiagnostic[];
191
+ /** By source specifier: where a check's normalized path sits in that source. */
192
+ readonly relocations?: ReadonlyMap<string, DefinitionRelocation>;
193
+ };
194
+ //#endregion
195
+ //#region src/definition/tooling/check/types.d.ts
196
+ /**
197
+ * @experimental One named check over normalized artifacts, which ph-cli passes
198
+ * to `checkProjectDefinitions`. It reports normalized paths.
199
+ */
200
+ type DefinitionCheck<TInput extends DefinitionCheckInput = DefinitionCheckInput> = {
201
+ readonly name: string;
202
+ readonly run: (input: TInput) => readonly DefinitionDiagnostic[] | Promise<readonly DefinitionDiagnostic[]>;
203
+ };
204
+ //#endregion
205
+ //#region src/definition/tooling/check/check-project-definitions.d.ts
206
+ /**
207
+ * @experimental The checks `ph model check` runs on document models. A later
208
+ * layer, such as ph-cli's release profile, adds its own with
209
+ * `[...documentModelChecks, ...theirs]`.
210
+ */
211
+ export declare const documentModelChecks: readonly DefinitionCheck[];
212
+ /**
213
+ * @experimental Runs every check over a loaded project and builds the stored
214
+ * check report with the project's load diagnostics. `definitions` adds
215
+ * inventory entries a caller checked itself; `profile` (default `edit`) names
216
+ * the check list the caller ran. Experimental while code-first projects are
217
+ * introduced.
218
+ */
219
+ export declare function checkProjectDefinitions<TInput extends DefinitionCheckInput = DefinitionCheckInput>(project: LoadedDefinitionProject & TInput, options?: {
220
+ readonly checks?: readonly DefinitionCheck<TInput>[];
221
+ readonly definitions?: DefinitionCheckReport["definitions"];
222
+ readonly profile?: DefinitionCheckProfile;
223
+ }): Promise<DefinitionCheckReport>;
224
+ //#endregion
225
+ //#region src/definition/tooling/release/types.d.ts
226
+ /**
227
+ * One reason a host would not serve a model as declared. Plain data, so a
228
+ * host's validator result is passed in as is and tooling never imports a host.
229
+ */
230
+ type HostValidationFindingData = {
231
+ readonly kind: "scalar-unbound";
232
+ readonly documentType: string;
233
+ readonly scalar: string;
234
+ } | {
235
+ /** `scalar-uncomparable`: equal metadata, validators that could not be compared. */
236
+ readonly kind: "scalar-mismatch" | "scalar-uncomparable";
237
+ readonly documentType: string;
238
+ readonly scalar: string;
239
+ readonly packageName: string;
240
+ /** Canonical JSON of the stored scalar metadata, with the validator when known. */
241
+ readonly declared: string;
242
+ readonly registered: string;
243
+ } | {
244
+ readonly kind: "definition-invalid" | "definition-mismatch";
245
+ readonly documentType: string;
246
+ /** The host's wire diagnostics, with paths into the module. */
247
+ readonly diagnostics: readonly DefinitionDiagnostic[];
248
+ };
249
+ /** @experimental A host validator's result, as ph-cli passes it to `releaseChecks`. */
250
+ type HostValidationEvidence = {
251
+ readonly completed: true;
252
+ readonly findings: readonly HostValidationFindingData[];
253
+ } | {
254
+ /** The host validator could not run over the package. */
255
+ readonly completed: false;
256
+ /** What stopped it, package relative. */
257
+ readonly reason: string;
258
+ readonly findings: readonly HostValidationFindingData[];
259
+ };
260
+ /** @experimental The evidence ph-cli gathers for the release profile. */
261
+ type ReleaseEvidence = {
262
+ readonly host: HostValidationEvidence;
263
+ };
264
+ /** @experimental The input `releaseChecks` read. */
265
+ type ReleaseCheckInput = DefinitionCheckInput & {
266
+ readonly release: ReleaseEvidence;
267
+ };
268
+ //#endregion
269
+ //#region src/definition/tooling/release/release-checks.d.ts
270
+ /**
271
+ * @experimental The checks the release profile of `ph build --release` and
272
+ * `ph model check --release` adds to `documentModelChecks`. They read the
273
+ * release evidence a caller gathered.
274
+ */
275
+ export declare const releaseChecks: readonly DefinitionCheck<ReleaseCheckInput>[];
276
+ //#endregion
277
+ //#region src/definition/tooling/report/status.d.ts
278
+ type DefinitionStatus = DefinitionCheckReport["status"];
279
+ //#endregion
280
+ //#region src/definition/tooling/inspect/types.d.ts
281
+ /**
282
+ * @experimental One served version of a family, as `ph model inspect` prints
283
+ * it. Experimental while code-first projects are introduced.
284
+ */
285
+ type DocumentModelInspection = {
286
+ readonly version: number;
287
+ readonly source: DefinitionSource;
288
+ readonly scopes: {
289
+ readonly global: string;
290
+ readonly local: string | null;
291
+ };
292
+ readonly modules: readonly {
293
+ readonly key: string;
294
+ readonly name: string;
295
+ readonly operations: readonly {
296
+ readonly key: string;
297
+ readonly name: string | null;
298
+ readonly actionType: string;
299
+ readonly scope: "global" | "local";
300
+ readonly input: string | null;
301
+ readonly errors: readonly {
302
+ readonly key: string;
303
+ readonly code: string | null;
304
+ }[];
305
+ }[];
306
+ }[];
307
+ readonly scalars: readonly {
308
+ readonly name: string;
309
+ readonly implementation: string;
310
+ }[];
311
+ readonly types: readonly string[];
312
+ };
313
+ /**
314
+ * @experimental One definition and the versions it serves. Every version
315
+ * carries the whole history, so the digest, name and compatibility belong to
316
+ * the family, not to a version. Experimental while code-first projects are
317
+ * introduced.
318
+ */
319
+ type DocumentModelFamilyInspection = {
320
+ readonly documentType: string;
321
+ readonly name: string;
322
+ readonly extension: string;
323
+ readonly digest: Sha256Digest;
324
+ readonly compatibility: DocumentModelDefinition["compatibility"];
325
+ readonly versions: readonly DocumentModelInspection[];
326
+ };
327
+ /**
328
+ * @experimental What `ph model inspect --json` prints: deterministic, package
329
+ * relative, and diffable between releases. Experimental while code-first
330
+ * projects are introduced.
331
+ */
332
+ type DefinitionInspectionReport = {
333
+ readonly kind: "powerhouse.definition-inspection";
334
+ readonly formatVersion: 1;
335
+ readonly status: DefinitionStatus;
336
+ readonly sourceSet: DefinitionSourceSet;
337
+ readonly families: readonly DocumentModelFamilyInspection[];
338
+ readonly diagnostics: readonly DefinitionDiagnostic[];
339
+ /** Present only when a selection matched exactly one model. */
340
+ readonly definition?: DocumentModelDefinition;
341
+ };
342
+ /** @experimental */
343
+ type DefinitionInspectionSelection = {
344
+ readonly documentType: string;
345
+ readonly version: number;
346
+ };
347
+ //#endregion
348
+ //#region src/definition/tooling/inspect/inspect-project-definitions.d.ts
349
+ /**
350
+ * @experimental Describes the loaded models without running checks. With a
351
+ * selection it answers for that model only, and adds its full definition
352
+ * when exactly one model serves it. Experimental while code-first projects
353
+ * are introduced.
354
+ */
355
+ export declare function inspectProjectDefinitions(project: LoadedDefinitionProject, options?: {
356
+ readonly selection?: DefinitionInspectionSelection;
357
+ }): DefinitionInspectionReport;
358
+ //#endregion
359
+ //#region src/definition/tooling/project/project-definitions.d.ts
360
+ /**
361
+ * @experimental A package's document models, loaded once and read by both
362
+ * `ph model check` and `ph model inspect`. Experimental while code-first
363
+ * projects are introduced.
364
+ */
365
+ type ProjectDefinitions = LoadedDefinitionProject & {
366
+ /** Absolute. No report carries it. */
367
+ readonly packageRoot: string;
368
+ };
369
+ /**
370
+ * @experimental Loads the selected code-first sources and the package's stored
371
+ * schema-first models, and scans for code-first declarations no source
372
+ * reaches. Artifacts and diagnostics are sorted and package relative.
373
+ * `producers` replaces the default readers. `importedFiles` names the
374
+ * absolute paths of every module the loader's import of a selected
375
+ * specifier evaluated, so reach follows whatever the importer resolved.
376
+ * Experimental while code-first projects are introduced.
377
+ */
378
+ export declare function loadProjectDefinitions(request: {
379
+ readonly loader: DefinitionSourceLoader;
380
+ readonly configFile: string;
381
+ readonly packageRevision: Sha256Digest;
382
+ readonly signal?: AbortSignal;
383
+ readonly producers?: readonly DefinitionProducer[];
384
+ readonly importedFiles: (specifier: string) => readonly string[];
385
+ }): Promise<ProjectDefinitions>;
386
+ //#endregion
387
+ export type { DefinitionCheck, DefinitionCheckInput, DefinitionInspectionReport, DefinitionSourceLoadRequest, DefinitionSourceOrigin, DefinitionSourceResolution, DefinitionSourceSelectionRequest, DefinitionSourceSet, DocumentModelFamilyInspection, DocumentModelInspection, HostValidationEvidence, LoadedDefinition, LoadedDefinitionSet, NormalizedDocumentModelArtifact, NormalizedDocumentModelResult, ProjectDefinitions, ReleaseCheckInput, ReleaseEvidence, TypeScriptSourceImportInterface };
388
+ export {};
389
+ //# sourceMappingURL=tooling.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooling.d.mts","names":[],"sources":["../src/definition/kernel/diagnostics.ts","../src/definition/tooling/adapters/types.ts","../src/definition/tooling/adapters/code-first-document-model-source-adapter.ts","../src/definition/tooling/definition-source-types.ts","../src/definition/tooling/definition-source-loader.ts","../src/definition/tooling/definition-source-resolution.ts","../src/definition/tooling/adapters/producer.ts","../src/definition/tooling/report/types.ts","../src/definition/tooling/check/types.ts","../src/definition/tooling/check/check-project-definitions.ts","../src/definition/tooling/release/types.ts","../src/definition/tooling/release/release-checks.ts","../src/definition/tooling/report/status.ts","../src/definition/tooling/inspect/types.ts","../src/definition/tooling/inspect/inspect-project-definitions.ts","../src/definition/tooling/project/project-definitions.ts"],"mappings":";;;wBAwPgB,uBAAuB,QAAQ;;wBAmB/B,2BACd,YAAY;;;;;;;KC/PF;WACD;WACA,QAAQ;WACR;WAEA;WAEA,YAAY;WAEZ,QAAQ;WAER,eAAe;;;KAId;WACD,oBAAoB;WAEpB,iBAAiB;WACjB,sBAAsB;;;;;;;;;wBC+MjB,kCACd,gBACA,QAAQ,mBACP;;;;;;;KCnOS,sBAAsB;;KAGtB,yBAAyB;;;;;;UAOpB;EACf,aAAa;aACF;aACA;aACA,iBAAiB;aACjB,SAAS;MAChB,QAAQ,SAAS;EAErB,iBAAiB,kBAAkB,eAAe;;;KAIxC;WACD;WAEA;;;KAIC,8BAA8B;;;;;WAK/B,iBAAiB;WACjB,SAAS;;;KAIR;WACD;WACA,WAAW;WACX,sBAAsB;;WAElB;WAAqC;;WAErC;WACA,YAAY;;;KAKf,iBAAiB;WAClB,QAAQ;WAER,MAAM;WACN,OAAO;;;KAIN,sBAAsB;WACvB,yBAAyB,iBAAiB;WAC1C,2BAA2B,iBAClC;;;;;;;;;;;;qBCyfS;;EAQX,YAAY,UAAU;EAItB,QACE,SAAS,mCACR;EAIG,2BACJ,SAAS,8BACR,QAAQ;;;;;;;;EA6EL,oBACJ,SAAS;aACE;MAEV;aAEY;aACA,WAAW,SAAS;;aAGpB;aACA,sB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