@dropthis/cli 0.21.0 → 0.22.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
@@ -916,13 +916,13 @@ async function runDoctor(_input, deps) {
916
916
  const authSource = credential?.source ?? "missing";
917
917
  const storageBackend = stored?.storage ?? "none";
918
918
  const pairs = [
919
- ["Version", "0.21.0"],
919
+ ["Version", "0.22.0"],
920
920
  ["Auth", authSource],
921
921
  ["Storage", storageBackend]
922
922
  ];
923
923
  writeKv(deps, pairs, {
924
924
  ok: true,
925
- version: "0.21.0",
925
+ version: "0.22.0",
926
926
  auth: { source: authSource },
927
927
  storage: { backend: storageBackend }
928
928
  });
@@ -2059,6 +2059,15 @@ function contentOptions(options) {
2059
2059
  if (options.path !== void 0) out.path = options.path;
2060
2060
  return out;
2061
2061
  }
2062
+ function partialOptions(raw) {
2063
+ const out = {};
2064
+ if (raw.replace) out.mode = "replace";
2065
+ else if (raw.mode !== void 0) out.mode = raw.mode;
2066
+ if (raw.deletePaths !== void 0 && raw.deletePaths.length > 0) {
2067
+ out.deletePaths = raw.deletePaths;
2068
+ }
2069
+ return out;
2070
+ }
2062
2071
  async function runUpdateContent(target, input, raw, deps) {
2063
2072
  const apiKey = raw.apiKey ?? deps.apiKey;
2064
2073
  try {
@@ -2116,7 +2125,11 @@ async function runUpdateContent(target, input, raw, deps) {
2116
2125
  dropId,
2117
2126
  input,
2118
2127
  withIdempotencyKey(
2119
- { ...contentOptions(parsed), ...revisionOptions },
2128
+ {
2129
+ ...contentOptions(parsed),
2130
+ ...partialOptions(raw),
2131
+ ...revisionOptions
2132
+ },
2120
2133
  "upd"
2121
2134
  )
2122
2135
  );
@@ -2767,7 +2780,7 @@ function buildProgram(options = {}) {
2767
2780
  ` ${import_picocolors6.default.cyan("dropthis login")}`,
2768
2781
  ` ${import_picocolors6.default.cyan("dropthis publish ./dist")}`
2769
2782
  ].join("\n")
2770
- ).version("0.21.0").configureHelp({
2783
+ ).version("0.22.0").configureHelp({
2771
2784
  subcommandTerm(cmd) {
2772
2785
  const args = cmd.registeredArguments.map((a) => {
2773
2786
  const name = a.name();
@@ -2925,6 +2938,15 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
2925
2938
  ).option("--path <name>", "Set filename for stdin content").option(
2926
2939
  "--manifest <file>",
2927
2940
  "Update content from a multi-file bundle defined in a JSON file (path, content/source_url/content_base64 per file). Cannot combine with a positional input."
2941
+ ).option(
2942
+ "--mode <mode>",
2943
+ "patch (default: provided files upsert, the rest carry forward) or replace (provided files become the whole content set)",
2944
+ parseMode
2945
+ ).option("--replace", "Shortcut for --mode replace (full content swap)").option(
2946
+ "--delete-path <path>",
2947
+ "Remove a file by path (patch-mode only; repeatable). Invalid with --replace.",
2948
+ collect,
2949
+ []
2928
2950
  ).option(
2929
2951
  "--if-revision <n>",
2930
2952
  "Fail if current revision doesn't match (optimistic lock)",
@@ -2965,10 +2987,16 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
2965
2987
  process.exitCode = writeError(deps, "invalid_usage", msg).exitCode;
2966
2988
  return;
2967
2989
  }
2990
+ const deletePaths = commandOptions.deletePath ?? [];
2991
+ const updateOpts = {
2992
+ ...dropOpts,
2993
+ ...commandOptions.replace ? { mode: "replace" } : commandOptions.mode !== void 0 ? { mode: commandOptions.mode } : {},
2994
+ ...deletePaths.length > 0 ? { deletePaths } : {}
2995
+ };
2968
2996
  const result = await runUpdateContent(
2969
2997
  dropId,
2970
2998
  updateInput,
2971
- dropOpts,
2999
+ updateOpts,
2972
3000
  deps
2973
3001
  );
2974
3002
  process.exitCode = result.exitCode;
@@ -3354,7 +3382,7 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
3354
3382
  );
3355
3383
  const result = await runUpgrade(commandOptions, {
3356
3384
  ...deps,
3357
- currentVersion: "0.21.0"
3385
+ currentVersion: "0.22.0"
3358
3386
  });
3359
3387
  process.exitCode = result.exitCode;
3360
3388
  });
@@ -3477,6 +3505,15 @@ function parseInteger(value) {
3477
3505
  if (Number.isNaN(n)) throw new import_commander.InvalidArgumentError("Expected an integer.");
3478
3506
  return n;
3479
3507
  }
3508
+ function parseMode(value) {
3509
+ if (value !== "patch" && value !== "replace") {
3510
+ throw new import_commander.InvalidArgumentError('Use "patch" or "replace".');
3511
+ }
3512
+ return value;
3513
+ }
3514
+ function collect(value, previous) {
3515
+ return [...previous, value];
3516
+ }
3480
3517
  async function resolvePublishInputs(inputs, stdin, stdinIsTTY) {
3481
3518
  if (inputs.length === 0) {
3482
3519
  if (stdinIsTTY) return void 0;
@@ -3599,7 +3636,7 @@ var showNotice = shouldShowNotice({
3599
3636
  if (showNotice) {
3600
3637
  const notice = noticeFromCache({
3601
3638
  cache: updateCache,
3602
- currentVersion: "0.21.0"
3639
+ currentVersion: "0.22.0"
3603
3640
  });
3604
3641
  if (notice) {
3605
3642
  process.stderr.write(`