@dropthis/cli 0.24.0 → 0.25.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 CHANGED
@@ -159,6 +159,18 @@ __export(cli_exports, {
159
159
  module.exports = __toCommonJS(cli_exports);
160
160
 
161
161
  // src/output.ts
162
+ function failuresFromApiError(error2) {
163
+ const body = error2.body;
164
+ const raw = body && typeof body === "object" ? body.failures : void 0;
165
+ if (!Array.isArray(raw)) return [];
166
+ return raw.filter(
167
+ (f) => !!f && typeof f === "object" && typeof f.path === "string" && f.path.length > 0
168
+ ).map((f) => ({
169
+ path: String(f.path),
170
+ reason: String(f.reason ?? "unknown"),
171
+ ...typeof f.source_url === "string" ? { sourceUrl: f.source_url } : {}
172
+ }));
173
+ }
162
174
  var UPLOAD_NEXT_ACTIONS = {
163
175
  upload_expired: "Create a new upload session and retry the publish.",
164
176
  upload_already_used: "Create a new upload session; upload sessions are single-use.",
@@ -181,6 +193,7 @@ function errorEnvelope(code, message, nextAction) {
181
193
  };
182
194
  }
183
195
  function apiErrorEnvelope(error2) {
196
+ const failures = failuresFromApiError(error2);
184
197
  return {
185
198
  ok: false,
186
199
  error: {
@@ -193,6 +206,7 @@ function apiErrorEnvelope(error2) {
193
206
  ...error2.requestId ? { request_id: error2.requestId } : {},
194
207
  ...error2.suggestion ? { suggestion: error2.suggestion } : {},
195
208
  ...error2.retryable !== void 0 && error2.retryable !== null ? { retryable: error2.retryable } : {},
209
+ ...failures.length ? { failures } : {},
196
210
  next_action: nextActionForApiError(error2)
197
211
  }
198
212
  };
@@ -423,6 +437,11 @@ function writeApiError(deps, details) {
423
437
  if (deps.outputMode === "human") {
424
438
  deps.stderr(`${error(details.message)}
425
439
  `);
440
+ const failures = failuresFromApiError(details);
441
+ for (const f of failures) {
442
+ deps.stderr(` ${f.path}: ${f.reason}
443
+ `);
444
+ }
426
445
  const nextAction = nextActionForApiError(details, "human");
427
446
  if (nextAction) deps.stderr(`${hint(nextAction)}
428
447
  `);
@@ -918,13 +937,13 @@ async function runDoctor(_input, deps) {
918
937
  const authSource = credential?.source ?? "missing";
919
938
  const storageBackend = stored?.storage ?? "none";
920
939
  const pairs = [
921
- ["Version", "0.24.0"],
940
+ ["Version", "0.25.0"],
922
941
  ["Auth", authSource],
923
942
  ["Storage", storageBackend]
924
943
  ];
925
944
  writeKv(deps, pairs, {
926
945
  ok: true,
927
- version: "0.24.0",
946
+ version: "0.25.0",
928
947
  auth: { source: authSource },
929
948
  storage: { backend: storageBackend }
930
949
  });
@@ -2777,7 +2796,7 @@ function buildProgram(options = {}) {
2777
2796
  ` ${import_picocolors6.default.cyan("dropthis login")}`,
2778
2797
  ` ${import_picocolors6.default.cyan("dropthis publish ./dist")}`
2779
2798
  ].join("\n")
2780
- ).version("0.24.0").configureHelp({
2799
+ ).version("0.25.0").configureHelp({
2781
2800
  subcommandTerm(cmd) {
2782
2801
  const args = cmd.registeredArguments.map((a) => {
2783
2802
  const name = a.name();
@@ -3379,7 +3398,7 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
3379
3398
  );
3380
3399
  const result = await runUpgrade(commandOptions, {
3381
3400
  ...deps,
3382
- currentVersion: "0.24.0"
3401
+ currentVersion: "0.25.0"
3383
3402
  });
3384
3403
  process.exitCode = result.exitCode;
3385
3404
  });
@@ -3633,7 +3652,7 @@ var showNotice = shouldShowNotice({
3633
3652
  if (showNotice) {
3634
3653
  const notice = noticeFromCache({
3635
3654
  cache: updateCache,
3636
- currentVersion: "0.24.0"
3655
+ currentVersion: "0.25.0"
3637
3656
  });
3638
3657
  if (notice) {
3639
3658
  process.stderr.write(`