@metamesh/testkit 0.0.0-stage → 0.14.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/CHANGELOG.md +234 -0
- package/LICENSE +200 -0
- package/README.md +118 -2
- package/dist/assertions.d.ts +20 -0
- package/dist/assertions.d.ts.map +1 -0
- package/dist/assertions.js +103 -0
- package/dist/assertions.js.map +1 -0
- package/dist/docs/guides/package.md +119 -0
- package/dist/docs/manifest.json +259 -0
- package/dist/docs/reference/font-fixtures/LoadedFontFixtures.md +13 -0
- package/dist/docs/reference/font-fixtures/loadFontFixtureServices.md +10 -0
- package/dist/docs/reference/font-fixtures/loadFontFixtures.md +10 -0
- package/dist/docs/reference/fonts/FontTestFixture.md +17 -0
- package/dist/docs/reference/fonts/prepareFontTestServices.md +10 -0
- package/dist/docs/reference/index/GeneratorTestExecution.md +19 -0
- package/dist/docs/reference/index/GeneratorTestRunner.md +19 -0
- package/dist/docs/reference/index/GeneratorTestRunnerOptions.md +14 -0
- package/dist/docs/reference/index/MeshMeasurementExpectation.md +19 -0
- package/dist/docs/reference/index/MeshMeasurementTolerances.md +17 -0
- package/dist/docs/reference/index/createGeneratorTestRunner.md +12 -0
- package/dist/docs/reference/index/expectMeshMeasurements.md +14 -0
- package/dist/docs/reference/index/expectSerializableDefinition.md +10 -0
- package/dist/docs/reference/index/expectValidDefaults.md +10 -0
- package/dist/docs/reference/index/expectValidParts.md +19 -0
- package/dist/docs/reference/index/expectValidPresets.md +10 -0
- package/dist/docs/reference/index/getTestEngine.md +13 -0
- package/dist/engine.d.ts +7 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +11 -0
- package/dist/engine.js.map +1 -0
- package/dist/font-fixtures.d.ts +11 -0
- package/dist/font-fixtures.d.ts.map +1 -0
- package/dist/font-fixtures.js +75 -0
- package/dist/font-fixtures.js.map +1 -0
- package/dist/fonts.d.ts +13 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +34 -0
- package/dist/fonts.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/measurements.d.ts +28 -0
- package/dist/measurements.d.ts.map +1 -0
- package/dist/measurements.js +66 -0
- package/dist/measurements.js.map +1 -0
- package/dist/runner.d.ts +36 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +118 -0
- package/dist/runner.js.map +1 -0
- package/package.json +55 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# createGeneratorTestRunner
|
|
2
|
+
|
|
3
|
+
Creates a lazy runner for one generation program without loading assets or an engine.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.14.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
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>;
|
|
12
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# expectMeshMeasurements
|
|
2
|
+
|
|
3
|
+
Analyzes current buffers, requires closed oriented edge topology, and checks selected physical facts with explicit absolute tolerances. Returns fresh measurements without initializing an engine. These facts do not prove geometric equivalence or absence of self-intersections.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.14.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/**
|
|
9
|
+
* Analyzes current buffers, requires closed oriented edge topology, and checks selected physical
|
|
10
|
+
* facts with explicit absolute tolerances. Returns fresh measurements without initializing an
|
|
11
|
+
* engine. These facts do not prove geometric equivalence or absence of self-intersections.
|
|
12
|
+
*/
|
|
13
|
+
export declare function expectMeshMeasurements(mesh: TriangleMesh, expected: MeshMeasurementExpectation, tolerances?: MeshMeasurementTolerances): TriangleMeshAnalysis;
|
|
14
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# expectSerializableDefinition
|
|
2
|
+
|
|
3
|
+
Throws unless a definition already has the canonical package-serializable representation.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.14.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
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# expectValidDefaults
|
|
2
|
+
|
|
3
|
+
Throws unless defaults strictly decode and equal the defaults derived from the definition.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.14.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Throws unless defaults strictly decode and equal the defaults derived from the definition. */
|
|
9
|
+
export declare function expectValidDefaults<const D extends GeneratorDefinition>(definition: D, defaults: GeneratorParams<D>): void;
|
|
10
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# expectValidParts
|
|
2
|
+
|
|
3
|
+
Checks finalized engine parts after omitting measurement facts from their strict wire DTOs. 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.14.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/**
|
|
9
|
+
* Checks finalized engine parts after omitting measurement facts from their strict wire DTOs.
|
|
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
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# expectValidPresets
|
|
2
|
+
|
|
3
|
+
Checks preset metadata. Validate domain assertions through the generation test runner.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.14.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
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;
|
|
10
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# getTestEngine
|
|
2
|
+
|
|
3
|
+
Returns the shared test engine, initializing it only on first request. Runner construction does not call this function.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/testkit` (@metamesh/testkit@0.14.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/**
|
|
9
|
+
* Returns the shared test engine, initializing it only on first request.
|
|
10
|
+
* Runner construction does not call this function.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getTestEngine(): Promise<ModelEngine>;
|
|
13
|
+
```
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ModelEngine } from "@metamesh/modeling/engine";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the shared test engine, initializing it only on first request.
|
|
4
|
+
* Runner construction does not call this function.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTestEngine(): Promise<ModelEngine>;
|
|
7
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createModelEngine } from "@metamesh/modeling/engine";
|
|
2
|
+
let testEngine;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the shared test engine, initializing it only on first request.
|
|
5
|
+
* Runner construction does not call this function.
|
|
6
|
+
*/
|
|
7
|
+
export function getTestEngine() {
|
|
8
|
+
testEngine ??= createModelEngine();
|
|
9
|
+
return testEngine;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FontSelection, type GeneratorDefinition, type GeneratorServices } from "@metamesh/generator-sdk";
|
|
2
|
+
/** Byte-verified local font selections and a reusable Generator service-preparation adapter. */
|
|
3
|
+
export interface LoadedFontFixtures {
|
|
4
|
+
readonly selections: readonly FontSelection[];
|
|
5
|
+
readonly prepareServices: (definition: GeneratorDefinition, parameters: Readonly<Record<string, unknown>>) => Promise<GeneratorServices>;
|
|
6
|
+
}
|
|
7
|
+
/** Node-only local descriptor loader. Paths resolve beside the descriptor; bytes never come from a catalog. */
|
|
8
|
+
export declare function loadFontFixtures(filename: string): Promise<LoadedFontFixtures>;
|
|
9
|
+
/** Fixture provider matching createGeneratorTestRunner's asynchronous service boundary. */
|
|
10
|
+
export declare function loadFontFixtureServices(filename: string): Promise<LoadedFontFixtures["prepareServices"]>;
|
|
11
|
+
//# sourceMappingURL=font-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-fixtures.d.ts","sourceRoot":"","sources":["../src/font-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC,gGAAgG;AAChG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IAC9C,QAAQ,CAAC,eAAe,EAAE,CACxB,UAAU,EAAE,mBAAmB,EAC/B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAC1C,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACjC;AAED,+GAA+G;AAC/G,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAiEpF;AAED,2FAA2F;AAC3F,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAEhD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { isFontSelection, } from "@metamesh/generator-sdk";
|
|
4
|
+
import { prepareFontTestServices } from "./fonts.js";
|
|
5
|
+
/** Node-only local descriptor loader. Paths resolve beside the descriptor; bytes never come from a catalog. */
|
|
6
|
+
export async function loadFontFixtures(filename) {
|
|
7
|
+
const source = resolve(filename);
|
|
8
|
+
const descriptors = JSON.parse(await readFile(source, "utf8"));
|
|
9
|
+
if (!Array.isArray(descriptors) || descriptors.length === 0 || descriptors.length > 100)
|
|
10
|
+
throw new Error("Font fixtures must be a JSON array of 1–100 local fixture descriptors.");
|
|
11
|
+
const fixtures = new Map();
|
|
12
|
+
const prepared = new Map();
|
|
13
|
+
const selectionKey = (selection) => `${selection.faceId}@${selection.revision}:${selection.weight}`;
|
|
14
|
+
for (const value of descriptors) {
|
|
15
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
16
|
+
throw new Error("Invalid local font fixture descriptor.");
|
|
17
|
+
const descriptor = value;
|
|
18
|
+
if (Object.keys(descriptor).some((key) => !["selection", "file", "staticWeight"].includes(key)) ||
|
|
19
|
+
!isFontSelection(descriptor.selection) ||
|
|
20
|
+
typeof descriptor.file !== "string" ||
|
|
21
|
+
descriptor.file.length === 0 ||
|
|
22
|
+
(descriptor.staticWeight !== undefined &&
|
|
23
|
+
(typeof descriptor.staticWeight !== "number" ||
|
|
24
|
+
!Number.isInteger(descriptor.staticWeight) ||
|
|
25
|
+
descriptor.staticWeight < 1 ||
|
|
26
|
+
descriptor.staticWeight > 1000)))
|
|
27
|
+
throw new Error("Each font fixture requires selection, a local file path, and optional staticWeight.");
|
|
28
|
+
const key = selectionKey(descriptor.selection);
|
|
29
|
+
if (fixtures.has(key))
|
|
30
|
+
throw new Error("Font fixtures contain a duplicate selection.");
|
|
31
|
+
const bytes = new Uint8Array(await readFile(resolve(dirname(source), descriptor.file)));
|
|
32
|
+
const digest = Buffer.from(await crypto.subtle.digest("SHA-256", bytes)).toString("hex");
|
|
33
|
+
if (digest !== descriptor.selection.revision)
|
|
34
|
+
throw new Error("The font fixture does not match its immutable revision.");
|
|
35
|
+
fixtures.set(key, {
|
|
36
|
+
selection: descriptor.selection,
|
|
37
|
+
bytes,
|
|
38
|
+
...(descriptor.staticWeight === undefined ? {} : { staticWeight: descriptor.staticWeight }),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
selections: [...fixtures.values()].map(({ selection }) => selection),
|
|
43
|
+
async prepareServices(definition, parameters) {
|
|
44
|
+
const selected = new Map();
|
|
45
|
+
for (const parameter of definition.parameters.filter(({ type }) => type === "font")) {
|
|
46
|
+
const selection = parameters[parameter.id];
|
|
47
|
+
if (!isFontSelection(selection))
|
|
48
|
+
throw new Error(`Invalid font parameter ${parameter.id}.`);
|
|
49
|
+
const key = selectionKey(selection);
|
|
50
|
+
const fixture = fixtures.get(key);
|
|
51
|
+
if (fixture === undefined)
|
|
52
|
+
throw new Error(`Missing local font fixture for ${key}.`);
|
|
53
|
+
selected.set(key, fixture);
|
|
54
|
+
}
|
|
55
|
+
const keys = [...selected.keys()].sort();
|
|
56
|
+
const cacheKey = JSON.stringify(keys);
|
|
57
|
+
let pending = prepared.get(cacheKey);
|
|
58
|
+
if (pending === undefined) {
|
|
59
|
+
pending = prepareFontTestServices(keys.map((key) => selected.get(key)));
|
|
60
|
+
prepared.set(cacheKey, pending);
|
|
61
|
+
const captured = pending;
|
|
62
|
+
void pending.catch(() => {
|
|
63
|
+
if (prepared.get(cacheKey) === captured)
|
|
64
|
+
prepared.delete(cacheKey);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return pending;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Fixture provider matching createGeneratorTestRunner's asynchronous service boundary. */
|
|
72
|
+
export async function loadFontFixtureServices(filename) {
|
|
73
|
+
return (await loadFontFixtures(filename)).prepareServices;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=font-fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-fixtures.js","sourceRoot":"","sources":["../src/font-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,eAAe,GAIhB,MAAM,yBA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BACzE,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAChC,MAAM,QAAQ,GAAG,OAAO,CAAC;gBACzB,KAAK,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;oBACtB,IAAI,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,QAAQ;wBAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACrE,CAAC,CAAC,CAAC;YACL,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,QAAgB;IAEhB,OAAO,CAAC,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC;AAC5D,CAAC"}
|
package/dist/fonts.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type FontSelection, type GeneratorServices } from "@metamesh/generator-sdk";
|
|
2
|
+
/** A checked-in immutable font fixture; no catalog or network is used by the test harness. */
|
|
3
|
+
export interface FontTestFixture {
|
|
4
|
+
/** Font face, weight and SHA-256 revision to resolve from these bytes. */
|
|
5
|
+
readonly selection: FontSelection;
|
|
6
|
+
/** Complete checked-in font file; its digest must match selection.revision. */
|
|
7
|
+
readonly bytes: Uint8Array<ArrayBuffer>;
|
|
8
|
+
/** Weight represented by a static face; omit for variable fonts. */
|
|
9
|
+
readonly staticWeight?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Prepares the same synchronous text service used by Studio, from reproducible fixture bytes. */
|
|
12
|
+
export declare function prepareFontTestServices(fixtures: readonly FontTestFixture[]): Promise<GeneratorServices>;
|
|
13
|
+
//# sourceMappingURL=fonts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../src/fonts.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAEvB,MAAM,yBAAyB,CAAC;AAOjC,8FAA8F;AAC9F,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,oEAAoE;IACpE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,kGAAkG;AAClG,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,SAAS,eAAe,EAAE,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAmC5B"}
|
package/dist/fonts.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isFontSelection, } from "@metamesh/generator-sdk";
|
|
2
|
+
import { prepareVectorFont, } from "@metamesh/modeling/text";
|
|
3
|
+
/** Prepares the same synchronous text service used by Studio, from reproducible fixture bytes. */
|
|
4
|
+
export async function prepareFontTestServices(fixtures) {
|
|
5
|
+
const entries = await Promise.all(fixtures.map(async (fixture) => {
|
|
6
|
+
if (!isFontSelection(fixture.selection))
|
|
7
|
+
throw new TypeError("Invalid fixture font selection.");
|
|
8
|
+
const digest = await crypto.subtle.digest("SHA-256", fixture.bytes);
|
|
9
|
+
const hash = Array.from(new Uint8Array(digest), (value) => value.toString(16).padStart(2, "0")).join("");
|
|
10
|
+
if (hash !== fixture.selection.revision)
|
|
11
|
+
throw new Error("The font fixture does not match its immutable revision.");
|
|
12
|
+
const font = await prepareVectorFont(fixture.bytes, fixture.staticWeight === undefined ? {} : { staticWeight: fixture.staticWeight });
|
|
13
|
+
return { font, selection: fixture.selection };
|
|
14
|
+
}));
|
|
15
|
+
function resolve(options) {
|
|
16
|
+
if (!isFontSelection(options.font))
|
|
17
|
+
throw new Error("Invalid font selection.");
|
|
18
|
+
const entry = entries.find(({ selection }) => selection.revision === options.font.revision &&
|
|
19
|
+
selection.faceId === options.font.faceId &&
|
|
20
|
+
selection.weight === options.font.weight);
|
|
21
|
+
if (!entry)
|
|
22
|
+
throw new Error("This selection has no prepared font fixture.");
|
|
23
|
+
return entry.font;
|
|
24
|
+
}
|
|
25
|
+
return Object.freeze({
|
|
26
|
+
text: Object.freeze({
|
|
27
|
+
layout: (text, options) => resolve(options).layout(text, vectorOptions(options)),
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function vectorOptions({ font, ...layout }) {
|
|
32
|
+
return { ...layout, fontWeight: font.weight };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../src/fonts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAIhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iBAAiB,GAGlB,MAAM,yBAAyB,CAAC;AAYjC,kGAAkG;AAClG,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,QAAoC;IAEpC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC;YACrC,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACpE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CACxD,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACpC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACX,IAAI,IAAI,KAA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AM,EAAwB;IAC9D,OAAO,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AAChD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
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";
|
|
6
|
+
export type { MeshMeasurementExpectation, MeshMeasurementTolerances } from "./measurements.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
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";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Bounds3, type TriangleMesh, type TriangleMeshAnalysis } from "@metamesh/modeling/geometry";
|
|
2
|
+
/** Physical expectations for a closed mesh; omitted facts are not asserted. */
|
|
3
|
+
export interface MeshMeasurementExpectation {
|
|
4
|
+
/** Axis-aligned XYZ bounds in millimetres. */
|
|
5
|
+
readonly bounds?: Bounds3;
|
|
6
|
+
/** Oriented enclosed volume in cubic millimetres; outward winding is positive. */
|
|
7
|
+
readonly signedVolume?: number;
|
|
8
|
+
/** Sum of triangle areas in square millimetres. */
|
|
9
|
+
readonly surfaceArea?: number;
|
|
10
|
+
/** Exact number of components connected by indexed mesh edges. */
|
|
11
|
+
readonly connectedComponentCount?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Absolute nonnegative comparison allowances; each omitted tolerance defaults to zero. */
|
|
14
|
+
export interface MeshMeasurementTolerances {
|
|
15
|
+
/** Allowance for each minimum/maximum XYZ coordinate in millimetres. */
|
|
16
|
+
readonly bounds?: number;
|
|
17
|
+
/** Allowance for signed volume in cubic millimetres. */
|
|
18
|
+
readonly signedVolume?: number;
|
|
19
|
+
/** Allowance for surface area in square millimetres. */
|
|
20
|
+
readonly surfaceArea?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Analyzes current buffers, requires closed oriented edge topology, and checks selected physical
|
|
24
|
+
* facts with explicit absolute tolerances. Returns fresh measurements without initializing an
|
|
25
|
+
* engine. These facts do not prove geometric equivalence or absence of self-intersections.
|
|
26
|
+
*/
|
|
27
|
+
export declare function expectMeshMeasurements(mesh: TriangleMesh, expected: MeshMeasurementExpectation, tolerances?: MeshMeasurementTolerances): TriangleMeshAnalysis;
|
|
28
|
+
//# sourceMappingURL=measurements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measurements.d.ts","sourceRoot":"","sources":["../src/measurements.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,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,OAAO,CAAC;IAC1B,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"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { analyzeTriangleMesh, } from "@metamesh/modeling/geometry";
|
|
2
|
+
function finite(value, label) {
|
|
3
|
+
if (!Number.isFinite(value))
|
|
4
|
+
throw new TypeError(`${label} must be finite.`);
|
|
5
|
+
}
|
|
6
|
+
function within(actual, expected, tolerance, label) {
|
|
7
|
+
finite(expected, `Expected ${label}`);
|
|
8
|
+
if (Math.abs(actual - expected) > tolerance) {
|
|
9
|
+
throw new Error(`Mesh ${label}: expected ${expected} ± ${tolerance}, received ${actual}.`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Analyzes current buffers, requires closed oriented edge topology, and checks selected physical
|
|
14
|
+
* facts with explicit absolute tolerances. Returns fresh measurements without initializing an
|
|
15
|
+
* engine. These facts do not prove geometric equivalence or absence of self-intersections.
|
|
16
|
+
*/
|
|
17
|
+
export function expectMeshMeasurements(mesh, expected, tolerances = {}) {
|
|
18
|
+
if (expected.bounds === undefined &&
|
|
19
|
+
expected.signedVolume === undefined &&
|
|
20
|
+
expected.surfaceArea === undefined &&
|
|
21
|
+
expected.connectedComponentCount === undefined) {
|
|
22
|
+
throw new TypeError("Provide at least one mesh measurement expectation.");
|
|
23
|
+
}
|
|
24
|
+
for (const metric of ["bounds", "signedVolume", "surfaceArea"]) {
|
|
25
|
+
const tolerance = tolerances[metric];
|
|
26
|
+
if (tolerance !== undefined) {
|
|
27
|
+
finite(tolerance, `${metric} tolerance`);
|
|
28
|
+
if (tolerance < 0)
|
|
29
|
+
throw new TypeError(`${metric} tolerance must be nonnegative.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const facts = analyzeTriangleMesh(mesh, {
|
|
33
|
+
requireClosed: true,
|
|
34
|
+
includeTopology: expected.connectedComponentCount !== undefined,
|
|
35
|
+
});
|
|
36
|
+
if (expected.bounds !== undefined) {
|
|
37
|
+
for (const end of ["min", "max"]) {
|
|
38
|
+
const point = expected.bounds[end];
|
|
39
|
+
const pointShape = point;
|
|
40
|
+
if (!Array.isArray(pointShape) || pointShape.length !== 3) {
|
|
41
|
+
throw new TypeError(`Expected bounds.${end} must contain three XYZ coordinates.`);
|
|
42
|
+
}
|
|
43
|
+
for (let axis = 0; axis < 3; axis += 1) {
|
|
44
|
+
within(facts.bounds[end][axis], point[axis], tolerances.bounds ?? 0, `bounds.${end}[${axis}]`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (expected.signedVolume !== undefined) {
|
|
49
|
+
within(facts.signedVolume, expected.signedVolume, tolerances.signedVolume ?? 0, "signedVolume");
|
|
50
|
+
}
|
|
51
|
+
if (expected.surfaceArea !== undefined) {
|
|
52
|
+
finite(expected.surfaceArea, "Expected surfaceArea");
|
|
53
|
+
if (expected.surfaceArea < 0)
|
|
54
|
+
throw new TypeError("Expected surfaceArea must be nonnegative.");
|
|
55
|
+
within(facts.surfaceArea, expected.surfaceArea, tolerances.surfaceArea ?? 0, "surfaceArea");
|
|
56
|
+
}
|
|
57
|
+
if (expected.connectedComponentCount !== undefined) {
|
|
58
|
+
const count = expected.connectedComponentCount;
|
|
59
|
+
if (!Number.isSafeInteger(count) || count < 1) {
|
|
60
|
+
throw new TypeError("Expected connectedComponentCount must be a positive safe integer.");
|
|
61
|
+
}
|
|
62
|
+
within(facts.connectedComponentCount, count, 0, "connectedComponentCount");
|
|
63
|
+
}
|
|
64
|
+
return facts;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=measurements.js.map
|
|
@@ -0,0 +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,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,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,SAAS,CAAC,mEAAmE,CAAC,CAAC;QAC3F,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,uBAAwB,EAAE,KAAK,EAAE,CAAC,EAAE,yBAAyB,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/runner.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type GeneratorDefinition, type GeneratorParams, type GeneratorServices, type ParameterValidationResult } from "@metamesh/generator-sdk";
|
|
2
|
+
import type { ModelingLimits, ModelProgram } from "@metamesh/modeling";
|
|
3
|
+
import { type ModelEngine, type ModelSnapshot } from "@metamesh/modeling/engine";
|
|
4
|
+
/** Fixed host resources and optional asynchronous asset preparation. */
|
|
5
|
+
export interface GeneratorTestRunnerOptions<D extends GeneratorDefinition> {
|
|
6
|
+
readonly prepareServices?: (definition: D, parameters: GeneratorParams<D>) => GeneratorServices | Promise<GeneratorServices>;
|
|
7
|
+
readonly engine?: ModelEngine;
|
|
8
|
+
readonly limits?: Partial<ModelingLimits>;
|
|
9
|
+
}
|
|
10
|
+
/** Parameter or assertion failure, or a generated snapshot owned separately from its runner. */
|
|
11
|
+
export type GeneratorTestExecution<D extends GeneratorDefinition> = {
|
|
12
|
+
readonly type: "invalid";
|
|
13
|
+
readonly parameters: GeneratorParams<D>;
|
|
14
|
+
readonly validation: ParameterValidationResult;
|
|
15
|
+
} | {
|
|
16
|
+
readonly type: "generated";
|
|
17
|
+
readonly parameters: GeneratorParams<D>;
|
|
18
|
+
readonly validation: ParameterValidationResult;
|
|
19
|
+
readonly model: ModelSnapshot;
|
|
20
|
+
};
|
|
21
|
+
/** A lazy reusable Generator test session; dispose the runner and every returned snapshot separately. */
|
|
22
|
+
export interface GeneratorTestRunner<D extends GeneratorDefinition> {
|
|
23
|
+
/** Checks declarations and assertions only. Set `normalize: false` to probe deliberately invalid typed values. */
|
|
24
|
+
readonly validate: (parameters: GeneratorParams<D>, options?: {
|
|
25
|
+
readonly normalize?: boolean;
|
|
26
|
+
}) => Promise<ParameterValidationResult>;
|
|
27
|
+
/** Normalizes once, prepares assets, and executes the same persistent session used by production hosts. */
|
|
28
|
+
readonly execute: (parameters: Readonly<Record<string, unknown>>) => Promise<GeneratorTestExecution<D>>;
|
|
29
|
+
/** Releases runner caches; separately owned snapshots remain valid. */
|
|
30
|
+
readonly dispose: () => void;
|
|
31
|
+
}
|
|
32
|
+
/** Creates a lazy runner for one generation program without loading assets or an engine. */
|
|
33
|
+
export declare function createGeneratorTestRunner<const D extends GeneratorDefinition>(definition: D, runtime: {
|
|
34
|
+
readonly generate: ModelProgram<GeneratorParams<D>, GeneratorServices>;
|
|
35
|
+
}, options?: GeneratorTestRunnerOptions<NoInfer<D>>): GeneratorTestRunner<D>;
|
|
36
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AAKnC,wEAAwE;AACxE,MAAM,WAAW,0BAA0B,CAAC,CAAC,SAAS,mBAAmB;IACvE,QAAQ,CAAC,eAAe,CAAC,EAAE,CACzB,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,KAC3B,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpD,QAA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YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAA;CAAE,EACnF,OAAO,GAAE,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAM,GACnD,mBAAmB,CAAC,CAAC,CAAC,CA6HxB"}
|
package/dist/runner.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { UNPREPARED_GENERATOR_SERVICES, } from "@metamesh/generator-sdk";
|
|
2
|
+
import { aggregateParameterIssues, canonicalizeParameters, parseParameterIssues, prepareParameters, } from "@metamesh/generator-sdk/parameters";
|
|
3
|
+
import { generationIssues } from "@metamesh/generator-sdk/runtime";
|
|
4
|
+
import { validateModel, } from "@metamesh/modeling/engine";
|
|
5
|
+
import { isGeometryError } from "@metamesh/modeling/geometry";
|
|
6
|
+
import { getTestEngine } from "./engine.js";
|
|
7
|
+
/** Creates a lazy runner for one generation program without loading assets or an engine. */
|
|
8
|
+
export function createGeneratorTestRunner(definition, runtime, options = {}) {
|
|
9
|
+
let session;
|
|
10
|
+
let assetKey;
|
|
11
|
+
let previous;
|
|
12
|
+
let disposed = false;
|
|
13
|
+
const assertActive = () => {
|
|
14
|
+
if (disposed)
|
|
15
|
+
throw new Error("Generator test runner has been disposed.");
|
|
16
|
+
};
|
|
17
|
+
async function services(parameters) {
|
|
18
|
+
if (options.prepareServices)
|
|
19
|
+
return options.prepareServices(definition, parameters);
|
|
20
|
+
if (definition.parameters.some((parameter) => parameter.type === "font")) {
|
|
21
|
+
throw new Error(`Generator "${definition.id}" declares Font parameters. Pass a prepareServices fixture provider to createGeneratorTestRunner().`);
|
|
22
|
+
}
|
|
23
|
+
return UNPREPARED_GENERATOR_SERVICES;
|
|
24
|
+
}
|
|
25
|
+
async function withSession(parameters, capabilities, execute) {
|
|
26
|
+
assertActive();
|
|
27
|
+
const engine = options.engine ?? (await getTestEngine());
|
|
28
|
+
assertActive();
|
|
29
|
+
const key = JSON.stringify(definition.parameters
|
|
30
|
+
.filter((parameter) => parameter.type === "font")
|
|
31
|
+
.map(({ id }) => parameters[id]));
|
|
32
|
+
if (session === undefined || assetKey !== key) {
|
|
33
|
+
session?.dispose();
|
|
34
|
+
session = undefined;
|
|
35
|
+
session = engine.createSession(runtime.generate, {
|
|
36
|
+
services: capabilities,
|
|
37
|
+
...(options.limits === undefined ? {} : { limits: options.limits }),
|
|
38
|
+
});
|
|
39
|
+
assetKey = key;
|
|
40
|
+
}
|
|
41
|
+
// Selection and execution stay synchronous: another prepared request may replace this session.
|
|
42
|
+
return execute(session);
|
|
43
|
+
}
|
|
44
|
+
function canonical(parameters) {
|
|
45
|
+
const result = canonicalizeParameters(definition, parameters, previous);
|
|
46
|
+
previous = result;
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
async validate(parameters, probe = {}) {
|
|
51
|
+
assertActive();
|
|
52
|
+
const state = probe.normalize === false
|
|
53
|
+
? { parameters, validation: aggregateParameterIssues() }
|
|
54
|
+
: prepareParameters(definition, parameters);
|
|
55
|
+
if (!state.validation.isValid)
|
|
56
|
+
return state.validation;
|
|
57
|
+
try {
|
|
58
|
+
const params = canonical(state.parameters);
|
|
59
|
+
const capabilities = await services(params);
|
|
60
|
+
assertActive();
|
|
61
|
+
let issues;
|
|
62
|
+
try {
|
|
63
|
+
issues =
|
|
64
|
+
options.engine === undefined
|
|
65
|
+
? validateModel(runtime.generate, params, {
|
|
66
|
+
services: capabilities,
|
|
67
|
+
...(options.limits === undefined ? {} : { limits: options.limits }),
|
|
68
|
+
})
|
|
69
|
+
: await withSession(params, capabilities, (active) => active.validate(params));
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (!isGeometryError(error) ||
|
|
73
|
+
error.context?.operation !== "validateModel" ||
|
|
74
|
+
error.context.details?.["requiresKernel"] !== true)
|
|
75
|
+
throw error;
|
|
76
|
+
issues = await withSession(params, capabilities, (active) => active.validate(params));
|
|
77
|
+
}
|
|
78
|
+
return aggregateParameterIssues(state.validation.issues, parseParameterIssues(definition, issues));
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
const issues = generationIssues(definition, error);
|
|
82
|
+
if (issues === undefined || !issues.some(({ severity }) => severity === "error"))
|
|
83
|
+
throw error;
|
|
84
|
+
return aggregateParameterIssues(state.validation.issues, issues);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
async execute(parameters) {
|
|
88
|
+
assertActive();
|
|
89
|
+
const state = prepareParameters(definition, parameters);
|
|
90
|
+
if (!state.validation.isValid)
|
|
91
|
+
return Object.freeze({ type: "invalid", ...state });
|
|
92
|
+
const params = canonical(state.parameters);
|
|
93
|
+
try {
|
|
94
|
+
const capabilities = await services(params);
|
|
95
|
+
const model = await withSession(params, capabilities, (active) => active.run(params));
|
|
96
|
+
const validation = aggregateParameterIssues(state.validation.issues, parseParameterIssues(definition, model.diagnostics));
|
|
97
|
+
return Object.freeze({ type: "generated", parameters: params, validation, model });
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const issues = generationIssues(definition, error);
|
|
101
|
+
if (issues === undefined || !issues.some(({ severity }) => severity === "error"))
|
|
102
|
+
throw error;
|
|
103
|
+
return Object.freeze({
|
|
104
|
+
type: "invalid",
|
|
105
|
+
parameters: params,
|
|
106
|
+
validation: aggregateParameterIssues(state.validation.issues, issues),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
dispose() {
|
|
111
|
+
disposed = true;
|
|
112
|
+
session?.dispose();
|
|
113
|
+
session = undefined;
|
|
114
|
+
previous = undefined;
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,GAK9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,E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