@dropthis/cli 0.27.0 → 0.28.0
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/dist/cli.cjs +16 -1
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -218,6 +218,7 @@ function normalizeApiErrorCode(error2) {
|
|
|
218
218
|
}
|
|
219
219
|
function nextActionForApiError(error2, mode = "json") {
|
|
220
220
|
const cliHint = cliNextAction(error2);
|
|
221
|
+
if (error2.code === "workspace_choice_required" && cliHint) return cliHint;
|
|
221
222
|
if (mode === "human" && cliHint) return cliHint;
|
|
222
223
|
if (error2.suggestion) return error2.suggestion;
|
|
223
224
|
if (cliHint) return cliHint;
|
|
@@ -229,9 +230,23 @@ function nextActionForApiError(error2, mode = "json") {
|
|
|
229
230
|
}
|
|
230
231
|
return "Fix the request or retry after checking the drop state.";
|
|
231
232
|
}
|
|
233
|
+
function workspaceChoiceSlugs(error2) {
|
|
234
|
+
const body = error2.body;
|
|
235
|
+
const raw = body && typeof body === "object" ? body.choices : void 0;
|
|
236
|
+
if (!Array.isArray(raw)) return [];
|
|
237
|
+
return raw.map(
|
|
238
|
+
(c) => c && typeof c === "object" ? c.slug : void 0
|
|
239
|
+
).filter((s) => typeof s === "string" && s.length > 0);
|
|
240
|
+
}
|
|
232
241
|
function cliNextAction(error2) {
|
|
233
242
|
const uploadNextAction = error2.code ? UPLOAD_NEXT_ACTIONS[error2.code] : void 0;
|
|
234
243
|
if (uploadNextAction) return uploadNextAction;
|
|
244
|
+
if (error2.code === "workspace_choice_required") {
|
|
245
|
+
const slugs = workspaceChoiceSlugs(error2);
|
|
246
|
+
const example = slugs[0] ?? "<slug>";
|
|
247
|
+
const list = slugs.length ? ` Workspaces: ${slugs.join(", ")}.` : "";
|
|
248
|
+
return `This account belongs to more than one workspace \u2014 pick one. Switch it for every later command with: dropthis workspace use ${example} \u2014 or target just this one with: --workspace ${example}.${list}`;
|
|
249
|
+
}
|
|
235
250
|
if (error2.code === "network_error") {
|
|
236
251
|
return "Could not reach the dropthis API \u2014 check your network or DROPTHIS_API_URL.";
|
|
237
252
|
}
|
|
@@ -959,7 +974,7 @@ function spreadData(data) {
|
|
|
959
974
|
}
|
|
960
975
|
|
|
961
976
|
// src/version.ts
|
|
962
|
-
var CLI_VERSION = true ? "0.
|
|
977
|
+
var CLI_VERSION = true ? "0.28.0" : "0.0.0-dev";
|
|
963
978
|
|
|
964
979
|
// src/commands/doctor.ts
|
|
965
980
|
async function runDoctor(_input, deps) {
|