@seriousgaming/sdk-tools 1.7.0 → 1.9.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/dist/agent/guidance.md +1 -0
- package/dist/{cli-SOFCTQAL.js → cli-2BF7KBBJ.js} +15 -15
- package/dist/cli-2CSI2UU2.js +110 -0
- package/dist/{cli-2BH7FX27.js → cli-2FXZZLCL.js} +1 -1
- package/dist/{cli-H3J3ICCQ.js → cli-2I6UN6C3.js} +3 -3
- package/dist/{cli-MYJGGLC5.js → cli-2JEICVMA.js} +3 -3
- package/dist/{cli-7RYIEKMB.js → cli-2PMLR6WG.js} +15 -15
- package/dist/{cli-JRIIAZ33.js → cli-2UOUIVHW.js} +53 -38
- package/dist/{cli-OQG3Y4RU.js → cli-2VV5IPSY.js} +15 -15
- package/dist/{cli-ZRPWZOCW.js → cli-35K37SYY.js} +20 -16
- package/dist/cli-3I6AI4AA.js +36 -0
- package/dist/{cli-YSPZZQCP.js → cli-3RMP4HKZ.js} +2 -2
- package/dist/{cli-4UWFQNGF.js → cli-3VV2JLHX.js} +1 -1
- package/dist/cli-3YGNWZC6.js +30 -0
- package/dist/{cli-TPNQLYPC.js → cli-4L7S27XO.js} +1 -1
- package/dist/cli-4X3X4HB2.js +16 -0
- package/dist/{cli-TJ3PLRHF.js → cli-5BPQ73OM.js} +15 -15
- package/dist/{cli-UTM4QU67.js → cli-5PTCQTS6.js} +282 -96
- package/dist/{cli-ZTZ5H55T.js → cli-6COAU7JR.js} +17 -17
- package/dist/{cli-QVASWX2A.js → cli-6GDPO5VU.js} +2 -2
- package/dist/{cli-TFMNNVJ7.js → cli-6KL5B7EC.js} +15 -15
- package/dist/{cli-NOQBWJQN.js → cli-6Y4XIVQS.js} +3 -3
- package/dist/cli-6ZBQELF2.js +36 -0
- package/dist/{cli-MMN4BPO4.js → cli-7CW2BBJG.js} +1 -1
- package/dist/{cli-LQ4VSM5R.js → cli-7N7WFRWA.js} +0 -0
- package/dist/{cli-JR5AZLLK.js → cli-7OCEVQQN.js} +2 -2
- package/dist/{cli-Z5HWENER.js → cli-7RLZIWFP.js} +19 -19
- package/dist/{cli-J4DKUUTK.js → cli-7V6GUIIS.js} +2 -2
- package/dist/{cli-6ZSMW4HR.js → cli-A3P3PO6Z.js} +15 -15
- package/dist/{cli-4VZIJYKU.js → cli-A7PITFRR.js} +2 -2
- package/dist/{cli-4XCQUM3E.js → cli-AA5GMEUL.js} +4 -4
- package/dist/{cli-N6H6T2E2.js → cli-AEAFLZGY.js} +12 -0
- package/dist/{cli-C47GJATR.js → cli-AGYCXRPR.js} +3 -3
- package/dist/{cli-T4HWGMY4.js → cli-AJ5CABGJ.js} +15 -15
- package/dist/{cli-FZ7QAZZP.js → cli-B5LZEFLU.js} +15 -15
- package/dist/{cli-XSVGKI3R.js → cli-BC4KKNLA.js} +1 -1
- package/dist/{cli-EJVAQCMQ.js → cli-BF6L37O3.js} +114 -5
- package/dist/{cli-ZQ2Y3U7F.js → cli-BNN36WZJ.js} +13 -13
- package/dist/{cli-FXY3DKPW.js → cli-BT47H36C.js} +2 -2
- package/dist/{cli-XTANOFQR.js → cli-BV7MX7JE.js} +3 -3
- package/dist/{cli-PVA52RC2.js → cli-BYXNPBVG.js} +15 -15
- package/dist/{cli-MJUYJIEP.js → cli-C45A5VX6.js} +3 -3
- package/dist/{cli-HM7CD4VU.js → cli-CKV44U7P.js} +19 -19
- package/dist/{cli-LQERHJFE.js → cli-CL3KF5KS.js} +2 -2
- package/dist/{cli-SX3ULO5P.js → cli-CPX4YA3P.js} +11 -11
- package/dist/{cli-CV4JGVJR.js → cli-CQUSM3SF.js} +19 -19
- package/dist/cli-CUZUIYCQ.js +36 -0
- package/dist/{cli-YOTGR3NB.js → cli-CVOLMK3Z.js} +1 -1
- package/dist/{cli-TFZ53OA2.js → cli-D6AC3ZCX.js} +18 -18
- package/dist/{cli-PIO7NWMH.js → cli-DJCQ5XFR.js} +15 -15
- package/dist/{cli-4YB3ROVR.js → cli-DMKRP33X.js} +1 -1
- package/dist/cli-DNCJURUU.js +36 -0
- package/dist/{cli-TIDQ4WUE.js → cli-DXHPYN4N.js} +1 -1
- package/dist/{cli-FP32D3T6.js → cli-E77R7ZYB.js} +15 -15
- package/dist/{cli-PKQNOGBO.js → cli-EDZF5Q2E.js} +63 -17
- package/dist/{cli-IPP5FDCH.js → cli-G54355N5.js} +18 -18
- package/dist/{cli-SWZY7L7K.js → cli-G7JTIP5G.js} +6 -6
- package/dist/{cli-C5QOJJWX.js → cli-GHIMH6JU.js} +1 -1
- package/dist/{cli-LE5ICDAF.js → cli-GHQIATHP.js} +4 -4
- package/dist/{cli-ESA6YNPF.js → cli-GZE4V7RC.js} +19 -19
- package/dist/{cli-4CHKF4DQ.js → cli-H7T6E7OA.js} +2 -2
- package/dist/{cli-TDYKRXUA.js → cli-HCMVZXWK.js} +17 -17
- package/dist/{cli-WU43JT4T.js → cli-HJPNNORV.js} +2 -2
- package/dist/{cli-MYJGMA6U.js → cli-IC5FOT2J.js} +1 -1
- package/dist/{cli-VYR326C6.js → cli-ICLCA6VD.js} +19 -19
- package/dist/{cli-CXCL7VRK.js → cli-IJPRZSJ5.js} +20 -20
- package/dist/{cli-VL2P354N.js → cli-IVZ7AHUJ.js} +3 -3
- package/dist/{cli-B6YHEKIJ.js → cli-J2OTL6JH.js} +5 -5
- package/dist/{cli-SOMIB4B4.js → cli-J75EBRAJ.js} +17 -17
- package/dist/{cli-WAZD75KE.js → cli-JEMWAIAA.js} +15 -15
- package/dist/{cli-TDSQSCX4.js → cli-K6M6YB67.js} +1 -1
- package/dist/{cli-WG36UJRK.js → cli-KD2RQS35.js} +18 -18
- package/dist/{cli-GTWEGYSU.js → cli-KGJHEDR2.js} +19 -19
- package/dist/{cli-EDCAH2TC.js → cli-KINJAQTJ.js} +19 -19
- package/dist/cli-KJV3GGBA.js +1973 -0
- package/dist/{cli-X7E3637I.js → cli-KO26S2CL.js} +50 -26
- package/dist/{cli-MULKSLA4.js → cli-L5ZKQNMI.js} +15 -15
- package/dist/{cli-ATI6OLJU.js → cli-LFUKHLHI.js} +17 -17
- package/dist/{cli-GHLILDH7.js → cli-LZFUSEJT.js} +13 -13
- package/dist/{cli-RZITKPJX.js → cli-MN7X4UG2.js} +1 -1
- package/dist/{cli-HCRTYQQS.js → cli-MPWTXNF6.js} +2 -2
- package/dist/{cli-HHPMAV4F.js → cli-MSSJLABW.js} +3 -3
- package/dist/{cli-DHOWZCXT.js → cli-MTAGL3QE.js} +15 -15
- package/dist/{cli-JIZTQVL2.js → cli-MX7GFQ6N.js} +14 -14
- package/dist/{cli-7TOLC62D.js → cli-MYBDWJP7.js} +20 -20
- package/dist/{cli-VPON5HGB.js → cli-MZM4MW7C.js} +19 -19
- package/dist/{cli-UBQCSUDH.js → cli-NTI22MRE.js} +16 -16
- package/dist/{cli-ZTWOE3ZT.js → cli-NU4SCD5D.js} +1 -1
- package/dist/{cli-DEBCP7UH.js → cli-OK6XWVIN.js} +17 -17
- package/dist/{cli-6HB6HTC6.js → cli-OOTGO3KW.js} +47 -47
- package/dist/{cli-2DQJACAH.js → cli-OX3254NS.js} +17 -17
- package/dist/{cli-GEQUJF4L.js → cli-PJO4BKSV.js} +16 -16
- package/dist/{cli-R7RG2VMW.js → cli-QIHVXDMW.js} +15 -15
- package/dist/{cli-57V4ARER.js → cli-QK2OD24J.js} +1 -1
- package/dist/{cli-OANH3BTQ.js → cli-QRAYIXNE.js} +5 -5
- package/dist/{cli-GPAN6XK2.js → cli-QWO3XJR3.js} +4 -4
- package/dist/{cli-JRMHSMYT.js → cli-R6YAZP6E.js} +19 -19
- package/dist/{cli-FXWWYBYU.js → cli-RHYQYXE2.js} +18 -18
- package/dist/{cli-C3OERMIR.js → cli-RL5EBZL7.js} +3 -3
- package/dist/{cli-XR2XSWQN.js → cli-S3YIYAXC.js} +12 -12
- package/dist/{cli-NPPY557S.js → cli-S7PLSPGE.js} +15 -15
- package/dist/{cli-NEOLMC2P.js → cli-SBKTGFY4.js} +17 -17
- package/dist/{cli-BOXXMDSX.js → cli-TLRTLTGK.js} +18 -18
- package/dist/cli-UKC7KXWU.js +36 -0
- package/dist/{cli-FWFRKQNE.js → cli-UR63LFVK.js} +2 -2
- package/dist/{cli-ZKG3OPZ6.js → cli-USBJQAYI.js} +13 -13
- package/dist/{cli-M7WEAIRF.js → cli-VRGVHSXH.js} +106 -28
- package/dist/{cli-IUS2YCD3.js → cli-VTLFQHDO.js} +1 -1
- package/dist/{cli-JGFJWZFU.js → cli-W4BHSBAX.js} +3 -3
- package/dist/cli-WA2PDQUB.js +36 -0
- package/dist/{cli-HYEU3QS6.js → cli-WJO75KP7.js} +3 -3
- package/dist/{cli-3PIJLSRQ.js → cli-XA4IL7IM.js} +11 -11
- package/dist/{cli-LRQDF3ZO.js → cli-XRVH5WV6.js} +13 -13
- package/dist/{cli-SRHBXZCN.js → cli-Y33ULHYO.js} +1 -1
- package/dist/{cli-G5DQGZ2E.js → cli-YD4SBAHQ.js} +19 -19
- package/dist/{cli-64AA7367.js → cli-YI3WZF3C.js} +11 -11
- package/dist/{cli-JPAXKLVT.js → cli-ZHFHOWJI.js} +11 -11
- package/dist/{cli-MM3A4SPH.js → cli-ZZSPFLTK.js} +7265 -4467
- package/dist/cli.js +52 -52
- package/dist/client.js +17518 -16558
- package/dist/core/save-scenario.d.ts +1 -0
- package/dist/core/session-start-gate.d.ts +25 -0
- package/dist/core/session.d.ts +4 -0
- package/dist/dev/console/assets/{index-CnXlPeLX.js → index-CVNjiRUh.js} +31 -27
- package/dist/dev/console/index.html +1 -1
- package/dist/docs/api/deck.md +1 -1
- package/dist/docs/api/index.md +1 -1
- package/dist/docs/api/sdk-e2e.md +7 -6
- package/dist/docs/api/sdk-projection.md +1 -0
- package/dist/docs/api/sdk-tools-client.md +3 -1
- package/dist/docs/api/sdk-tools-playwright.md +1 -8
- package/dist/docs/api/sdk-ui.md +40 -64
- package/dist/docs/api/sdk.md +10 -1
- package/dist/docs/changelog.md +25 -0
- package/dist/docs/cli-error-codes.md +7 -1
- package/dist/docs/cli-reference.md +3 -0
- package/dist/docs/concepts/index.md +1 -0
- package/dist/docs/guides/engine.md +5 -0
- package/dist/docs/guides/file-handling.md +4 -1
- package/dist/docs/guides/llm-integration.md +3 -2
- package/dist/docs/guides/multi-team-games.md +2 -0
- package/dist/docs/guides/patterns.md +5 -0
- package/dist/docs/guides/session.md +1 -1
- package/dist/docs/guides/settings.md +2 -0
- package/dist/docs/guides/setup.md +67 -6
- package/dist/docs/guides/speech-generation.md +1 -0
- package/dist/docs/guides/testing.md +2 -0
- package/dist/docs/guides/tick-controller.md +2 -0
- package/dist/docs/guides/type-safety.md +2 -1
- package/dist/docs/guides/ui-files-and-llms.md +3 -1
- package/dist/docs/guides/upgrading.md +4 -0
- package/dist/docs/guides/validators.md +27 -4
- package/dist/docs/guides/waiting-room.md +2 -0
- package/dist/docs/page-index.md +10 -7
- package/dist/docs/recipes/call-endpoint-from-ui.md +1 -0
- package/dist/docs/recipes/create-scenario-editor.md +2 -1
- package/dist/docs/recipes/create-setup.md +19 -10
- package/dist/docs/recipes/declare-api-uses.md +1 -0
- package/dist/docs/recipes/describe-setup-with-endpoint.md +69 -0
- package/dist/docs/recipes/give-setup-a-menu.md +90 -0
- package/dist/docs/recipes/index.md +4 -1
- package/dist/docs/recipes/share-logic-between-engine-and-ui.md +2 -2
- package/dist/docs/recipes/test-user-interface.md +1 -1
- package/dist/docs/recipes/validate-scenarios.md +9 -3
- package/dist/docs/recipes/write-setup-notes.md +57 -0
- package/dist/docs/troubleshooting.md +2 -1
- package/dist/execution/executor.d.ts +12 -0
- package/dist/execution/scenario-gates.d.ts +40 -0
- package/dist/host.js +1082 -467
- package/dist/playwright.js +17529 -16569
- package/dist/runtime/manifest-version.d.ts +1 -1
- package/dist/runtime.js +4 -2
- package/dist/setup/setup-notes.d.ts +42 -0
- package/dist/templates/package/package.json.liquid +15 -15
- package/dist/templates/starter-game/package.json +13 -13
- package/dist/utils/error-codes.d.ts +13 -1
- package/dist/validation/package-validation.d.ts +1 -1
- package/package.json +22 -23
- package/dist/cli-57C72YKJ.js +0 -36
- package/dist/cli-5G7TZHD3.js +0 -36
- package/dist/cli-7MBLH4M3.js +0 -36
- package/dist/cli-C6G65H6S.js +0 -256
- package/dist/cli-L5IG7MY2.js +0 -36
- package/dist/cli-SPGUVL6Z.js +0 -36
- package/dist/cli-UY4VDI7W.js +0 -30
- package/dist/cli-WM6SQJ6Q.js +0 -16
- package/dist/cli-ZBTFLZUL.js +0 -36
- package/dist/cli-ZF7IFB54.js +0 -4026
package/dist/cli-C6G65H6S.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_LOGIC_EXECUTION_BOUND_MS,
|
|
4
|
-
LogicLoader,
|
|
5
|
-
resolveSettingsLayers
|
|
6
|
-
} from "./cli-UTM4QU67.js";
|
|
7
|
-
import {
|
|
8
|
-
describeAssetByReference,
|
|
9
|
-
describeBlob,
|
|
10
|
-
readAssetByReference
|
|
11
|
-
} from "./cli-QWQMPCL6.js";
|
|
12
|
-
import {
|
|
13
|
-
SCENARIO_GATE_READ_LIMIT_BYTES,
|
|
14
|
-
ScenarioAssetTooLargeError,
|
|
15
|
-
Transpile,
|
|
16
|
-
errorMessage,
|
|
17
|
-
getPluralResourceMeta
|
|
18
|
-
} from "./cli-ZF7IFB54.js";
|
|
19
|
-
|
|
20
|
-
// cli/execution/scenario-gates.ts
|
|
21
|
-
import { existsSync } from "fs";
|
|
22
|
-
import { readFile } from "fs/promises";
|
|
23
|
-
var SCENARIO_VALIDATION = "scenario-validation";
|
|
24
|
-
var SCENARIO_FILES = "scenario-files";
|
|
25
|
-
function hasScenarioGate(config) {
|
|
26
|
-
return (config.validators ?? []).some((v) => v.definition.gates?.includes("scenario"));
|
|
27
|
-
}
|
|
28
|
-
async function runScenarioGates(options) {
|
|
29
|
-
const { config } = options;
|
|
30
|
-
if (!hasScenarioGate(config)) return [];
|
|
31
|
-
const loader = options.loader ?? new LogicLoader(options.packagePath, {
|
|
32
|
-
transpile: Transpile,
|
|
33
|
-
fs: { existsSync, readFile }
|
|
34
|
-
});
|
|
35
|
-
const resolved = resolveSettingsLayers(config, options.scenarioSettings, null);
|
|
36
|
-
const locale = options.locale ?? config.game?.definition.supportedLocales?.[0] ?? "en";
|
|
37
|
-
const readsFiles = (config.requires ?? []).includes(SCENARIO_FILES);
|
|
38
|
-
const problems = [];
|
|
39
|
-
for (const validator of config.validators ?? []) {
|
|
40
|
-
if (!validator.definition.gates?.includes("scenario")) continue;
|
|
41
|
-
const identifier = validator.definition.identifier;
|
|
42
|
-
const declared = validator.definition.settings ?? [];
|
|
43
|
-
const pick = (values) => Object.fromEntries(
|
|
44
|
-
declared.filter((id) => values[id] !== void 0).map((id) => [id, values[id]])
|
|
45
|
-
);
|
|
46
|
-
try {
|
|
47
|
-
const exports = await loader.load(
|
|
48
|
-
"validator",
|
|
49
|
-
identifier,
|
|
50
|
-
validator,
|
|
51
|
-
`Validator ${identifier} not found in configuration`
|
|
52
|
-
);
|
|
53
|
-
const gate = exports.Scenario;
|
|
54
|
-
if (!gate) {
|
|
55
|
-
problems.push({
|
|
56
|
-
validatorIdentifier: identifier,
|
|
57
|
-
message: `Validator ${identifier} does not export Scenario`
|
|
58
|
-
});
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
const found = await withBound(
|
|
62
|
-
gate({
|
|
63
|
-
settings: structuredClone(pick(resolved)),
|
|
64
|
-
locale,
|
|
65
|
-
callbacks: readsFiles ? scenarioCallbacks(
|
|
66
|
-
options.packagePath,
|
|
67
|
-
options.files ?? { scenarioRoot: null, blobs: "none" }
|
|
68
|
-
) : withoutScenarioFiles(identifier)
|
|
69
|
-
}),
|
|
70
|
-
options.boundMs ?? DEFAULT_LOGIC_EXECUTION_BOUND_MS
|
|
71
|
-
);
|
|
72
|
-
if (!Array.isArray(found)) {
|
|
73
|
-
problems.push({
|
|
74
|
-
validatorIdentifier: identifier,
|
|
75
|
-
message: `Validator ${identifier}'s Scenario returned ${JSON.stringify(found)}, not an array of problems (an empty array passes)`
|
|
76
|
-
});
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
for (const problem of found) {
|
|
80
|
-
problems.push({ validatorIdentifier: identifier, ...problem });
|
|
81
|
-
}
|
|
82
|
-
} catch (error) {
|
|
83
|
-
problems.push({
|
|
84
|
-
validatorIdentifier: identifier,
|
|
85
|
-
message: `Validator ${identifier} threw: ${errorMessage(error, String(error))}`
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return problems;
|
|
90
|
-
}
|
|
91
|
-
function scenarioCallbacks(packagePath, files) {
|
|
92
|
-
const unreadable = async (reference) => {
|
|
93
|
-
if (!reference.startsWith("blob:") || files.blobs === "all") return false;
|
|
94
|
-
if (files.blobs === "none") return true;
|
|
95
|
-
const blob = await describeBlob(packagePath, reference.slice("blob:".length));
|
|
96
|
-
return blob !== void 0 && blob.retention !== "scenario";
|
|
97
|
-
};
|
|
98
|
-
return {
|
|
99
|
-
readAsset: async (reference) => {
|
|
100
|
-
if (await unreadable(reference)) {
|
|
101
|
-
throw new Error(`Cannot read "${reference}": the scenario cannot name that file`);
|
|
102
|
-
}
|
|
103
|
-
const described = await describeAssetByReference(
|
|
104
|
-
packagePath,
|
|
105
|
-
files.scenarioRoot,
|
|
106
|
-
reference
|
|
107
|
-
);
|
|
108
|
-
if (described && described.size > SCENARIO_GATE_READ_LIMIT_BYTES) {
|
|
109
|
-
throw new ScenarioAssetTooLargeError(reference, described.size);
|
|
110
|
-
}
|
|
111
|
-
const asset = await readAssetByReference(packagePath, files.scenarioRoot, reference);
|
|
112
|
-
return { data: new Uint8Array(asset.data), mimeType: asset.mimeType, name: asset.name };
|
|
113
|
-
},
|
|
114
|
-
describeAsset: async (reference) => await unreadable(reference) ? void 0 : describeAssetByReference(packagePath, files.scenarioRoot, reference)
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function withoutScenarioFiles(identifier) {
|
|
118
|
-
const refuse = (callback) => async () => {
|
|
119
|
-
throw new Error(
|
|
120
|
-
`Validator "${identifier}" called ${callback} in its Scenario gate, which needs the "${SCENARIO_FILES}" feature, but requires does not list it. Add "${SCENARIO_FILES}" to requires in seriousgaming.sdk.json.`
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
return { readAsset: refuse("readAsset"), describeAsset: refuse("describeAsset") };
|
|
124
|
-
}
|
|
125
|
-
async function withBound(run, boundMs) {
|
|
126
|
-
let timer;
|
|
127
|
-
try {
|
|
128
|
-
return await Promise.race([
|
|
129
|
-
run,
|
|
130
|
-
new Promise((_, reject) => {
|
|
131
|
-
timer = setTimeout(
|
|
132
|
-
() => reject(new Error(`did not finish within ${boundMs}ms`)),
|
|
133
|
-
boundMs
|
|
134
|
-
);
|
|
135
|
-
})
|
|
136
|
-
]);
|
|
137
|
-
} finally {
|
|
138
|
-
if (timer) clearTimeout(timer);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
function describeScenarioProblems(problems) {
|
|
142
|
-
return problems.map(
|
|
143
|
-
(p) => `${p.path ? `${p.path}: ` : ""}${p.message} (validator "${p.validatorIdentifier}")`
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// cli/generation/ts-type.ts
|
|
148
|
-
import { existsSync as existsSync2, readFileSync, statSync } from "fs";
|
|
149
|
-
import { dirname, isAbsolute, join, relative, resolve, sep } from "path";
|
|
150
|
-
var RELATIVE_IMPORT = /import\((['"])(\.{1,2}\/[^'"]+)\1\)/g;
|
|
151
|
-
var ABSOLUTE_IMPORT = /import\((['"])(\/[^'"]+|[A-Za-z]:[\\/][^'"]+)\1\)/g;
|
|
152
|
-
var NAMED_IMPORT = /import\((['"])([^'"]+)\1\)\.([A-Za-z_$][\w$]*)/g;
|
|
153
|
-
var MODULE_EXTENSIONS = [".ts", ".tsx", ".d.ts", "/index.ts", "/index.tsx"];
|
|
154
|
-
function capabilityDirectory(workingDir, identifier) {
|
|
155
|
-
return join(workingDir, getPluralResourceMeta("capability").pluralDir, identifier);
|
|
156
|
-
}
|
|
157
|
-
function mapTsTypes(schema, rewrite) {
|
|
158
|
-
if (Array.isArray(schema)) return schema.map((item) => mapTsTypes(item, rewrite));
|
|
159
|
-
if (schema === null || typeof schema !== "object") return schema;
|
|
160
|
-
return Object.fromEntries(
|
|
161
|
-
Object.entries(schema).map(([key, value]) => [
|
|
162
|
-
key,
|
|
163
|
-
key === "tsType" && typeof value === "string" ? rewrite(value) : mapTsTypes(value, rewrite)
|
|
164
|
-
])
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
function collectTsTypes(schema, into = []) {
|
|
168
|
-
if (Array.isArray(schema)) {
|
|
169
|
-
for (const item of schema) collectTsTypes(item, into);
|
|
170
|
-
} else if (schema !== null && typeof schema === "object") {
|
|
171
|
-
for (const [key, value] of Object.entries(schema)) {
|
|
172
|
-
if (key === "tsType" && typeof value === "string") into.push(value);
|
|
173
|
-
else collectTsTypes(value, into);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return into;
|
|
177
|
-
}
|
|
178
|
-
function absolutiseTsTypes(capabilities, workingDir) {
|
|
179
|
-
return capabilities.map((capability) => {
|
|
180
|
-
const schema = capability.definition.variablesSchema;
|
|
181
|
-
if (collectTsTypes(schema).length === 0) return capability;
|
|
182
|
-
const base = capabilityDirectory(workingDir, capability.definition.identifier);
|
|
183
|
-
return {
|
|
184
|
-
...capability,
|
|
185
|
-
definition: {
|
|
186
|
-
...capability.definition,
|
|
187
|
-
variablesSchema: mapTsTypes(
|
|
188
|
-
schema,
|
|
189
|
-
(tsType) => tsType.replace(
|
|
190
|
-
RELATIVE_IMPORT,
|
|
191
|
-
(_match, quote, path) => `import(${quote}${resolve(base, path)}${quote})`
|
|
192
|
-
)
|
|
193
|
-
)
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
function relativiseTsTypes(schema, outputPath) {
|
|
199
|
-
const from = dirname(outputPath);
|
|
200
|
-
return mapTsTypes(
|
|
201
|
-
schema,
|
|
202
|
-
(tsType) => tsType.replace(ABSOLUTE_IMPORT, (_match, quote, path) => {
|
|
203
|
-
let rel = relative(from, path).split(sep).join("/");
|
|
204
|
-
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
205
|
-
return `import(${quote}${rel}${quote})`;
|
|
206
|
-
})
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
function validateTsTypes(capabilities, workingDir) {
|
|
210
|
-
const errors = [];
|
|
211
|
-
for (const capability of capabilities) {
|
|
212
|
-
const { identifier } = capability.definition;
|
|
213
|
-
const base = capabilityDirectory(workingDir, identifier);
|
|
214
|
-
for (const tsType of collectTsTypes(capability.definition.variablesSchema)) {
|
|
215
|
-
for (const match of tsType.matchAll(NAMED_IMPORT)) {
|
|
216
|
-
const [, , specifier, name] = match;
|
|
217
|
-
if (!specifier.startsWith(".") && !isAbsolute(specifier)) continue;
|
|
218
|
-
const target = resolve(base, specifier);
|
|
219
|
-
const file = [target, ...MODULE_EXTENSIONS.map((ext) => `${target}${ext}`)].find(
|
|
220
|
-
(candidate) => existsSync2(candidate) && statSync(candidate).isFile()
|
|
221
|
-
);
|
|
222
|
-
if (!file) {
|
|
223
|
-
errors.push(
|
|
224
|
-
`Capability "${identifier}" has tsType "${tsType}", but "${specifier}" resolves to no module from ${relative(workingDir, base) || "."}. A tsType path is relative to the capability's own directory.`
|
|
225
|
-
);
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
if (!exportsName(readFileSync(file, "utf-8"), name)) {
|
|
229
|
-
errors.push(
|
|
230
|
-
`Capability "${identifier}" has tsType "${tsType}", but ${relative(workingDir, file)} does not export "${name}".`
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return errors;
|
|
237
|
-
}
|
|
238
|
-
function exportsName(source, name) {
|
|
239
|
-
const escaped = name.replace(/[$]/g, "\\$");
|
|
240
|
-
const declared = new RegExp(
|
|
241
|
-
`export\\s+(?:declare\\s+)?(?:interface|type|class|enum|const|let|var|function|abstract\\s+class)\\s+${escaped}\\b`
|
|
242
|
-
);
|
|
243
|
-
const listed = new RegExp(`export\\s+(?:type\\s+)?\\{[^}]*\\b${escaped}\\b[^}]*\\}`);
|
|
244
|
-
return declared.test(source) || listed.test(source) || /export\s+\*\s+from/.test(source);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export {
|
|
248
|
-
SCENARIO_VALIDATION,
|
|
249
|
-
SCENARIO_FILES,
|
|
250
|
-
hasScenarioGate,
|
|
251
|
-
runScenarioGates,
|
|
252
|
-
describeScenarioProblems,
|
|
253
|
-
absolutiseTsTypes,
|
|
254
|
-
relativiseTsTypes,
|
|
255
|
-
validateTsTypes
|
|
256
|
-
};
|
package/dist/cli-L5IG7MY2.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
deleteSettingsEditor
|
|
4
|
-
} from "./cli-XR2XSWQN.js";
|
|
5
|
-
import "./cli-XTANOFQR.js";
|
|
6
|
-
import "./cli-4VZIJYKU.js";
|
|
7
|
-
import "./cli-S5IVGDDD.js";
|
|
8
|
-
import "./cli-JR5AZLLK.js";
|
|
9
|
-
import "./cli-4UWFQNGF.js";
|
|
10
|
-
import "./cli-LE5ICDAF.js";
|
|
11
|
-
import "./cli-IUS2YCD3.js";
|
|
12
|
-
import "./cli-QUNIRH7A.js";
|
|
13
|
-
import "./cli-YSPZZQCP.js";
|
|
14
|
-
import "./cli-XSVGKI3R.js";
|
|
15
|
-
import "./cli-FXY3DKPW.js";
|
|
16
|
-
import "./cli-57V4ARER.js";
|
|
17
|
-
import "./cli-JGFJWZFU.js";
|
|
18
|
-
import "./cli-ZTWOE3ZT.js";
|
|
19
|
-
import "./cli-H3J3ICCQ.js";
|
|
20
|
-
import "./cli-SWZY7L7K.js";
|
|
21
|
-
import "./cli-C6G65H6S.js";
|
|
22
|
-
import "./cli-UTM4QU67.js";
|
|
23
|
-
import "./cli-25RWY5BQ.js";
|
|
24
|
-
import "./cli-QWQMPCL6.js";
|
|
25
|
-
import "./cli-ZF7IFB54.js";
|
|
26
|
-
import "./cli-F2D4GGUA.js";
|
|
27
|
-
import "./cli-4YB3ROVR.js";
|
|
28
|
-
import "./cli-N6H6T2E2.js";
|
|
29
|
-
|
|
30
|
-
// cli/commands/resources/scenario-editor/delete.ts
|
|
31
|
-
function deleteScenarioEditor(options) {
|
|
32
|
-
return deleteSettingsEditor("scenario_editor", options);
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
deleteScenarioEditor
|
|
36
|
-
};
|
package/dist/cli-SPGUVL6Z.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
updateSettingsEditor
|
|
4
|
-
} from "./cli-XR2XSWQN.js";
|
|
5
|
-
import "./cli-XTANOFQR.js";
|
|
6
|
-
import "./cli-4VZIJYKU.js";
|
|
7
|
-
import "./cli-S5IVGDDD.js";
|
|
8
|
-
import "./cli-JR5AZLLK.js";
|
|
9
|
-
import "./cli-4UWFQNGF.js";
|
|
10
|
-
import "./cli-LE5ICDAF.js";
|
|
11
|
-
import "./cli-IUS2YCD3.js";
|
|
12
|
-
import "./cli-QUNIRH7A.js";
|
|
13
|
-
import "./cli-YSPZZQCP.js";
|
|
14
|
-
import "./cli-XSVGKI3R.js";
|
|
15
|
-
import "./cli-FXY3DKPW.js";
|
|
16
|
-
import "./cli-57V4ARER.js";
|
|
17
|
-
import "./cli-JGFJWZFU.js";
|
|
18
|
-
import "./cli-ZTWOE3ZT.js";
|
|
19
|
-
import "./cli-H3J3ICCQ.js";
|
|
20
|
-
import "./cli-SWZY7L7K.js";
|
|
21
|
-
import "./cli-C6G65H6S.js";
|
|
22
|
-
import "./cli-UTM4QU67.js";
|
|
23
|
-
import "./cli-25RWY5BQ.js";
|
|
24
|
-
import "./cli-QWQMPCL6.js";
|
|
25
|
-
import "./cli-ZF7IFB54.js";
|
|
26
|
-
import "./cli-F2D4GGUA.js";
|
|
27
|
-
import "./cli-4YB3ROVR.js";
|
|
28
|
-
import "./cli-N6H6T2E2.js";
|
|
29
|
-
|
|
30
|
-
// cli/commands/resources/setup/update.ts
|
|
31
|
-
function updateSetup(definitionInput, options) {
|
|
32
|
-
return updateSettingsEditor("setup", definitionInput, options);
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
updateSetup
|
|
36
|
-
};
|
package/dist/cli-UY4VDI7W.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
submitPatch,
|
|
4
|
-
submitSharedPatch,
|
|
5
|
-
tickCommand
|
|
6
|
-
} from "./cli-MYJGGLC5.js";
|
|
7
|
-
import "./cli-OANH3BTQ.js";
|
|
8
|
-
import "./cli-WU43JT4T.js";
|
|
9
|
-
import "./cli-GPAN6XK2.js";
|
|
10
|
-
import "./cli-LQ4VSM5R.js";
|
|
11
|
-
import "./cli-EJVAQCMQ.js";
|
|
12
|
-
import "./cli-TDSQSCX4.js";
|
|
13
|
-
import "./cli-SRHBXZCN.js";
|
|
14
|
-
import "./cli-MM3A4SPH.js";
|
|
15
|
-
import "./cli-4LKXZQ2B.js";
|
|
16
|
-
import "./cli-MMN4BPO4.js";
|
|
17
|
-
import "./cli-S5IVGDDD.js";
|
|
18
|
-
import "./cli-QUNIRH7A.js";
|
|
19
|
-
import "./cli-UTM4QU67.js";
|
|
20
|
-
import "./cli-25RWY5BQ.js";
|
|
21
|
-
import "./cli-QWQMPCL6.js";
|
|
22
|
-
import "./cli-ZF7IFB54.js";
|
|
23
|
-
import "./cli-F2D4GGUA.js";
|
|
24
|
-
import "./cli-4YB3ROVR.js";
|
|
25
|
-
import "./cli-N6H6T2E2.js";
|
|
26
|
-
export {
|
|
27
|
-
submitPatch,
|
|
28
|
-
submitSharedPatch,
|
|
29
|
-
tickCommand
|
|
30
|
-
};
|
package/dist/cli-WM6SQJ6Q.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
generateCommand
|
|
4
|
-
} from "./cli-H3J3ICCQ.js";
|
|
5
|
-
import "./cli-SWZY7L7K.js";
|
|
6
|
-
import "./cli-C6G65H6S.js";
|
|
7
|
-
import "./cli-UTM4QU67.js";
|
|
8
|
-
import "./cli-25RWY5BQ.js";
|
|
9
|
-
import "./cli-QWQMPCL6.js";
|
|
10
|
-
import "./cli-ZF7IFB54.js";
|
|
11
|
-
import "./cli-F2D4GGUA.js";
|
|
12
|
-
import "./cli-4YB3ROVR.js";
|
|
13
|
-
import "./cli-N6H6T2E2.js";
|
|
14
|
-
export {
|
|
15
|
-
generateCommand
|
|
16
|
-
};
|
package/dist/cli-ZBTFLZUL.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
updateSettingsEditor
|
|
4
|
-
} from "./cli-XR2XSWQN.js";
|
|
5
|
-
import "./cli-XTANOFQR.js";
|
|
6
|
-
import "./cli-4VZIJYKU.js";
|
|
7
|
-
import "./cli-S5IVGDDD.js";
|
|
8
|
-
import "./cli-JR5AZLLK.js";
|
|
9
|
-
import "./cli-4UWFQNGF.js";
|
|
10
|
-
import "./cli-LE5ICDAF.js";
|
|
11
|
-
import "./cli-IUS2YCD3.js";
|
|
12
|
-
import "./cli-QUNIRH7A.js";
|
|
13
|
-
import "./cli-YSPZZQCP.js";
|
|
14
|
-
import "./cli-XSVGKI3R.js";
|
|
15
|
-
import "./cli-FXY3DKPW.js";
|
|
16
|
-
import "./cli-57V4ARER.js";
|
|
17
|
-
import "./cli-JGFJWZFU.js";
|
|
18
|
-
import "./cli-ZTWOE3ZT.js";
|
|
19
|
-
import "./cli-H3J3ICCQ.js";
|
|
20
|
-
import "./cli-SWZY7L7K.js";
|
|
21
|
-
import "./cli-C6G65H6S.js";
|
|
22
|
-
import "./cli-UTM4QU67.js";
|
|
23
|
-
import "./cli-25RWY5BQ.js";
|
|
24
|
-
import "./cli-QWQMPCL6.js";
|
|
25
|
-
import "./cli-ZF7IFB54.js";
|
|
26
|
-
import "./cli-F2D4GGUA.js";
|
|
27
|
-
import "./cli-4YB3ROVR.js";
|
|
28
|
-
import "./cli-N6H6T2E2.js";
|
|
29
|
-
|
|
30
|
-
// cli/commands/resources/scenario-editor/update.ts
|
|
31
|
-
function updateScenarioEditor(definitionInput, options) {
|
|
32
|
-
return updateSettingsEditor("scenario_editor", definitionInput, options);
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
updateScenarioEditor
|
|
36
|
-
};
|