@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/README.md
CHANGED
|
@@ -1,25 +1,62 @@
|
|
|
1
1
|
# @playdrop/playdrop-cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
Command-line interface for creators and AI agents using Playdrop.
|
|
4
|
+
|
|
5
|
+
## Main Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
playdrop auth login
|
|
9
|
+
playdrop browse
|
|
10
|
+
playdrop search "city builder"
|
|
11
|
+
playdrop detail playdrop/app/hangingout
|
|
12
|
+
playdrop comments browse playdrop/app/hangingout
|
|
13
|
+
playdrop versions browse playdrop/app/hangingout
|
|
14
|
+
playdrop credits balance
|
|
15
|
+
playdrop notifications browse
|
|
16
|
+
playdrop creations browse
|
|
17
|
+
playdrop ai create image "Pixel art hero portrait"
|
|
18
|
+
playdrop project init .
|
|
19
|
+
playdrop project create app my-app --template playdrop/template/html_template
|
|
20
|
+
playdrop project dev my-app
|
|
21
|
+
playdrop project publish .
|
|
22
|
+
playdrop documentation browse
|
|
23
|
+
playdrop feedback send --title "Bug report" --comment "Details here."
|
|
24
|
+
playdrop getting-started
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Ref Format
|
|
28
|
+
|
|
29
|
+
Public content refs are always:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
<creator>/<kind>/<name>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Valid kinds:
|
|
36
|
+
|
|
37
|
+
- `app`
|
|
38
|
+
- `asset`
|
|
39
|
+
- `asset-pack`
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
|
|
43
|
+
- `playdrop/app/hangingout`
|
|
44
|
+
- `playdrop/asset/astro`
|
|
45
|
+
- `playdrop/asset-pack/starter-kit`
|
|
46
|
+
|
|
47
|
+
## Local Project Flow
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
playdrop auth login
|
|
51
|
+
playdrop project init .
|
|
52
|
+
playdrop project create app my-app --template playdrop/template/html_template
|
|
53
|
+
playdrop project dev my-app
|
|
54
|
+
playdrop project publish .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
playdrop documentation browse
|
|
61
|
+
playdrop documentation read getting-started.md
|
|
62
|
+
```
|
package/config/client-meta.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.
|
|
2
|
+
"version": "0.3.5",
|
|
3
3
|
"build": 1,
|
|
4
4
|
"platforms": {
|
|
5
5
|
"ios": {
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
},
|
|
27
27
|
"clients": {
|
|
28
28
|
"web": {
|
|
29
|
-
"minimumVersion": "0.3.
|
|
29
|
+
"minimumVersion": "0.3.5",
|
|
30
30
|
"minimumBuild": 1
|
|
31
31
|
},
|
|
32
32
|
"admin": {
|
|
33
|
-
"minimumVersion": "0.3.
|
|
33
|
+
"minimumVersion": "0.3.5",
|
|
34
34
|
"minimumBuild": 1
|
|
35
35
|
},
|
|
36
36
|
"apple": {
|
|
37
|
-
"minimumVersion": "0.3.
|
|
37
|
+
"minimumVersion": "0.3.5",
|
|
38
38
|
"minimumBuild": 1
|
|
39
39
|
},
|
|
40
40
|
"cli": {
|
|
41
|
-
"minimumVersion": "0.3.
|
|
41
|
+
"minimumVersion": "0.3.5",
|
|
42
42
|
"minimumBuild": 1
|
|
43
43
|
}
|
|
44
44
|
}
|
package/dist/apps/upload.js
CHANGED
|
@@ -47,6 +47,10 @@ async function uploadApp(client, task, artifacts, options) {
|
|
|
47
47
|
* Upload an app version using the versioned API.
|
|
48
48
|
*/
|
|
49
49
|
async function uploadAppVersion(client, task, artifacts, options) {
|
|
50
|
+
const creatorUsername = typeof options?.creatorUsername === 'string' ? options.creatorUsername.trim() : '';
|
|
51
|
+
if (!creatorUsername) {
|
|
52
|
+
throw new Error(`Missing creator username for app "${task.name}" upload.`);
|
|
53
|
+
}
|
|
50
54
|
const versionOptions = {
|
|
51
55
|
version: task.version,
|
|
52
56
|
releaseNotes: task.releaseNotes,
|
|
@@ -59,8 +63,6 @@ async function uploadAppVersion(client, task, artifacts, options) {
|
|
|
59
63
|
type: task.type,
|
|
60
64
|
emoji: task.emoji ?? undefined,
|
|
61
65
|
color: task.color ?? undefined,
|
|
62
|
-
// Admin-only: publish as different user
|
|
63
|
-
creatorUsername: options?.creatorUsername,
|
|
64
66
|
};
|
|
65
67
|
// For EXTERNAL hosting mode, use externalUrl instead of bundle
|
|
66
68
|
if (task.hostingMode === 'EXTERNAL') {
|
|
@@ -105,7 +107,7 @@ async function uploadAppVersion(client, task, artifacts, options) {
|
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
try {
|
|
108
|
-
const response = await client.uploadAppVersion(task.name, versionOptions);
|
|
110
|
+
const response = await client.uploadAppVersion(creatorUsername, task.name, versionOptions);
|
|
109
111
|
return {
|
|
110
112
|
versionCreated: true,
|
|
111
113
|
version: response?.version?.version,
|
|
@@ -93,7 +93,7 @@ const MODEL_PRESET_BY_SUBCATEGORY = {
|
|
|
93
93
|
height: 1024,
|
|
94
94
|
},
|
|
95
95
|
};
|
|
96
|
-
const TOOL_NAME = 'playdrop
|
|
96
|
+
const TOOL_NAME = 'playdrop';
|
|
97
97
|
const WORKER_ENTRY_BASENAMES = ['model-worker.ts', 'model-worker.js'];
|
|
98
98
|
let workerBundlePromise = null;
|
|
99
99
|
function normalizeRole(role) {
|
package/dist/catalogue.d.ts
CHANGED
|
@@ -79,6 +79,9 @@ export type AssetPackCatalogueEntry = {
|
|
|
79
79
|
version?: string;
|
|
80
80
|
username?: string;
|
|
81
81
|
assets?: string[];
|
|
82
|
+
hostingMode?: string;
|
|
83
|
+
externalUrl?: string;
|
|
84
|
+
downloadUrl?: string;
|
|
82
85
|
previewApp?: string;
|
|
83
86
|
visibility?: string;
|
|
84
87
|
releaseNotes?: string;
|
|
@@ -187,6 +190,9 @@ export type AssetPackTask = {
|
|
|
187
190
|
cataloguePath: string;
|
|
188
191
|
username?: string;
|
|
189
192
|
assets: string[];
|
|
193
|
+
hostingMode?: AppHostingMode;
|
|
194
|
+
externalUrl?: string;
|
|
195
|
+
downloadUrl?: string;
|
|
190
196
|
previewApp?: string;
|
|
191
197
|
visibility?: string;
|
|
192
198
|
releaseNotes?: string;
|
package/dist/catalogue.js
CHANGED
|
@@ -1110,7 +1110,41 @@ function buildAssetPackTasks(catalogues) {
|
|
|
1110
1110
|
const assets = Array.isArray(entry.assets)
|
|
1111
1111
|
? entry.assets.filter((value) => typeof value === 'string' && value.trim().length > 0).map((value) => value.trim())
|
|
1112
1112
|
: [];
|
|
1113
|
-
|
|
1113
|
+
let hostingMode;
|
|
1114
|
+
const rawHostingMode = typeof entry.hostingMode === 'string' ? entry.hostingMode.trim().toUpperCase() : '';
|
|
1115
|
+
if (rawHostingMode) {
|
|
1116
|
+
if (!types_1.APP_HOSTING_MODE_VALUES.includes(rawHostingMode)) {
|
|
1117
|
+
errors.push(`[${label}] Asset pack "${name}" hostingMode must be one of ${types_1.APP_HOSTING_MODE_VALUES.join(', ')}.`);
|
|
1118
|
+
continue;
|
|
1119
|
+
}
|
|
1120
|
+
hostingMode = rawHostingMode;
|
|
1121
|
+
}
|
|
1122
|
+
let externalUrl;
|
|
1123
|
+
const rawExternalUrl = typeof entry.externalUrl === 'string' ? entry.externalUrl.trim() : '';
|
|
1124
|
+
if (rawExternalUrl) {
|
|
1125
|
+
if (!/^https:\/\//i.test(rawExternalUrl)) {
|
|
1126
|
+
errors.push(`[${label}] Asset pack "${name}" externalUrl must be an HTTPS URL.`);
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
externalUrl = rawExternalUrl;
|
|
1130
|
+
}
|
|
1131
|
+
let downloadUrl;
|
|
1132
|
+
const rawDownloadUrl = typeof entry.downloadUrl === 'string' ? entry.downloadUrl.trim() : '';
|
|
1133
|
+
if (rawDownloadUrl) {
|
|
1134
|
+
if (!/^https:\/\//i.test(rawDownloadUrl)) {
|
|
1135
|
+
errors.push(`[${label}] Asset pack "${name}" downloadUrl must be an HTTPS URL.`);
|
|
1136
|
+
continue;
|
|
1137
|
+
}
|
|
1138
|
+
downloadUrl = rawDownloadUrl;
|
|
1139
|
+
}
|
|
1140
|
+
if (hostingMode === 'EXTERNAL' && !externalUrl) {
|
|
1141
|
+
errors.push(`[${label}] Asset pack "${name}" externalUrl is required when hostingMode is EXTERNAL.`);
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1144
|
+
if (externalUrl && hostingMode !== 'EXTERNAL') {
|
|
1145
|
+
hostingMode = 'EXTERNAL';
|
|
1146
|
+
}
|
|
1147
|
+
if (assets.length === 0 && hostingMode !== 'EXTERNAL') {
|
|
1114
1148
|
errors.push(`[${label}] Asset pack "${name}" must reference at least one asset.`);
|
|
1115
1149
|
continue;
|
|
1116
1150
|
}
|
|
@@ -1289,6 +1323,9 @@ function buildAssetPackTasks(catalogues) {
|
|
|
1289
1323
|
cataloguePath: label,
|
|
1290
1324
|
username,
|
|
1291
1325
|
assets,
|
|
1326
|
+
hostingMode,
|
|
1327
|
+
externalUrl,
|
|
1328
|
+
downloadUrl,
|
|
1292
1329
|
previewApp: typeof entry.previewApp === 'string' && entry.previewApp.trim().length > 0 ? entry.previewApp.trim() : undefined,
|
|
1293
1330
|
visibility,
|
|
1294
1331
|
releaseNotes: typeof entry.releaseNotes === 'string' ? entry.releaseNotes : undefined,
|
package/dist/commandContext.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export type EnvironmentContext = {
|
|
|
12
12
|
};
|
|
13
13
|
type EnvironmentCallback = (ctx: EnvironmentContext) => Promise<void> | void;
|
|
14
14
|
export declare function withEnvironment(command: string, actionLabel: string, callback: EnvironmentCallback): Promise<void>;
|
|
15
|
+
export declare function withPublicEnvironment(command: string, callback: EnvironmentCallback): Promise<void>;
|
|
15
16
|
export {};
|
package/dist/commandContext.js
CHANGED
|
@@ -1,40 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withEnvironment = withEnvironment;
|
|
4
|
+
exports.withPublicEnvironment = withPublicEnvironment;
|
|
4
5
|
const config_1 = require("./config");
|
|
5
6
|
const apiClient_1 = require("./apiClient");
|
|
6
7
|
const environment_1 = require("./environment");
|
|
7
8
|
const messages_1 = require("./messages");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const DEFAULT_PUBLIC_ENV = 'prod';
|
|
10
|
+
function resolveConfiguredEnvironment(cfg, command, options) {
|
|
11
|
+
const configuredEnv = typeof cfg.env === 'string' && cfg.env.trim().length > 0
|
|
12
|
+
? cfg.env.trim()
|
|
13
|
+
: undefined;
|
|
14
|
+
if (!configuredEnv && options.requireAuth) {
|
|
11
15
|
(0, messages_1.printConfigEnvironmentMissing)(command);
|
|
12
16
|
process.exitCode = 1;
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (!cfg.token) {
|
|
16
|
-
(0, messages_1.printLoginRequired)(actionLabel, command);
|
|
17
|
-
process.exitCode = 1;
|
|
18
|
-
return;
|
|
17
|
+
return null;
|
|
19
18
|
}
|
|
20
|
-
const
|
|
19
|
+
const envName = configuredEnv ?? (options.allowDefaultPublicEnv ? DEFAULT_PUBLIC_ENV : undefined);
|
|
20
|
+
const envConfig = (0, environment_1.resolveEnvironmentConfig)(envName);
|
|
21
21
|
if (!envConfig) {
|
|
22
22
|
const choices = (0, environment_1.formatEnvironmentList)();
|
|
23
|
-
(0, messages_1.printUnknownEnvironment)(
|
|
23
|
+
(0, messages_1.printUnknownEnvironment)(envName || '', choices, command);
|
|
24
24
|
process.exitCode = 1;
|
|
25
|
-
return;
|
|
25
|
+
return null;
|
|
26
26
|
}
|
|
27
27
|
if (envConfig.allowInsecureRequests) {
|
|
28
28
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
29
29
|
}
|
|
30
|
+
return envConfig;
|
|
31
|
+
}
|
|
32
|
+
function buildContext(cfg, envConfig) {
|
|
30
33
|
const client = (0, apiClient_1.createCliApiClient)({ baseUrl: envConfig.apiBase, token: cfg.token });
|
|
31
34
|
const aiClient = (0, apiClient_1.createCliAiClient)({ baseUrl: envConfig.aiBase, token: cfg.token });
|
|
32
|
-
|
|
35
|
+
return {
|
|
33
36
|
client,
|
|
34
37
|
aiClient,
|
|
35
|
-
env:
|
|
38
|
+
env: envConfig.name,
|
|
36
39
|
envConfig,
|
|
37
|
-
token: cfg.token,
|
|
40
|
+
token: cfg.token || '',
|
|
38
41
|
config: cfg,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async function withEnvironment(command, actionLabel, callback) {
|
|
45
|
+
const cfg = (0, config_1.loadConfig)();
|
|
46
|
+
if (!cfg.token) {
|
|
47
|
+
(0, messages_1.printLoginRequired)(actionLabel, command);
|
|
48
|
+
process.exitCode = 1;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const envConfig = resolveConfiguredEnvironment(cfg, command, {
|
|
52
|
+
requireAuth: true,
|
|
53
|
+
allowDefaultPublicEnv: false,
|
|
39
54
|
});
|
|
55
|
+
if (!envConfig) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
await callback(buildContext(cfg, envConfig));
|
|
59
|
+
}
|
|
60
|
+
async function withPublicEnvironment(command, callback) {
|
|
61
|
+
const cfg = (0, config_1.loadConfig)();
|
|
62
|
+
const envConfig = resolveConfiguredEnvironment(cfg, command, {
|
|
63
|
+
requireAuth: false,
|
|
64
|
+
allowDefaultPublicEnv: true,
|
|
65
|
+
});
|
|
66
|
+
if (!envConfig) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
await callback(buildContext(cfg, envConfig));
|
|
40
70
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type BrowseKind = 'app' | 'asset' | 'asset-pack' | 'all';
|
|
2
|
+
export type BrowseCreator = 'all' | 'me' | string;
|
|
3
|
+
export type BrowseOptions = {
|
|
4
|
+
kind?: string;
|
|
5
|
+
creator?: string;
|
|
6
|
+
appType?: string;
|
|
7
|
+
assetCategory?: string;
|
|
8
|
+
assetSubcategory?: string;
|
|
9
|
+
limit?: string | number;
|
|
10
|
+
offset?: string | number;
|
|
11
|
+
json?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function browse(options?: BrowseOptions): Promise<void>;
|
|
14
|
+
export declare function browseCategories(options?: {
|
|
15
|
+
json?: boolean;
|
|
16
|
+
}): Promise<void>;
|