@prisma/cli 3.0.0-dev.99.1 → 8.0.0-rc.2

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.
Files changed (87) hide show
  1. package/README.md +3 -1
  2. package/dist/cli.js +15115 -16
  3. package/dist/deploy-framework-C7bQM00A.js +23 -0
  4. package/dist/payload-B88Qvzxk-CrtTXSOe.js +34 -0
  5. package/dist/sender.js +192 -0
  6. package/package.json +22 -18
  7. package/dist/adapters/git.js +0 -54
  8. package/dist/adapters/local-state.js +0 -144
  9. package/dist/adapters/mock-api.js +0 -136
  10. package/dist/adapters/token-storage.js +0 -418
  11. package/dist/cli2.js +0 -119
  12. package/dist/commands/app/index.js +0 -345
  13. package/dist/commands/auth/index.js +0 -96
  14. package/dist/commands/branch/index.js +0 -27
  15. package/dist/commands/database/index.js +0 -159
  16. package/dist/commands/env.js +0 -99
  17. package/dist/commands/git/index.js +0 -36
  18. package/dist/commands/project/index.js +0 -69
  19. package/dist/commands/version/index.js +0 -18
  20. package/dist/controllers/app-env-api.js +0 -54
  21. package/dist/controllers/app-env-file.js +0 -181
  22. package/dist/controllers/app-env.js +0 -502
  23. package/dist/controllers/app.js +0 -2443
  24. package/dist/controllers/auth.js +0 -316
  25. package/dist/controllers/branch.js +0 -103
  26. package/dist/controllers/database.js +0 -318
  27. package/dist/controllers/project.js +0 -731
  28. package/dist/controllers/select-prompt-port.js +0 -12
  29. package/dist/controllers/version.js +0 -12
  30. package/dist/lib/app/app-interaction.js +0 -5
  31. package/dist/lib/app/app-provider.js +0 -544
  32. package/dist/lib/app/branch-database-api.js +0 -102
  33. package/dist/lib/app/branch-database-deploy.js +0 -325
  34. package/dist/lib/app/branch-database.js +0 -215
  35. package/dist/lib/app/build-settings.js +0 -93
  36. package/dist/lib/app/build.js +0 -80
  37. package/dist/lib/app/bun-project.js +0 -45
  38. package/dist/lib/app/compute-config.js +0 -147
  39. package/dist/lib/app/deploy-output.js +0 -24
  40. package/dist/lib/app/deploy-plan.js +0 -58
  41. package/dist/lib/app/deploy-progress.js +0 -100
  42. package/dist/lib/app/domain-guidance.js +0 -14
  43. package/dist/lib/app/env-config.js +0 -67
  44. package/dist/lib/app/env-file.js +0 -82
  45. package/dist/lib/app/env-vars.js +0 -50
  46. package/dist/lib/app/local-dev.js +0 -109
  47. package/dist/lib/app/production-deploy-gate.js +0 -161
  48. package/dist/lib/app/read-branch.js +0 -30
  49. package/dist/lib/auth/auth-ops.js +0 -158
  50. package/dist/lib/auth/client.js +0 -22
  51. package/dist/lib/auth/guard.js +0 -38
  52. package/dist/lib/auth/login.js +0 -330
  53. package/dist/lib/database/provider.js +0 -167
  54. package/dist/lib/diagnostics.js +0 -15
  55. package/dist/lib/fs/home-path.js +0 -24
  56. package/dist/lib/git/local-branch.js +0 -53
  57. package/dist/lib/git/local-status.js +0 -57
  58. package/dist/lib/project/interactive-setup.js +0 -56
  59. package/dist/lib/project/local-pin.js +0 -200
  60. package/dist/lib/project/resolution.js +0 -386
  61. package/dist/lib/project/setup.js +0 -135
  62. package/dist/lib/version.js +0 -55
  63. package/dist/output/patterns.js +0 -90
  64. package/dist/presenters/app-env.js +0 -265
  65. package/dist/presenters/app.js +0 -646
  66. package/dist/presenters/auth.js +0 -183
  67. package/dist/presenters/branch.js +0 -46
  68. package/dist/presenters/database.js +0 -274
  69. package/dist/presenters/project.js +0 -174
  70. package/dist/presenters/verbose-context.js +0 -64
  71. package/dist/presenters/version.js +0 -29
  72. package/dist/shell/command-arguments.js +0 -6
  73. package/dist/shell/command-meta.js +0 -622
  74. package/dist/shell/command-runner.js +0 -112
  75. package/dist/shell/diagnostics-output.js +0 -57
  76. package/dist/shell/errors.js +0 -134
  77. package/dist/shell/global-flags.js +0 -37
  78. package/dist/shell/help.js +0 -89
  79. package/dist/shell/output.js +0 -82
  80. package/dist/shell/prompt.js +0 -41
  81. package/dist/shell/runtime.js +0 -55
  82. package/dist/shell/ui.js +0 -116
  83. package/dist/shell/update-check.js +0 -247
  84. package/dist/use-cases/auth.js +0 -145
  85. package/dist/use-cases/branch.js +0 -47
  86. package/dist/use-cases/create-cli-gateways.js +0 -68
  87. package/dist/use-cases/project.js +0 -30
@@ -1,622 +0,0 @@
1
- //#region src/shell/command-meta.ts
2
- const COMMAND_DESCRIPTOR_ID = Symbol("prisma.commandDescriptorId");
3
- const DESCRIPTORS = [
4
- {
5
- id: "root",
6
- path: ["prisma"],
7
- description: "The Prisma Developer Platform, from your terminal",
8
- examples: ["prisma-cli auth login", "prisma-cli app deploy"],
9
- longDescription: "Deploy your app with isolated infrastructure for every branch"
10
- },
11
- {
12
- id: "version",
13
- path: ["prisma", "version"],
14
- description: "Show CLI build and environment",
15
- examples: ["prisma-cli version", "prisma-cli version --json"]
16
- },
17
- {
18
- id: "auth",
19
- path: ["prisma", "auth"],
20
- description: "Manage local authentication for the CLI",
21
- examples: ["prisma-cli auth login", "prisma-cli auth whoami"]
22
- },
23
- {
24
- id: "auth.login",
25
- path: [
26
- "prisma",
27
- "auth",
28
- "login"
29
- ],
30
- description: "Log in to your Prisma platform account",
31
- examples: ["prisma-cli auth login"]
32
- },
33
- {
34
- id: "auth.logout",
35
- path: [
36
- "prisma",
37
- "auth",
38
- "logout"
39
- ],
40
- description: "Clear stored authentication credentials",
41
- examples: ["prisma-cli auth logout"]
42
- },
43
- {
44
- id: "auth.whoami",
45
- path: [
46
- "prisma",
47
- "auth",
48
- "whoami"
49
- ],
50
- description: "Show the authenticated user and accessible workspace",
51
- examples: ["prisma-cli auth whoami", "prisma-cli auth whoami --json"]
52
- },
53
- {
54
- id: "auth.workspace",
55
- path: [
56
- "prisma",
57
- "auth",
58
- "workspace"
59
- ],
60
- description: "Manage local authenticated workspaces",
61
- examples: [
62
- "prisma-cli auth workspace list",
63
- "prisma-cli auth workspace use",
64
- "prisma-cli auth workspace use wksp_123",
65
- "prisma-cli auth workspace logout wksp_123"
66
- ]
67
- },
68
- {
69
- id: "auth.workspace.list",
70
- path: [
71
- "prisma",
72
- "auth",
73
- "workspace",
74
- "list"
75
- ],
76
- description: "List locally authenticated workspaces",
77
- examples: ["prisma-cli auth workspace list", "prisma-cli auth workspace list --json"]
78
- },
79
- {
80
- id: "auth.workspace.use",
81
- path: [
82
- "prisma",
83
- "auth",
84
- "workspace",
85
- "use"
86
- ],
87
- description: "Switch the local CLI workspace",
88
- examples: [
89
- "prisma-cli auth workspace use",
90
- "prisma-cli auth workspace use wksp_123",
91
- "prisma-cli auth workspace use \"Acme Inc\""
92
- ]
93
- },
94
- {
95
- id: "auth.workspace.logout",
96
- path: [
97
- "prisma",
98
- "auth",
99
- "workspace",
100
- "logout"
101
- ],
102
- description: "Remove one local OAuth workspace session",
103
- examples: ["prisma-cli auth workspace logout wksp_123", "prisma-cli auth workspace logout \"Acme Inc\""]
104
- },
105
- {
106
- id: "project",
107
- path: ["prisma", "project"],
108
- description: "Manage and inspect your Prisma projects",
109
- examples: [
110
- "prisma-cli project list",
111
- "prisma-cli project link proj_123",
112
- "prisma-cli project create my-app"
113
- ]
114
- },
115
- {
116
- id: "app",
117
- path: ["prisma", "app"],
118
- description: "Manage apps and deployments for a project",
119
- examples: ["prisma-cli app deploy", "prisma-cli app deploy --app my-app --framework nextjs --http-port 3000"]
120
- },
121
- {
122
- id: "branch",
123
- path: ["prisma", "branch"],
124
- description: "View your Platform branches",
125
- examples: ["prisma-cli branch list"]
126
- },
127
- {
128
- id: "database",
129
- path: ["prisma", "database"],
130
- description: "Manage Prisma Postgres databases for a project",
131
- examples: [
132
- "prisma-cli database list",
133
- "prisma-cli database create my-db",
134
- "prisma-cli database connection create db_123"
135
- ]
136
- },
137
- {
138
- id: "git",
139
- path: ["prisma", "git"],
140
- description: "Manage Git repository connections for a project",
141
- examples: ["prisma-cli git connect", "prisma-cli git disconnect"]
142
- },
143
- {
144
- id: "project.list",
145
- path: [
146
- "prisma",
147
- "project",
148
- "list"
149
- ],
150
- description: "List all projects in your workspace",
151
- examples: ["prisma-cli project list", "prisma-cli project list --json"]
152
- },
153
- {
154
- id: "project.show",
155
- path: [
156
- "prisma",
157
- "project",
158
- "show"
159
- ],
160
- description: "Show this directory's Project binding",
161
- examples: ["prisma-cli project show", "prisma-cli project show --project proj_123 --json"]
162
- },
163
- {
164
- id: "project.create",
165
- path: [
166
- "prisma",
167
- "project",
168
- "create"
169
- ],
170
- description: "Create a Project and link this directory",
171
- examples: ["prisma-cli project create my-app", "prisma-cli project create my-app --json"]
172
- },
173
- {
174
- id: "project.link",
175
- path: [
176
- "prisma",
177
- "project",
178
- "link"
179
- ],
180
- description: "Link this directory to a Project",
181
- examples: [
182
- "prisma-cli project link",
183
- "prisma-cli project link proj_123",
184
- "prisma-cli project link \"Acme Dashboard\" --json"
185
- ]
186
- },
187
- {
188
- id: "git.connect",
189
- path: [
190
- "prisma",
191
- "git",
192
- "connect"
193
- ],
194
- description: "Connect the resolved project to a GitHub repository",
195
- examples: [
196
- "prisma-cli git connect",
197
- "prisma-cli git connect git@github.com:prisma/prisma-cli.git",
198
- "prisma-cli git connect --project proj_123"
199
- ]
200
- },
201
- {
202
- id: "git.disconnect",
203
- path: [
204
- "prisma",
205
- "git",
206
- "disconnect"
207
- ],
208
- description: "Disconnect the GitHub repository from the resolved project",
209
- examples: ["prisma-cli git disconnect", "prisma-cli git disconnect --project proj_123"]
210
- },
211
- {
212
- id: "branch.list",
213
- path: [
214
- "prisma",
215
- "branch",
216
- "list"
217
- ],
218
- description: "List Platform branches for the resolved project",
219
- examples: ["prisma-cli branch list", "prisma-cli branch list --json"]
220
- },
221
- {
222
- id: "database.list",
223
- path: [
224
- "prisma",
225
- "database",
226
- "list"
227
- ],
228
- description: "List Prisma Postgres databases for the resolved project",
229
- examples: [
230
- "prisma-cli database list",
231
- "prisma-cli database list --branch feature/foo",
232
- "prisma-cli database list --json"
233
- ]
234
- },
235
- {
236
- id: "database.show",
237
- path: [
238
- "prisma",
239
- "database",
240
- "show"
241
- ],
242
- description: "Show database metadata without secret values",
243
- examples: ["prisma-cli database show db_123", "prisma-cli database show acme-preview --branch preview --json"]
244
- },
245
- {
246
- id: "database.create",
247
- path: [
248
- "prisma",
249
- "database",
250
- "create"
251
- ],
252
- description: "Create a Prisma Postgres database and print its one-time connection URL",
253
- examples: ["prisma-cli database create my-db", "prisma-cli database create my-db --branch feature/foo --region eu-central-1"]
254
- },
255
- {
256
- id: "database.remove",
257
- path: [
258
- "prisma",
259
- "database",
260
- "remove"
261
- ],
262
- description: "Remove a database after exact id confirmation",
263
- examples: ["prisma-cli database remove db_123 --confirm db_123"]
264
- },
265
- {
266
- id: "database.connection",
267
- path: [
268
- "prisma",
269
- "database",
270
- "connection"
271
- ],
272
- description: "Manage one-time-view database connection strings",
273
- examples: [
274
- "prisma-cli database connection list db_123",
275
- "prisma-cli database connection create db_123",
276
- "prisma-cli database connection remove conn_123 --confirm conn_123"
277
- ]
278
- },
279
- {
280
- id: "database.connection.list",
281
- path: [
282
- "prisma",
283
- "database",
284
- "connection",
285
- "list"
286
- ],
287
- description: "List database connection metadata without secret values",
288
- examples: ["prisma-cli database connection list db_123", "prisma-cli database connection list acme-preview --branch preview --json"]
289
- },
290
- {
291
- id: "database.connection.create",
292
- path: [
293
- "prisma",
294
- "database",
295
- "connection",
296
- "create"
297
- ],
298
- description: "Create a database connection and print its one-time connection URL",
299
- examples: ["prisma-cli database connection create db_123", "prisma-cli database connection create db_123 --name readonly"]
300
- },
301
- {
302
- id: "database.connection.remove",
303
- path: [
304
- "prisma",
305
- "database",
306
- "connection",
307
- "remove"
308
- ],
309
- description: "Remove a database connection after exact id confirmation",
310
- examples: ["prisma-cli database connection remove conn_123 --confirm conn_123"]
311
- },
312
- {
313
- id: "app.build",
314
- path: [
315
- "prisma",
316
- "app",
317
- "build"
318
- ],
319
- description: "Build the app locally into a deployable artifact",
320
- examples: [
321
- "prisma-cli app build --build-type nextjs",
322
- "prisma-cli app build --build-type nuxt",
323
- "prisma-cli app build --build-type bun --entry server.ts"
324
- ]
325
- },
326
- {
327
- id: "app.run",
328
- path: [
329
- "prisma",
330
- "app",
331
- "run"
332
- ],
333
- description: "Run your app locally",
334
- examples: ["prisma-cli app run --build-type nextjs", "prisma-cli app run --build-type bun --entry server.ts --port 3000"]
335
- },
336
- {
337
- id: "app.deploy",
338
- path: [
339
- "prisma",
340
- "app",
341
- "deploy"
342
- ],
343
- description: "Creates a new deployment for the app",
344
- examples: [
345
- "prisma-cli app deploy",
346
- "prisma-cli app deploy --project proj_123",
347
- "prisma-cli app deploy --create-project my-app --yes",
348
- "prisma-cli app deploy --app my-app --env DATABASE_URL=postgresql://example",
349
- "prisma-cli app deploy --env .env",
350
- "prisma-cli app deploy --db",
351
- "prisma-cli app deploy --db --yes",
352
- "prisma-cli app deploy --app my-app --framework nextjs --http-port 3000",
353
- "prisma-cli app deploy --branch feat-login --framework hono",
354
- "prisma-cli app deploy --prod --yes",
355
- "prisma-cli app deploy --framework bun --entry src/server.ts"
356
- ]
357
- },
358
- {
359
- id: "app.show",
360
- path: [
361
- "prisma",
362
- "app",
363
- "show"
364
- ],
365
- description: "Show the app and its current deployment",
366
- examples: ["prisma-cli app show", "prisma-cli app show --app hello-world"]
367
- },
368
- {
369
- id: "app.open",
370
- path: [
371
- "prisma",
372
- "app",
373
- "open"
374
- ],
375
- description: "Open the app's live URL",
376
- examples: ["prisma-cli app open", "prisma-cli app open --app hello-world"]
377
- },
378
- {
379
- id: "app.domain",
380
- path: [
381
- "prisma",
382
- "app",
383
- "domain"
384
- ],
385
- description: "Manage custom domains for an app",
386
- examples: [
387
- "prisma-cli app domain add shop.acme.com",
388
- "prisma-cli app domain wait shop.acme.com --timeout 15m",
389
- "prisma-cli app domain retry shop.acme.com"
390
- ]
391
- },
392
- {
393
- id: "app.domain.add",
394
- path: [
395
- "prisma",
396
- "app",
397
- "domain",
398
- "add"
399
- ],
400
- description: "Register a custom domain on the app's production branch",
401
- examples: ["prisma-cli app domain add shop.acme.com"]
402
- },
403
- {
404
- id: "app.domain.show",
405
- path: [
406
- "prisma",
407
- "app",
408
- "domain",
409
- "show"
410
- ],
411
- description: "Show custom domain status and certificate details",
412
- examples: ["prisma-cli app domain show shop.acme.com"]
413
- },
414
- {
415
- id: "app.domain.remove",
416
- path: [
417
- "prisma",
418
- "app",
419
- "domain",
420
- "remove"
421
- ],
422
- description: "Detach a custom domain from the app",
423
- examples: ["prisma-cli app domain remove shop.acme.com --yes"]
424
- },
425
- {
426
- id: "app.domain.retry",
427
- path: [
428
- "prisma",
429
- "app",
430
- "domain",
431
- "retry"
432
- ],
433
- description: "Retry custom domain DNS verification and TLS provisioning",
434
- examples: ["prisma-cli app domain retry shop.acme.com"]
435
- },
436
- {
437
- id: "app.domain.wait",
438
- path: [
439
- "prisma",
440
- "app",
441
- "domain",
442
- "wait"
443
- ],
444
- description: "Wait until a custom domain is active or failed",
445
- examples: ["prisma-cli app domain wait shop.acme.com", "prisma-cli app domain wait shop.acme.com --timeout 0 --json"]
446
- },
447
- {
448
- id: "app.logs",
449
- path: [
450
- "prisma",
451
- "app",
452
- "logs"
453
- ],
454
- description: "Stream logs for the app's current deployment",
455
- examples: ["prisma-cli app logs", "prisma-cli app logs --deployment dep_123"]
456
- },
457
- {
458
- id: "app.list-deploys",
459
- path: [
460
- "prisma",
461
- "app",
462
- "list-deploys"
463
- ],
464
- description: "List deployments for the app",
465
- examples: ["prisma-cli app list-deploys", "prisma-cli app list-deploys --app hello-world"]
466
- },
467
- {
468
- id: "app.show-deploy",
469
- path: [
470
- "prisma",
471
- "app",
472
- "show-deploy"
473
- ],
474
- description: "Show a deployment in detail",
475
- examples: ["prisma-cli app show-deploy dep_123"]
476
- },
477
- {
478
- id: "app.promote",
479
- path: [
480
- "prisma",
481
- "app",
482
- "promote"
483
- ],
484
- description: "Promote a deployment to production by rebuilding with production env vars",
485
- examples: ["prisma-cli app promote dep_123", "prisma-cli app promote dep_123 --app hello-world"]
486
- },
487
- {
488
- id: "app.rollback",
489
- path: [
490
- "prisma",
491
- "app",
492
- "rollback"
493
- ],
494
- description: "Roll back production to a previous deployment",
495
- examples: ["prisma-cli app rollback", "prisma-cli app rollback --app hello-world --to dep_123"]
496
- },
497
- {
498
- id: "app.remove",
499
- path: [
500
- "prisma",
501
- "app",
502
- "remove"
503
- ],
504
- description: "Remove the app from the current branch",
505
- examples: ["prisma-cli app remove --app hello-world", "prisma-cli app remove --app hello-world --yes"]
506
- },
507
- {
508
- id: "project.env",
509
- path: [
510
- "prisma",
511
- "project",
512
- "env"
513
- ],
514
- description: "Manage environment variables for the active project",
515
- examples: [
516
- "prisma-cli project env list",
517
- "prisma-cli project env add STRIPE_KEY=sk_test_xxx --role production",
518
- "prisma-cli project env add --file .env --role preview",
519
- "prisma-cli project env add DATABASE_URL=postgresql://branch --branch feature/foo",
520
- "prisma-cli project env remove STRIPE_KEY --role preview"
521
- ]
522
- },
523
- {
524
- id: "project.env.add",
525
- path: [
526
- "prisma",
527
- "project",
528
- "env",
529
- "add"
530
- ],
531
- description: "Create a new environment variable.",
532
- examples: [
533
- "prisma-cli project env add STRIPE_KEY=sk_test_xxx --role production",
534
- "prisma-cli project env add STRIPE_KEY=sk_test_xxx --role preview",
535
- "prisma-cli project env add --file .env --role preview",
536
- "prisma-cli project env add DATABASE_URL=postgresql://branch --branch feature/foo",
537
- "prisma-cli project env add --file .env.local --branch feature/foo",
538
- "API_URL=https://api.example prisma-cli project env add API_URL --project proj_123 --role preview"
539
- ]
540
- },
541
- {
542
- id: "project.env.update",
543
- path: [
544
- "prisma",
545
- "project",
546
- "env",
547
- "update"
548
- ],
549
- description: "Replace an existing environment variable's value.",
550
- examples: [
551
- "prisma-cli project env update STRIPE_KEY=sk_new_xxx --role production",
552
- "prisma-cli project env update STRIPE_KEY=sk_new_xxx --role preview",
553
- "prisma-cli project env update --file .env --role production",
554
- "prisma-cli project env update DATABASE_URL=postgresql://branch --branch feature/foo"
555
- ]
556
- },
557
- {
558
- id: "project.env.list",
559
- path: [
560
- "prisma",
561
- "project",
562
- "env",
563
- "list"
564
- ],
565
- description: "List environment variable metadata for a scope (no values).",
566
- examples: [
567
- "prisma-cli project env list",
568
- "prisma-cli project env list --role production",
569
- "prisma-cli project env list --role preview",
570
- "prisma-cli project env list --branch feature/foo"
571
- ]
572
- },
573
- {
574
- id: "project.env.remove",
575
- path: [
576
- "prisma",
577
- "project",
578
- "env",
579
- "remove"
580
- ],
581
- description: "Remove an environment variable from a scope.",
582
- examples: [
583
- "prisma-cli project env remove STRIPE_KEY --role production",
584
- "prisma-cli project env remove STRIPE_KEY --role preview",
585
- "prisma-cli project env remove DATABASE_URL --branch feature/foo"
586
- ]
587
- }
588
- ];
589
- const DESCRIPTORS_BY_ID = new Map(DESCRIPTORS.map((descriptor) => [descriptor.id, descriptor]));
590
- function attachCommandDescriptor(command, descriptorId) {
591
- const descriptor = getCommandDescriptor(descriptorId);
592
- command[COMMAND_DESCRIPTOR_ID] = descriptor.id;
593
- command.description(descriptor.description);
594
- return command;
595
- }
596
- function getCommandDescriptor(id) {
597
- const descriptor = DESCRIPTORS_BY_ID.get(id);
598
- if (!descriptor) throw new Error(`Unknown command descriptor "${id}".`);
599
- return descriptor;
600
- }
601
- function getDescriptorForCommand(command) {
602
- const descriptorId = command[COMMAND_DESCRIPTOR_ID];
603
- if (descriptorId) return getCommandDescriptor(descriptorId);
604
- const path = getCommandPath(command);
605
- const descriptor = DESCRIPTORS.find((candidate) => candidate.path.join(" ") === path.join(" "));
606
- if (!descriptor) throw new Error(`No command descriptor registered for "${path.join(" ")}".`);
607
- return descriptor;
608
- }
609
- function getCommandPath(command) {
610
- const names = [];
611
- let current = command;
612
- while (current) {
613
- if (current.name()) names.unshift(current.name());
614
- current = current.parent ?? null;
615
- }
616
- return names;
617
- }
618
- function formatDescriptorLabel(descriptor) {
619
- return descriptor.path.length === 1 ? descriptor.path[0] : descriptor.path.slice(1).join(" ");
620
- }
621
- //#endregion
622
- export { attachCommandDescriptor, formatDescriptorLabel, getCommandDescriptor, getDescriptorForCommand };