@forgeax/engine-pack 0.0.0-dev.8d955ade1c79
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/LICENSE +202 -0
- package/README.md +429 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/ai-recovery.unit.test.d.ts +2 -0
- package/dist/__tests__/ai-recovery.unit.test.d.ts.map +1 -0
- package/dist/__tests__/artifact-path.test.d.ts +2 -0
- package/dist/__tests__/artifact-path.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-error-hints.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-error-hints.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-lifecycle.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-lifecycle.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-schema.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-schema.test.d.ts.map +1 -0
- package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts +2 -0
- package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts.map +1 -0
- package/dist/__tests__/atlas-error-code-owner.test-d.d.ts +2 -0
- package/dist/__tests__/atlas-error-code-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/cli-asset-evidence.integration.test.d.ts +2 -0
- package/dist/__tests__/cli-asset-evidence.integration.test.d.ts.map +1 -0
- package/dist/__tests__/cli.unit.test.d.ts +2 -0
- package/dist/__tests__/cli.unit.test.d.ts.map +1 -0
- package/dist/__tests__/evidence-source-inventory.unit.test.d.ts +2 -0
- package/dist/__tests__/evidence-source-inventory.unit.test.d.ts.map +1 -0
- package/dist/__tests__/guid-collision.unit.test.d.ts +2 -0
- package/dist/__tests__/guid-collision.unit.test.d.ts.map +1 -0
- package/dist/__tests__/guid-validator-surface.unit.test.d.ts +2 -0
- package/dist/__tests__/guid-validator-surface.unit.test.d.ts.map +1 -0
- package/dist/__tests__/load-asset-config.test.d.ts +2 -0
- package/dist/__tests__/load-asset-config.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-dependencies.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-dependencies.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-receipt.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-receipt.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-schema.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-schema.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin-contract.unit.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin-contract.unit.test.d.ts.map +1 -0
- package/dist/__tests__/meta-schema-optional.test.d.ts +2 -0
- package/dist/__tests__/meta-schema-optional.test.d.ts.map +1 -0
- package/dist/__tests__/meta-source-overrides.unit.test.d.ts +2 -0
- package/dist/__tests__/meta-source-overrides.unit.test.d.ts.map +1 -0
- package/dist/__tests__/native-cooker-registry.test.d.ts +2 -0
- package/dist/__tests__/native-cooker-registry.test.d.ts.map +1 -0
- package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts +2 -0
- package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/offline-evidence.integration.test.d.ts +2 -0
- package/dist/__tests__/offline-evidence.integration.test.d.ts.map +1 -0
- package/dist/__tests__/owner-chain.integration.test.d.ts +2 -0
- package/dist/__tests__/owner-chain.integration.test.d.ts.map +1 -0
- package/dist/__tests__/pack-v2-fixture-migration.test.d.ts +2 -0
- package/dist/__tests__/pack-v2-fixture-migration.test.d.ts.map +1 -0
- package/dist/__tests__/pack-v2-schema.test.d.ts +2 -0
- package/dist/__tests__/pack-v2-schema.test.d.ts.map +1 -0
- package/dist/__tests__/pack.unit.test.d.ts +2 -0
- package/dist/__tests__/pack.unit.test.d.ts.map +1 -0
- package/dist/__tests__/package-finalizer.contract.test.d.ts +2 -0
- package/dist/__tests__/package-finalizer.contract.test.d.ts.map +1 -0
- package/dist/__tests__/producer-contract-schema.unit.test.d.ts +2 -0
- package/dist/__tests__/producer-contract-schema.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resolve-asset-source.test.d.ts +2 -0
- package/dist/__tests__/resolve-asset-source.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-projection.unit.test.d.ts +2 -0
- package/dist/__tests__/runtime-projection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/runtime.browser.test.d.ts +2 -0
- package/dist/__tests__/runtime.browser.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-inventory.contract.test.d.ts +2 -0
- package/dist/__tests__/scanner-inventory.contract.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-inventory.test.d.ts +2 -0
- package/dist/__tests__/scanner-inventory.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-mount-cycle.test.d.ts +2 -0
- package/dist/__tests__/scanner-mount-cycle.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack.test-d.d.ts +2 -0
- package/dist/__tests__/scriptable-pack.test-d.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack.unit.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack.unit.test.d.ts.map +1 -0
- package/dist/__tests__/topology-actions.unit.test.d.ts +2 -0
- package/dist/__tests__/topology-actions.unit.test.d.ts.map +1 -0
- package/dist/__tests__/topology.unit.test.d.ts +2 -0
- package/dist/__tests__/topology.unit.test.d.ts.map +1 -0
- package/dist/artifact-path.d.ts +9 -0
- package/dist/artifact-path.d.ts.map +1 -0
- package/dist/artifact-path.mjs +53 -0
- package/dist/artifact-path.mjs.map +1 -0
- package/dist/atlas/run-atlas.d.ts +8 -0
- package/dist/atlas/run-atlas.d.ts.map +1 -0
- package/dist/atlas/shelf-pack.d.ts +55 -0
- package/dist/atlas/shelf-pack.d.ts.map +1 -0
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.mjs +3 -0
- package/dist/bridge.mjs.map +1 -0
- package/dist/build.d.ts +19 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.mjs +10203 -0
- package/dist/build.mjs.map +1 -0
- package/dist/builtin.d.ts +44 -0
- package/dist/builtin.d.ts.map +1 -0
- package/dist/builtin.mjs +141 -0
- package/dist/builtin.mjs.map +1 -0
- package/dist/catalog-builder.d.ts +43 -0
- package/dist/catalog-builder.d.ts.map +1 -0
- package/dist/catalog-delta.d.ts +11 -0
- package/dist/catalog-delta.d.ts.map +1 -0
- package/dist/catalog-projection.d.ts +91 -0
- package/dist/catalog-projection.d.ts.map +1 -0
- package/dist/cli-asset.d.ts +22 -0
- package/dist/cli-asset.d.ts.map +1 -0
- package/dist/cli-asset.mjs +9697 -0
- package/dist/cli-asset.mjs.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.mjs +29 -0
- package/dist/config.mjs.map +1 -0
- package/dist/deriveAssetName.d.ts +15 -0
- package/dist/deriveAssetName.d.ts.map +1 -0
- package/dist/errors.d.ts +30 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.mjs +19 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/evidence/material-cook.d.ts +92 -0
- package/dist/evidence/material-cook.d.ts.map +1 -0
- package/dist/evidence/offline-evidence.d.ts +25 -0
- package/dist/evidence/offline-evidence.d.ts.map +1 -0
- package/dist/evidence/source-inventory.d.ts +29 -0
- package/dist/evidence/source-inventory.d.ts.map +1 -0
- package/dist/guid.d.ts +45 -0
- package/dist/guid.d.ts.map +1 -0
- package/dist/guid.mjs +94 -0
- package/dist/guid.mjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +8612 -0
- package/dist/index.mjs.map +1 -0
- package/dist/material/artifact-writer.d.ts +14 -0
- package/dist/material/artifact-writer.d.ts.map +1 -0
- package/dist/material-cook.d.ts +2 -0
- package/dist/material-cook.d.ts.map +1 -0
- package/dist/material-cook.mjs +248 -0
- package/dist/material-cook.mjs.map +1 -0
- package/dist/mesh-bin-contract.d.ts +36 -0
- package/dist/mesh-bin-contract.d.ts.map +1 -0
- package/dist/mesh-bin-contract.mjs +96 -0
- package/dist/mesh-bin-contract.mjs.map +1 -0
- package/dist/name.mjs +22 -0
- package/dist/name.mjs.map +1 -0
- package/dist/native-cooker-registry.d.ts +47 -0
- package/dist/native-cooker-registry.d.ts.map +1 -0
- package/dist/native-cooker.d.ts +3 -0
- package/dist/native-cooker.d.ts.map +1 -0
- package/dist/native-cooker.mjs +142 -0
- package/dist/native-cooker.mjs.map +1 -0
- package/dist/package-finalizer.d.ts +121 -0
- package/dist/package-finalizer.d.ts.map +1 -0
- package/dist/producer-contract.d.ts +19 -0
- package/dist/producer-contract.d.ts.map +1 -0
- package/dist/resolve-asset-source.d.ts +4 -0
- package/dist/resolve-asset-source.d.ts.map +1 -0
- package/dist/resolve-asset-source.mjs +109 -0
- package/dist/resolve-asset-source.mjs.map +1 -0
- package/dist/runtime-projection.d.ts +14 -0
- package/dist/runtime-projection.d.ts.map +1 -0
- package/dist/runtime-publication.d.ts +44 -0
- package/dist/runtime-publication.d.ts.map +1 -0
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.mjs +7261 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/scanner.d.ts +113 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.mjs +8819 -0
- package/dist/scanner.mjs.map +1 -0
- package/dist/schema-compiled.d.ts +12 -0
- package/dist/schema-compiled.d.ts.map +1 -0
- package/dist/schema.mjs +7369 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/scriptable-pack-node.d.ts +62 -0
- package/dist/scriptable-pack-node.d.ts.map +1 -0
- package/dist/scriptable-pack-node.mjs +1674 -0
- package/dist/scriptable-pack-node.mjs.map +1 -0
- package/dist/scriptable-pack-worker.d.ts +2 -0
- package/dist/scriptable-pack-worker.d.ts.map +1 -0
- package/dist/scriptable-pack-worker.mjs +224 -0
- package/dist/scriptable-pack-worker.mjs.map +1 -0
- package/dist/scriptable-pack.d.ts +558 -0
- package/dist/scriptable-pack.d.ts.map +1 -0
- package/dist/scriptable-pack.mjs +672 -0
- package/dist/scriptable-pack.mjs.map +1 -0
- package/dist/topology.d.ts +10 -0
- package/dist/topology.d.ts.map +1 -0
- package/package.json +154 -0
- package/schema/meta.schema.json +173 -0
- package/schema/pack.schema.json +232 -0
- package/src/__tests__/ai-recovery.unit.test.ts +114 -0
- package/src/__tests__/artifact-path.test.ts +41 -0
- package/src/__tests__/asset-evidence-error-hints.test.ts +46 -0
- package/src/__tests__/asset-evidence-lifecycle.test.ts +104 -0
- package/src/__tests__/asset-evidence-schema.test.ts +86 -0
- package/src/__tests__/atlas-cli-region-mismatch.test.ts +134 -0
- package/src/__tests__/atlas-error-code-owner.test-d.ts +23 -0
- package/src/__tests__/cli-asset-evidence.integration.test.ts +172 -0
- package/src/__tests__/cli.unit.test.ts +448 -0
- package/src/__tests__/evidence-source-inventory.unit.test.ts +37 -0
- package/src/__tests__/guid-collision.unit.test.ts +112 -0
- package/src/__tests__/guid-validator-surface.unit.test.ts +20 -0
- package/src/__tests__/load-asset-config.test.ts +121 -0
- package/src/__tests__/material-cook-dependencies.unit.test.ts +112 -0
- package/src/__tests__/material-cook-receipt.unit.test.ts +148 -0
- package/src/__tests__/material-cook-schema.unit.test.ts +152 -0
- package/src/__tests__/mesh-bin-consumer-surface.unit.test.ts +22 -0
- package/src/__tests__/mesh-bin-contract.unit.test.ts +32 -0
- package/src/__tests__/meta-schema-optional.test.ts +116 -0
- package/src/__tests__/meta-source-overrides.unit.test.ts +71 -0
- package/src/__tests__/native-cooker-registry.test.ts +64 -0
- package/src/__tests__/offline-evidence-artifact-verification-owner.test-d.ts +64 -0
- package/src/__tests__/offline-evidence.integration.test.ts +106 -0
- package/src/__tests__/owner-chain.integration.test.ts +78 -0
- package/src/__tests__/pack-v2-fixture-migration.test.ts +87 -0
- package/src/__tests__/pack-v2-schema.test.ts +142 -0
- package/src/__tests__/pack.unit.test.ts +2218 -0
- package/src/__tests__/package-finalizer.contract.test.ts +105 -0
- package/src/__tests__/producer-contract-schema.unit.test.ts +92 -0
- package/src/__tests__/resolve-asset-source.test.ts +121 -0
- package/src/__tests__/runtime-projection.unit.test.ts +87 -0
- package/src/__tests__/runtime.browser.test.ts +15 -0
- package/src/__tests__/scanner-inventory.contract.test.ts +167 -0
- package/src/__tests__/scanner-inventory.test.ts +76 -0
- package/src/__tests__/scanner-mount-cycle.test.ts +232 -0
- package/src/__tests__/scriptable-pack-cli.integration.test.ts +47 -0
- package/src/__tests__/scriptable-pack-ddc-key.unit.test.ts +63 -0
- package/src/__tests__/scriptable-pack.test-d.ts +131 -0
- package/src/__tests__/scriptable-pack.unit.test.ts +789 -0
- package/src/__tests__/topology-actions.unit.test.ts +94 -0
- package/src/__tests__/topology.unit.test.ts +85 -0
- package/src/artifact-path.ts +69 -0
- package/src/atlas/run-atlas.ts +358 -0
- package/src/atlas/shelf-pack.ts +172 -0
- package/src/atlas/upng-ambient.d.ts +13 -0
- package/src/bridge.ts +2 -0
- package/src/build.ts +139 -0
- package/src/builtin.ts +117 -0
- package/src/catalog-builder.ts +313 -0
- package/src/catalog-delta.ts +189 -0
- package/src/catalog-projection.ts +344 -0
- package/src/cli-asset.ts +586 -0
- package/src/config.ts +36 -0
- package/src/deriveAssetName.ts +42 -0
- package/src/errors.ts +47 -0
- package/src/evidence/material-cook.ts +411 -0
- package/src/evidence/offline-evidence.ts +90 -0
- package/src/evidence/source-inventory.ts +193 -0
- package/src/guid.ts +99 -0
- package/src/index.ts +108 -0
- package/src/material/artifact-writer.ts +26 -0
- package/src/material-cook.ts +15 -0
- package/src/mesh-bin-contract.ts +150 -0
- package/src/native-cooker-registry.ts +235 -0
- package/src/native-cooker.ts +2 -0
- package/src/package-finalizer.ts +394 -0
- package/src/producer-contract.ts +277 -0
- package/src/resolve-asset-source.ts +88 -0
- package/src/runtime-projection.ts +100 -0
- package/src/runtime-publication.ts +190 -0
- package/src/runtime.ts +23 -0
- package/src/scanner.ts +715 -0
- package/src/schema/material-cook.schema.json +119 -0
- package/src/schema-compiled.ts +238 -0
- package/src/scriptable-pack-node.ts +1394 -0
- package/src/scriptable-pack-worker.ts +308 -0
- package/src/scriptable-pack.ts +1006 -0
- package/src/topology.ts +157 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "ForgeaX cooked material record",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["schemaVersion", "guid", "resolved", "refs", "artifact", "receipt"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"schemaVersion": { "const": "material-cook/3" },
|
|
8
|
+
"guid": { "type": "string", "minLength": 1 },
|
|
9
|
+
"materialGuid": { "type": "string", "minLength": 1 },
|
|
10
|
+
"publicationGeneration": { "type": "integer", "minimum": 1 },
|
|
11
|
+
"specializationKey": { "type": "string", "minLength": 1 },
|
|
12
|
+
"artifactDigest": { "type": "string", "pattern": "^sha256:" },
|
|
13
|
+
"sourceClosure": { "type": "array", "items": { "type": "string" } },
|
|
14
|
+
"parameterContract": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": ["parameters", "values"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"parameters": { "type": "array" },
|
|
19
|
+
"values": { "type": "object" }
|
|
20
|
+
},
|
|
21
|
+
"additionalProperties": false
|
|
22
|
+
},
|
|
23
|
+
"authored": { "type": "object", "required": ["kind"] },
|
|
24
|
+
"resolved": { "type": "object", "required": ["passes", "parameters", "values"] },
|
|
25
|
+
"refs": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"required": ["parent", "textures", "samplers", "modules"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"parent": { "type": "array", "items": { "type": "string" } },
|
|
30
|
+
"textures": { "type": "array", "items": { "type": "string" } },
|
|
31
|
+
"samplers": { "type": "array", "items": { "type": "string" } },
|
|
32
|
+
"modules": { "type": "array", "items": { "type": "string" } }
|
|
33
|
+
},
|
|
34
|
+
"additionalProperties": false
|
|
35
|
+
},
|
|
36
|
+
"artifact": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": ["mediaType", "path", "digest", "bytes"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"mediaType": { "type": "string" },
|
|
41
|
+
"path": { "type": "string" },
|
|
42
|
+
"digest": { "type": "string", "pattern": "^sha256:" },
|
|
43
|
+
"bytes": { "type": "array", "items": { "type": "integer", "minimum": 0, "maximum": 255 } }
|
|
44
|
+
},
|
|
45
|
+
"additionalProperties": false
|
|
46
|
+
},
|
|
47
|
+
"receipt": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"required": [
|
|
50
|
+
"schemaVersion",
|
|
51
|
+
"sourceClosure",
|
|
52
|
+
"profile",
|
|
53
|
+
"compilerVersion",
|
|
54
|
+
"identity",
|
|
55
|
+
"derivedInterface"
|
|
56
|
+
],
|
|
57
|
+
"properties": {
|
|
58
|
+
"schemaVersion": { "const": "material-cook/3" },
|
|
59
|
+
"sourceClosure": { "type": "array", "items": { "type": "string" } },
|
|
60
|
+
"profile": { "type": "string" },
|
|
61
|
+
"compilerVersion": { "type": "string" },
|
|
62
|
+
"identity": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"required": [
|
|
65
|
+
"materialContractDigest",
|
|
66
|
+
"sourceRevision",
|
|
67
|
+
"sourceClosureDigest",
|
|
68
|
+
"layoutIdentity",
|
|
69
|
+
"programIdentity",
|
|
70
|
+
"pipelineIdentity",
|
|
71
|
+
"materialPublicationIdentity",
|
|
72
|
+
"cookIdentity",
|
|
73
|
+
"compilerFingerprint",
|
|
74
|
+
"wasm",
|
|
75
|
+
"artifactDigest",
|
|
76
|
+
"valueGeneration",
|
|
77
|
+
"dependencyGeneration",
|
|
78
|
+
"cookGeneration"
|
|
79
|
+
],
|
|
80
|
+
"properties": {
|
|
81
|
+
"materialContractDigest": { "type": "string", "minLength": 1 },
|
|
82
|
+
"sourceRevision": { "type": "string", "minLength": 1 },
|
|
83
|
+
"sourceClosureDigest": { "type": "string", "minLength": 1 },
|
|
84
|
+
"layoutIdentity": { "type": "string", "minLength": 1 },
|
|
85
|
+
"programIdentity": { "type": "string", "minLength": 1 },
|
|
86
|
+
"pipelineIdentity": { "type": "string", "minLength": 1 },
|
|
87
|
+
"materialPublicationIdentity": { "type": "string", "minLength": 1 },
|
|
88
|
+
"cookIdentity": { "type": "string", "minLength": 1 },
|
|
89
|
+
"compilerFingerprint": { "type": "string", "minLength": 1 },
|
|
90
|
+
"wasm": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"required": ["sourceContentKey", "artifactSha256", "glueSha256"],
|
|
93
|
+
"properties": {
|
|
94
|
+
"sourceContentKey": { "type": "string", "minLength": 1 },
|
|
95
|
+
"artifactSha256": { "type": "string", "minLength": 1 },
|
|
96
|
+
"glueSha256": { "type": "string", "minLength": 1 }
|
|
97
|
+
},
|
|
98
|
+
"additionalProperties": false
|
|
99
|
+
},
|
|
100
|
+
"artifactDigest": { "type": "string", "minLength": 1 },
|
|
101
|
+
"valueGeneration": { "type": "integer", "minimum": 1 },
|
|
102
|
+
"dependencyGeneration": { "type": "integer", "minimum": 1 },
|
|
103
|
+
"cookGeneration": { "type": "integer", "minimum": 1 }
|
|
104
|
+
},
|
|
105
|
+
"additionalProperties": false
|
|
106
|
+
},
|
|
107
|
+
"derivedInterface": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"required": ["layoutIdentity"],
|
|
110
|
+
"properties": { "layoutIdentity": { "type": "string", "minLength": 1 } },
|
|
111
|
+
"additionalProperties": false
|
|
112
|
+
},
|
|
113
|
+
"publicationGeneration": { "type": "integer", "minimum": 1 }
|
|
114
|
+
},
|
|
115
|
+
"additionalProperties": false
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"additionalProperties": false
|
|
119
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import type { PackV2 } from '@forgeax/engine-types';
|
|
2
|
+
import Ajv, { type ValidateFunction } from 'ajv';
|
|
3
|
+
import addFormats from 'ajv-formats';
|
|
4
|
+
import metaSchemaJson from '../schema/meta.schema.json' with { type: 'json' };
|
|
5
|
+
import packSchemaJson from '../schema/pack.schema.json' with { type: 'json' };
|
|
6
|
+
|
|
7
|
+
const ajv = new Ajv({ strict: true, allErrors: false });
|
|
8
|
+
addFormats(ajv, ['uuid']);
|
|
9
|
+
|
|
10
|
+
// Module-top-level compiled validators - compiled once on import, never recreated.
|
|
11
|
+
export const validateMeta = ajv.compile(metaSchemaJson);
|
|
12
|
+
export const validatePack = ajv.compile(packSchemaJson);
|
|
13
|
+
|
|
14
|
+
export function validatePackV2(value: unknown): value is PackV2 {
|
|
15
|
+
if (!validatePack(value) || !isPackV2Shape(value)) return false;
|
|
16
|
+
|
|
17
|
+
const seenGuids = new Set<string>();
|
|
18
|
+
for (const asset of value.assets) {
|
|
19
|
+
if (seenGuids.has(asset.guid)) return false;
|
|
20
|
+
seenGuids.add(asset.guid);
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function isPackV2Shape(value: unknown): value is PackV2 {
|
|
26
|
+
return (
|
|
27
|
+
typeof value === 'object' &&
|
|
28
|
+
value !== null &&
|
|
29
|
+
'schemaVersion' in value &&
|
|
30
|
+
value.schemaVersion === '2.0.0'
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// === SceneAsset payload validator factory (feat-20260514 w5 / D-P4) =============
|
|
35
|
+
//
|
|
36
|
+
// Decision anchors:
|
|
37
|
+
// - plan-strategy §D-P4 (per-component additionalProperties:false, path a;
|
|
38
|
+
// path b "extend PackErrorDetail" rejected to keep the 8-member
|
|
39
|
+
// PackErrorCode closed union frozen)
|
|
40
|
+
// - requirements §AC-08(b) (typo field name fail-fast through ajv with the
|
|
41
|
+
// verbatim 'additional properties' message wording)
|
|
42
|
+
// - requirements §AC-10 (no new SceneErrorCode / PackErrorCode introduced)
|
|
43
|
+
//
|
|
44
|
+
// `buildSceneAssetValidator(componentSchemas)` returns a fresh ajv
|
|
45
|
+
// `ValidateFunction` whose JSON Schema sub-tree describes:
|
|
46
|
+
// {
|
|
47
|
+
// kind: 'scene',
|
|
48
|
+
// nodes: SceneEntity[]
|
|
49
|
+
// }
|
|
50
|
+
// where each SceneEntity has the closed shape
|
|
51
|
+
// { localId: integer, components: <closed map keyed by registered tokens> }
|
|
52
|
+
// and the per-component sub-schema is composed verbatim from the caller's
|
|
53
|
+
// `componentSchemas[name]` entry. `additionalProperties: false` is applied
|
|
54
|
+
// at three layers: top-level SceneAsset, SceneEntity, and SceneEntity.components,
|
|
55
|
+
// so ajv emits an `additional properties` ajvError on any typo or unknown
|
|
56
|
+
// component token (AC-08(b)).
|
|
57
|
+
//
|
|
58
|
+
// The runtime layer feeds `componentSchemas` from the live `defineComponent`
|
|
59
|
+
// registry; this factory itself stays ECS-free (charter proposition 5
|
|
60
|
+
// consistent abstraction: pack package is layered below ecs and runtime,
|
|
61
|
+
// the per-component schemas arrive as plain ajv-compatible JSON Schema
|
|
62
|
+
// objects).
|
|
63
|
+
export function buildSceneAssetValidator(
|
|
64
|
+
componentSchemas: Readonly<Record<string, object>>,
|
|
65
|
+
): ValidateFunction {
|
|
66
|
+
// Use a separate ajv instance so the dynamically registered closed map of
|
|
67
|
+
// component sub-schemas does not pollute the module-top-level validators
|
|
68
|
+
// above (they may be re-built across test fixtures with different
|
|
69
|
+
// component sets).
|
|
70
|
+
const localAjv = new Ajv({ strict: true, allErrors: false });
|
|
71
|
+
addFormats(localAjv, ['uuid']);
|
|
72
|
+
|
|
73
|
+
const componentsProperties: Record<string, object> = {};
|
|
74
|
+
for (const [name, sub] of Object.entries(componentSchemas)) {
|
|
75
|
+
componentsProperties[name] = sub;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// MountOverride schema (feat-20260608-scene-nesting-ecs-fication M1 / w11;
|
|
79
|
+
// feat-20260713-mount-override-component-add-and-shared-ref-round M1 / w3;
|
|
80
|
+
// requirements §S-10 / AC-03): validates each entry in mounts[].overrides[].
|
|
81
|
+
// `field` is optional — it is a component-granular add-or-patch discriminant
|
|
82
|
+
// (present -> patch one field with `value`; absent -> add/upsert the whole
|
|
83
|
+
// `comp` with `value` as its per-field map). `localId` / `comp` / `value`
|
|
84
|
+
// stay required; `additionalProperties: false` rejects any `op`-tag
|
|
85
|
+
// discriminant so downstream consumers never branch on it. Field-level type
|
|
86
|
+
// validation (matching the schema vocab) is enforced at runtime via
|
|
87
|
+
// setSceneOverride (D-9 / EcsErrorCode 'scene-override-type-mismatch').
|
|
88
|
+
const mountOverrideSchema = {
|
|
89
|
+
type: 'object',
|
|
90
|
+
additionalProperties: false,
|
|
91
|
+
required: ['localId', 'comp', 'value'],
|
|
92
|
+
properties: {
|
|
93
|
+
localId: { type: 'integer', minimum: 0 },
|
|
94
|
+
comp: { type: 'string', minLength: 1 },
|
|
95
|
+
field: { type: 'string', minLength: 1 },
|
|
96
|
+
value: {},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// SceneInstanceMount schema (feat-20260608-scene-nesting-ecs-fication
|
|
101
|
+
// M1 / w11; requirements §S-10): validates each mounts[] entry. parent /
|
|
102
|
+
// components / overrides are optional; cross-mount window collision and
|
|
103
|
+
// mount.source / mount.memberCount agreement with referenced child
|
|
104
|
+
// SceneAsset are checked at the build-time scanner (D-1, w14), not here.
|
|
105
|
+
const mountSchema = {
|
|
106
|
+
type: 'object',
|
|
107
|
+
additionalProperties: false,
|
|
108
|
+
required: ['localId', 'source', 'memberFirst', 'memberCount'],
|
|
109
|
+
properties: {
|
|
110
|
+
localId: { type: 'integer', minimum: 0 },
|
|
111
|
+
source: { type: 'integer', minimum: 0 },
|
|
112
|
+
memberFirst: { type: 'integer', minimum: 0 },
|
|
113
|
+
memberCount: { type: 'integer', minimum: 0 },
|
|
114
|
+
parent: { type: 'integer', minimum: 0 },
|
|
115
|
+
components: {
|
|
116
|
+
type: 'object',
|
|
117
|
+
additionalProperties: false,
|
|
118
|
+
properties: componentsProperties,
|
|
119
|
+
},
|
|
120
|
+
overrides: {
|
|
121
|
+
type: 'array',
|
|
122
|
+
items: mountOverrideSchema,
|
|
123
|
+
},
|
|
124
|
+
publicationFence: {
|
|
125
|
+
type: 'object',
|
|
126
|
+
additionalProperties: false,
|
|
127
|
+
required: [
|
|
128
|
+
'schemaVersion',
|
|
129
|
+
'sourcePath',
|
|
130
|
+
'sourceRevision',
|
|
131
|
+
'publicationGeneration',
|
|
132
|
+
'outputDigest',
|
|
133
|
+
'outputSetDigest',
|
|
134
|
+
'receiptIdentity',
|
|
135
|
+
],
|
|
136
|
+
properties: {
|
|
137
|
+
schemaVersion: { type: 'string', const: 'scene-publication-fence/1' },
|
|
138
|
+
sourcePath: { type: 'string', minLength: 1 },
|
|
139
|
+
sourceRevision: { type: 'string', minLength: 1 },
|
|
140
|
+
publicationGeneration: { type: 'integer', minimum: 1 },
|
|
141
|
+
outputDigest: { type: 'string', minLength: 1 },
|
|
142
|
+
outputSetDigest: { type: 'string', minLength: 1 },
|
|
143
|
+
receiptIdentity: { type: 'string', minLength: 1 },
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const sceneSchema = {
|
|
150
|
+
type: 'object',
|
|
151
|
+
additionalProperties: false,
|
|
152
|
+
required: ['kind', 'entities'],
|
|
153
|
+
properties: {
|
|
154
|
+
kind: { type: 'string', const: 'scene' },
|
|
155
|
+
entities: {
|
|
156
|
+
type: 'array',
|
|
157
|
+
items: {
|
|
158
|
+
type: 'object',
|
|
159
|
+
additionalProperties: false,
|
|
160
|
+
required: ['localId', 'components'],
|
|
161
|
+
properties: {
|
|
162
|
+
localId: { type: 'integer', minimum: 0 },
|
|
163
|
+
components: {
|
|
164
|
+
type: 'object',
|
|
165
|
+
additionalProperties: false,
|
|
166
|
+
properties: componentsProperties,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
// Optional top-level mounts[] (feat-20260608-scene-nesting-ecs-fication
|
|
172
|
+
// M1 / w11). Missing mounts is semantically equivalent to mounts: []
|
|
173
|
+
// (plan-strategy §6.3 back-compat); ajv default produces the empty
|
|
174
|
+
// array on absent input.
|
|
175
|
+
mounts: {
|
|
176
|
+
type: 'array',
|
|
177
|
+
items: mountSchema,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
return localAjv.compile(sceneSchema);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// === MaterialAsset payload validator factory (feat-20260523-shader-template-instance-split M1-T06) ===
|
|
186
|
+
//
|
|
187
|
+
// Decision anchors:
|
|
188
|
+
// - plan-strategy D-PackKind (factory pattern, same shape as buildSceneAssetValidator)
|
|
189
|
+
// - plan-strategy D-ParamTypeWhitelist (paramTypeWhitelist consumed here)
|
|
190
|
+
// - requirements AC-04 (v1 type set SSOT; validator covers all param type boundaries)
|
|
191
|
+
//
|
|
192
|
+
// `buildMaterialAssetValidator(paramTypeWhitelist)` returns an ajv
|
|
193
|
+
// `ValidateFunction` that validates:
|
|
194
|
+
// {
|
|
195
|
+
// materialShader: string,
|
|
196
|
+
// paramSchema: ParamSchemaEntry[],
|
|
197
|
+
// values: object
|
|
198
|
+
// }
|
|
199
|
+
// Each ParamSchemaEntry.type must be in the whitelist (D-ParamTypeWhitelist).
|
|
200
|
+
// `additionalProperties: false` at top level so ajv rejects unknown fields.
|
|
201
|
+
// values is free-form (object) — the runtime layer does deeper validation.
|
|
202
|
+
//
|
|
203
|
+
// Uses a separate ajv instance per call so different whitelists across
|
|
204
|
+
// test fixtures do not pollute the module-top-level validators.
|
|
205
|
+
export function buildMaterialAssetValidator(
|
|
206
|
+
paramTypeWhitelist: ReadonlySet<string>,
|
|
207
|
+
): ValidateFunction {
|
|
208
|
+
const localAjv = new Ajv({ strict: true, allErrors: false });
|
|
209
|
+
|
|
210
|
+
const whitelistEnum = Array.from(paramTypeWhitelist);
|
|
211
|
+
|
|
212
|
+
const paramSchemaEntry = {
|
|
213
|
+
type: 'object',
|
|
214
|
+
additionalProperties: false,
|
|
215
|
+
required: ['name', 'type'],
|
|
216
|
+
properties: {
|
|
217
|
+
name: { type: 'string', minLength: 1 },
|
|
218
|
+
type: { type: 'string', enum: whitelistEnum },
|
|
219
|
+
default: {},
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const materialSchema = {
|
|
224
|
+
type: 'object',
|
|
225
|
+
additionalProperties: false,
|
|
226
|
+
required: ['materialShader', 'paramSchema', 'values'],
|
|
227
|
+
properties: {
|
|
228
|
+
materialShader: { type: 'string', minLength: 1 },
|
|
229
|
+
paramSchema: {
|
|
230
|
+
type: 'array',
|
|
231
|
+
items: paramSchemaEntry,
|
|
232
|
+
},
|
|
233
|
+
values: { type: 'object' },
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return localAjv.compile(materialSchema);
|
|
238
|
+
}
|