@prisma/cli 3.0.0-alpha.1 → 3.0.0-alpha.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.
- package/README.md +1 -16
- package/dist/cli2.js +2 -0
- package/dist/commands/app/index.js +2 -1
- package/dist/commands/auth/index.js +2 -1
- package/dist/commands/branch/index.js +2 -1
- package/dist/commands/project/index.js +2 -1
- package/dist/controllers/app.js +73 -73
- package/dist/controllers/auth.js +7 -7
- package/dist/controllers/branch.js +5 -5
- package/dist/controllers/project.js +14 -14
- package/dist/lib/app/env-vars.js +4 -4
- package/dist/lib/auth/login.js +115 -4
- package/dist/output/patterns.js +14 -16
- package/dist/shell/command-meta.js +57 -88
- package/dist/shell/errors.js +2 -2
- package/dist/shell/global-flags.js +12 -1
- package/dist/shell/help.js +7 -6
- package/dist/use-cases/auth.js +4 -4
- package/dist/use-cases/create-cli-gateways.js +1 -1
- package/dist/use-cases/project.js +2 -2
- package/package.json +1 -1
|
@@ -4,17 +4,15 @@ const DESCRIPTORS = [
|
|
|
4
4
|
{
|
|
5
5
|
id: "root",
|
|
6
6
|
path: ["prisma"],
|
|
7
|
-
description: "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
longDescription: "The Prisma CLI groups commands by developer workflow and keeps human and agent behavior aligned."
|
|
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"
|
|
11
10
|
},
|
|
12
11
|
{
|
|
13
12
|
id: "auth",
|
|
14
13
|
path: ["prisma", "auth"],
|
|
15
|
-
description: "
|
|
16
|
-
|
|
17
|
-
examples: ["prisma auth login", "prisma auth whoami"]
|
|
14
|
+
description: "Manage local authentication for the CLI",
|
|
15
|
+
examples: ["prisma-cli auth login", "prisma-cli auth whoami"]
|
|
18
16
|
},
|
|
19
17
|
{
|
|
20
18
|
id: "auth.login",
|
|
@@ -23,9 +21,8 @@ const DESCRIPTORS = [
|
|
|
23
21
|
"auth",
|
|
24
22
|
"login"
|
|
25
23
|
],
|
|
26
|
-
description: "
|
|
27
|
-
|
|
28
|
-
examples: ["prisma auth login"]
|
|
24
|
+
description: "Log in to your Prisma platform account",
|
|
25
|
+
examples: ["prisma-cli auth login"]
|
|
29
26
|
},
|
|
30
27
|
{
|
|
31
28
|
id: "auth.logout",
|
|
@@ -34,9 +31,8 @@ const DESCRIPTORS = [
|
|
|
34
31
|
"auth",
|
|
35
32
|
"logout"
|
|
36
33
|
],
|
|
37
|
-
description: "Clear
|
|
38
|
-
|
|
39
|
-
examples: ["prisma auth logout"]
|
|
34
|
+
description: "Clear stored authentication credentials",
|
|
35
|
+
examples: ["prisma-cli auth logout"]
|
|
40
36
|
},
|
|
41
37
|
{
|
|
42
38
|
id: "auth.whoami",
|
|
@@ -45,34 +41,26 @@ const DESCRIPTORS = [
|
|
|
45
41
|
"auth",
|
|
46
42
|
"whoami"
|
|
47
43
|
],
|
|
48
|
-
description: "Show the
|
|
49
|
-
|
|
50
|
-
examples: ["prisma auth whoami", "prisma auth whoami --json"]
|
|
44
|
+
description: "Show the authenticated user and accessible workspace",
|
|
45
|
+
examples: ["prisma-cli auth whoami", "prisma-cli auth whoami --json"]
|
|
51
46
|
},
|
|
52
47
|
{
|
|
53
48
|
id: "project",
|
|
54
49
|
path: ["prisma", "project"],
|
|
55
|
-
description: "
|
|
56
|
-
|
|
57
|
-
examples: ["prisma project list", "prisma project show"]
|
|
50
|
+
description: "Manage the link between this directory and a Prisma project",
|
|
51
|
+
examples: ["prisma-cli project list", "prisma-cli project show"]
|
|
58
52
|
},
|
|
59
53
|
{
|
|
60
54
|
id: "app",
|
|
61
55
|
path: ["prisma", "app"],
|
|
62
|
-
description: "
|
|
63
|
-
|
|
64
|
-
examples: [
|
|
65
|
-
"prisma app build --build-type nextjs",
|
|
66
|
-
"prisma app deploy --app hello-world --build-type nextjs --http-port 3000",
|
|
67
|
-
"prisma app deploy --app hello-world --build-type nuxt"
|
|
68
|
-
]
|
|
56
|
+
description: "Manage apps and deployments for a project",
|
|
57
|
+
examples: ["prisma-cli app deploy", "prisma-cli app deploy --app hello-world --build-type nextjs --http-port 3000"]
|
|
69
58
|
},
|
|
70
59
|
{
|
|
71
60
|
id: "branch",
|
|
72
61
|
path: ["prisma", "branch"],
|
|
73
|
-
description: "
|
|
74
|
-
|
|
75
|
-
examples: ["prisma branch list", "prisma branch use production"]
|
|
62
|
+
description: "View your active Platform branches",
|
|
63
|
+
examples: ["prisma-cli branch list", "prisma-cli branch show"]
|
|
76
64
|
},
|
|
77
65
|
{
|
|
78
66
|
id: "project.list",
|
|
@@ -81,9 +69,8 @@ const DESCRIPTORS = [
|
|
|
81
69
|
"project",
|
|
82
70
|
"list"
|
|
83
71
|
],
|
|
84
|
-
description: "List projects
|
|
85
|
-
|
|
86
|
-
examples: ["prisma project list", "prisma project list --json"]
|
|
72
|
+
description: "List all projects in your workspace",
|
|
73
|
+
examples: ["prisma-cli project list", "prisma-cli project list --json"]
|
|
87
74
|
},
|
|
88
75
|
{
|
|
89
76
|
id: "project.show",
|
|
@@ -92,9 +79,8 @@ const DESCRIPTORS = [
|
|
|
92
79
|
"project",
|
|
93
80
|
"show"
|
|
94
81
|
],
|
|
95
|
-
description: "Show the
|
|
96
|
-
|
|
97
|
-
examples: ["prisma project show", "prisma project show --json"]
|
|
82
|
+
description: "Show the Prisma project linked to this directory",
|
|
83
|
+
examples: ["prisma-cli project show", "prisma-cli project show --json"]
|
|
98
84
|
},
|
|
99
85
|
{
|
|
100
86
|
id: "project.link",
|
|
@@ -103,9 +89,8 @@ const DESCRIPTORS = [
|
|
|
103
89
|
"project",
|
|
104
90
|
"link"
|
|
105
91
|
],
|
|
106
|
-
description: "Link
|
|
107
|
-
|
|
108
|
-
examples: ["prisma project link", "prisma project link proj_123"]
|
|
92
|
+
description: "Link this directory to a Prisma project",
|
|
93
|
+
examples: ["prisma-cli project link", "prisma-cli project link proj_123"]
|
|
109
94
|
},
|
|
110
95
|
{
|
|
111
96
|
id: "branch.list",
|
|
@@ -114,9 +99,8 @@ const DESCRIPTORS = [
|
|
|
114
99
|
"branch",
|
|
115
100
|
"list"
|
|
116
101
|
],
|
|
117
|
-
description: "List
|
|
118
|
-
|
|
119
|
-
examples: ["prisma branch list", "prisma branch list --json"]
|
|
102
|
+
description: "List active Platform branches linked to this project",
|
|
103
|
+
examples: ["prisma-cli branch list", "prisma-cli branch list --json"]
|
|
120
104
|
},
|
|
121
105
|
{
|
|
122
106
|
id: "branch.show",
|
|
@@ -125,9 +109,8 @@ const DESCRIPTORS = [
|
|
|
125
109
|
"branch",
|
|
126
110
|
"show"
|
|
127
111
|
],
|
|
128
|
-
description: "Show the current
|
|
129
|
-
|
|
130
|
-
examples: ["prisma branch show", "prisma branch show --json"]
|
|
112
|
+
description: "Show the Platform branch matching your current Git branch",
|
|
113
|
+
examples: ["prisma-cli branch show", "prisma-cli branch show --json"]
|
|
131
114
|
},
|
|
132
115
|
{
|
|
133
116
|
id: "branch.use",
|
|
@@ -137,8 +120,7 @@ const DESCRIPTORS = [
|
|
|
137
120
|
"use"
|
|
138
121
|
],
|
|
139
122
|
description: "Change the local default branch context.",
|
|
140
|
-
|
|
141
|
-
examples: ["prisma branch use", "prisma branch use production"]
|
|
123
|
+
examples: ["prisma-cli branch use", "prisma-cli branch use production"]
|
|
142
124
|
},
|
|
143
125
|
{
|
|
144
126
|
id: "app.build",
|
|
@@ -147,12 +129,11 @@ const DESCRIPTORS = [
|
|
|
147
129
|
"app",
|
|
148
130
|
"build"
|
|
149
131
|
],
|
|
150
|
-
description: "Build the
|
|
151
|
-
docsPath: "docs/product/command-spec.md#prisma-app-build---entry-path---build-type-autobunnextjsnuxtastrotanstack-start",
|
|
132
|
+
description: "Build the app locally into a deployable artifact",
|
|
152
133
|
examples: [
|
|
153
|
-
"prisma app build --build-type nextjs",
|
|
154
|
-
"prisma app build --build-type nuxt",
|
|
155
|
-
"prisma app build --build-type bun --entry server.ts"
|
|
134
|
+
"prisma-cli app build --build-type nextjs",
|
|
135
|
+
"prisma-cli app build --build-type nuxt",
|
|
136
|
+
"prisma-cli app build --build-type bun --entry server.ts"
|
|
156
137
|
]
|
|
157
138
|
},
|
|
158
139
|
{
|
|
@@ -162,9 +143,8 @@ const DESCRIPTORS = [
|
|
|
162
143
|
"app",
|
|
163
144
|
"run"
|
|
164
145
|
],
|
|
165
|
-
description: "
|
|
166
|
-
|
|
167
|
-
examples: ["prisma app run --build-type nextjs", "prisma app run --build-type bun --entry server.ts --port 3000"]
|
|
146
|
+
description: "Run your app locally",
|
|
147
|
+
examples: ["prisma-cli app run --build-type nextjs", "prisma-cli app run --build-type bun --entry server.ts --port 3000"]
|
|
168
148
|
},
|
|
169
149
|
{
|
|
170
150
|
id: "app.deploy",
|
|
@@ -173,13 +153,12 @@ const DESCRIPTORS = [
|
|
|
173
153
|
"app",
|
|
174
154
|
"deploy"
|
|
175
155
|
],
|
|
176
|
-
description: "
|
|
177
|
-
docsPath: "docs/product/command-spec.md#prisma-app-deploy---app-name---entry-path---build-type-autobunnextjsnuxtastrotanstack-start---http-port-port---env-namevalue",
|
|
156
|
+
description: "Creates a new deployment for the app",
|
|
178
157
|
examples: [
|
|
179
|
-
"prisma app deploy",
|
|
180
|
-
"prisma app deploy --app hello-world --env DATABASE_URL=postgresql://example",
|
|
181
|
-
"prisma app deploy --app hello-world --build-type nextjs --http-port 3000",
|
|
182
|
-
"prisma app deploy --app hello-world --build-type nuxt"
|
|
158
|
+
"prisma-cli app deploy",
|
|
159
|
+
"prisma-cli app deploy --app hello-world --env DATABASE_URL=postgresql://example",
|
|
160
|
+
"prisma-cli app deploy --app hello-world --build-type nextjs --http-port 3000",
|
|
161
|
+
"prisma-cli app deploy --app hello-world --build-type nuxt"
|
|
183
162
|
]
|
|
184
163
|
},
|
|
185
164
|
{
|
|
@@ -190,8 +169,7 @@ const DESCRIPTORS = [
|
|
|
190
169
|
"update-env"
|
|
191
170
|
],
|
|
192
171
|
description: "Create a new deployment with updated environment variables.",
|
|
193
|
-
|
|
194
|
-
examples: ["prisma app update-env --env DATABASE_URL=postgresql://example", "prisma app update-env --app hello-world --env DATABASE_URL=postgresql://another"]
|
|
172
|
+
examples: ["prisma-cli app update-env --env DATABASE_URL=postgresql://example", "prisma-cli app update-env --app hello-world --env DATABASE_URL=postgresql://another"]
|
|
195
173
|
},
|
|
196
174
|
{
|
|
197
175
|
id: "app.list-env",
|
|
@@ -201,8 +179,7 @@ const DESCRIPTORS = [
|
|
|
201
179
|
"list-env"
|
|
202
180
|
],
|
|
203
181
|
description: "List environment variable names for the selected app.",
|
|
204
|
-
|
|
205
|
-
examples: ["prisma app list-env", "prisma app list-env --app hello-world"]
|
|
182
|
+
examples: ["prisma-cli app list-env", "prisma-cli app list-env --app hello-world"]
|
|
206
183
|
},
|
|
207
184
|
{
|
|
208
185
|
id: "app.show",
|
|
@@ -211,9 +188,8 @@ const DESCRIPTORS = [
|
|
|
211
188
|
"app",
|
|
212
189
|
"show"
|
|
213
190
|
],
|
|
214
|
-
description: "Show the
|
|
215
|
-
|
|
216
|
-
examples: ["prisma app show", "prisma app show --app hello-world"]
|
|
191
|
+
description: "Show the app and its current deployment",
|
|
192
|
+
examples: ["prisma-cli app show", "prisma-cli app show --app hello-world"]
|
|
217
193
|
},
|
|
218
194
|
{
|
|
219
195
|
id: "app.open",
|
|
@@ -222,9 +198,8 @@ const DESCRIPTORS = [
|
|
|
222
198
|
"app",
|
|
223
199
|
"open"
|
|
224
200
|
],
|
|
225
|
-
description: "Open the live URL
|
|
226
|
-
|
|
227
|
-
examples: ["prisma app open", "prisma app open --app hello-world"]
|
|
201
|
+
description: "Open the app's live URL",
|
|
202
|
+
examples: ["prisma-cli app open", "prisma-cli app open --app hello-world"]
|
|
228
203
|
},
|
|
229
204
|
{
|
|
230
205
|
id: "app.logs",
|
|
@@ -233,9 +208,8 @@ const DESCRIPTORS = [
|
|
|
233
208
|
"app",
|
|
234
209
|
"logs"
|
|
235
210
|
],
|
|
236
|
-
description: "
|
|
237
|
-
|
|
238
|
-
examples: ["prisma app logs", "prisma app logs --deployment dep_123"]
|
|
211
|
+
description: "Stream logs for the app's current deployment",
|
|
212
|
+
examples: ["prisma-cli app logs", "prisma-cli app logs --deployment dep_123"]
|
|
239
213
|
},
|
|
240
214
|
{
|
|
241
215
|
id: "app.list-deploys",
|
|
@@ -244,9 +218,8 @@ const DESCRIPTORS = [
|
|
|
244
218
|
"app",
|
|
245
219
|
"list-deploys"
|
|
246
220
|
],
|
|
247
|
-
description: "List deployments for the
|
|
248
|
-
|
|
249
|
-
examples: ["prisma app list-deploys", "prisma app list-deploys --app hello-world"]
|
|
221
|
+
description: "List deployments for the app",
|
|
222
|
+
examples: ["prisma-cli app list-deploys", "prisma-cli app list-deploys --app hello-world"]
|
|
250
223
|
},
|
|
251
224
|
{
|
|
252
225
|
id: "app.show-deploy",
|
|
@@ -255,9 +228,8 @@ const DESCRIPTORS = [
|
|
|
255
228
|
"app",
|
|
256
229
|
"show-deploy"
|
|
257
230
|
],
|
|
258
|
-
description: "Show
|
|
259
|
-
|
|
260
|
-
examples: ["prisma app show-deploy dep_123"]
|
|
231
|
+
description: "Show a deployment in detail",
|
|
232
|
+
examples: ["prisma-cli app show-deploy dep_123"]
|
|
261
233
|
},
|
|
262
234
|
{
|
|
263
235
|
id: "app.promote",
|
|
@@ -266,9 +238,8 @@ const DESCRIPTORS = [
|
|
|
266
238
|
"app",
|
|
267
239
|
"promote"
|
|
268
240
|
],
|
|
269
|
-
description: "
|
|
270
|
-
|
|
271
|
-
examples: ["prisma app promote dep_123", "prisma app promote dep_123 --app hello-world"]
|
|
241
|
+
description: "Promote a deployment to production by rebuilding with production env vars",
|
|
242
|
+
examples: ["prisma-cli app promote dep_123", "prisma-cli app promote dep_123 --app hello-world"]
|
|
272
243
|
},
|
|
273
244
|
{
|
|
274
245
|
id: "app.rollback",
|
|
@@ -277,9 +248,8 @@ const DESCRIPTORS = [
|
|
|
277
248
|
"app",
|
|
278
249
|
"rollback"
|
|
279
250
|
],
|
|
280
|
-
description: "
|
|
281
|
-
|
|
282
|
-
examples: ["prisma app rollback", "prisma app rollback --app hello-world --to dep_123"]
|
|
251
|
+
description: "Roll back production to a previous deployment",
|
|
252
|
+
examples: ["prisma-cli app rollback", "prisma-cli app rollback --app hello-world --to dep_123"]
|
|
283
253
|
},
|
|
284
254
|
{
|
|
285
255
|
id: "app.remove",
|
|
@@ -288,9 +258,8 @@ const DESCRIPTORS = [
|
|
|
288
258
|
"app",
|
|
289
259
|
"remove"
|
|
290
260
|
],
|
|
291
|
-
description: "Remove the
|
|
292
|
-
|
|
293
|
-
examples: ["prisma app remove --app hello-world", "prisma app remove --app hello-world --yes"]
|
|
261
|
+
description: "Remove the app from the current branch",
|
|
262
|
+
examples: ["prisma-cli app remove --app hello-world", "prisma-cli app remove --app hello-world --yes"]
|
|
294
263
|
}
|
|
295
264
|
];
|
|
296
265
|
const DESCRIPTORS_BY_ID = new Map(DESCRIPTORS.map((descriptor) => [descriptor.id, descriptor]));
|
package/dist/shell/errors.js
CHANGED
|
@@ -40,13 +40,13 @@ function usageError(summary, why, fix, nextSteps = [], domain = "cli") {
|
|
|
40
40
|
nextSteps
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
function authRequiredError(nextSteps = ["prisma auth login"]) {
|
|
43
|
+
function authRequiredError(nextSteps = ["prisma-cli auth login"]) {
|
|
44
44
|
return new CliError({
|
|
45
45
|
code: "AUTH_REQUIRED",
|
|
46
46
|
domain: "auth",
|
|
47
47
|
summary: "Authentication required",
|
|
48
48
|
why: "This command needs an authenticated session.",
|
|
49
|
-
fix: "Run prisma auth login, or rerun the command in a TTY to sign in interactively.",
|
|
49
|
+
fix: "Run prisma-cli auth login, or rerun the command in a TTY to sign in interactively.",
|
|
50
50
|
exitCode: 1,
|
|
51
51
|
nextSteps
|
|
52
52
|
});
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { Option } from "commander";
|
|
2
2
|
//#region src/shell/global-flags.ts
|
|
3
|
+
const COMPACT_GLOBAL_OPTION_FLAGS = [
|
|
4
|
+
"--json",
|
|
5
|
+
"-q, --quiet",
|
|
6
|
+
"-v, --verbose",
|
|
7
|
+
"--trace",
|
|
8
|
+
"--no-interactive",
|
|
9
|
+
"-y, --yes"
|
|
10
|
+
];
|
|
3
11
|
function addGlobalFlags(command) {
|
|
4
12
|
return command.option("--json", "Emit structured JSON output.").option("-q, --quiet", "Reduce human-oriented output.").option("-v, --verbose", "Increase human-oriented output detail.").option("--trace", "Show deeper diagnostics for failures.").option("-y, --yes", "Accept supported confirmation prompts.").addOption(new Option("--interactive", "Force interactive behavior when prompts are supported.")).addOption(new Option("--no-interactive", "Disable interactive behavior and prompts.")).addOption(new Option("--color", "Force color output in supported terminals.")).addOption(new Option("--no-color", "Disable color output."));
|
|
5
13
|
}
|
|
14
|
+
function addCompactGlobalFlags(command) {
|
|
15
|
+
return command.option("--json", "Emit structured JSON output.").option("-q, --quiet", "Reduce human-oriented output.").option("-v, --verbose", "Increase human-oriented output detail.").option("--trace", "Show deeper diagnostics for failures.").addOption(new Option("--no-interactive", "Disable interactive behavior and prompts.")).option("-y, --yes", "Accept supported confirmation prompts.");
|
|
16
|
+
}
|
|
6
17
|
function getExplicitBoolean(argv, positive, negative) {
|
|
7
18
|
for (let index = argv.length - 1; index >= 0; index -= 1) {
|
|
8
19
|
const value = argv[index];
|
|
@@ -22,4 +33,4 @@ function resolveGlobalFlags(argv, options) {
|
|
|
22
33
|
};
|
|
23
34
|
}
|
|
24
35
|
//#endregion
|
|
25
|
-
export { addGlobalFlags, resolveGlobalFlags };
|
|
36
|
+
export { COMPACT_GLOBAL_OPTION_FLAGS, addCompactGlobalFlags, addGlobalFlags, resolveGlobalFlags };
|
package/dist/shell/help.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatDescriptorLabel, getDescriptorForCommand } from "./command-meta.js";
|
|
2
|
-
import { resolveGlobalFlags } from "./global-flags.js";
|
|
2
|
+
import { COMPACT_GLOBAL_OPTION_FLAGS, resolveGlobalFlags } from "./global-flags.js";
|
|
3
3
|
import { createShellUi, padDisplay, wrapText } from "./ui.js";
|
|
4
4
|
//#region src/shell/help.ts
|
|
5
5
|
function renderHelp(command, runtime) {
|
|
@@ -10,8 +10,14 @@ function renderHelp(command, runtime) {
|
|
|
10
10
|
const visibleCommands = command.commands.filter((candidate) => candidate.name() !== "help" && !candidate.hidden);
|
|
11
11
|
const visibleOptions = command.options.filter((candidate) => !candidate.hidden);
|
|
12
12
|
if (visibleCommands.length > 0) lines.push(...renderCommandRows(rail, ui, visibleCommands));
|
|
13
|
+
if (descriptor.longDescription) {
|
|
14
|
+
lines.push(`${rail}`);
|
|
15
|
+
const wrapped = wrapText(descriptor.longDescription, Math.max(ui.width - 3, 40));
|
|
16
|
+
for (const line of wrapped) lines.push(`${rail} ${line}`);
|
|
17
|
+
}
|
|
13
18
|
if (visibleOptions.length > 0) {
|
|
14
19
|
if (visibleCommands.length > 0) lines.push(`${rail}`);
|
|
20
|
+
if (visibleCommands.length > 0 && visibleOptions.every((option) => COMPACT_GLOBAL_OPTION_FLAGS.includes(option.flags))) lines.push(`${rail} Global options:`);
|
|
15
21
|
lines.push(...renderOptionRows(rail, ui, visibleOptions));
|
|
16
22
|
}
|
|
17
23
|
if (descriptor.examples && descriptor.examples.length > 0) {
|
|
@@ -19,11 +25,6 @@ function renderHelp(command, runtime) {
|
|
|
19
25
|
lines.push(`${rail} Examples:`);
|
|
20
26
|
for (const example of descriptor.examples) lines.push(`${rail} $ ${example}`);
|
|
21
27
|
}
|
|
22
|
-
if (descriptor.longDescription) {
|
|
23
|
-
lines.push(`${rail}`);
|
|
24
|
-
const wrapped = wrapText(descriptor.longDescription, Math.max(ui.width - 3, 40));
|
|
25
|
-
for (const line of wrapped) lines.push(`${rail} ${line}`);
|
|
26
|
-
}
|
|
27
28
|
if (descriptor.docsPath) {
|
|
28
29
|
lines.push(`${rail}`);
|
|
29
30
|
lines.push(`${rail} ${ui.accent(padDisplay("Read more", 16))} ${ui.link(descriptor.docsPath)}`);
|
package/dist/use-cases/auth.js
CHANGED
|
@@ -18,23 +18,23 @@ function createAuthUseCases(dependencies) {
|
|
|
18
18
|
listProviders: async () => dependencies.identityGateway.listProviders(),
|
|
19
19
|
resolveProvider: async (providerId) => {
|
|
20
20
|
const provider = dependencies.identityGateway.getProvider(providerId);
|
|
21
|
-
if (!provider) throw usageError("Login requires a valid mock provider", `The mock provider "${providerId}" does not exist.`, "Use --provider github or --provider google.", ["prisma auth login"], "auth");
|
|
21
|
+
if (!provider) throw usageError("Login requires a valid mock provider", `The mock provider "${providerId}" does not exist.`, "Use --provider github or --provider google.", ["prisma-cli auth login"], "auth");
|
|
22
22
|
return provider;
|
|
23
23
|
},
|
|
24
24
|
listUsersForProvider: async (providerId) => {
|
|
25
25
|
const users = dependencies.identityGateway.listUsersForProvider(providerId);
|
|
26
|
-
if (users.length === 0) throw usageError("Login requires a valid mock user", `No mock users support provider "${providerId}".`, "Update the fixture data or choose a different provider.", ["prisma auth login"], "auth");
|
|
26
|
+
if (users.length === 0) throw usageError("Login requires a valid mock user", `No mock users support provider "${providerId}".`, "Update the fixture data or choose a different provider.", ["prisma-cli auth login"], "auth");
|
|
27
27
|
return users;
|
|
28
28
|
},
|
|
29
29
|
resolveUserForProvider: async (providerId, userId) => {
|
|
30
30
|
const user = dependencies.identityGateway.getUserForProvider(providerId, userId);
|
|
31
|
-
if (!user) throw usageError("Login requires a valid mock user", `The mock user "${userId}" is not available for provider "${providerId}".`, "Choose a user that supports the selected provider.", ["prisma auth login"], "auth");
|
|
31
|
+
if (!user) throw usageError("Login requires a valid mock user", `The mock user "${userId}" is not available for provider "${providerId}".`, "Choose a user that supports the selected provider.", ["prisma-cli auth login"], "auth");
|
|
32
32
|
return user;
|
|
33
33
|
},
|
|
34
34
|
listWorkspacesForUser: async (userId) => dependencies.identityGateway.listUserWorkspaces(userId),
|
|
35
35
|
resolveWorkspaceForUser: async (userId, workspaceId) => {
|
|
36
36
|
const workspace = dependencies.identityGateway.getUserWorkspace(userId, workspaceId);
|
|
37
|
-
if (!workspace) throw usageError("Login requires a valid mock workspace", `The mock workspace "${workspaceId}" is not available for the selected user.`, "Choose a workspace that the selected user can access.", ["prisma auth login"], "auth");
|
|
37
|
+
if (!workspace) throw usageError("Login requires a valid mock workspace", `The mock workspace "${workspaceId}" is not available for the selected user.`, "Choose a workspace that the selected user can access.", ["prisma-cli auth login"], "auth");
|
|
38
38
|
return workspace;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
@@ -50,7 +50,7 @@ function createCliUseCaseGateways(context) {
|
|
|
50
50
|
try {
|
|
51
51
|
await writeLinkedProjectId(context.runtime.cwd, projectId);
|
|
52
52
|
} catch (error) {
|
|
53
|
-
if (error instanceof UnsafeConfigWriteError) throw usageError("Project link requires a writable Prisma config", error.message, "Update prisma.config.ts to use a recognizable project field, or remove it and rerun prisma project link.", ["prisma project link proj_123"], "project");
|
|
53
|
+
if (error instanceof UnsafeConfigWriteError) throw usageError("Project link requires a writable Prisma config", error.message, "Update prisma.config.ts to use a recognizable project field, or remove it and rerun prisma-cli project link.", ["prisma-cli project link proj_123"], "project");
|
|
54
54
|
throw error;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -36,7 +36,7 @@ function createProjectUseCases(dependencies) {
|
|
|
36
36
|
link: async (authState, projectId) => {
|
|
37
37
|
const workspace = requireWorkspace(authState);
|
|
38
38
|
const project = dependencies.projectGateway.getProjectForWorkspace(workspace.id, projectId);
|
|
39
|
-
if (!project) throw projectNotFoundError(`The project "${projectId}" does not exist in workspace "${workspace.name}".`, "Run prisma project list and choose a project id from the active workspace.");
|
|
39
|
+
if (!project) throw projectNotFoundError(`The project "${projectId}" does not exist in workspace "${workspace.name}".`, "Run prisma-cli project list and choose a project id from the active workspace.");
|
|
40
40
|
await dependencies.projectConfigGateway.writeLinkedProjectId(project.id);
|
|
41
41
|
return {
|
|
42
42
|
linkedProjectId: project.id,
|
|
@@ -60,7 +60,7 @@ function toProjectSummary(project) {
|
|
|
60
60
|
name: project.name
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
function projectNotFoundError(why, fix, nextSteps = ["prisma project list"]) {
|
|
63
|
+
function projectNotFoundError(why, fix, nextSteps = ["prisma-cli project list"]) {
|
|
64
64
|
return new CliError({
|
|
65
65
|
code: "PROJECT_NOT_FOUND",
|
|
66
66
|
domain: "project",
|