@forgeax/engine-pack 0.1.23 → 0.1.25
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 +12 -6
- package/dist/build.d.ts +4 -4
- package/dist/build.d.ts.map +1 -1
- package/dist/build.mjs +390 -294
- package/dist/build.mjs.map +1 -1
- package/dist/cli-asset.mjs +33 -35
- package/dist/cli-asset.mjs.map +1 -1
- package/dist/evidence/material-cook.d.ts +26 -0
- package/dist/evidence/material-cook.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +121 -27
- package/dist/index.mjs.map +1 -1
- package/dist/material-cook.d.ts +1 -1
- package/dist/material-cook.d.ts.map +1 -1
- package/dist/material-cook.mjs +102 -4
- package/dist/material-cook.mjs.map +1 -1
- package/dist/{parameterized-pack-node.d.ts → pack-authoring-node.d.ts} +7 -7
- package/dist/pack-authoring-node.d.ts.map +1 -0
- package/dist/{parameterized-pack-node.mjs → pack-authoring-node.mjs} +59 -63
- package/dist/pack-authoring-node.mjs.map +1 -0
- package/dist/{parameterized-pack.d.ts → pack-authoring.d.ts} +28 -31
- package/dist/pack-authoring.d.ts.map +1 -0
- package/dist/pack-authoring.mjs +1137 -0
- package/dist/pack-authoring.mjs.map +1 -0
- package/dist/runtime.mjs +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.d.ts +11 -9
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.mjs +36 -34
- package/dist/scanner.mjs.map +1 -1
- package/dist/schema.mjs +1 -1
- package/dist/schema.mjs.map +1 -1
- package/dist/scriptable-pack-node.d.ts +4 -4
- package/dist/scriptable-pack-node.d.ts.map +1 -1
- package/dist/scriptable-pack-node.mjs +18 -20
- package/dist/scriptable-pack-node.mjs.map +1 -1
- package/dist/scriptable-pack.d.ts +3 -2
- package/dist/scriptable-pack.d.ts.map +1 -1
- package/dist/scriptable-pack.mjs +19 -23
- package/dist/scriptable-pack.mjs.map +1 -1
- package/package.json +2 -7
- package/schema/pack.schema.json +1 -1
- package/src/__tests__/material-cook-receipt-layer-plan.unit.test.ts +16 -0
- package/src/__tests__/material-cook-schema.unit.test.ts +62 -0
- package/src/__tests__/material-declaration-boundary.unit.test.ts +35 -0
- package/src/__tests__/material-surface-consumer-census.test.ts +24 -0
- package/src/__tests__/material-surface-publication.unit.test.ts +159 -0
- package/src/__tests__/material-surface-wire.unit.test.ts +30 -0
- package/src/__tests__/{parameterized-pack-authoring-gateway.unit.test.ts → pack-authoring-gateway.unit.test.ts} +9 -9
- package/src/__tests__/{parameterized-pack.unit.test.ts → pack-authoring.unit.test.ts} +10 -10
- package/src/__tests__/{parameterized-pack-scanner.unit.test.ts → pack-scanner.unit.test.ts} +6 -6
- package/src/__tests__/scanner-inventory.contract.test.ts +2 -4
- package/src/__tests__/scanner-inventory.test.ts +7 -6
- package/src/__tests__/scriptable-pack-cli.integration.test.ts +1 -1
- package/src/build.ts +10 -8
- package/src/catalog-builder.ts +3 -3
- package/src/cli-asset.ts +5 -5
- package/src/evidence/material-cook.ts +170 -7
- package/src/evidence/source-inventory.ts +3 -3
- package/src/index.ts +6 -1
- package/src/material-cook.ts +3 -0
- package/src/{parameterized-pack-node.ts → pack-authoring-node.ts} +71 -73
- package/src/{parameterized-pack.ts → pack-authoring.ts} +59 -74
- package/src/scanner.ts +33 -31
- package/src/schema/material-cook.schema.json +47 -1
- package/src/scriptable-pack-node.ts +25 -25
- package/src/scriptable-pack.ts +3 -2
- package/dist/__tests__/ai-recovery.unit.test.d.ts +0 -2
- package/dist/__tests__/ai-recovery.unit.test.d.ts.map +0 -1
- package/dist/__tests__/artifact-path.test.d.ts +0 -2
- package/dist/__tests__/artifact-path.test.d.ts.map +0 -1
- package/dist/__tests__/asset-evidence-error-hints.test.d.ts +0 -2
- package/dist/__tests__/asset-evidence-error-hints.test.d.ts.map +0 -1
- package/dist/__tests__/asset-evidence-lifecycle.test.d.ts +0 -2
- package/dist/__tests__/asset-evidence-lifecycle.test.d.ts.map +0 -1
- package/dist/__tests__/asset-evidence-schema.test.d.ts +0 -2
- package/dist/__tests__/asset-evidence-schema.test.d.ts.map +0 -1
- package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts +0 -2
- package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts.map +0 -1
- package/dist/__tests__/atlas-error-code-owner.test-d.d.ts +0 -2
- package/dist/__tests__/atlas-error-code-owner.test-d.d.ts.map +0 -1
- package/dist/__tests__/cli-asset-evidence.integration.test.d.ts +0 -2
- package/dist/__tests__/cli-asset-evidence.integration.test.d.ts.map +0 -1
- package/dist/__tests__/cli.unit.test.d.ts +0 -2
- package/dist/__tests__/cli.unit.test.d.ts.map +0 -1
- package/dist/__tests__/evidence-source-inventory.unit.test.d.ts +0 -2
- package/dist/__tests__/evidence-source-inventory.unit.test.d.ts.map +0 -1
- package/dist/__tests__/guid-collision.unit.test.d.ts +0 -2
- package/dist/__tests__/guid-collision.unit.test.d.ts.map +0 -1
- package/dist/__tests__/guid-validator-surface.unit.test.d.ts +0 -2
- package/dist/__tests__/guid-validator-surface.unit.test.d.ts.map +0 -1
- package/dist/__tests__/inventory-schema.test.d.ts +0 -2
- package/dist/__tests__/inventory-schema.test.d.ts.map +0 -1
- package/dist/__tests__/material-cook-dependencies.unit.test.d.ts +0 -2
- package/dist/__tests__/material-cook-dependencies.unit.test.d.ts.map +0 -1
- package/dist/__tests__/material-cook-receipt.unit.test.d.ts +0 -2
- package/dist/__tests__/material-cook-receipt.unit.test.d.ts.map +0 -1
- package/dist/__tests__/material-cook-schema.unit.test.d.ts +0 -2
- package/dist/__tests__/material-cook-schema.unit.test.d.ts.map +0 -1
- package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts +0 -2
- package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts.map +0 -1
- package/dist/__tests__/mesh-bin-contract.unit.test.d.ts +0 -2
- package/dist/__tests__/mesh-bin-contract.unit.test.d.ts.map +0 -1
- package/dist/__tests__/meta-schema-optional.test.d.ts +0 -2
- package/dist/__tests__/meta-schema-optional.test.d.ts.map +0 -1
- package/dist/__tests__/meta-source-overrides.unit.test.d.ts +0 -2
- package/dist/__tests__/meta-source-overrides.unit.test.d.ts.map +0 -1
- package/dist/__tests__/native-cooker-registry.test.d.ts +0 -2
- package/dist/__tests__/native-cooker-registry.test.d.ts.map +0 -1
- package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts +0 -2
- package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts.map +0 -1
- package/dist/__tests__/offline-evidence.integration.test.d.ts +0 -2
- package/dist/__tests__/offline-evidence.integration.test.d.ts.map +0 -1
- package/dist/__tests__/owner-chain.integration.test.d.ts +0 -2
- package/dist/__tests__/owner-chain.integration.test.d.ts.map +0 -1
- package/dist/__tests__/pack-v2-fixture-migration.test.d.ts +0 -2
- package/dist/__tests__/pack-v2-fixture-migration.test.d.ts.map +0 -1
- package/dist/__tests__/pack-v2-schema.test.d.ts +0 -2
- package/dist/__tests__/pack-v2-schema.test.d.ts.map +0 -1
- package/dist/__tests__/pack.unit.test.d.ts +0 -2
- package/dist/__tests__/pack.unit.test.d.ts.map +0 -1
- package/dist/__tests__/package-finalizer.contract.test.d.ts +0 -2
- package/dist/__tests__/package-finalizer.contract.test.d.ts.map +0 -1
- package/dist/__tests__/parameterized-pack-authoring-gateway.unit.test.d.ts +0 -2
- package/dist/__tests__/parameterized-pack-authoring-gateway.unit.test.d.ts.map +0 -1
- package/dist/__tests__/parameterized-pack-scanner.unit.test.d.ts +0 -2
- package/dist/__tests__/parameterized-pack-scanner.unit.test.d.ts.map +0 -1
- package/dist/__tests__/parameterized-pack.unit.test.d.ts +0 -2
- package/dist/__tests__/parameterized-pack.unit.test.d.ts.map +0 -1
- package/dist/__tests__/producer-contract-schema.unit.test.d.ts +0 -2
- package/dist/__tests__/producer-contract-schema.unit.test.d.ts.map +0 -1
- package/dist/__tests__/resolve-asset-source.test.d.ts +0 -2
- package/dist/__tests__/resolve-asset-source.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-projection.unit.test.d.ts +0 -2
- package/dist/__tests__/runtime-projection.unit.test.d.ts.map +0 -1
- package/dist/__tests__/runtime.browser.test.d.ts +0 -2
- package/dist/__tests__/runtime.browser.test.d.ts.map +0 -1
- package/dist/__tests__/scanner-blacklist.test.d.ts +0 -2
- package/dist/__tests__/scanner-blacklist.test.d.ts.map +0 -1
- package/dist/__tests__/scanner-inventory.contract.test.d.ts +0 -2
- package/dist/__tests__/scanner-inventory.contract.test.d.ts.map +0 -1
- package/dist/__tests__/scanner-inventory.test.d.ts +0 -2
- package/dist/__tests__/scanner-inventory.test.d.ts.map +0 -1
- package/dist/__tests__/scanner-mount-cycle.test.d.ts +0 -2
- package/dist/__tests__/scanner-mount-cycle.test.d.ts.map +0 -1
- package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts +0 -2
- package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts.map +0 -1
- package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts +0 -2
- package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts.map +0 -1
- package/dist/__tests__/topology-actions.unit.test.d.ts +0 -2
- package/dist/__tests__/topology-actions.unit.test.d.ts.map +0 -1
- package/dist/__tests__/topology.unit.test.d.ts +0 -2
- package/dist/__tests__/topology.unit.test.d.ts.map +0 -1
- package/dist/parameterized-pack-node.d.ts.map +0 -1
- package/dist/parameterized-pack-node.mjs.map +0 -1
- package/dist/parameterized-pack.d.ts.map +0 -1
|
@@ -7366,10 +7366,10 @@ function validateParameterDefinitions(parameters, propertyPath = "$.parameters")
|
|
|
7366
7366
|
}
|
|
7367
7367
|
return ok(Object.freeze(normalized));
|
|
7368
7368
|
}
|
|
7369
|
-
function
|
|
7369
|
+
function projectScriptablePackMeta(definition, sourcePath) {
|
|
7370
7370
|
return {
|
|
7371
7371
|
schemaVersion: "2.0.0",
|
|
7372
|
-
kind: "
|
|
7372
|
+
kind: "scriptable-pack-source",
|
|
7373
7373
|
packageId: PackageId.format(definition.packageId),
|
|
7374
7374
|
source: sourcePath,
|
|
7375
7375
|
..."parameters" in definition ? {
|
|
@@ -7606,7 +7606,7 @@ function parsePackJsonAsset(value, sourceKey) {
|
|
|
7606
7606
|
};
|
|
7607
7607
|
return ok(withArtifacts);
|
|
7608
7608
|
}
|
|
7609
|
-
function
|
|
7609
|
+
function parsePackSourceJson(value) {
|
|
7610
7610
|
if (!isRecord(value))
|
|
7611
7611
|
return jsonError("$", "a v3 pack.json object", value, "document is not an object");
|
|
7612
7612
|
if (value.schemaVersion !== "3.0.0")
|
|
@@ -7686,7 +7686,7 @@ function parseParameterizedPackJson(value) {
|
|
|
7686
7686
|
});
|
|
7687
7687
|
}
|
|
7688
7688
|
function projectDirectPackJson(value) {
|
|
7689
|
-
const parsed = "format" in value ? ok(value) :
|
|
7689
|
+
const parsed = "format" in value ? ok(value) : parsePackSourceJson(value);
|
|
7690
7690
|
if (!parsed.ok) return parsed;
|
|
7691
7691
|
if (parsed.value.format !== "direct") {
|
|
7692
7692
|
return failure(
|
|
@@ -7732,9 +7732,9 @@ async function resolvePackParameterInheritance(subject, readParent) {
|
|
|
7732
7732
|
if (current.format === "direct") {
|
|
7733
7733
|
return failure(
|
|
7734
7734
|
authoringError(
|
|
7735
|
-
"pack-parent-
|
|
7736
|
-
"a
|
|
7737
|
-
"direct packs cannot be instance parents; point the instance at a
|
|
7735
|
+
"pack-parent-has-no-parameters",
|
|
7736
|
+
"a ScriptablePack source with parameters as the parent",
|
|
7737
|
+
"direct packs cannot be instance parents; point the instance at a ScriptablePack source with parameters",
|
|
7738
7738
|
{ packageId: currentId }
|
|
7739
7739
|
)
|
|
7740
7740
|
);
|
|
@@ -7745,7 +7745,7 @@ async function resolvePackParameterInheritance(subject, readParent) {
|
|
|
7745
7745
|
if (descriptors2.value.length === 0) {
|
|
7746
7746
|
return failure(
|
|
7747
7747
|
authoringError(
|
|
7748
|
-
"pack-parent-
|
|
7748
|
+
"pack-parent-has-no-parameters",
|
|
7749
7749
|
"the parent source to declare a non-empty parameter list",
|
|
7750
7750
|
"use clone for an independent zero-parameter Pack instead of creating an empty instance",
|
|
7751
7751
|
{ packageId: currentId }
|
|
@@ -7771,7 +7771,7 @@ async function resolvePackParameterInheritance(subject, readParent) {
|
|
|
7771
7771
|
authoringError(
|
|
7772
7772
|
"pack-parent-not-found",
|
|
7773
7773
|
"the parent packageId to resolve in the source index",
|
|
7774
|
-
"inspect the parent locator or recreate the instance from a live
|
|
7774
|
+
"inspect the parent locator or recreate the instance from a live ScriptablePack with parameters",
|
|
7775
7775
|
{ packageId: currentId, parent: PackageId.format(current.parent) }
|
|
7776
7776
|
)
|
|
7777
7777
|
);
|
|
@@ -7812,7 +7812,7 @@ async function resolvePackParameterInheritance(subject, readParent) {
|
|
|
7812
7812
|
}
|
|
7813
7813
|
return visit(subject, []);
|
|
7814
7814
|
}
|
|
7815
|
-
var
|
|
7815
|
+
var PACK_AUTHORING_OPERATION_IDS = [
|
|
7816
7816
|
"asset.list",
|
|
7817
7817
|
"asset.inspect",
|
|
7818
7818
|
"asset.resolve",
|
|
@@ -7824,7 +7824,7 @@ var PARAMETERIZED_PACK_OPERATION_IDS = [
|
|
|
7824
7824
|
"asset-source.rebuild",
|
|
7825
7825
|
"asset-source.cold-cook"
|
|
7826
7826
|
];
|
|
7827
|
-
function
|
|
7827
|
+
function createPackAuthoringGateway(port) {
|
|
7828
7828
|
const requests = /* @__PURE__ */ new Map();
|
|
7829
7829
|
return {
|
|
7830
7830
|
execute(operation) {
|
|
@@ -7890,14 +7890,12 @@ function createParameterizedPackAuthoringGateway(port) {
|
|
|
7890
7890
|
}
|
|
7891
7891
|
};
|
|
7892
7892
|
}
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
})
|
|
7900
|
-
);
|
|
7893
|
+
PACK_AUTHORING_OPERATION_IDS.map((id) => ({
|
|
7894
|
+
id,
|
|
7895
|
+
domain: id.startsWith("asset-source.") ? "session" : "asset",
|
|
7896
|
+
readOnly: id.startsWith("asset."),
|
|
7897
|
+
requiresRevision: !id.startsWith("asset.") && id !== "asset-source.create"
|
|
7898
|
+
}));
|
|
7901
7899
|
function isRecord2(value) {
|
|
7902
7900
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7903
7901
|
}
|
|
@@ -8358,7 +8356,7 @@ var pack_schema_default = {
|
|
|
8358
8356
|
},
|
|
8359
8357
|
parent: {
|
|
8360
8358
|
$ref: "#/$defs/guid36",
|
|
8361
|
-
description: "Parent
|
|
8359
|
+
description: "Parent ScriptablePack packageId for one v3 instance; the source may declare Pack parameters."
|
|
8362
8360
|
},
|
|
8363
8361
|
values: {
|
|
8364
8362
|
type: "object",
|
|
@@ -8713,7 +8711,7 @@ function hydrateFailure(value) {
|
|
|
8713
8711
|
return value;
|
|
8714
8712
|
}
|
|
8715
8713
|
var WorkerScriptablePackExecutor = class {
|
|
8716
|
-
|
|
8714
|
+
supportsPackParameters = true;
|
|
8717
8715
|
worker;
|
|
8718
8716
|
compileRoot;
|
|
8719
8717
|
nextBuildId = 0;
|
|
@@ -8814,7 +8812,7 @@ function scriptablePackWorkerUrl() {
|
|
|
8814
8812
|
const bundledWorker = new URL("./scriptable-pack-worker.mjs", import.meta.url);
|
|
8815
8813
|
return existsSync(fileURLToPath(bundledWorker)) ? bundledWorker : new URL("../dist/scriptable-pack-worker.mjs", import.meta.url);
|
|
8816
8814
|
}
|
|
8817
|
-
function
|
|
8815
|
+
function scriptablePackLoadFailure(sourcePath, reason, phase, diagnostic, timeoutMs) {
|
|
8818
8816
|
return {
|
|
8819
8817
|
code: "pack-parameter-invalid",
|
|
8820
8818
|
expected: "a trusted Pack v2 authoring module with a valid default export",
|
|
@@ -8828,14 +8826,14 @@ function parameterizedLoadFailure(sourcePath, reason, phase, diagnostic, timeout
|
|
|
8828
8826
|
}
|
|
8829
8827
|
};
|
|
8830
8828
|
}
|
|
8831
|
-
async function
|
|
8829
|
+
async function loadScriptablePack(sourcePath, options = {}) {
|
|
8832
8830
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
8833
8831
|
const buildTimeoutMs = options.buildTimeoutMs ?? 5e3;
|
|
8834
8832
|
const executor = options.executor ?? new WorkerScriptablePackExecutor();
|
|
8835
8833
|
let disposeReason;
|
|
8836
8834
|
let timeout;
|
|
8837
8835
|
try {
|
|
8838
|
-
const timeoutSignal = /* @__PURE__ */ Symbol("
|
|
8836
|
+
const timeoutSignal = /* @__PURE__ */ Symbol("scriptable-pack-module-timeout");
|
|
8839
8837
|
const loaded = await Promise.race([
|
|
8840
8838
|
executor.load(sourcePath),
|
|
8841
8839
|
new Promise((resolve4) => {
|
|
@@ -8845,7 +8843,7 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
8845
8843
|
if (loaded === timeoutSignal) {
|
|
8846
8844
|
disposeReason = "timeout";
|
|
8847
8845
|
return err(
|
|
8848
|
-
|
|
8846
|
+
scriptablePackLoadFailure(
|
|
8849
8847
|
sourcePath,
|
|
8850
8848
|
"timeout",
|
|
8851
8849
|
"module-load",
|
|
@@ -8872,7 +8870,7 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
8872
8870
|
let buildTimedOut = false;
|
|
8873
8871
|
let buildTimeout;
|
|
8874
8872
|
const timeoutResult = err(
|
|
8875
|
-
|
|
8873
|
+
scriptablePackLoadFailure(
|
|
8876
8874
|
sourcePath,
|
|
8877
8875
|
"timeout",
|
|
8878
8876
|
"build",
|
|
@@ -8881,7 +8879,7 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
8881
8879
|
)
|
|
8882
8880
|
);
|
|
8883
8881
|
try {
|
|
8884
|
-
const invocation = "
|
|
8882
|
+
const invocation = "supportsPackParameters" in executor && executor.supportsPackParameters === true ? build(context.readByGuid, {
|
|
8885
8883
|
packageId: [...context.packageId],
|
|
8886
8884
|
..."values" in context && context.values !== void 0 ? { values: context.values } : {}
|
|
8887
8885
|
}) : definition.build(context);
|
|
@@ -8911,7 +8909,7 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
8911
8909
|
} catch (error) {
|
|
8912
8910
|
disposeReason = "failure";
|
|
8913
8911
|
return err(
|
|
8914
|
-
|
|
8912
|
+
scriptablePackLoadFailure(
|
|
8915
8913
|
sourcePath,
|
|
8916
8914
|
"module-load",
|
|
8917
8915
|
"module-load",
|
|
@@ -9061,7 +9059,7 @@ async function scanValidated(roots, opts = {}, capture) {
|
|
|
9061
9059
|
if (!loaded.ok) return loaded;
|
|
9062
9060
|
const { raw, parsed } = loaded.value;
|
|
9063
9061
|
if (record(parsed) && parsed.schemaVersion === "3.0.0") {
|
|
9064
|
-
const authoring =
|
|
9062
|
+
const authoring = parsePackSourceJson(parsed);
|
|
9065
9063
|
if (!authoring.ok) {
|
|
9066
9064
|
return packErr(
|
|
9067
9065
|
makePackError("pack-malformed-pack", {
|
|
@@ -9305,7 +9303,7 @@ async function scanValidated(roots, opts = {}, capture) {
|
|
|
9305
9303
|
...opts.scriptablePack ?? {},
|
|
9306
9304
|
...capture === void 0 ? { metadataOnly: true } : {}
|
|
9307
9305
|
};
|
|
9308
|
-
const loaded = await
|
|
9306
|
+
const loaded = await loadScriptablePack(sourcePath, loaderOptions);
|
|
9309
9307
|
if (!loaded.ok) {
|
|
9310
9308
|
const diagnostic = loaded.error.detail.diagnostic;
|
|
9311
9309
|
return packErr(
|
|
@@ -9334,12 +9332,12 @@ async function scanValidated(roots, opts = {}, capture) {
|
|
|
9334
9332
|
const packageCollision = registerPackage(
|
|
9335
9333
|
PackageId.format(loaded.value.packageId),
|
|
9336
9334
|
sourcePath,
|
|
9337
|
-
"
|
|
9335
|
+
"scriptable"
|
|
9338
9336
|
);
|
|
9339
9337
|
if (packageCollision !== void 0) return packErr(packageCollision);
|
|
9340
|
-
const meta =
|
|
9338
|
+
const meta = projectScriptablePackMeta(loaded.value, sourcePath);
|
|
9341
9339
|
capture?.declarations.set(sourcePath, {
|
|
9342
|
-
format: "pack.ts
|
|
9340
|
+
format: "pack.ts",
|
|
9343
9341
|
sourcePath,
|
|
9344
9342
|
sourceRevision: `sha256:${createHash("sha256").update(source).digest("hex")}`,
|
|
9345
9343
|
value: meta,
|
|
@@ -9368,15 +9366,15 @@ async function scanValidated(roots, opts = {}, capture) {
|
|
|
9368
9366
|
);
|
|
9369
9367
|
}
|
|
9370
9368
|
const kind = packageKind.get(parentId);
|
|
9371
|
-
if (kind !== "
|
|
9369
|
+
if (kind !== "scriptable" && kind !== "instance") {
|
|
9372
9370
|
return packErr(
|
|
9373
9371
|
makePackError("pack-malformed-pack", {
|
|
9374
9372
|
path: instance.path,
|
|
9375
|
-
reason: "pack-parent-
|
|
9373
|
+
reason: "pack-parent-has-no-parameters",
|
|
9376
9374
|
ajvErrors: [
|
|
9377
9375
|
{
|
|
9378
9376
|
instancePath: "/parent",
|
|
9379
|
-
message: `parent ${instance.parent} is not a
|
|
9377
|
+
message: `parent ${instance.parent} is not a ScriptablePack source with parameters`
|
|
9380
9378
|
}
|
|
9381
9379
|
]
|
|
9382
9380
|
})
|
|
@@ -9446,7 +9444,7 @@ async function scanInventory(roots, opts = {}) {
|
|
|
9446
9444
|
const declaration = declarations.get(sourcePath);
|
|
9447
9445
|
if (declaration?.format !== "pack.json") continue;
|
|
9448
9446
|
if (declaration.value.schemaVersion === "3.0.0") {
|
|
9449
|
-
const parsed =
|
|
9447
|
+
const parsed = parsePackSourceJson(declaration.value);
|
|
9450
9448
|
if (!parsed.ok) {
|
|
9451
9449
|
return packErr(
|
|
9452
9450
|
makePackError("pack-malformed-pack", {
|
|
@@ -9491,7 +9489,7 @@ async function scanInventory(roots, opts = {}) {
|
|
|
9491
9489
|
return ok3({ paths: scanned.value, inventory, declarations });
|
|
9492
9490
|
}
|
|
9493
9491
|
|
|
9494
|
-
// src/
|
|
9492
|
+
// src/pack-authoring-node.ts
|
|
9495
9493
|
function isRecord3(value) {
|
|
9496
9494
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
9497
9495
|
}
|
|
@@ -9623,7 +9621,7 @@ function scanFailure(operation, cause) {
|
|
|
9623
9621
|
const value = cause !== null && typeof cause === "object" ? cause : {};
|
|
9624
9622
|
const detail = value.detail !== null && typeof value.detail === "object" ? value.detail : {};
|
|
9625
9623
|
const reason = isRecord3(detail) && typeof detail.reason === "string" ? detail.reason : void 0;
|
|
9626
|
-
const code = reason === "pack-parent-not-found" || reason === "pack-parent-cycle" || reason === "pack-parent-
|
|
9624
|
+
const code = reason === "pack-parent-not-found" || reason === "pack-parent-cycle" || reason === "pack-parent-has-no-parameters" ? reason : value.code === "pack-guid-collision" ? "pack-guid-collision" : "pack-parameter-invalid";
|
|
9627
9625
|
return makeError(
|
|
9628
9626
|
code,
|
|
9629
9627
|
typeof value.expected === "string" ? value.expected : "a valid Pack Source Index",
|
|
@@ -9795,7 +9793,7 @@ async function createSnapshot(options, operation) {
|
|
|
9795
9793
|
const directAssets = [];
|
|
9796
9794
|
for (const [sourcePath, declaration] of scanned.value.declarations) {
|
|
9797
9795
|
const relativePath = relative(resolve(options.gameRoot), sourcePath).split(sep).join("/");
|
|
9798
|
-
if (declaration.format === "pack.ts
|
|
9796
|
+
if (declaration.format === "pack.ts") {
|
|
9799
9797
|
subjects.set(packageKey(declaration.definition.packageId), {
|
|
9800
9798
|
format: "source",
|
|
9801
9799
|
packageId: declaration.definition.packageId,
|
|
@@ -9806,7 +9804,7 @@ async function createSnapshot(options, operation) {
|
|
|
9806
9804
|
continue;
|
|
9807
9805
|
}
|
|
9808
9806
|
if (declaration.format !== "pack.json" || declaration.value.schemaVersion !== "3.0.0") continue;
|
|
9809
|
-
const parsed =
|
|
9807
|
+
const parsed = parsePackSourceJson(declaration.value);
|
|
9810
9808
|
if (!parsed.ok) return err(parsed.error);
|
|
9811
9809
|
if (parsed.value.format === "direct") {
|
|
9812
9810
|
const projected = projectDirectPackJson(parsed.value);
|
|
@@ -10519,7 +10517,7 @@ function revisionConflict(operation, path, actual) {
|
|
|
10519
10517
|
function directJson(packageId2, assets) {
|
|
10520
10518
|
return { schemaVersion: "3.0.0", packageId: PackageId.format(packageId2), assets };
|
|
10521
10519
|
}
|
|
10522
|
-
function
|
|
10520
|
+
function packSourceScaffold(packageId2, parameters) {
|
|
10523
10521
|
const parameterSource = parameters === void 0 ? "" : "\n parameters: " + JSON.stringify(
|
|
10524
10522
|
parameters.map((parameter) => jsonValue(parameter)),
|
|
10525
10523
|
null,
|
|
@@ -10607,13 +10605,13 @@ async function executeRaw(options, operation) {
|
|
|
10607
10605
|
makeError(
|
|
10608
10606
|
"pack-parameter-invalid",
|
|
10609
10607
|
"direct create to contain assets only",
|
|
10610
|
-
"use pack.ts for a
|
|
10608
|
+
"use pack.ts for a ScriptablePack source or create-instance for parent+values",
|
|
10611
10609
|
{ requestId: operation.requestId }
|
|
10612
10610
|
)
|
|
10613
10611
|
);
|
|
10614
10612
|
}
|
|
10615
10613
|
const assets = operation.initialAssets ?? {};
|
|
10616
|
-
const parsed =
|
|
10614
|
+
const parsed = parsePackSourceJson(directJson(identity.value, assets));
|
|
10617
10615
|
if (!parsed.ok) return err(parsed.error);
|
|
10618
10616
|
if (parsed.value.format !== "direct") {
|
|
10619
10617
|
return err(
|
|
@@ -10669,7 +10667,7 @@ async function executeRaw(options, operation) {
|
|
|
10669
10667
|
}
|
|
10670
10668
|
parameters = validated.value.parameters;
|
|
10671
10669
|
}
|
|
10672
|
-
source =
|
|
10670
|
+
source = packSourceScaffold(identity.value, parameters);
|
|
10673
10671
|
const serialized = parameters === void 0 ? void 0 : serializedParameters({
|
|
10674
10672
|
schemaVersion: "2.0.0",
|
|
10675
10673
|
packageId: identity.value,
|
|
@@ -10765,7 +10763,7 @@ async function executeRaw(options, operation) {
|
|
|
10765
10763
|
)
|
|
10766
10764
|
);
|
|
10767
10765
|
}
|
|
10768
|
-
const parsed =
|
|
10766
|
+
const parsed = parsePackSourceJson(parsedValue);
|
|
10769
10767
|
if (!parsed.ok) return err(parsed.error);
|
|
10770
10768
|
source = `${JSON.stringify(
|
|
10771
10769
|
parsed.value.format === "direct" ? directJson(identity.value, parsed.value.assets) : {
|
|
@@ -10825,7 +10823,7 @@ async function executeRaw(options, operation) {
|
|
|
10825
10823
|
makeError(
|
|
10826
10824
|
"pack-parent-not-found",
|
|
10827
10825
|
"a parent packageId for the new instance",
|
|
10828
|
-
"pass parentPackageId or parent and point it at a
|
|
10826
|
+
"pass parentPackageId or parent and point it at a ScriptablePack source with parameters",
|
|
10829
10827
|
{ requestId: operation.requestId }
|
|
10830
10828
|
)
|
|
10831
10829
|
);
|
|
@@ -10848,7 +10846,7 @@ async function executeRaw(options, operation) {
|
|
|
10848
10846
|
makeError(
|
|
10849
10847
|
"pack-parent-not-found",
|
|
10850
10848
|
"the parent packageId to exist in the current Source Index",
|
|
10851
|
-
"inspect the Source Index and choose a
|
|
10849
|
+
"inspect the Source Index and choose a ScriptablePack parent with parameters",
|
|
10852
10850
|
{ requestId: operation.requestId, parent: parentText }
|
|
10853
10851
|
)
|
|
10854
10852
|
);
|
|
@@ -10856,8 +10854,8 @@ async function executeRaw(options, operation) {
|
|
|
10856
10854
|
if (parent.format === "source" && !("parameters" in parent.definition)) {
|
|
10857
10855
|
return err(
|
|
10858
10856
|
makeError(
|
|
10859
|
-
"pack-parent-
|
|
10860
|
-
"a non-empty
|
|
10857
|
+
"pack-parent-has-no-parameters",
|
|
10858
|
+
"a ScriptablePack source with a non-empty parameter list as the parent",
|
|
10861
10859
|
"use asset-source.clone for a zero-parameter Pack",
|
|
10862
10860
|
{ requestId: operation.requestId, parent: parentText }
|
|
10863
10861
|
)
|
|
@@ -10866,8 +10864,8 @@ async function executeRaw(options, operation) {
|
|
|
10866
10864
|
if (parent.format === "direct") {
|
|
10867
10865
|
return err(
|
|
10868
10866
|
makeError(
|
|
10869
|
-
"pack-parent-
|
|
10870
|
-
"a
|
|
10867
|
+
"pack-parent-has-no-parameters",
|
|
10868
|
+
"a ScriptablePack source or instance with parameters as the parent",
|
|
10871
10869
|
"direct Packs cannot be instance parents",
|
|
10872
10870
|
{ requestId: operation.requestId, parent: parentText }
|
|
10873
10871
|
)
|
|
@@ -10970,7 +10968,7 @@ async function executeRaw(options, operation) {
|
|
|
10970
10968
|
)
|
|
10971
10969
|
);
|
|
10972
10970
|
}
|
|
10973
|
-
const parsed =
|
|
10971
|
+
const parsed = parsePackSourceJson(json);
|
|
10974
10972
|
if (!parsed.ok) return err(parsed.error);
|
|
10975
10973
|
if (parsed.value.format !== "instance") {
|
|
10976
10974
|
return err(
|
|
@@ -11073,21 +11071,19 @@ async function executeRaw(options, operation) {
|
|
|
11073
11071
|
return err(
|
|
11074
11072
|
makeError(
|
|
11075
11073
|
"pack-parameter-invalid",
|
|
11076
|
-
"a supported
|
|
11077
|
-
"use one of
|
|
11074
|
+
"a supported Pack authoring operation",
|
|
11075
|
+
"use one of PACK_AUTHORING_OPERATION_IDS",
|
|
11078
11076
|
{ requestId: operation.requestId, operation: operation.operation }
|
|
11079
11077
|
)
|
|
11080
11078
|
);
|
|
11081
11079
|
}
|
|
11082
|
-
function
|
|
11080
|
+
function createFileSystemPackAuthoringPort(options) {
|
|
11083
11081
|
return { execute: (operation) => executeRaw(options, operation) };
|
|
11084
11082
|
}
|
|
11085
|
-
function
|
|
11086
|
-
return
|
|
11087
|
-
createFileSystemParameterizedPackAuthoringPort(options)
|
|
11088
|
-
);
|
|
11083
|
+
function createFileSystemPackAuthoringGateway(options) {
|
|
11084
|
+
return createPackAuthoringGateway(createFileSystemPackAuthoringPort(options));
|
|
11089
11085
|
}
|
|
11090
11086
|
|
|
11091
|
-
export {
|
|
11092
|
-
//# sourceMappingURL=
|
|
11093
|
-
//# sourceMappingURL=
|
|
11087
|
+
export { createFileSystemPackAuthoringGateway, createFileSystemPackAuthoringPort };
|
|
11088
|
+
//# sourceMappingURL=pack-authoring-node.mjs.map
|
|
11089
|
+
//# sourceMappingURL=pack-authoring-node.mjs.map
|