@metamesh/testkit 0.16.0 → 0.18.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +191 -0
  2. package/README.md +122 -88
  3. package/dist/assertions.d.ts +8 -15
  4. package/dist/assertions.d.ts.map +1 -1
  5. package/dist/assertions.js +24 -70
  6. package/dist/assertions.js.map +1 -1
  7. package/dist/content-assertions.d.ts +28 -0
  8. package/dist/content-assertions.d.ts.map +1 -0
  9. package/dist/content-assertions.js +75 -0
  10. package/dist/content-assertions.js.map +1 -0
  11. package/dist/content-matchers.d.ts +12 -0
  12. package/dist/content-matchers.d.ts.map +1 -0
  13. package/dist/content-matchers.js +22 -0
  14. package/dist/content-matchers.js.map +1 -0
  15. package/dist/docs/guides/package.md +122 -88
  16. package/dist/docs/manifest.json +175 -35
  17. package/dist/docs/reference/font-fixtures/LoadedFontFixtures.md +1 -1
  18. package/dist/docs/reference/font-fixtures/loadFontFixtureServices.md +1 -1
  19. package/dist/docs/reference/font-fixtures/loadFontFixtures.md +1 -1
  20. package/dist/docs/reference/fonts/FontTestFixture.md +1 -1
  21. package/dist/docs/reference/fonts/prepareFontTestServices.md +1 -1
  22. package/dist/docs/reference/index/BufferContent.md +13 -0
  23. package/dist/docs/reference/index/ContentMismatchError.md +12 -0
  24. package/dist/docs/reference/index/GeneratorModelTestInput.md +13 -0
  25. package/dist/docs/reference/index/GeneratorModelTestOptions.md +10 -0
  26. package/dist/docs/reference/index/GeneratorTestResult.md +18 -0
  27. package/dist/docs/reference/index/GeneratorTestRunner.md +9 -9
  28. package/dist/docs/reference/index/GeneratorTestRunnerOptions.md +2 -3
  29. package/dist/docs/reference/index/MeshContent.md +13 -0
  30. package/dist/docs/reference/index/MeshMeasurementExpectation.md +3 -3
  31. package/dist/docs/reference/index/MeshMeasurementTolerances.md +1 -1
  32. package/dist/docs/reference/index/RunModelOptions.md +13 -0
  33. package/dist/docs/reference/index/assertEqualBuffer.md +15 -0
  34. package/dist/docs/reference/index/assertEqualMesh.md +14 -0
  35. package/dist/docs/reference/index/{expectMeshMeasurements.md → assertMeshMeasurements.md} +3 -3
  36. package/dist/docs/reference/index/{expectValidDefaults.md → assertValidDefaults.md} +3 -3
  37. package/dist/docs/reference/index/assertValidDefinition.md +10 -0
  38. package/dist/docs/reference/index/assertValidParts.md +12 -0
  39. package/dist/docs/reference/index/{expectValidPresets.md → assertValidPresets.md} +3 -3
  40. package/dist/docs/reference/index/contentMatchers.md +12 -0
  41. package/dist/docs/reference/index/createGeneratorTestRunner.md +2 -4
  42. package/dist/docs/reference/index/getTestEngine.md +1 -1
  43. package/dist/docs/reference/index/runModel.md +13 -0
  44. package/dist/generator-execution.d.ts +6 -0
  45. package/dist/generator-execution.d.ts.map +1 -0
  46. package/dist/generator-execution.js +20 -0
  47. package/dist/generator-execution.js.map +1 -0
  48. package/dist/generator-test-runner.d.ts +32 -0
  49. package/dist/generator-test-runner.d.ts.map +1 -0
  50. package/dist/generator-test-runner.js +109 -0
  51. package/dist/generator-test-runner.js.map +1 -0
  52. package/dist/index.d.ts +10 -5
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +7 -4
  55. package/dist/index.js.map +1 -1
  56. package/dist/measurements.d.ts +4 -4
  57. package/dist/measurements.d.ts.map +1 -1
  58. package/dist/measurements.js +10 -9
  59. package/dist/measurements.js.map +1 -1
  60. package/dist/run-model.d.ts +21 -0
  61. package/dist/run-model.d.ts.map +1 -0
  62. package/dist/run-model.js +39 -0
  63. package/dist/run-model.js.map +1 -0
  64. package/dist/{engine.d.ts → test-engine.d.ts} +1 -1
  65. package/dist/test-engine.d.ts.map +1 -0
  66. package/dist/{engine.js → test-engine.js} +1 -1
  67. package/dist/test-engine.js.map +1 -0
  68. package/package.json +8 -5
  69. package/dist/docs/reference/index/GeneratorTestExecution.md +0 -19
  70. package/dist/docs/reference/index/expectSerializableDefinition.md +0 -10
  71. package/dist/docs/reference/index/expectValidParts.md +0 -19
  72. package/dist/engine.d.ts.map +0 -1
  73. package/dist/engine.js.map +0 -1
  74. package/dist/runner.d.ts +0 -36
  75. package/dist/runner.d.ts.map +0 -1
  76. package/dist/runner.js +0 -121
  77. package/dist/runner.js.map +0 -1
@@ -1,10 +1,10 @@
1
- # expectValidPresets
1
+ # assertValidPresets
2
2
 
3
3
  Checks preset metadata. Validate domain assertions through the generation test runner.
4
4
 
5
- Import from `@metamesh/testkit` (@metamesh/testkit@0.16.0).
5
+ Import from `@metamesh/testkit` (@metamesh/testkit@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** Checks preset metadata. Validate domain assertions through the generation test runner. */
9
- export declare function expectValidPresets<const D extends GeneratorDefinition>(definition: D, presets: readonly GeneratorPreset<D>[]): void;
9
+ export declare function assertValidPresets<const D extends GeneratorDefinition>(definition: D, presets: readonly GeneratorPreset<D>[]): void;
10
10
  ```
@@ -0,0 +1,12 @@
1
+ # contentMatchers
2
+
3
+ Optional expect.extend adapters; only content mismatches become failed matcher results.
4
+
5
+ Import from `@metamesh/testkit` (@metamesh/testkit@0.18.0).
6
+
7
+ ```ts
8
+ contentMatchers: {
9
+ toEqualBuffer(received: BufferContent, expected: BufferContent): ContentMatcherResult;
10
+ toEqualMesh(received: MeshContent, expected: MeshContent): ContentMatcherResult;
11
+ }
12
+ ```
@@ -2,11 +2,9 @@
2
2
 
3
3
  Creates a lazy runner for one generation program without loading assets or an engine.
4
4
 
5
- Import from `@metamesh/testkit` (@metamesh/testkit@0.16.0).
5
+ Import from `@metamesh/testkit` (@metamesh/testkit@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** Creates a lazy runner for one generation program without loading assets or an engine. */
9
- export declare function createGeneratorTestRunner<const D extends GeneratorDefinition>(definition: D, runtime: {
10
- readonly generate: ModelProgram<GeneratorParams<D>, GeneratorServices>;
11
- }, options?: GeneratorTestRunnerOptions<NoInfer<D>>): GeneratorTestRunner<D>;
9
+ export declare function createGeneratorTestRunner<const D extends GeneratorDefinition>(definition: D, runtime: ModelProgram<GeneratorParams<D>, GeneratorServices>, options?: GeneratorTestRunnerOptions<NoInfer<D>>): GeneratorTestRunner<D>;
12
10
  ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  Returns the shared test engine, initializing it only on first request. Runner construction does not call this function.
4
4
 
5
- Import from `@metamesh/testkit` (@metamesh/testkit@0.16.0).
5
+ Import from `@metamesh/testkit` (@metamesh/testkit@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /**
@@ -0,0 +1,13 @@
1
+ # runModel
2
+
3
+ Runs a model program or synchronous callback once and returns durable immutable data. Strictly validates Generator inputs (defaults when omitted), prepares services, and returns durable data.
4
+
5
+ Import from `@metamesh/testkit` (@metamesh/testkit@0.18.0).
6
+
7
+ ```ts
8
+ /** Runs a model program or synchronous callback once and returns durable immutable data. */
9
+ export declare function runModel<P extends object = Record<never, never>, S = Record<never, never>>(source: ModelProgram<P, S> | GenerateCallback<P, S>, ...args: ModelRunArguments<P, S, RunModelOptions<S>>): Promise<ModelResult>;
10
+
11
+ /** Strictly validates Generator inputs (defaults when omitted), prepares services, and returns durable data. */
12
+ export declare function runModel<const D extends GeneratorDefinition>(source: GeneratorModelTestInput<D>, parameters?: GeneratorParams<NoInfer<D>>, options?: GeneratorModelTestOptions<NoInfer<D>>): Promise<ModelResult>;
13
+ ```
@@ -0,0 +1,6 @@
1
+ import { type GeneratorDefinition, type GeneratorParams, type GeneratorServices, type ParameterValidationResult } from "@metamesh/generator-sdk";
2
+ /** @internal Shared asynchronous host preparation for isolated and persistent execution. */
3
+ export declare function prepareGeneratorServices<D extends GeneratorDefinition>(definition: D, parameters: GeneratorParams<D>, prepareServices?: (definition: D, parameters: GeneratorParams<D>) => GeneratorServices | Promise<GeneratorServices>): Promise<GeneratorServices>;
4
+ /** @internal Translates expected domain failures while preserving unexpected author/host errors. */
5
+ export declare function generatorFailure(definition: GeneratorDefinition, error: unknown): ParameterValidationResult;
6
+ //# sourceMappingURL=generator-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-execution.d.ts","sourceRoot":"","sources":["../src/generator-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AAIjC,4FAA4F;AAC5F,wBAAsB,wBAAwB,CAAC,CAAC,SAAS,mBAAmB,EAC1E,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,EAC9B,eAAe,CAAC,EAAE,CAChB,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,KAC3B,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAClD,OAAO,CAAC,iBAAiB,CAAC,CAQ5B;AAED,oGAAoG;AACpG,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,mBAAmB,EAC/B,KAAK,EAAE,OAAO,GACb,yBAAyB,CAI3B"}
@@ -0,0 +1,20 @@
1
+ import { UNPREPARED_GENERATOR_SERVICES, } from "@metamesh/generator-sdk";
2
+ import { aggregateParameterIssues } from "@metamesh/generator-sdk/parameters";
3
+ import { generationIssues } from "@metamesh/generator-sdk/runtime";
4
+ /** @internal Shared asynchronous host preparation for isolated and persistent execution. */
5
+ export async function prepareGeneratorServices(definition, parameters, prepareServices) {
6
+ if (prepareServices !== undefined)
7
+ return prepareServices(definition, parameters);
8
+ if (definition.parameters.some((parameter) => parameter.type === "font")) {
9
+ throw new Error(`Generator "${definition.id}" declares Font parameters. Pass a prepareServices fixture provider.`);
10
+ }
11
+ return UNPREPARED_GENERATOR_SERVICES;
12
+ }
13
+ /** @internal Translates expected domain failures while preserving unexpected author/host errors. */
14
+ export function generatorFailure(definition, error) {
15
+ const issues = generationIssues(definition, error);
16
+ if (issues === undefined || !issues.some(({ severity }) => severity === "error"))
17
+ throw error;
18
+ return aggregateParameterIssues(issues);
19
+ }
20
+ //# sourceMappingURL=generator-execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-execution.js","sourceRoot":"","sources":["../src/generator-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,GAK9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,4FAA4F;AAC5F,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,UAAa,EACb,UAA8B,EAC9B,eAGmD;IAEnD,IAAI,eAAe,KAAK,SAAS;QAAE,OAAO,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAClF,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,KAAK,CACb,cAAc,UAAU,CAAC,EAAE,sEAAsE,CAClG,CAAC;IACJ,CAAC;IACD,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,gBAAgB,CAC9B,UAA+B,EAC/B,KAAc;IAEd,MAAM,MAAM,GAAG,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACnD,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,OAAO,CAAC;QAAE,MAAM,KAAK,CAAC;IAC9F,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { type GeneratorDefinition, type GeneratorParams, type GeneratorServices, type ParameterValidationResult } from "@metamesh/generator-sdk";
2
+ import type { ModelProgram } from "@metamesh/modeling";
3
+ import { type ModelEngine, type ModelResult, type SessionOptions } from "@metamesh/modeling/engine";
4
+ /** Fixed host resources and optional asynchronous asset preparation. */
5
+ export interface GeneratorTestRunnerOptions<D extends GeneratorDefinition> extends Omit<SessionOptions<GeneratorServices>, "services"> {
6
+ readonly prepareServices?: (definition: D, parameters: GeneratorParams<D>) => GeneratorServices | Promise<GeneratorServices>;
7
+ readonly engine?: ModelEngine;
8
+ }
9
+ /** Parameter or assertion failure, or a durable immutable model result. */
10
+ export type GeneratorTestResult<D extends GeneratorDefinition> = {
11
+ readonly type: "invalid";
12
+ readonly validation: ParameterValidationResult;
13
+ } | {
14
+ readonly type: "generated";
15
+ readonly parameters: GeneratorParams<D>;
16
+ readonly validation: ParameterValidationResult;
17
+ readonly model: ModelResult;
18
+ };
19
+ /** A lazy reusable Generator test session; dispose only the runner's caches. */
20
+ export interface GeneratorTestRunner<D extends GeneratorDefinition> {
21
+ /** Checks declarations and assertions only. Set `validateInput: false` to probe deliberately invalid typed values. */
22
+ readonly check: (parameters: GeneratorParams<D>, options?: {
23
+ readonly validateInput?: boolean;
24
+ }) => Promise<ParameterValidationResult>;
25
+ /** Strictly validates inputs, prepares assets, and executes a persistent session. */
26
+ readonly run: (parameters: Readonly<Record<string, unknown>>) => Promise<GeneratorTestResult<D>>;
27
+ /** Releases runner caches; previously returned results remain valid. */
28
+ readonly dispose: () => void;
29
+ }
30
+ /** Creates a lazy runner for one generation program without loading assets or an engine. */
31
+ export declare function createGeneratorTestRunner<const D extends GeneratorDefinition>(definition: D, runtime: ModelProgram<GeneratorParams<D>, GeneratorServices>, options?: GeneratorTestRunnerOptions<NoInfer<D>>): GeneratorTestRunner<D>;
32
+ //# sourceMappingURL=generator-test-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-test-runner.d.ts","sourceRoot":"","sources":["../src/generator-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC/B,MAAM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E,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IACjG,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,4FAA4F;AAC5F,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EAC3E,UAAU,EAAE,CAAC,EACb,OAAO,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,EAC5D,OAAO,GAAE,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAM,GACnD,mBAAmB,CAAC,CAAC,CAAC,CA+GxB"}
@@ -0,0 +1,109 @@
1
+ import {} from "@metamesh/generator-sdk";
2
+ import { aggregateParameterIssues, createParamCodec, parseParameterIssues, } from "@metamesh/generator-sdk/parameters";
3
+ import { canonicalizeParameters } from "@metamesh/generator-sdk/runtime";
4
+ import { checkModel, } from "@metamesh/modeling/engine";
5
+ import { isGeometryError } from "@metamesh/modeling/geometry";
6
+ import { generatorFailure, prepareGeneratorServices } from "./generator-execution.js";
7
+ import { getTestEngine } from "./test-engine.js";
8
+ /** Creates a lazy runner for one generation program without loading assets or an engine. */
9
+ export function createGeneratorTestRunner(definition, runtime, options = {}) {
10
+ const { engine: providedEngine, prepareServices, ...policy } = options;
11
+ let session;
12
+ let sessionServices;
13
+ let assetKey;
14
+ let previous;
15
+ let disposed = false;
16
+ const assertActive = () => {
17
+ if (disposed)
18
+ throw new Error("Generator test runner has been disposed.");
19
+ };
20
+ async function withSession(parameters, capabilities, run) {
21
+ assertActive();
22
+ const engine = providedEngine ?? (await getTestEngine());
23
+ assertActive();
24
+ const key = JSON.stringify(definition.parameters
25
+ .filter((parameter) => parameter.type === "font")
26
+ .map(({ id }) => parameters[id]));
27
+ if (session === undefined || assetKey !== key || sessionServices !== capabilities) {
28
+ session?.dispose();
29
+ session = undefined;
30
+ session = engine.createSession(runtime, {
31
+ ...policy,
32
+ services: capabilities,
33
+ });
34
+ assetKey = key;
35
+ sessionServices = capabilities;
36
+ }
37
+ // Selection and execution stay synchronous: another prepared request may replace this session.
38
+ return run(session);
39
+ }
40
+ function canonical(parameters) {
41
+ const result = canonicalizeParameters(parameters, previous);
42
+ previous = result;
43
+ return result;
44
+ }
45
+ async function run(parameters) {
46
+ assertActive();
47
+ const state = createParamCodec(definition).safeParse(parameters);
48
+ if (!state.success)
49
+ return Object.freeze({ type: "invalid", validation: aggregateParameterIssues(state.issues) });
50
+ const params = canonical(state.data);
51
+ try {
52
+ const capabilities = await prepareGeneratorServices(definition, params, prepareServices);
53
+ const model = await withSession(params, capabilities, (active) => active.run(params));
54
+ const validation = aggregateParameterIssues(parseParameterIssues(definition, model.diagnostics));
55
+ return Object.freeze({ type: "generated", parameters: params, validation, model });
56
+ }
57
+ catch (error) {
58
+ return Object.freeze({
59
+ type: "invalid",
60
+ validation: generatorFailure(definition, error),
61
+ });
62
+ }
63
+ }
64
+ return Object.freeze({
65
+ async check(parameters, probe = {}) {
66
+ assertActive();
67
+ const state = probe.validateInput === false
68
+ ? { success: true, data: parameters }
69
+ : createParamCodec(definition).safeParse(parameters);
70
+ if (!state.success)
71
+ return aggregateParameterIssues(state.issues);
72
+ try {
73
+ const params = canonical(state.data);
74
+ const capabilities = await prepareGeneratorServices(definition, params, prepareServices);
75
+ assertActive();
76
+ let issues;
77
+ try {
78
+ issues =
79
+ providedEngine === undefined
80
+ ? checkModel(runtime, params, {
81
+ services: capabilities,
82
+ ...policy,
83
+ })
84
+ : await withSession(params, capabilities, (active) => active.check(params));
85
+ }
86
+ catch (error) {
87
+ if (!isGeometryError(error) ||
88
+ error.context?.operation !== "checkModel" ||
89
+ error.context.details?.["requiresKernel"] !== true)
90
+ throw error;
91
+ issues = await withSession(params, capabilities, (active) => active.check(params));
92
+ }
93
+ return aggregateParameterIssues(parseParameterIssues(definition, issues));
94
+ }
95
+ catch (error) {
96
+ return generatorFailure(definition, error);
97
+ }
98
+ },
99
+ run,
100
+ dispose() {
101
+ disposed = true;
102
+ session?.dispose();
103
+ session = undefined;
104
+ sessionServices = undefined;
105
+ previous = undefined;
106
+ },
107
+ });
108
+ }
109
+ //# sourceMappingURL=generator-test-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-test-runner.js","sourceRoot":"","sources":["../src/generator-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EACL,UAAU,GAKX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAwCjD,4FAA4F;AAC5F,MAAM,UAAU,yBAAyB,CACvC,UAAa,EACb,OAA4D,EAC5D,UAAkD,EAAE;IAEpD,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IACvE,IAAI,OAAqD,CAAC;IAC1D,IAAI,eAA8C,CAAC;IACnD,IAAI,QAA4B,CAAC;IACjC,IAAI,QAAwC,CAAC;IAC7C,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,IAAI,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC5E,CAAC,CAAC;IAEF,KAAK,UAAU,WAAW,CACxB,UAA8B,EAC9B,YAA+B,EAC/B,GAAgE;QAEhE,YAAY,EAAE,CAAC;QACf,MAAM,MAAM,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,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,12 @@
1
- export { createGeneratorTestRunner } from "./runner.js";
2
- export type { GeneratorTestExecution, GeneratorTestRunner, GeneratorTestRunnerOptions, } from "./runner.js";
3
- export { expectSerializableDefinition, expectValidDefaults, expectValidParts, expectValidPresets, } from "./assertions.js";
4
- export { getTestEngine } from "./engine.js";
5
- export { expectMeshMeasurements } from "./measurements.js";
1
+ export { createGeneratorTestRunner } from "./generator-test-runner.js";
2
+ export { runModel } from "./run-model.js";
3
+ export type { GeneratorModelTestInput, GeneratorModelTestOptions, RunModelOptions, } from "./run-model.js";
4
+ export type { GeneratorTestResult, GeneratorTestRunner, GeneratorTestRunnerOptions, } from "./generator-test-runner.js";
5
+ export { assertValidDefinition, assertValidDefaults, assertValidParts, assertValidPresets, } from "./assertions.js";
6
+ export { getTestEngine } from "./test-engine.js";
7
+ export { assertMeshMeasurements } from "./measurements.js";
6
8
  export type { MeshMeasurementExpectation, MeshMeasurementTolerances } from "./measurements.js";
9
+ export { assertEqualBuffer, assertEqualMesh, ContentMismatchError } from "./content-assertions.js";
10
+ export type { BufferContent, MeshContent } from "./content-assertions.js";
11
+ export { contentMatchers } from "./content-matchers.js";
7
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,YAAY,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EACV,uBAAuB,EACvB,yBAAyB,EACzB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,YAAY,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACnG,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
- export { createGeneratorTestRunner } from "./runner.js";
2
- export { expectSerializableDefinition, expectValidDefaults, expectValidParts, expectValidPresets, } from "./assertions.js";
3
- export { getTestEngine } from "./engine.js";
4
- export { expectMeshMeasurements } from "./measurements.js";
1
+ export { createGeneratorTestRunner } from "./generator-test-runner.js";
2
+ export { runModel } from "./run-model.js";
3
+ export { assertValidDefinition, assertValidDefaults, assertValidParts, assertValidPresets, } from "./assertions.js";
4
+ export { getTestEngine } from "./test-engine.js";
5
+ export { assertMeshMeasurements } from "./measurements.js";
6
+ export { assertEqualBuffer, assertEqualMesh, ContentMismatchError } from "./content-assertions.js";
7
+ export { contentMatchers } from "./content-matchers.js";
5
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAMxD,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAW1C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type Bounds3Data, type TriangleMesh, type TriangleMeshAnalysis } from "@metamesh/modeling/geometry";
1
+ import { type Bounds3Data, type TriangleMeshAnalysis, type TriangleMeshInput } from "@metamesh/modeling/geometry";
2
2
  /** Physical expectations for a closed mesh; omitted facts are not asserted. */
3
3
  export interface MeshMeasurementExpectation {
4
4
  /** Axis-aligned XYZ bounds in millimetres. */
@@ -7,8 +7,8 @@ export interface MeshMeasurementExpectation {
7
7
  readonly signedVolume?: number;
8
8
  /** Sum of triangle areas in square millimetres. */
9
9
  readonly surfaceArea?: number;
10
- /** Exact number of components connected by indexed mesh edges. */
11
- readonly connectedComponentCount?: number;
10
+ /** Exact number of surface shells connected by shared indexed edges. */
11
+ readonly shellCount?: number;
12
12
  }
13
13
  /** Absolute nonnegative comparison allowances; each omitted tolerance defaults to zero. */
14
14
  export interface MeshMeasurementTolerances {
@@ -24,5 +24,5 @@ export interface MeshMeasurementTolerances {
24
24
  * facts with explicit absolute tolerances. Returns fresh measurements without initializing an
25
25
  * engine. These facts do not prove geometric equivalence or absence of self-intersections.
26
26
  */
27
- export declare function expectMeshMeasurements(mesh: TriangleMesh, expected: MeshMeasurementExpectation, tolerances?: MeshMeasurementTolerances): TriangleMeshAnalysis;
27
+ export declare function assertMeshMeasurements(triangleMesh: TriangleMeshInput, expected: MeshMeasurementExpectation, tolerances?: MeshMeasurementTolerances): TriangleMeshAnalysis;
28
28
  //# sourceMappingURL=measurements.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"measurements.d.ts","sourceRoot":"","sources":["../src/measurements.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AAErC,+EAA+E;AAC/E,MAAM,WAAW,0BAA0B;IACzC,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAC3C;AAED,2FAA2F;AAC3F,MAAM,WAAW,yBAAyB;IACxC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,wDAAwD;IACxD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAaD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,0BAA0B,EACpC,UAAU,GAAE,yBAA8B,GACzC,oBAAoB,CAqDtB"}
1
+ {"version":3,"file":"measurements.d.ts","sourceRoot":"","sources":["../src/measurements.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAGrC,+EAA+E;AAC/E,MAAM,WAAW,0BAA0B;IACzC,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,2FAA2F;AAC3F,MAAM,WAAW,yBAAyB;IACxC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,wDAAwD;IACxD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAaD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,iBAAiB,EAC/B,QAAQ,EAAE,0BAA0B,EACpC,UAAU,GAAE,yBAA8B,GACzC,oBAAoB,CAqDtB"}
@@ -1,4 +1,5 @@
1
- import { analyzeTriangleMesh, } from "@metamesh/modeling/geometry";
1
+ import {} from "@metamesh/modeling/geometry";
2
+ import * as mesh from "@metamesh/modeling/geometry/mesh";
2
3
  function finite(value, label) {
3
4
  if (!Number.isFinite(value))
4
5
  throw new TypeError(`${label} must be finite.`);
@@ -14,11 +15,11 @@ function within(actual, expected, tolerance, label) {
14
15
  * facts with explicit absolute tolerances. Returns fresh measurements without initializing an
15
16
  * engine. These facts do not prove geometric equivalence or absence of self-intersections.
16
17
  */
17
- export function expectMeshMeasurements(mesh, expected, tolerances = {}) {
18
+ export function assertMeshMeasurements(triangleMesh, expected, tolerances = {}) {
18
19
  if (expected.bounds === undefined &&
19
20
  expected.signedVolume === undefined &&
20
21
  expected.surfaceArea === undefined &&
21
- expected.connectedComponentCount === undefined) {
22
+ expected.shellCount === undefined) {
22
23
  throw new TypeError("Provide at least one mesh measurement expectation.");
23
24
  }
24
25
  for (const metric of ["bounds", "signedVolume", "surfaceArea"]) {
@@ -29,9 +30,9 @@ export function expectMeshMeasurements(mesh, expected, tolerances = {}) {
29
30
  throw new TypeError(`${metric} tolerance must be nonnegative.`);
30
31
  }
31
32
  }
32
- const facts = analyzeTriangleMesh(mesh, {
33
+ const facts = mesh.analyze(triangleMesh, {
33
34
  requireClosed: true,
34
- includeTopology: expected.connectedComponentCount !== undefined,
35
+ includeTopology: expected.shellCount !== undefined,
35
36
  });
36
37
  if (expected.bounds !== undefined) {
37
38
  for (const end of ["min", "max"]) {
@@ -54,12 +55,12 @@ export function expectMeshMeasurements(mesh, expected, tolerances = {}) {
54
55
  throw new TypeError("Expected surfaceArea must be nonnegative.");
55
56
  within(facts.surfaceArea, expected.surfaceArea, tolerances.surfaceArea ?? 0, "surfaceArea");
56
57
  }
57
- if (expected.connectedComponentCount !== undefined) {
58
- const count = expected.connectedComponentCount;
58
+ if (expected.shellCount !== undefined) {
59
+ const count = expected.shellCount;
59
60
  if (!Number.isSafeInteger(count) || count < 1) {
60
- throw new TypeError("Expected connectedComponentCount must be a positive safe integer.");
61
+ throw new TypeError("Expected shellCount must be a positive safe integer.");
61
62
  }
62
- within(facts.connectedComponentCount, count, 0, "connectedComponentCount");
63
+ within(facts.shellCount, count, 0, "shellCount");
63
64
  }
64
65
  return facts;
65
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"measurements.js","sourceRoot":"","sources":["../src/measurements.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAIpB,MAAM,6BAA6B,CAAC;AAwBrC,SAAS,MAAM,CAAC,KAAa,EAAE,KAAa;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,kBAAkB,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,SAAiB,EAAE,KAAa;IAChF,MAAM,CAAC,QAAQ,EAAE,YAAY,KAAK,EAAE,CAAC,CAAC;IACtC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,SAAS,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,cAAc,QAAQ,MAAM,SAAS,cAAc,MAAM,GAAG,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAkB,EAClB,QAAoC,EACpC,aAAwC,EAAE;IAE1C,IACE,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC7B,QAAQ,CAAC,YAAY,KAAK,SAAS;QACnC,QAAQ,CAAC,WAAW,KAAK,SAAS;QAClC,QAAQ,CAAC,uBAAuB,KAAK,SAAS,EAC9C,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAC;IAC5E,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,CAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAU,EAAE,CAAC;QACxE,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,SAAS,KAAK,SAAS,EAAE,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C,EAAE,CAAC;YAC9C,MAAM,IAAI,SAAS,CAAC,sDAAsD,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,UAAW,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { GeneratorDefinition, GeneratorParams, GeneratorServices } from "@metamesh/generator-sdk";
2
+ import { type GenerateCallback, type ModelProgram } from "@metamesh/modeling";
3
+ import type { ModelEngine, ModelResult, ModelRunArguments, ModelRunOptions } from "@metamesh/modeling/engine";
4
+ import type { GeneratorTestRunnerOptions } from "./generator-test-runner.js";
5
+ /** Host policy and prepared services for an isolated model run; the engine remains host-owned. */
6
+ export interface RunModelOptions<S = Record<never, never>> extends ModelRunOptions<S> {
7
+ /** Reuse a test-owned engine; omitted uses the lazy shared test engine. */
8
+ readonly engine?: ModelEngine;
9
+ }
10
+ /** Definition and executable runtime needed to validate and prepare a Generator. */
11
+ export interface GeneratorModelTestInput<D extends GeneratorDefinition> {
12
+ readonly definition: D;
13
+ readonly runtime: ModelProgram<GeneratorParams<D>, GeneratorServices>;
14
+ }
15
+ /** Generation policy, optional test-owned engine, and asynchronous Generator asset preparation. */
16
+ export type GeneratorModelTestOptions<D extends GeneratorDefinition> = Omit<GeneratorTestRunnerOptions<D>, "cache" | "verifyCache">;
17
+ /** Runs a model program or synchronous callback once and returns durable immutable data. */
18
+ export declare function runModel<P extends object = Record<never, never>, S = Record<never, never>>(source: ModelProgram<P, S> | GenerateCallback<P, S>, ...args: ModelRunArguments<P, S, RunModelOptions<S>>): Promise<ModelResult>;
19
+ /** Strictly validates Generator inputs (defaults when omitted), prepares services, and returns durable data. */
20
+ export declare function runModel<const D extends GeneratorDefinition>(source: GeneratorModelTestInput<D>, parameters?: GeneratorParams<NoInfer<D>>, options?: GeneratorModelTestOptions<NoInfer<D>>): Promise<ModelResult>;
21
+ //# sourceMapp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AC,EACnD,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,GACnD,OAAO,CAAC,WAAW,CAAC,CAAC;AAExB,gHAAgH;AAChH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EAC1D,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAClC,UAAU,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EACxC,OAAO,CAAC,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAC9C,OAAO,CAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { createParamCodec, getDefaultParameters } from "@metamesh/generator-sdk/parameters";
2
+ import { generate, GenerationError, } from "@metamesh/modeling";
3
+ import { generatorFailure, prepareGeneratorServices } from "./generator-execution.js";
4
+ import { getTestEngine } from "./test-engine.js";
5
+ export async function runModel(source, parameters, options = {}) {
6
+ if (typeof source === "function" ||
7
+ (source !== null &&
8
+ typeof source === "object" &&
9
+ "kind" in source &&
10
+ source.kind === "metamesh-model")) {
11
+ const { engine: providedEngine, ...policy } = options;
12
+ const engine = providedEngine ?? (await getTestEngine());
13
+ const program = typeof source === "function" ? generate(source) : source;
14
+ return engine.run(program, ...[parameters, policy]);
15
+ }
16
+ if (!source ||
17
+ typeof source !== "object" ||
18
+ !("definition" in source) ||
19
+ !("runtime" in source)) {
20
+ throw new TypeError("runModel requires a model program, generation callback, or { definition, runtime }.");
21
+ }
22
+ const { definition, runtime } = source;
23
+ const { engine: providedEngine, prepareServices, ...policy } = options;
24
+ const state = createParamCodec(definition).safeParse(parameters === undefined ? getDefaultParameters(definition) : parameters);
25
+ if (!state.success)
26
+ throw new GenerationError(state.issues);
27
+ try {
28
+ const services = await prepareGeneratorServices(definition, state.data, prepareServices);
29
+ const engine = providedEngine ?? (await getTestEngine());
30
+ return engine.run(runtime, state.data, {
31
+ ...policy,
32
+ services,
33
+ });
34
+ }
35
+ catch (error) {
36
+ throw new GenerationError(generatorFailure(definition, error).issues);
37
+ }
38
+ }
39
+ //# sourceMappingURL=run-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-model.js","sourceRoot":"","sources":["../src/run-model.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EACL,QAAQ,EACR,eAAe,GAGhB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEtF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAiCjD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAAgF,EAChF,UAA4D,EAC5D,UAA6D,EAAE;IAE/D,IACE,OAAO,MAAM,KAAK,UAAU;QAC5B,CAAC,MAAM,KAAK,IAAI;YACd,OAAO,MAAM,KAAK,QAAQ;YAC1B,MAAM,IAAI,MAAM;YAChB,MAAM,CAAC,IAAI,KAAK,gBAAgB,CAAC,EACnC,CAAC;QACD,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,GAAG,OAA6B,CAAC;QAC5E,MAAM,MAAM,GAAG,cAAc,IAAI,CAAC,MAAM,aAAa,EAAE,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACzE,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,GAAI,CAAC,UAAU,EAAE,MAAM,CAA6B,CAAC,CAAC;IACnF,CAAC;IAED,IACE,CAAC,MAAM;QACP,OAAO,MAAM,KAAK,QAAQ;QAC1B,CAAC,CAAC,YAAY,IAAI,MAAM,CAAC;QACzB,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EACtB,CAAC;QACD,MAAM,IAAI,SAAS,CACjB,qFAAqF,CACtF,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACvC,MAAM,EACJ,MAAM,EAAE,cAAc,EACtB,eAAe,EACf,GAAG,MAAM,EACV,GAAG,OAAuC,CAAC;IAC5C,MAAM,KAAK,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC,SAAS,CAClD,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CACzE,CAAC;IACF,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,MAAM,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACzF,MAAM,MAAM,GAAG,cAAc,IAAI,CAAC,MAAM,aAAa,EAAE,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC,GAAG,CAAwC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE;YAC5E,GAAG,MAAM;YACT,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,eAAe,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
@@ -4,4 +4,4 @@ import { type ModelEngine } from "@metamesh/modeling/engine";
4
4
  * Runner construction does not call this function.
5
5
  */
6
6
  export declare function getTestEngine(): Promise<ModelEngine>;
7
- //# sourceMappingURL=engine.d.ts.map
7
+ //# sourceMappingURL=test-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-engine.d.ts","sourceRoot":"","sources":["../src/test-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAIhF;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC,CAGpD"}
@@ -8,4 +8,4 @@ export function getTestEngine() {
8
8
  testEngine ??= createModelEngine();
9
9
  return testEngine;
10
10
  }
11
- //# sourceMappingURL=engine.js.map
11
+ //# sourceMappingURL=test-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-engine.js","sourceRoot":"","sources":["../src/test-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,2BAA2B,CAAC;AAEhF,IAAI,UAA4C,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,UAAU,KAAK,iBAAiB,EAAE,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamesh/testkit",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "Runner-neutral MetaMesh model and Generator testing helpers, assertions, and local font fixtures.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,6 +13,9 @@
13
13
  "url": "https://github.com/JasonKoolman/metamesh/issues"
14
14
  },
15
15
  "type": "module",
16
+ "engines": {
17
+ "node": ">=24"
18
+ },
16
19
  "sideEffects": false,
17
20
  "files": [
18
21
  "CHANGELOG.md",
@@ -38,13 +41,13 @@
38
41
  "registry": "https://registry.npmjs.org/"
39
42
  },
40
43
  "peerDependencies": {
41
- "@metamesh/generator-sdk": "0.16.0",
42
- "@metamesh/modeling": "0.16.0"
44
+ "@metamesh/generator-sdk": "0.18.0",
45
+ "@metamesh/modeling": "0.18.0"
43
46
  },
44
47
  "devDependencies": {
45
48
  "@metamesh/config": "0.0.0",
46
- "@metamesh/generator-sdk": "0.16.0",
47
- "@metamesh/modeling": "0.16.0",
49
+ "@metamesh/generator-sdk": "0.18.0",
50
+ "@metamesh/modeling": "0.18.0",
48
51
  "vitest": "^5.0.5",
49
52
  "@types/node": "^24.19.2",
50
53
  "typescript": "6.0.3"
@@ -1,19 +0,0 @@
1
- # GeneratorTestExecution
2
-
3
- Parameter or assertion failure, or a generated snapshot owned separately from its runner.
4
-
5
- Import from `@metamesh/testkit` (@metamesh/testkit@0.16.0).
6
-
7
- ```ts
8
- /** Parameter or assertion failure, or a generated snapshot owned separately from its runner. */
9
- export type GeneratorTestExecution<D extends GeneratorDefinition> = {
10
- readonly type: "invalid";
11
- readonly parameters: GeneratorParams<D>;
12
- readonly validation: ParameterValidationResult;
13
- } | {
14
- readonly type: "generated";
15
- readonly parameters: GeneratorParams<D>;
16
- readonly validation: ParameterValidationResult;
17
- readonly model: ModelSnapshot;
18
- };
19
- ```
@@ -1,10 +0,0 @@
1
- # expectSerializableDefinition
2
-
3
- Throws unless a definition already has the canonical package-serializable representation.
4
-
5
- Import from `@metamesh/testkit` (@metamesh/testkit@0.16.0).
6
-
7
- ```ts
8
- /** Throws unless a definition already has the canonical package-serializable representation. */
9
- export declare function expectSerializableDefinition(definition: GeneratorDefinition): void;
10
- ```
@@ -1,19 +0,0 @@
1
- # expectValidParts
2
-
3
- Checks finalized parts without measurement facts, retaining shared snapshot resources and placement. Runs mesh reconstruction/finalization synchronously using the supplied engine. Strictly checks unknown wire data and reconstructs its meshes using the supplied engine. Initializes the shared test engine lazily, then applies the same wire and mesh checks.
4
-
5
- Import from `@metamesh/testkit` (@metamesh/testkit@0.16.0).
6
-
7
- ```ts
8
- /**
9
- * Checks finalized parts without measurement facts, retaining shared snapshot resources and placement.
10
- * Runs mesh reconstruction/finalization synchronously using the supplied engine.
11
- */
12
- export declare function expectValidParts(value: readonly FinalizedPart[], engine: ModelEngine): readonly GeneratedPart[];
13
-
14
- /** Strictly checks unknown wire data and reconstructs its meshes using the supplied engine. */
15
- export declare function expectValidParts(value: unknown, engine: ModelEngine): readonly GeneratedPart[];
16
-
17
- /** Initializes the shared test engine lazily, then applies the same wire and mesh checks. */
18
- export declare function expectValidParts(value: unknown): Promise<readonly GeneratedPart[]>;
19
- ```
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAIhF;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC,CAGpD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,2BAA2B,CAAC;AAEhF,IAAI,UAA4C,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,UAAU,KAAK,iBAAiB,EAAE,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC"}