@dcl/sdk-commands 7.29.0 → 7.29.1-35039347300.commit-dffaede

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.
Files changed (58) hide show
  1. package/dist/commands/sdk-server-logs/index.d.ts +24 -0
  2. package/dist/commands/sdk-server-logs/index.js +313 -0
  3. package/dist/commands/sdk-server-logs/index.js.map +1 -0
  4. package/dist/commands/start/index.d.ts +1 -0
  5. package/dist/commands/start/index.js +14 -1
  6. package/dist/commands/start/index.js.map +1 -1
  7. package/dist/commands/start/multiplayer-server.d.ts +35 -0
  8. package/dist/commands/start/multiplayer-server.js +246 -0
  9. package/dist/commands/start/multiplayer-server.js.map +1 -0
  10. package/dist/commands/start/server/routes.js +2 -0
  11. package/dist/commands/start/server/routes.js.map +1 -1
  12. package/dist/commands/start/server/runtime-env.d.ts +71 -0
  13. package/dist/commands/start/server/runtime-env.js +253 -0
  14. package/dist/commands/start/server/runtime-env.js.map +1 -0
  15. package/dist/commands/start/server/storage-service.d.ts +8 -0
  16. package/dist/commands/start/server/storage-service.js +156 -0
  17. package/dist/commands/start/server/storage-service.js.map +1 -0
  18. package/dist/commands/start/utils.d.ts +32 -0
  19. package/dist/commands/start/utils.js +72 -0
  20. package/dist/commands/start/utils.js.map +1 -1
  21. package/dist/commands/storage/env.d.ts +5 -0
  22. package/dist/commands/storage/env.js +86 -0
  23. package/dist/commands/storage/env.js.map +1 -0
  24. package/dist/commands/storage/index.d.ts +26 -0
  25. package/dist/commands/storage/index.js +142 -0
  26. package/dist/commands/storage/index.js.map +1 -0
  27. package/dist/commands/storage/player.d.ts +5 -0
  28. package/dist/commands/storage/player.js +143 -0
  29. package/dist/commands/storage/player.js.map +1 -0
  30. package/dist/commands/storage/scene.d.ts +5 -0
  31. package/dist/commands/storage/scene.js +105 -0
  32. package/dist/commands/storage/scene.js.map +1 -0
  33. package/dist/commands/storage/shared.d.ts +62 -0
  34. package/dist/commands/storage/shared.js +260 -0
  35. package/dist/commands/storage/shared.js.map +1 -0
  36. package/dist/commands/storage/types.d.ts +56 -0
  37. package/dist/commands/storage/types.js +23 -0
  38. package/dist/commands/storage/types.js.map +1 -0
  39. package/dist/components/analytics.d.ts +75 -1
  40. package/dist/components/analytics.js +3 -2
  41. package/dist/components/analytics.js.map +1 -1
  42. package/dist/logic/auth-chain-headers.d.ts +11 -0
  43. package/dist/logic/auth-chain-headers.js +25 -0
  44. package/dist/logic/auth-chain-headers.js.map +1 -0
  45. package/dist/logic/bundle.js +31 -0
  46. package/dist/logic/bundle.js.map +1 -1
  47. package/dist/logic/config.d.ts +1 -0
  48. package/dist/logic/config.js +7 -0
  49. package/dist/logic/config.js.map +1 -1
  50. package/dist/logic/error.d.ts +1 -1
  51. package/dist/logic/error.js.map +1 -1
  52. package/dist/logic/exec.d.ts +1 -0
  53. package/dist/logic/exec.js +2 -2
  54. package/dist/logic/exec.js.map +1 -1
  55. package/dist/logic/lang.js +1 -1
  56. package/dist/logic/scene-validations.d.ts +8 -1
  57. package/dist/logic/scene-validations.js.map +1 -1
  58. package/package.json +3 -3
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlePlayer = void 0;
4
+ const path_1 = require("path");
5
+ const error_1 = require("../../logic/error");
6
+ const beautiful_logs_1 = require("../../logic/beautiful-logs");
7
+ const shared_1 = require("./shared");
8
+ /**
9
+ * Handles player storage operations in the server-side storage service (get, set, delete, clear)
10
+ */
11
+ const handlePlayer = async (action, key, options) => {
12
+ const { logger, analytics } = options.components;
13
+ const projectRoot = (0, path_1.resolve)(process.cwd(), options.args['--dir'] || '.');
14
+ // Common setup: validate action, workspace, and world
15
+ const { baseURL, worldName, baseParcel, parcels } = await (0, shared_1.setupStorageCommand)(options.components, projectRoot, action, options.args['--target'], ['get', 'set', 'delete', 'clear']);
16
+ // Get address (required for get/set/delete, optional for clear)
17
+ const address = options.args['--address'];
18
+ // Linker dApp options
19
+ const linkOptions = (0, shared_1.getLinkerDappOptions)(options.args);
20
+ // Handle actions
21
+ if (action === 'get') {
22
+ // GET operation
23
+ if (!address) {
24
+ throw new error_1.CliError('STORAGE_MISSING_ADDRESS', 'Missing --address option. Usage: storage player get KEY --address 0x...');
25
+ }
26
+ if (!key) {
27
+ throw new error_1.CliError('STORAGE_MISSING_KEY', 'Missing KEY argument. Usage: storage player get KEY --address 0x...');
28
+ }
29
+ logger.info(`Getting player storage value '${key}' for ${address} from ${baseURL}`);
30
+ const url = `${baseURL}/players/${encodeURIComponent(address)}/values/${encodeURIComponent(key)}`;
31
+ const info = (0, shared_1.createStorageInfo)('player', 'get', url, worldName, baseParcel, parcels, key, undefined, address);
32
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'GET', url);
33
+ if (result.success) {
34
+ analytics.track('Storage Player Get Success', { key, address });
35
+ logger.log(`\nValue for '${key}' (${address}):`);
36
+ logger.log(JSON.stringify(result.data, null, 2));
37
+ }
38
+ else {
39
+ analytics.track('Storage Player Get Failure', { key, address });
40
+ (0, beautiful_logs_1.printError)(logger, `Failed to get player storage value '${key}' for ${address}:`, new Error(result.error || 'Unknown error'));
41
+ }
42
+ }
43
+ else if (action === 'set') {
44
+ // SET operation
45
+ if (!address) {
46
+ throw new error_1.CliError('STORAGE_MISSING_ADDRESS', 'Missing --address option. Usage: storage player set KEY --value VALUE --address 0x...');
47
+ }
48
+ if (!key) {
49
+ throw new error_1.CliError('STORAGE_MISSING_KEY', 'Missing KEY argument. Usage: storage player set KEY --value VALUE --address 0x...');
50
+ }
51
+ const value = options.args['--value'];
52
+ if (value === undefined) {
53
+ throw new error_1.CliError('STORAGE_MISSING_VALUE', 'Missing --value option. Usage: storage player set KEY --value VALUE --address 0x...');
54
+ }
55
+ logger.info(`Setting player storage value '${key}' for ${address} to ${baseURL}`);
56
+ const url = `${baseURL}/players/${encodeURIComponent(address)}/values/${encodeURIComponent(key)}`;
57
+ const info = (0, shared_1.createStorageInfo)('player', 'set', url, worldName, baseParcel, parcels, key, value, address);
58
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'PUT', url, { value });
59
+ if (result.success) {
60
+ analytics.track('Storage Player Set Success', { key, address });
61
+ (0, beautiful_logs_1.printSuccess)(logger, `Player storage value '${key}' for ${address} set successfully!`, '');
62
+ }
63
+ else {
64
+ analytics.track('Storage Player Set Failure', { key, address });
65
+ (0, beautiful_logs_1.printError)(logger, `Failed to set player storage value '${key}' for ${address}:`, new Error(result.error || 'Unknown error'));
66
+ }
67
+ }
68
+ else if (action === 'delete') {
69
+ // DELETE operation
70
+ if (!address) {
71
+ throw new error_1.CliError('STORAGE_MISSING_ADDRESS', 'Missing --address option. Usage: storage player delete KEY --address 0x...');
72
+ }
73
+ if (!key) {
74
+ throw new error_1.CliError('STORAGE_MISSING_KEY', 'Missing KEY argument. Usage: storage player delete KEY --address 0x...');
75
+ }
76
+ logger.info(`Deleting player storage value '${key}' for ${address} from ${baseURL}`);
77
+ const url = `${baseURL}/players/${encodeURIComponent(address)}/values/${encodeURIComponent(key)}`;
78
+ const info = (0, shared_1.createStorageInfo)('player', 'delete', url, worldName, baseParcel, parcels, key, undefined, address);
79
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'DELETE', url);
80
+ if (result.success) {
81
+ analytics.track('Storage Player Delete Success', { key, address });
82
+ (0, beautiful_logs_1.printSuccess)(logger, `Player storage value '${key}' for ${address} deleted successfully!`, '');
83
+ }
84
+ else {
85
+ analytics.track('Storage Player Delete Failure', { key, address });
86
+ (0, beautiful_logs_1.printError)(logger, `Failed to delete player storage value '${key}' for ${address}:`, new Error(result.error || 'Unknown error'));
87
+ }
88
+ }
89
+ else if (action === 'clear') {
90
+ // CLEAR operation
91
+ const hasConfirm = options.args['--confirm'];
92
+ if (address) {
93
+ // Clear specific player
94
+ if (!hasConfirm) {
95
+ const confirmed = await (0, shared_1.confirmAction)(`Are you sure you want to delete ALL storage data for player ${address}? This cannot be undone.`);
96
+ if (!confirmed) {
97
+ logger.info('Operation cancelled.');
98
+ return;
99
+ }
100
+ }
101
+ logger.info(`Clearing all storage data for player ${address} from ${baseURL}`);
102
+ const url = `${baseURL}/players/${encodeURIComponent(address)}/values`;
103
+ const info = (0, shared_1.createStorageInfo)('player', 'clear', url, worldName, baseParcel, parcels, undefined, undefined, address);
104
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'DELETE', url, undefined, {
105
+ 'X-Confirm-Delete-All': 'true'
106
+ });
107
+ if (result.success) {
108
+ analytics.track('Storage Player Clear Success', { address });
109
+ (0, beautiful_logs_1.printSuccess)(logger, `All storage data for player ${address} cleared successfully!`, '');
110
+ }
111
+ else {
112
+ analytics.track('Storage Player Clear Failure', { address });
113
+ (0, beautiful_logs_1.printError)(logger, `Failed to clear storage data for player ${address}:`, new Error(result.error || 'Unknown error'));
114
+ }
115
+ }
116
+ else {
117
+ // Clear all players
118
+ if (!hasConfirm) {
119
+ const confirmed = await (0, shared_1.confirmAction)('Are you sure you want to delete ALL player storage data for ALL players? This cannot be undone.');
120
+ if (!confirmed) {
121
+ logger.info('Operation cancelled.');
122
+ return;
123
+ }
124
+ }
125
+ logger.info(`Clearing all player storage data from ${baseURL}`);
126
+ const url = `${baseURL}/players`;
127
+ const info = (0, shared_1.createStorageInfo)('player', 'clear', url, worldName, baseParcel, parcels);
128
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'DELETE', url, undefined, {
129
+ 'X-Confirm-Delete-All': 'true'
130
+ });
131
+ if (result.success) {
132
+ analytics.track('Storage Player Clear All Success', {});
133
+ (0, beautiful_logs_1.printSuccess)(logger, 'All player storage data cleared successfully!', '');
134
+ }
135
+ else {
136
+ analytics.track('Storage Player Clear All Failure', {});
137
+ (0, beautiful_logs_1.printError)(logger, 'Failed to clear all player storage data:', new Error(result.error || 'Unknown error'));
138
+ }
139
+ }
140
+ }
141
+ };
142
+ exports.handlePlayer = handlePlayer;
143
+ //# sourceMappingURL=player.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"player.js","sourceRoot":"","sources":["../../../src/commands/storage/player.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAE9B,6CAA4C;AAC5C,+DAAqE;AACrE,qCAMiB;AAEjB;;GAEG;AACI,MAAM,YAAY,GAAG,KAAK,EAAE,MAAc,EAAE,GAAuB,EAAE,OAAgB,EAAiB,EAAE;IAC7G,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAA;IAChD,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAA;IAExE,sDAAsD;IACtD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,4BAAmB,EAC3E,OAAO,CAAC,UAAU,EAClB,WAAW,EACX,MAAM,EACN,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EACxB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAClC,CAAA;IAED,gEAAgE;IAChE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAEzC,sBAAsB;IACtB,MAAM,WAAW,GAAG,IAAA,6BAAoB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtD,iBAAiB;IACjB,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,gBAAgB;QAChB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,gBAAQ,CAChB,yBAAyB,EACzB,yEAAyE,CAC1E,CAAA;QACH,CAAC;QAED,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,gBAAQ,CAAC,qBAAqB,EAAE,qEAAqE,CAAC,CAAA;QAClH,CAAC;QAED,MAAM,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,MAAM,EAAE,0CAA0C,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,eAAe,CAAC,CAAC,CAAA;YAC5G,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AA5MY,QAAA,YAAY,gBA4MxB"}
@@ -0,0 +1,5 @@
1
+ import { Options } from './types';
2
+ /**
3
+ * Handles scene storage operations in the server-side storage service (get, set, delete, clear)
4
+ */
5
+ export declare const handleScene: (action: string, key: string | undefined, options: Options) => Promise<void>;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleScene = void 0;
4
+ const path_1 = require("path");
5
+ const error_1 = require("../../logic/error");
6
+ const beautiful_logs_1 = require("../../logic/beautiful-logs");
7
+ const shared_1 = require("./shared");
8
+ /**
9
+ * Handles scene storage operations in the server-side storage service (get, set, delete, clear)
10
+ */
11
+ const handleScene = async (action, key, options) => {
12
+ const { logger, analytics } = options.components;
13
+ const projectRoot = (0, path_1.resolve)(process.cwd(), options.args['--dir'] || '.');
14
+ // Common setup: validate action, workspace, and world
15
+ const { baseURL, worldName, baseParcel, parcels } = await (0, shared_1.setupStorageCommand)(options.components, projectRoot, action, options.args['--target'], ['get', 'set', 'delete', 'clear']);
16
+ // Linker dApp options
17
+ const linkOptions = (0, shared_1.getLinkerDappOptions)(options.args);
18
+ // Handle actions
19
+ if (action === 'get') {
20
+ // GET operation
21
+ if (!key) {
22
+ throw new error_1.CliError('STORAGE_MISSING_KEY', 'Missing KEY argument. Usage: storage scene get KEY');
23
+ }
24
+ logger.info(`Getting scene storage value '${key}' from ${baseURL}`);
25
+ const url = `${baseURL}/values/${encodeURIComponent(key)}`;
26
+ const info = (0, shared_1.createStorageInfo)('scene', 'get', url, worldName, baseParcel, parcels, key);
27
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'GET', url);
28
+ if (result.success) {
29
+ analytics.track('Storage Scene Get Success', { key });
30
+ logger.log(`\nValue for '${key}':`);
31
+ logger.log(JSON.stringify(result.data, null, 2));
32
+ }
33
+ else {
34
+ analytics.track('Storage Scene Get Failure', { key });
35
+ (0, beautiful_logs_1.printError)(logger, `Failed to get scene storage value '${key}':`, new Error(result.error || 'Unknown error'));
36
+ }
37
+ }
38
+ else if (action === 'set') {
39
+ // SET operation
40
+ if (!key) {
41
+ throw new error_1.CliError('STORAGE_MISSING_KEY', 'Missing KEY argument. Usage: storage scene set KEY --value VALUE');
42
+ }
43
+ const value = options.args['--value'];
44
+ if (value === undefined) {
45
+ throw new error_1.CliError('STORAGE_MISSING_VALUE', 'Missing --value option. Usage: storage scene set KEY --value VALUE');
46
+ }
47
+ logger.info(`Setting scene storage value '${key}' to ${baseURL}`);
48
+ const url = `${baseURL}/values/${encodeURIComponent(key)}`;
49
+ const info = (0, shared_1.createStorageInfo)('scene', 'set', url, worldName, baseParcel, parcels, key, value);
50
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'PUT', url, { value });
51
+ if (result.success) {
52
+ analytics.track('Storage Scene Set Success', { key });
53
+ (0, beautiful_logs_1.printSuccess)(logger, `Scene storage value '${key}' set successfully!`, '');
54
+ }
55
+ else {
56
+ analytics.track('Storage Scene Set Failure', { key });
57
+ (0, beautiful_logs_1.printError)(logger, `Failed to set scene storage value '${key}':`, new Error(result.error || 'Unknown error'));
58
+ }
59
+ }
60
+ else if (action === 'delete') {
61
+ // DELETE operation
62
+ if (!key) {
63
+ throw new error_1.CliError('STORAGE_MISSING_KEY', 'Missing KEY argument. Usage: storage scene delete KEY');
64
+ }
65
+ logger.info(`Deleting scene storage value '${key}' from ${baseURL}`);
66
+ const url = `${baseURL}/values/${encodeURIComponent(key)}`;
67
+ const info = (0, shared_1.createStorageInfo)('scene', 'delete', url, worldName, baseParcel, parcels, key);
68
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'DELETE', url);
69
+ if (result.success) {
70
+ analytics.track('Storage Scene Delete Success', { key });
71
+ (0, beautiful_logs_1.printSuccess)(logger, `Scene storage value '${key}' deleted successfully!`, '');
72
+ }
73
+ else {
74
+ analytics.track('Storage Scene Delete Failure', { key });
75
+ (0, beautiful_logs_1.printError)(logger, `Failed to delete scene storage value '${key}':`, new Error(result.error || 'Unknown error'));
76
+ }
77
+ }
78
+ else if (action === 'clear') {
79
+ // CLEAR operation
80
+ const hasConfirm = options.args['--confirm'];
81
+ if (!hasConfirm) {
82
+ const confirmed = await (0, shared_1.confirmAction)('Are you sure you want to delete ALL scene storage data? This cannot be undone.');
83
+ if (!confirmed) {
84
+ logger.info('Operation cancelled.');
85
+ return;
86
+ }
87
+ }
88
+ logger.info(`Clearing all scene storage data from ${baseURL}`);
89
+ const url = `${baseURL}/values`;
90
+ const info = (0, shared_1.createStorageInfo)('scene', 'clear', url, worldName, baseParcel, parcels);
91
+ const result = await (0, shared_1.makeAuthenticatedRequest)(options.components, info, linkOptions, 'DELETE', url, undefined, {
92
+ 'X-Confirm-Delete-All': 'true'
93
+ });
94
+ if (result.success) {
95
+ analytics.track('Storage Scene Clear Success', {});
96
+ (0, beautiful_logs_1.printSuccess)(logger, 'All scene storage data cleared successfully!', '');
97
+ }
98
+ else {
99
+ analytics.track('Storage Scene Clear Failure', {});
100
+ (0, beautiful_logs_1.printError)(logger, 'Failed to clear scene storage data:', new Error(result.error || 'Unknown error'));
101
+ }
102
+ }
103
+ };
104
+ exports.handleScene = handleScene;
105
+ //# sourceMappingURL=scene.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene.js","sourceRoot":"","sources":["../../../src/commands/storage/scene.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAE9B,6CAA4C;AAC5C,+DAAqE;AACrE,qCAMiB;AAEjB;;GAEG;AACI,MAAM,WAAW,GAAG,KAAK,EAAE,MAAc,EAAE,GAAuB,EAAE,OAAgB,EAAiB,EAAE;IAC5G,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,C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1E,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAA;YAClD,IAAA,2BAAU,EAAC,MAAM,EAAE,qCAAqC,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,eAAe,CAAC,CAAC,CAAA;QACvG,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAlHY,QAAA,WAAW,eAkHvB"}
@@ -0,0 +1,62 @@
1
+ import { IFuture } from 'fp-future';
2
+ import { Lifecycle } from '@well-known-components/interfaces';
3
+ import { CliComponents } from '../../components';
4
+ import { LinkerResponse } from '../../linker-dapp/routes';
5
+ import { StorageInfo, LinkerOptions, StorageType } from './types';
6
+ /** True when the storage target is a local development server. Matches by exact hostname so a lookalike host (localhost.evil.com) is not treated as local. */
7
+ export declare const isLocalStorageTarget: (baseURL: string) => boolean;
8
+ /** Validates the workspace and resolves the storage target (local server, a World, or a Genesis City scene by its base parcel). */
9
+ export declare const validateWorkspaceAndWorld: (components: CliComponents, projectRoot: string, baseURL: string) => Promise<{
10
+ worldName: string | undefined;
11
+ baseParcel: string;
12
+ parcels: string[];
13
+ }>;
14
+ /**
15
+ * Builds metadata for server-side storage service requests (ADR-44 format)
16
+ */
17
+ export declare const buildStorageMetadata: (worldName: string | undefined, baseParcel: string) => string;
18
+ /**
19
+ * Confirms an action with the user
20
+ * Accepts: yes, y, no, n (case insensitive)
21
+ */
22
+ export declare const confirmAction: (message: string) => Promise<boolean>;
23
+ /**
24
+ * Extracts linker dApp options from command arguments
25
+ */
26
+ export declare const getLinkerDappOptions: (args: {
27
+ "--port"?: number;
28
+ "--no-browser"?: boolean;
29
+ "--https"?: boolean;
30
+ }) => LinkerOptions;
31
+ /**
32
+ * Common setup for server-side storage commands: validates action, workspace, and world configuration
33
+ */
34
+ export declare const setupStorageCommand: (components: CliComponents, projectRoot: string, action: string, targetArg: string | undefined, validActions: string[]) => Promise<{
35
+ baseURL: string;
36
+ worldName: string | undefined;
37
+ baseParcel: string;
38
+ parcels: string[];
39
+ }>;
40
+ export type StorageOperationResult = {
41
+ success: boolean;
42
+ data?: any;
43
+ error?: string;
44
+ };
45
+ /**
46
+ * Gets authentication (private key or linker dApp) and executes callback with signed headers
47
+ */
48
+ export declare const getAuthHeaders: (components: CliComponents, awaitResponse: IFuture<void>, info: StorageInfo, linkOptions: LinkerOptions, deployCallback: (response: LinkerResponse) => Promise<StorageOperationResult>) => Promise<{
49
+ program?: Lifecycle.ComponentBasedProgram<unknown>;
50
+ }>;
51
+ /**
52
+ * Makes an authenticated request to the server-side storage service
53
+ */
54
+ export declare const makeAuthenticatedRequest: (components: CliComponents, info: StorageInfo, linkOptions: LinkerOptions, method: "GET" | "PUT" | "DELETE", url: string, body?: any, additionalHeaders?: Record<string, string>) => Promise<StorageOperationResult>;
55
+ /**
56
+ * Gets the base URL for server-side storage service operations
57
+ */
58
+ export declare const getStorageBaseUrl: (targetArg?: string) => string;
59
+ /**
60
+ * Creates storage info object for signing server-side storage service requests
61
+ */
62
+ export declare const createStorageInfo: (storageType: StorageType, action: "get" | "set" | "delete" | "clear", url: string, worldName: string | undefined, baseParcel: string, parcels: string[], key?: string, value?: string, address?: string) => StorageInfo;
@@ -0,0 +1,260 @@
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.createStorageInfo = exports.getStorageBaseUrl = exports.makeAuthenticatedRequest = exports.getAuthHeaders = exports.setupStorageCommand = exports.getLinkerDappOptions = exports.confirmAction = exports.buildStorageMetadata = exports.validateWorkspaceAndWorld = exports.isLocalStorageTarget = void 0;
7
+ const fp_future_1 = __importDefault(require("fp-future"));
8
+ const crypto_1 = require("@dcl/crypto");
9
+ const crypto_2 = require("@dcl/crypto/dist/crypto");
10
+ const eth_connect_1 = require("eth-connect");
11
+ const readline_1 = __importDefault(require("readline"));
12
+ const error_1 = require("../../logic/error");
13
+ const account_1 = require("../../logic/account");
14
+ const auth_chain_headers_1 = require("../../logic/auth-chain-headers");
15
+ const routes_1 = require("../../linker-dapp/routes");
16
+ const run_dapp_1 = require("../../run-dapp");
17
+ const workspace_validations_1 = require("../../logic/workspace-validations");
18
+ const scene_validations_1 = require("../../logic/scene-validations");
19
+ const STORAGE_SERVER_ORG = 'https://storage.decentraland.org';
20
+ /** True when the storage target is a local development server. Matches by exact hostname so a lookalike host (localhost.evil.com) is not treated as local. */
21
+ const isLocalStorageTarget = (baseURL) => {
22
+ try {
23
+ const { hostname } = new URL(baseURL);
24
+ return hostname === 'localhost' || hostname === '127.0.0.1';
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ };
30
+ exports.isLocalStorageTarget = isLocalStorageTarget;
31
+ /** Validates the workspace and resolves the storage target (local server, a World, or a Genesis City scene by its base parcel). */
32
+ const validateWorkspaceAndWorld = async (components, projectRoot, baseURL) => {
33
+ await (0, workspace_validations_1.getValidWorkspace)(components, projectRoot);
34
+ const sceneJson = await (0, scene_validations_1.getValidSceneJson)(components, projectRoot);
35
+ const worldName = sceneJson.worldConfiguration?.name;
36
+ const baseParcel = sceneJson.scene?.base;
37
+ if (!(0, exports.isLocalStorageTarget)(baseURL) && !worldName && !baseParcel) {
38
+ throw new error_1.CliError('STORAGE_MISSING_LOCATION', 'scene.json must define worldConfiguration.name (World) or scene.base (Genesis City parcel) to use storage on remote servers');
39
+ }
40
+ const resolvedBaseParcel = baseParcel ?? '0,0';
41
+ const parcels = sceneJson.scene?.parcels ?? [resolvedBaseParcel];
42
+ return { worldName, baseParcel: resolvedBaseParcel, parcels };
43
+ };
44
+ exports.validateWorkspaceAndWorld = validateWorkspaceAndWorld;
45
+ /**
46
+ * Builds metadata for server-side storage service requests (ADR-44 format)
47
+ */
48
+ const buildStorageMetadata = (worldName, baseParcel) => {
49
+ const meta = {};
50
+ if (worldName) {
51
+ meta.realm = { serverName: worldName };
52
+ meta.realmName = worldName;
53
+ }
54
+ meta.parcel = baseParcel;
55
+ return JSON.stringify(meta);
56
+ };
57
+ exports.buildStorageMetadata = buildStorageMetadata;
58
+ /**
59
+ * Confirms an action with the user
60
+ * Accepts: yes, y, no, n (case insensitive)
61
+ */
62
+ const confirmAction = async (message) => {
63
+ return new Promise((resolve) => {
64
+ const rl = readline_1.default.createInterface({
65
+ input: process.stdin,
66
+ output: process.stdout
67
+ });
68
+ rl.question(`${message} (Yes/No): `, (answer) => {
69
+ rl.close();
70
+ const normalized = answer.toLowerCase().trim();
71
+ resolve(normalized === 'yes' || normalized === 'y');
72
+ });
73
+ });
74
+ };
75
+ exports.confirmAction = confirmAction;
76
+ /**
77
+ * Extracts linker dApp options from command arguments
78
+ */
79
+ const getLinkerDappOptions = (args) => {
80
+ return {
81
+ linkerPort: args['--port'],
82
+ openBrowser: !args['--no-browser'],
83
+ isHttps: !!args['--https']
84
+ };
85
+ };
86
+ exports.getLinkerDappOptions = getLinkerDappOptions;
87
+ /**
88
+ * Common setup for server-side storage commands: validates action, workspace, and world configuration
89
+ */
90
+ const setupStorageCommand = async (components, projectRoot, action, targetArg, validActions) => {
91
+ const { logger } = components;
92
+ // Validate action
93
+ if (!validActions.includes(action)) {
94
+ throw new error_1.CliError('STORAGE_INVALID_ACTION', `Invalid action '${action}'. Use: ${validActions.join(', ')}`);
95
+ }
96
+ // Get base URL
97
+ const baseURL = (0, exports.getStorageBaseUrl)(targetArg);
98
+ const { worldName, baseParcel, parcels } = await (0, exports.validateWorkspaceAndWorld)(components, projectRoot, baseURL);
99
+ if ((0, exports.isLocalStorageTarget)(baseURL)) {
100
+ logger.info('Local development mode (no world configuration required)');
101
+ }
102
+ else if (worldName) {
103
+ logger.info(`World: ${worldName}`);
104
+ }
105
+ else {
106
+ logger.info(`Genesis City scene at parcel ${baseParcel}`);
107
+ }
108
+ return { baseURL, worldName, baseParcel, parcels };
109
+ };
110
+ exports.setupStorageCommand = setupStorageCommand;
111
+ /**
112
+ * Sets up routes for the linker dApp specific to server-side storage operations
113
+ */
114
+ const setStorageRoutes = (router, components, awaitResponse, deployCallback) => {
115
+ const { logger } = components;
116
+ const resolveLinkerPromise = () => setTimeout(() => awaitResponse.resolve(), 100);
117
+ const rejectLinkerPromise = (e) => setTimeout(() => awaitResponse.reject(e), 100);
118
+ router.post('/api/storage', async (ctx) => {
119
+ const value = (await ctx.request.json());
120
+ if (!value.address || !value.authChain) {
121
+ const errorMessage = `Invalid payload: ${Object.keys(value).join(' - ')}`;
122
+ logger.error(errorMessage);
123
+ resolveLinkerPromise();
124
+ return { status: 400, body: { success: false, error: errorMessage } };
125
+ }
126
+ try {
127
+ const result = await deployCallback(value);
128
+ resolveLinkerPromise();
129
+ if (!result.success) {
130
+ return { status: 400, body: { success: false, error: result.error } };
131
+ }
132
+ return { body: { success: true, data: result.data } };
133
+ }
134
+ catch (e) {
135
+ rejectLinkerPromise(e);
136
+ return { status: 400, body: { success: false, error: e.message } };
137
+ }
138
+ });
139
+ return router;
140
+ };
141
+ /**
142
+ * Gets authentication (private key or linker dApp) and executes callback with signed headers
143
+ */
144
+ const getAuthHeaders = async (components, awaitResponse, info, linkOptions, deployCallback) => {
145
+ // If DCL_PRIVATE_KEY is set, sign directly without the linker dapp
146
+ if (process.env.DCL_PRIVATE_KEY) {
147
+ const wallet = (0, account_1.createWallet)(process.env.DCL_PRIVATE_KEY);
148
+ const authChain = crypto_1.Authenticator.createSimpleAuthChain(info.rootCID, wallet.address, (0, crypto_2.ethSign)((0, eth_connect_1.hexToBytes)(wallet.privateKey), info.rootCID));
149
+ const linkerResponse = { authChain, address: wallet.address };
150
+ await deployCallback(linkerResponse);
151
+ awaitResponse.resolve();
152
+ return {};
153
+ }
154
+ // Use linker dapp for signing
155
+ const { router: commonRouter } = (0, routes_1.setRoutes)(components, {
156
+ storageType: info.storageType,
157
+ key: info.key,
158
+ value: info.value,
159
+ address: info.address,
160
+ world: info.world,
161
+ action: info.action,
162
+ targetUrl: info.targetUrl,
163
+ rootCID: info.rootCID,
164
+ baseParcel: info.baseParcel,
165
+ parcels: info.parcels,
166
+ skipValidations: info.skipValidations,
167
+ debug: info.debug,
168
+ isWorld: info.isWorld,
169
+ title: 'Storage Service',
170
+ description: 'Manage storage in the Decentraland Storage Service'
171
+ });
172
+ const router = setStorageRoutes(commonRouter, components, awaitResponse, deployCallback);
173
+ const actionLabel = info.action === 'delete' || info.action === 'clear' ? 'delete' : 'deploy';
174
+ components.logger.info(`You need to sign the content before the ${actionLabel}:`);
175
+ const { program } = await (0, run_dapp_1.runDapp)(components, router, { ...linkOptions, uri: `/` });
176
+ return { program };
177
+ };
178
+ exports.getAuthHeaders = getAuthHeaders;
179
+ /**
180
+ * Makes an authenticated request to the server-side storage service
181
+ */
182
+ const makeAuthenticatedRequest = async (components, info, linkOptions, method, url, body, additionalHeaders) => {
183
+ const { fetch: fetchComponent } = components;
184
+ const awaitResponse = (0, fp_future_1.default)();
185
+ let operationResult = { success: false, error: 'Operation not completed' };
186
+ const { program } = await (0, exports.getAuthHeaders)(components, awaitResponse, info, linkOptions, async (linkerResponse) => {
187
+ const authHeaders = (0, auth_chain_headers_1.createAuthChainHeaders)(linkerResponse.authChain, info.timestamp, info.metadata);
188
+ const headers = {
189
+ ...authHeaders,
190
+ ...additionalHeaders
191
+ };
192
+ if (method !== 'GET') {
193
+ headers['Content-Type'] = 'application/json';
194
+ }
195
+ const res = await fetchComponent.fetch(url, {
196
+ method,
197
+ headers,
198
+ body: body ? JSON.stringify(body) : undefined
199
+ });
200
+ if (res.ok) {
201
+ try {
202
+ const text = await res.text();
203
+ const responseData = text ? JSON.parse(text) : {};
204
+ operationResult = { success: true, data: responseData.value };
205
+ }
206
+ catch {
207
+ operationResult = { success: true };
208
+ }
209
+ }
210
+ else {
211
+ const errorText = await res.text();
212
+ operationResult = { success: false, error: errorText };
213
+ }
214
+ return operationResult;
215
+ });
216
+ try {
217
+ await awaitResponse;
218
+ }
219
+ finally {
220
+ void program?.stop();
221
+ }
222
+ return operationResult;
223
+ };
224
+ exports.makeAuthenticatedRequest = makeAuthenticatedRequest;
225
+ /**
226
+ * Gets the base URL for server-side storage service operations
227
+ */
228
+ const getStorageBaseUrl = (targetArg) => {
229
+ return targetArg || STORAGE_SERVER_ORG;
230
+ };
231
+ exports.getStorageBaseUrl = getStorageBaseUrl;
232
+ /**
233
+ * Creates storage info object for signing server-side storage service requests
234
+ */
235
+ const createStorageInfo = (storageType, action, url, worldName, baseParcel, parcels, key, value, address) => {
236
+ const timestamp = String(Date.now());
237
+ const metadata = (0, exports.buildStorageMetadata)(worldName, baseParcel);
238
+ const pathname = new URL(url).pathname;
239
+ const method = action === 'get' ? 'get' : action === 'set' ? 'put' : 'delete';
240
+ const payload = [method, pathname, timestamp, metadata].join(':').toLowerCase();
241
+ return {
242
+ storageType,
243
+ key,
244
+ value,
245
+ address,
246
+ world: worldName,
247
+ action,
248
+ targetUrl: url,
249
+ rootCID: payload,
250
+ timestamp,
251
+ metadata,
252
+ baseParcel,
253
+ parcels,
254
+ skipValidations: true,
255
+ debug: !!process.env.DEBUG,
256
+ isWorld: !!worldName
257
+ };
258
+ };
259
+ exports.createStorageInfo = createStorageInfo;
260
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/commands/storage/shared.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA2C;AAC3C,wCAA2C;AAC3C,oDAAiD;AACjD,6CAAwC;AAGxC,wDAA+B;AAG/B,6CAA4C;AAC5C,iDAAkD;AAClD,uEAAuE;AACvE,qDAAoE;AACpE,6CAAwC;AACxC,6EAAqE;AACrE,qEAAiE;AAGjE,MAAM,kBAAkB,GAAG,kCAAkC,CAAA;AAE7D,8JAA8J;AACvJ,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAW,EAAE;IAC/D,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAA;QACrC,OA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