@forgeax/engine-pack 0.1.30 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/build.d.ts +1 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.mjs +237 -17
- package/dist/build.mjs.map +1 -1
- package/dist/cli-asset.d.ts +63 -0
- package/dist/cli-asset.d.ts.map +1 -1
- package/dist/cli-asset.mjs +142 -4
- package/dist/cli-asset.mjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/native-cooker-registry.d.ts.map +1 -1
- package/dist/native-cooker.mjs +13 -1
- package/dist/native-cooker.mjs.map +1 -1
- package/dist/pack-authoring-node.d.ts +6 -0
- package/dist/pack-authoring-node.d.ts.map +1 -1
- package/dist/pack-authoring-node.mjs +215 -11
- package/dist/pack-authoring-node.mjs.map +1 -1
- package/dist/pack-authoring.d.ts +26 -0
- package/dist/pack-authoring.d.ts.map +1 -1
- package/dist/pack-authoring.mjs.map +1 -1
- package/dist/runtime-publication.d.ts +8 -0
- package/dist/runtime-publication.d.ts.map +1 -1
- package/dist/scanner.d.ts +1 -1
- package/dist/scanner.mjs +5 -5
- package/dist/scanner.mjs.map +1 -1
- package/dist/scriptable-pack-node.mjs.map +1 -1
- package/dist/scriptable-pack.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/cli.unit.test.ts +87 -0
- package/src/__tests__/native-cooker-registry.test.ts +16 -0
- package/src/__tests__/pack-authoring-gateway.unit.test.ts +49 -0
- package/src/__tests__/pack.unit.test.ts +6 -6
- package/src/__tests__/runtime-publication.unit.test.ts +27 -1
- package/src/build.ts +2 -0
- package/src/cli-asset.ts +227 -5
- package/src/native-cooker-registry.ts +14 -1
- package/src/pack-authoring-node.ts +258 -9
- package/src/pack-authoring.ts +26 -0
- package/src/runtime-publication.ts +44 -0
- package/src/scanner.ts +5 -5
package/README.md
CHANGED
|
@@ -495,9 +495,9 @@ this package does not publish an independent executable.
|
|
|
495
495
|
|
|
496
496
|
| Subcommand | Description | Exit code |
|
|
497
497
|
|:--|:--|:--|
|
|
498
|
-
| `forgeax asset list --root <project> --json` | Print
|
|
498
|
+
| `forgeax asset list --root <project> --json` | Print a bounded page (default `limit=100`, maximum 256); add `--type` and `--cursor` to continue | 0 on valid roots |
|
|
499
499
|
| `forgeax asset inspect --subject <guid> --root <project> --json` | Print matching asset evidence | 0 found / 1 not found |
|
|
500
|
-
| `forgeax asset verify --root <project> --json` | Run the fail-fast scanner and return
|
|
500
|
+
| `forgeax asset verify --root <project> --json` | Run the fail-fast scanner and return a bounded `asset-verification-v1` source/output report | 0 clean / 1 error |
|
|
501
501
|
|
|
502
502
|
```bash
|
|
503
503
|
# Direct invocation (after pnpm -F @forgeax/engine-pack build)
|
package/dist/build.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { type FinalizedPackageProduct, finalizePackageProduct, finalizePackageTr
|
|
|
17
17
|
export { validateProducerContract, validateProducerOutputs } from './producer-contract.js';
|
|
18
18
|
export { resolveAssetSource } from './resolve-asset-source.js';
|
|
19
19
|
export { parsePackV2, validateMeta, validatePack, validatePackV2 } from './runtime.js';
|
|
20
|
-
export { createRuntimePackPublication, type RuntimePackAssetInput, type RuntimePackEnvelope, type RuntimePackInput, type RuntimePackPublication, type RuntimePackPublicationInput, } from './runtime-publication.js';
|
|
20
|
+
export { bindRuntimePackScope, createRuntimePackPublication, type RuntimePackAssetInput, type RuntimePackEnvelope, type RuntimePackInput, type RuntimePackPublication, type RuntimePackPublicationInput, stripRuntimePackLifecycle, } from './runtime-publication.js';
|
|
21
21
|
export { type InventoryDeclaration, type LegacyPackInventoryDocument, type PackInventoryAsset, type PackInventoryDocument, type PackSourceInventoryDocument, type ScanInventory, type ScanOptions, type ScanSourceDeclaration, type ScriptablePackInventoryDeclaration, type ScriptablePackScanOptions, STANDARD_SCRIPTABLE_PACK_SCAN_OPTIONS, scanInventory, } from './scanner.js';
|
|
22
22
|
export { type AssetReader, isScriptablePackAssetKind, projectScriptablePackSceneComponents, SCRIPTABLE_PACK_ASSET_KINDS, type ScriptablePackAssetKind, type ScriptablePackReadError, type ScriptablePackSourceClosureEntry, } from './scriptable-pack.js';
|
|
23
23
|
export { calculateTopologyDiff, diffTopology } from './topology.js';
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,aAAa,EACb,cAAc,EACd,KAAK,EACL,cAAc,EACd,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,oBAAoB,EACpB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,oBAAoB,EACzB,uBAA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AK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,kCAAkC,EACvC,KAAK,yBAAyB,EAC9B,qCAAqC,EACrC,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,WAAW,EAChB,yBAAyB,EACzB,oCAAoC,EACpC,2BAA2B,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,gCAAgC,GACtC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/build.mjs
CHANGED
|
@@ -9254,11 +9254,11 @@ function record(value) {
|
|
|
9254
9254
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
9255
9255
|
}
|
|
9256
9256
|
var STANDARD_SCRIPTABLE_PACK_SCAN_OPTIONS = Object.freeze({
|
|
9257
|
-
// Scriptable Packs execute in an isolated worker.
|
|
9258
|
-
//
|
|
9259
|
-
//
|
|
9260
|
-
//
|
|
9261
|
-
timeoutMs:
|
|
9257
|
+
// Scriptable Packs execute in an isolated worker. A cold worker must compile
|
|
9258
|
+
// the authored source closure before it can return metadata. Keep the bound
|
|
9259
|
+
// finite while allowing a heavy character/scene closure to complete on a
|
|
9260
|
+
// busy host.
|
|
9261
|
+
timeoutMs: 12e4
|
|
9262
9262
|
});
|
|
9263
9263
|
var BLACKLIST = /* @__PURE__ */ new Set([
|
|
9264
9264
|
"node_modules",
|
|
@@ -10971,6 +10971,7 @@ function decodeMeshBinHeader(bytes, sourceKey2 = "<unknown mesh source>") {
|
|
|
10971
10971
|
}
|
|
10972
10972
|
};
|
|
10973
10973
|
}
|
|
10974
|
+
var VERIFY_PROVENANCE_LIMIT = 256;
|
|
10974
10975
|
function isRecord3(value) {
|
|
10975
10976
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10976
10977
|
}
|
|
@@ -11267,6 +11268,54 @@ async function readMaterialized(options, operation) {
|
|
|
11267
11268
|
);
|
|
11268
11269
|
return ok(materialized);
|
|
11269
11270
|
}
|
|
11271
|
+
async function readAdditionalKnownGuids(options, operation) {
|
|
11272
|
+
let rawGuids;
|
|
11273
|
+
try {
|
|
11274
|
+
rawGuids = await options.additionalKnownGuids?.() ?? [];
|
|
11275
|
+
} catch (cause) {
|
|
11276
|
+
return err(
|
|
11277
|
+
makeError(
|
|
11278
|
+
"pack-parameter-invalid",
|
|
11279
|
+
"the additionalKnownGuids callback to return current Catalog GUIDs",
|
|
11280
|
+
"repair the build-owner Catalog projection callback, then retry the Pack operation",
|
|
11281
|
+
{
|
|
11282
|
+
requestId: operation.requestId,
|
|
11283
|
+
cause: cause instanceof Error ? cause.message : String(cause)
|
|
11284
|
+
}
|
|
11285
|
+
)
|
|
11286
|
+
);
|
|
11287
|
+
}
|
|
11288
|
+
if (!Array.isArray(rawGuids)) {
|
|
11289
|
+
return err(
|
|
11290
|
+
makeError(
|
|
11291
|
+
"pack-parameter-invalid",
|
|
11292
|
+
"additionalKnownGuids to be an array of AssetGuid strings",
|
|
11293
|
+
"repair the build-owner Catalog projection before querying Pack authoring",
|
|
11294
|
+
{ requestId: operation.requestId, actual: typeof rawGuids }
|
|
11295
|
+
)
|
|
11296
|
+
);
|
|
11297
|
+
}
|
|
11298
|
+
const guids = [];
|
|
11299
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11300
|
+
for (const candidate of rawGuids) {
|
|
11301
|
+
if (typeof candidate !== "string" || !isValidAssetGuidString(candidate)) {
|
|
11302
|
+
return err(
|
|
11303
|
+
makeError(
|
|
11304
|
+
"pack-parameter-invalid",
|
|
11305
|
+
"additionalKnownGuids to contain valid AssetGuid strings",
|
|
11306
|
+
"repair the build-owner Catalog projection before querying Pack authoring",
|
|
11307
|
+
{ requestId: operation.requestId, guid: candidate }
|
|
11308
|
+
)
|
|
11309
|
+
);
|
|
11310
|
+
}
|
|
11311
|
+
const guid = candidate.toLowerCase();
|
|
11312
|
+
if (!seen.has(guid)) {
|
|
11313
|
+
seen.add(guid);
|
|
11314
|
+
guids.push(guid);
|
|
11315
|
+
}
|
|
11316
|
+
}
|
|
11317
|
+
return ok(guids);
|
|
11318
|
+
}
|
|
11270
11319
|
async function createSnapshot(options, operation) {
|
|
11271
11320
|
const scanned = options.inventory === void 0 ? await scanInventory(scanRoots(options)) : await options.inventory();
|
|
11272
11321
|
if (!scanned.ok) return err(scanFailure(operation, scanned.error));
|
|
@@ -11322,6 +11371,8 @@ async function createSnapshot(options, operation) {
|
|
|
11322
11371
|
}
|
|
11323
11372
|
const materializedResult = await readMaterialized(options, operation);
|
|
11324
11373
|
if (!materializedResult.ok) return materializedResult;
|
|
11374
|
+
const additionalKnownGuidsResult = await readAdditionalKnownGuids(options, operation);
|
|
11375
|
+
if (!additionalKnownGuidsResult.ok) return additionalKnownGuidsResult;
|
|
11325
11376
|
const materialized = materializedResult.value;
|
|
11326
11377
|
const guidOwners = /* @__PURE__ */ new Map();
|
|
11327
11378
|
const directPairs = /* @__PURE__ */ new Set();
|
|
@@ -11373,7 +11424,8 @@ async function createSnapshot(options, operation) {
|
|
|
11373
11424
|
const knownGuids = /* @__PURE__ */ new Set([
|
|
11374
11425
|
...scanned.value.inventory.map((entry) => entry.guid.toLowerCase()),
|
|
11375
11426
|
...directAssets.map((asset) => asset.guid),
|
|
11376
|
-
...materialized.map((asset) => asset.guid)
|
|
11427
|
+
...materialized.map((asset) => asset.guid),
|
|
11428
|
+
...additionalKnownGuidsResult.value
|
|
11377
11429
|
]);
|
|
11378
11430
|
return ok({ inventory: scanned.value, subjects, directAssets, materialized, knownGuids });
|
|
11379
11431
|
}
|
|
@@ -11880,7 +11932,164 @@ async function resolveAsset(gameRoot, snapshot, operation) {
|
|
|
11880
11932
|
}
|
|
11881
11933
|
});
|
|
11882
11934
|
}
|
|
11883
|
-
|
|
11935
|
+
function verificationSourceFormat(gameRoot, sourcePath, fallback = "pack.ts") {
|
|
11936
|
+
if (sourcePath === void 0) return fallback;
|
|
11937
|
+
const absolute = resolve(gameRoot, sourcePath);
|
|
11938
|
+
if (absolute.endsWith(".meta.json")) return "meta.json";
|
|
11939
|
+
if (absolute.endsWith(".pack.json")) return "pack.json";
|
|
11940
|
+
if (absolute.endsWith(".pack.ts")) return "pack.ts";
|
|
11941
|
+
return fallback;
|
|
11942
|
+
}
|
|
11943
|
+
function verificationAuthorFacts(snapshot, entry) {
|
|
11944
|
+
const declaration = snapshot.inventory.declarations.get(entry.sourcePath);
|
|
11945
|
+
if (declaration?.format === "meta.json") {
|
|
11946
|
+
const asset = declaration.value.subAssets.find(
|
|
11947
|
+
(candidate) => candidate.guid.toLowerCase() === entry.guid.toLowerCase()
|
|
11948
|
+
);
|
|
11949
|
+
return {
|
|
11950
|
+
...asset?.name === void 0 && asset?.sourceKey === void 0 ? {} : { name: asset.name ?? asset.sourceKey },
|
|
11951
|
+
dependencies: []
|
|
11952
|
+
};
|
|
11953
|
+
}
|
|
11954
|
+
if (declaration?.format === "pack.json") {
|
|
11955
|
+
if (declaration.value.schemaVersion === "3.0.0") {
|
|
11956
|
+
const parsed = parsePackSourceJson(declaration.value);
|
|
11957
|
+
if (parsed.ok && parsed.value.format === "direct" && entry.sourceKey !== void 0) {
|
|
11958
|
+
const asset = parsed.value.assets[entry.sourceKey];
|
|
11959
|
+
return {
|
|
11960
|
+
...asset?.name === void 0 ? {} : { name: asset.name },
|
|
11961
|
+
dependencies: asset?.refs ?? []
|
|
11962
|
+
};
|
|
11963
|
+
}
|
|
11964
|
+
} else {
|
|
11965
|
+
const asset = declaration.value.assets.find(
|
|
11966
|
+
(candidate) => candidate.guid.toLowerCase() === entry.guid.toLowerCase()
|
|
11967
|
+
);
|
|
11968
|
+
return {
|
|
11969
|
+
...asset?.name === void 0 ? {} : { name: asset.name },
|
|
11970
|
+
dependencies: asset?.refs ?? []
|
|
11971
|
+
};
|
|
11972
|
+
}
|
|
11973
|
+
}
|
|
11974
|
+
return { dependencies: [] };
|
|
11975
|
+
}
|
|
11976
|
+
function verificationOutput(materialized, legacyPublished = false) {
|
|
11977
|
+
if (materialized !== void 0) {
|
|
11978
|
+
return {
|
|
11979
|
+
status: materialized.ready ? "produced" : "unknown",
|
|
11980
|
+
availability: materialized.ready ? "available" : "unknown",
|
|
11981
|
+
freshness: "unknown"
|
|
11982
|
+
};
|
|
11983
|
+
}
|
|
11984
|
+
if (legacyPublished) {
|
|
11985
|
+
return {
|
|
11986
|
+
status: "produced",
|
|
11987
|
+
availability: "unknown",
|
|
11988
|
+
freshness: "unknown"
|
|
11989
|
+
// A legacy Pack row is a validated published declaration. The bytes
|
|
11990
|
+
// remain outside this read-only gateway, so availability is unknown.
|
|
11991
|
+
};
|
|
11992
|
+
}
|
|
11993
|
+
return { status: "unproduced", availability: "unknown", freshness: "unknown" };
|
|
11994
|
+
}
|
|
11995
|
+
function createGatewayVerificationReport(gameRoot, snapshot) {
|
|
11996
|
+
const materializedByGuid = new Map(
|
|
11997
|
+
snapshot.materialized.map((asset) => [asset.guid.toLowerCase(), asset])
|
|
11998
|
+
);
|
|
11999
|
+
const rows = /* @__PURE__ */ new Map();
|
|
12000
|
+
for (const entry of snapshot.inventory.inventory) {
|
|
12001
|
+
const declaration = snapshot.inventory.declarations.get(entry.sourcePath);
|
|
12002
|
+
const format = declaration?.format ?? verificationSourceFormat(gameRoot, entry.sourcePath);
|
|
12003
|
+
const facts = verificationAuthorFacts(snapshot, entry);
|
|
12004
|
+
const materialized = materializedByGuid.get(entry.guid.toLowerCase());
|
|
12005
|
+
const legacyPublished = declaration?.format === "pack.json" && declaration.value.schemaVersion !== "3.0.0";
|
|
12006
|
+
rows.set(entry.guid.toLowerCase(), {
|
|
12007
|
+
guid: entry.guid,
|
|
12008
|
+
type: entry.kind,
|
|
12009
|
+
source: {
|
|
12010
|
+
path: entry.sourcePath,
|
|
12011
|
+
format,
|
|
12012
|
+
role: "author",
|
|
12013
|
+
...entry.sourceRevision === void 0 ? {} : { revision: entry.sourceRevision }
|
|
12014
|
+
},
|
|
12015
|
+
output: verificationOutput(materialized, legacyPublished),
|
|
12016
|
+
dependencies: facts.dependencies,
|
|
12017
|
+
producer: {
|
|
12018
|
+
state: materialized !== void 0 ? "published" : legacyPublished ? "published" : "not-run"
|
|
12019
|
+
},
|
|
12020
|
+
...facts.name === void 0 ? {} : { name: facts.name },
|
|
12021
|
+
...entry.sourceKey === void 0 ? {} : { sourceKey: entry.sourceKey },
|
|
12022
|
+
...entry.sourceIndex === void 0 ? {} : { sourceIndex: entry.sourceIndex }
|
|
12023
|
+
});
|
|
12024
|
+
}
|
|
12025
|
+
for (const asset of snapshot.materialized) {
|
|
12026
|
+
const key = asset.guid.toLowerCase();
|
|
12027
|
+
if (rows.has(key)) continue;
|
|
12028
|
+
const sourcePath = asset.sourcePath === void 0 ? void 0 : resolve(gameRoot, asset.sourcePath);
|
|
12029
|
+
const declaration = sourcePath === void 0 ? void 0 : snapshot.inventory.declarations.get(sourcePath);
|
|
12030
|
+
const format = declaration?.format ?? verificationSourceFormat(gameRoot, asset.sourcePath);
|
|
12031
|
+
rows.set(key, {
|
|
12032
|
+
guid: asset.guid,
|
|
12033
|
+
type: asset.kind,
|
|
12034
|
+
source: {
|
|
12035
|
+
path: sourcePath ?? `${asset.packageId}/${asset.sourceKey}`,
|
|
12036
|
+
format,
|
|
12037
|
+
role: "author",
|
|
12038
|
+
...declaration === void 0 ? {} : { revision: declaration.sourceRevision }
|
|
12039
|
+
},
|
|
12040
|
+
output: verificationOutput(asset),
|
|
12041
|
+
dependencies: asset.refs ?? [],
|
|
12042
|
+
producer: { state: "published" },
|
|
12043
|
+
sourceKey: asset.sourceKey
|
|
12044
|
+
});
|
|
12045
|
+
}
|
|
12046
|
+
const assets = [...rows.values()].sort(
|
|
12047
|
+
(left, right) => `${left.source.path}:${left.guid}`.localeCompare(`${right.source.path}:${right.guid}`)
|
|
12048
|
+
);
|
|
12049
|
+
const emitted = assets.slice(0, VERIFY_PROVENANCE_LIMIT);
|
|
12050
|
+
const sourcePaths = [...snapshot.inventory.declarations.keys()].sort();
|
|
12051
|
+
const scriptablePackSources = [...snapshot.inventory.declarations.values()].filter((declaration) => declaration.format === "pack.ts").sort((left, right) => left.sourcePath.localeCompare(right.sourcePath));
|
|
12052
|
+
const unmaterializedScriptable = scriptablePackSources.filter(
|
|
12053
|
+
(source) => !snapshot.materialized.some(
|
|
12054
|
+
(asset) => asset.packageId === source.value.packageId.toLowerCase() || asset.sourcePath !== void 0 && resolve(gameRoot, asset.sourcePath) === source.sourcePath
|
|
12055
|
+
)
|
|
12056
|
+
);
|
|
12057
|
+
return {
|
|
12058
|
+
schemaVersion: "asset-verification-v1",
|
|
12059
|
+
root: resolve(gameRoot),
|
|
12060
|
+
operation: "asset.verify",
|
|
12061
|
+
requestId: "gateway",
|
|
12062
|
+
scope: {
|
|
12063
|
+
sourceCount: sourcePaths.length,
|
|
12064
|
+
assetCount: assets.length,
|
|
12065
|
+
sourcePaths: sourcePaths.slice(0, VERIFY_PROVENANCE_LIMIT),
|
|
12066
|
+
omittedSourceCount: Math.max(0, sourcePaths.length - VERIFY_PROVENANCE_LIMIT),
|
|
12067
|
+
assetLimit: VERIFY_PROVENANCE_LIMIT,
|
|
12068
|
+
truncated: assets.length > VERIFY_PROVENANCE_LIMIT,
|
|
12069
|
+
scriptablePackSourceCount: scriptablePackSources.length,
|
|
12070
|
+
scriptablePackSources: unmaterializedScriptable.slice(0, VERIFY_PROVENANCE_LIMIT).map((source) => ({
|
|
12071
|
+
sourcePath: source.sourcePath,
|
|
12072
|
+
packageId: source.value.packageId,
|
|
12073
|
+
output: "unproduced",
|
|
12074
|
+
reason: "producer-not-run"
|
|
12075
|
+
})),
|
|
12076
|
+
omittedScriptablePackSourceCount: Math.max(
|
|
12077
|
+
0,
|
|
12078
|
+
unmaterializedScriptable.length - VERIFY_PROVENANCE_LIMIT
|
|
12079
|
+
)
|
|
12080
|
+
},
|
|
12081
|
+
assets: emitted,
|
|
12082
|
+
summary: {
|
|
12083
|
+
assetCount: assets.length,
|
|
12084
|
+
emittedAssetCount: emitted.length,
|
|
12085
|
+
materialCount: assets.filter((asset) => asset.type === "material").length,
|
|
12086
|
+
unproducedAssetCount: assets.filter((asset) => asset.output.status === "unproduced").length,
|
|
12087
|
+
unknownAssetCount: assets.filter((asset) => asset.output.status === "unknown").length,
|
|
12088
|
+
unmaterializedScriptablePackCount: unmaterializedScriptable.length
|
|
12089
|
+
}
|
|
12090
|
+
};
|
|
12091
|
+
}
|
|
12092
|
+
async function verify(gameRoot, snapshot, operation) {
|
|
11884
12093
|
for (const subject of snapshot.subjects.values()) {
|
|
11885
12094
|
if (subject.format === "instance") {
|
|
11886
12095
|
const resolved = await resolveInstance(snapshot, subject);
|
|
@@ -11925,14 +12134,8 @@ async function verify(snapshot, operation) {
|
|
|
11925
12134
|
);
|
|
11926
12135
|
}
|
|
11927
12136
|
}
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
requestId: operation.requestId,
|
|
11931
|
-
snapshot: {
|
|
11932
|
-
sourceCount: snapshot.subjects.size,
|
|
11933
|
-
assetCount: snapshotAssets(snapshot).length
|
|
11934
|
-
}
|
|
11935
|
-
});
|
|
12137
|
+
const report = createGatewayVerificationReport(gameRoot, snapshot);
|
|
12138
|
+
return ok({ ...report, operation: operation.operation, requestId: operation.requestId });
|
|
11936
12139
|
}
|
|
11937
12140
|
function packageIdFromOperation(snapshot, operation) {
|
|
11938
12141
|
const value = operation.packageId === void 0 ? ok(PackageId.random()) : PackageId.parse(operation.packageId);
|
|
@@ -12032,7 +12235,8 @@ async function executeRaw(options, operation) {
|
|
|
12032
12235
|
if (!snapshot.ok) return snapshot;
|
|
12033
12236
|
if (operation.operation === "asset.resolve")
|
|
12034
12237
|
return resolveAsset(options.gameRoot, snapshot.value, operation);
|
|
12035
|
-
if (operation.operation === "asset.verify")
|
|
12238
|
+
if (operation.operation === "asset.verify")
|
|
12239
|
+
return verify(options.gameRoot, snapshot.value, operation);
|
|
12036
12240
|
if (operation.operation === "asset-source.create") {
|
|
12037
12241
|
const path = confinedPath(
|
|
12038
12242
|
options.gameRoot,
|
|
@@ -12799,6 +13003,22 @@ function parsePackV2(value) {
|
|
|
12799
13003
|
}
|
|
12800
13004
|
return ok(value);
|
|
12801
13005
|
}
|
|
13006
|
+
function isRuntimePackEnvelope(value) {
|
|
13007
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
13008
|
+
const record2 = value;
|
|
13009
|
+
return record2.schemaVersion === "2.0.0" && record2.kind === "internal-text-package" && typeof record2.scopeId === "string" && record2.scopeId.length > 0 && typeof record2.generation === "number" && Number.isSafeInteger(record2.generation) && record2.generation > 0 && Array.isArray(record2.assets);
|
|
13010
|
+
}
|
|
13011
|
+
function stripRuntimePackLifecycle(value) {
|
|
13012
|
+
if (!isRuntimePackEnvelope(value)) return value;
|
|
13013
|
+
const { scopeId: _scopeId, generation: _generation, ...semantic } = value;
|
|
13014
|
+
return semantic;
|
|
13015
|
+
}
|
|
13016
|
+
function bindRuntimePackScope(value, scopeId, generation) {
|
|
13017
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || value.schemaVersion !== "2.0.0" || value.kind !== "internal-text-package" || !Array.isArray(value.assets)) {
|
|
13018
|
+
return value;
|
|
13019
|
+
}
|
|
13020
|
+
return { ...value, scopeId, generation };
|
|
13021
|
+
}
|
|
12802
13022
|
function stable(value) {
|
|
12803
13023
|
if (value instanceof Uint8Array) return `bytes:${Buffer.from(value).toString("base64")}`;
|
|
12804
13024
|
if (Array.isArray(value)) return `[${value.map(stable).join(",")}]`;
|
|
@@ -12908,6 +13128,6 @@ function createRuntimePackPublication(input) {
|
|
|
12908
13128
|
};
|
|
12909
13129
|
}
|
|
12910
13130
|
|
|
12911
|
-
export { AssetGuid, MESH_BIN_DIGEST_BYTES, MESH_BIN_HEADER_V4_BYTES, MESH_BIN_PROJECTION_VERSION, MESH_BIN_VERSION, PACK_AUTHORING_OPERATION_DESCRIPTORS, PACK_AUTHORING_OPERATION_IDS, PACK_PARAMETER_TYPES, PACK_SOURCE_KEY_RE, PackageId, SCRIPTABLE_PACK_ASSET_KINDS, STANDARD_SCRIPTABLE_PACK_SCAN_OPTIONS, buildCatalogProjection, buildOfflineAssetEvidence, calculateCatalogDelta, calculateTopologyDiff, catalogProjectionFor, catalogSourcePathFor, collectMaterialCookRefs, createFileSystemPackAuthoringGateway, createFileSystemPackAuthoringPort, createMaterialArtifactDigest, createPackAuthoringGateway, createRuntimePackPublication, currentProjectionFor, decodeMeshBinHeader, definePack, definePackageId, diffTopology, finalizePackageProduct, finalizePackageTransportSource, findReservedAssetKindConflict, hasPackParameters, inventoryDigest, isScriptablePackAssetKind, isValidAssetGuidString, isValidPackSourceKey, metaPathForGuid, packageTransportRevision, packageVerification, parsePackSourceJson, parsePackV2, projectAssetRefs, projectCookedMaterialRecord, projectCookedPackageEntry, projectDirectPackJson, projectExternalCatalogEntries, projectPackageCatalog, projectRuntimeCatalogRow, projectSceneEntityRefs, projectScriptablePackMeta, projectScriptablePackSceneComponents, resolveAssetSource, resolvePackInheritance, resolvePackParameterInheritance, resolvePackParameterValues, scanInventory, serializeCookedMaterialRecord, serializeMaterialCookReceipt, syncAuthorInventory, validateArtifactPath, validateAuthorInventory, validateCookedMaterialRecord, validateMaterialCookReceipt, validateMeta, validatePack, validatePackDefinition, validatePackV2, validateProducerContract, validateProducerOutputs, writeMeshBinHeader };
|
|
13131
|
+
export { AssetGuid, MESH_BIN_DIGEST_BYTES, MESH_BIN_HEADER_V4_BYTES, MESH_BIN_PROJECTION_VERSION, MESH_BIN_VERSION, PACK_AUTHORING_OPERATION_DESCRIPTORS, PACK_AUTHORING_OPERATION_IDS, PACK_PARAMETER_TYPES, PACK_SOURCE_KEY_RE, PackageId, SCRIPTABLE_PACK_ASSET_KINDS, STANDARD_SCRIPTABLE_PACK_SCAN_OPTIONS, bindRuntimePackScope, buildCatalogProjection, buildOfflineAssetEvidence, calculateCatalogDelta, calculateTopologyDiff, catalogProjectionFor, catalogSourcePathFor, collectMaterialCookRefs, createFileSystemPackAuthoringGateway, createFileSystemPackAuthoringPort, createMaterialArtifactDigest, createPackAuthoringGateway, createRuntimePackPublication, currentProjectionFor, decodeMeshBinHeader, definePack, definePackageId, diffTopology, finalizePackageProduct, finalizePackageTransportSource, findReservedAssetKindConflict, hasPackParameters, inventoryDigest, isScriptablePackAssetKind, isValidAssetGuidString, isValidPackSourceKey, metaPathForGuid, packageTransportRevision, packageVerification, parsePackSourceJson, parsePackV2, projectAssetRefs, projectCookedMaterialRecord, projectCookedPackageEntry, projectDirectPackJson, projectExternalCatalogEntries, projectPackageCatalog, projectRuntimeCatalogRow, projectSceneEntityRefs, projectScriptablePackMeta, projectScriptablePackSceneComponents, resolveAssetSource, resolvePackInheritance, resolvePackParameterInheritance, resolvePackParameterValues, scanInventory, serializeCookedMaterialRecord, serializeMaterialCookReceipt, stripRuntimePackLifecycle, syncAuthorInventory, validateArtifactPath, validateAuthorInventory, validateCookedMaterialRecord, validateMaterialCookReceipt, validateMeta, validatePack, validatePackDefinition, validatePackV2, validateProducerContract, validateProducerOutputs, writeMeshBinHeader };
|
|
12912
13132
|
//# sourceMappingURL=build.mjs.map
|
|
12913
13133
|
//# sourceMappingURL=build.mjs.map
|