@air-jam/devtools 0.9.3 → 1.0.0-beta.10
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 +60 -0
- package/dist/{chunk-VKMJO6VN.js → chunk-2O67AXCU.js} +150 -40
- package/dist/chunk-2O67AXCU.js.map +1 -0
- package/dist/chunk-AO3ZDXF6.js +142 -0
- package/dist/chunk-AO3ZDXF6.js.map +1 -0
- package/dist/chunk-ART5TEYT.js +472 -0
- package/dist/chunk-ART5TEYT.js.map +1 -0
- package/dist/chunk-ASC2CK2R.js +77 -0
- package/dist/chunk-ASC2CK2R.js.map +1 -0
- package/dist/chunk-E3UZZGAV.js +50 -0
- package/dist/chunk-E3UZZGAV.js.map +1 -0
- package/dist/chunk-EJTE7UKX.js +64 -0
- package/dist/chunk-EJTE7UKX.js.map +1 -0
- package/dist/chunk-ESFKNN75.js +110 -0
- package/dist/chunk-ESFKNN75.js.map +1 -0
- package/dist/chunk-EU7A6PXW.js +1339 -0
- package/dist/chunk-EU7A6PXW.js.map +1 -0
- package/dist/chunk-FN7E6EA7.js +549 -0
- package/dist/chunk-FN7E6EA7.js.map +1 -0
- package/dist/chunk-GDFAWHGA.js +190 -0
- package/dist/chunk-GDFAWHGA.js.map +1 -0
- package/dist/chunk-HZUGBH4Y.js +347 -0
- package/dist/chunk-HZUGBH4Y.js.map +1 -0
- package/dist/chunk-ITKAOEGX.js +93 -0
- package/dist/chunk-ITKAOEGX.js.map +1 -0
- package/dist/chunk-JBCUTWRI.js +897 -0
- package/dist/chunk-JBCUTWRI.js.map +1 -0
- package/dist/chunk-JSI5S4WP.js +1174 -0
- package/dist/chunk-JSI5S4WP.js.map +1 -0
- package/dist/chunk-L4D675BG.js +97 -0
- package/dist/chunk-L4D675BG.js.map +1 -0
- package/dist/{chunk-GUEZP773.js → chunk-LB3Y64P5.js} +206 -60
- package/dist/chunk-LB3Y64P5.js.map +1 -0
- package/dist/chunk-M6CJ7GQC.js +133 -0
- package/dist/chunk-M6CJ7GQC.js.map +1 -0
- package/dist/{chunk-CKFT2ZJE.js → chunk-MEIMOSZC.js} +53 -105
- package/dist/chunk-MEIMOSZC.js.map +1 -0
- package/dist/chunk-OM6SCJ7H.js +18 -0
- package/dist/chunk-OM6SCJ7H.js.map +1 -0
- package/dist/chunk-PKD4WVX5.js +63 -0
- package/dist/chunk-PKD4WVX5.js.map +1 -0
- package/dist/chunk-PMBLXGFM.js +3384 -0
- package/dist/chunk-PMBLXGFM.js.map +1 -0
- package/dist/chunk-PMNE5GIN.js +279 -0
- package/dist/chunk-PMNE5GIN.js.map +1 -0
- package/dist/chunk-QAWI64VR.js +148 -0
- package/dist/chunk-QAWI64VR.js.map +1 -0
- package/dist/chunk-QGADSPHZ.js +449 -0
- package/dist/chunk-QGADSPHZ.js.map +1 -0
- package/dist/chunk-SPYN66UV.js +338 -0
- package/dist/chunk-SPYN66UV.js.map +1 -0
- package/dist/context.d.ts +9 -3
- package/dist/context.js +2 -1
- package/dist/controller.d.ts +33 -7
- package/dist/controller.js +18 -8
- package/dist/dependencies.d.ts +44 -0
- package/dist/dependencies.js +10 -0
- package/dist/dev.d.ts +9 -3
- package/dist/dev.js +3 -4
- package/dist/game-builds.d.ts +200 -0
- package/dist/game-builds.js +16 -0
- package/dist/game-builds.js.map +1 -0
- package/dist/game-run-watch-CEd_SpAT.d.ts +84 -0
- package/dist/game-runs.d.ts +1452 -0
- package/dist/game-runs.js +76 -0
- package/dist/game-runs.js.map +1 -0
- package/dist/game-session-broker-CUvORfMd.d.ts +439 -0
- package/dist/game-session-broker.d.ts +4 -57
- package/dist/game-session-broker.js +33 -228
- package/dist/game-session-broker.js.map +1 -1
- package/dist/game-session.d.ts +3931 -10
- package/dist/game-session.js +186 -15
- package/dist/game-session.js.map +1 -1
- package/dist/game-settings.d.ts +16 -0
- package/dist/game-settings.js +237 -0
- package/dist/game-settings.js.map +1 -0
- package/dist/games.d.ts +11 -4
- package/dist/games.js +4 -2
- package/dist/harness/visual.d.ts +34 -151
- package/dist/harness/visual.js +6 -1
- package/dist/logs.d.ts +8 -2
- package/dist/logs.js +3 -4
- package/dist/logs.js.map +1 -1
- package/dist/managed-process-scope-BicYi_t9.d.ts +3 -0
- package/dist/mcp-config.js +2 -1
- package/dist/mcp-config.js.map +1 -1
- package/dist/platform-auth.d.ts +8 -111
- package/dist/platform-auth.js +9 -1
- package/dist/platform-game-analytics.d.ts +51 -0
- package/dist/platform-game-analytics.js +49 -0
- package/dist/platform-game-analytics.js.map +1 -0
- package/dist/platform-game-app-id.d.ts +46 -0
- package/dist/platform-game-app-id.js +93 -0
- package/dist/platform-game-app-id.js.map +1 -0
- package/dist/platform-game-media.d.ts +40 -2
- package/dist/platform-game-media.js +1 -1
- package/dist/platform-games.d.ts +24 -2
- package/dist/platform-games.js +16 -84
- package/dist/platform-games.js.map +1 -1
- package/dist/quality.d.ts +9 -3
- package/dist/quality.js +3 -4
- package/dist/quality.js.map +1 -1
- package/dist/release.d.ts +226 -16
- package/dist/release.js +18 -1331
- package/dist/release.js.map +1 -1
- package/dist/rooms-check.d.ts +90 -0
- package/dist/rooms-check.js +717 -0
- package/dist/rooms-check.js.map +1 -0
- package/dist/source-tree-contract.d.ts +16 -0
- package/dist/source-tree-contract.js +13 -0
- package/dist/source-tree-contract.js.map +1 -0
- package/dist/testing.d.ts +464 -0
- package/dist/testing.js +27 -0
- package/dist/testing.js.map +1 -0
- package/dist/tooling/describe-game.js +54 -0
- package/dist/tooling/describe-game.js.map +1 -0
- package/dist/tooling/game-session-broker.js +28 -0
- package/dist/tooling/game-session-broker.js.map +1 -0
- package/dist/tooling/hold-runtime-host.js +770 -68
- package/dist/tooling/hold-runtime-host.js.map +1 -1
- package/dist/tooling/list-visual-scenarios.js +18 -55
- package/dist/tooling/list-visual-scenarios.js.map +1 -1
- package/dist/tooling/process-scope-bootstrap.mjs +24 -0
- package/dist/tooling/process-scope-guard.d.ts +2 -0
- package/dist/tooling/process-scope-guard.js +388 -0
- package/dist/tooling/process-scope-guard.js.map +1 -0
- package/dist/tooling/process-scope-windows.ps1 +148 -0
- package/dist/tooling/rooms-check-device.d.ts +2 -0
- package/dist/tooling/rooms-check-device.js +498 -0
- package/dist/tooling/rooms-check-device.js.map +1 -0
- package/dist/tooling/run-headless-room.d.ts +2 -0
- package/dist/tooling/run-headless-room.js +288 -0
- package/dist/tooling/run-headless-room.js.map +1 -0
- package/dist/tooling/run-test-profile.d.ts +2 -0
- package/dist/tooling/run-test-profile.js +181 -0
- package/dist/tooling/run-test-profile.js.map +1 -0
- package/dist/tooling/run-visual-capture.js +70 -34
- package/dist/tooling/run-visual-capture.js.map +1 -1
- package/dist/tooling/seal-game-build.d.ts +2 -0
- package/dist/tooling/seal-game-build.js +120 -0
- package/dist/tooling/seal-game-build.js.map +1 -0
- package/dist/{types-C6NrHt88.d.ts → types-CdYrgrG_.d.ts} +337 -76
- package/dist/types-DyRD-ym1.d.ts +141 -0
- package/dist/visual.d.ts +9 -3
- package/dist/visual.js +24 -68
- package/dist/visual.js.map +1 -1
- package/package.json +51 -14
- package/src/bounded-response.ts +28 -0
- package/src/built-game-runtime.ts +152 -0
- package/src/context.ts +2 -13
- package/src/controller-protocol.ts +22 -0
- package/src/controller.ts +747 -597
- package/src/current-room-host.ts +166 -0
- package/src/decision-provider.ts +102 -0
- package/src/dependencies.ts +176 -0
- package/src/dependency-install-contract.ts +12 -0
- package/src/dev.ts +46 -50
- package/src/game-action-observation.ts +11 -1
- package/src/game-build-protocol.ts +72 -0
- package/src/game-build.ts +483 -0
- package/src/game-run-owner.ts +2358 -0
- package/src/game-run-protocol.ts +448 -0
- package/src/game-run-record.ts +92 -0
- package/src/game-run-replay.ts +95 -0
- package/src/game-run-watch.ts +155 -0
- package/src/game-session-broker.ts +689 -197
- package/src/game-session-operations.ts +61 -0
- package/src/game-session-protocol.ts +180 -0
- package/src/game-session-runtime.ts +861 -0
- package/src/game-session.ts +164 -417
- package/src/game-settings.ts +295 -0
- package/src/games.ts +88 -92
- package/src/harness/visual/browser.ts +100 -0
- package/src/harness/visual/controller-observation.ts +181 -0
- package/src/harness/visual/runner.ts +24 -21
- package/src/harness/visual/runtime-controller-observations.ts +151 -0
- package/src/harness/visual/scenario-contract.ts +1 -2
- package/src/harness/visual/scenario-helpers.ts +5 -1
- package/src/harness/visual/screencast.ts +155 -0
- package/src/harness/visual/session.ts +74 -69
- package/src/harness/visual/types.ts +8 -5
- package/src/headless-room-protocol.ts +112 -0
- package/src/headless-room.ts +222 -0
- package/src/helper-channel.ts +229 -0
- package/src/helper-scripts.ts +25 -5
- package/src/installed-dependencies.ts +74 -0
- package/src/managed-process-scope.ts +481 -0
- package/src/node-process-environment.ts +10 -0
- package/src/platform-auth.ts +194 -55
- package/src/platform-game-analytics.ts +50 -0
- package/src/platform-game-app-id.ts +99 -0
- package/src/platform-games.ts +13 -111
- package/src/policy-artifact-contract.ts +52 -0
- package/src/policy-artifacts.ts +134 -0
- package/src/process-scope-admission.ts +50 -0
- package/src/process-scope-protocol.ts +66 -0
- package/src/process-scope.ts +327 -0
- package/src/release.ts +28 -42
- package/src/rooms-check-fleet.ts +194 -0
- package/src/rooms-check-link.ts +138 -0
- package/src/rooms-check-protocol.ts +244 -0
- package/src/rooms-check.ts +797 -0
- package/src/runtime-owner-protocol.ts +106 -18
- package/src/source-tree-contract.ts +70 -0
- package/src/source-tree.ts +84 -0
- package/src/test-profile-process.ts +153 -0
- package/src/test-profile-protocol.ts +116 -0
- package/src/testing.ts +430 -0
- package/src/tooling/declaration-hook.ts +52 -0
- package/src/tooling/describe-game.ts +49 -0
- package/src/tooling/game-session-broker.ts +7 -0
- package/src/tooling/hold-runtime-host.ts +254 -42
- package/src/tooling/list-visual-scenarios.ts +19 -62
- package/src/tooling/load-game.ts +79 -0
- package/src/tooling/process-scope-bootstrap.mjs +24 -0
- package/src/tooling/process-scope-guard.ts +213 -0
- package/src/tooling/process-scope-windows.ps1 +148 -0
- package/src/tooling/rooms-check-device.ts +493 -0
- package/src/tooling/run-headless-room.ts +329 -0
- package/src/tooling/run-test-profile.ts +190 -0
- package/src/tooling/run-visual-capture.ts +37 -23
- package/src/tooling/runtime-owner-actions.ts +23 -0
- package/src/tooling/seal-game-build.ts +118 -0
- package/src/tooling/visual-pack.ts +10 -45
- package/src/types.ts +54 -77
- package/src/visual.ts +14 -22
- package/src/windows-process-scopes.ts +189 -0
- package/dist/agent.d.ts +0 -15
- package/dist/agent.js +0 -19
- package/dist/chunk-5YAARMW5.js +0 -36
- package/dist/chunk-5YAARMW5.js.map +0 -1
- package/dist/chunk-6WQODT37.js +0 -1019
- package/dist/chunk-6WQODT37.js.map +0 -1
- package/dist/chunk-CKFT2ZJE.js.map +0 -1
- package/dist/chunk-ER3Q2C4G.js +0 -358
- package/dist/chunk-ER3Q2C4G.js.map +0 -1
- package/dist/chunk-GUEZP773.js.map +0 -1
- package/dist/chunk-HIDNI56E.js +0 -33
- package/dist/chunk-HIDNI56E.js.map +0 -1
- package/dist/chunk-QKXS5D35.js +0 -43
- package/dist/chunk-QKXS5D35.js.map +0 -1
- package/dist/chunk-S4LSCEVE.js +0 -261
- package/dist/chunk-S4LSCEVE.js.map +0 -1
- package/dist/chunk-VKMJO6VN.js.map +0 -1
- package/dist/chunk-WFUR3MXY.js +0 -67
- package/dist/chunk-WFUR3MXY.js.map +0 -1
- package/dist/chunk-XEMR7KUE.js +0 -361
- package/dist/chunk-XEMR7KUE.js.map +0 -1
- package/dist/chunk-ZLPD7FY5.js +0 -191
- package/dist/chunk-ZLPD7FY5.js.map +0 -1
- package/dist/tooling/agent-contract.js +0 -193
- package/dist/tooling/agent-contract.js.map +0 -1
- package/dist/tooling/inspect-airjam-agent.js +0 -37
- package/dist/tooling/inspect-airjam-agent.js.map +0 -1
- package/src/agent.ts +0 -380
- package/src/tooling/agent-contract.ts +0 -232
- package/src/tooling/agent-declaration.ts +0 -36
- package/src/tooling/airjam-agent-inspection.ts +0 -45
- package/src/tooling/airjam-agent.ts +0 -118
- package/src/tooling/inspect-airjam-agent.ts +0 -20
- /package/dist/{agent.js.map → dependencies.js.map} +0 -0
- /package/dist/tooling/{agent-contract.d.ts → describe-game.d.ts} +0 -0
- /package/dist/tooling/{inspect-airjam-agent.d.ts → game-session-broker.d.ts} +0 -0
package/src/platform-auth.ts
CHANGED
|
@@ -5,6 +5,11 @@ import {
|
|
|
5
5
|
platformMachineDeviceStartResultSchema,
|
|
6
6
|
platformMachineLogoutResultSchema,
|
|
7
7
|
platformMachineMeResultSchema,
|
|
8
|
+
platformMachineProfileInputSchema,
|
|
9
|
+
platformMachineRevokeSessionInputSchema,
|
|
10
|
+
platformMachineSessionSchema,
|
|
11
|
+
platformMachineSessionsResultSchema,
|
|
12
|
+
platformMachineUserSchema,
|
|
8
13
|
} from "@air-jam/sdk/platform-machine";
|
|
9
14
|
import { randomUUID } from "node:crypto";
|
|
10
15
|
import {
|
|
@@ -18,6 +23,7 @@ import {
|
|
|
18
23
|
import { isIP } from "node:net";
|
|
19
24
|
import os from "node:os";
|
|
20
25
|
import path from "node:path";
|
|
26
|
+
import lockfile from "proper-lockfile";
|
|
21
27
|
import { z } from "zod";
|
|
22
28
|
import type {
|
|
23
29
|
AirJamPlatformAuthStatus,
|
|
@@ -56,43 +62,72 @@ const resolvePlatformAuthDirectory = () =>
|
|
|
56
62
|
const resolvePlatformAuthFile = () =>
|
|
57
63
|
path.join(resolvePlatformAuthDirectory(), "platform-session.json");
|
|
58
64
|
|
|
59
|
-
const
|
|
60
|
-
version: z.literal(1),
|
|
65
|
+
const storedPlatformSessionFields = z.object({
|
|
61
66
|
platformBaseUrl: z.string().url(),
|
|
62
67
|
clientName: z.string().nullable(),
|
|
63
68
|
storedAt: z.string().min(1),
|
|
64
|
-
user:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
user: platformMachineUserSchema,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const storedPlatformSessionSchema = storedPlatformSessionFields.extend({
|
|
73
|
+
version: z.literal(2),
|
|
74
|
+
session: platformMachineSessionSchema,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Read the former credential only to exchange it through the refresh endpoint.
|
|
78
|
+
const legacyStoredPlatformSessionSchema = storedPlatformSessionFields.extend({
|
|
79
|
+
version: z.literal(1),
|
|
80
|
+
session: platformMachineSessionSchema.omit({
|
|
81
|
+
refreshToken: true,
|
|
82
|
+
refreshExpiresAt: true,
|
|
76
83
|
}),
|
|
77
84
|
});
|
|
78
85
|
|
|
86
|
+
const readableStoredPlatformSessionSchema = z.discriminatedUnion("version", [
|
|
87
|
+
storedPlatformSessionSchema,
|
|
88
|
+
legacyStoredPlatformSessionSchema,
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
const withPlatformSessionLock = async <T>(
|
|
92
|
+
operation: () => Promise<T>,
|
|
93
|
+
): Promise<T> => {
|
|
94
|
+
await mkdir(resolvePlatformAuthDirectory(), { recursive: true, mode: 0o700 });
|
|
95
|
+
const release = await lockfile.lock(resolvePlatformAuthFile(), {
|
|
96
|
+
realpath: false,
|
|
97
|
+
retries: { retries: 10, minTimeout: 50, maxTimeout: 1000 },
|
|
98
|
+
});
|
|
99
|
+
try {
|
|
100
|
+
return await operation();
|
|
101
|
+
} finally {
|
|
102
|
+
await release();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
79
106
|
export class AirJamPlatformApiError extends Error {
|
|
80
107
|
readonly code: PlatformMachineErrorCode;
|
|
81
108
|
readonly status: number;
|
|
109
|
+
readonly details: Record<string, unknown> | undefined;
|
|
110
|
+
readonly retryAfterSeconds: number | null;
|
|
82
111
|
|
|
83
112
|
constructor({
|
|
84
113
|
code,
|
|
85
114
|
message,
|
|
86
115
|
status,
|
|
116
|
+
details,
|
|
117
|
+
retryAfterSeconds = null,
|
|
87
118
|
}: {
|
|
88
119
|
code: PlatformMachineErrorCode;
|
|
89
120
|
message: string;
|
|
90
121
|
status: number;
|
|
122
|
+
details?: Record<string, unknown>;
|
|
123
|
+
retryAfterSeconds?: number | null;
|
|
91
124
|
}) {
|
|
92
125
|
super(message);
|
|
93
126
|
this.name = "AirJamPlatformApiError";
|
|
94
127
|
this.code = code;
|
|
95
128
|
this.status = status;
|
|
129
|
+
this.details = details;
|
|
130
|
+
this.retryAfterSeconds = retryAfterSeconds;
|
|
96
131
|
}
|
|
97
132
|
}
|
|
98
133
|
|
|
@@ -203,8 +238,13 @@ export const requestPlatformMachineApi = async <T>({
|
|
|
203
238
|
if (parsedError.success) {
|
|
204
239
|
throw new AirJamPlatformApiError({
|
|
205
240
|
code: parsedError.data.error,
|
|
206
|
-
message:
|
|
241
|
+
message:
|
|
242
|
+
parsedError.data.error === "invalid_token"
|
|
243
|
+
? `${parsedError.data.message} Run airjam auth login to sign in again.`
|
|
244
|
+
: parsedError.data.message,
|
|
207
245
|
status: response.status,
|
|
246
|
+
details: parsedError.data.details,
|
|
247
|
+
retryAfterSeconds: parsedError.data.retryAfterSeconds,
|
|
208
248
|
});
|
|
209
249
|
}
|
|
210
250
|
|
|
@@ -218,25 +258,26 @@ export const requestPlatformMachineApi = async <T>({
|
|
|
218
258
|
return schema.parse(payload);
|
|
219
259
|
};
|
|
220
260
|
|
|
221
|
-
export const readStoredPlatformMachineSession =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
throw error;
|
|
261
|
+
export const readStoredPlatformMachineSession = async () => {
|
|
262
|
+
const storagePath = resolvePlatformAuthFile();
|
|
263
|
+
let source: string;
|
|
264
|
+
try {
|
|
265
|
+
source = await readFile(storagePath, "utf8");
|
|
266
|
+
} catch (error) {
|
|
267
|
+
if ((error as NodeJS.ErrnoException)?.code === "ENOENT") {
|
|
268
|
+
return null;
|
|
232
269
|
}
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
233
272
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
273
|
+
try {
|
|
274
|
+
return readableStoredPlatformSessionSchema.parse(
|
|
275
|
+
JSON.parse(source) as unknown,
|
|
276
|
+
);
|
|
277
|
+
} catch (error) {
|
|
278
|
+
throw new AirJamStoredPlatformSessionError(storagePath, error);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
240
281
|
|
|
241
282
|
export const writeStoredPlatformMachineSession = async (
|
|
242
283
|
value: AirJamPlatformMachineSessionStore,
|
|
@@ -305,8 +346,10 @@ export const loginPlatformWithDeviceFlow = async ({
|
|
|
305
346
|
await onPrompt?.(authorization);
|
|
306
347
|
|
|
307
348
|
const expiresAtMs = Date.parse(authorization.expiresAt);
|
|
349
|
+
let intervalSeconds = authorization.intervalSeconds;
|
|
308
350
|
while (Date.now() < expiresAtMs) {
|
|
309
|
-
await sleep(
|
|
351
|
+
await sleep(intervalSeconds * 1000);
|
|
352
|
+
if (Date.now() >= expiresAtMs) break;
|
|
310
353
|
|
|
311
354
|
try {
|
|
312
355
|
const authenticated = await pollPlatformDeviceAuthorization({
|
|
@@ -323,7 +366,7 @@ export const loginPlatformWithDeviceFlow = async ({
|
|
|
323
366
|
);
|
|
324
367
|
}
|
|
325
368
|
const storedSession: AirJamPlatformMachineSessionStore = {
|
|
326
|
-
version:
|
|
369
|
+
version: 2,
|
|
327
370
|
platformBaseUrl: baseUrl,
|
|
328
371
|
clientName: clientName?.trim() || null,
|
|
329
372
|
storedAt: new Date().toISOString(),
|
|
@@ -331,7 +374,9 @@ export const loginPlatformWithDeviceFlow = async ({
|
|
|
331
374
|
session: authenticated.session,
|
|
332
375
|
};
|
|
333
376
|
|
|
334
|
-
await
|
|
377
|
+
await withPlatformSessionLock(() =>
|
|
378
|
+
writeStoredPlatformMachineSession(storedSession),
|
|
379
|
+
);
|
|
335
380
|
|
|
336
381
|
return {
|
|
337
382
|
authorization,
|
|
@@ -339,11 +384,12 @@ export const loginPlatformWithDeviceFlow = async ({
|
|
|
339
384
|
storedSession,
|
|
340
385
|
};
|
|
341
386
|
} catch (error) {
|
|
342
|
-
if (
|
|
343
|
-
error
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
387
|
+
if (error instanceof AirJamPlatformApiError) {
|
|
388
|
+
if (error.code === "slow_down") {
|
|
389
|
+
intervalSeconds += 5;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (error.code === "authorization_pending") continue;
|
|
347
393
|
}
|
|
348
394
|
|
|
349
395
|
throw error;
|
|
@@ -357,7 +403,7 @@ export const loginPlatformWithDeviceFlow = async ({
|
|
|
357
403
|
});
|
|
358
404
|
};
|
|
359
405
|
|
|
360
|
-
|
|
406
|
+
const resolvePlatformMachineAuthUnlocked = async ({
|
|
361
407
|
platformUrl,
|
|
362
408
|
token,
|
|
363
409
|
}: {
|
|
@@ -371,11 +417,12 @@ export const resolvePlatformMachineAuth = async ({
|
|
|
371
417
|
};
|
|
372
418
|
}
|
|
373
419
|
|
|
374
|
-
|
|
420
|
+
let stored = await readStoredPlatformMachineSession();
|
|
375
421
|
if (!stored) {
|
|
376
|
-
throw new Error(
|
|
422
|
+
throw new Error(
|
|
423
|
+
"No stored Air Jam platform session was found. Run airjam auth login to sign in.",
|
|
424
|
+
);
|
|
377
425
|
}
|
|
378
|
-
|
|
379
426
|
const baseUrl = resolvePlatformBaseUrl(platformUrl ?? stored.platformBaseUrl);
|
|
380
427
|
if (
|
|
381
428
|
parsePlatformUrl(baseUrl).origin !==
|
|
@@ -385,10 +432,76 @@ export const resolvePlatformMachineAuth = async ({
|
|
|
385
432
|
"The stored Air Jam session belongs to a different platform origin. Log in to that platform or supply an explicit token.",
|
|
386
433
|
);
|
|
387
434
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
435
|
+
if (
|
|
436
|
+
stored.version === 1 ||
|
|
437
|
+
Date.parse(stored.session.expiresAt) <= Date.now() + 30_000
|
|
438
|
+
) {
|
|
439
|
+
const authenticated = await requestPlatformMachineApi({
|
|
440
|
+
baseUrl,
|
|
441
|
+
pathname: "/api/cli/auth/refresh",
|
|
442
|
+
method: "POST",
|
|
443
|
+
body: {
|
|
444
|
+
refreshToken:
|
|
445
|
+
stored.version === 1
|
|
446
|
+
? stored.session.token
|
|
447
|
+
: stored.session.refreshToken,
|
|
448
|
+
},
|
|
449
|
+
schema: platformMachineDevicePollResultSchema,
|
|
450
|
+
});
|
|
451
|
+
if (
|
|
452
|
+
parsePlatformUrl(authenticated.platformBaseUrl).origin !==
|
|
453
|
+
parsePlatformUrl(baseUrl).origin
|
|
454
|
+
) {
|
|
455
|
+
throw new Error(
|
|
456
|
+
"The refresh response does not match the requested platform origin.",
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
stored = {
|
|
460
|
+
...stored,
|
|
461
|
+
version: 2,
|
|
462
|
+
user: authenticated.user,
|
|
463
|
+
session: authenticated.session,
|
|
464
|
+
storedAt: new Date().toISOString(),
|
|
465
|
+
};
|
|
466
|
+
await writeStoredPlatformMachineSession(stored);
|
|
467
|
+
}
|
|
468
|
+
return { baseUrl, token: stored.session.token };
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
export const resolvePlatformMachineAuth = async (options: {
|
|
472
|
+
platformUrl?: string;
|
|
473
|
+
token?: string;
|
|
474
|
+
}) =>
|
|
475
|
+
options.token?.trim()
|
|
476
|
+
? resolvePlatformMachineAuthUnlocked(options)
|
|
477
|
+
: withPlatformSessionLock(() =>
|
|
478
|
+
resolvePlatformMachineAuthUnlocked(options),
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
export const listPlatformMachineSessions = async (
|
|
482
|
+
options: GetPlatformMachineProfileOptions = {},
|
|
483
|
+
) => {
|
|
484
|
+
const resolved = await resolvePlatformMachineAuth(options);
|
|
485
|
+
return requestPlatformMachineApi({
|
|
486
|
+
baseUrl: resolved.baseUrl,
|
|
487
|
+
pathname: "/api/cli/auth/sessions",
|
|
488
|
+
token: resolved.token,
|
|
489
|
+
schema: platformMachineSessionsResultSchema,
|
|
490
|
+
});
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
export const revokePlatformMachineSession = async (
|
|
494
|
+
options: GetPlatformMachineProfileOptions & { id: string },
|
|
495
|
+
) => {
|
|
496
|
+
const resolved = await resolvePlatformMachineAuth(options);
|
|
497
|
+
return requestPlatformMachineApi({
|
|
498
|
+
baseUrl: resolved.baseUrl,
|
|
499
|
+
pathname: "/api/cli/auth/sessions/revoke",
|
|
500
|
+
method: "POST",
|
|
501
|
+
token: resolved.token,
|
|
502
|
+
body: platformMachineRevokeSessionInputSchema.parse(options),
|
|
503
|
+
schema: platformMachineLogoutResultSchema,
|
|
504
|
+
});
|
|
392
505
|
};
|
|
393
506
|
|
|
394
507
|
export const getPlatformMachineProfile = async ({
|
|
@@ -404,20 +517,42 @@ export const getPlatformMachineProfile = async ({
|
|
|
404
517
|
});
|
|
405
518
|
};
|
|
406
519
|
|
|
407
|
-
export const
|
|
520
|
+
export const updatePlatformMachineProfile = async ({
|
|
408
521
|
platformUrl,
|
|
409
522
|
token,
|
|
410
|
-
|
|
523
|
+
displayName,
|
|
524
|
+
}: GetPlatformMachineProfileOptions & { displayName: string }) => {
|
|
525
|
+
const input = platformMachineProfileInputSchema.parse({ displayName });
|
|
411
526
|
const resolved = await resolvePlatformMachineAuth({ platformUrl, token });
|
|
412
|
-
|
|
527
|
+
return requestPlatformMachineApi({
|
|
413
528
|
baseUrl: resolved.baseUrl,
|
|
414
|
-
pathname: "/api/cli/auth/
|
|
529
|
+
pathname: "/api/cli/auth/profile",
|
|
415
530
|
method: "POST",
|
|
416
531
|
token: resolved.token,
|
|
417
|
-
|
|
532
|
+
body: input,
|
|
533
|
+
schema: platformMachineUserSchema,
|
|
534
|
+
});
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
export const logoutPlatformMachineSession = async ({
|
|
538
|
+
platformUrl,
|
|
539
|
+
token,
|
|
540
|
+
}: LogoutPlatformMachineSessionOptions = {}) => {
|
|
541
|
+
return withPlatformSessionLock(async () => {
|
|
542
|
+
const resolved = await resolvePlatformMachineAuthUnlocked({
|
|
543
|
+
platformUrl,
|
|
544
|
+
token,
|
|
545
|
+
});
|
|
546
|
+
const result = await requestPlatformMachineApi({
|
|
547
|
+
baseUrl: resolved.baseUrl,
|
|
548
|
+
pathname: "/api/cli/auth/logout",
|
|
549
|
+
method: "POST",
|
|
550
|
+
token: resolved.token,
|
|
551
|
+
schema: platformMachineLogoutResultSchema,
|
|
552
|
+
});
|
|
553
|
+
if (!token) await clearStoredPlatformMachineSession();
|
|
554
|
+
return result;
|
|
418
555
|
});
|
|
419
|
-
await clearStoredPlatformMachineSession();
|
|
420
|
-
return result;
|
|
421
556
|
};
|
|
422
557
|
|
|
423
558
|
export const getPlatformMachineAuthStatus =
|
|
@@ -446,6 +581,10 @@ export const getPlatformMachineAuthStatus =
|
|
|
446
581
|
session: {
|
|
447
582
|
id: stored.session.id,
|
|
448
583
|
expiresAt: stored.session.expiresAt,
|
|
584
|
+
refreshExpiresAt:
|
|
585
|
+
stored.version === 1
|
|
586
|
+
? stored.session.expiresAt
|
|
587
|
+
: stored.session.refreshExpiresAt,
|
|
449
588
|
createdAt: stored.session.createdAt,
|
|
450
589
|
userAgent: stored.session.userAgent,
|
|
451
590
|
},
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
platformMachineGameAnalyticsOverviewInputSchema,
|
|
3
|
+
platformMachineGameAnalyticsOverviewSchema,
|
|
4
|
+
platformMachineGameAnalyticsSessionsInputSchema,
|
|
5
|
+
platformMachineGameAnalyticsSessionsSchema,
|
|
6
|
+
} from "@air-jam/sdk/platform-machine";
|
|
7
|
+
import {
|
|
8
|
+
requestPlatformMachineApi,
|
|
9
|
+
resolvePlatformMachineAuth,
|
|
10
|
+
} from "./platform-auth.js";
|
|
11
|
+
|
|
12
|
+
type GameAnalyticsOptions = {
|
|
13
|
+
platformUrl?: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
slugOrId: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const getPlatformGameAnalyticsOverview = async ({
|
|
19
|
+
platformUrl,
|
|
20
|
+
token,
|
|
21
|
+
slugOrId,
|
|
22
|
+
days,
|
|
23
|
+
}: GameAnalyticsOptions & { days?: number }) => {
|
|
24
|
+
const input = platformMachineGameAnalyticsOverviewInputSchema.parse({ days });
|
|
25
|
+
const resolved = await resolvePlatformMachineAuth({ platformUrl, token });
|
|
26
|
+
return requestPlatformMachineApi({
|
|
27
|
+
baseUrl: resolved.baseUrl,
|
|
28
|
+
pathname: `/api/cli/games/${encodeURIComponent(slugOrId)}/analytics?days=${input.days}`,
|
|
29
|
+
token: resolved.token,
|
|
30
|
+
schema: platformMachineGameAnalyticsOverviewSchema,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const getPlatformGameAnalyticsSessions = async ({
|
|
35
|
+
platformUrl,
|
|
36
|
+
token,
|
|
37
|
+
slugOrId,
|
|
38
|
+
limit,
|
|
39
|
+
}: GameAnalyticsOptions & { limit?: number }) => {
|
|
40
|
+
const input = platformMachineGameAnalyticsSessionsInputSchema.parse({
|
|
41
|
+
limit,
|
|
42
|
+
});
|
|
43
|
+
const resolved = await resolvePlatformMachineAuth({ platformUrl, token });
|
|
44
|
+
return requestPlatformMachineApi({
|
|
45
|
+
baseUrl: resolved.baseUrl,
|
|
46
|
+
pathname: `/api/cli/games/${encodeURIComponent(slugOrId)}/analytics/sessions?limit=${input.limit}`,
|
|
47
|
+
token: resolved.token,
|
|
48
|
+
schema: platformMachineGameAnalyticsSessionsSchema,
|
|
49
|
+
});
|
|
50
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
platformMachineGameAppIdOriginsInputSchema,
|
|
3
|
+
platformMachineGameAppIdRegenerateInputSchema,
|
|
4
|
+
platformMachineGameAppIdSchema,
|
|
5
|
+
platformMachineGameSlugAvailabilityInputSchema,
|
|
6
|
+
platformMachineGameSlugAvailabilitySchema,
|
|
7
|
+
} from "@air-jam/sdk/platform-machine";
|
|
8
|
+
import {
|
|
9
|
+
requestPlatformMachineApi,
|
|
10
|
+
resolvePlatformMachineAuth,
|
|
11
|
+
} from "./platform-auth.js";
|
|
12
|
+
|
|
13
|
+
type GameAppIdOptions = {
|
|
14
|
+
platformUrl?: string;
|
|
15
|
+
token?: string;
|
|
16
|
+
slugOrId: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const inspectPlatformGameAppId = async ({
|
|
20
|
+
platformUrl,
|
|
21
|
+
token,
|
|
22
|
+
slugOrId,
|
|
23
|
+
}: GameAppIdOptions) => {
|
|
24
|
+
const resolved = await resolvePlatformMachineAuth({ platformUrl, token });
|
|
25
|
+
return requestPlatformMachineApi({
|
|
26
|
+
baseUrl: resolved.baseUrl,
|
|
27
|
+
pathname: `/api/cli/games/${encodeURIComponent(slugOrId)}/app-id`,
|
|
28
|
+
token: resolved.token,
|
|
29
|
+
schema: platformMachineGameAppIdSchema,
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const updatePlatformGameAppIdOrigins = async ({
|
|
34
|
+
platformUrl,
|
|
35
|
+
token,
|
|
36
|
+
slugOrId,
|
|
37
|
+
allowedOrigins,
|
|
38
|
+
}: GameAppIdOptions & { allowedOrigins: string[] }) => {
|
|
39
|
+
const input = platformMachineGameAppIdOriginsInputSchema.parse({
|
|
40
|
+
allowedOrigins,
|
|
41
|
+
});
|
|
42
|
+
const resolved = await resolvePlatformMachineAuth({ platformUrl, token });
|
|
43
|
+
return requestPlatformMachineApi({
|
|
44
|
+
baseUrl: resolved.baseUrl,
|
|
45
|
+
pathname: `/api/cli/games/${encodeURIComponent(slugOrId)}/app-id/origins`,
|
|
46
|
+
method: "POST",
|
|
47
|
+
token: resolved.token,
|
|
48
|
+
body: input,
|
|
49
|
+
schema: platformMachineGameAppIdSchema,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const regeneratePlatformGameAppId = async ({
|
|
54
|
+
platformUrl,
|
|
55
|
+
token,
|
|
56
|
+
slugOrId,
|
|
57
|
+
yes,
|
|
58
|
+
}: GameAppIdOptions & { yes?: boolean }) => {
|
|
59
|
+
if (!yes)
|
|
60
|
+
throw new Error(
|
|
61
|
+
"Regenerating the App ID breaks deployed games. Pass --yes to confirm.",
|
|
62
|
+
);
|
|
63
|
+
const input = platformMachineGameAppIdRegenerateInputSchema.parse({ yes });
|
|
64
|
+
const resolved = await resolvePlatformMachineAuth({ platformUrl, token });
|
|
65
|
+
return requestPlatformMachineApi({
|
|
66
|
+
baseUrl: resolved.baseUrl,
|
|
67
|
+
pathname: `/api/cli/games/${encodeURIComponent(slugOrId)}/app-id/regenerate`,
|
|
68
|
+
method: "POST",
|
|
69
|
+
token: resolved.token,
|
|
70
|
+
body: input,
|
|
71
|
+
schema: platformMachineGameAppIdSchema,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const checkPlatformGameSlugAvailability = async ({
|
|
76
|
+
platformUrl,
|
|
77
|
+
token,
|
|
78
|
+
slug,
|
|
79
|
+
game,
|
|
80
|
+
}: {
|
|
81
|
+
platformUrl?: string;
|
|
82
|
+
token?: string;
|
|
83
|
+
slug: string;
|
|
84
|
+
game?: string;
|
|
85
|
+
}) => {
|
|
86
|
+
const input = platformMachineGameSlugAvailabilityInputSchema.parse({
|
|
87
|
+
slug,
|
|
88
|
+
game,
|
|
89
|
+
});
|
|
90
|
+
const query = new URLSearchParams({ slug: input.slug });
|
|
91
|
+
if (input.game !== undefined) query.set("game", input.game);
|
|
92
|
+
const resolved = await resolvePlatformMachineAuth({ platformUrl, token });
|
|
93
|
+
return requestPlatformMachineApi({
|
|
94
|
+
baseUrl: resolved.baseUrl,
|
|
95
|
+
pathname: `/api/cli/games/slug-availability?${query}`,
|
|
96
|
+
token: resolved.token,
|
|
97
|
+
schema: platformMachineGameSlugAvailabilitySchema,
|
|
98
|
+
});
|
|
99
|
+
};
|
package/src/platform-games.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
airJamGameMetadataSchema,
|
|
3
|
-
type AirJamGameMetadata,
|
|
4
|
-
} from "@air-jam/sdk/metadata";
|
|
5
1
|
import {
|
|
6
2
|
platformMachineCreateOwnedGameResultSchema,
|
|
7
3
|
platformMachineGetOwnedGameResultSchema,
|
|
@@ -9,16 +5,8 @@ import {
|
|
|
9
5
|
platformMachineUpdateOwnedGameResultSchema,
|
|
10
6
|
} from "@air-jam/sdk/platform-machine";
|
|
11
7
|
import { readFile } from "node:fs/promises";
|
|
12
|
-
import { createRequire } from "node:module";
|
|
13
8
|
import path from "node:path";
|
|
14
|
-
import {
|
|
15
|
-
import { runCommandResult } from "./commands.js";
|
|
16
|
-
import {
|
|
17
|
-
findUp,
|
|
18
|
-
pathExists,
|
|
19
|
-
readJsonFile,
|
|
20
|
-
readPackageJson,
|
|
21
|
-
} from "./fs-utils.js";
|
|
9
|
+
import { findUp, pathExists, readPackageJson } from "./fs-utils.js";
|
|
22
10
|
import { inspectGame } from "./games.js";
|
|
23
11
|
import {
|
|
24
12
|
requestPlatformMachineApi,
|
|
@@ -40,16 +28,6 @@ export type {
|
|
|
40
28
|
UpdatePlatformGameOptions,
|
|
41
29
|
} from "./types.js";
|
|
42
30
|
|
|
43
|
-
const require = createRequire(import.meta.url);
|
|
44
|
-
|
|
45
|
-
const resolveTsxLoaderPath = (): string | null => {
|
|
46
|
-
try {
|
|
47
|
-
return require.resolve("tsx/esm");
|
|
48
|
-
} catch {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
31
|
const normalizeGithubRemoteUrl = (value: string): string | null => {
|
|
54
32
|
const trimmed = value.trim();
|
|
55
33
|
if (!trimmed) {
|
|
@@ -139,113 +117,37 @@ const resolveRepoSourceUrl = async ({
|
|
|
139
117
|
return `${normalizedRemoteUrl}/tree/main/${relativeProjectPath.replaceAll(path.sep, "/")}`;
|
|
140
118
|
};
|
|
141
119
|
|
|
142
|
-
type LocalTemplateManifest = {
|
|
143
|
-
id?: unknown;
|
|
144
|
-
name?: unknown;
|
|
145
|
-
description?: unknown;
|
|
146
|
-
category?: unknown;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const toOptionalString = (value: unknown): string | null =>
|
|
150
|
-
typeof value === "string" && value.trim() ? value.trim() : null;
|
|
151
|
-
|
|
152
|
-
const resolveTemplateManifestPath = (projectDir: string) =>
|
|
153
|
-
path.join(projectDir, "airjam-template.json");
|
|
154
|
-
|
|
155
|
-
const loadTemplateManifest = async (
|
|
156
|
-
projectDir: string,
|
|
157
|
-
): Promise<{
|
|
158
|
-
path: string | null;
|
|
159
|
-
value: LocalTemplateManifest | null;
|
|
160
|
-
}> => {
|
|
161
|
-
const manifestPath = resolveTemplateManifestPath(projectDir);
|
|
162
|
-
try {
|
|
163
|
-
return {
|
|
164
|
-
path: manifestPath,
|
|
165
|
-
value: await readJsonFile<LocalTemplateManifest>(manifestPath),
|
|
166
|
-
};
|
|
167
|
-
} catch {
|
|
168
|
-
return {
|
|
169
|
-
path: null,
|
|
170
|
-
value: null,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const loadGameMetadataFromConfig = async (
|
|
176
|
-
configPath: string | null,
|
|
177
|
-
): Promise<AirJamGameMetadata | null> => {
|
|
178
|
-
if (!configPath) {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const tsxLoaderPath = resolveTsxLoaderPath();
|
|
183
|
-
if (!tsxLoaderPath) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const configUrl = pathToFileURL(configPath).href;
|
|
188
|
-
const script = `
|
|
189
|
-
const moduleUrl = ${JSON.stringify(configUrl)};
|
|
190
|
-
const mod = await import(moduleUrl);
|
|
191
|
-
const value = mod.gameMetadata ?? mod.airjam?.metadata ?? null;
|
|
192
|
-
process.stdout.write(JSON.stringify(value));
|
|
193
|
-
`;
|
|
194
|
-
|
|
195
|
-
const result = runCommandResult({
|
|
196
|
-
command: process.execPath,
|
|
197
|
-
args: ["--import", tsxLoaderPath, "--input-type=module", "--eval", script],
|
|
198
|
-
cwd: path.dirname(configPath),
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
if (!result.ok) {
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const raw = result.stdout.trim();
|
|
206
|
-
if (!raw) {
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
try {
|
|
211
|
-
return airJamGameMetadataSchema.parse(JSON.parse(raw) as unknown);
|
|
212
|
-
} catch {
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
120
|
export const readLocalHostedGameDefaults = async ({
|
|
218
121
|
cwd = process.cwd(),
|
|
219
122
|
}: {
|
|
220
123
|
cwd?: string;
|
|
221
124
|
} = {}): Promise<AirJamLocalHostedGameDefaults> => {
|
|
222
125
|
const game = await inspectGame({ cwd });
|
|
223
|
-
const [
|
|
224
|
-
loadTemplateManifest(game.rootDir),
|
|
126
|
+
const [packageJson, sourceUrl] = await Promise.all([
|
|
225
127
|
readPackageJson(game.rootDir),
|
|
226
|
-
loadGameMetadataFromConfig(game.configPath),
|
|
227
128
|
resolveRepoSourceUrl({ projectDir: game.rootDir }),
|
|
228
129
|
]);
|
|
229
130
|
|
|
131
|
+
const metadata = game.declaration.metadata;
|
|
230
132
|
return {
|
|
231
133
|
projectDir: game.rootDir,
|
|
232
134
|
configPath: game.configPath,
|
|
233
|
-
manifestPath:
|
|
135
|
+
manifestPath: game.manifestPath,
|
|
234
136
|
packageJsonPath: packageJson?.path ?? null,
|
|
235
137
|
packageName: game.packageName,
|
|
236
138
|
sourceUrl,
|
|
237
139
|
metadata: {
|
|
238
|
-
name: metadata
|
|
239
|
-
slug: metadata
|
|
240
|
-
description: metadata
|
|
241
|
-
category: metadata
|
|
242
|
-
tags:
|
|
140
|
+
name: metadata.name,
|
|
141
|
+
slug: metadata.slug,
|
|
142
|
+
description: metadata.tagline,
|
|
143
|
+
category: metadata.category,
|
|
144
|
+
tags: [...(metadata.tags ?? [])],
|
|
243
145
|
},
|
|
244
146
|
template: {
|
|
245
|
-
id:
|
|
246
|
-
name:
|
|
247
|
-
description:
|
|
248
|
-
category:
|
|
147
|
+
id: metadata.slug,
|
|
148
|
+
name: metadata.name,
|
|
149
|
+
description: metadata.tagline,
|
|
150
|
+
category: metadata.category,
|
|
249
151
|
},
|
|
250
152
|
};
|
|
251
153
|
};
|