@playdrop/playdrop-cli 0.7.13 → 0.7.16
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/config/client-meta.json +1 -1
- package/node_modules/@playdrop/ai-client/dist/index.js +461 -444
- package/node_modules/@playdrop/ai-client/package.json +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +903 -882
- package/node_modules/@playdrop/api-client/dist/core/errors.js +69 -45
- package/node_modules/@playdrop/api-client/dist/core/request.js +188 -159
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +516 -491
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +40 -14
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +480 -462
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +439 -419
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +696 -676
- package/node_modules/@playdrop/api-client/dist/domains/auth.js +346 -320
- package/node_modules/@playdrop/api-client/dist/domains/comments.js +124 -98
- package/node_modules/@playdrop/api-client/dist/domains/free-credits.js +91 -65
- package/node_modules/@playdrop/api-client/dist/domains/me.js +71 -45
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +407 -386
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.js +144 -118
- package/node_modules/@playdrop/api-client/dist/domains/search.js +117 -104
- package/node_modules/@playdrop/api-client/dist/domains/tags.js +188 -162
- package/node_modules/@playdrop/api-client/dist/index.js +993 -552
- package/node_modules/@playdrop/api-client/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/animations.js +84 -62
- package/node_modules/@playdrop/boxel-three/dist/src/builders.js +341 -308
- package/node_modules/@playdrop/boxel-three/dist/src/context.js +55 -29
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +856 -858
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.js +267 -261
- package/node_modules/@playdrop/boxel-three/dist/src/index.js +64 -15
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.js +89 -63
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +81 -56
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.js +112 -86
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.js +45 -17
- package/node_modules/@playdrop/boxel-three/dist/src/scene.js +160 -136
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.js +582 -584
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.js +123 -97
- package/node_modules/@playdrop/boxel-three/dist/src/textures.js +207 -182
- package/node_modules/@playdrop/boxel-three/dist/src/types.js +15 -1
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.js +451 -425
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.js +109 -84
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.js +127 -106
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.js +73 -51
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +97 -79
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.js +29 -7
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +80 -60
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.js +41 -19
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.js +72 -50
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.js +84 -62
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +69 -47
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.js +129 -109
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.js +40 -18
- package/node_modules/@playdrop/boxel-three/package.json +1 -1
- package/node_modules/@playdrop/config/client-meta.json +1 -1
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/types/dist/api.js +289 -203
- package/node_modules/@playdrop/types/dist/app-capability-filters.js +112 -62
- package/node_modules/@playdrop/types/dist/app.js +91 -45
- package/node_modules/@playdrop/types/dist/asset-pack.js +37 -5
- package/node_modules/@playdrop/types/dist/asset-spec.js +170 -90
- package/node_modules/@playdrop/types/dist/asset.js +186 -108
- package/node_modules/@playdrop/types/dist/content-license.js +49 -15
- package/node_modules/@playdrop/types/dist/creator-public-image.js +60 -32
- package/node_modules/@playdrop/types/dist/ecs.js +102 -82
- package/node_modules/@playdrop/types/dist/engine-builtins.js +603 -573
- package/node_modules/@playdrop/types/dist/entity.js +63 -53
- package/node_modules/@playdrop/types/dist/graph.js +116 -80
- package/node_modules/@playdrop/types/dist/index.js +47 -20
- package/node_modules/@playdrop/types/dist/owned-assets.js +55 -33
- package/node_modules/@playdrop/types/dist/player-meta.js +151 -100
- package/node_modules/@playdrop/types/dist/realtime.js +27 -7
- package/node_modules/@playdrop/types/dist/version.js +182 -124
- package/node_modules/@playdrop/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,478 +1,496 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var apps_exports = {};
|
|
19
|
+
__export(apps_exports, {
|
|
20
|
+
buildAppsApiClientMethods: () => buildAppsApiClientMethods
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(apps_exports);
|
|
23
|
+
var import_request = require("../core/request.js");
|
|
24
|
+
function buildPublicAppPath(normalizeCreatorItemSlug, creatorUsername, appName, suffix = "") {
|
|
25
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
26
|
+
const name = normalizeCreatorItemSlug(appName, "name");
|
|
27
|
+
return `/apps/${encodeURIComponent(creator)}/${encodeURIComponent(name)}${suffix}`;
|
|
6
28
|
}
|
|
7
29
|
function appendNormalizedTagParams(params, tags) {
|
|
8
|
-
|
|
9
|
-
|
|
30
|
+
if (!Array.isArray(tags)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
for (const tag of tags) {
|
|
34
|
+
if (typeof tag !== "string") {
|
|
35
|
+
continue;
|
|
10
36
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
const normalized = tag.trim();
|
|
16
|
-
if (normalized.length > 0) {
|
|
17
|
-
params.append('tag', normalized);
|
|
18
|
-
}
|
|
37
|
+
const normalized = tag.trim();
|
|
38
|
+
if (normalized.length > 0) {
|
|
39
|
+
params.append("tag", normalized);
|
|
19
40
|
}
|
|
41
|
+
}
|
|
20
42
|
}
|
|
21
43
|
function appendAppCapabilityFilterParams(params, filters) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
if (typeof filters.auth === "string" && filters.auth.trim().length > 0) {
|
|
45
|
+
params.set("auth", filters.auth.trim());
|
|
46
|
+
}
|
|
47
|
+
if (typeof filters.controller === "string" && filters.controller.trim().length > 0) {
|
|
48
|
+
params.set("controller", filters.controller.trim());
|
|
49
|
+
}
|
|
50
|
+
if (filters.controllerCompatible === true) {
|
|
51
|
+
params.set("controllerCompatible", "1");
|
|
52
|
+
}
|
|
53
|
+
if (typeof filters.surface === "string" && filters.surface.trim().length > 0) {
|
|
54
|
+
params.set("surface", filters.surface.trim());
|
|
55
|
+
}
|
|
34
56
|
}
|
|
35
57
|
function appendFinitePaginationParam(params, key, value) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
59
|
+
params.set(key, String(value));
|
|
60
|
+
}
|
|
39
61
|
}
|
|
40
62
|
async function buildAuthorizedHeaders(getClientHeaders, resolveToken) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
const headers = new Headers();
|
|
64
|
+
for (const [key, value] of Object.entries(getClientHeaders())) {
|
|
65
|
+
headers.set(key, value);
|
|
66
|
+
}
|
|
67
|
+
const token = await resolveToken();
|
|
68
|
+
if (token) {
|
|
69
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
70
|
+
}
|
|
71
|
+
return headers;
|
|
50
72
|
}
|
|
51
73
|
async function fetchAppsByCreatorRequest(request, handleApiError, creatorUsername, options = {}) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const normalizedCreator = creatorUsername.trim();
|
|
75
|
+
const params = new URLSearchParams();
|
|
76
|
+
if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
|
|
77
|
+
params.set("limit", String(options.limit));
|
|
78
|
+
}
|
|
79
|
+
if (typeof options.offset === "number" && Number.isFinite(options.offset)) {
|
|
80
|
+
params.set("offset", String(options.offset));
|
|
81
|
+
}
|
|
82
|
+
if (typeof options.type === "string" && options.type.trim().length > 0) {
|
|
83
|
+
params.set("type", options.type.trim());
|
|
84
|
+
}
|
|
85
|
+
if (typeof options.sort === "string" && options.sort.trim().length > 0) {
|
|
86
|
+
params.set("sort", options.sort.trim());
|
|
87
|
+
}
|
|
88
|
+
appendAppCapabilityFilterParams(params, options);
|
|
89
|
+
appendNormalizedTagParams(params, options.tags);
|
|
90
|
+
const query = params.toString();
|
|
91
|
+
const response = await request({
|
|
92
|
+
method: "GET",
|
|
93
|
+
path: `/creators/${encodeURIComponent(normalizedCreator)}/apps` + (query ? `?${query}` : "")
|
|
94
|
+
});
|
|
95
|
+
if (response.status !== 200) {
|
|
96
|
+
handleApiError(response, "fetch_apps_by_creator");
|
|
97
|
+
}
|
|
98
|
+
return response.body;
|
|
77
99
|
}
|
|
78
100
|
async function buildAppUploadAuthorizedHeaders(input) {
|
|
79
|
-
|
|
101
|
+
return await buildAuthorizedHeaders(input.getClientHeaders, input.resolveToken);
|
|
80
102
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
path: `${buildPublicAppPath(normalizeCreatorItemSlug, creatorUsername, appName)}/remix${params.size > 0 ? `?${params.toString()}` : ''}`,
|
|
471
|
-
});
|
|
472
|
-
if (response.status !== 200) {
|
|
473
|
-
handleApiError(response, 'fetch_remix_scaffold');
|
|
474
|
-
}
|
|
475
|
-
return response.body;
|
|
476
|
-
},
|
|
477
|
-
};
|
|
103
|
+
function buildAppsApiClientMethods(input) {
|
|
104
|
+
const { request, handleApiError, fetchImpl, includeBrowserCredentials, resolveBaseUrl, resolveUrl, parseResponseBody, resolveToken, getClientHeaders, buildCreatorAppMutationPath, normalizeCreatorItemSlug, normalizeSemverInput, parseContentDispositionFilename } = input;
|
|
105
|
+
return {
|
|
106
|
+
async fetchApps(options = {}) {
|
|
107
|
+
const params = new URLSearchParams();
|
|
108
|
+
if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
|
|
109
|
+
params.set("limit", String(options.limit));
|
|
110
|
+
}
|
|
111
|
+
if (typeof options.offset === "number" && Number.isFinite(options.offset)) {
|
|
112
|
+
params.set("offset", String(options.offset));
|
|
113
|
+
}
|
|
114
|
+
if (typeof options.sort === "string" && options.sort.trim().length > 0) {
|
|
115
|
+
params.set("sort", options.sort.trim());
|
|
116
|
+
}
|
|
117
|
+
appendAppCapabilityFilterParams(params, options);
|
|
118
|
+
appendNormalizedTagParams(params, options.tags);
|
|
119
|
+
const query = params.toString();
|
|
120
|
+
const response = await request({
|
|
121
|
+
method: "GET",
|
|
122
|
+
path: "/apps" + (query ? `?${query}` : "")
|
|
123
|
+
});
|
|
124
|
+
if (response.status !== 200) {
|
|
125
|
+
handleApiError(response, "fetch_apps");
|
|
126
|
+
}
|
|
127
|
+
return response.body;
|
|
128
|
+
},
|
|
129
|
+
async fetchAppsByType(type, options = {}) {
|
|
130
|
+
const params = new URLSearchParams();
|
|
131
|
+
if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
|
|
132
|
+
params.set("limit", String(options.limit));
|
|
133
|
+
}
|
|
134
|
+
if (typeof options.offset === "number" && Number.isFinite(options.offset)) {
|
|
135
|
+
params.set("offset", String(options.offset));
|
|
136
|
+
}
|
|
137
|
+
if (typeof options.sort === "string" && options.sort.trim().length > 0) {
|
|
138
|
+
params.set("sort", options.sort.trim());
|
|
139
|
+
}
|
|
140
|
+
appendAppCapabilityFilterParams(params, options);
|
|
141
|
+
appendNormalizedTagParams(params, options.tags);
|
|
142
|
+
const query = params.toString();
|
|
143
|
+
const response = await request({
|
|
144
|
+
method: "GET",
|
|
145
|
+
path: `/apps/types/${encodeURIComponent(type)}` + (query ? `?${query}` : "")
|
|
146
|
+
});
|
|
147
|
+
if (response.status !== 200) {
|
|
148
|
+
handleApiError(response, "fetch_apps_by_type");
|
|
149
|
+
}
|
|
150
|
+
return response.body;
|
|
151
|
+
},
|
|
152
|
+
async fetchAppsByCreator(creatorUsername, options = {}) {
|
|
153
|
+
return fetchAppsByCreatorRequest(request, handleApiError, creatorUsername, options);
|
|
154
|
+
},
|
|
155
|
+
async fetchAppBySlug(creatorUsername, appName, options = {}) {
|
|
156
|
+
const params = new URLSearchParams();
|
|
157
|
+
if (options.includeDependencies === true) {
|
|
158
|
+
params.set("includeDependencies", "1");
|
|
159
|
+
}
|
|
160
|
+
const response = await request({
|
|
161
|
+
method: "GET",
|
|
162
|
+
path: `/apps/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(appName)}${params.size > 0 ? `?${params.toString()}` : ""}`
|
|
163
|
+
});
|
|
164
|
+
if (response.status !== 200) {
|
|
165
|
+
handleApiError(response, "fetch_app");
|
|
166
|
+
}
|
|
167
|
+
return response.body;
|
|
168
|
+
},
|
|
169
|
+
async fetchAppMoreCollections(creatorUsername, appName, options = {}) {
|
|
170
|
+
const params = new URLSearchParams();
|
|
171
|
+
appendFinitePaginationParam(params, "limit", options.limit);
|
|
172
|
+
const response = await request({
|
|
173
|
+
method: "GET",
|
|
174
|
+
path: `${buildPublicAppPath(normalizeCreatorItemSlug, creatorUsername, appName, "/more")}${params.size > 0 ? `?${params.toString()}` : ""}`
|
|
175
|
+
});
|
|
176
|
+
if (response.status !== 200) {
|
|
177
|
+
handleApiError(response, "fetch_app_more_collections");
|
|
178
|
+
}
|
|
179
|
+
return response.body;
|
|
180
|
+
},
|
|
181
|
+
async fetchAppMoreCollectionPage(creatorUsername, appName, collectionKey, options = {}) {
|
|
182
|
+
const params = new URLSearchParams();
|
|
183
|
+
appendFinitePaginationParam(params, "limit", options.limit);
|
|
184
|
+
appendFinitePaginationParam(params, "offset", options.offset);
|
|
185
|
+
const response = await request({
|
|
186
|
+
method: "GET",
|
|
187
|
+
path: `${buildPublicAppPath(normalizeCreatorItemSlug, creatorUsername, appName, `/more/${encodeURIComponent(collectionKey)}`)}${params.size > 0 ? `?${params.toString()}` : ""}`
|
|
188
|
+
});
|
|
189
|
+
if (response.status !== 200) {
|
|
190
|
+
handleApiError(response, "fetch_app_more_collection_page");
|
|
191
|
+
}
|
|
192
|
+
return response.body;
|
|
193
|
+
},
|
|
194
|
+
async requestAppAccessToken(appId) {
|
|
195
|
+
const response = await request({
|
|
196
|
+
method: "POST",
|
|
197
|
+
path: `/apps/${encodeURIComponent(String(appId))}/token`
|
|
198
|
+
});
|
|
199
|
+
if (response.status !== 200) {
|
|
200
|
+
handleApiError(response, "request_app_access_token");
|
|
201
|
+
}
|
|
202
|
+
return response.body;
|
|
203
|
+
},
|
|
204
|
+
async sendAppLog(appId, entry) {
|
|
205
|
+
const response = await request({
|
|
206
|
+
method: "POST",
|
|
207
|
+
path: `/apps/${encodeURIComponent(String(appId))}/logs`,
|
|
208
|
+
body: entry
|
|
209
|
+
});
|
|
210
|
+
if (response.status !== 200) {
|
|
211
|
+
handleApiError(response, "send_app_log");
|
|
212
|
+
}
|
|
213
|
+
return response.body;
|
|
214
|
+
},
|
|
215
|
+
async createApp(creatorUsername, createRequest) {
|
|
216
|
+
const response = await request({
|
|
217
|
+
method: "POST",
|
|
218
|
+
path: buildCreatorAppMutationPath(creatorUsername),
|
|
219
|
+
body: createRequest
|
|
220
|
+
});
|
|
221
|
+
if (response.status !== 200) {
|
|
222
|
+
handleApiError(response, "create_app");
|
|
223
|
+
}
|
|
224
|
+
return response.body;
|
|
225
|
+
},
|
|
226
|
+
async updateApp(creatorUsername, name, updateRequest) {
|
|
227
|
+
const response = await request({
|
|
228
|
+
method: "PATCH",
|
|
229
|
+
path: buildCreatorAppMutationPath(creatorUsername, name),
|
|
230
|
+
body: updateRequest
|
|
231
|
+
});
|
|
232
|
+
if (response.status !== 200) {
|
|
233
|
+
handleApiError(response, "update_app");
|
|
234
|
+
}
|
|
235
|
+
return response.body;
|
|
236
|
+
},
|
|
237
|
+
async initializeAppUpload(creatorUsername, appName, requestBody) {
|
|
238
|
+
const response = await request({
|
|
239
|
+
method: "POST",
|
|
240
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions`,
|
|
241
|
+
body: requestBody
|
|
242
|
+
});
|
|
243
|
+
if (response.status !== 200) {
|
|
244
|
+
handleApiError(response, "initialize_app_upload");
|
|
245
|
+
}
|
|
246
|
+
return response.body;
|
|
247
|
+
},
|
|
248
|
+
async uploadAppSessionFile(creatorUsername, appName, sessionId, fileKey, options) {
|
|
249
|
+
const form = new FormData();
|
|
250
|
+
const filename = typeof options.filename === "string" && options.filename.trim().length > 0 ? options.filename.trim() : "upload.bin";
|
|
251
|
+
form.append("file", options.file, filename);
|
|
252
|
+
const base = resolveBaseUrl();
|
|
253
|
+
const headers = await buildAppUploadAuthorizedHeaders({ getClientHeaders, resolveToken });
|
|
254
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/files/${encodeURIComponent(fileKey)}`;
|
|
255
|
+
const response = await fetchImpl(resolveUrl(base, path), {
|
|
256
|
+
method: "POST",
|
|
257
|
+
headers,
|
|
258
|
+
body: form,
|
|
259
|
+
...(0, import_request.buildBrowserCredentialsInit)(includeBrowserCredentials)
|
|
260
|
+
});
|
|
261
|
+
const parsed = await parseResponseBody(response);
|
|
262
|
+
const apiResponse = { status: response.status, body: parsed, headers: response.headers };
|
|
263
|
+
if (response.status !== 200) {
|
|
264
|
+
handleApiError(apiResponse, "upload_app_session_file");
|
|
265
|
+
}
|
|
266
|
+
return parsed;
|
|
267
|
+
},
|
|
268
|
+
async uploadAppSessionOwnedAsset(creatorUsername, appName, sessionId, uploadKey, options) {
|
|
269
|
+
const form = new FormData();
|
|
270
|
+
for (const entry of options.files) {
|
|
271
|
+
const fieldName = typeof entry.fieldName === "string" && entry.fieldName.trim().length > 0 ? entry.fieldName.trim() : "file";
|
|
272
|
+
const filename = typeof entry.filename === "string" && entry.filename.trim().length > 0 ? entry.filename.trim() : "upload.bin";
|
|
273
|
+
form.append(fieldName, entry.file, filename);
|
|
274
|
+
}
|
|
275
|
+
const base = resolveBaseUrl();
|
|
276
|
+
const headers = await buildAppUploadAuthorizedHeaders({ getClientHeaders, resolveToken });
|
|
277
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/owned-assets/${encodeURIComponent(uploadKey)}`;
|
|
278
|
+
const response = await fetchImpl(resolveUrl(base, path), {
|
|
279
|
+
method: "POST",
|
|
280
|
+
headers,
|
|
281
|
+
body: form,
|
|
282
|
+
...(0, import_request.buildBrowserCredentialsInit)(includeBrowserCredentials)
|
|
283
|
+
});
|
|
284
|
+
const parsed = await parseResponseBody(response);
|
|
285
|
+
const apiResponse = { status: response.status, body: parsed, headers: response.headers };
|
|
286
|
+
if (response.status !== 200) {
|
|
287
|
+
handleApiError(apiResponse, "upload_app_session_owned_asset");
|
|
288
|
+
}
|
|
289
|
+
return parsed;
|
|
290
|
+
},
|
|
291
|
+
async finalizeAppUpload(creatorUsername, appName, sessionId) {
|
|
292
|
+
const response = await request({
|
|
293
|
+
method: "POST",
|
|
294
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/finalize`
|
|
295
|
+
});
|
|
296
|
+
if (response.status !== 200) {
|
|
297
|
+
handleApiError(response, "finalize_app_upload");
|
|
298
|
+
}
|
|
299
|
+
return response.body;
|
|
300
|
+
},
|
|
301
|
+
async fetchAppUploadLaunchCheckPreview(creatorUsername, appName, sessionId) {
|
|
302
|
+
const response = await request({
|
|
303
|
+
method: "GET",
|
|
304
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/launch-check/preview`
|
|
305
|
+
});
|
|
306
|
+
if (response.status !== 200) {
|
|
307
|
+
handleApiError(response, "fetch_app_upload_launch_check_preview");
|
|
308
|
+
}
|
|
309
|
+
return response.body;
|
|
310
|
+
},
|
|
311
|
+
async recordAppUploadLaunchCheck(creatorUsername, appName, sessionId, requestBody) {
|
|
312
|
+
const response = await request({
|
|
313
|
+
method: "POST",
|
|
314
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/launch-check`,
|
|
315
|
+
body: requestBody
|
|
316
|
+
});
|
|
317
|
+
if (response.status !== 200) {
|
|
318
|
+
handleApiError(response, "record_app_upload_launch_check");
|
|
319
|
+
}
|
|
320
|
+
return response.body;
|
|
321
|
+
},
|
|
322
|
+
async abortAppUpload(creatorUsername, appName, sessionId) {
|
|
323
|
+
const response = await request({
|
|
324
|
+
method: "POST",
|
|
325
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/abort`
|
|
326
|
+
});
|
|
327
|
+
if (response.status !== 200) {
|
|
328
|
+
handleApiError(response, "abort_app_upload");
|
|
329
|
+
}
|
|
330
|
+
return response.body;
|
|
331
|
+
},
|
|
332
|
+
async fetchAppRelated(creatorUsername, appName) {
|
|
333
|
+
const response = await request({
|
|
334
|
+
method: "GET",
|
|
335
|
+
path: buildPublicAppPath(normalizeCreatorItemSlug, creatorUsername, appName, "/related")
|
|
336
|
+
});
|
|
337
|
+
if (response.status !== 200) {
|
|
338
|
+
handleApiError(response, "get_app_related");
|
|
339
|
+
}
|
|
340
|
+
return response.body;
|
|
341
|
+
},
|
|
342
|
+
async requestDevAppAccessToken(appId, slot) {
|
|
343
|
+
const response = await request({
|
|
344
|
+
method: "POST",
|
|
345
|
+
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/token`
|
|
346
|
+
});
|
|
347
|
+
if (response.status !== 200) {
|
|
348
|
+
handleApiError(response, "request_dev_app_access_token");
|
|
349
|
+
}
|
|
350
|
+
return response.body;
|
|
351
|
+
},
|
|
352
|
+
async resetDevPlayer(appId, slot) {
|
|
353
|
+
const response = await request({
|
|
354
|
+
method: "POST",
|
|
355
|
+
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/reset`
|
|
356
|
+
});
|
|
357
|
+
if (response.status !== 200) {
|
|
358
|
+
handleApiError(response, "reset_dev_player");
|
|
359
|
+
}
|
|
360
|
+
return response.body;
|
|
361
|
+
},
|
|
362
|
+
async resetAllDevPlayers(appId) {
|
|
363
|
+
const response = await request({
|
|
364
|
+
method: "POST",
|
|
365
|
+
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/reset-all`
|
|
366
|
+
});
|
|
367
|
+
if (response.status !== 200) {
|
|
368
|
+
handleApiError(response, "reset_all_dev_players");
|
|
369
|
+
}
|
|
370
|
+
return response.body;
|
|
371
|
+
},
|
|
372
|
+
async listAppVersions(creatorUsername, appName) {
|
|
373
|
+
const path = `/apps/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(appName)}/versions`;
|
|
374
|
+
const response = await request({
|
|
375
|
+
method: "GET",
|
|
376
|
+
path
|
|
377
|
+
});
|
|
378
|
+
if (response.status !== 200) {
|
|
379
|
+
handleApiError(response, "list_app_versions");
|
|
380
|
+
}
|
|
381
|
+
return response.body;
|
|
382
|
+
},
|
|
383
|
+
async getAppVersion(creatorUsername, appName, version) {
|
|
384
|
+
const normalizedVersion = normalizeSemverInput(version);
|
|
385
|
+
const path = `/apps/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(appName)}/versions/${encodeURIComponent(normalizedVersion)}`;
|
|
386
|
+
const response = await request({
|
|
387
|
+
method: "GET",
|
|
388
|
+
path
|
|
389
|
+
});
|
|
390
|
+
if (response.status !== 200) {
|
|
391
|
+
handleApiError(response, "get_app_version");
|
|
392
|
+
}
|
|
393
|
+
return response.body;
|
|
394
|
+
},
|
|
395
|
+
async fetchAppRuntimeAssets(creatorUsername, appName, version) {
|
|
396
|
+
const normalizedVersion = normalizeSemverInput(version);
|
|
397
|
+
const path = `/apps/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(appName)}/versions/${encodeURIComponent(normalizedVersion)}/runtime-assets`;
|
|
398
|
+
const response = await request({
|
|
399
|
+
method: "GET",
|
|
400
|
+
path
|
|
401
|
+
});
|
|
402
|
+
if (response.status !== 200) {
|
|
403
|
+
handleApiError(response, "fetch_app_runtime_assets");
|
|
404
|
+
}
|
|
405
|
+
return response.body;
|
|
406
|
+
},
|
|
407
|
+
async downloadAppSource(creatorUsername, appName, version) {
|
|
408
|
+
const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
|
|
409
|
+
const name = normalizeCreatorItemSlug(appName, "name");
|
|
410
|
+
const normalizedVersion = normalizeSemverInput(version);
|
|
411
|
+
const path = `/apps/${encodeURIComponent(creator)}/${encodeURIComponent(name)}/versions/${encodeURIComponent(normalizedVersion)}/source`;
|
|
412
|
+
const base = resolveBaseUrl();
|
|
413
|
+
const headers = new Headers();
|
|
414
|
+
for (const [key, value] of Object.entries(getClientHeaders())) {
|
|
415
|
+
headers.set(key, value);
|
|
416
|
+
}
|
|
417
|
+
const token = await resolveToken();
|
|
418
|
+
if (token) {
|
|
419
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
420
|
+
}
|
|
421
|
+
const response = await fetchImpl(resolveUrl(base, path), {
|
|
422
|
+
method: "GET",
|
|
423
|
+
headers,
|
|
424
|
+
...(0, import_request.buildBrowserCredentialsInit)(includeBrowserCredentials)
|
|
425
|
+
});
|
|
426
|
+
if (!response.ok) {
|
|
427
|
+
const parsed = await parseResponseBody(response);
|
|
428
|
+
handleApiError({ status: response.status, body: parsed, headers: response.headers }, "download_app_source");
|
|
429
|
+
}
|
|
430
|
+
const blob = await response.blob();
|
|
431
|
+
const filename = parseContentDispositionFilename(response.headers.get("content-disposition")) ?? `${name}-${normalizedVersion}-source.zip`;
|
|
432
|
+
const headerSize = response.headers.get("content-length");
|
|
433
|
+
const parsedSize = headerSize ? Number.parseInt(headerSize, 10) : Number.NaN;
|
|
434
|
+
const checksumHeader = response.headers.get("x-app-source-checksum");
|
|
435
|
+
return {
|
|
436
|
+
blob,
|
|
437
|
+
metadata: {
|
|
438
|
+
filename,
|
|
439
|
+
sizeBytes: Number.isFinite(parsedSize) && parsedSize >= 0 ? parsedSize : blob.size,
|
|
440
|
+
checksum: checksumHeader ?? null
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
},
|
|
444
|
+
async updateAppVersion(creatorUsername, appName, version, updates) {
|
|
445
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/versions/${encodeURIComponent(version)}`;
|
|
446
|
+
const response = await request({
|
|
447
|
+
method: "PATCH",
|
|
448
|
+
path,
|
|
449
|
+
body: updates
|
|
450
|
+
});
|
|
451
|
+
if (response.status !== 200) {
|
|
452
|
+
handleApiError(response, "update_app_version");
|
|
453
|
+
}
|
|
454
|
+
return response.body;
|
|
455
|
+
},
|
|
456
|
+
async deleteAppVersion(creatorUsername, appName, version) {
|
|
457
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/versions/${encodeURIComponent(version)}`;
|
|
458
|
+
const response = await request({
|
|
459
|
+
method: "DELETE",
|
|
460
|
+
path
|
|
461
|
+
});
|
|
462
|
+
if (response.status !== 200) {
|
|
463
|
+
handleApiError(response, "delete_app_version");
|
|
464
|
+
}
|
|
465
|
+
return response.body;
|
|
466
|
+
},
|
|
467
|
+
async deleteApp(creatorUsername, name) {
|
|
468
|
+
const response = await request({
|
|
469
|
+
method: "DELETE",
|
|
470
|
+
path: buildCreatorAppMutationPath(creatorUsername, name)
|
|
471
|
+
});
|
|
472
|
+
if (response.status !== 200) {
|
|
473
|
+
handleApiError(response, "delete_app");
|
|
474
|
+
}
|
|
475
|
+
return response.body;
|
|
476
|
+
},
|
|
477
|
+
async fetchRemixScaffold(creatorUsername, appName, version) {
|
|
478
|
+
const params = new URLSearchParams();
|
|
479
|
+
if (typeof version === "string" && version.trim().length > 0) {
|
|
480
|
+
params.set("version", version.trim());
|
|
481
|
+
}
|
|
482
|
+
const response = await request({
|
|
483
|
+
method: "GET",
|
|
484
|
+
path: `${buildPublicAppPath(normalizeCreatorItemSlug, creatorUsername, appName)}/remix${params.size > 0 ? `?${params.toString()}` : ""}`
|
|
485
|
+
});
|
|
486
|
+
if (response.status !== 200) {
|
|
487
|
+
handleApiError(response, "fetch_remix_scaffold");
|
|
488
|
+
}
|
|
489
|
+
return response.body;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
478
492
|
}
|
|
493
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
494
|
+
0 && (module.exports = {
|
|
495
|
+
buildAppsApiClientMethods
|
|
496
|
+
});
|