constructa-core 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,9 +21,13 @@ Use `defineGenerator()` for developer-authored executable implementations. An im
21
21
 
22
22
  `GeneratorDefinition<Output>` carries output information only at compile time; emitted definitions remain plain JSON data. Factories should use `createGeneratorDefinition()` so literal fields are preserved and the resulting definition is portable. Implementations receive randomness and child generation through `GenerationContext`; they must not use global randomness or built-in-specific execution switches.
23
23
 
24
+ ## Random sources
25
+
26
+ `RandomSource` exposes `float()` in `[0, 1)`, `integer(maxExclusive)` in `[0, maxExclusive)`, and `bytes(length)` with exactly the requested number of bytes. Use `createRandomSource()` to validate injected adapters or `createDefaultRandomSource()` for the platform-backed source. Invalid source output is a system error; Constructa never substitutes biased fallback randomness. The default source uses platform cryptographic bytes, but this package makes no claim that generated values are suitable for a security-sensitive use case.
27
+
24
28
  ## Registry
25
29
 
26
- `createRegistry()` is advanced infrastructure. Register trusted implementations explicitly with `register()`. Duplicate type IDs fail without changing registry state; `replace()` is the deliberate replacement path and requires the type to already be registered. `snapshot()` returns an immutable, type-sorted record of registered generator IDs and versions for execution infrastructure. Lookup and dispatch are separate later concerns.
30
+ `createRegistry()` is advanced infrastructure. Register trusted implementations explicitly with `register()`. Duplicate type IDs fail without changing registry state; `replace()` is the deliberate replacement path and requires the type to already be registered. `lookup(type, path?)` resolves a registered implementation without a central built-in switch. Unknown IDs throw a dependency `UNKNOWN_GENERATOR` error at the supplied definition path plus `type`, with safe registered-type diagnostics. `snapshot()` returns an immutable, type-sorted registry view with the same lookup behavior; later registry changes do not affect it. Dispatch remains a separate concern.
27
31
 
28
32
  ## Dependency Boundary
29
33
 
package/dist/index.d.ts CHANGED
@@ -1,8 +1,22 @@
1
1
  import { GeneratorDefinition, GeneratorDefinition as GeneratorDefinition$1, Infer, ValidationIssue, ValidationIssue as ValidationIssue$1, ValidationPath, ValidationPath as ValidationPath$1 } from "constructa-schema";
2
2
  //#region src/index.d.ts
3
+ /**
4
+ * Random values are always half-open: `float()` returns [0, 1), while
5
+ * `integer(maxExclusive)` returns an integer in [0, maxExclusive).
6
+ */
3
7
  type RandomSource = {
4
- next(): number;
8
+ float(): number;
9
+ integer(maxExclusive: number): number;
10
+ bytes(length: number): Uint8Array;
5
11
  };
12
+ type RandomSourceAdapter = RandomSource;
13
+ /**
14
+ * Validates an injected source and guards every produced value. No fallback
15
+ * randomness is used when an adapter violates its contract.
16
+ */
17
+ declare function createRandomSource(adapter: RandomSourceAdapter): RandomSource;
18
+ /** Creates the default platform-backed random source. It makes no security claim. */
19
+ declare function createDefaultRandomSource(): RandomSource;
6
20
  /** Services supplied by the engine. Implementations must not use global randomness. */
7
21
  type GenerationContext = {
8
22
  readonly random: RandomSource;
@@ -28,10 +42,12 @@ type RegisteredGenerator = {
28
42
  };
29
43
  type GeneratorRegistrySnapshot = {
30
44
  readonly generators: readonly RegisteredGenerator[];
45
+ readonly lookup: (type: string, path?: ValidationPath$1) => GeneratorImplementation<GeneratorDefinition$1, unknown>;
31
46
  };
32
47
  type GeneratorRegistry = {
33
48
  register: <Definition extends GeneratorDefinition$1<Output>, Output>(implementation: GeneratorImplementation<Definition, Output>) => void;
34
49
  replace: <Definition extends GeneratorDefinition$1<Output>, Output>(implementation: GeneratorImplementation<Definition, Output>) => void;
50
+ lookup: (type: string, path?: ValidationPath$1) => GeneratorImplementation<GeneratorDefinition$1, unknown>;
35
51
  snapshot: () => GeneratorRegistrySnapshot;
36
52
  };
37
53
  /** Creates advanced registry infrastructure. Normal factories do not require it. */
@@ -54,5 +70,5 @@ declare function invokeGeneratorImplementation<Definition extends GeneratorDefin
54
70
  readonly path?: ValidationPath$1;
55
71
  }): Output;
56
72
  //#endregion
57
- export { GenerationContext, type GeneratorDefinition, GeneratorDependency, GeneratorImplementation, GeneratorRegistry, GeneratorRegistrySnapshot, type Infer, RandomSource, RegisteredGenerator, type ValidationIssue, type ValidationPath, createGeneratorDefinition, createRegistry, defineGenerator, invokeGeneratorImplementation };
73
+ export { GenerationContext, type GeneratorDefinition, GeneratorDependency, GeneratorImplementation, GeneratorRegistry, GeneratorRegistrySnapshot, type Infer, RandomSource, RandomSourceAdapter, RegisteredGenerator, type ValidationIssue, type ValidationPath, createDefaultRandomSource, createGeneratorDefinition, createRandomSource, createRegistry, defineGenerator, invokeGeneratorImplementation };
58
74
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;KAgBY;EACV;;;KAIU;WACD,QAAQ;WACR,gBAAgB,QACvB,YAAY,sBAAoB,YAC7B;;KAGK;WACD;WACA,MAAM;;KAGL,wBACV,mBAAmB,sBAAoB,SACvC;WAES;WACA;WACA,qBACP,iCACY;WACL,uBACP,YAAY,wBACA;WACL,WAAW;aACT,YAAY;aACZ,SAAS;QACd;;KAGI;WACD;WACA;;KAGC;WACD,qBAAqB;;KAGpB;EACV,WAAW,mBAAmB,sBAAoB,SAAS,QACzD,gBAAgB,wBAAwB,YAAY;EAEtD,UAAU,mBAAmB,sBAAoB,SAAS,QACxD,gBAAgB,wBAAwB,YAAY;EAEtD,gBAAgB;;;iBAUF,kBAAkB;;;;;iBAoDlB,sBACR,mBAAmB,sBAAoB,SAC7C,QAEA,gBAAgB,wBAAwB,YAAY,UACnD,wBAAwB,YAAY;;iBAMvB,0BACd,cACM,mBAAmB,sBAAoB,SAC7C,YAAY,aAAa;;;;;;iBAUX,8BACd,mBAAmB,sBAAoB,SACvC,QAEA,gBAAgB,wBAAwB,YAAY,SACpD;WACW,YAAY;WACZ,SAAS;WACT,OAAO;IAEjB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;KAoBY;EACV;EACA,QAAQ;EACR,MAAM,iBAAiB;;KAGb,sBAAsB;;;;;iBAMlB,mBAAmB,SAAS,sBAAsB;;iBA0ClD,6BAA6B;;KAqCjC;WACD,QAAQ;WACR,gBAAgB,QACvB,YAAY,sBAAoB,YAC7B;;KAGK;WACD;WACA,MAAM;;KAGL,wBACV,mBAAmB,sBAAoB,SACvC;WAES;WACA;WACA,qBACP,iCACY;WACL,uBACP,YAAY,wBACA;WACL,WAAW;aACT,YAAY;aACZ,SAAS;QACd;;KAGI;WACD;WACA;;KAGC;WACD,qBAAqB;WACrB,SACP,cACA,OAAO,qBACJ,wBAAwB;;KAGnB;EACV,WAAW,mBAAmB,sBAAoB,SAAS,QACzD,gBAAgB,wBAAwB,YAAY;EAEtD,UAAU,mBAAmB,sBAAoB,SAAS,QACxD,gBAAgB,wBAAwB,YAAY;EAEtD,SACE,cACA,OAAO,qBACJ,wBAAwB;EAC7B,gBAAgB;;;iBAUF,kBAAkB;;;;;iBAoDlB,sBACR,mBAAmB,sBAAoB,SAC7C,QAEA,gBAAgB,wBAAwB,YAAY,UACnD,wBAAwB,YAAY;;iBAMvB,0BACd,cACM,mBAAmB,sBAAoB,SAC7C,YAAY,aAAa;;;;;;iBAUX,8BACd,mBAAmB,sBAAoB,SACvC,QAEA,gBAAgB,wBAAwB,YAAY,SACpD;WACW,YAAY;WACZ,SAAS;WACT,OAAO;IAEjB"}
package/dist/index.js CHANGED
@@ -1,5 +1,61 @@
1
1
  import { ConstructaError, assertGeneratorDefinition, normalizeConstructaError } from "constructa-schema";
2
2
  //#region src/index.ts
3
+ /**
4
+ * Validates an injected source and guards every produced value. No fallback
5
+ * randomness is used when an adapter violates its contract.
6
+ */
7
+ function createRandomSource(adapter) {
8
+ assertRandomSourceAdapter(adapter);
9
+ return Object.freeze({
10
+ float() {
11
+ const value = adapter.float();
12
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value >= 1) throw invalidRandomSource("float() must return a finite number in [0, 1).");
13
+ return value;
14
+ },
15
+ integer(maxExclusive) {
16
+ assertRandomLength(maxExclusive, "maxExclusive");
17
+ const value = adapter.integer(maxExclusive);
18
+ if (!Number.isSafeInteger(value) || value < 0 || value >= maxExclusive) throw invalidRandomSource("integer(maxExclusive) must return a safe integer in [0, maxExclusive).");
19
+ return value;
20
+ },
21
+ bytes(length) {
22
+ assertRandomLength(length, "length");
23
+ const value = adapter.bytes(length);
24
+ if (!(value instanceof Uint8Array) || value.length !== length) throw invalidRandomSource("bytes(length) must return a Uint8Array with exactly length bytes.");
25
+ return value;
26
+ }
27
+ });
28
+ }
29
+ /** Creates the default platform-backed random source. It makes no security claim. */
30
+ function createDefaultRandomSource() {
31
+ const crypto = globalThis.crypto;
32
+ if (crypto?.getRandomValues === void 0) throw new ConstructaError({
33
+ kind: "system",
34
+ code: "SYSTEM_RANDOM_UNAVAILABLE",
35
+ path: [],
36
+ message: "Platform cryptographic random values are unavailable."
37
+ });
38
+ const randomBytes = (length) => {
39
+ const bytes = new Uint8Array(length);
40
+ for (let offset = 0; offset < length; offset += 65536) crypto.getRandomValues(bytes.subarray(offset, offset + 65536));
41
+ return bytes;
42
+ };
43
+ const uint32 = () => new DataView(randomBytes(4).buffer).getUint32(0);
44
+ const uint53 = () => (uint32() & 2097151) * 2 ** 32 + uint32();
45
+ return createRandomSource({
46
+ float() {
47
+ return uint53() / 2 ** 53;
48
+ },
49
+ integer(maxExclusive) {
50
+ const range = 2 ** 53;
51
+ const upperLimit = range - range % maxExclusive;
52
+ let value = uint53();
53
+ while (value >= upperLimit) value = uint53();
54
+ return value % maxExclusive;
55
+ },
56
+ bytes: randomBytes
57
+ });
58
+ }
3
59
  const RESERVED_GENERATOR_TYPE_IDS = /* @__PURE__ */ new Set([
4
60
  "__proto__",
5
61
  "constructor",
@@ -19,12 +75,11 @@ function createRegistry() {
19
75
  if (!implementations.has(implementation.type)) throw registryError("UNKNOWN_GENERATOR", ["type"], `No generator with type "${implementation.type}" is registered.`);
20
76
  implementations.set(implementation.type, freezeImplementation(implementation));
21
77
  },
78
+ lookup(type, path = []) {
79
+ return lookupImplementation(implementations, type, path);
80
+ },
22
81
  snapshot() {
23
- const generators = [...implementations.values()].map(({ type, version }) => Object.freeze({
24
- type,
25
- version
26
- })).sort((left, right) => left.type.localeCompare(right.type));
27
- return Object.freeze({ generators: Object.freeze(generators) });
82
+ return createRegistrySnapshot(implementations);
28
83
  }
29
84
  };
30
85
  }
@@ -107,6 +162,31 @@ function assertRegistryImplementation(implementation) {
107
162
  function freezeImplementation(implementation) {
108
163
  return Object.freeze({ ...implementation });
109
164
  }
165
+ function createRegistrySnapshot(implementations) {
166
+ const snapshotImplementations = new Map(implementations);
167
+ const generators = [...snapshotImplementations.values()].map(({ type, version }) => Object.freeze({
168
+ type,
169
+ version
170
+ })).sort((left, right) => left.type.localeCompare(right.type));
171
+ return Object.freeze({
172
+ generators: Object.freeze(generators),
173
+ lookup(type, path = []) {
174
+ return lookupImplementation(snapshotImplementations, type, path);
175
+ }
176
+ });
177
+ }
178
+ function lookupImplementation(implementations, type, path) {
179
+ const implementation = implementations.get(type);
180
+ if (implementation !== void 0) return implementation;
181
+ const registeredTypes = [...implementations.keys()].sort((left, right) => left.localeCompare(right));
182
+ throw new ConstructaError({
183
+ kind: "dependency",
184
+ code: "UNKNOWN_GENERATOR",
185
+ path: [...path, "type"],
186
+ message: `No generator with type "${type}" is registered.`,
187
+ details: { registeredTypes }
188
+ });
189
+ }
110
190
  function registryError(code, path, message) {
111
191
  return new ConstructaError({
112
192
  kind: "configuration",
@@ -115,10 +195,24 @@ function registryError(code, path, message) {
115
195
  message
116
196
  });
117
197
  }
198
+ function assertRandomSourceAdapter(adapter) {
199
+ if (typeof adapter !== "object" || adapter === null || typeof adapter.float !== "function" || typeof adapter.integer !== "function" || typeof adapter.bytes !== "function") throw invalidRandomSource("A random source must provide float(), integer(), and bytes() methods.");
200
+ }
201
+ function assertRandomLength(value, name) {
202
+ if (!Number.isSafeInteger(value) || value < 1) throw invalidRandomSource(`${name} must be a positive safe integer.`);
203
+ }
204
+ function invalidRandomSource(message) {
205
+ return new ConstructaError({
206
+ kind: "system",
207
+ code: "INVALID_RANDOM_SOURCE",
208
+ path: ["random"],
209
+ message
210
+ });
211
+ }
118
212
  function isStableTypeId(value) {
119
213
  return /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(value);
120
214
  }
121
215
  //#endregion
122
- export { createGeneratorDefinition, createRegistry, defineGenerator, invokeGeneratorImplementation };
216
+ export { createDefaultRandomSource, createGeneratorDefinition, createRandomSource, createRegistry, defineGenerator, invokeGeneratorImplementation };
123
217
 
124
218
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n assertGeneratorDefinition,\n ConstructaError,\n type GeneratorDefinition,\n normalizeConstructaError,\n type ValidationIssue,\n type ValidationPath,\n} from \"constructa-schema\";\n\nexport type {\n GeneratorDefinition,\n Infer,\n ValidationIssue,\n ValidationPath,\n} from \"constructa-schema\";\n\nexport type RandomSource = {\n next(): number;\n};\n\n/** Services supplied by the engine. Implementations must not use global randomness. */\nexport type GenerationContext = {\n readonly random: RandomSource;\n readonly generateChild: <Output>(\n definition: GeneratorDefinition<Output>,\n ) => Output;\n};\n\nexport type GeneratorDependency = {\n readonly typeId: string;\n readonly path: ValidationPath;\n};\n\nexport type GeneratorImplementation<\n Definition extends GeneratorDefinition<Output>,\n Output,\n> = {\n readonly type: string;\n readonly version: number;\n readonly validateDefinition: (\n definition: unknown,\n ) => readonly ValidationIssue[];\n readonly analyzeDependencies?: (\n definition: Definition,\n ) => readonly GeneratorDependency[];\n readonly generate: (input: {\n readonly definition: Definition;\n readonly context: GenerationContext;\n }) => Output;\n};\n\nexport type RegisteredGenerator = {\n readonly type: string;\n readonly version: number;\n};\n\nexport type GeneratorRegistrySnapshot = {\n readonly generators: readonly RegisteredGenerator[];\n};\n\nexport type GeneratorRegistry = {\n register: <Definition extends GeneratorDefinition<Output>, Output>(\n implementation: GeneratorImplementation<Definition, Output>,\n ) => void;\n replace: <Definition extends GeneratorDefinition<Output>, Output>(\n implementation: GeneratorImplementation<Definition, Output>,\n ) => void;\n snapshot: () => GeneratorRegistrySnapshot;\n};\n\nconst RESERVED_GENERATOR_TYPE_IDS = new Set([\n \"__proto__\",\n \"constructor\",\n \"prototype\",\n]);\n\n/** Creates advanced registry infrastructure. Normal factories do not require it. */\nexport function createRegistry(): GeneratorRegistry {\n const implementations = new Map<\n string,\n GeneratorImplementation<GeneratorDefinition, unknown>\n >();\n\n return {\n register(implementation) {\n assertRegistryImplementation(implementation);\n if (implementations.has(implementation.type)) {\n throw registryError(\n \"DUPLICATE_GENERATOR\",\n [\"type\"],\n `A generator with type \"${implementation.type}\" is already registered.`,\n );\n }\n implementations.set(\n implementation.type,\n freezeImplementation(\n implementation,\n ) as unknown as GeneratorImplementation<GeneratorDefinition, unknown>,\n );\n },\n replace(implementation) {\n assertRegistryImplementation(implementation);\n if (!implementations.has(implementation.type)) {\n throw registryError(\n \"UNKNOWN_GENERATOR\",\n [\"type\"],\n `No generator with type \"${implementation.type}\" is registered.`,\n );\n }\n implementations.set(\n implementation.type,\n freezeImplementation(\n implementation,\n ) as unknown as GeneratorImplementation<GeneratorDefinition, unknown>,\n );\n },\n snapshot() {\n const generators = [...implementations.values()]\n .map(({ type, version }) => Object.freeze({ type, version }))\n .sort((left, right) => left.type.localeCompare(right.type));\n return Object.freeze({ generators: Object.freeze(generators) });\n },\n };\n}\n\n/**\n * Defines a trusted, developer-authored generator implementation. This API has\n * no dependency on a particular validation library.\n */\nexport function defineGenerator<\n const Definition extends GeneratorDefinition<Output>,\n Output,\n>(\n implementation: GeneratorImplementation<Definition, Output>,\n): GeneratorImplementation<Definition, Output> {\n assertGeneratorImplementation(implementation);\n return implementation;\n}\n\n/** Builds a portable definition while preserving literal fields and output inference. */\nexport function createGeneratorDefinition<\n Output,\n const Definition extends GeneratorDefinition<Output>,\n>(definition: Definition): Definition {\n assertGeneratorDefinition(definition);\n return definition;\n}\n\n/**\n * Invokes one validated implementation. Registry lookup and dispatch are added\n * later; this function keeps validation and execution failure normalization in\n * the same shared contract today.\n */\nexport function invokeGeneratorImplementation<\n Definition extends GeneratorDefinition<Output>,\n Output,\n>(\n implementation: GeneratorImplementation<Definition, Output>,\n input: {\n readonly definition: Definition;\n readonly context: GenerationContext;\n readonly path?: ValidationPath;\n },\n): Output {\n const path = input.path ?? [];\n let issues: readonly ValidationIssue[];\n\n try {\n issues = implementation.validateDefinition(input.definition);\n } catch (cause) {\n throw normalizeConstructaError(cause, {\n kind: \"configuration\",\n code: \"INVALID_CONFIGURATION\",\n path,\n message: \"Generator definition validation failed.\",\n });\n }\n\n if (issues.length > 0) {\n const [issue] = issues;\n if (issue !== undefined) {\n throw new ConstructaError({\n kind: \"configuration\",\n code: \"INVALID_CONFIGURATION\",\n path: [...path, ...issue.path],\n message: issue.message,\n details: { issueCode: issue.code },\n });\n }\n\n throw new ConstructaError({\n kind: \"system\",\n code: \"EXECUTION_FAILED\",\n path,\n message: \"Generator validation returned an invalid result.\",\n });\n }\n\n try {\n return implementation.generate({\n definition: input.definition,\n context: input.context,\n });\n } catch (cause) {\n throw normalizeConstructaError(cause, {\n kind: \"execution\",\n code: \"EXECUTION_FAILED\",\n path,\n message: \"Generator execution failed.\",\n });\n }\n}\n\nfunction assertGeneratorImplementation(implementation: {\n readonly type: string;\n readonly version: number;\n readonly validateDefinition: unknown;\n readonly analyzeDependencies?: unknown;\n readonly generate: unknown;\n}): void {\n if (!isStableTypeId(implementation.type)) {\n throw new TypeError(\"generator type must be a stable lowercase identifier\");\n }\n if (\n !Number.isSafeInteger(implementation.version) ||\n implementation.version < 1\n ) {\n throw new TypeError(\"generator version must be a positive safe integer\");\n }\n if (typeof implementation.validateDefinition !== \"function\") {\n throw new TypeError(\"validateDefinition must be a function\");\n }\n if (typeof implementation.generate !== \"function\") {\n throw new TypeError(\"generate must be a function\");\n }\n if (\n implementation.analyzeDependencies !== undefined &&\n typeof implementation.analyzeDependencies !== \"function\"\n ) {\n throw new TypeError(\"analyzeDependencies must be a function when present\");\n }\n}\n\nfunction assertRegistryImplementation(implementation: {\n readonly type: string;\n readonly version: number;\n readonly validateDefinition: unknown;\n readonly analyzeDependencies?: unknown;\n readonly generate: unknown;\n}): void {\n try {\n assertGeneratorImplementation(implementation);\n } catch {\n throw registryError(\n \"INVALID_CONFIGURATION\",\n [\"implementation\"],\n \"Generator implementation is invalid.\",\n );\n }\n if (RESERVED_GENERATOR_TYPE_IDS.has(implementation.type)) {\n throw registryError(\n \"INVALID_CONFIGURATION\",\n [\"type\"],\n `Generator type \"${implementation.type}\" is reserved.`,\n );\n }\n}\n\nfunction freezeImplementation<\n Definition extends GeneratorDefinition<Output>,\n Output,\n>(\n implementation: GeneratorImplementation<Definition, Output>,\n): GeneratorImplementation<Definition, Output> {\n return Object.freeze({ ...implementation });\n}\n\nfunction registryError(\n code: \"DUPLICATE_GENERATOR\" | \"INVALID_CONFIGURATION\" | \"UNKNOWN_GENERATOR\",\n path: ValidationPath,\n message: string,\n): ConstructaError {\n return new ConstructaError({ kind: \"configuration\", code, path, message });\n}\n\nfunction isStableTypeId(value: string): boolean {\n return /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(value);\n}\n"],"mappings":";;AAsEA,MAAM,8CAA8B,IAAI,IAAI;CAC1C;CACA;CACA;AACF,CAAC;;AAGD,SAAgB,iBAAoC;CAClD,MAAM,kCAAkB,IAAI,IAG1B;CAEF,OAAO;EACL,SAAS,gBAAgB;GACvB,6BAA6B,cAAc;GAC3C,IAAI,gBAAgB,IAAI,eAAe,IAAI,GACzC,MAAM,cACJ,uBACA,CAAC,MAAM,GACP,0BAA0B,eAAe,KAAK,yBAChD;GAEF,gBAAgB,IACd,eAAe,MACf,qBACE,cACF,CACF;EACF;EACA,QAAQ,gBAAgB;GACtB,6BAA6B,cAAc;GAC3C,IAAI,CAAC,gBAAgB,IAAI,eAAe,IAAI,GAC1C,MAAM,cACJ,qBACA,CAAC,MAAM,GACP,2BAA2B,eAAe,KAAK,iBACjD;GAEF,gBAAgB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BAM9B;CACP,IAAI,CAAC,eAAe,eAAe,IAAI,GACrC,MAAM,IAAI,UAAU,sDAAsD;CAE5E,IACE,CAAC,OAAO,cAAc,eAAe,OAAO,KAC5C,eAAe,UAAU,GAEzB,MAAM,IAAI,UAAU,mDAAmD;CAEzE,IAAI,OAAO,eAAe,uBAAuB,YAC/C,MAAM,IAAI,UAAU,uCAAuC;CAE7D,IAAI,OAAO,eAAe,aAAa,YACrC,MAAM,IAAI,UAAU,6BAA6B;CAEnD,IACE,eAAe,wBAAwB,KAAA,KACvC,OAAO,eAAe,wBAAwB,YAE9C,MAAM,IAAI,UAAU,qDAAqD;AAE7E;AAEA,SAAS,6BAA6B,gBAM7B;CACP,IAAI;EACF,8BAA8B,cAAc;CAC9C,QAAQ;EACN,MAAM,cACJ,yBACA,CAAC,gBAAgB,GACjB,sCACF;CACF;CACA,IAAI,4BAA4B,IAAI,eAAe,IAAI,GACrD,MAAM,cACJ,yBACA,CAAC,MAAM,GACP,mBAAmB,eAAe,KAAK,eACzC;AAEJ;AAEA,SAAS,qBAIP,gBAC6C;CAC7C,OAAO,OAAO,OAAO,EAAE,GAAG,eAAe,CAAC;AAC5C;AAEA,SAAS,cACP,MACA,MACA,SACiB;CACjB,OAAO,IAAI,gBAAgB;EAAE,MAAM;EAAiB;EAAM;EAAM;CAAQ,CAAC;AAC3E;AAEA,SAAS,eAAe,OAAwB;CAC9C,OAAO,uCAAuC,KAAK,KAAK;AAC1D"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n assertGeneratorDefinition,\n ConstructaError,\n type GeneratorDefinition,\n normalizeConstructaError,\n type ValidationIssue,\n type ValidationPath,\n} from \"constructa-schema\";\n\nexport type {\n GeneratorDefinition,\n Infer,\n ValidationIssue,\n ValidationPath,\n} from \"constructa-schema\";\n\n/**\n * Random values are always half-open: `float()` returns [0, 1), while\n * `integer(maxExclusive)` returns an integer in [0, maxExclusive).\n */\nexport type RandomSource = {\n float(): number;\n integer(maxExclusive: number): number;\n bytes(length: number): Uint8Array;\n};\n\nexport type RandomSourceAdapter = RandomSource;\n\n/**\n * Validates an injected source and guards every produced value. No fallback\n * randomness is used when an adapter violates its contract.\n */\nexport function createRandomSource(adapter: RandomSourceAdapter): RandomSource {\n assertRandomSourceAdapter(adapter);\n\n return Object.freeze({\n float() {\n const value = adapter.float();\n if (\n typeof value !== \"number\" ||\n !Number.isFinite(value) ||\n value < 0 ||\n value >= 1\n ) {\n throw invalidRandomSource(\n \"float() must return a finite number in [0, 1).\",\n );\n }\n return value;\n },\n integer(maxExclusive: number) {\n assertRandomLength(maxExclusive, \"maxExclusive\");\n const value = adapter.integer(maxExclusive);\n if (!Number.isSafeInteger(value) || value < 0 || value >= maxExclusive) {\n throw invalidRandomSource(\n \"integer(maxExclusive) must return a safe integer in [0, maxExclusive).\",\n );\n }\n return value;\n },\n bytes(length: number) {\n assertRandomLength(length, \"length\");\n const value = adapter.bytes(length);\n if (!(value instanceof Uint8Array) || value.length !== length) {\n throw invalidRandomSource(\n \"bytes(length) must return a Uint8Array with exactly length bytes.\",\n );\n }\n return value;\n },\n });\n}\n\n/** Creates the default platform-backed random source. It makes no security claim. */\nexport function createDefaultRandomSource(): RandomSource {\n const crypto = globalThis.crypto;\n if (crypto?.getRandomValues === undefined) {\n throw new ConstructaError({\n kind: \"system\",\n code: \"SYSTEM_RANDOM_UNAVAILABLE\",\n path: [],\n message: \"Platform cryptographic random values are unavailable.\",\n });\n }\n\n const randomBytes = (length: number) => {\n const bytes = new Uint8Array(length);\n for (let offset = 0; offset < length; offset += 65_536) {\n crypto.getRandomValues(bytes.subarray(offset, offset + 65_536));\n }\n return bytes;\n };\n const uint32 = () => new DataView(randomBytes(4).buffer).getUint32(0);\n const uint53 = () => (uint32() & 0x1f_ffff) * 2 ** 32 + uint32();\n\n return createRandomSource({\n float() {\n return uint53() / 2 ** 53;\n },\n integer(maxExclusive: number) {\n const range = 2 ** 53;\n const upperLimit = range - (range % maxExclusive);\n let value = uint53();\n while (value >= upperLimit) value = uint53();\n return value % maxExclusive;\n },\n bytes: randomBytes,\n });\n}\n\n/** Services supplied by the engine. Implementations must not use global randomness. */\nexport type GenerationContext = {\n readonly random: RandomSource;\n readonly generateChild: <Output>(\n definition: GeneratorDefinition<Output>,\n ) => Output;\n};\n\nexport type GeneratorDependency = {\n readonly typeId: string;\n readonly path: ValidationPath;\n};\n\nexport type GeneratorImplementation<\n Definition extends GeneratorDefinition<Output>,\n Output,\n> = {\n readonly type: string;\n readonly version: number;\n readonly validateDefinition: (\n definition: unknown,\n ) => readonly ValidationIssue[];\n readonly analyzeDependencies?: (\n definition: Definition,\n ) => readonly GeneratorDependency[];\n readonly generate: (input: {\n readonly definition: Definition;\n readonly context: GenerationContext;\n }) => Output;\n};\n\nexport type RegisteredGenerator = {\n readonly type: string;\n readonly version: number;\n};\n\nexport type GeneratorRegistrySnapshot = {\n readonly generators: readonly RegisteredGenerator[];\n readonly lookup: (\n type: string,\n path?: ValidationPath,\n ) => GeneratorImplementation<GeneratorDefinition, unknown>;\n};\n\nexport type GeneratorRegistry = {\n register: <Definition extends GeneratorDefinition<Output>, Output>(\n implementation: GeneratorImplementation<Definition, Output>,\n ) => void;\n replace: <Definition extends GeneratorDefinition<Output>, Output>(\n implementation: GeneratorImplementation<Definition, Output>,\n ) => void;\n lookup: (\n type: string,\n path?: ValidationPath,\n ) => GeneratorImplementation<GeneratorDefinition, unknown>;\n snapshot: () => GeneratorRegistrySnapshot;\n};\n\nconst RESERVED_GENERATOR_TYPE_IDS = new Set([\n \"__proto__\",\n \"constructor\",\n \"prototype\",\n]);\n\n/** Creates advanced registry infrastructure. Normal factories do not require it. */\nexport function createRegistry(): GeneratorRegistry {\n const implementations = new Map<\n string,\n GeneratorImplementation<GeneratorDefinition, unknown>\n >();\n\n return {\n register(implementation) {\n assertRegistryImplementation(implementation);\n if (implementations.has(implementation.type)) {\n throw registryError(\n \"DUPLICATE_GENERATOR\",\n [\"type\"],\n `A generator with type \"${implementation.type}\" is already registered.`,\n );\n }\n implementations.set(\n implementation.type,\n freezeImplementation(\n implementation,\n ) as unknown as GeneratorImplementation<GeneratorDefinition, unknown>,\n );\n },\n replace(implementation) {\n assertRegistryImplementation(implementation);\n if (!implementations.has(implementation.type)) {\n throw registryError(\n \"UNKNOWN_GENERATOR\",\n [\"type\"],\n `No generator with type \"${implementation.type}\" is registered.`,\n );\n }\n implementations.set(\n implementation.type,\n freezeImplementation(\n implementation,\n ) as unknown as GeneratorImplementation<GeneratorDefinition, unknown>,\n );\n },\n lookup(type, path = []) {\n return lookupImplementation(implementations, type, path);\n },\n snapshot() {\n return createRegistrySnapshot(implementations);\n },\n };\n}\n\n/**\n * Defines a trusted, developer-authored generator implementation. This API has\n * no dependency on a particular validation library.\n */\nexport function defineGenerator<\n const Definition extends GeneratorDefinition<Output>,\n Output,\n>(\n implementation: GeneratorImplementation<Definition, Output>,\n): GeneratorImplementation<Definition, Output> {\n assertGeneratorImplementation(implementation);\n return implementation;\n}\n\n/** Builds a portable definition while preserving literal fields and output inference. */\nexport function createGeneratorDefinition<\n Output,\n const Definition extends GeneratorDefinition<Output>,\n>(definition: Definition): Definition {\n assertGeneratorDefinition(definition);\n return definition;\n}\n\n/**\n * Invokes one validated implementation. Registry lookup and dispatch are added\n * later; this function keeps validation and execution failure normalization in\n * the same shared contract today.\n */\nexport function invokeGeneratorImplementation<\n Definition extends GeneratorDefinition<Output>,\n Output,\n>(\n implementation: GeneratorImplementation<Definition, Output>,\n input: {\n readonly definition: Definition;\n readonly context: GenerationContext;\n readonly path?: ValidationPath;\n },\n): Output {\n const path = input.path ?? [];\n let issues: readonly ValidationIssue[];\n\n try {\n issues = implementation.validateDefinition(input.definition);\n } catch (cause) {\n throw normalizeConstructaError(cause, {\n kind: \"configuration\",\n code: \"INVALID_CONFIGURATION\",\n path,\n message: \"Generator definition validation failed.\",\n });\n }\n\n if (issues.length > 0) {\n const [issue] = issues;\n if (issue !== undefined) {\n throw new ConstructaError({\n kind: \"configuration\",\n code: \"INVALID_CONFIGURATION\",\n path: [...path, ...issue.path],\n message: issue.message,\n details: { issueCode: issue.code },\n });\n }\n\n throw new ConstructaError({\n kind: \"system\",\n code: \"EXECUTION_FAILED\",\n path,\n message: \"Generator validation returned an invalid result.\",\n });\n }\n\n try {\n return implementation.generate({\n definition: input.definition,\n context: input.context,\n });\n } catch (cause) {\n throw normalizeConstructaError(cause, {\n kind: \"execution\",\n code: \"EXECUTION_FAILED\",\n path,\n message: \"Generator execution failed.\",\n });\n }\n}\n\nfunction assertGeneratorImplementation(implementation: {\n readonly type: string;\n readonly version: number;\n readonly validateDefinition: unknown;\n readonly analyzeDependencies?: unknown;\n readonly generate: unknown;\n}): void {\n if (!isStableTypeId(implementation.type)) {\n throw new TypeError(\"generator type must be a stable lowercase identifier\");\n }\n if (\n !Number.isSafeInteger(implementation.version) ||\n implementation.version < 1\n ) {\n throw new TypeError(\"generator version must be a positive safe integer\");\n }\n if (typeof implementation.validateDefinition !== \"function\") {\n throw new TypeError(\"validateDefinition must be a function\");\n }\n if (typeof implementation.generate !== \"function\") {\n throw new TypeError(\"generate must be a function\");\n }\n if (\n implementation.analyzeDependencies !== undefined &&\n typeof implementation.analyzeDependencies !== \"function\"\n ) {\n throw new TypeError(\"analyzeDependencies must be a function when present\");\n }\n}\n\nfunction assertRegistryImplementation(implementation: {\n readonly type: string;\n readonly version: number;\n readonly validateDefinition: unknown;\n readonly analyzeDependencies?: unknown;\n readonly generate: unknown;\n}): void {\n try {\n assertGeneratorImplementation(implementation);\n } catch {\n throw registryError(\n \"INVALID_CONFIGURATION\",\n [\"implementation\"],\n \"Generator implementation is invalid.\",\n );\n }\n if (RESERVED_GENERATOR_TYPE_IDS.has(implementation.type)) {\n throw registryError(\n \"INVALID_CONFIGURATION\",\n [\"type\"],\n `Generator type \"${implementation.type}\" is reserved.`,\n );\n }\n}\n\nfunction freezeImplementation<\n Definition extends GeneratorDefinition<Output>,\n Output,\n>(\n implementation: GeneratorImplementation<Definition, Output>,\n): GeneratorImplementation<Definition, Output> {\n return Object.freeze({ ...implementation });\n}\n\nfunction createRegistrySnapshot(\n implementations: ReadonlyMap<\n string,\n GeneratorImplementation<GeneratorDefinition, unknown>\n >,\n): GeneratorRegistrySnapshot {\n const snapshotImplementations = new Map(implementations);\n const generators = [...snapshotImplementations.values()]\n .map(({ type, version }) => Object.freeze({ type, version }))\n .sort((left, right) => left.type.localeCompare(right.type));\n\n return Object.freeze({\n generators: Object.freeze(generators),\n lookup(type: string, path: ValidationPath = []) {\n return lookupImplementation(snapshotImplementations, type, path);\n },\n });\n}\n\nfunction lookupImplementation(\n implementations: ReadonlyMap<\n string,\n GeneratorImplementation<GeneratorDefinition, unknown>\n >,\n type: string,\n path: ValidationPath,\n): GeneratorImplementation<GeneratorDefinition, unknown> {\n const implementation = implementations.get(type);\n if (implementation !== undefined) return implementation;\n\n const registeredTypes = [...implementations.keys()].sort((left, right) =>\n left.localeCompare(right),\n );\n throw new ConstructaError({\n kind: \"dependency\",\n code: \"UNKNOWN_GENERATOR\",\n path: [...path, \"type\"],\n message: `No generator with type \"${type}\" is registered.`,\n details: { registeredTypes },\n });\n}\n\nfunction registryError(\n code: \"DUPLICATE_GENERATOR\" | \"INVALID_CONFIGURATION\" | \"UNKNOWN_GENERATOR\",\n path: ValidationPath,\n message: string,\n): ConstructaError {\n return new ConstructaError({ kind: \"configuration\", code, path, message });\n}\n\nfunction assertRandomSourceAdapter(adapter: RandomSourceAdapter): void {\n if (\n typeof adapter !== \"object\" ||\n adapter === null ||\n typeof adapter.float !== \"function\" ||\n typeof adapter.integer !== \"function\" ||\n typeof adapter.bytes !== \"function\"\n ) {\n throw invalidRandomSource(\n \"A random source must provide float(), integer(), and bytes() methods.\",\n );\n }\n}\n\nfunction assertRandomLength(value: number, name: string): void {\n if (!Number.isSafeInteger(value) || value < 1) {\n throw invalidRandomSource(`${name} must be a positive safe integer.`);\n }\n}\n\nfunction invalidRandomSource(message: string): ConstructaError {\n return new ConstructaError({\n kind: \"system\",\n code: \"INVALID_RANDOM_SOURCE\",\n path: [\"random\"],\n message,\n });\n}\n\nfunction isStableTypeId(value: string): boolean {\n return /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(value);\n}\n"],"mappings":";;;;;;AAgCA,SAAgB,mBAAmB,SAA4C;CAC7E,0BAA0B,OAAO;CAEjC,OAAO,OAAO,OAAO;EACnB,QAAQ;GACN,MAAM,QAAQ,QAAQ,MAAM;GAC5B,IACE,OAAO,UAAU,YACjB,CAAC,OAAO,SAAS,KAAK,KACtB,QAAQ,KACR,SAAS,GAET,MAAM,oBACJ,gDACF;GAEF,OAAO;EACT;EACA,QAAQ,cAAsB;GAC5B,mBAAmB,cAAc,cAAc;GAC/C,MAAM,QAAQ,QAAQ,QAAQ,YAAY;GAC1C,IAAI,CAAC,OAAO,cAAc,KAAK,KAAK,QAAQ,KAAK,SAAS,cACxD,MAAM,oBACJ,wEACF;GAEF,OAAO;EACT;EACA,MAAM,QAAgB;GACpB,mBAAmB,QAAQ,QAAQ;GACnC,MAAM,QAAQ,QAAQ,MAAM,MAAM;GAClC,IAAI,EAAE,iBAAiB,eAAe,MAAM,WAAW,QACrD,MAAM,oBACJ,mEACF;GAEF,OAAO;EACT;CACF,CAAC;AACH;;AAGA,SAAgB,4BAA0C;CACxD,MAAM,SAAS,WAAW;CAC1B,IAAI,QAAQ,oBAAoB,KAAA,GAC9B,MAAM,IAAI,gBAAgB;EACxB,MAAM;EACN,MAAM;EACN,MAAM,CAAC;EACP,SAAS;CACX,CAAC;CAGH,MAAM,eAAe,WAAmB;EACtC,MAAM,QAAQ,IAAI,WAAW,MAAM;EACnC,KAAK,IAAI,SAAS,GAAG,SAAS,QAAQ,UAAU,OAC9C,OAAO,gBAAgB,MAAM,SAAS,QAAQ,SAAS,KAAM,CAAC;EAEhE,OAAO;CACT;CACA,MAAM,eAAe,IAAI,SAAS,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CA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F;AAEJ;AAEA,SAAS,mBAAmB,OAAe,MAAoB;CAC7D,IAAI,CAAC,OAAO,cAAc,KAAK,KAAK,QAAQ,GAC1C,MAAM,oBAAoB,GAAG,KAAK,kCAAkC;AAExE;AAEA,SAAS,oBAAoB,SAAkC;CAC7D,OAAO,IAAI,gBAAgB;EACzB,MAAM;EACN,MAAM;EACN,MAAM,CAAC,QAAQ;EACf;CACF,CAAC;AACH;AAEA,SAAS,eAAe,OAAwB;CAC9C,OAAO,uCAAuC,KAAK,KAAK;AAC1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "constructa-core",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "The UI-agnostic Constructa generator execution engine.",
5
5
  "private": false,
6
6
  "license": "MIT",