@prisma/cli 3.0.0-dev.132.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
  });
@@ -1510,13 +1510,21 @@ function requireDeploymentForApp(deployments, deploymentId, appName) {
1510
1510
  nextSteps: ["prisma-cli app list-deploys"]
1511
1511
  });
1512
1512
  }
1513
+ /**
1514
+ * Resolves the app's live deployment from the app pointer, the provider's live
1515
+ * flag, then locally cached state.
1516
+ *
1517
+ * @returns the live deployment id, or null when no authoritative signal exists.
1518
+ * Callers must treat null as "not known to be live" rather than assuming the
1519
+ * newest deployment is live.
1520
+ */
1513
1521
  async function resolveCurrentLiveDeploymentId(context, projectId, app, deployments) {
1514
1522
  if (app.liveDeploymentId && deployments.some((deployment) => deployment.id === app.liveDeploymentId)) return app.liveDeploymentId;
1515
1523
  const providerLiveDeployment = deployments.find((deployment) => deployment.live === true);
1516
1524
  if (providerLiveDeployment) return providerLiveDeployment.id;
1517
1525
  const knownLiveDeploymentId = await context.stateStore.readKnownLiveDeployment(projectId, app.id);
1518
1526
  if (knownLiveDeploymentId && deployments.some((deployment) => deployment.id === knownLiveDeploymentId)) return knownLiveDeploymentId;
1519
- return deployments[0]?.id ?? null;
1527
+ return null;
1520
1528
  }
1521
1529
  function buildAppShowNextSteps(liveUrl, liveDeployment, deployments) {
1522
1530
  const nextSteps = [];
@@ -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.132.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": {