@prisma/cli 3.0.0-dev.99.1 → 8.0.0-rc.10-dev.80
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 +26 -28
- package/dist/cli.js +14551 -16
- package/dist/payload-B88Qvzxk-CrtTXSOe.js +34 -0
- package/dist/sender.js +192 -0
- package/package.json +26 -19
- package/dist/adapters/git.js +0 -54
- package/dist/adapters/local-state.js +0 -144
- package/dist/adapters/mock-api.js +0 -136
- package/dist/adapters/token-storage.js +0 -418
- package/dist/cli2.js +0 -119
- package/dist/commands/app/index.js +0 -345
- package/dist/commands/auth/index.js +0 -96
- package/dist/commands/branch/index.js +0 -27
- package/dist/commands/database/index.js +0 -159
- package/dist/commands/env.js +0 -99
- package/dist/commands/git/index.js +0 -36
- package/dist/commands/project/index.js +0 -69
- package/dist/commands/version/index.js +0 -18
- package/dist/controllers/app-env-api.js +0 -54
- package/dist/controllers/app-env-file.js +0 -181
- package/dist/controllers/app-env.js +0 -502
- package/dist/controllers/app.js +0 -2443
- package/dist/controllers/auth.js +0 -316
- package/dist/controllers/branch.js +0 -103
- package/dist/controllers/database.js +0 -318
- package/dist/controllers/project.js +0 -731
- package/dist/controllers/select-prompt-port.js +0 -12
- package/dist/controllers/version.js +0 -12
- package/dist/lib/app/app-interaction.js +0 -5
- package/dist/lib/app/app-provider.js +0 -544
- package/dist/lib/app/branch-database-api.js +0 -102
- package/dist/lib/app/branch-database-deploy.js +0 -325
- package/dist/lib/app/branch-database.js +0 -215
- package/dist/lib/app/build-settings.js +0 -93
- package/dist/lib/app/build.js +0 -80
- package/dist/lib/app/bun-project.js +0 -45
- package/dist/lib/app/compute-config.js +0 -147
- package/dist/lib/app/deploy-output.js +0 -24
- package/dist/lib/app/deploy-plan.js +0 -58
- package/dist/lib/app/deploy-progress.js +0 -100
- package/dist/lib/app/domain-guidance.js +0 -14
- package/dist/lib/app/env-config.js +0 -67
- package/dist/lib/app/env-file.js +0 -82
- package/dist/lib/app/env-vars.js +0 -50
- package/dist/lib/app/local-dev.js +0 -109
- package/dist/lib/app/production-deploy-gate.js +0 -161
- package/dist/lib/app/read-branch.js +0 -30
- package/dist/lib/auth/auth-ops.js +0 -158
- package/dist/lib/auth/client.js +0 -22
- package/dist/lib/auth/guard.js +0 -38
- package/dist/lib/auth/login.js +0 -330
- package/dist/lib/database/provider.js +0 -167
- package/dist/lib/diagnostics.js +0 -15
- package/dist/lib/fs/home-path.js +0 -24
- package/dist/lib/git/local-branch.js +0 -53
- package/dist/lib/git/local-status.js +0 -57
- package/dist/lib/project/interactive-setup.js +0 -56
- package/dist/lib/project/local-pin.js +0 -200
- package/dist/lib/project/resolution.js +0 -386
- package/dist/lib/project/setup.js +0 -135
- package/dist/lib/version.js +0 -55
- package/dist/output/patterns.js +0 -90
- package/dist/presenters/app-env.js +0 -265
- package/dist/presenters/app.js +0 -646
- package/dist/presenters/auth.js +0 -183
- package/dist/presenters/branch.js +0 -46
- package/dist/presenters/database.js +0 -274
- package/dist/presenters/project.js +0 -174
- package/dist/presenters/verbose-context.js +0 -64
- package/dist/presenters/version.js +0 -29
- package/dist/shell/command-arguments.js +0 -6
- package/dist/shell/command-meta.js +0 -622
- package/dist/shell/command-runner.js +0 -112
- package/dist/shell/diagnostics-output.js +0 -57
- package/dist/shell/errors.js +0 -134
- package/dist/shell/global-flags.js +0 -37
- package/dist/shell/help.js +0 -89
- package/dist/shell/output.js +0 -82
- package/dist/shell/prompt.js +0 -41
- package/dist/shell/runtime.js +0 -55
- package/dist/shell/ui.js +0 -116
- package/dist/shell/update-check.js +0 -247
- package/dist/use-cases/auth.js +0 -145
- package/dist/use-cases/branch.js +0 -47
- package/dist/use-cases/create-cli-gateways.js +0 -68
- package/dist/use-cases/project.js +0 -30
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { usageError } from "../../shell/errors.js";
|
|
2
|
-
import { APP_BUILD_TYPES } from "../../lib/app/build.js";
|
|
3
|
-
import { attachCommandDescriptor } from "../../shell/command-meta.js";
|
|
4
|
-
import { addCompactGlobalFlags, addGlobalFlags } from "../../shell/global-flags.js";
|
|
5
|
-
import { configureRuntimeCommand } from "../../shell/runtime.js";
|
|
6
|
-
import { runAppBuild, runAppDeploy, runAppDomainAdd, runAppDomainRemove, runAppDomainRetry, runAppDomainShow, runAppDomainWait, runAppListDeploys, runAppLogs, runAppOpen, runAppPromote, runAppRemove, runAppRollback, runAppRun, runAppShow, runAppShowDeploy } from "../../controllers/app.js";
|
|
7
|
-
import { isAppDeployAllResult, renderAppBuild, renderAppDeploy, renderAppDeployAll, renderAppDomainAdd, renderAppDomainRemove, renderAppDomainRetry, renderAppDomainShow, renderAppListDeploys, renderAppOpen, renderAppPromote, renderAppRemove, renderAppRollback, renderAppRun, renderAppShow, renderAppShowDeploy, serializeAppBuild, serializeAppDeploy, serializeAppDeployAll, serializeAppDomainAdd, serializeAppDomainRemove, serializeAppDomainRetry, serializeAppDomainShow, serializeAppListDeploys, serializeAppOpen, serializeAppPromote, serializeAppRemove, serializeAppRollback, serializeAppRun, serializeAppShow, serializeAppShowDeploy } from "../../presenters/app.js";
|
|
8
|
-
import { runCommand, runStreamingCommand } from "../../shell/command-runner.js";
|
|
9
|
-
import { Command, Option } from "commander";
|
|
10
|
-
import { FRAMEWORK_KEYS, LOCAL_DEV_BUILD_TYPES } from "@prisma/compute-sdk/config";
|
|
11
|
-
//#region src/commands/app/index.ts
|
|
12
|
-
function createAppCommand(runtime) {
|
|
13
|
-
const app = attachCommandDescriptor(configureRuntimeCommand(new Command("app"), runtime), "app");
|
|
14
|
-
addCompactGlobalFlags(app);
|
|
15
|
-
app.addCommand(createBuildCommand(runtime));
|
|
16
|
-
app.addCommand(createRunCommand(runtime));
|
|
17
|
-
app.addCommand(createDeployCommand(runtime));
|
|
18
|
-
app.addCommand(createShowCommand(runtime));
|
|
19
|
-
app.addCommand(createOpenCommand(runtime));
|
|
20
|
-
app.addCommand(createDomainCommand(runtime));
|
|
21
|
-
app.addCommand(createLogsCommand(runtime));
|
|
22
|
-
app.addCommand(createListDeploysCommand(runtime));
|
|
23
|
-
app.addCommand(createShowDeployCommand(runtime));
|
|
24
|
-
app.addCommand(createPromoteCommand(runtime));
|
|
25
|
-
app.addCommand(createRollbackCommand(runtime));
|
|
26
|
-
app.addCommand(createRemoveCommand(runtime));
|
|
27
|
-
return app;
|
|
28
|
-
}
|
|
29
|
-
function createBuildCommand(runtime) {
|
|
30
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("build"), runtime), "app.build");
|
|
31
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto builds")).addOption(new Option("--build-type <type>", "Local build type").choices([...APP_BUILD_TYPES]).default("auto"));
|
|
32
|
-
addGlobalFlags(command);
|
|
33
|
-
command.action(async (configTarget, options) => {
|
|
34
|
-
const entry = options.entry;
|
|
35
|
-
const buildType = options.buildType;
|
|
36
|
-
await runCommand(runtime, "app.build", options, (context) => runAppBuild(context, {
|
|
37
|
-
entrypoint: entry,
|
|
38
|
-
buildType,
|
|
39
|
-
configTarget
|
|
40
|
-
}), {
|
|
41
|
-
renderHuman: (context, descriptor, result) => renderAppBuild(context, descriptor, result),
|
|
42
|
-
renderJson: (result) => serializeAppBuild(result)
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
return command;
|
|
46
|
-
}
|
|
47
|
-
function createRunCommand(runtime) {
|
|
48
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("run"), runtime), "app.run");
|
|
49
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto runs")).addOption(new Option("--build-type <type>", "Local framework type").choices(["auto", ...LOCAL_DEV_BUILD_TYPES]).default("auto")).addOption(new Option("--port <port>", "Local port"));
|
|
50
|
-
addGlobalFlags(command);
|
|
51
|
-
command.action(async (configTarget, options) => {
|
|
52
|
-
const entry = options.entry;
|
|
53
|
-
const buildType = options.buildType;
|
|
54
|
-
const port = options.port;
|
|
55
|
-
await runCommand(runtime, "app.run", options, (context) => runAppRun(context, {
|
|
56
|
-
entrypoint: entry,
|
|
57
|
-
buildType,
|
|
58
|
-
port,
|
|
59
|
-
configTarget
|
|
60
|
-
}), {
|
|
61
|
-
renderHuman: (context, descriptor, result) => renderAppRun(context, descriptor, result),
|
|
62
|
-
renderJson: (result) => serializeAppRun(result)
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
return command;
|
|
66
|
-
}
|
|
67
|
-
function createDeployCommand(runtime) {
|
|
68
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("deploy"), runtime), "app.deploy");
|
|
69
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--create-project <name>", "Create and link a new Project before deploying")).addOption(new Option("--branch <name>", "Branch name")).addOption(new Option("--framework <name>", "Framework to deploy").choices([...FRAMEWORK_KEYS])).addOption(new Option("--entry <path>", "Entrypoint path for Bun deploys")).addOption(new Option("--http-port <port>", "HTTP port override for the deployed app")).addOption(new Option("--env <name=value|file>", "Environment variable assignment or dotenv file").argParser(collectRepeatableValues)).addOption(new Option("--db", "Create and wire a Prisma Postgres database for this deploy target")).addOption(new Option("--no-db", "Skip database setup")).addOption(new Option("--prod", "Confirm intent to deploy to production"));
|
|
70
|
-
addGlobalFlags(command);
|
|
71
|
-
command.action(async (configTarget, options) => {
|
|
72
|
-
const appName = options.app;
|
|
73
|
-
const entry = options.entry;
|
|
74
|
-
const branchName = options.branch;
|
|
75
|
-
const framework = options.framework;
|
|
76
|
-
const httpPort = options.httpPort;
|
|
77
|
-
const envAssignments = options.env;
|
|
78
|
-
const projectRef = options.project;
|
|
79
|
-
const createProjectName = options.createProject;
|
|
80
|
-
const prod = options.prod;
|
|
81
|
-
const db = options.db;
|
|
82
|
-
const hasDbConflict = hasFlag(runtime.argv, "--db") && hasFlag(runtime.argv, "--no-db");
|
|
83
|
-
await runCommand(runtime, "app.deploy", options, (context) => {
|
|
84
|
-
if (hasDbConflict) throw usageError("app deploy accepts either --db or --no-db", "--db requests database setup, while --no-db disables it.", "Pass exactly one database setup flag.", ["prisma-cli app deploy --db", "prisma-cli app deploy --no-db"], "app");
|
|
85
|
-
return runAppDeploy(context, appName, {
|
|
86
|
-
projectRef,
|
|
87
|
-
createProjectName,
|
|
88
|
-
branchName,
|
|
89
|
-
entrypoint: entry,
|
|
90
|
-
framework,
|
|
91
|
-
httpPort,
|
|
92
|
-
envAssignments,
|
|
93
|
-
prod: prod === true,
|
|
94
|
-
db,
|
|
95
|
-
configTarget
|
|
96
|
-
});
|
|
97
|
-
}, {
|
|
98
|
-
renderHuman: (context, descriptor, result) => isAppDeployAllResult(result) ? renderAppDeployAll(context, descriptor, result) : renderAppDeploy(context, descriptor, result),
|
|
99
|
-
renderJson: (result) => isAppDeployAllResult(result) ? serializeAppDeployAll(result) : serializeAppDeploy(result)
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
return command;
|
|
103
|
-
}
|
|
104
|
-
function hasFlag(argv, flag) {
|
|
105
|
-
return argv.some((arg) => arg === flag || arg.startsWith(`${flag}=`));
|
|
106
|
-
}
|
|
107
|
-
function createShowCommand(runtime) {
|
|
108
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "app.show");
|
|
109
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
110
|
-
addGlobalFlags(command);
|
|
111
|
-
command.action(async (configTarget, options) => {
|
|
112
|
-
const appName = options.app;
|
|
113
|
-
const projectRef = options.project;
|
|
114
|
-
await runCommand(runtime, "app.show", options, (context) => runAppShow(context, appName, projectRef, configTarget), {
|
|
115
|
-
renderHuman: (context, descriptor, result) => renderAppShow(context, descriptor, result),
|
|
116
|
-
renderJson: (result) => serializeAppShow(result)
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
return command;
|
|
120
|
-
}
|
|
121
|
-
function createOpenCommand(runtime) {
|
|
122
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("open"), runtime), "app.open");
|
|
123
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
124
|
-
addGlobalFlags(command);
|
|
125
|
-
command.action(async (configTarget, options) => {
|
|
126
|
-
const appName = options.app;
|
|
127
|
-
const projectRef = options.project;
|
|
128
|
-
await runCommand(runtime, "app.open", options, (context) => runAppOpen(context, appName, projectRef, configTarget), {
|
|
129
|
-
renderHuman: (context, descriptor, result) => renderAppOpen(context, descriptor, result),
|
|
130
|
-
renderJson: (result) => serializeAppOpen(result)
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
return command;
|
|
134
|
-
}
|
|
135
|
-
function createDomainCommand(runtime) {
|
|
136
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("domain"), runtime), "app.domain");
|
|
137
|
-
addCompactGlobalFlags(command);
|
|
138
|
-
command.addCommand(createDomainAddCommand(runtime));
|
|
139
|
-
command.addCommand(createDomainShowCommand(runtime));
|
|
140
|
-
command.addCommand(createDomainRemoveCommand(runtime));
|
|
141
|
-
command.addCommand(createDomainRetryCommand(runtime));
|
|
142
|
-
command.addCommand(createDomainWaitCommand(runtime));
|
|
143
|
-
return command;
|
|
144
|
-
}
|
|
145
|
-
function addDomainTargetOptions(command) {
|
|
146
|
-
return command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--branch <name>", "Branch name"));
|
|
147
|
-
}
|
|
148
|
-
function createDomainAddCommand(runtime) {
|
|
149
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("add"), runtime), "app.domain.add");
|
|
150
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
151
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
152
|
-
addDomainTargetOptions(command);
|
|
153
|
-
addGlobalFlags(command);
|
|
154
|
-
command.action(async (hostname, configTarget, options) => {
|
|
155
|
-
const appName = options.app;
|
|
156
|
-
const projectRef = options.project;
|
|
157
|
-
const branchName = options.branch;
|
|
158
|
-
await runCommand(runtime, "app.domain.add", options, (context) => runAppDomainAdd(context, hostname, {
|
|
159
|
-
appName,
|
|
160
|
-
projectRef,
|
|
161
|
-
branchName,
|
|
162
|
-
configTarget
|
|
163
|
-
}), {
|
|
164
|
-
renderHuman: (context, descriptor, result) => renderAppDomainAdd(context, descriptor, result),
|
|
165
|
-
renderJson: (result) => serializeAppDomainAdd(result)
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
return command;
|
|
169
|
-
}
|
|
170
|
-
function createDomainShowCommand(runtime) {
|
|
171
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "app.domain.show");
|
|
172
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
173
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
174
|
-
addDomainTargetOptions(command);
|
|
175
|
-
addGlobalFlags(command);
|
|
176
|
-
command.action(async (hostname, configTarget, options) => {
|
|
177
|
-
const appName = options.app;
|
|
178
|
-
const projectRef = options.project;
|
|
179
|
-
const branchName = options.branch;
|
|
180
|
-
await runCommand(runtime, "app.domain.show", options, (context) => runAppDomainShow(context, hostname, {
|
|
181
|
-
appName,
|
|
182
|
-
projectRef,
|
|
183
|
-
branchName,
|
|
184
|
-
configTarget
|
|
185
|
-
}), {
|
|
186
|
-
renderHuman: (context, descriptor, result) => renderAppDomainShow(context, descriptor, result),
|
|
187
|
-
renderJson: (result) => serializeAppDomainShow(result)
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
return command;
|
|
191
|
-
}
|
|
192
|
-
function createDomainRemoveCommand(runtime) {
|
|
193
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "app.domain.remove");
|
|
194
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
195
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
196
|
-
addDomainTargetOptions(command);
|
|
197
|
-
addGlobalFlags(command);
|
|
198
|
-
command.action(async (hostname, configTarget, options) => {
|
|
199
|
-
const appName = options.app;
|
|
200
|
-
const projectRef = options.project;
|
|
201
|
-
const branchName = options.branch;
|
|
202
|
-
await runCommand(runtime, "app.domain.remove", options, (context) => runAppDomainRemove(context, hostname, {
|
|
203
|
-
appName,
|
|
204
|
-
projectRef,
|
|
205
|
-
branchName,
|
|
206
|
-
configTarget
|
|
207
|
-
}), {
|
|
208
|
-
renderHuman: (context, descriptor, result) => renderAppDomainRemove(context, descriptor, result),
|
|
209
|
-
renderJson: (result) => serializeAppDomainRemove(result)
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
return command;
|
|
213
|
-
}
|
|
214
|
-
function createDomainRetryCommand(runtime) {
|
|
215
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("retry"), runtime), "app.domain.retry");
|
|
216
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
217
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
218
|
-
addDomainTargetOptions(command);
|
|
219
|
-
addGlobalFlags(command);
|
|
220
|
-
command.action(async (hostname, configTarget, options) => {
|
|
221
|
-
const appName = options.app;
|
|
222
|
-
const projectRef = options.project;
|
|
223
|
-
const branchName = options.branch;
|
|
224
|
-
await runCommand(runtime, "app.domain.retry", options, (context) => runAppDomainRetry(context, hostname, {
|
|
225
|
-
appName,
|
|
226
|
-
projectRef,
|
|
227
|
-
branchName,
|
|
228
|
-
configTarget
|
|
229
|
-
}), {
|
|
230
|
-
renderHuman: (context, descriptor, result) => renderAppDomainRetry(context, descriptor, result),
|
|
231
|
-
renderJson: (result) => serializeAppDomainRetry(result)
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
return command;
|
|
235
|
-
}
|
|
236
|
-
function createDomainWaitCommand(runtime) {
|
|
237
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("wait"), runtime), "app.domain.wait");
|
|
238
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
239
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
240
|
-
addDomainTargetOptions(command);
|
|
241
|
-
command.addOption(new Option("--timeout <duration>", "Maximum time to wait").default("15m"));
|
|
242
|
-
addGlobalFlags(command);
|
|
243
|
-
command.action(async (hostname, configTarget, options) => {
|
|
244
|
-
const appName = options.app;
|
|
245
|
-
const projectRef = options.project;
|
|
246
|
-
const branchName = options.branch;
|
|
247
|
-
const timeout = options.timeout;
|
|
248
|
-
await runStreamingCommand(runtime, "app.domain.wait", options, (context) => runAppDomainWait(context, hostname, {
|
|
249
|
-
appName,
|
|
250
|
-
projectRef,
|
|
251
|
-
branchName,
|
|
252
|
-
timeout,
|
|
253
|
-
configTarget
|
|
254
|
-
}));
|
|
255
|
-
});
|
|
256
|
-
return command;
|
|
257
|
-
}
|
|
258
|
-
function createLogsCommand(runtime) {
|
|
259
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logs"), runtime), "app.logs");
|
|
260
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--deployment <id>", "Deployment id"));
|
|
261
|
-
addGlobalFlags(command);
|
|
262
|
-
command.action(async (configTarget, options) => {
|
|
263
|
-
const appName = options.app;
|
|
264
|
-
const deploymentId = options.deployment;
|
|
265
|
-
const projectRef = options.project;
|
|
266
|
-
await runStreamingCommand(runtime, "app.logs", options, (context) => runAppLogs(context, appName, deploymentId, projectRef, configTarget));
|
|
267
|
-
});
|
|
268
|
-
return command;
|
|
269
|
-
}
|
|
270
|
-
function collectRepeatableValues(value, previous) {
|
|
271
|
-
return [...previous ?? [], value];
|
|
272
|
-
}
|
|
273
|
-
function createListDeploysCommand(runtime) {
|
|
274
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list-deploys"), runtime), "app.list-deploys");
|
|
275
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
276
|
-
addGlobalFlags(command);
|
|
277
|
-
command.action(async (configTarget, options) => {
|
|
278
|
-
const appName = options.app;
|
|
279
|
-
const projectRef = options.project;
|
|
280
|
-
await runCommand(runtime, "app.list-deploys", options, (context) => runAppListDeploys(context, appName, projectRef, configTarget), {
|
|
281
|
-
renderHuman: (context, descriptor, result) => renderAppListDeploys(context, descriptor, result),
|
|
282
|
-
renderJson: (result) => serializeAppListDeploys(result)
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
return command;
|
|
286
|
-
}
|
|
287
|
-
function createShowDeployCommand(runtime) {
|
|
288
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show-deploy"), runtime), "app.show-deploy");
|
|
289
|
-
command.argument("<deployment>", "Deployment id");
|
|
290
|
-
addGlobalFlags(command);
|
|
291
|
-
command.action(async (deploymentId, options) => {
|
|
292
|
-
await runCommand(runtime, "app.show-deploy", options, (context) => runAppShowDeploy(context, deploymentId), {
|
|
293
|
-
renderHuman: (context, descriptor, result) => renderAppShowDeploy(context, descriptor, result),
|
|
294
|
-
renderJson: (result) => serializeAppShowDeploy(result)
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
return command;
|
|
298
|
-
}
|
|
299
|
-
function createPromoteCommand(runtime) {
|
|
300
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("promote"), runtime), "app.promote");
|
|
301
|
-
command.argument("<deployment>", "Deployment id");
|
|
302
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
303
|
-
command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
304
|
-
addGlobalFlags(command);
|
|
305
|
-
command.action(async (deploymentId, configTarget, options) => {
|
|
306
|
-
const appName = options.app;
|
|
307
|
-
const projectRef = options.project;
|
|
308
|
-
await runCommand(runtime, "app.promote", options, (context) => runAppPromote(context, deploymentId, appName, projectRef, configTarget), {
|
|
309
|
-
renderHuman: (context, descriptor, result) => renderAppPromote(context, descriptor, result),
|
|
310
|
-
renderJson: (result) => serializeAppPromote(result)
|
|
311
|
-
});
|
|
312
|
-
});
|
|
313
|
-
return command;
|
|
314
|
-
}
|
|
315
|
-
function createRollbackCommand(runtime) {
|
|
316
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("rollback"), runtime), "app.rollback");
|
|
317
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--to <deployment>", "Deployment id"));
|
|
318
|
-
addGlobalFlags(command);
|
|
319
|
-
command.action(async (configTarget, options) => {
|
|
320
|
-
const appName = options.app;
|
|
321
|
-
const deploymentId = options.to;
|
|
322
|
-
const projectRef = options.project;
|
|
323
|
-
await runCommand(runtime, "app.rollback", options, (context) => runAppRollback(context, appName, deploymentId, projectRef, configTarget), {
|
|
324
|
-
renderHuman: (context, descriptor, result) => renderAppRollback(context, descriptor, result),
|
|
325
|
-
renderJson: (result) => serializeAppRollback(result)
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
return command;
|
|
329
|
-
}
|
|
330
|
-
function createRemoveCommand(runtime) {
|
|
331
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "app.remove");
|
|
332
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
333
|
-
addGlobalFlags(command);
|
|
334
|
-
command.action(async (configTarget, options) => {
|
|
335
|
-
const appName = options.app;
|
|
336
|
-
const projectRef = options.project;
|
|
337
|
-
await runCommand(runtime, "app.remove", options, (context) => runAppRemove(context, appName, projectRef, configTarget), {
|
|
338
|
-
renderHuman: (context, descriptor, result) => renderAppRemove(context, descriptor, result),
|
|
339
|
-
renderJson: (result) => serializeAppRemove(result)
|
|
340
|
-
});
|
|
341
|
-
});
|
|
342
|
-
return command;
|
|
343
|
-
}
|
|
344
|
-
//#endregion
|
|
345
|
-
export { createAppCommand };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { attachCommandDescriptor } from "../../shell/command-meta.js";
|
|
2
|
-
import { addCompactGlobalFlags, addGlobalFlags } from "../../shell/global-flags.js";
|
|
3
|
-
import { configureRuntimeCommand } from "../../shell/runtime.js";
|
|
4
|
-
import { runAuthLogin, runAuthLogout, runAuthWhoAmI, runAuthWorkspaceList, runAuthWorkspaceLogout, runAuthWorkspaceUse } from "../../controllers/auth.js";
|
|
5
|
-
import { runCommand } from "../../shell/command-runner.js";
|
|
6
|
-
import { renderAuthSuccess, renderAuthWorkspaceList, renderAuthWorkspaceLogout, renderAuthWorkspaceUse, serializeAuthWorkspaceList, serializeAuthWorkspaceLogout, serializeAuthWorkspaceUse } from "../../presenters/auth.js";
|
|
7
|
-
import { Command, Option } from "commander";
|
|
8
|
-
//#region src/commands/auth/index.ts
|
|
9
|
-
function createAuthCommand(runtime) {
|
|
10
|
-
const auth = attachCommandDescriptor(configureRuntimeCommand(new Command("auth"), runtime), "auth");
|
|
11
|
-
addCompactGlobalFlags(auth);
|
|
12
|
-
auth.addCommand(createAuthLoginCommand(runtime));
|
|
13
|
-
auth.addCommand(createAuthLogoutCommand(runtime));
|
|
14
|
-
auth.addCommand(createAuthWhoAmICommand(runtime));
|
|
15
|
-
auth.addCommand(createAuthWorkspaceCommand(runtime));
|
|
16
|
-
return auth;
|
|
17
|
-
}
|
|
18
|
-
function createAuthLoginCommand(runtime) {
|
|
19
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("login"), runtime), "auth.login");
|
|
20
|
-
command.addOption(new Option("--provider <provider>").hideHelp()).addOption(new Option("--user <id>").hideHelp()).addOption(new Option("--workspace <id>").hideHelp());
|
|
21
|
-
addGlobalFlags(command);
|
|
22
|
-
command.action(async (options) => {
|
|
23
|
-
await runCommand(runtime, "auth.login", options, (context) => runAuthLogin(context, options), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.login", result) });
|
|
24
|
-
});
|
|
25
|
-
return command;
|
|
26
|
-
}
|
|
27
|
-
function createAuthLogoutCommand(runtime) {
|
|
28
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logout"), runtime), "auth.logout");
|
|
29
|
-
command.addOption(new Option("--workspace <id-or-name>", "Remove one stored OAuth workspace session"));
|
|
30
|
-
addGlobalFlags(command);
|
|
31
|
-
command.action(async (options) => {
|
|
32
|
-
const logoutOptions = options;
|
|
33
|
-
if (logoutOptions.workspace?.trim()) {
|
|
34
|
-
await runCommand(runtime, "auth.workspace.logout", options, (context) => runAuthWorkspaceLogout(context, logoutOptions.workspace), {
|
|
35
|
-
renderHuman: (context, descriptor, result) => renderAuthWorkspaceLogout(context, descriptor, result),
|
|
36
|
-
renderJson: (result) => serializeAuthWorkspaceLogout(result)
|
|
37
|
-
});
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
await runCommand(runtime, "auth.logout", options, (context) => runAuthLogout(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.logout", result) });
|
|
41
|
-
});
|
|
42
|
-
return command;
|
|
43
|
-
}
|
|
44
|
-
function createAuthWhoAmICommand(runtime) {
|
|
45
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("whoami"), runtime), "auth.whoami");
|
|
46
|
-
addGlobalFlags(command);
|
|
47
|
-
command.action(async (options) => {
|
|
48
|
-
await runCommand(runtime, "auth.whoami", options, (context) => runAuthWhoAmI(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.whoami", result) });
|
|
49
|
-
});
|
|
50
|
-
return command;
|
|
51
|
-
}
|
|
52
|
-
function createAuthWorkspaceCommand(runtime) {
|
|
53
|
-
const workspace = attachCommandDescriptor(configureRuntimeCommand(new Command("workspace"), runtime), "auth.workspace");
|
|
54
|
-
addCompactGlobalFlags(workspace);
|
|
55
|
-
workspace.addCommand(createAuthWorkspaceListCommand(runtime));
|
|
56
|
-
workspace.addCommand(createAuthWorkspaceUseCommand(runtime));
|
|
57
|
-
workspace.addCommand(createAuthWorkspaceLogoutCommand(runtime));
|
|
58
|
-
return workspace;
|
|
59
|
-
}
|
|
60
|
-
function createAuthWorkspaceListCommand(runtime) {
|
|
61
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "auth.workspace.list");
|
|
62
|
-
addGlobalFlags(command);
|
|
63
|
-
command.action(async (options) => {
|
|
64
|
-
await runCommand(runtime, "auth.workspace.list", options, (context) => runAuthWorkspaceList(context), {
|
|
65
|
-
renderHuman: (context, descriptor, result) => renderAuthWorkspaceList(context, descriptor, result),
|
|
66
|
-
renderJson: (result) => serializeAuthWorkspaceList(result)
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
return command;
|
|
70
|
-
}
|
|
71
|
-
function createAuthWorkspaceLogoutCommand(runtime) {
|
|
72
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logout"), runtime), "auth.workspace.logout");
|
|
73
|
-
command.argument("<id-or-name>", "Workspace id or exact name");
|
|
74
|
-
addGlobalFlags(command);
|
|
75
|
-
command.action(async (workspaceRef, options) => {
|
|
76
|
-
await runCommand(runtime, "auth.workspace.logout", options, (context) => runAuthWorkspaceLogout(context, typeof workspaceRef === "string" ? workspaceRef : void 0), {
|
|
77
|
-
renderHuman: (context, descriptor, result) => renderAuthWorkspaceLogout(context, descriptor, result),
|
|
78
|
-
renderJson: (result) => serializeAuthWorkspaceLogout(result)
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
return command;
|
|
82
|
-
}
|
|
83
|
-
function createAuthWorkspaceUseCommand(runtime) {
|
|
84
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("use"), runtime), "auth.workspace.use");
|
|
85
|
-
command.argument("[id-or-name]", "Workspace id or exact name");
|
|
86
|
-
addGlobalFlags(command);
|
|
87
|
-
command.action(async (workspaceRef, options) => {
|
|
88
|
-
await runCommand(runtime, "auth.workspace.use", options, (context) => runAuthWorkspaceUse(context, typeof workspaceRef === "string" ? workspaceRef : void 0), {
|
|
89
|
-
renderHuman: (context, descriptor, result) => renderAuthWorkspaceUse(context, descriptor, result),
|
|
90
|
-
renderJson: (result) => serializeAuthWorkspaceUse(result)
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
return command;
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
|
-
export { createAuthCommand };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { attachCommandDescriptor } from "../../shell/command-meta.js";
|
|
2
|
-
import { addCompactGlobalFlags, addGlobalFlags } from "../../shell/global-flags.js";
|
|
3
|
-
import { configureRuntimeCommand } from "../../shell/runtime.js";
|
|
4
|
-
import { runCommand } from "../../shell/command-runner.js";
|
|
5
|
-
import { runBranchList } from "../../controllers/branch.js";
|
|
6
|
-
import { renderBranchList, serializeBranchList } from "../../presenters/branch.js";
|
|
7
|
-
import { Command } from "commander";
|
|
8
|
-
//#region src/commands/branch/index.ts
|
|
9
|
-
function createBranchCommand(runtime) {
|
|
10
|
-
const branch = attachCommandDescriptor(configureRuntimeCommand(new Command("branch"), runtime), "branch");
|
|
11
|
-
addCompactGlobalFlags(branch);
|
|
12
|
-
branch.addCommand(createBranchListCommand(runtime));
|
|
13
|
-
return branch;
|
|
14
|
-
}
|
|
15
|
-
function createBranchListCommand(runtime) {
|
|
16
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "branch.list");
|
|
17
|
-
addGlobalFlags(command);
|
|
18
|
-
command.action(async (options) => {
|
|
19
|
-
await runCommand(runtime, "branch.list", options, (context) => runBranchList(context), {
|
|
20
|
-
renderHuman: (context, descriptor, result) => renderBranchList(context, descriptor, result),
|
|
21
|
-
renderJson: (result) => serializeBranchList(result)
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
return command;
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { createBranchCommand };
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { attachCommandDescriptor } from "../../shell/command-meta.js";
|
|
2
|
-
import { addCompactGlobalFlags, addGlobalFlags } from "../../shell/global-flags.js";
|
|
3
|
-
import { configureRuntimeCommand } from "../../shell/runtime.js";
|
|
4
|
-
import { runCommand } from "../../shell/command-runner.js";
|
|
5
|
-
import { runDatabaseConnectionCreate, runDatabaseConnectionList, runDatabaseConnectionRemove, runDatabaseCreate, runDatabaseList, runDatabaseRemove, runDatabaseShow } from "../../controllers/database.js";
|
|
6
|
-
import { renderDatabaseConnectionCreate, renderDatabaseConnectionCreateStdout, renderDatabaseConnectionList, renderDatabaseConnectionRemove, renderDatabaseCreate, renderDatabaseCreateStdout, renderDatabaseList, renderDatabaseRemove, renderDatabaseShow, serializeDatabaseConnectionCreate, serializeDatabaseConnectionList, serializeDatabaseConnectionRemove, serializeDatabaseCreate, serializeDatabaseList, serializeDatabaseRemove, serializeDatabaseShow } from "../../presenters/database.js";
|
|
7
|
-
import { Command, Option } from "commander";
|
|
8
|
-
//#region src/commands/database/index.ts
|
|
9
|
-
function createDatabaseCommand(runtime) {
|
|
10
|
-
const database = attachCommandDescriptor(configureRuntimeCommand(new Command("database"), runtime), "database");
|
|
11
|
-
addCompactGlobalFlags(database);
|
|
12
|
-
database.addCommand(createDatabaseListCommand(runtime));
|
|
13
|
-
database.addCommand(createDatabaseShowCommand(runtime));
|
|
14
|
-
database.addCommand(createDatabaseCreateCommand(runtime));
|
|
15
|
-
database.addCommand(createDatabaseRemoveCommand(runtime));
|
|
16
|
-
database.addCommand(createDatabaseConnectionCommand(runtime));
|
|
17
|
-
return database;
|
|
18
|
-
}
|
|
19
|
-
function addProjectAndBranchOptions(command) {
|
|
20
|
-
return command.addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--branch <git-name>", "Branch git name"));
|
|
21
|
-
}
|
|
22
|
-
function createDatabaseListCommand(runtime) {
|
|
23
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "database.list");
|
|
24
|
-
addProjectAndBranchOptions(command);
|
|
25
|
-
addGlobalFlags(command);
|
|
26
|
-
command.action(async (options) => {
|
|
27
|
-
const projectRef = options.project;
|
|
28
|
-
const branchName = options.branch;
|
|
29
|
-
await runCommand(runtime, "database.list", options, (context) => runDatabaseList(context, {
|
|
30
|
-
projectRef,
|
|
31
|
-
branchName
|
|
32
|
-
}), {
|
|
33
|
-
renderHuman: (context, descriptor, result) => renderDatabaseList(context, descriptor, result),
|
|
34
|
-
renderJson: (result) => serializeDatabaseList(result)
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
return command;
|
|
38
|
-
}
|
|
39
|
-
function createDatabaseShowCommand(runtime) {
|
|
40
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "database.show");
|
|
41
|
-
command.argument("<database>", "Database id or name");
|
|
42
|
-
addProjectAndBranchOptions(command);
|
|
43
|
-
addGlobalFlags(command);
|
|
44
|
-
command.action(async (databaseRef, options) => {
|
|
45
|
-
const projectRef = options.project;
|
|
46
|
-
const branchName = options.branch;
|
|
47
|
-
await runCommand(runtime, "database.show", options, (context) => runDatabaseShow(context, databaseRef, {
|
|
48
|
-
projectRef,
|
|
49
|
-
branchName
|
|
50
|
-
}), {
|
|
51
|
-
renderHuman: (context, descriptor, result) => renderDatabaseShow(context, descriptor, result),
|
|
52
|
-
renderJson: (result) => serializeDatabaseShow(result)
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
return command;
|
|
56
|
-
}
|
|
57
|
-
function createDatabaseCreateCommand(runtime) {
|
|
58
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("create"), runtime), "database.create");
|
|
59
|
-
command.argument("<name>", "Database name").addOption(new Option("--region <region>", "Prisma Postgres region id"));
|
|
60
|
-
addProjectAndBranchOptions(command);
|
|
61
|
-
addGlobalFlags(command);
|
|
62
|
-
command.action(async (name, options) => {
|
|
63
|
-
const projectRef = options.project;
|
|
64
|
-
const branchName = options.branch;
|
|
65
|
-
const region = options.region;
|
|
66
|
-
await runCommand(runtime, "database.create", options, (context) => runDatabaseCreate(context, name, {
|
|
67
|
-
projectRef,
|
|
68
|
-
branchName,
|
|
69
|
-
region
|
|
70
|
-
}), {
|
|
71
|
-
renderStdout: (context, descriptor, result) => renderDatabaseCreateStdout(context, descriptor, result),
|
|
72
|
-
renderHuman: (context, descriptor, result) => renderDatabaseCreate(context, descriptor, result),
|
|
73
|
-
renderJson: (result) => serializeDatabaseCreate(result)
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
return command;
|
|
77
|
-
}
|
|
78
|
-
function createDatabaseRemoveCommand(runtime) {
|
|
79
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "database.remove");
|
|
80
|
-
command.argument("<database>", "Database id or name").addOption(new Option("--confirm <database-id>", "Exact database id required to remove"));
|
|
81
|
-
addProjectAndBranchOptions(command);
|
|
82
|
-
addGlobalFlags(command);
|
|
83
|
-
command.action(async (databaseRef, options) => {
|
|
84
|
-
const projectRef = options.project;
|
|
85
|
-
const branchName = options.branch;
|
|
86
|
-
const confirm = options.confirm;
|
|
87
|
-
await runCommand(runtime, "database.remove", options, (context) => runDatabaseRemove(context, databaseRef, {
|
|
88
|
-
projectRef,
|
|
89
|
-
branchName,
|
|
90
|
-
confirm
|
|
91
|
-
}), {
|
|
92
|
-
renderHuman: (context, descriptor, result) => renderDatabaseRemove(context, descriptor, result),
|
|
93
|
-
renderJson: (result) => serializeDatabaseRemove(result)
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
return command;
|
|
97
|
-
}
|
|
98
|
-
function createDatabaseConnectionCommand(runtime) {
|
|
99
|
-
const connection = attachCommandDescriptor(configureRuntimeCommand(new Command("connection"), runtime), "database.connection");
|
|
100
|
-
addCompactGlobalFlags(connection);
|
|
101
|
-
connection.addCommand(createDatabaseConnectionListCommand(runtime));
|
|
102
|
-
connection.addCommand(createDatabaseConnectionCreateCommand(runtime));
|
|
103
|
-
connection.addCommand(createDatabaseConnectionRemoveCommand(runtime));
|
|
104
|
-
return connection;
|
|
105
|
-
}
|
|
106
|
-
function createDatabaseConnectionListCommand(runtime) {
|
|
107
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "database.connection.list");
|
|
108
|
-
command.argument("<database>", "Database id or name");
|
|
109
|
-
addProjectAndBranchOptions(command);
|
|
110
|
-
addGlobalFlags(command);
|
|
111
|
-
command.action(async (databaseRef, options) => {
|
|
112
|
-
const projectRef = options.project;
|
|
113
|
-
const branchName = options.branch;
|
|
114
|
-
await runCommand(runtime, "database.connection.list", options, (context) => runDatabaseConnectionList(context, databaseRef, {
|
|
115
|
-
projectRef,
|
|
116
|
-
branchName
|
|
117
|
-
}), {
|
|
118
|
-
renderHuman: (context, descriptor, result) => renderDatabaseConnectionList(context, descriptor, result),
|
|
119
|
-
renderJson: (result) => serializeDatabaseConnectionList(result)
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
return command;
|
|
123
|
-
}
|
|
124
|
-
function createDatabaseConnectionCreateCommand(runtime) {
|
|
125
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("create"), runtime), "database.connection.create");
|
|
126
|
-
command.argument("<database>", "Database id or name").addOption(new Option("--name <name>", "Connection name"));
|
|
127
|
-
addProjectAndBranchOptions(command);
|
|
128
|
-
addGlobalFlags(command);
|
|
129
|
-
command.action(async (databaseRef, options) => {
|
|
130
|
-
const projectRef = options.project;
|
|
131
|
-
const branchName = options.branch;
|
|
132
|
-
const name = options.name;
|
|
133
|
-
await runCommand(runtime, "database.connection.create", options, (context) => runDatabaseConnectionCreate(context, databaseRef, {
|
|
134
|
-
projectRef,
|
|
135
|
-
branchName,
|
|
136
|
-
name
|
|
137
|
-
}), {
|
|
138
|
-
renderStdout: (context, descriptor, result) => renderDatabaseConnectionCreateStdout(context, descriptor, result),
|
|
139
|
-
renderHuman: (context, descriptor, result) => renderDatabaseConnectionCreate(context, descriptor, result),
|
|
140
|
-
renderJson: (result) => serializeDatabaseConnectionCreate(result)
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
return command;
|
|
144
|
-
}
|
|
145
|
-
function createDatabaseConnectionRemoveCommand(runtime) {
|
|
146
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "database.connection.remove");
|
|
147
|
-
command.argument("<connection>", "Connection id").addOption(new Option("--confirm <connection-id>", "Exact connection id required to remove"));
|
|
148
|
-
addGlobalFlags(command);
|
|
149
|
-
command.action(async (connectionRef, options) => {
|
|
150
|
-
const confirm = options.confirm;
|
|
151
|
-
await runCommand(runtime, "database.connection.remove", options, (context) => runDatabaseConnectionRemove(context, connectionRef, { confirm }), {
|
|
152
|
-
renderHuman: (context, descriptor, result) => renderDatabaseConnectionRemove(context, descriptor, result),
|
|
153
|
-
renderJson: (result) => serializeDatabaseConnectionRemove(result)
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
return command;
|
|
157
|
-
}
|
|
158
|
-
//#endregion
|
|
159
|
-
export { createDatabaseCommand };
|