@prisma/cli 3.0.0-dev.133.1 → 3.0.0-dev.135.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.
@@ -58,9 +58,11 @@ function createBucketCreateCommand(runtime) {
58
58
  function createBucketDeleteCommand(runtime) {
59
59
  const command = attachCommandDescriptor(configureRuntimeCommand(new Command("delete"), runtime), "bucket.delete");
60
60
  command.argument("<bucketId>", "Bucket id");
61
+ command.addOption(new Option("--confirm <bucket-id>", "Exact bucket id to confirm deletion"));
61
62
  addGlobalFlags(command);
62
63
  command.action(async (bucketId, options) => {
63
- await runCommand(runtime, "bucket.delete", options, (context) => runBucketDelete(context, bucketId), {
64
+ const confirm = options.confirm;
65
+ await runCommand(runtime, "bucket.delete", options, (context) => runBucketDelete(context, bucketId, { confirm }), {
64
66
  renderHuman: (context, descriptor, result) => renderBucketDelete(context, descriptor, result),
65
67
  renderJson: (result) => serializeBucketDelete(result)
66
68
  });
@@ -48,7 +48,7 @@ async function runBucketCreate(context, flags) {
48
48
  nextSteps: []
49
49
  };
50
50
  }
51
- async function runBucketDelete(context, bucketId) {
51
+ async function runBucketDelete(context, bucketId, flags) {
52
52
  const id = bucketId.trim();
53
53
  if (!id) throw new CliError({
54
54
  code: "USAGE_ERROR",
@@ -59,6 +59,19 @@ async function runBucketDelete(context, bucketId) {
59
59
  exitCode: 2,
60
60
  nextSteps: ["prisma-cli bucket list"]
61
61
  });
62
+ if (flags.confirm !== id) throw new CliError({
63
+ code: "CONFIRMATION_REQUIRED",
64
+ domain: "bucket",
65
+ summary: "Confirm bucket deletion",
66
+ why: "Deleting this bucket permanently removes all objects and access keys.",
67
+ fix: `Rerun with --confirm ${id}.`,
68
+ exitCode: 2,
69
+ nextSteps: [`prisma-cli bucket delete ${id} --confirm ${id}`],
70
+ meta: {
71
+ expectedConfirm: id,
72
+ receivedConfirm: flags.confirm ?? null
73
+ }
74
+ });
62
75
  await (await requireBucketProviderOnly(context)).deleteBucket(id, { signal: context.runtime.signal });
63
76
  return {
64
77
  command: "bucket.delete",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli",
3
- "version": "3.0.0-dev.133.1",
3
+ "version": "3.0.0-dev.135.1",
4
4
  "description": "Command-line interface for the Prisma Developer Platform.",
5
5
  "type": "module",
6
6
  "bin": {