@dcl/sdk-commands 7.28.0 → 7.28.1-34624845556.commit-7d0808b
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/commands/sdk-server-logs/index.d.ts +24 -0
- package/dist/commands/sdk-server-logs/index.js +313 -0
- package/dist/commands/sdk-server-logs/index.js.map +1 -0
- package/dist/commands/start/index.js +19 -1
- package/dist/commands/start/index.js.map +1 -1
- package/dist/commands/start/multiplayer-server.d.ts +25 -0
- package/dist/commands/start/multiplayer-server.js +227 -0
- package/dist/commands/start/multiplayer-server.js.map +1 -0
- package/dist/commands/start/server/routes.js +2 -0
- package/dist/commands/start/server/routes.js.map +1 -1
- package/dist/commands/start/server/runtime-env.d.ts +71 -0
- package/dist/commands/start/server/runtime-env.js +253 -0
- package/dist/commands/start/server/runtime-env.js.map +1 -0
- package/dist/commands/start/server/storage-service.d.ts +8 -0
- package/dist/commands/start/server/storage-service.js +156 -0
- package/dist/commands/start/server/storage-service.js.map +1 -0
- package/dist/commands/start/utils.d.ts +34 -0
- package/dist/commands/start/utils.js +104 -0
- package/dist/commands/start/utils.js.map +1 -1
- package/dist/commands/storage/env.d.ts +5 -0
- package/dist/commands/storage/env.js +86 -0
- package/dist/commands/storage/env.js.map +1 -0
- package/dist/commands/storage/index.d.ts +26 -0
- package/dist/commands/storage/index.js +142 -0
- package/dist/commands/storage/index.js.map +1 -0
- package/dist/commands/storage/player.d.ts +5 -0
- package/dist/commands/storage/player.js +143 -0
- package/dist/commands/storage/player.js.map +1 -0
- package/dist/commands/storage/scene.d.ts +5 -0
- package/dist/commands/storage/scene.js +105 -0
- package/dist/commands/storage/scene.js.map +1 -0
- package/dist/commands/storage/shared.d.ts +62 -0
- package/dist/commands/storage/shared.js +260 -0
- package/dist/commands/storage/shared.js.map +1 -0
- package/dist/commands/storage/types.d.ts +56 -0
- package/dist/commands/storage/types.js +23 -0
- package/dist/commands/storage/types.js.map +1 -0
- package/dist/components/analytics.d.ts +75 -1
- package/dist/components/analytics.js +3 -2
- package/dist/components/analytics.js.map +1 -1
- package/dist/logic/auth-chain-headers.d.ts +11 -0
- package/dist/logic/auth-chain-headers.js +25 -0
- package/dist/logic/auth-chain-headers.js.map +1 -0
- package/dist/logic/bundle.js +31 -0
- package/dist/logic/bundle.js.map +1 -1
- package/dist/logic/config.d.ts +1 -0
- package/dist/logic/config.js +7 -0
- package/dist/logic/config.js.map +1 -1
- package/dist/logic/error.d.ts +1 -1
- package/dist/logic/error.js.map +1 -1
- package/dist/logic/exec.d.ts +1 -0
- package/dist/logic/exec.js +2 -2
- package/dist/logic/exec.js.map +1 -1
- package/dist/logic/lang.js +1 -1
- package/dist/logic/scene-validations.d.ts +8 -1
- package/dist/logic/scene-validations.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startMultiplayerServer = startMultiplayerServer;
|
|
4
|
+
exports.spawnAuthServer = spawnAuthServer;
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const beautiful_logs_1 = require("../../logic/beautiful-logs");
|
|
7
|
+
const log_1 = require("../../components/log");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
const HAMMURABI_PACKAGE = '@dcl/hammurabi-server';
|
|
10
|
+
const HAMMURABI_VERSION = 'next';
|
|
11
|
+
const BEVY_PACKAGE = '@dcl-regenesislabs/bevy-headless-server';
|
|
12
|
+
// `latest` moves only when someone dispatches bevy-explorer's publish-headless
|
|
13
|
+
// workflow with dist_tag=latest — engine pushes to main land on `next` and cannot
|
|
14
|
+
// change what previews run. DCL_SERVER_PACKAGE overrides for local builds.
|
|
15
|
+
const BEVY_VERSION = 'latest';
|
|
16
|
+
// The bevy server exits with this when it can never run here (unsupported platform,
|
|
17
|
+
// missing binary, bad arguments). We fail the preview loudly instead of retrying:
|
|
18
|
+
// a silent fallback would hide broken bevy installs from the people shipping them.
|
|
19
|
+
const EXIT_UNAVAILABLE = 78;
|
|
20
|
+
const DEFAULT_ENGINE = 'bevy';
|
|
21
|
+
function selectedEngine() {
|
|
22
|
+
const requested = process.env.DCL_SERVER_ENGINE;
|
|
23
|
+
return requested === 'bevy' || requested === 'hammurabi' ? requested : DEFAULT_ENGINE;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* npx accepts a directory or tarball as well as a registry spec, so pointing
|
|
27
|
+
* DCL_SERVER_PACKAGE at a local build exercises this spawn path without publishing.
|
|
28
|
+
*/
|
|
29
|
+
function packageSpec(engine) {
|
|
30
|
+
const override = process.env.DCL_SERVER_PACKAGE;
|
|
31
|
+
if (override)
|
|
32
|
+
return override;
|
|
33
|
+
return engine === 'bevy' ? `${BEVY_PACKAGE}@${BEVY_VERSION}` : `${HAMMURABI_PACKAGE}@${HAMMURABI_VERSION}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Registers cleanup handlers on the global process object
|
|
37
|
+
* Returns a function to remove the handlers
|
|
38
|
+
*/
|
|
39
|
+
function registerProcessCleanup(cleanup) {
|
|
40
|
+
process.on('SIGTERM', cleanup);
|
|
41
|
+
process.on('SIGINT', cleanup);
|
|
42
|
+
process.on('exit', cleanup);
|
|
43
|
+
return () => {
|
|
44
|
+
process.off('SIGTERM', cleanup);
|
|
45
|
+
process.off('SIGINT', cleanup);
|
|
46
|
+
process.off('exit', cleanup);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// `2026-08-11T14:28:33.522058Z INFO scene_runner::renderer_context: ` — the
|
|
50
|
+
// timestamp/level/target prefix the bevy engine's tracing puts on every line
|
|
51
|
+
const TRACING_PREFIX = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})\.\d+Z\s+(INFO|WARN|ERROR|DEBUG|TRACE)\s+[\w:]+:\s?/;
|
|
52
|
+
const HEARTBEAT_LINE = /^\[headless\] alive:/;
|
|
53
|
+
// The engine colors its output even when piped, so lines arrive wrapped in ANSI
|
|
54
|
+
// escapes and must be stripped before the prefix regex can match.
|
|
55
|
+
// eslint-disable-next-line no-control-regex
|
|
56
|
+
const ANSI_CODES = /\u001b\[[0-9;]*m/g;
|
|
57
|
+
// Engine-internal noise in local preview: the asset pipeline hunts dot-prefixed
|
|
58
|
+
// processed gltf paths the preview server never has (repeated on every scene
|
|
59
|
+
// composition), and the headless build's expected gizmo/asset-loader startup
|
|
60
|
+
// complaints about the renderer it deliberately doesn't have
|
|
61
|
+
const ENGINE_NOISE = [
|
|
62
|
+
/^failed to process gltf/,
|
|
63
|
+
/^Path not found: \$ipfs/,
|
|
64
|
+
/^bevy_render feature is enabled but RenderApp was not detected/,
|
|
65
|
+
/^Could not find an asset loader matching: .* Path: Some\("embedded:\/\//
|
|
66
|
+
];
|
|
67
|
+
// `[[0, 0] 3.33] ` — parcel coords + scene clock the engine prepends to every
|
|
68
|
+
// scene log line; redundant in a single-scene preview
|
|
69
|
+
const SCENE_CONTEXT = /^\[\[-?\d+, -?\d+\] \d+\.\d+\] /;
|
|
70
|
+
// color alone conveys the level; the LOG/WARN/ERROR words are dropped
|
|
71
|
+
function colorByLevel(level, message) {
|
|
72
|
+
if (level === 'WARN')
|
|
73
|
+
return log_1.colors.yellow(message);
|
|
74
|
+
if (level === 'ERROR')
|
|
75
|
+
return log_1.colors.redBright(message);
|
|
76
|
+
return message;
|
|
77
|
+
}
|
|
78
|
+
// engine timestamps are UTC ISO with microseconds; show local wall-clock instead
|
|
79
|
+
function localTime(utcTimestamp) {
|
|
80
|
+
const date = new Date(utcTimestamp + 'Z');
|
|
81
|
+
return isNaN(date.getTime()) ? '' : log_1.colors.dim(date.toTimeString().slice(0, 8)) + ' ';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Forwards a bevy child stream line by line, tagged `[Server]` to stand apart from
|
|
85
|
+
* the preview CLI's own output, dropping the tracing prefix (warnings yellow,
|
|
86
|
+
* errors red) and the periodic `[headless] alive:` heartbeat.
|
|
87
|
+
*/
|
|
88
|
+
function forwardEngineLogs(source, sink) {
|
|
89
|
+
if (!source)
|
|
90
|
+
return;
|
|
91
|
+
const serverTag = log_1.colors.greenBright('[Server]') + ' ';
|
|
92
|
+
const writeClean = (raw) => {
|
|
93
|
+
const line = raw.replace(ANSI_CODES, '');
|
|
94
|
+
if (!line.trim())
|
|
95
|
+
return;
|
|
96
|
+
if (HEARTBEAT_LINE.test(line))
|
|
97
|
+
return;
|
|
98
|
+
const match = line.match(TRACING_PREFIX);
|
|
99
|
+
if (!match) {
|
|
100
|
+
// launcher lines ([headless] realm=...): the [Server] tag replaces their own
|
|
101
|
+
sink.write(serverTag + line.replace(/^\[headless\] /, '') + '\n');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const message = line.slice(match[0].length);
|
|
105
|
+
if (ENGINE_NOISE.some((pattern) => pattern.test(message)))
|
|
106
|
+
return;
|
|
107
|
+
if (SCENE_CONTEXT.test(message)) {
|
|
108
|
+
const sceneMessage = message.replace(SCENE_CONTEXT, '');
|
|
109
|
+
const sceneTag = sceneMessage.match(/^(LOG|WARN|ERROR|DEBUG) /);
|
|
110
|
+
const body = sceneTag ? sceneMessage.slice(sceneTag[0].length) : sceneMessage;
|
|
111
|
+
sink.write(serverTag + localTime(match[1]) + colorByLevel(sceneTag?.[1], body) + '\n');
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
sink.write(serverTag + localTime(match[1]) + colorByLevel(match[2], message) + '\n');
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
let pending = '';
|
|
118
|
+
source.setEncoding('utf8');
|
|
119
|
+
source.on('data', (chunk) => {
|
|
120
|
+
const lines = (pending + chunk).split('\n');
|
|
121
|
+
pending = lines.pop() ?? '';
|
|
122
|
+
lines.forEach(writeClean);
|
|
123
|
+
});
|
|
124
|
+
source.on('end', () => {
|
|
125
|
+
if (pending)
|
|
126
|
+
writeClean(pending);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Starts the Multiplayer Server process using npx to install and run in one step
|
|
131
|
+
*/
|
|
132
|
+
function startMultiplayerServer(components, workingDir, realm, engine = DEFAULT_ENGINE) {
|
|
133
|
+
const pkg = packageSpec(engine);
|
|
134
|
+
(0, beautiful_logs_1.printProgressInfo)(components.logger, `Starting ${log_1.colors.bold('Multiplayer Server')} (${engine}) with realm: ${log_1.colors.bold(realm)}`);
|
|
135
|
+
const npxArgs = ['--yes', pkg, `--realm=${realm}`];
|
|
136
|
+
const npxCliJs = (0, utils_1.findNpxCliJs)();
|
|
137
|
+
// In Electron, override npm_config_prefix because npm derives its prefix from process.execPath,
|
|
138
|
+
// which points to the Electron Helper binary. This causes npm to look for a `lib/` directory
|
|
139
|
+
// inside the Helper bundle, which doesn't exist (ENOENT).
|
|
140
|
+
const env = (0, utils_1.isElectronEnvironment)()
|
|
141
|
+
? { ...(0, utils_1.getSpawnEnv)(), npm_config_prefix: workingDir }
|
|
142
|
+
: { ...(0, utils_1.getSpawnEnv)() };
|
|
143
|
+
// Quiet the bevy engine's internal tracing chatter while keeping scene logs
|
|
144
|
+
// (scene_runner::renderer_context) and real warnings. An explicit RUST_LOG wins.
|
|
145
|
+
if (engine === 'bevy' && !env.RUST_LOG) {
|
|
146
|
+
env.RUST_LOG = 'warn,scene_runner::renderer_context=info';
|
|
147
|
+
}
|
|
148
|
+
// Bevy output goes through the line filter below; hammurabi keeps the terminal directly.
|
|
149
|
+
const stdio = engine === 'bevy' ? ['inherit', 'pipe', 'pipe'] : 'inherit';
|
|
150
|
+
// If npx-cli.js was found, run it directly via process.execPath (node in regular env,
|
|
151
|
+
// Electron Helper with ELECTRON_RUN_AS_NODE=1 in Electron). Otherwise fall back to npx binary.
|
|
152
|
+
const serverProcess = npxCliJs
|
|
153
|
+
? (0, child_process_1.spawn)(process.execPath, [npxCliJs, ...npxArgs], { cwd: workingDir, shell: false, stdio, env })
|
|
154
|
+
: (0, child_process_1.spawn)((0, utils_1.getNpxBin)(), npxArgs, { cwd: workingDir, shell: false, stdio, env });
|
|
155
|
+
if (engine === 'bevy') {
|
|
156
|
+
forwardEngineLogs(serverProcess.stdout, process.stdout);
|
|
157
|
+
forwardEngineLogs(serverProcess.stderr, process.stderr);
|
|
158
|
+
}
|
|
159
|
+
serverProcess.on('error', (error) => {
|
|
160
|
+
(0, beautiful_logs_1.printWarning)(components.logger, `Multiplayer Server process error: ${error.message}`);
|
|
161
|
+
});
|
|
162
|
+
// Register cleanup handlers
|
|
163
|
+
const cleanup = () => {
|
|
164
|
+
if (!serverProcess.killed) {
|
|
165
|
+
serverProcess.kill('SIGTERM');
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const removeCleanup = registerProcessCleanup(cleanup);
|
|
169
|
+
serverProcess.on('close', (code, signal) => {
|
|
170
|
+
removeCleanup();
|
|
171
|
+
if (code !== 0 && code !== null) {
|
|
172
|
+
// report abnormal exits (including bevy's exit-78 "can't run here") so we can
|
|
173
|
+
// tell from telemetry when the server is failing on users' machines
|
|
174
|
+
components.analytics.track('Multiplayer server exited', {
|
|
175
|
+
engine,
|
|
176
|
+
exitCode: code,
|
|
177
|
+
unavailable: code === EXIT_UNAVAILABLE
|
|
178
|
+
});
|
|
179
|
+
(0, beautiful_logs_1.printWarning)(components.logger, `Multiplayer Server exited with code ${code}`);
|
|
180
|
+
}
|
|
181
|
+
else if (signal && signal !== 'SIGTERM' && signal !== 'SIGINT') {
|
|
182
|
+
// SIGTERM/SIGINT are our own shutdown; anything else (SIGSEGV, SIGKILL/OOM)
|
|
183
|
+
// means the engine died out from under the preview
|
|
184
|
+
(0, beautiful_logs_1.printWarning)(components.logger, `Multiplayer Server terminated by signal ${signal}`);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
return serverProcess;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Spawns the multiplayer server for the project.
|
|
191
|
+
* In the auth-server SDK, all scenes are authoritative multiplayer.
|
|
192
|
+
* Uses npx to handle installation and execution in a single step (works in Electron).
|
|
193
|
+
*
|
|
194
|
+
* Which implementation runs is chosen by DCL_SERVER_ENGINE (bevy | hammurabi), defaulting
|
|
195
|
+
* to bevy. When bevy reports itself unavailable on this machine (exit 78) the preview is
|
|
196
|
+
* aborted with instructions to opt into hammurabi — there is no automatic fallback.
|
|
197
|
+
*
|
|
198
|
+
* @param components - Preview components including logger
|
|
199
|
+
* @param project - The project to start the multiplayer server for
|
|
200
|
+
* @param realm - The realm URL to pass to the server
|
|
201
|
+
* @returns The ChildProcess if started, undefined otherwise
|
|
202
|
+
*/
|
|
203
|
+
function spawnAuthServer(components, project, realm) {
|
|
204
|
+
const engine = selectedEngine();
|
|
205
|
+
try {
|
|
206
|
+
const child = startMultiplayerServer(components, project.workingDirectory, realm, engine);
|
|
207
|
+
if (engine === 'bevy') {
|
|
208
|
+
child.on('close', (code) => {
|
|
209
|
+
if (code !== EXIT_UNAVAILABLE)
|
|
210
|
+
return;
|
|
211
|
+
const { logger } = components;
|
|
212
|
+
logger.error(`The bevy multiplayer server (${packageSpec(engine)}) cannot run on this machine ` +
|
|
213
|
+
`(exit ${EXIT_UNAVAILABLE}: unsupported platform or missing binary — ${process.platform}-${process.arch}).`);
|
|
214
|
+
logger.error(`To run the preview with the hammurabi server instead:`);
|
|
215
|
+
logger.error(` DCL_SERVER_ENGINE=hammurabi npm start`);
|
|
216
|
+
// flush the 'Multiplayer server exited' event before killing the preview
|
|
217
|
+
void components.analytics.stop().finally(() => process.exit(EXIT_UNAVAILABLE));
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return child;
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
(0, beautiful_logs_1.printWarning)(components.logger, `Failed to start Multiplayer Server: ${error.message}`);
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=multiplayer-server.js.map
|
|
@@ -0,0 +1 @@
|
|
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;AACtB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,eAAe,CAC7B,UAA6B,EAC7B,OAAqB,EACrB,KAAa;IAEb,MAAM,MAAM,GAAG,cAAc,EAAE,CAAA;IAC/B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,sBAAsB,CAAC,UAAU,EAAE,OAAO,CAAC,gBAAgB,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACzB,IAAI,IAAI,KAAK,gBAAgB;oBAAE,OAAM;gBACrC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;gBAC7B,MAAM,CAAC,KAAK,CACV,gCAAgC,WAAW,CAAC,MAAM,CAAC,+BAA+B;oBAChF,SAAS,gBAAgB,8CAA8C,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,IAAI,CAC9G,CAAA;gBACD,MAAM,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAA;gBACrE,MAAM,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAA;gBACvD,yEAAyE;gBACzE,KAAK,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;YAChF,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAA,6BAAY,EAAC,UAAU,CAAC,MAAM,EAAE,uCAAuC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QACvF,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -10,6 +10,7 @@ const http_server_1 = require("@well-known-components/http-server");
|
|
|
10
10
|
const ws_1 = require("@well-known-components/http-server/dist/ws");
|
|
11
11
|
const ws_2 = require("../data-layer/ws");
|
|
12
12
|
const endpoints_1 = require("./endpoints");
|
|
13
|
+
const storage_service_1 = require("./storage-service");
|
|
13
14
|
const realm_1 = require("./realm");
|
|
14
15
|
const utils_1 = require("../utils");
|
|
15
16
|
exports.sceneUpdateClients = new Set();
|
|
@@ -60,6 +61,7 @@ async function wireRouter(components, workspace, dataLayer) {
|
|
|
60
61
|
};
|
|
61
62
|
});
|
|
62
63
|
(0, realm_1.setupRealmAndComms)(components, router, localSceneParcels);
|
|
64
|
+
(0, storage_service_1.setupStorageEndpoints)(components, router, workspace);
|
|
63
65
|
await (0, endpoints_1.setupEcs6Endpoints)(components, router, workspace);
|
|
64
66
|
components.server.setContext(components);
|
|
65
67
|
components.server.use(router.allowedMethods());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../../src/commands/start/server/routes.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../../src/commands/start/server/routes.ts"],"names":[],"mappings":";;;;;;AAcA,gCA8DC;AA5ED,oDAA2B;AAC3B,oEAA2D;AAC3D,mEAAqF;AAIrF,yCAAoD;AAEpD,2CAAgD;AAChD,uDAAyD;AACzD,mCAA4C;AAC5C,oCAAoC;AAEvB,QAAA,kBAAkB,GAAG,IAAI,GAAG,EAAa,CAAA;AAC/C,KAAK,UAAU,UAAU,CAAC,UAA6B,EAAE,SAAoB,EAAE,SAAqB;IACzG,MAAM,MAAM,GAAG,IAAI,oBAAM,EAAqB,CAAA;IAE9C,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC5C,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,WAAW,EAAE,CAAC;gBACvD,OAAO,IAAA,6BAAwB,EAAC,C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C;IACD,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1C,CAAC,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CliComponents } from '../../../components';
|
|
2
|
+
/**
|
|
3
|
+
* Structure for all server-side storage data.
|
|
4
|
+
* Stored in sdk-commands package directory (hidden from users).
|
|
5
|
+
*/
|
|
6
|
+
export interface ServerStorage {
|
|
7
|
+
env: Record<string, string>;
|
|
8
|
+
world: Record<string, unknown>;
|
|
9
|
+
players: Record<string, Record<string, unknown>>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Loads all server-side storage data from server-storage.json.
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadServerStorage(components: Pick<CliComponents, 'fs' | 'logger'>): Promise<ServerStorage>;
|
|
15
|
+
/**
|
|
16
|
+
* Saves all server-side storage data to server-storage.json.
|
|
17
|
+
*/
|
|
18
|
+
export declare function saveServerStorage(components: Pick<CliComponents, 'fs' | 'logger'>, data: ServerStorage): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Loads environment variables from a .env file in the project directory.
|
|
21
|
+
* Returns a Map of key-value pairs.
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadEnvFile(components: Pick<CliComponents, 'fs' | 'logger'>, projectDirectory: string): Promise<Map<string, string>>;
|
|
24
|
+
/**
|
|
25
|
+
* Gets runtime environment variables.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getEnvStorage(components: Pick<CliComponents, 'fs' | 'logger'>): Promise<Record<string, string>>;
|
|
28
|
+
/**
|
|
29
|
+
* Gets merged environment variables.
|
|
30
|
+
* Runtime values (from server-storage.json) override .env values.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getMergedEnv(components: Pick<CliComponents, 'fs' | 'logger'>, projectDirectory: string): Promise<Map<string, string>>;
|
|
33
|
+
/**
|
|
34
|
+
* Sets a runtime environment variable.
|
|
35
|
+
*/
|
|
36
|
+
export declare function setEnvValue(components: Pick<CliComponents, 'fs' | 'logger'>, key: string, value: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Deletes a runtime environment variable.
|
|
39
|
+
* Returns true if key existed and was deleted, false otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export declare function deleteEnvValue(components: Pick<CliComponents, 'fs' | 'logger'>, key: string): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Gets all world storage data.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getWorldStorage(components: Pick<CliComponents, 'fs' | 'logger'>): Promise<Record<string, unknown>>;
|
|
46
|
+
/**
|
|
47
|
+
* Gets a value from world storage.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getWorldValue(components: Pick<CliComponents, 'fs' | 'logger'>, key: string): Promise<unknown | undefined>;
|
|
50
|
+
/**
|
|
51
|
+
* Sets a value in world storage.
|
|
52
|
+
*/
|
|
53
|
+
export declare function setWorldValue(components: Pick<CliComponents, 'fs' | 'logger'>, key: string, value: unknown): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Deletes a value from world storage.
|
|
56
|
+
* Returns true if key existed and was deleted, false otherwise.
|
|
57
|
+
*/
|
|
58
|
+
export declare function deleteWorldValue(components: Pick<CliComponents, 'fs' | 'logger'>, key: string): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Gets a value from a player's storage.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getPlayerValue(components: Pick<CliComponents, 'fs' | 'logger'>, address: string, key: string): Promise<unknown | undefined>;
|
|
63
|
+
/**
|
|
64
|
+
* Sets a value in a player's storage.
|
|
65
|
+
*/
|
|
66
|
+
export declare function setPlayerValue(components: Pick<CliComponents, 'fs' | 'logger'>, address: string, key: string, value: unknown): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Deletes a value from a player's storage.
|
|
69
|
+
* Returns true if key existed and was deleted, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
export declare function deletePlayerValue(components: Pick<CliComponents, 'fs' | 'logger'>, address: string, key: string): Promise<boolean>;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadServerStorage = loadServerStorage;
|
|
7
|
+
exports.saveServerStorage = saveServerStorage;
|
|
8
|
+
exports.loadEnvFile = loadEnvFile;
|
|
9
|
+
exports.getEnvStorage = getEnvStorage;
|
|
10
|
+
exports.getMergedEnv = getMergedEnv;
|
|
11
|
+
exports.setEnvValue = setEnvValue;
|
|
12
|
+
exports.deleteEnvValue = deleteEnvValue;
|
|
13
|
+
exports.getWorldStorage = getWorldStorage;
|
|
14
|
+
exports.getWorldValue = getWorldValue;
|
|
15
|
+
exports.setWorldValue = setWorldValue;
|
|
16
|
+
exports.deleteWorldValue = deleteWorldValue;
|
|
17
|
+
exports.getPlayerValue = getPlayerValue;
|
|
18
|
+
exports.setPlayerValue = setPlayerValue;
|
|
19
|
+
exports.deletePlayerValue = deletePlayerValue;
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
21
|
+
// Find the sdk-commands package root by resolving its package.json
|
|
22
|
+
const SDK_COMMANDS_ROOT = path_1.default.dirname(require.resolve('@dcl/sdk-commands/package.json'));
|
|
23
|
+
const RUNTIME_DATA_DIR = path_1.default.join(SDK_COMMANDS_ROOT, '.runtime-data');
|
|
24
|
+
const SERVER_STORAGE_FILE = 'server-storage.json';
|
|
25
|
+
function createDefaultStorage() {
|
|
26
|
+
return {
|
|
27
|
+
env: {},
|
|
28
|
+
world: {},
|
|
29
|
+
players: {}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
let writeQueue = Promise.resolve();
|
|
33
|
+
/**
|
|
34
|
+
* Serializes read-modify-write cycles against server-storage.json. The entire
|
|
35
|
+
* load→mutate→save must run under one lock: two handlers that each load the same
|
|
36
|
+
* snapshot would otherwise lose one update, and two concurrent saves would interleave
|
|
37
|
+
* their writes into a corrupt file.
|
|
38
|
+
*/
|
|
39
|
+
function serialize(task) {
|
|
40
|
+
const run = writeQueue.then(task, task);
|
|
41
|
+
writeQueue = run.then(() => undefined, () => undefined);
|
|
42
|
+
return run;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Ensures the runtime data directory exists.
|
|
46
|
+
*/
|
|
47
|
+
async function ensureRuntimeDir(components) {
|
|
48
|
+
try {
|
|
49
|
+
const exists = await components.fs.directoryExists(RUNTIME_DATA_DIR);
|
|
50
|
+
if (!exists) {
|
|
51
|
+
await components.fs.mkdir(RUNTIME_DATA_DIR, { recursive: true });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
components.logger.error(`Failed to create runtime data directory: ${error}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Loads all server-side storage data from server-storage.json.
|
|
60
|
+
*/
|
|
61
|
+
async function loadServerStorage(components) {
|
|
62
|
+
const storagePath = path_1.default.join(RUNTIME_DATA_DIR, SERVER_STORAGE_FILE);
|
|
63
|
+
try {
|
|
64
|
+
const exists = await components.fs.fileExists(storagePath);
|
|
65
|
+
if (!exists) {
|
|
66
|
+
return createDefaultStorage();
|
|
67
|
+
}
|
|
68
|
+
const content = await components.fs.readFile(storagePath, 'utf-8');
|
|
69
|
+
const parsed = JSON.parse(content);
|
|
70
|
+
return {
|
|
71
|
+
env: parsed.env ?? {},
|
|
72
|
+
world: parsed.world ?? {},
|
|
73
|
+
players: parsed.players ?? {}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
components.logger.error(`Failed to load ${SERVER_STORAGE_FILE}: ${error}`);
|
|
78
|
+
return createDefaultStorage();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Saves all server-side storage data to server-storage.json.
|
|
83
|
+
*/
|
|
84
|
+
async function saveServerStorage(components, data) {
|
|
85
|
+
await ensureRuntimeDir(components);
|
|
86
|
+
const storagePath = path_1.default.join(RUNTIME_DATA_DIR, SERVER_STORAGE_FILE);
|
|
87
|
+
try {
|
|
88
|
+
const tmpPath = `${storagePath}.tmp`;
|
|
89
|
+
await components.fs.writeFile(tmpPath, JSON.stringify(data, null, 2));
|
|
90
|
+
await components.fs.rename(tmpPath, storagePath);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
components.logger.error(`Failed to save ${SERVER_STORAGE_FILE}: ${error}`);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Loads environment variables from a .env file in the project directory.
|
|
99
|
+
* Returns a Map of key-value pairs.
|
|
100
|
+
*/
|
|
101
|
+
async function loadEnvFile(components, projectDirectory) {
|
|
102
|
+
const envMap = new Map();
|
|
103
|
+
const envPath = path_1.default.join(projectDirectory, '.env');
|
|
104
|
+
try {
|
|
105
|
+
const exists = await components.fs.fileExists(envPath);
|
|
106
|
+
if (!exists) {
|
|
107
|
+
return envMap;
|
|
108
|
+
}
|
|
109
|
+
const content = await components.fs.readFile(envPath, 'utf-8');
|
|
110
|
+
const lines = content.split('\n');
|
|
111
|
+
for (const line of lines) {
|
|
112
|
+
const trimmed = line.trim();
|
|
113
|
+
// Skip empty lines and comments
|
|
114
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const equalIndex = trimmed.indexOf('=');
|
|
118
|
+
if (equalIndex > 0) {
|
|
119
|
+
const key = trimmed.slice(0, equalIndex).trim();
|
|
120
|
+
let value = trimmed.slice(equalIndex + 1).trim();
|
|
121
|
+
// Remove surrounding quotes if present
|
|
122
|
+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
123
|
+
value = value.slice(1, -1);
|
|
124
|
+
}
|
|
125
|
+
envMap.set(key, value);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
components.logger.error(`Failed to load .env file: ${error}`);
|
|
131
|
+
}
|
|
132
|
+
return envMap;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Gets runtime environment variables.
|
|
136
|
+
*/
|
|
137
|
+
async function getEnvStorage(components) {
|
|
138
|
+
const storage = await loadServerStorage(components);
|
|
139
|
+
return storage.env;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Gets merged environment variables.
|
|
143
|
+
* Runtime values (from server-storage.json) override .env values.
|
|
144
|
+
*/
|
|
145
|
+
async function getMergedEnv(components, projectDirectory) {
|
|
146
|
+
const envFile = await loadEnvFile(components, projectDirectory);
|
|
147
|
+
const runtimeEnv = await getEnvStorage(components);
|
|
148
|
+
// Runtime overrides .env
|
|
149
|
+
for (const [key, value] of Object.entries(runtimeEnv)) {
|
|
150
|
+
envFile.set(key, value);
|
|
151
|
+
}
|
|
152
|
+
return envFile;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Sets a runtime environment variable.
|
|
156
|
+
*/
|
|
157
|
+
async function setEnvValue(components, key, value) {
|
|
158
|
+
return serialize(async () => {
|
|
159
|
+
const storage = await loadServerStorage(components);
|
|
160
|
+
storage.env[key] = value;
|
|
161
|
+
await saveServerStorage(components, storage);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Deletes a runtime environment variable.
|
|
166
|
+
* Returns true if key existed and was deleted, false otherwise.
|
|
167
|
+
*/
|
|
168
|
+
async function deleteEnvValue(components, key) {
|
|
169
|
+
return serialize(async () => {
|
|
170
|
+
const storage = await loadServerStorage(components);
|
|
171
|
+
if (!(key in storage.env)) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
delete storage.env[key];
|
|
175
|
+
await saveServerStorage(components, storage);
|
|
176
|
+
return true;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Gets all world storage data.
|
|
181
|
+
*/
|
|
182
|
+
async function getWorldStorage(components) {
|
|
183
|
+
const storage = await loadServerStorage(components);
|
|
184
|
+
return storage.world;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Gets a value from world storage.
|
|
188
|
+
*/
|
|
189
|
+
async function getWorldValue(components, key) {
|
|
190
|
+
const storage = await loadServerStorage(components);
|
|
191
|
+
return storage.world[key];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Sets a value in world storage.
|
|
195
|
+
*/
|
|
196
|
+
async function setWorldValue(components, key, value) {
|
|
197
|
+
return serialize(async () => {
|
|
198
|
+
const storage = await loadServerStorage(components);
|
|
199
|
+
storage.world[key] = value;
|
|
200
|
+
await saveServerStorage(components, storage);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Deletes a value from world storage.
|
|
205
|
+
* Returns true if key existed and was deleted, false otherwise.
|
|
206
|
+
*/
|
|
207
|
+
async function deleteWorldValue(components, key) {
|
|
208
|
+
return serialize(async () => {
|
|
209
|
+
const storage = await loadServerStorage(components);
|
|
210
|
+
if (!(key in storage.world)) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
delete storage.world[key];
|
|
214
|
+
await saveServerStorage(components, storage);
|
|
215
|
+
return true;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Gets a value from a player's storage.
|
|
220
|
+
*/
|
|
221
|
+
async function getPlayerValue(components, address, key) {
|
|
222
|
+
const storage = await loadServerStorage(components);
|
|
223
|
+
return storage.players[address]?.[key];
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Sets a value in a player's storage.
|
|
227
|
+
*/
|
|
228
|
+
async function setPlayerValue(components, address, key, value) {
|
|
229
|
+
return serialize(async () => {
|
|
230
|
+
const storage = await loadServerStorage(components);
|
|
231
|
+
if (!storage.players[address]) {
|
|
232
|
+
storage.players[address] = {};
|
|
233
|
+
}
|
|
234
|
+
storage.players[address][key] = value;
|
|
235
|
+
await saveServerStorage(components, storage);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Deletes a value from a player's storage.
|
|
240
|
+
* Returns true if key existed and was deleted, false otherwise.
|
|
241
|
+
*/
|
|
242
|
+
async function deletePlayerValue(components, address, key) {
|
|
243
|
+
return serialize(async () => {
|
|
244
|
+
const storage = await loadServerStorage(components);
|
|
245
|
+
if (!storage.players[address] || !(key in storage.players[address])) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
delete storage.players[address][key];
|
|
249
|
+
await saveServerStorage(components, storage);
|
|
250
|
+
return true;
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=runtime-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-env.js","sourceRoot":"","sources":["../../../../src/commands/start/server/runtime-env.ts"],"names":[],"mappings":";;;;;AA4DA,8CAqBC;AAKD,8CAeC;AAMD,kCAyCC;AAKD,sCAGC;AAMD,oCAaC;AAKD,kCAUC;AAMD,wCAUC;AAKD,0CAKC;AAKD,sCAMC;AAKD,sCAUC;AAMD,4CAaC;AAKD,wCAOC;AAKD,wCAcC;AAMD,8CAcC;AAxTD,gDAAuB;AAGvB,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAA;AACzF,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAA;AACtE,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AAYjD,SAAS,oBAAoB;IAC3B,OAAO;QACL,GAAG,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AAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;YACpE,OAAO,KAAK,CAAA;QACd,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAA;QACpC,MAAM,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAC5C,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Router } from '@well-known-components/http-server';
|
|
2
|
+
import { PreviewComponents } from '../types';
|
|
3
|
+
import { CliComponents } from '../../../components';
|
|
4
|
+
import { Workspace } from '../../../logic/workspace-validations';
|
|
5
|
+
/**
|
|
6
|
+
* Sets up storage-related endpoints for environment variables, scene storage, and player storage.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setupStorageEndpoints(components: CliComponents, router: Router<PreviewComponents>, workspace: Workspace): void;
|