@dreamboard-games/cli 0.1.30-alpha.12 → 0.1.30-alpha.15
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 -6
- package/dist/agent-verifier/agent-workspace-verifier.mjs +18 -17
- package/dist/agent-verifier/agent-workspace-verifier.mjs.map +1 -1
- package/dist/agent-verifier/{chunk-VLOIZDR6.mjs → chunk-4BECKTAF.mjs} +199 -190
- package/dist/agent-verifier/chunk-4BECKTAF.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-TLYGTHXU.mjs → chunk-5GCZZ6NW.mjs} +3 -3
- package/dist/agent-verifier/{chunk-YR664DJX.mjs → chunk-A67WUYN2.mjs} +42 -68
- package/dist/agent-verifier/chunk-A67WUYN2.mjs.map +1 -0
- package/dist/agent-verifier/chunk-AXXUGU7Q.mjs +255 -0
- package/dist/agent-verifier/chunk-AXXUGU7Q.mjs.map +1 -0
- package/dist/agent-verifier/chunk-CO3BRUD6.mjs +342 -0
- package/dist/agent-verifier/chunk-CO3BRUD6.mjs.map +1 -0
- package/dist/agent-verifier/chunk-DPYC2NDB.mjs +59 -0
- package/dist/agent-verifier/chunk-DPYC2NDB.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-4GU3PCHV.mjs → chunk-DWLTCUUX.mjs} +576 -393
- package/dist/agent-verifier/chunk-DWLTCUUX.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-COB56ESI.mjs → chunk-G2ECODRB.mjs} +2 -2
- package/dist/agent-verifier/{chunk-6XRC5PWB.mjs → chunk-H3XNWKJU.mjs} +217 -232
- package/dist/agent-verifier/chunk-H3XNWKJU.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-Z6OZWUIZ.mjs → chunk-HLHT57AW.mjs} +64 -16
- package/dist/agent-verifier/chunk-HLHT57AW.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-YDIOW2BO.mjs → chunk-INIK6LHK.mjs} +2 -2
- package/dist/agent-verifier/{chunk-UWJIZML3.mjs → chunk-LKQ557TJ.mjs} +30 -23
- package/dist/agent-verifier/chunk-LKQ557TJ.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-NAK77WXW.mjs → chunk-MYMVXTZT.mjs} +4 -5
- package/dist/agent-verifier/chunk-MYMVXTZT.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-UIJ2NDG6.mjs → chunk-NFL3Z4Z7.mjs} +31 -238
- package/dist/agent-verifier/chunk-NFL3Z4Z7.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-XKCJBIRY.mjs → chunk-QD4SQNUP.mjs} +2 -2
- package/dist/agent-verifier/{chunk-IAYRNVUC.mjs → chunk-RDYXWXXC.mjs} +1 -3
- package/dist/agent-verifier/{chunk-QBAF7EYR.mjs → chunk-TTB7AIHZ.mjs} +4 -4
- package/dist/agent-verifier/{chunk-QBAF7EYR.mjs.map → chunk-TTB7AIHZ.mjs.map} +1 -1
- package/dist/agent-verifier/chunk-V6AQDR7W.mjs +89 -0
- package/dist/agent-verifier/chunk-V6AQDR7W.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-RHI6S4SU.mjs → chunk-V7ABTZXW.mjs} +1 -3
- package/dist/agent-verifier/{chunk-RHI6S4SU.mjs.map → chunk-V7ABTZXW.mjs.map} +1 -1
- package/dist/agent-verifier/chunk-WAFBU5U7.mjs +467 -0
- package/dist/agent-verifier/chunk-WAFBU5U7.mjs.map +1 -0
- package/dist/agent-verifier/{chunk-3IJBOLGT.mjs → chunk-WSIYUUSD.mjs} +2 -2
- package/dist/agent-verifier/{compile-WZ7X6I2A.mjs → compile-6G6GENLP.mjs} +22 -18
- package/dist/agent-verifier/compile-6G6GENLP.mjs.map +1 -0
- package/dist/agent-verifier/{global-config-XHL7BCKN.mjs → global-config-6UGFPLDA.mjs} +4 -3
- package/dist/agent-verifier/{keychain-backend-A3MRWLPF.mjs → keychain-backend-BQLW5VEC.mjs} +11 -6
- package/dist/agent-verifier/keychain-backend-BQLW5VEC.mjs.map +1 -0
- package/dist/agent-verifier/{local-files-ZW52HSVT.mjs → local-files-WPHUV6GU.mjs} +6 -6
- package/dist/agent-verifier/{materialize-workspace-BKZLLFI4.mjs → materialize-workspace-S24JA46C.mjs} +17 -17
- package/dist/agent-verifier/materialize-workspace-S24JA46C.mjs.map +1 -0
- package/dist/agent-verifier/{reducer-bundle-preflight-7NYZF5ZT.mjs → reducer-bundle-preflight-3DSXIELT.mjs} +4 -4
- package/dist/agent-verifier/reducer-contract-preflight-FQB7M4PU.mjs +11 -0
- package/dist/agent-verifier/{reducer-native-test-harness-D4VWPIAC.mjs → reducer-native-test-harness-GY2CCQWN.mjs} +12 -9
- package/dist/agent-verifier/{static-scaffold-JCRBDKEH.mjs → static-scaffold-5YD6QHIS.mjs} +7 -9
- package/dist/agent-verifier/{sync-ELLJEWMB.mjs → sync-3OZBFABA.mjs} +24 -22
- package/dist/agent-verifier/{sync-ELLJEWMB.mjs.map → sync-3OZBFABA.mjs.map} +1 -1
- package/dist/agent-verifier/{test-OSXBPLSP.mjs → test-LQAGEQLY.mjs} +19 -17
- package/dist/agent-verifier/test-LQAGEQLY.mjs.map +1 -0
- package/dist/agent-verifier/{workspace-codegen-WPZHMATU.mjs → workspace-codegen-4IWICKLB.mjs} +3 -3
- package/dist/agent-verifier/{workspace-dependencies-ULZZZPNX.mjs → workspace-dependencies-ZMHPHVQV.mjs} +2 -2
- package/dist/authoring-compatibility-internal.js +12 -0
- package/dist/{agent-verifier/chunk-W2MDP5ZN.mjs → chunk-AVOAT522.js} +118 -21
- package/dist/chunk-AVOAT522.js.map +1 -0
- package/dist/chunk-FFO2IJL3.js +204 -0
- package/dist/chunk-FFO2IJL3.js.map +1 -0
- package/dist/chunk-JMV5ZFMK.js +4298 -0
- package/dist/chunk-JMV5ZFMK.js.map +1 -0
- package/dist/{chunk-P5TITCD3.js → chunk-JSF7PMIF.js} +2240 -4554
- package/dist/chunk-JSF7PMIF.js.map +1 -0
- package/dist/{global-config-WPJRXVDO.js → global-config-NLGAFSRU.js} +3 -2
- package/dist/global-config-NLGAFSRU.js.map +1 -0
- package/dist/index.js +1371 -3545
- package/dist/index.js.map +1 -1
- package/dist/internal.js +14 -8
- package/dist/{keychain-backend-JHTXAKWC.js → keychain-backend-47LZ5IX5.js} +11 -6
- package/dist/keychain-backend-47LZ5IX5.js.map +1 -0
- package/package.json +9 -19
- package/release/authoring-release-set.json +38 -0
- package/skills/dreamboard/references/manifest-authoring.md +11 -3
- package/dist/agent-verifier/chunk-4GU3PCHV.mjs.map +0 -1
- package/dist/agent-verifier/chunk-6XRC5PWB.mjs.map +0 -1
- package/dist/agent-verifier/chunk-G42BGGG2.mjs +0 -70
- package/dist/agent-verifier/chunk-G42BGGG2.mjs.map +0 -1
- package/dist/agent-verifier/chunk-KK47X7RV.mjs +0 -14
- package/dist/agent-verifier/chunk-KK47X7RV.mjs.map +0 -1
- package/dist/agent-verifier/chunk-NAK77WXW.mjs.map +0 -1
- package/dist/agent-verifier/chunk-UIJ2NDG6.mjs.map +0 -1
- package/dist/agent-verifier/chunk-UWJIZML3.mjs.map +0 -1
- package/dist/agent-verifier/chunk-VLOIZDR6.mjs.map +0 -1
- package/dist/agent-verifier/chunk-W2MDP5ZN.mjs.map +0 -1
- package/dist/agent-verifier/chunk-YR664DJX.mjs.map +0 -1
- package/dist/agent-verifier/chunk-Z6OZWUIZ.mjs.map +0 -1
- package/dist/agent-verifier/compile-WZ7X6I2A.mjs.map +0 -1
- package/dist/agent-verifier/keychain-backend-A3MRWLPF.mjs.map +0 -1
- package/dist/agent-verifier/materialize-workspace-BKZLLFI4.mjs.map +0 -1
- package/dist/agent-verifier/reducer-contract-preflight-COD2CO22.mjs +0 -11
- package/dist/agent-verifier/test-OSXBPLSP.mjs.map +0 -1
- package/dist/chunk-GXM7RRZJ.js +0 -433
- package/dist/chunk-GXM7RRZJ.js.map +0 -1
- package/dist/chunk-P5TITCD3.js.map +0 -1
- package/dist/dev-host/components/drawer.tsx +0 -132
- package/dist/dev-host/components/input.tsx +0 -21
- package/dist/dev-host/dev-api-proxy-plugin.ts +0 -328
- package/dist/dev-host/dev-author-dom-warnings.ts +0 -100
- package/dist/dev-host/dev-diagnostics.ts +0 -62
- package/dist/dev-host/dev-fallback-stylesheet.ts +0 -53
- package/dist/dev-host/dev-hmr-guard-plugin.ts +0 -47
- package/dist/dev-host/dev-host-controller.ts +0 -674
- package/dist/dev-host/dev-host-player-query.ts +0 -17
- package/dist/dev-host/dev-host-session-transport.ts +0 -52
- package/dist/dev-host/dev-host-storage.ts +0 -56
- package/dist/dev-host/dev-log-relay-plugin.ts +0 -510
- package/dist/dev-host/dev-runtime-config.ts +0 -14
- package/dist/dev-host/dev-runtime-platform.ts +0 -335
- package/dist/dev-host/dev-virtual-modules-plugin.ts +0 -64
- package/dist/dev-host/host-main.css +0 -224
- package/dist/dev-host/host-main.tsx +0 -954
- package/dist/dev-host/index.html +0 -56
- package/dist/dev-host/lib/utils.ts +0 -6
- package/dist/dev-host/plugin-main.ts +0 -61
- package/dist/dev-host/plugin.html +0 -24
- package/dist/dev-host/shared-styles.css +0 -144
- package/dist/dev-host/start-dev-server.ts +0 -140
- package/dist/dev-host/virtual-modules.d.ts +0 -27
- package/dist/keychain-backend-JHTXAKWC.js.map +0 -1
- /package/dist/agent-verifier/{chunk-TLYGTHXU.mjs.map → chunk-5GCZZ6NW.mjs.map} +0 -0
- /package/dist/agent-verifier/{chunk-COB56ESI.mjs.map → chunk-G2ECODRB.mjs.map} +0 -0
- /package/dist/agent-verifier/{chunk-YDIOW2BO.mjs.map → chunk-INIK6LHK.mjs.map} +0 -0
- /package/dist/agent-verifier/{chunk-XKCJBIRY.mjs.map → chunk-QD4SQNUP.mjs.map} +0 -0
- /package/dist/agent-verifier/{chunk-IAYRNVUC.mjs.map → chunk-RDYXWXXC.mjs.map} +0 -0
- /package/dist/agent-verifier/{chunk-3IJBOLGT.mjs.map → chunk-WSIYUUSD.mjs.map} +0 -0
- /package/dist/agent-verifier/{global-config-XHL7BCKN.mjs.map → global-config-6UGFPLDA.mjs.map} +0 -0
- /package/dist/agent-verifier/{local-files-ZW52HSVT.mjs.map → local-files-WPHUV6GU.mjs.map} +0 -0
- /package/dist/agent-verifier/{reducer-bundle-preflight-7NYZF5ZT.mjs.map → reducer-bundle-preflight-3DSXIELT.mjs.map} +0 -0
- /package/dist/agent-verifier/{reducer-contract-preflight-COD2CO22.mjs.map → reducer-contract-preflight-FQB7M4PU.mjs.map} +0 -0
- /package/dist/agent-verifier/{reducer-native-test-harness-D4VWPIAC.mjs.map → reducer-native-test-harness-GY2CCQWN.mjs.map} +0 -0
- /package/dist/agent-verifier/{static-scaffold-JCRBDKEH.mjs.map → static-scaffold-5YD6QHIS.mjs.map} +0 -0
- /package/dist/agent-verifier/{workspace-codegen-WPZHMATU.mjs.map → workspace-codegen-4IWICKLB.mjs.map} +0 -0
- /package/dist/agent-verifier/{workspace-dependencies-ULZZZPNX.mjs.map → workspace-dependencies-ZMHPHVQV.mjs.map} +0 -0
- /package/dist/{global-config-WPJRXVDO.js.map → authoring-compatibility-internal.js.map} +0 -0
- /package/{dist/scaffold → scaffold}/assets/static/app/tsconfig.framework.json +0 -0
- /package/{dist/scaffold → scaffold}/assets/static/app/tsconfig.json +0 -0
- /package/{dist/scaffold → scaffold}/assets/static/ui/index.tsx +0 -0
- /package/{dist/scaffold → scaffold}/assets/static/ui/style.css +0 -0
- /package/{dist/scaffold → scaffold}/assets/static/ui/tsconfig.framework.json +0 -0
- /package/{dist/scaffold → scaffold}/assets/static/ui/tsconfig.json +0 -0
|
@@ -1,19 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
importTypeScriptModule
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QD4SQNUP.mjs";
|
|
5
5
|
import {
|
|
6
6
|
external_exports
|
|
7
7
|
} from "./chunk-JZTH3EMV.mjs";
|
|
8
8
|
|
|
9
9
|
// src/services/project/reducer-bundle-preflight.ts
|
|
10
10
|
import path from "path";
|
|
11
|
-
import {
|
|
12
|
-
import "
|
|
13
|
-
import { materializeManifestTable } from "@dreamboard-games/sdk/codegen";
|
|
11
|
+
import { createRequire } from "module";
|
|
12
|
+
import { pathToFileURL } from "url";
|
|
14
13
|
globalThis.__DREAMBOARD_AUTHORING_WARNINGS__ = true;
|
|
15
14
|
var REDUCER_BUNDLE_ENTRY_PATH = path.join("app", "index.ts");
|
|
16
15
|
var PREFLIGHT_RNG_SEED = 1337;
|
|
16
|
+
function isStructuralPerPlayer(value) {
|
|
17
|
+
return typeof value === "object" && value !== null && value.__perPlayer === true && Array.isArray(value.entries);
|
|
18
|
+
}
|
|
19
|
+
function fallbackPerPlayerSchema(valueSchema, options) {
|
|
20
|
+
const playerSchema = options.players.length > 0 ? external_exports.enum(options.players) : external_exports.string();
|
|
21
|
+
return external_exports.object({
|
|
22
|
+
__perPlayer: external_exports.literal(true),
|
|
23
|
+
entries: external_exports.array(external_exports.tuple([playerSchema, valueSchema]))
|
|
24
|
+
}).strict();
|
|
25
|
+
}
|
|
26
|
+
async function loadProjectReducerPreflightModules(projectRoot) {
|
|
27
|
+
const requireFromProject = createRequire(
|
|
28
|
+
path.join(projectRoot, "package.json")
|
|
29
|
+
);
|
|
30
|
+
const reducerPath = requireFromProject.resolve("@dreamboard-games/sdk/reducer");
|
|
31
|
+
const reducerContractPath = requireFromProject.resolve(
|
|
32
|
+
"@dreamboard-games/sdk/reducer-contract"
|
|
33
|
+
);
|
|
34
|
+
const [reducerModule, reducerContractModule] = await Promise.all([
|
|
35
|
+
import(pathToFileURL(reducerPath).href),
|
|
36
|
+
import(pathToFileURL(reducerContractPath).href)
|
|
37
|
+
]);
|
|
38
|
+
if (typeof reducerModule.isPerPlayer !== "function" || typeof reducerModule.perPlayerSchema !== "function" || typeof reducerContractModule.materializeManifestTable !== "function") {
|
|
39
|
+
throw new Error(
|
|
40
|
+
"Installed @dreamboard-games/sdk does not expose the reducer preflight helpers required by this CLI."
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
isPerPlayer: reducerModule.isPerPlayer,
|
|
45
|
+
perPlayerSchema: reducerModule.perPlayerSchema,
|
|
46
|
+
materializeManifestTable: reducerContractModule.materializeManifestTable
|
|
47
|
+
};
|
|
48
|
+
}
|
|
17
49
|
function buildPlayerIds(playerCount) {
|
|
18
50
|
const ids = [];
|
|
19
51
|
for (let index = 1; index <= playerCount; index += 1) {
|
|
@@ -58,12 +90,15 @@ function summarizeError(error) {
|
|
|
58
90
|
}
|
|
59
91
|
return { headline: String(error ?? "Unknown failure") };
|
|
60
92
|
}
|
|
61
|
-
function assertViewPerPlayerSeatsValid(view, expectedPlayerIds,
|
|
93
|
+
function assertViewPerPlayerSeatsValid(view, expectedPlayerIds, helpers = {
|
|
94
|
+
isPerPlayer: isStructuralPerPlayer,
|
|
95
|
+
perPlayerSchema: fallbackPerPlayerSchema
|
|
96
|
+
}, breadcrumb = []) {
|
|
62
97
|
if (view === null || view === void 0) {
|
|
63
98
|
return null;
|
|
64
99
|
}
|
|
65
|
-
if (isPerPlayer(view)) {
|
|
66
|
-
const schema = perPlayerSchema(external_exports.unknown(), {
|
|
100
|
+
if (helpers.isPerPlayer(view)) {
|
|
101
|
+
const schema = helpers.perPlayerSchema(external_exports.unknown(), {
|
|
67
102
|
players: expectedPlayerIds
|
|
68
103
|
});
|
|
69
104
|
const result = schema.safeParse(view);
|
|
@@ -80,6 +115,7 @@ function assertViewPerPlayerSeatsValid(view, expectedPlayerIds, breadcrumb = [])
|
|
|
80
115
|
const result = assertViewPerPlayerSeatsValid(
|
|
81
116
|
view[index],
|
|
82
117
|
expectedPlayerIds,
|
|
118
|
+
helpers,
|
|
83
119
|
[...breadcrumb, `[${index}]`]
|
|
84
120
|
);
|
|
85
121
|
if (result) return result;
|
|
@@ -90,10 +126,12 @@ function assertViewPerPlayerSeatsValid(view, expectedPlayerIds, breadcrumb = [])
|
|
|
90
126
|
for (const [key, value] of Object.entries(
|
|
91
127
|
view
|
|
92
128
|
)) {
|
|
93
|
-
const result = assertViewPerPlayerSeatsValid(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
129
|
+
const result = assertViewPerPlayerSeatsValid(
|
|
130
|
+
value,
|
|
131
|
+
expectedPlayerIds,
|
|
132
|
+
helpers,
|
|
133
|
+
[...breadcrumb, key]
|
|
134
|
+
);
|
|
97
135
|
if (result) return result;
|
|
98
136
|
}
|
|
99
137
|
return null;
|
|
@@ -104,7 +142,7 @@ function identityShuffle(values) {
|
|
|
104
142
|
return [...values];
|
|
105
143
|
}
|
|
106
144
|
async function driveReducerBundleThroughScenarios(options) {
|
|
107
|
-
const { manifest, bundle, scenarios } = options;
|
|
145
|
+
const { manifest, bundle, scenarios, preflightModules } = options;
|
|
108
146
|
const rngSeed = options.rngSeed ?? PREFLIGHT_RNG_SEED;
|
|
109
147
|
const failures = [];
|
|
110
148
|
const tableCache = /* @__PURE__ */ new Map();
|
|
@@ -115,7 +153,7 @@ async function driveReducerBundleThroughScenarios(options) {
|
|
|
115
153
|
const playerIds2 = buildPlayerIds(scenario.playerCount);
|
|
116
154
|
const table2 = JSON.parse(
|
|
117
155
|
JSON.stringify(
|
|
118
|
-
materializeManifestTable({
|
|
156
|
+
preflightModules.materializeManifestTable({
|
|
119
157
|
manifest,
|
|
120
158
|
playerIds: playerIds2,
|
|
121
159
|
shuffleItems: identityShuffle
|
|
@@ -185,7 +223,11 @@ async function driveReducerBundleThroughScenarios(options) {
|
|
|
185
223
|
});
|
|
186
224
|
continue;
|
|
187
225
|
}
|
|
188
|
-
const mismatch = assertViewPerPlayerSeatsValid(
|
|
226
|
+
const mismatch = assertViewPerPlayerSeatsValid(
|
|
227
|
+
seat.view,
|
|
228
|
+
playerIds,
|
|
229
|
+
preflightModules
|
|
230
|
+
);
|
|
189
231
|
if (mismatch) {
|
|
190
232
|
failures.push({
|
|
191
233
|
scenario,
|
|
@@ -229,7 +271,13 @@ async function runReducerBundleSmoke(options) {
|
|
|
229
271
|
].join(" ")
|
|
230
272
|
);
|
|
231
273
|
}
|
|
232
|
-
|
|
274
|
+
const preflightModules = await loadProjectReducerPreflightModules(projectRoot);
|
|
275
|
+
return driveReducerBundleThroughScenarios({
|
|
276
|
+
manifest,
|
|
277
|
+
bundle,
|
|
278
|
+
scenarios,
|
|
279
|
+
preflightModules
|
|
280
|
+
});
|
|
233
281
|
}
|
|
234
282
|
function formatFailureLines(failures) {
|
|
235
283
|
return failures.map((failure) => {
|
|
@@ -258,4 +306,4 @@ export {
|
|
|
258
306
|
runReducerBundleSmoke,
|
|
259
307
|
assertReducerBundleSmoke
|
|
260
308
|
};
|
|
261
|
-
//# sourceMappingURL=chunk-
|
|
309
|
+
//# sourceMappingURL=chunk-HLHT57AW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/project/reducer-bundle-preflight.ts"],"sourcesContent":["import path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\nimport type {\n GameTopologyManifest,\n SetupProfileSpec,\n} from \"@dreamboard-games/sdk/types\";\nimport { z } from \"zod\";\nimport { importTypeScriptModule } from \"../../utils/ts-module-loader.js\";\n\nnamespace Wire {\n export type JsonValue =\n | null\n | boolean\n | number\n | string\n | JsonValue[]\n | { [key: string]: JsonValue };\n export type ReducerSessionState = Record<string, unknown>;\n export type SeatProjection = { view: unknown };\n export type SeatProjectionBundle = {\n seats?: Record<string, SeatProjection | undefined>;\n };\n}\n\n// Opt in to SDK authoring warnings (e.g. concrete dependent-choice defaults).\n// Trusted reducer code cannot read process.env, so the SDK gates authoring\n// warnings on this host-set global instead.\n(globalThis as Record<string, unknown>).__DREAMBOARD_AUTHORING_WARNINGS__ =\n true;\n\n/**\n * Path to the reducer bundle entry, relative to the project root. Matches\n * the scaffold produced by `dreamboard new`.\n */\nconst REDUCER_BUNDLE_ENTRY_PATH = path.join(\"app\", \"index.ts\");\n\n/**\n * Deterministic rng seed used to drive the reducer during preflight.\n * Kept stable so local preflight failures reproduce across CLI runs.\n */\nconst PREFLIGHT_RNG_SEED = 1337;\n\n/**\n * Phase of the preflight smoke test that a failure occurred in.\n */\nexport type ReducerBundleSmokePhase =\n | \"BUILD_GAME_STATE\"\n | \"INITIALIZE\"\n | \"PROJECT_SEATS\"\n | \"VALIDATE_VIEW\";\n\nexport interface ReducerBundleSmokeScenario {\n readonly setupProfileId: string | null;\n readonly playerCount: number;\n}\n\nexport interface ReducerBundleSmokeFailure {\n readonly scenario: ReducerBundleSmokeScenario;\n readonly phase: ReducerBundleSmokePhase;\n readonly playerId?: string;\n readonly headline: string;\n readonly detail?: string;\n}\n\n/**\n * Shape of a single seat's slice in `projectSeatsDynamic(...)`. Only `view`\n * is consumed by the preflight, but the full wire DTO keeps local tests\n * aligned with the canonical reducer boundary.\n */\nexport type ReducerBundleSeatProjection = Wire.SeatProjection;\n\n/** Result of calling `bundle.projectSeatsDynamic({ state, playerIds })`. */\nexport type ReducerBundleSeatProjectionBundle = Wire.SeatProjectionBundle;\n\n/**\n * Minimal structural shape the preflight needs from the authored reducer\n * bundle. Matches the subset of `createReducerBundle(game)` used by the\n * reducer runtime.\n */\nexport type ReducerBundleLike = Pick<\n {\n initialize(input: {\n table: Wire.JsonValue;\n playerIds: readonly string[];\n rngSeed?: number | null;\n setup?: unknown;\n }): unknown | Promise<unknown>;\n projectSeatsDynamic(input: {\n state: unknown;\n playerIds: readonly string[];\n }): ReducerBundleSeatProjectionBundle;\n },\n \"initialize\" | \"projectSeatsDynamic\"\n>;\n\ntype PerPlayerValidationHelpers = {\n isPerPlayer(value: unknown): boolean;\n perPlayerSchema(\n valueSchema: z.ZodTypeAny,\n options: { players: readonly string[] },\n ): z.ZodTypeAny;\n};\n\ntype ProjectReducerPreflightModules = PerPlayerValidationHelpers & {\n materializeManifestTable(input: {\n manifest: GameTopologyManifest;\n playerIds: readonly string[];\n shuffleItems<Value>(values: readonly Value[]): Value[];\n }): unknown;\n};\n\nfunction isStructuralPerPlayer(value: unknown): boolean {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { __perPlayer?: unknown }).__perPlayer === true &&\n Array.isArray((value as { entries?: unknown }).entries)\n );\n}\n\nfunction fallbackPerPlayerSchema(\n valueSchema: z.ZodTypeAny,\n options: { players: readonly string[] },\n): z.ZodTypeAny {\n const playerSchema =\n options.players.length > 0\n ? z.enum(options.players as [string, ...string[]])\n : z.string();\n return z\n .object({\n __perPlayer: z.literal(true),\n entries: z.array(z.tuple([playerSchema, valueSchema])),\n })\n .strict();\n}\n\nasync function loadProjectReducerPreflightModules(\n projectRoot: string,\n): Promise<ProjectReducerPreflightModules> {\n const requireFromProject = createRequire(\n path.join(projectRoot, \"package.json\"),\n );\n const reducerPath = requireFromProject.resolve(\"@dreamboard-games/sdk/reducer\");\n const reducerContractPath = requireFromProject.resolve(\n \"@dreamboard-games/sdk/reducer-contract\",\n );\n const [reducerModule, reducerContractModule] = (await Promise.all([\n import(pathToFileURL(reducerPath).href),\n import(pathToFileURL(reducerContractPath).href),\n ])) as [\n Partial<PerPlayerValidationHelpers>,\n { materializeManifestTable?: unknown },\n ];\n\n if (\n typeof reducerModule.isPerPlayer !== \"function\" ||\n typeof reducerModule.perPlayerSchema !== \"function\" ||\n typeof reducerContractModule.materializeManifestTable !== \"function\"\n ) {\n throw new Error(\n \"Installed @dreamboard-games/sdk does not expose the reducer preflight helpers required by this CLI.\",\n );\n }\n\n return {\n isPerPlayer: reducerModule.isPerPlayer,\n perPlayerSchema: reducerModule.perPlayerSchema,\n materializeManifestTable:\n reducerContractModule.materializeManifestTable as ProjectReducerPreflightModules[\"materializeManifestTable\"],\n };\n}\n\nfunction buildPlayerIds(playerCount: number): string[] {\n const ids: string[] = [];\n for (let index = 1; index <= playerCount; index += 1) {\n ids.push(`player-${index}`);\n }\n return ids;\n}\n\n/**\n * Build the matrix of scenarios to drive. Exported for tests so we can\n * assert scenario generation without loading a full reducer bundle.\n */\nexport function buildScenarios(\n manifest: GameTopologyManifest,\n): ReducerBundleSmokeScenario[] {\n const rawCounts = [\n manifest.players?.minPlayers,\n manifest.players?.maxPlayers,\n ].filter(\n (count): count is number =>\n typeof count === \"number\" && Number.isFinite(count) && count > 0,\n );\n const playerCounts = Array.from(new Set(rawCounts));\n if (playerCounts.length === 0) {\n return [];\n }\n const profiles: SetupProfileSpec[] = manifest.setupProfiles ?? [];\n const profileIds: Array<string | null> =\n profiles.length > 0 ? profiles.map((profile) => profile.id) : [null];\n\n const scenarios: ReducerBundleSmokeScenario[] = [];\n const seen = new Set<string>();\n for (const profileId of profileIds) {\n for (const count of playerCounts) {\n const key = `${profileId ?? \"<default>\"}:${count}`;\n if (seen.has(key)) continue;\n seen.add(key);\n scenarios.push({ setupProfileId: profileId, playerCount: count });\n }\n }\n return scenarios;\n}\n\nfunction describeScenario(scenario: ReducerBundleSmokeScenario): string {\n const profileDesc = scenario.setupProfileId\n ? `setup profile '${scenario.setupProfileId}'`\n : \"no setup profile\";\n return `${profileDesc}, ${scenario.playerCount} player${\n scenario.playerCount === 1 ? \"\" : \"s\"\n }`;\n}\n\nfunction summarizeError(error: unknown): { headline: string; detail?: string } {\n if (error instanceof Error) {\n const firstLine =\n error.message\n .split(\"\\n\")\n .map((line) => line.trim())\n .find((line) => line.length > 0) ?? \"Unknown failure\";\n const detail =\n error.stack && error.stack !== error.message ? error.stack : undefined;\n return { headline: firstLine, detail };\n }\n return { headline: String(error ?? \"Unknown failure\") };\n}\n\n/**\n * Walk `view` recursively and, for every embedded `PerPlayer<T>` shape,\n * assert its seat list matches `expectedPlayerIds` using\n * `perPlayerSchema({ players })`. Returns `null` on success, or a headline\n * describing the first mismatch.\n *\n * This catches the class of bug where an author returns a `PerPlayer<T>`\n * that was built from the wrong seat list (e.g. a manifest-derived\n * `maxPlayers` literal union) while the runtime session has a different\n * number of seats. The Zod bound schema produces an identical error shape\n * to the one the backend raises in production so authors see the same\n * diagnostic locally.\n */\nexport function assertViewPerPlayerSeatsValid(\n view: unknown,\n expectedPlayerIds: readonly string[],\n helpers: PerPlayerValidationHelpers = {\n isPerPlayer: isStructuralPerPlayer,\n perPlayerSchema: fallbackPerPlayerSchema,\n },\n breadcrumb: string[] = [],\n): string | null {\n if (view === null || view === undefined) {\n return null;\n }\n\n if (helpers.isPerPlayer(view)) {\n const schema = helpers.perPlayerSchema(z.unknown(), {\n players: expectedPlayerIds as never,\n });\n const result = schema.safeParse(view);\n if (!result.success) {\n const firstIssue = result.error.issues[0];\n const location =\n breadcrumb.length > 0 ? ` at view.${breadcrumb.join(\".\")}` : \"\";\n const message = firstIssue?.message ?? \"PerPlayer seat mismatch\";\n return `PerPlayer seat mismatch${location}: ${message}`;\n }\n return null;\n }\n\n if (Array.isArray(view)) {\n for (let index = 0; index < view.length; index += 1) {\n const result = assertViewPerPlayerSeatsValid(\n view[index],\n expectedPlayerIds,\n helpers,\n [...breadcrumb, `[${index}]`],\n );\n if (result) return result;\n }\n return null;\n }\n\n if (typeof view === \"object\") {\n for (const [key, value] of Object.entries(\n view as Record<string, unknown>,\n )) {\n const result = assertViewPerPlayerSeatsValid(\n value,\n expectedPlayerIds,\n helpers,\n [...breadcrumb, key],\n );\n if (result) return result;\n }\n return null;\n }\n\n return null;\n}\n\nfunction identityShuffle<Value>(values: readonly Value[]): Value[] {\n return [...values];\n}\n\n/**\n * Drive an already-loaded reducer bundle through the provided scenarios.\n * Shared between the full `runReducerBundleSmoke` entrypoint and the\n * unit tests, which feed a fake bundle directly.\n *\n * For each (setup profile × player count) scenario this:\n *\n * 1. materializes an initial table via `materializeManifestTable`,\n * 2. calls `bundle.initialize({ table, playerIds, rngSeed, setup })`,\n * 3. calls `bundle.projectSeatsDynamic({ state, playerIds })` once, and\n * 4. validates any embedded `PerPlayer<T>` views match the runtime seat\n * list using `perPlayerSchema({ players: playerIds })`.\n *\n * Failures are collected instead of thrown so authors get the full list\n * of broken scenarios in one preflight pass.\n */\nexport async function driveReducerBundleThroughScenarios(options: {\n manifest: GameTopologyManifest;\n bundle: ReducerBundleLike;\n scenarios: readonly ReducerBundleSmokeScenario[];\n preflightModules: ProjectReducerPreflightModules;\n rngSeed?: number;\n}): Promise<ReducerBundleSmokeFailure[]> {\n const { manifest, bundle, scenarios, preflightModules } = options;\n const rngSeed = options.rngSeed ?? PREFLIGHT_RNG_SEED;\n\n const failures: ReducerBundleSmokeFailure[] = [];\n const tableCache = new Map<\n number,\n { table: unknown; playerIds: string[] } | { error: unknown }\n >();\n\n for (const scenario of scenarios) {\n let tableEntry = tableCache.get(scenario.playerCount);\n if (!tableEntry) {\n try {\n const playerIds = buildPlayerIds(scenario.playerCount);\n // JSON-roundtrip the materialized table to mirror the backend wire\n // boundary: real flows serialize the table over HTTP, which drops\n // explicit `undefined` property values (e.g. optional card text) that\n // the bundle's strict JSON state schema would otherwise reject.\n const table: unknown = JSON.parse(\n JSON.stringify(\n preflightModules.materializeManifestTable({\n manifest,\n playerIds,\n shuffleItems: identityShuffle,\n }),\n ),\n );\n tableEntry = { table, playerIds };\n } catch (error) {\n tableEntry = { error };\n }\n tableCache.set(scenario.playerCount, tableEntry);\n }\n if (\"error\" in tableEntry) {\n const summary = summarizeError(tableEntry.error);\n failures.push({\n scenario,\n phase: \"BUILD_GAME_STATE\",\n headline: summary.headline,\n detail: summary.detail,\n });\n continue;\n }\n\n const { table, playerIds } = tableEntry;\n\n let sessionState: unknown;\n try {\n sessionState = await bundle.initialize({\n table: table as Wire.JsonValue,\n playerIds: [...playerIds],\n rngSeed,\n setup: scenario.setupProfileId\n ? { profileId: scenario.setupProfileId, optionValues: {} }\n : null,\n });\n } catch (error) {\n const summary = summarizeError(error);\n failures.push({\n scenario,\n phase: \"INITIALIZE\",\n headline: summary.headline,\n detail: summary.detail,\n });\n continue;\n }\n\n let projection: ReducerBundleSeatProjectionBundle | undefined;\n try {\n projection = bundle.projectSeatsDynamic({\n state: sessionState as Wire.ReducerSessionState,\n playerIds: [...playerIds],\n });\n } catch (error) {\n const summary = summarizeError(error);\n failures.push({\n scenario,\n phase: \"PROJECT_SEATS\",\n headline: summary.headline,\n detail: summary.detail,\n });\n continue;\n }\n\n const seats = projection?.seats ?? {};\n for (const playerId of playerIds) {\n const seat = seats[playerId];\n if (!seat) {\n failures.push({\n scenario,\n phase: \"PROJECT_SEATS\",\n playerId,\n headline: `projectSeatsDynamic() did not return an entry for seat '${playerId}'.`,\n });\n continue;\n }\n const mismatch = assertViewPerPlayerSeatsValid(\n seat.view,\n playerIds,\n preflightModules,\n );\n if (mismatch) {\n failures.push({\n scenario,\n phase: \"VALIDATE_VIEW\",\n playerId,\n headline: mismatch,\n });\n }\n }\n }\n\n return failures;\n}\n\n/**\n * Import the authored reducer bundle from `projectRoot/app/index.ts` and\n * drive it through every (setup profile × player count) scenario the\n * manifest declares. Returns the collected failures without throwing so\n * callers can decide whether to surface them.\n */\nexport async function runReducerBundleSmoke(options: {\n projectRoot: string;\n manifest: GameTopologyManifest;\n}): Promise<ReducerBundleSmokeFailure[]> {\n const { projectRoot, manifest } = options;\n const scenarios = buildScenarios(manifest);\n if (scenarios.length === 0) {\n return [];\n }\n\n const entryPath = path.join(projectRoot, REDUCER_BUNDLE_ENTRY_PATH);\n let module: { default?: ReducerBundleLike };\n try {\n module = await importTypeScriptModule<{ default?: ReducerBundleLike }>(\n entryPath,\n );\n } catch (error) {\n const summary = summarizeError(error);\n throw new Error(\n [\n `Dreamboard could not import \\`${REDUCER_BUNDLE_ENTRY_PATH}\\` during \\`dreamboard sync\\`.`,\n \"Fix the reducer bundle entry so it can be imported locally, then run `dreamboard sync` again.\",\n `Original error: ${summary.headline}`,\n ].join(\" \"),\n );\n }\n const bundle = module.default;\n if (!bundle || typeof bundle.initialize !== \"function\") {\n throw new Error(\n [\n `\\`${REDUCER_BUNDLE_ENTRY_PATH}\\` does not export a reducer bundle as its default export.`,\n \"Export `createReducerBundle(game)` from `app/index.ts` so the compile pipeline can smoke-test it.\",\n ].join(\" \"),\n );\n }\n\n const preflightModules = await loadProjectReducerPreflightModules(projectRoot);\n return driveReducerBundleThroughScenarios({\n manifest,\n bundle,\n scenarios,\n preflightModules,\n });\n}\n\nfunction formatFailureLines(\n failures: readonly ReducerBundleSmokeFailure[],\n): string {\n return failures\n .map((failure) => {\n const location = failure.playerId ? ` (seat ${failure.playerId})` : \"\";\n return `• [${failure.phase}] ${describeScenario(failure.scenario)}${location}: ${failure.headline}`;\n })\n .join(\"\\n\");\n}\n\n/**\n * Preflight wrapper used by `dreamboard sync`. Runs\n * `runReducerBundleSmoke` and throws an aggregated error if any scenario\n * failed so the author sees every broken seat/profile in one shot.\n *\n * Sync already guarantees that the authored contract imports cleanly\n * (via `assertReducerContractPreflight`) and that `tsc --noEmit` is\n * green (via `runLocalTypecheck`) before this runs, so failures from\n * this step are always runtime-shaped (`initialize`/`projectSeatsDynamic` rejecting,\n * `perPlayer` seat mismatches, …) rather than static type or import\n * errors.\n */\nexport async function assertReducerBundleSmoke(options: {\n projectRoot: string;\n manifest: GameTopologyManifest;\n}): Promise<void> {\n const failures = await runReducerBundleSmoke(options);\n if (failures.length === 0) {\n return;\n }\n throw new Error(\n [\n \"Reducer bundle preflight failed during `dreamboard sync`.\",\n \"Fix the reported scenarios locally before syncing so the backend does not catch them after start-game:\",\n formatFailureLines(failures),\n ].join(\"\\n\"),\n );\n}\n"],"mappings":";;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AA0B7B,WAAuC,oCACtC;AAMF,IAAM,4BAA4B,KAAK,KAAK,OAAO,UAAU;AAM7D,IAAM,qBAAqB;AAuE3B,SAAS,sBAAsB,OAAyB;AACtD,SACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAoC,gBAAgB,QACrD,MAAM,QAAS,MAAgC,OAAO;AAE1D;AAEA,SAAS,wBACP,aACA,SACc;AACd,QAAM,eACJ,QAAQ,QAAQ,SAAS,IACrB,iBAAE,KAAK,QAAQ,OAAgC,IAC/C,iBAAE,OAAO;AACf,SAA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A,IACA;AAAA,EACF,CAAC;AACH;AAEA,SAAS,mBACP,UACQ;AACR,SAAO,SACJ,IAAI,CAAC,YAAY;AAChB,UAAM,WAAW,QAAQ,WAAW,UAAU,QAAQ,QAAQ,MAAM;AACpE,WAAO,WAAM,QAAQ,KAAK,KAAK,iBAAiB,QAAQ,QAAQ,CAAC,GAAG,QAAQ,KAAK,QAAQ,QAAQ;AAAA,EACnG,CAAC,EACA,KAAK,IAAI;AACd;AAcA,eAAsB,yBAAyB,SAG7B;AAChB,QAAM,WAAW,MAAM,sBAAsB,OAAO;AACpD,MAAI,SAAS,WAAW,GAAG;AACzB;AAAA,EACF;AACA,QAAM,IAAI;AAAA,IACR;AAAA,MACE;AAAA,MACA;AAAA,MACA,mBAAmB,QAAQ;AAAA,IAC7B,EAAE,KAAK,IAAI;AAAA,EACb;AACF;","names":["playerIds","table"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
importTypeScriptModule
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QD4SQNUP.mjs";
|
|
5
5
|
|
|
6
6
|
// src/services/project/reducer-contract-preflight.ts
|
|
7
7
|
import path from "path";
|
|
@@ -42,4 +42,4 @@ async function assertReducerContractPreflight(projectRoot) {
|
|
|
42
42
|
export {
|
|
43
43
|
assertReducerContractPreflight
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
45
|
+
//# sourceMappingURL=chunk-INIK6LHK.mjs.map
|
|
@@ -9,13 +9,14 @@ import {
|
|
|
9
9
|
isLibraryPath,
|
|
10
10
|
materializeManifest,
|
|
11
11
|
writeManifestSource
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-H3XNWKJU.mjs";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
readWorkspaceTextFile,
|
|
15
|
+
readWorkspaceTextFileIfExists,
|
|
16
|
+
resolveWorkspacePath,
|
|
17
|
+
unlinkWorkspaceFile,
|
|
18
|
+
writeWorkspaceTextFile
|
|
19
|
+
} from "./chunk-WAFBU5U7.mjs";
|
|
19
20
|
import {
|
|
20
21
|
LOCAL_IGNORE_DIRS,
|
|
21
22
|
MANIFEST_FILE,
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
} from "./chunk-M7UVBANQ.mjs";
|
|
26
27
|
|
|
27
28
|
// src/services/project/local-files.ts
|
|
28
|
-
import { readdir
|
|
29
|
+
import { readdir } from "fs/promises";
|
|
29
30
|
import path from "path";
|
|
30
31
|
function isAllowedGamePath2(filePath) {
|
|
31
32
|
return isAllowedGamePath(filePath);
|
|
@@ -41,8 +42,7 @@ function shouldWriteScaffoldFile(filePath, existingContent) {
|
|
|
41
42
|
async function writeSourceFiles(rootDir, files) {
|
|
42
43
|
for (const [relativePath, content] of Object.entries(files)) {
|
|
43
44
|
if (content === null || content === void 0) continue;
|
|
44
|
-
|
|
45
|
-
await writeTextFile(filePath, content);
|
|
45
|
+
await writeWorkspaceTextFile(rootDir, relativePath, content);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
async function writeScaffoldFiles(rootDir, files) {
|
|
@@ -50,14 +50,16 @@ async function writeScaffoldFiles(rootDir, files) {
|
|
|
50
50
|
const skipped = [];
|
|
51
51
|
for (const [relativePath, content] of Object.entries(files)) {
|
|
52
52
|
if (content === null || content === void 0) continue;
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
const existingContent = await readWorkspaceTextFileIfExists(
|
|
54
|
+
rootDir,
|
|
55
|
+
relativePath
|
|
56
|
+
);
|
|
55
57
|
const decision = shouldWriteScaffoldFile(relativePath, existingContent);
|
|
56
58
|
if (decision === "skip") {
|
|
57
59
|
skipped.push(relativePath);
|
|
58
60
|
continue;
|
|
59
61
|
}
|
|
60
|
-
await
|
|
62
|
+
await writeWorkspaceTextFile(rootDir, relativePath, content);
|
|
61
63
|
if (existingContent !== content) {
|
|
62
64
|
written.push(relativePath);
|
|
63
65
|
}
|
|
@@ -71,7 +73,7 @@ async function removeExtraneousFiles(rootDir, keep) {
|
|
|
71
73
|
for (const filePath of Object.keys(localFiles)) {
|
|
72
74
|
if (filePath === MANIFEST_FILE || filePath === RULE_FILE) continue;
|
|
73
75
|
if (!keep.has(filePath)) {
|
|
74
|
-
await
|
|
76
|
+
await unlinkWorkspaceFile(rootDir, filePath);
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -89,7 +91,7 @@ async function walkDir(rootDir, currentDir, result) {
|
|
|
89
91
|
} else if (entry.isFile()) {
|
|
90
92
|
const filePath = path.join(currentDir, entry.name);
|
|
91
93
|
const relativePath = path.relative(rootDir, filePath);
|
|
92
|
-
result[relativePath] = await
|
|
94
|
+
result[relativePath] = await readWorkspaceTextFile(rootDir, relativePath);
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
}
|
|
@@ -97,15 +99,13 @@ async function writeManifest(rootDir, manifest) {
|
|
|
97
99
|
await writeManifestSource(rootDir, manifest);
|
|
98
100
|
}
|
|
99
101
|
async function writeRule(rootDir, ruleText) {
|
|
100
|
-
|
|
101
|
-
await writeTextFile(filePath, ruleText);
|
|
102
|
+
await writeWorkspaceTextFile(rootDir, RULE_FILE, ruleText);
|
|
102
103
|
}
|
|
103
104
|
async function loadManifest(rootDir) {
|
|
104
105
|
return materializeManifest(rootDir);
|
|
105
106
|
}
|
|
106
107
|
async function loadRule(rootDir) {
|
|
107
|
-
|
|
108
|
-
return readTextFile(filePath);
|
|
108
|
+
return readWorkspaceTextFile(rootDir, RULE_FILE);
|
|
109
109
|
}
|
|
110
110
|
async function writeSnapshot(rootDir) {
|
|
111
111
|
const files = await collectLocalFiles(rootDir);
|
|
@@ -120,20 +120,27 @@ async function writeSnapshotFromFiles(rootDir, files) {
|
|
|
120
120
|
if (isDynamicGeneratedPath(filePath)) continue;
|
|
121
121
|
snapshot.files[filePath] = hashContent(content);
|
|
122
122
|
}
|
|
123
|
-
const snapshotPath =
|
|
123
|
+
const snapshotPath = resolveWorkspacePath(
|
|
124
|
+
rootDir,
|
|
125
|
+
`${PROJECT_DIR_NAME}/${SNAPSHOT_FILE}`
|
|
126
|
+
);
|
|
124
127
|
await atomicWriteFile(
|
|
125
128
|
snapshotPath,
|
|
126
129
|
`${JSON.stringify(snapshot, null, 2)}
|
|
127
130
|
`,
|
|
128
|
-
{
|
|
131
|
+
{
|
|
132
|
+
mode: 420
|
|
133
|
+
}
|
|
129
134
|
);
|
|
130
135
|
}
|
|
131
136
|
function isIgnorableLocalDiffPath(filePath) {
|
|
132
137
|
return filePath.startsWith("test/generated/") || filePath.startsWith(".playwright-cli/");
|
|
133
138
|
}
|
|
134
139
|
async function getLocalDiff(rootDir) {
|
|
135
|
-
const
|
|
136
|
-
|
|
140
|
+
const snapshot = await readWorkspaceTextFile(
|
|
141
|
+
rootDir,
|
|
142
|
+
`${PROJECT_DIR_NAME}/${SNAPSHOT_FILE}`
|
|
143
|
+
).then((text) => JSON.parse(text)).catch(() => null);
|
|
137
144
|
if (!snapshot) {
|
|
138
145
|
return { modified: [], added: [], deleted: [] };
|
|
139
146
|
}
|
|
@@ -182,4 +189,4 @@ export {
|
|
|
182
189
|
writeSnapshotFromFiles,
|
|
183
190
|
getLocalDiff
|
|
184
191
|
};
|
|
185
|
-
//# sourceMappingURL=chunk-
|
|
192
|
+
//# sourceMappingURL=chunk-LKQ557TJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/project/local-files.ts"],"sourcesContent":["import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { GameTopologyManifest } from \"@dreamboard-games/sdk/types\";\nimport {\n PROJECT_DIR_NAME,\n MANIFEST_FILE,\n RULE_FILE,\n SNAPSHOT_FILE,\n LOCAL_IGNORE_DIRS,\n} from \"../../constants.js\";\nimport type { Snapshot } from \"../../types.js\";\nimport { atomicWriteFile } from \"../../utils/atomic-file.js\";\nimport { hashContent } from \"../../utils/crypto.js\";\nimport {\n computeManifestHash,\n materializeManifest,\n writeManifestSource,\n} from \"./manifest-authoring.js\";\nimport {\n isAllowedGamePath as isAllowedPathFromOwnership,\n isDynamicGeneratedPath,\n isLibraryPath as isLibraryPathFromOwnership,\n} from \"./scaffold-ownership.js\";\nimport {\n readWorkspaceTextFile,\n readWorkspaceTextFileIfExists,\n resolveWorkspacePath,\n unlinkWorkspaceFile,\n writeWorkspaceTextFile,\n} from \"./workspace-path.js\";\n\n/**\n * Returns true when a path is inside the canonical game project structure.\n * Anything outside app/, ui/, shared/, or the known root files is rejected.\n */\nexport function isAllowedGamePath(filePath: string): boolean {\n return isAllowedPathFromOwnership(filePath);\n}\n\nexport function isLibraryPath(filePath: string): boolean {\n return isLibraryPathFromOwnership(filePath);\n}\n\ntype WriteDecision = \"write\" | \"skip\";\n\n/**\n * Decide whether a file from the scaffold response should be written to disk.\n *\n * - Library files → always overwrite (they are fully generated).\n * - Everything else → only write if the file does not yet exist or is empty\n * locally (first-time seeding; preserves user edits).\n */\nfunction shouldWriteScaffoldFile(\n filePath: string,\n existingContent: string | null,\n): WriteDecision {\n if (isLibraryPath(filePath)) return \"write\";\n const hasContent =\n existingContent !== null && existingContent.trim().length > 0;\n return hasContent ? \"skip\" : \"write\";\n}\n\nexport async function writeSourceFiles(\n rootDir: string,\n files: Record<string, string | null>,\n): Promise<void> {\n for (const [relativePath, content] of Object.entries(files)) {\n if (content === null || content === undefined) continue;\n await writeWorkspaceTextFile(rootDir, relativePath, content);\n }\n}\n\nexport interface ScaffoldWriteResult {\n written: string[];\n skipped: string[];\n}\n\n/**\n * Write scaffold files using local-merge logic.\n *\n * - Library files are always overwritten.\n * - User-owned files (phases, components, etc.) are only written when the\n * local file does not exist or is empty. Files with content are skipped\n * so user edits are never lost.\n *\n * Returns lists of files that were written (and actually changed) and files\n * that were skipped because a non-empty local copy already exists.\n */\nexport async function writeScaffoldFiles(\n rootDir: string,\n files: Record<string, string | null>,\n): Promise<ScaffoldWriteResult> {\n const written: string[] = [];\n const skipped: string[] = [];\n\n for (const [relativePath, content] of Object.entries(files)) {\n if (content === null || content === undefined) continue;\n\n const existingContent = await readWorkspaceTextFileIfExists(\n rootDir,\n relativePath,\n );\n\n const decision = shouldWriteScaffoldFile(relativePath, existingContent);\n\n if (decision === \"skip\") {\n skipped.push(relativePath);\n continue;\n }\n\n await writeWorkspaceTextFile(rootDir, relativePath, content);\n\n if (existingContent !== content) {\n written.push(relativePath);\n }\n }\n\n written.sort();\n skipped.sort();\n return { written, skipped };\n}\n\nexport async function removeExtraneousFiles(\n rootDir: string,\n keep: Set<string>,\n): Promise<void> {\n const localFiles = await collectLocalFiles(rootDir);\n for (const filePath of Object.keys(localFiles)) {\n if (filePath === MANIFEST_FILE || filePath === RULE_FILE) continue;\n if (!keep.has(filePath)) {\n await unlinkWorkspaceFile(rootDir, filePath);\n }\n }\n}\n\nexport async function collectLocalFiles(\n rootDir: string,\n): Promise<Record<string, string>> {\n const result: Record<string, string> = {};\n await walkDir(rootDir, rootDir, result);\n return result;\n}\n\nexport async function walkDir(\n rootDir: string,\n currentDir: string,\n result: Record<string, string>,\n): Promise<void> {\n const entries = await readdir(currentDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isDirectory()) {\n if (LOCAL_IGNORE_DIRS.has(entry.name)) continue;\n await walkDir(rootDir, path.join(currentDir, entry.name), result);\n } else if (entry.isFile()) {\n const filePath = path.join(currentDir, entry.name);\n const relativePath = path.relative(rootDir, filePath);\n result[relativePath] = await readWorkspaceTextFile(rootDir, relativePath);\n }\n }\n}\n\nexport async function writeManifest(\n rootDir: string,\n manifest: GameTopologyManifest,\n): Promise<void> {\n await writeManifestSource(rootDir, manifest);\n}\n\nexport async function writeRule(\n rootDir: string,\n ruleText: string,\n): Promise<void> {\n await writeWorkspaceTextFile(rootDir, RULE_FILE, ruleText);\n}\n\nexport async function loadManifest(\n rootDir: string,\n): Promise<GameTopologyManifest> {\n return materializeManifest(rootDir);\n}\n\nexport { computeManifestHash };\n\nexport async function loadRule(rootDir: string): Promise<string> {\n return readWorkspaceTextFile(rootDir, RULE_FILE);\n}\n\nexport async function writeSnapshot(rootDir: string): Promise<void> {\n const files = await collectLocalFiles(rootDir);\n await writeSnapshotFromFiles(rootDir, files);\n}\n\nexport async function writeSnapshotFromFiles(\n rootDir: string,\n files: Record<string, string>,\n): Promise<void> {\n const snapshot: Snapshot = {\n files: {},\n };\n\n for (const [filePath, content] of Object.entries(files)) {\n if (filePath.startsWith(`${PROJECT_DIR_NAME}/`)) continue;\n if (isDynamicGeneratedPath(filePath)) continue;\n snapshot.files[filePath] = hashContent(content);\n }\n\n // Atomic write: a crash mid-snapshot (e.g. user kills a long `dreamboard\n // sync`) must not leave `.dreamboard/snapshot.json` truncated, or\n // `getLocalDiff` will silently report everything as \"added\" on the\n // next run and force a full re-sync.\n const snapshotPath = resolveWorkspacePath(\n rootDir,\n `${PROJECT_DIR_NAME}/${SNAPSHOT_FILE}`,\n );\n await atomicWriteFile(\n snapshotPath,\n `${JSON.stringify(snapshot, null, 2)}\\n`,\n {\n mode: 0o644,\n },\n );\n}\n\nfunction isIgnorableLocalDiffPath(filePath: string): boolean {\n return (\n filePath.startsWith(\"test/generated/\") ||\n filePath.startsWith(\".playwright-cli/\")\n );\n}\n\nexport async function getLocalDiff(rootDir: string): Promise<{\n modified: string[];\n added: string[];\n deleted: string[];\n}> {\n const snapshot = await readWorkspaceTextFile(\n rootDir,\n `${PROJECT_DIR_NAME}/${SNAPSHOT_FILE}`,\n )\n .then((text) => JSON.parse(text) as Snapshot)\n .catch(() => null);\n if (!snapshot) {\n return { modified: [], added: [], deleted: [] };\n }\n\n const files = await collectLocalFiles(rootDir);\n const currentHashes: Record<string, string> = {};\n\n for (const [filePath, content] of Object.entries(files)) {\n if (filePath.startsWith(`${PROJECT_DIR_NAME}/`)) continue;\n if (isIgnorableLocalDiffPath(filePath)) continue;\n if (isDynamicGeneratedPath(filePath)) continue;\n currentHashes[filePath] = hashContent(content);\n }\n\n const modified: string[] = [];\n const added: string[] = [];\n const deleted: string[] = [];\n\n for (const [filePath, hash] of Object.entries(currentHashes)) {\n const prevHash = snapshot.files[filePath];\n if (!prevHash) {\n added.push(filePath);\n } else if (prevHash !== hash) {\n modified.push(filePath);\n }\n }\n\n for (const filePath of Object.keys(snapshot.files)) {\n if (isIgnorableLocalDiffPath(filePath)) continue;\n if (isDynamicGeneratedPath(filePath)) continue;\n if (!currentHashes[filePath]) {\n deleted.push(filePath);\n }\n }\n\n return { modified, added, deleted };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,OAAO,UAAU;AAkCV,SAASA,mBAAkB,UAA2B;AAC3D,SAAO,kBAA2B,QAAQ;AAC5C;AAEO,SAASC,eAAc,UAA2B;AACvD,SAAO,cAA2B,QAAQ;AAC5C;AAWA,SAAS,wBACP,UACA,iBACe;AACf,MAAIA,eAAc,QAAQ,EAAG,QAAO;AACpC,QAAM,aACJ,oBAAoB,QAAQ,gBAAgB,KAAK,EAAE,SAAS;AAC9D,SAAO,aAAa,SAAS;AAC/B;AAEA,eAAsB,iBACpB,SACA,OACe;AACf,aAAW,CAAC,cAAc,OAAO,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC3D,QAAI,YAAY,QAAQ,YAAY,OAAW;AAC/C,UAAM,uBAAuB,SAAS,cAAc,OAAO;AAAA,EAC7D;AACF;AAkBA,eAAsB,mBACpB,SACA,OAC8B;AAC9B,QAAM,UAAoB,CAAC;AAC3B,QAAM,UAAoB,CAAC;AAE3B,aAAW,CAAC,cAAc,OAAO,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC3D,QAAI,YAAY,QAAQ,YAAY,OAAW;AAE/C,UAAM,kBAAkB,MAAM;AAAA,MAC5B;AAAA,MACA;AAAA,IACF;AAEA,UAAM,WAAW,wBAAwB,cAAc,eAAe;AAEtE,QAAI,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AG;AACvD,QAAI,SAAS,WAAW,GAAG,gBAAgB,GAAG,EAAG;AACjD,QAAI,yBAAyB,QAAQ,EAAG;AACxC,QAAI,uBAAuB,QAAQ,EAAG;AACtC,kBAAc,QAAQ,IAAI,YAAY,OAAO;AAAA,EAC/C;AAEA,QAAM,WAAqB,CAAC;AAC5B,QAAM,QAAkB,CAAC;AACzB,QAAM,UAAoB,CAAC;AAE3B,aAAW,CAAC,UAAU,IAAI,KAAK,OAAO,QAAQ,aAAa,GAAG;AAC5D,UAAM,WAAW,SAAS,MAAM,QAAQ;AACxC,QAAI,CAAC,UAAU;AACb,YAAM,KAAK,QAAQ;AAAA,IACrB,WAAW,aAAa,MAAM;AAC5B,eAAS,KAAK,QAAQ;AAAA,IACxB;AAAA,EACF;AAEA,aAAW,YAAY,OAAO,KAAK,SAAS,KAAK,GAAG;AAClD,QAAI,yBAAyB,QAAQ,EAAG;AACxC,QAAI,uBAAuB,QAAQ,EAAG;AACtC,QAAI,CAAC,cAAc,QAAQ,GAAG;AAC5B,cAAQ,KAAK,QAAQ;AAAA,IACvB;AAAA,EACF;AAEA,SAAO,EAAE,UAAU,OAAO,QAAQ;AACpC;","names":["isAllowedGamePath","isLibraryPath"]}
|
|
@@ -63,8 +63,7 @@ var createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer,
|
|
|
63
63
|
if (done)
|
|
64
64
|
break;
|
|
65
65
|
buffer += value;
|
|
66
|
-
|
|
67
|
-
const chunks = buffer.split("\n\n");
|
|
66
|
+
const chunks = buffer.split("\r\n");
|
|
68
67
|
buffer = chunks.pop() ?? "";
|
|
69
68
|
for (const chunk of chunks) {
|
|
70
69
|
const lines = chunk.split("\n");
|
|
@@ -109,7 +108,7 @@ var createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer,
|
|
|
109
108
|
id: lastEventId,
|
|
110
109
|
retry: retryDelay
|
|
111
110
|
});
|
|
112
|
-
if (dataLines.length
|
|
111
|
+
if (dataLines.length) {
|
|
113
112
|
yield data;
|
|
114
113
|
}
|
|
115
114
|
}
|
|
@@ -122,7 +121,7 @@ var createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer,
|
|
|
122
121
|
} catch (error) {
|
|
123
122
|
onSseError?.(error);
|
|
124
123
|
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
125
|
-
|
|
124
|
+
break;
|
|
126
125
|
}
|
|
127
126
|
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
128
127
|
await sleep(backoff);
|
|
@@ -764,4 +763,4 @@ var client = createClient(createConfig({ baseUrl: "https://dreamboard.games" }))
|
|
|
764
763
|
export {
|
|
765
764
|
client
|
|
766
765
|
};
|
|
767
|
-
//# sourceMappingURL=chunk-
|
|
766
|
+
//# sourceMappingURL=chunk-MYMVXTZT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../packages/api-client/dist/core/bodySerializer.gen.js","../../../../packages/api-client/dist/core/params.gen.js","../../../../packages/api-client/dist/core/serverSentEvents.gen.js","../../../../packages/api-client/dist/core/pathSerializer.gen.js","../../../../packages/api-client/dist/core/utils.gen.js","../../../../packages/api-client/dist/core/auth.gen.js","../../../../packages/api-client/dist/client/utils.gen.js","../../../../packages/api-client/dist/client/client.gen.js","../../../../packages/api-client/dist/client.gen.js"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\nconst serializeFormDataPair = (data, key, value) => {\n if (typeof value === 'string' || value instanceof Blob) {\n data.append(key, value);\n }\n else if (value instanceof Date) {\n data.append(key, value.toISOString());\n }\n else {\n data.append(key, JSON.stringify(value));\n }\n};\nconst serializeUrlSearchParamsPair = (data, key, value) => {\n if (typeof value === 'string') {\n data.append(key, value);\n }\n else {\n data.append(key, JSON.stringify(value));\n }\n};\nexport const formDataBodySerializer = {\n bodySerializer: (body) => {\n const data = new FormData();\n Object.entries(body).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeFormDataPair(data, key, v));\n }\n else {\n serializeFormDataPair(data, key, value);\n }\n });\n return data;\n },\n};\nexport const jsonBodySerializer = {\n bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === 'bigint' ? value.toString() : value),\n};\nexport const urlSearchParamsBodySerializer = {\n bodySerializer: (body) => {\n const data = new URLSearchParams();\n Object.entries(body).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));\n }\n else {\n serializeUrlSearchParamsPair(data, key, value);\n }\n });\n return data.toString();\n },\n};\n","// This file is auto-generated by @hey-api/openapi-ts\nconst extraPrefixesMap = {\n $body_: 'body',\n $headers_: 'headers',\n $path_: 'path',\n $query_: 'query',\n};\nconst extraPrefixes = Object.entries(extraPrefixesMap);\nconst buildKeyMap = (fields, map) => {\n if (!map) {\n map = new Map();\n }\n for (const config of fields) {\n if ('in' in config) {\n if (config.key) {\n map.set(config.key, {\n in: config.in,\n map: config.map,\n });\n }\n }\n else if ('key' in config) {\n map.set(config.key, {\n map: config.map,\n });\n }\n else if (config.args) {\n buildKeyMap(config.args, map);\n }\n }\n return map;\n};\nconst stripEmptySlots = (params) => {\n for (const [slot, value] of Object.entries(params)) {\n if (value && typeof value === 'object' && !Object.keys(value).length) {\n delete params[slot];\n }\n }\n};\nexport const buildClientParams = (args, fields) => {\n const params = {\n body: {},\n headers: {},\n path: {},\n query: {},\n };\n const map = buildKeyMap(fields);\n let config;\n for (const [index, arg] of args.entries()) {\n if (fields[index]) {\n config = fields[index];\n }\n if (!config) {\n continue;\n }\n if ('in' in config) {\n if (config.key) {\n const field = map.get(config.key);\n const name = field.map || config.key;\n if (field.in) {\n params[field.in][name] = arg;\n }\n }\n else {\n params.body = arg;\n }\n }\n else {\n for (const [key, value] of Object.entries(arg ?? {})) {\n const field = map.get(key);\n if (field) {\n if (field.in) {\n const name = field.map || key;\n params[field.in][name] = value;\n }\n else {\n params[field.map] = value;\n }\n }\n else {\n const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));\n if (extra) {\n const [prefix, slot] = extra;\n params[slot][key.slice(prefix.length)] = value;\n }\n else if ('allowExtra' in config && config.allowExtra) {\n for (const [slot, allowed] of Object.entries(config.allowExtra)) {\n if (allowed) {\n params[slot][key] = value;\n break;\n }\n }\n }\n }\n }\n }\n }\n stripEmptySlots(params);\n return params;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\nexport const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {\n let lastEventId;\n const sleep = sseSleepFn ??\n ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));\n const createStream = async function* () {\n let retryDelay = sseDefaultRetryDelay ?? 3000;\n let attempt = 0;\n const signal = options.signal ?? new AbortController().signal;\n while (true) {\n if (signal.aborted)\n break;\n attempt++;\n const headers = options.headers instanceof Headers\n ? options.headers\n : new Headers(options.headers);\n if (lastEventId !== undefined) {\n headers.set(\"Last-Event-ID\", lastEventId);\n }\n try {\n const requestInit = {\n redirect: \"follow\",\n ...options,\n body: options.serializedBody,\n headers,\n signal,\n };\n let request = new Request(url, requestInit);\n if (onRequest) {\n request = await onRequest(url, requestInit);\n }\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = options.fetch ?? globalThis.fetch;\n const response = await _fetch(request);\n if (!response.ok)\n throw new Error(`SSE failed: ${response.status} ${response.statusText}`);\n if (!response.body)\n throw new Error(\"No body in SSE response\");\n const reader = response.body\n .pipeThrough(new TextDecoderStream())\n .getReader();\n let buffer = \"\";\n const abortHandler = () => {\n try {\n reader.cancel();\n }\n catch {\n // noop\n }\n };\n signal.addEventListener(\"abort\", abortHandler);\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done)\n break;\n buffer += value;\n const chunks = buffer.split(\"\\r\\n\");\n buffer = chunks.pop() ?? \"\";\n for (const chunk of chunks) {\n const lines = chunk.split(\"\\n\");\n const dataLines = [];\n let eventName;\n for (const line of lines) {\n if (line.startsWith(\"data:\")) {\n dataLines.push(line.replace(/^data:\\s*/, \"\"));\n }\n else if (line.startsWith(\"event:\")) {\n eventName = line.replace(/^event:\\s*/, \"\");\n }\n else if (line.startsWith(\"id:\")) {\n lastEventId = line.replace(/^id:\\s*/, \"\");\n }\n else if (line.startsWith(\"retry:\")) {\n const parsed = Number.parseInt(line.replace(/^retry:\\s*/, \"\"), 10);\n if (!Number.isNaN(parsed)) {\n retryDelay = parsed;\n }\n }\n }\n let data;\n let parsedJson = false;\n if (dataLines.length) {\n const rawData = dataLines.join(\"\\n\");\n try {\n data = JSON.parse(rawData);\n parsedJson = true;\n }\n catch {\n data = rawData;\n }\n }\n if (parsedJson) {\n if (responseValidator) {\n await responseValidator(data);\n }\n if (responseTransformer) {\n data = await responseTransformer(data);\n }\n }\n onSseEvent?.({\n data,\n event: eventName,\n id: lastEventId,\n retry: retryDelay,\n });\n if (dataLines.length) {\n yield data;\n }\n }\n }\n }\n finally {\n signal.removeEventListener(\"abort\", abortHandler);\n reader.releaseLock();\n }\n break; // exit loop on normal completion\n }\n catch (error) {\n // connection failed or aborted; retry after delay\n onSseError?.(error);\n if (sseMaxRetryAttempts !== undefined &&\n attempt >= sseMaxRetryAttempts) {\n break; // stop after firing error\n }\n // exponential backoff: double retry each attempt, cap at 30s\n const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);\n await sleep(backoff);\n }\n }\n };\n const stream = createStream();\n return { stream };\n};\n","// This file is auto-generated by @hey-api/openapi-ts\nexport const separatorArrayExplode = (style) => {\n switch (style) {\n case 'label':\n return '.';\n case 'matrix':\n return ';';\n case 'simple':\n return ',';\n default:\n return '&';\n }\n};\nexport const separatorArrayNoExplode = (style) => {\n switch (style) {\n case 'form':\n return ',';\n case 'pipeDelimited':\n return '|';\n case 'spaceDelimited':\n return '%20';\n default:\n return ',';\n }\n};\nexport const separatorObjectExplode = (style) => {\n switch (style) {\n case 'label':\n return '.';\n case 'matrix':\n return ';';\n case 'simple':\n return ',';\n default:\n return '&';\n }\n};\nexport const serializeArrayParam = ({ allowReserved, explode, name, style, value, }) => {\n if (!explode) {\n const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));\n switch (style) {\n case 'label':\n return `.${joinedValues}`;\n case 'matrix':\n return `;${name}=${joinedValues}`;\n case 'simple':\n return joinedValues;\n default:\n return `${name}=${joinedValues}`;\n }\n }\n const separator = separatorArrayExplode(style);\n const joinedValues = value\n .map((v) => {\n if (style === 'label' || style === 'simple') {\n return allowReserved ? v : encodeURIComponent(v);\n }\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v,\n });\n })\n .join(separator);\n return style === 'label' || style === 'matrix'\n ? separator + joinedValues\n : joinedValues;\n};\nexport const serializePrimitiveParam = ({ allowReserved, name, value, }) => {\n if (value === undefined || value === null) {\n return '';\n }\n if (typeof value === 'object') {\n throw new Error('Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.');\n }\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;\n};\nexport const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly, }) => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;\n }\n if (style !== 'deepObject' && !explode) {\n let values = [];\n Object.entries(value).forEach(([key, v]) => {\n values = [\n ...values,\n key,\n allowReserved ? v : encodeURIComponent(v),\n ];\n });\n const joinedValues = values.join(',');\n switch (style) {\n case 'form':\n return `${name}=${joinedValues}`;\n case 'label':\n return `.${joinedValues}`;\n case 'matrix':\n return `;${name}=${joinedValues}`;\n default:\n return joinedValues;\n }\n }\n const separator = separatorObjectExplode(style);\n const joinedValues = Object.entries(value)\n .map(([key, v]) => serializePrimitiveParam({\n allowReserved,\n name: style === 'deepObject' ? `${name}[${key}]` : key,\n value: v,\n }))\n .join(separator);\n return style === 'label' || style === 'matrix'\n ? separator + joinedValues\n : joinedValues;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\nimport { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from './pathSerializer.gen.js';\nexport const PATH_PARAM_RE = /\\{[^{}]+\\}/g;\nexport const defaultPathSerializer = ({ path, url: _url }) => {\n let url = _url;\n const matches = _url.match(PATH_PARAM_RE);\n if (matches) {\n for (const match of matches) {\n let explode = false;\n let name = match.substring(1, match.length - 1);\n let style = 'simple';\n if (name.endsWith('*')) {\n explode = true;\n name = name.substring(0, name.length - 1);\n }\n if (name.startsWith('.')) {\n name = name.substring(1);\n style = 'label';\n }\n else if (name.startsWith(';')) {\n name = name.substring(1);\n style = 'matrix';\n }\n const value = path[name];\n if (value === undefined || value === null) {\n continue;\n }\n if (Array.isArray(value)) {\n url = url.replace(match, serializeArrayParam({ explode, name, style, value }));\n continue;\n }\n if (typeof value === 'object') {\n url = url.replace(match, serializeObjectParam({\n explode,\n name,\n style,\n value: value,\n valueOnly: true,\n }));\n continue;\n }\n if (style === 'matrix') {\n url = url.replace(match, `;${serializePrimitiveParam({\n name,\n value: value,\n })}`);\n continue;\n }\n const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);\n url = url.replace(match, replaceValue);\n }\n }\n return url;\n};\nexport const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {\n const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;\n let url = (baseUrl ?? '') + pathUrl;\n if (path) {\n url = defaultPathSerializer({ path, url });\n }\n let search = query ? querySerializer(query) : '';\n if (search.startsWith('?')) {\n search = search.substring(1);\n }\n if (search) {\n url += `?${search}`;\n }\n return url;\n};\nexport function getValidRequestBody(options) {\n const hasBody = options.body !== undefined;\n const isSerializedBody = hasBody && options.bodySerializer;\n if (isSerializedBody) {\n if ('serializedBody' in options) {\n const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== '';\n return hasSerializedBody ? options.serializedBody : null;\n }\n // not all clients implement a serializedBody property (i.e. client-axios)\n return options.body !== '' ? options.body : null;\n }\n // plain/text body\n if (hasBody) {\n return options.body;\n }\n // no body was provided\n return undefined;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\nexport const getAuthToken = async (auth, callback) => {\n const token = typeof callback === 'function' ? await callback(auth) : callback;\n if (!token) {\n return;\n }\n if (auth.scheme === 'bearer') {\n return `Bearer ${token}`;\n }\n if (auth.scheme === 'basic') {\n return `Basic ${btoa(token)}`;\n }\n return token;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\nimport { getAuthToken } from '../core/auth.gen.js';\nimport { jsonBodySerializer } from '../core/bodySerializer.gen.js';\nimport { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from '../core/pathSerializer.gen.js';\nimport { getUrl } from '../core/utils.gen.js';\nexport const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {\n const querySerializer = (queryParams) => {\n const search = [];\n if (queryParams && typeof queryParams === 'object') {\n for (const name in queryParams) {\n const value = queryParams[name];\n if (value === undefined || value === null) {\n continue;\n }\n const options = parameters[name] || args;\n if (Array.isArray(value)) {\n const serializedArray = serializeArrayParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: 'form',\n value,\n ...options.array,\n });\n if (serializedArray)\n search.push(serializedArray);\n }\n else if (typeof value === 'object') {\n const serializedObject = serializeObjectParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: 'deepObject',\n value: value,\n ...options.object,\n });\n if (serializedObject)\n search.push(serializedObject);\n }\n else {\n const serializedPrimitive = serializePrimitiveParam({\n allowReserved: options.allowReserved,\n name,\n value: value,\n });\n if (serializedPrimitive)\n search.push(serializedPrimitive);\n }\n }\n }\n return search.join('&');\n };\n return querySerializer;\n};\n/**\n * Infers parseAs value from provided Content-Type header.\n */\nexport const getParseAs = (contentType) => {\n if (!contentType) {\n // If no Content-Type header is provided, the best we can do is return the raw response body,\n // which is effectively the same as the 'stream' option.\n return 'stream';\n }\n const cleanContent = contentType.split(';')[0]?.trim();\n if (!cleanContent) {\n return;\n }\n if (cleanContent.startsWith('application/json') ||\n cleanContent.endsWith('+json')) {\n return 'json';\n }\n if (cleanContent === 'multipart/form-data') {\n return 'formData';\n }\n if (['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type))) {\n return 'blob';\n }\n if (cleanContent.startsWith('text/')) {\n return 'text';\n }\n return;\n};\nconst checkForExistence = (options, name) => {\n if (!name) {\n return false;\n }\n if (options.headers.has(name) ||\n options.query?.[name] ||\n options.headers.get('Cookie')?.includes(`${name}=`)) {\n return true;\n }\n return false;\n};\nexport const setAuthParams = async ({ security, ...options }) => {\n for (const auth of security) {\n if (checkForExistence(options, auth.name)) {\n continue;\n }\n const token = await getAuthToken(auth, options.auth);\n if (!token) {\n continue;\n }\n const name = auth.name ?? 'Authorization';\n switch (auth.in) {\n case 'query':\n if (!options.query) {\n options.query = {};\n }\n options.query[name] = token;\n break;\n case 'cookie':\n options.headers.append('Cookie', `${name}=${token}`);\n break;\n case 'header':\n default:\n options.headers.set(name, token);\n break;\n }\n }\n};\nexport const buildUrl = (options) => getUrl({\n baseUrl: options.baseUrl,\n path: options.path,\n query: options.query,\n querySerializer: typeof options.querySerializer === 'function'\n ? options.querySerializer\n : createQuerySerializer(options.querySerializer),\n url: options.url,\n});\nexport const mergeConfigs = (a, b) => {\n const config = { ...a, ...b };\n if (config.baseUrl?.endsWith('/')) {\n config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);\n }\n config.headers = mergeHeaders(a.headers, b.headers);\n return config;\n};\nconst headersEntries = (headers) => {\n const entries = [];\n headers.forEach((value, key) => {\n entries.push([key, value]);\n });\n return entries;\n};\nexport const mergeHeaders = (...headers) => {\n const mergedHeaders = new Headers();\n for (const header of headers) {\n if (!header) {\n continue;\n }\n const iterator = header instanceof Headers\n ? headersEntries(header)\n : Object.entries(header);\n for (const [key, value] of iterator) {\n if (value === null) {\n mergedHeaders.delete(key);\n }\n else if (Array.isArray(value)) {\n for (const v of value) {\n mergedHeaders.append(key, v);\n }\n }\n else if (value !== undefined) {\n // assume object headers are meant to be JSON stringified, i.e. their\n // content value in OpenAPI specification is 'application/json'\n mergedHeaders.set(key, typeof value === 'object' ? JSON.stringify(value) : value);\n }\n }\n }\n return mergedHeaders;\n};\nclass Interceptors {\n constructor() {\n this.fns = [];\n }\n clear() {\n this.fns = [];\n }\n eject(id) {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = null;\n }\n }\n exists(id) {\n const index = this.getInterceptorIndex(id);\n return Boolean(this.fns[index]);\n }\n getInterceptorIndex(id) {\n if (typeof id === 'number') {\n return this.fns[id] ? id : -1;\n }\n return this.fns.indexOf(id);\n }\n update(id, fn) {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = fn;\n return id;\n }\n return false;\n }\n use(fn) {\n this.fns.push(fn);\n return this.fns.length - 1;\n }\n}\nexport const createInterceptors = () => ({\n error: new Interceptors(),\n request: new Interceptors(),\n response: new Interceptors(),\n});\nconst defaultQuerySerializer = createQuerySerializer({\n allowReserved: false,\n array: {\n explode: true,\n style: 'form',\n },\n object: {\n explode: true,\n style: 'deepObject',\n },\n});\nconst defaultHeaders = {\n 'Content-Type': 'application/json',\n};\nexport const createConfig = (override = {}) => ({\n ...jsonBodySerializer,\n headers: defaultHeaders,\n parseAs: 'auto',\n querySerializer: defaultQuerySerializer,\n ...override,\n});\n","// This file is auto-generated by @hey-api/openapi-ts\nimport { createSseClient } from '../core/serverSentEvents.gen.js';\nimport { getValidRequestBody } from '../core/utils.gen.js';\nimport { buildUrl, createConfig, createInterceptors, getParseAs, mergeConfigs, mergeHeaders, setAuthParams, } from './utils.gen.js';\nexport const createClient = (config = {}) => {\n let _config = mergeConfigs(createConfig(), config);\n const getConfig = () => ({ ..._config });\n const setConfig = (config) => {\n _config = mergeConfigs(_config, config);\n return getConfig();\n };\n const interceptors = createInterceptors();\n const beforeRequest = async (options) => {\n const opts = {\n ..._config,\n ...options,\n fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,\n headers: mergeHeaders(_config.headers, options.headers),\n serializedBody: undefined,\n };\n if (opts.security) {\n await setAuthParams({\n ...opts,\n security: opts.security,\n });\n }\n if (opts.requestValidator) {\n await opts.requestValidator(opts);\n }\n if (opts.body !== undefined && opts.bodySerializer) {\n opts.serializedBody = opts.bodySerializer(opts.body);\n }\n // remove Content-Type header if body is empty to avoid sending invalid requests\n if (opts.body === undefined || opts.serializedBody === '') {\n opts.headers.delete('Content-Type');\n }\n const url = buildUrl(opts);\n return { opts, url };\n };\n const request = async (options) => {\n // @ts-expect-error\n const { opts, url } = await beforeRequest(options);\n const requestInit = {\n redirect: 'follow',\n ...opts,\n body: getValidRequestBody(opts),\n };\n let request = new Request(url, requestInit);\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = opts.fetch;\n let response;\n try {\n response = await _fetch(request);\n }\n catch (error) {\n // Handle fetch exceptions (AbortError, network errors, etc.)\n let finalError = error;\n for (const fn of interceptors.error.fns) {\n if (fn) {\n finalError = (await fn(error, undefined, request, opts));\n }\n }\n finalError = finalError || {};\n if (opts.throwOnError) {\n throw finalError;\n }\n // Return error response\n return opts.responseStyle === 'data'\n ? undefined\n : {\n error: finalError,\n request,\n response: undefined,\n };\n }\n for (const fn of interceptors.response.fns) {\n if (fn) {\n response = await fn(response, request, opts);\n }\n }\n const result = {\n request,\n response,\n };\n if (response.ok) {\n const parseAs = (opts.parseAs === 'auto'\n ? getParseAs(response.headers.get('Content-Type'))\n : opts.parseAs) ?? 'json';\n if (response.status === 204 ||\n response.headers.get('Content-Length') === '0') {\n let emptyData;\n switch (parseAs) {\n case 'arrayBuffer':\n case 'blob':\n case 'text':\n emptyData = await response[parseAs]();\n break;\n case 'formData':\n emptyData = new FormData();\n break;\n case 'stream':\n emptyData = response.body;\n break;\n case 'json':\n default:\n emptyData = {};\n break;\n }\n return opts.responseStyle === 'data'\n ? emptyData\n : {\n data: emptyData,\n ...result,\n };\n }\n let data;\n switch (parseAs) {\n case 'arrayBuffer':\n case 'blob':\n case 'formData':\n case 'text':\n data = await response[parseAs]();\n break;\n case 'json': {\n // Some servers return 200 with no Content-Length and empty body.\n // response.json() would throw; read as text and parse if non-empty.\n const text = await response.text();\n data = text ? JSON.parse(text) : {};\n break;\n }\n case 'stream':\n return opts.responseStyle === 'data'\n ? response.body\n : {\n data: response.body,\n ...result,\n };\n }\n if (parseAs === 'json') {\n if (opts.responseValidator) {\n await opts.responseValidator(data);\n }\n if (opts.responseTransformer) {\n data = await opts.responseTransformer(data);\n }\n }\n return opts.responseStyle === 'data'\n ? data\n : {\n data,\n ...result,\n };\n }\n const textError = await response.text();\n let jsonError;\n try {\n jsonError = JSON.parse(textError);\n }\n catch {\n // noop\n }\n const error = jsonError ?? textError;\n let finalError = error;\n for (const fn of interceptors.error.fns) {\n if (fn) {\n finalError = (await fn(error, response, request, opts));\n }\n }\n finalError = finalError || {};\n if (opts.throwOnError) {\n throw finalError;\n }\n // TODO: we probably want to return error and improve types\n return opts.responseStyle === 'data'\n ? undefined\n : {\n error: finalError,\n ...result,\n };\n };\n const makeMethodFn = (method) => (options) => request({ ...options, method });\n const makeSseFn = (method) => async (options) => {\n const { opts, url } = await beforeRequest(options);\n return createSseClient({\n ...opts,\n body: opts.body,\n headers: opts.headers,\n method,\n onRequest: async (url, init) => {\n let request = new Request(url, init);\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n return request;\n },\n serializedBody: getValidRequestBody(opts),\n url,\n });\n };\n return {\n buildUrl,\n connect: makeMethodFn('CONNECT'),\n delete: makeMethodFn('DELETE'),\n get: makeMethodFn('GET'),\n getConfig,\n head: makeMethodFn('HEAD'),\n interceptors,\n options: makeMethodFn('OPTIONS'),\n patch: makeMethodFn('PATCH'),\n post: makeMethodFn('POST'),\n put: makeMethodFn('PUT'),\n request,\n setConfig,\n sse: {\n connect: makeSseFn('CONNECT'),\n delete: makeSseFn('DELETE'),\n get: makeSseFn('GET'),\n head: makeSseFn('HEAD'),\n options: makeSseFn('OPTIONS'),\n patch: makeSseFn('PATCH'),\n post: makeSseFn('POST'),\n put: makeSseFn('PUT'),\n trace: makeSseFn('TRACE'),\n },\n trace: makeMethodFn('TRACE'),\n };\n};\n","// This file is auto-generated by @hey-api/openapi-ts\nimport { createClient, createConfig } from './client/index.js';\nexport const client = createClient(createConfig({ baseUrl: 'https://dreamboard.games' }));\n"],"mappings":";;;AAqCO,IAAM,qBAAqB;AAAA,EAC9B,gBAAgB,CAAC,SAAS,KAAK,UAAU,MAAM,CAAC,MAAM,UAAU,OAAO,UAAU,WAAW,MAAM,SAAS,IAAI,KAAK;AACxH;;;ACtCA,IAAM,mBAAmB;AAAA,EACrB,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AACb;AACA,IAAM,gBAAgB,OAAO,QAAQ,gBAAgB;;;ACN9C,IAAM,kBAAkB,CAAC,EAAE,WAAW,YAAY,YAAY,qBAAqB,mBAAmB,sBAAsB,qBAAqB,kBAAkB,YAAY,KAAK,GAAG,QAAQ,MAAM;AACxM,MAAI;AACJ,QAAM,QAAQ,eACT,CAAC,OAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAC7D,QAAM,eAAe,mBAAmB;AACpC,QAAI,aAAa,wBAAwB;AACzC,QAAI,UAAU;AACd,UAAM,SAAS,QAAQ,UAAU,IAAI,gBAAgB,EAAE;AACvD,WAAO,MAAM;AACT,UAAI,OAAO;AACP;AACJ;AACA,YAAM,UAAU,QAAQ,mBAAmB,UACrC,QAAQ,UACR,IAAI,QAAQ,QAAQ,OAAO;AACjC,UAAI,gBAAg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