@playdrop/playdrop-cli 0.3.4-build.1 → 0.3.5-build.1
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 -23
- package/config/client-meta.json +5 -5
- package/dist/apps/upload.js +5 -3
- package/dist/assets/model-artifacts.js +1 -1
- package/dist/catalogue.d.ts +6 -0
- package/dist/catalogue.js +38 -1
- package/dist/commandContext.d.ts +1 -0
- package/dist/commandContext.js +45 -15
- package/dist/commands/browse.d.ts +16 -0
- package/dist/commands/browse.js +370 -0
- package/dist/commands/build.js +4 -9
- package/dist/commands/capture.js +24 -24
- package/dist/commands/captureRemote.d.ts +11 -0
- package/dist/commands/captureRemote.js +90 -0
- package/dist/commands/comments.d.ts +14 -0
- package/dist/commands/comments.js +189 -0
- package/dist/commands/create.js +112 -72
- package/dist/commands/creations.d.ts +49 -0
- package/dist/commands/creations.js +657 -0
- package/dist/commands/credits.d.ts +10 -0
- package/dist/commands/credits.js +91 -0
- package/dist/commands/detail.d.ts +2 -2
- package/dist/commands/detail.js +148 -290
- package/dist/commands/dev.js +24 -24
- package/dist/commands/devShared.js +2 -2
- package/dist/commands/documentation.d.ts +4 -1
- package/dist/commands/documentation.js +79 -104
- package/dist/commands/feedback.d.ts +12 -9
- package/dist/commands/feedback.js +125 -257
- package/dist/commands/format.js +6 -13
- package/dist/commands/generation.d.ts +11 -0
- package/dist/commands/generation.js +204 -42
- package/dist/commands/gettingStarted.d.ts +1 -0
- package/dist/commands/gettingStarted.js +26 -0
- package/dist/commands/init.js +26 -24
- package/dist/commands/login.js +9 -8
- package/dist/commands/logout.js +2 -1
- package/dist/commands/notifications.d.ts +14 -0
- package/dist/commands/notifications.js +179 -0
- package/dist/commands/search.d.ts +13 -0
- package/dist/commands/search.js +198 -0
- package/dist/commands/upload.js +20 -17
- package/dist/commands/validate.js +15 -1
- package/dist/commands/versionsBrowse.d.ts +7 -0
- package/dist/commands/versionsBrowse.js +209 -0
- package/dist/commands/whoami.js +9 -8
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +52 -0
- package/dist/externalAssetPackValidation.d.ts +2 -0
- package/dist/externalAssetPackValidation.js +115 -0
- package/dist/http.js +1 -1
- package/dist/index.js +570 -630
- package/dist/messages.js +11 -11
- package/dist/output.d.ts +5 -0
- package/dist/output.js +45 -0
- package/dist/playwright.js +1 -1
- package/dist/refs.d.ts +18 -0
- package/dist/refs.js +105 -0
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +42 -15
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/ai-client/package.json +1 -0
- package/node_modules/@playdrop/api-client/dist/client.d.ts +39 -27
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +280 -1669
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts +9 -0
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/core/errors.js +46 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +27 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/core/request.js +122 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +75 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +282 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +22 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +15 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +60 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +301 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +59 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +297 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +62 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +297 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +28 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.js +78 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +29 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.js +65 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts +24 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.js +35 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +37 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +148 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts +27 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.js +65 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +33 -56
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +103 -44
- package/node_modules/@playdrop/api-client/package.json +3 -2
- package/node_modules/@playdrop/boxel-core/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/package.json +2 -1
- package/node_modules/@playdrop/config/client-meta.json +5 -5
- package/node_modules/@playdrop/config/dist/src/constants.d.ts +5 -0
- package/node_modules/@playdrop/config/dist/src/constants.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/constants.js +5 -1
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/config/package.json +1 -1
- package/node_modules/@playdrop/types/dist/api.d.ts +178 -17
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +30 -1
- package/node_modules/@playdrop/types/dist/app.d.ts +0 -14
- package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/app.js +0 -10
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +11 -1
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +65 -0
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/realtime.d.ts +26 -26
- package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.d.ts +5 -0
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/package.json +2 -3
- package/bin/playdrop-cli +0 -2
- package/dist/commands/asset-packs.d.ts +0 -27
- package/dist/commands/asset-packs.js +0 -508
- package/dist/commands/assets.d.ts +0 -35
- package/dist/commands/assets.js +0 -668
- package/dist/commands/list.d.ts +0 -7
- package/dist/commands/list.js +0 -347
- package/dist/commands/migrateCatalogueV2.d.ts +0 -1
- package/dist/commands/migrateCatalogueV2.js +0 -142
- package/dist/commands/versions.d.ts +0 -17
- package/dist/commands/versions.js +0 -384
package/dist/commands/list.js
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.list = list;
|
|
4
|
-
const types_1 = require("@playdrop/types");
|
|
5
|
-
const http_1 = require("../http");
|
|
6
|
-
const messages_1 = require("../messages");
|
|
7
|
-
const commandContext_1 = require("../commandContext");
|
|
8
|
-
const ALL_APP_TYPES = [...types_1.APP_TYPE_VALUES];
|
|
9
|
-
function normalizePluralCandidate(value) {
|
|
10
|
-
const trimmed = value.trim();
|
|
11
|
-
if (trimmed.length > 1 && trimmed.toUpperCase().endsWith('S')) {
|
|
12
|
-
return trimmed.slice(0, -1);
|
|
13
|
-
}
|
|
14
|
-
return trimmed;
|
|
15
|
-
}
|
|
16
|
-
function parseAppTypeOption(value) {
|
|
17
|
-
const normalized = normalizePluralCandidate(value).toUpperCase();
|
|
18
|
-
return (0, types_1.parseAppType)(normalized);
|
|
19
|
-
}
|
|
20
|
-
function resolveTypeSelection(raw) {
|
|
21
|
-
if (!raw || raw.trim().length === 0) {
|
|
22
|
-
return { appTypes: ALL_APP_TYPES, includeAssets: true, includePacks: true };
|
|
23
|
-
}
|
|
24
|
-
const normalized = raw.trim().toLowerCase();
|
|
25
|
-
if (normalized === 'all') {
|
|
26
|
-
return { appTypes: ALL_APP_TYPES, includeAssets: true, includePacks: true };
|
|
27
|
-
}
|
|
28
|
-
if (normalized === 'app' || normalized === 'apps') {
|
|
29
|
-
return { appTypes: ALL_APP_TYPES, includeAssets: false, includePacks: false };
|
|
30
|
-
}
|
|
31
|
-
if (normalized === 'asset' || normalized === 'assets') {
|
|
32
|
-
return { appTypes: [], includeAssets: true, includePacks: false };
|
|
33
|
-
}
|
|
34
|
-
if (normalized === 'pack' || normalized === 'packs' || normalized === 'asset-pack' || normalized === 'asset-packs') {
|
|
35
|
-
return { appTypes: [], includeAssets: false, includePacks: true };
|
|
36
|
-
}
|
|
37
|
-
const appType = parseAppTypeOption(normalized);
|
|
38
|
-
if (appType) {
|
|
39
|
-
return { appTypes: [appType], includeAssets: false, includePacks: false };
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
function resolveCreatorSelection(raw) {
|
|
44
|
-
if (!raw || raw.trim().length === 0) {
|
|
45
|
-
return { kind: 'all' };
|
|
46
|
-
}
|
|
47
|
-
const normalized = raw.trim().toLowerCase();
|
|
48
|
-
if (normalized === 'me') {
|
|
49
|
-
return { kind: 'me' };
|
|
50
|
-
}
|
|
51
|
-
if (normalized === 'all') {
|
|
52
|
-
return { kind: 'all' };
|
|
53
|
-
}
|
|
54
|
-
if (normalized.includes(' ')) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return { kind: 'creator', username: raw.trim() };
|
|
58
|
-
}
|
|
59
|
-
function resolveMaxValue(raw) {
|
|
60
|
-
if (raw === undefined) {
|
|
61
|
-
return 10;
|
|
62
|
-
}
|
|
63
|
-
const parsed = typeof raw === 'number' ? raw : Number.parseInt(String(raw), 10);
|
|
64
|
-
if (!Number.isFinite(parsed) || !Number.isInteger(parsed)) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
if (parsed < 1 || parsed > 100) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
return parsed;
|
|
71
|
-
}
|
|
72
|
-
function isNetworkError(error) {
|
|
73
|
-
if (!error || typeof error !== 'object') {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
const candidate = error;
|
|
77
|
-
if (candidate instanceof TypeError) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
const code = typeof candidate.code === 'string' ? candidate.code : undefined;
|
|
81
|
-
if (code === 'ECONNREFUSED' || code === 'ENOTFOUND') {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
const cause = candidate.cause;
|
|
85
|
-
if (cause && typeof cause === 'object' && typeof cause.code === 'string') {
|
|
86
|
-
const nestedCode = cause.code;
|
|
87
|
-
return nestedCode === 'ECONNREFUSED' || nestedCode === 'ENOTFOUND';
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
async function fetchCurrentUsername(client) {
|
|
92
|
-
try {
|
|
93
|
-
const response = await client.me();
|
|
94
|
-
const username = response?.user?.username;
|
|
95
|
-
if (typeof username === 'string' && username.trim().length > 0) {
|
|
96
|
-
return username.trim();
|
|
97
|
-
}
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
if (error instanceof types_1.UnsupportedClientError) {
|
|
102
|
-
(0, http_1.handleUnsupportedError)(error, 'List');
|
|
103
|
-
}
|
|
104
|
-
if (error instanceof http_1.CLIUnsupportedClientError) {
|
|
105
|
-
throw error;
|
|
106
|
-
}
|
|
107
|
-
if (error instanceof types_1.ApiError) {
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
110
|
-
throw error;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function normalizeCreatorUsername(username) {
|
|
114
|
-
if (!username) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
const trimmed = username.trim();
|
|
118
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
119
|
-
}
|
|
120
|
-
function appTypeToSlug(type) {
|
|
121
|
-
return type.toLowerCase();
|
|
122
|
-
}
|
|
123
|
-
function getDescription(value) {
|
|
124
|
-
if (typeof value !== 'string') {
|
|
125
|
-
return '';
|
|
126
|
-
}
|
|
127
|
-
return value.trim();
|
|
128
|
-
}
|
|
129
|
-
function upsertRecord(recordMap, key, displayName, description, taxonomy) {
|
|
130
|
-
if (!recordMap.has(key)) {
|
|
131
|
-
recordMap.set(key, {
|
|
132
|
-
displayName,
|
|
133
|
-
description: getDescription(description),
|
|
134
|
-
taxonomy: typeof taxonomy === 'string' && taxonomy.trim().length > 0 ? taxonomy.trim() : undefined,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
async function list(options = {}) {
|
|
139
|
-
await (0, commandContext_1.withEnvironment)('list', 'Listing content', async ({ client }) => {
|
|
140
|
-
const typeSelection = resolveTypeSelection(options.type);
|
|
141
|
-
if (!typeSelection) {
|
|
142
|
-
(0, messages_1.printErrorWithHelp)(`Type "${options.type ?? ''}" is not supported.`, [
|
|
143
|
-
'Use one of: all, app(s), game(s), template(s), tool(s), demo(s), asset(s), pack(s).',
|
|
144
|
-
], { command: 'list' });
|
|
145
|
-
process.exitCode = 1;
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const creatorSelection = resolveCreatorSelection(options.creator);
|
|
149
|
-
if (!creatorSelection) {
|
|
150
|
-
(0, messages_1.printErrorWithHelp)('Creator value is invalid.', ['Use "me", "all", or provide a creator slug without spaces.'], { command: 'list' });
|
|
151
|
-
process.exitCode = 1;
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const max = resolveMaxValue(options.max);
|
|
155
|
-
if (max === null) {
|
|
156
|
-
(0, messages_1.printErrorWithHelp)('The --max value must be an integer between 1 and 100.', ['Example: --max 10'], { command: 'list' });
|
|
157
|
-
process.exitCode = 1;
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const activeTypeSelection = typeSelection;
|
|
161
|
-
const activeCreatorSelection = creatorSelection;
|
|
162
|
-
const activeMax = max;
|
|
163
|
-
let resolvedCreatorUsername = null;
|
|
164
|
-
if (activeCreatorSelection.kind === 'me') {
|
|
165
|
-
try {
|
|
166
|
-
resolvedCreatorUsername = await fetchCurrentUsername(client);
|
|
167
|
-
}
|
|
168
|
-
catch (error) {
|
|
169
|
-
if (error instanceof http_1.CLIUnsupportedClientError) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (error instanceof types_1.UnsupportedClientError) {
|
|
173
|
-
(0, http_1.handleUnsupportedError)(error, 'List');
|
|
174
|
-
}
|
|
175
|
-
if (error instanceof types_1.ApiError) {
|
|
176
|
-
(0, messages_1.printErrorWithHelp)(`Failed to resolve your account (status ${error.status}).`, ['Run "playdrop-cli login" to refresh your session, then try again.'], { command: 'list' });
|
|
177
|
-
process.exitCode = 1;
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if (isNetworkError(error)) {
|
|
181
|
-
(0, messages_1.printNetworkIssue)('Could not reach the API to resolve your account.', 'list');
|
|
182
|
-
process.exitCode = 1;
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
throw error;
|
|
186
|
-
}
|
|
187
|
-
resolvedCreatorUsername = normalizeCreatorUsername(resolvedCreatorUsername);
|
|
188
|
-
if (!resolvedCreatorUsername) {
|
|
189
|
-
(0, messages_1.printErrorWithHelp)('The API returned an unexpected response.', ['Retry "playdrop-cli list" in a moment.'], { command: 'list' });
|
|
190
|
-
process.exitCode = 1;
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
else if (activeCreatorSelection.kind === 'creator') {
|
|
195
|
-
resolvedCreatorUsername = normalizeCreatorUsername(activeCreatorSelection.username);
|
|
196
|
-
if (!resolvedCreatorUsername) {
|
|
197
|
-
(0, messages_1.printErrorWithHelp)('Creator slug cannot be empty.', ['Provide a creator username like "playdrop".'], {
|
|
198
|
-
command: 'list',
|
|
199
|
-
});
|
|
200
|
-
process.exitCode = 1;
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
const recordMap = new Map();
|
|
205
|
-
async function listApps() {
|
|
206
|
-
if (activeTypeSelection.appTypes.length === 0) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
try {
|
|
210
|
-
let apps = [];
|
|
211
|
-
if (activeCreatorSelection.kind === 'me') {
|
|
212
|
-
const response = await client.fetchCreatorApps();
|
|
213
|
-
apps = Array.isArray(response?.apps) ? response.apps : [];
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
const response = await client.fetchApps();
|
|
217
|
-
apps = Array.isArray(response?.apps) ? response.apps : [];
|
|
218
|
-
}
|
|
219
|
-
if ((activeCreatorSelection.kind === 'creator' || activeCreatorSelection.kind === 'me') && resolvedCreatorUsername) {
|
|
220
|
-
const creator = resolvedCreatorUsername.toLowerCase();
|
|
221
|
-
apps = apps.filter((app) => app.creatorUsername.toLowerCase() === creator);
|
|
222
|
-
}
|
|
223
|
-
const allowedTypes = new Set(activeTypeSelection.appTypes);
|
|
224
|
-
for (const app of apps) {
|
|
225
|
-
if (!allowedTypes.has(app.type)) {
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
const key = `${app.creatorUsername}/${appTypeToSlug(app.type)}/${app.name}`;
|
|
229
|
-
upsertRecord(recordMap, key, app.displayName || app.name, app.description);
|
|
230
|
-
}
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
if (error instanceof http_1.CLIUnsupportedClientError) {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
if (error instanceof types_1.UnsupportedClientError) {
|
|
238
|
-
(0, http_1.handleUnsupportedError)(error, 'List apps');
|
|
239
|
-
}
|
|
240
|
-
if (error instanceof types_1.ApiError) {
|
|
241
|
-
(0, messages_1.printErrorWithHelp)(`Request failed (status ${error.status}).`, ['Retry in a moment.'], {
|
|
242
|
-
command: 'list',
|
|
243
|
-
});
|
|
244
|
-
process.exitCode = 1;
|
|
245
|
-
return false;
|
|
246
|
-
}
|
|
247
|
-
if (isNetworkError(error)) {
|
|
248
|
-
(0, messages_1.printNetworkIssue)('Could not reach the API to list apps.', 'list');
|
|
249
|
-
process.exitCode = 1;
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
throw error;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
async function listAssets() {
|
|
256
|
-
if (!activeTypeSelection.includeAssets) {
|
|
257
|
-
return true;
|
|
258
|
-
}
|
|
259
|
-
try {
|
|
260
|
-
const response = resolvedCreatorUsername
|
|
261
|
-
? await client.listAssetsForCreator(resolvedCreatorUsername, { limit: activeMax, offset: 0 })
|
|
262
|
-
: await client.listAssets({ limit: activeMax, offset: 0 });
|
|
263
|
-
const rows = Array.isArray(response?.assets) ? response.assets : [];
|
|
264
|
-
for (const asset of rows) {
|
|
265
|
-
const key = `${asset.creatorUsername}/asset/${asset.name}`;
|
|
266
|
-
const taxonomy = asset.currentVersion ? `${asset.category}:${asset.currentVersion.subcategory}` : asset.category;
|
|
267
|
-
upsertRecord(recordMap, key, asset.displayName || asset.name, asset.description, taxonomy);
|
|
268
|
-
}
|
|
269
|
-
return true;
|
|
270
|
-
}
|
|
271
|
-
catch (error) {
|
|
272
|
-
if (error instanceof http_1.CLIUnsupportedClientError) {
|
|
273
|
-
return false;
|
|
274
|
-
}
|
|
275
|
-
if (error instanceof types_1.UnsupportedClientError) {
|
|
276
|
-
(0, http_1.handleUnsupportedError)(error, 'List assets');
|
|
277
|
-
}
|
|
278
|
-
if (error instanceof types_1.ApiError) {
|
|
279
|
-
(0, messages_1.printErrorWithHelp)(`Request failed (status ${error.status}).`, ['Retry in a moment.'], {
|
|
280
|
-
command: 'list',
|
|
281
|
-
});
|
|
282
|
-
process.exitCode = 1;
|
|
283
|
-
return false;
|
|
284
|
-
}
|
|
285
|
-
if (isNetworkError(error)) {
|
|
286
|
-
(0, messages_1.printNetworkIssue)('Could not reach the API to list assets.', 'list');
|
|
287
|
-
process.exitCode = 1;
|
|
288
|
-
return false;
|
|
289
|
-
}
|
|
290
|
-
throw error;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
async function listPacks() {
|
|
294
|
-
if (!activeTypeSelection.includePacks) {
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
try {
|
|
298
|
-
const response = resolvedCreatorUsername
|
|
299
|
-
? await client.listAssetPacksForCreator(resolvedCreatorUsername, { limit: activeMax, offset: 0 })
|
|
300
|
-
: await client.listAssetPacks({ limit: activeMax, offset: 0 });
|
|
301
|
-
const rows = Array.isArray(response?.packs) ? response.packs : [];
|
|
302
|
-
for (const pack of rows) {
|
|
303
|
-
const key = `${pack.creatorUsername}/pack/${pack.name}`;
|
|
304
|
-
upsertRecord(recordMap, key, pack.displayName || pack.name, pack.description);
|
|
305
|
-
}
|
|
306
|
-
return true;
|
|
307
|
-
}
|
|
308
|
-
catch (error) {
|
|
309
|
-
if (error instanceof http_1.CLIUnsupportedClientError) {
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
if (error instanceof types_1.UnsupportedClientError) {
|
|
313
|
-
(0, http_1.handleUnsupportedError)(error, 'List packs');
|
|
314
|
-
}
|
|
315
|
-
if (error instanceof types_1.ApiError) {
|
|
316
|
-
(0, messages_1.printErrorWithHelp)(`Request failed (status ${error.status}).`, ['Retry in a moment.'], {
|
|
317
|
-
command: 'list',
|
|
318
|
-
});
|
|
319
|
-
process.exitCode = 1;
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
if (isNetworkError(error)) {
|
|
323
|
-
(0, messages_1.printNetworkIssue)('Could not reach the API to list packs.', 'list');
|
|
324
|
-
process.exitCode = 1;
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
327
|
-
throw error;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
if (!(await listApps()))
|
|
331
|
-
return;
|
|
332
|
-
if (!(await listAssets()))
|
|
333
|
-
return;
|
|
334
|
-
if (!(await listPacks()))
|
|
335
|
-
return;
|
|
336
|
-
const keys = Array.from(recordMap.keys()).sort((a, b) => a.localeCompare(b)).slice(0, activeMax);
|
|
337
|
-
if (keys.length === 0) {
|
|
338
|
-
console.log('No results found for the selected filters.');
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
for (const key of keys) {
|
|
342
|
-
const entry = recordMap.get(key);
|
|
343
|
-
const taxonomySegment = entry.taxonomy ? `, taxonomy=${entry.taxonomy}` : '';
|
|
344
|
-
console.log(`${key}, ${entry.displayName}, ${entry.description}${taxonomySegment}`);
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function migrateCatalogueV2(target?: string): Promise<void>;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.migrateCatalogueV2 = migrateCatalogueV2;
|
|
4
|
-
const node_fs_1 = require("node:fs");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
const LEGACY_PROFILE_SECTIONS = [
|
|
7
|
-
{ key: 'avatars', profile: 'avatar' },
|
|
8
|
-
{ key: 'humanoids', profile: 'humanoid' },
|
|
9
|
-
{ key: 'creatures', profile: 'creature' },
|
|
10
|
-
{ key: 'blocks', profile: 'block' },
|
|
11
|
-
];
|
|
12
|
-
function resolveCataloguePath(target) {
|
|
13
|
-
const absolute = (0, node_path_1.resolve)(target);
|
|
14
|
-
if (!(0, node_fs_1.existsSync)(absolute)) {
|
|
15
|
-
throw new Error(`Path not found: ${absolute}`);
|
|
16
|
-
}
|
|
17
|
-
if ((0, node_fs_1.statSync)(absolute).isDirectory()) {
|
|
18
|
-
const candidate = (0, node_path_1.join)(absolute, 'catalogue.json');
|
|
19
|
-
if (!(0, node_fs_1.existsSync)(candidate)) {
|
|
20
|
-
throw new Error(`catalogue.json not found in ${absolute}`);
|
|
21
|
-
}
|
|
22
|
-
return candidate;
|
|
23
|
-
}
|
|
24
|
-
if (!(0, node_fs_1.statSync)(absolute).isFile()) {
|
|
25
|
-
throw new Error(`Target is not a file: ${absolute}`);
|
|
26
|
-
}
|
|
27
|
-
return absolute;
|
|
28
|
-
}
|
|
29
|
-
function asString(value) {
|
|
30
|
-
if (typeof value !== 'string') {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
const trimmed = value.trim();
|
|
34
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
35
|
-
}
|
|
36
|
-
function parseLegacyListed(value) {
|
|
37
|
-
const normalized = asString(value)?.toUpperCase();
|
|
38
|
-
if (normalized === 'SHOP') {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
if (normalized === 'DEFAULT') {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
throw new Error(`Invalid avatar visibility value "${String(value)}". Expected SHOP or DEFAULT.`);
|
|
45
|
-
}
|
|
46
|
-
function parseLegacyPriceCredits(value) {
|
|
47
|
-
if (typeof value === 'number' && Number.isFinite(value) && value >= 0) {
|
|
48
|
-
return Math.floor(value);
|
|
49
|
-
}
|
|
50
|
-
if (typeof value === 'string' && value.trim().length > 0 && /^\d+$/.test(value.trim())) {
|
|
51
|
-
return Number.parseInt(value.trim(), 10);
|
|
52
|
-
}
|
|
53
|
-
return 0;
|
|
54
|
-
}
|
|
55
|
-
function migrateLegacySection(sectionKey, profile, rawEntries) {
|
|
56
|
-
if (!Array.isArray(rawEntries)) {
|
|
57
|
-
return [];
|
|
58
|
-
}
|
|
59
|
-
const migrated = [];
|
|
60
|
-
for (let index = 0; index < rawEntries.length; index++) {
|
|
61
|
-
const entry = rawEntries[index];
|
|
62
|
-
if (!entry || typeof entry !== 'object') {
|
|
63
|
-
throw new Error(`Invalid entry at ${sectionKey}[${index}]`);
|
|
64
|
-
}
|
|
65
|
-
const name = asString(entry.name);
|
|
66
|
-
if (!name) {
|
|
67
|
-
throw new Error(`Missing name at ${sectionKey}[${index}]`);
|
|
68
|
-
}
|
|
69
|
-
const mesh = asString(entry.mesh) ?? `${name}.glb`;
|
|
70
|
-
const preview = asString(entry.preview) ?? `${name}.png`;
|
|
71
|
-
const entity = asString(entry.entity);
|
|
72
|
-
if (!entity) {
|
|
73
|
-
throw new Error(`Missing entity definition path at ${sectionKey}[${index}]`);
|
|
74
|
-
}
|
|
75
|
-
const shopListed = profile === 'avatar' ? parseLegacyListed(entry.visibility) : undefined;
|
|
76
|
-
const shopPriceCredits = profile === 'avatar' ? parseLegacyPriceCredits(entry.value) : undefined;
|
|
77
|
-
if (profile === 'avatar') {
|
|
78
|
-
if (shopListed === undefined || shopPriceCredits === undefined) {
|
|
79
|
-
throw new Error(`Invalid avatar commerce values at ${sectionKey}[${index}]`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
migrated.push({
|
|
83
|
-
name,
|
|
84
|
-
category: 'MODEL_3D',
|
|
85
|
-
subcategory: profile,
|
|
86
|
-
files: {
|
|
87
|
-
mesh,
|
|
88
|
-
preview,
|
|
89
|
-
entity,
|
|
90
|
-
},
|
|
91
|
-
...(shopListed !== undefined ? { shopListed } : {}),
|
|
92
|
-
...(shopPriceCredits !== undefined ? { shopPriceCredits } : {}),
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
return migrated;
|
|
96
|
-
}
|
|
97
|
-
async function migrateCatalogueV2(target = '.') {
|
|
98
|
-
const cataloguePath = resolveCataloguePath(target);
|
|
99
|
-
const raw = (0, node_fs_1.readFileSync)(cataloguePath, 'utf8');
|
|
100
|
-
const parsed = raw.trim().length > 0 ? JSON.parse(raw) : {};
|
|
101
|
-
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
102
|
-
throw new Error('catalogue.json must contain an object');
|
|
103
|
-
}
|
|
104
|
-
const input = parsed;
|
|
105
|
-
const existingAssets = Array.isArray(input.assets) ? [...input.assets] : [];
|
|
106
|
-
const migratedAssets = [];
|
|
107
|
-
for (const section of LEGACY_PROFILE_SECTIONS) {
|
|
108
|
-
migratedAssets.push(...migrateLegacySection(section.key, section.profile, input[section.key]));
|
|
109
|
-
}
|
|
110
|
-
if (migratedAssets.length === 0 && input.schemaVersion === 2) {
|
|
111
|
-
console.log(`No legacy entity sections found in ${cataloguePath}. File already uses schemaVersion 2.`);
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const existingAssetNames = new Set();
|
|
115
|
-
for (const entry of existingAssets) {
|
|
116
|
-
if (entry && typeof entry === 'object' && typeof entry.name === 'string') {
|
|
117
|
-
const key = entry.name.trim();
|
|
118
|
-
if (key) {
|
|
119
|
-
existingAssetNames.add(key);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
for (const asset of migratedAssets) {
|
|
124
|
-
if (existingAssetNames.has(asset.name)) {
|
|
125
|
-
throw new Error(`Duplicate asset name after migration: ${asset.name}`);
|
|
126
|
-
}
|
|
127
|
-
existingAssetNames.add(asset.name);
|
|
128
|
-
}
|
|
129
|
-
const output = {
|
|
130
|
-
...input,
|
|
131
|
-
schemaVersion: 2,
|
|
132
|
-
apps: Array.isArray(input.apps) ? input.apps : undefined,
|
|
133
|
-
assets: [...existingAssets, ...migratedAssets],
|
|
134
|
-
assetPacks: Array.isArray(input.assetPacks) ? input.assetPacks : undefined,
|
|
135
|
-
};
|
|
136
|
-
delete output.avatars;
|
|
137
|
-
delete output.humanoids;
|
|
138
|
-
delete output.creatures;
|
|
139
|
-
delete output.blocks;
|
|
140
|
-
(0, node_fs_1.writeFileSync)(cataloguePath, `${JSON.stringify(output, null, 2)}\n`, 'utf8');
|
|
141
|
-
console.log(`Migrated ${migratedAssets.length} legacy entity entries to assets in ${cataloguePath}.`);
|
|
142
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type VersionsListOptions = {
|
|
2
|
-
format?: string;
|
|
3
|
-
creator?: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function listVersions(appKey: string, options?: VersionsListOptions): Promise<void>;
|
|
6
|
-
export declare function setCurrentVersion(appKey: string, version: string, options?: {
|
|
7
|
-
creator?: string;
|
|
8
|
-
}): Promise<void>;
|
|
9
|
-
export declare function publishVersion(appKey: string, version: string, options?: {
|
|
10
|
-
creator?: string;
|
|
11
|
-
}): Promise<void>;
|
|
12
|
-
export declare function unpublishVersion(appKey: string, version: string, options?: {
|
|
13
|
-
creator?: string;
|
|
14
|
-
}): Promise<void>;
|
|
15
|
-
export declare function deleteVersion(appKey: string, version: string, options?: {
|
|
16
|
-
creator?: string;
|
|
17
|
-
}): Promise<void>;
|