@prisma/cli 3.0.0-dev.101.1 → 3.0.0-dev.102.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.
package/dist/controllers/app.js
CHANGED
|
@@ -2254,7 +2254,7 @@ function appDeployFailedError(error, progress) {
|
|
|
2254
2254
|
}
|
|
2255
2255
|
if (!progress.buildStarted) return deployFailedError("App deploy failed", error, ["prisma-cli app deploy"]);
|
|
2256
2256
|
const phaseHeadline = progress.containerLive ? "The deployment started, but the app is not ready yet." : "Deploy failed after the build completed.";
|
|
2257
|
-
const recoveryLines = progress.
|
|
2257
|
+
const recoveryLines = progress.deploymentId ? ["See what happened", `prisma-cli app logs --deployment ${progress.deploymentId}`] : ["Fix", "Retry the command, or rerun with --trace for more detailed diagnostics."];
|
|
2258
2258
|
const urlLines = progress.deploymentUrl ? [
|
|
2259
2259
|
"",
|
|
2260
2260
|
"URL",
|
|
@@ -2280,11 +2280,11 @@ function appDeployFailedError(error, progress) {
|
|
|
2280
2280
|
domain: "app",
|
|
2281
2281
|
summary: phaseHeadline,
|
|
2282
2282
|
why,
|
|
2283
|
-
fix: progress.
|
|
2283
|
+
fix: progress.deploymentId ? `Inspect logs with prisma-cli app logs --deployment ${progress.deploymentId}.` : "Retry the command, or rerun with --trace for more detailed diagnostics.",
|
|
2284
2284
|
debug,
|
|
2285
2285
|
meta: {
|
|
2286
2286
|
phase: progress.containerLive ? "runtime_ready" : "deploy",
|
|
2287
|
-
deploymentId: progress.
|
|
2287
|
+
deploymentId: progress.deploymentId,
|
|
2288
2288
|
deploymentUrl: progress.deploymentUrl
|
|
2289
2289
|
},
|
|
2290
2290
|
humanLines,
|
|
@@ -68,14 +68,14 @@ function createAppProvider(client, options) {
|
|
|
68
68
|
return deleteEnvironmentVariable(client, options);
|
|
69
69
|
},
|
|
70
70
|
async removeApp(appId, options) {
|
|
71
|
-
const appResult = await sdk.
|
|
72
|
-
|
|
71
|
+
const appResult = await sdk.showApp({
|
|
72
|
+
appId,
|
|
73
73
|
signal: options?.signal
|
|
74
74
|
});
|
|
75
75
|
if (appResult.isErr()) throw new Error(appResult.error.message);
|
|
76
|
-
const destroyResult = await sdk.
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const destroyResult = await sdk.destroyApp({
|
|
77
|
+
appId,
|
|
78
|
+
keepApp: false,
|
|
79
79
|
timeoutSeconds: 120,
|
|
80
80
|
pollIntervalMs: 2e3,
|
|
81
81
|
signal: options?.signal
|
|
@@ -90,8 +90,8 @@ function createAppProvider(client, options) {
|
|
|
90
90
|
return listComputeServiceDomains(client, appId, options?.signal);
|
|
91
91
|
},
|
|
92
92
|
async addDomain(options) {
|
|
93
|
-
const result = await client.POST("/v1/
|
|
94
|
-
params: { path: {
|
|
93
|
+
const result = await client.POST("/v1/apps/{appId}/domains", {
|
|
94
|
+
params: { path: { appId: options.appId } },
|
|
95
95
|
body: { hostname: options.hostname },
|
|
96
96
|
signal: options.signal
|
|
97
97
|
});
|
|
@@ -135,8 +135,8 @@ function createAppProvider(client, options) {
|
|
|
135
135
|
},
|
|
136
136
|
async promoteDeployment(options) {
|
|
137
137
|
const promoteResult = await sdk.promote({
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
appId: options.appId,
|
|
139
|
+
deploymentId: options.deploymentId,
|
|
140
140
|
timeoutSeconds: 120,
|
|
141
141
|
pollIntervalMs: 2e3,
|
|
142
142
|
signal: options.signal,
|
|
@@ -169,8 +169,8 @@ function createAppProvider(client, options) {
|
|
|
169
169
|
buildSettings: options.buildSettings
|
|
170
170
|
}),
|
|
171
171
|
projectId: options.projectId,
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
appId: resolvedApp.appId,
|
|
173
|
+
appName: resolvedApp.appName,
|
|
174
174
|
region: resolvedApp.region,
|
|
175
175
|
portMapping: options.portMapping,
|
|
176
176
|
envVars: options.envVars,
|
|
@@ -185,22 +185,22 @@ function createAppProvider(client, options) {
|
|
|
185
185
|
return {
|
|
186
186
|
projectId: deployed.projectId,
|
|
187
187
|
app: {
|
|
188
|
-
id: deployed.
|
|
189
|
-
name: deployed.
|
|
188
|
+
id: deployed.appId,
|
|
189
|
+
name: deployed.appName,
|
|
190
190
|
region: deployed.region ?? null,
|
|
191
|
-
liveDeploymentId: deployed.
|
|
192
|
-
liveUrl: toAbsoluteUrl(deployed.
|
|
191
|
+
liveDeploymentId: deployed.deploymentId,
|
|
192
|
+
liveUrl: toAbsoluteUrl(deployed.appEndpointDomain ?? null)
|
|
193
193
|
},
|
|
194
194
|
deployment: {
|
|
195
|
-
id: deployed.
|
|
195
|
+
id: deployed.deploymentId,
|
|
196
196
|
status: "running",
|
|
197
|
-
url: toAbsoluteUrl(deployed.
|
|
197
|
+
url: toAbsoluteUrl(deployed.appEndpointDomain ?? deployed.deploymentEndpointDomain ?? null)
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
},
|
|
201
201
|
async updateAppEnv(options) {
|
|
202
202
|
const updateResult = await sdk.updateEnv({
|
|
203
|
-
|
|
203
|
+
appId: options.appId,
|
|
204
204
|
envVars: options.envVars,
|
|
205
205
|
timeoutSeconds: 120,
|
|
206
206
|
pollIntervalMs: 2e3,
|
|
@@ -209,19 +209,19 @@ function createAppProvider(client, options) {
|
|
|
209
209
|
});
|
|
210
210
|
if (updateResult.isErr()) throw new Error(updateResult.error.message);
|
|
211
211
|
const promoteResult = await sdk.promote({
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
appId: options.appId,
|
|
213
|
+
deploymentId: updateResult.value.deploymentId,
|
|
214
214
|
timeoutSeconds: 120,
|
|
215
215
|
pollIntervalMs: 2e3,
|
|
216
216
|
signal: options.signal,
|
|
217
217
|
progress: options.promoteProgress
|
|
218
218
|
});
|
|
219
219
|
if (promoteResult.isErr()) throw new Error(promoteResult.error.message);
|
|
220
|
-
const [serviceResult, versionResult] = await Promise.all([sdk.
|
|
221
|
-
|
|
220
|
+
const [serviceResult, versionResult] = await Promise.all([sdk.showApp({
|
|
221
|
+
appId: options.appId,
|
|
222
222
|
signal: options.signal
|
|
223
|
-
}), sdk.
|
|
224
|
-
|
|
223
|
+
}), sdk.showDeployment({
|
|
224
|
+
deploymentId: updateResult.value.deploymentId,
|
|
225
225
|
signal: options.signal
|
|
226
226
|
})]);
|
|
227
227
|
if (serviceResult.isErr()) throw new Error(serviceResult.error.message);
|
|
@@ -232,25 +232,25 @@ function createAppProvider(client, options) {
|
|
|
232
232
|
id: serviceResult.value.id,
|
|
233
233
|
name: serviceResult.value.name,
|
|
234
234
|
region: serviceResult.value.region ?? null,
|
|
235
|
-
liveDeploymentId: serviceResult.value.
|
|
236
|
-
liveUrl: toAbsoluteUrl(serviceResult.value.
|
|
235
|
+
liveDeploymentId: serviceResult.value.latestDeploymentId ?? null,
|
|
236
|
+
liveUrl: toAbsoluteUrl(serviceResult.value.appEndpointDomain ?? null)
|
|
237
237
|
},
|
|
238
238
|
deployment: {
|
|
239
239
|
id: versionResult.value.id,
|
|
240
240
|
status: versionResult.value.status,
|
|
241
241
|
createdAt: versionResult.value.createdAt,
|
|
242
|
-
url: toAbsoluteUrl(serviceResult.value.
|
|
242
|
+
url: toAbsoluteUrl(serviceResult.value.appEndpointDomain ?? versionResult.value.previewDomain ?? null),
|
|
243
243
|
live: true
|
|
244
244
|
},
|
|
245
245
|
variables: envVarNames(versionResult.value.envVars)
|
|
246
246
|
};
|
|
247
247
|
},
|
|
248
248
|
async listAppEnvNames(options) {
|
|
249
|
-
const [serviceResult, versionResult] = await Promise.all([sdk.
|
|
250
|
-
|
|
249
|
+
const [serviceResult, versionResult] = await Promise.all([sdk.showApp({
|
|
250
|
+
appId: options.appId,
|
|
251
251
|
signal: options.signal
|
|
252
|
-
}), sdk.
|
|
253
|
-
|
|
252
|
+
}), sdk.showDeployment({
|
|
253
|
+
deploymentId: options.deploymentId,
|
|
254
254
|
signal: options.signal
|
|
255
255
|
})]);
|
|
256
256
|
if (serviceResult.isErr()) throw new Error(serviceResult.error.message);
|
|
@@ -261,25 +261,25 @@ function createAppProvider(client, options) {
|
|
|
261
261
|
id: serviceResult.value.id,
|
|
262
262
|
name: serviceResult.value.name,
|
|
263
263
|
region: serviceResult.value.region ?? null,
|
|
264
|
-
liveDeploymentId: serviceResult.value.
|
|
265
|
-
liveUrl: toAbsoluteUrl(serviceResult.value.
|
|
264
|
+
liveDeploymentId: serviceResult.value.latestDeploymentId ?? null,
|
|
265
|
+
liveUrl: toAbsoluteUrl(serviceResult.value.appEndpointDomain ?? null)
|
|
266
266
|
},
|
|
267
267
|
deployment: {
|
|
268
268
|
id: versionResult.value.id,
|
|
269
269
|
status: versionResult.value.status,
|
|
270
270
|
createdAt: versionResult.value.createdAt,
|
|
271
271
|
url: toAbsoluteUrl(versionResult.value.previewDomain ?? null),
|
|
272
|
-
live: serviceResult.value.
|
|
272
|
+
live: serviceResult.value.latestDeploymentId === versionResult.value.id
|
|
273
273
|
},
|
|
274
274
|
variables: envVarNames(versionResult.value.envVars)
|
|
275
275
|
};
|
|
276
276
|
},
|
|
277
277
|
async listDeployments(appId, options) {
|
|
278
|
-
const [appResult, versionsResult] = await Promise.all([sdk.
|
|
279
|
-
|
|
278
|
+
const [appResult, versionsResult] = await Promise.all([sdk.showApp({
|
|
279
|
+
appId,
|
|
280
280
|
signal: options?.signal
|
|
281
|
-
}), sdk.
|
|
282
|
-
|
|
281
|
+
}), sdk.listDeployments({
|
|
282
|
+
appId,
|
|
283
283
|
signal: options?.signal
|
|
284
284
|
})]);
|
|
285
285
|
if (appResult.isErr()) throw new Error(appResult.error.message);
|
|
@@ -289,8 +289,8 @@ function createAppProvider(client, options) {
|
|
|
289
289
|
id: appResult.value.id,
|
|
290
290
|
name: appResult.value.name,
|
|
291
291
|
region: appResult.value.region ?? null,
|
|
292
|
-
liveDeploymentId: appResult.value.
|
|
293
|
-
liveUrl: toAbsoluteUrl(appResult.value.
|
|
292
|
+
liveDeploymentId: appResult.value.latestDeploymentId ?? null,
|
|
293
|
+
liveUrl: toAbsoluteUrl(appResult.value.appEndpointDomain ?? null)
|
|
294
294
|
},
|
|
295
295
|
deployments: versionsResult.value.slice().sort((left, right) => {
|
|
296
296
|
const byDate = right.createdAt.localeCompare(left.createdAt);
|
|
@@ -305,8 +305,8 @@ function createAppProvider(client, options) {
|
|
|
305
305
|
};
|
|
306
306
|
},
|
|
307
307
|
async showDeployment(deploymentId, options) {
|
|
308
|
-
const deploymentResult = await sdk.
|
|
309
|
-
|
|
308
|
+
const deploymentResult = await sdk.showDeployment({
|
|
309
|
+
deploymentId,
|
|
310
310
|
signal: options?.signal
|
|
311
311
|
});
|
|
312
312
|
if (deploymentResult.isErr()) {
|
|
@@ -329,7 +329,7 @@ function createAppProvider(client, options) {
|
|
|
329
329
|
const result = await streamLogs({
|
|
330
330
|
baseUrl: options.baseUrl,
|
|
331
331
|
token: await options.getToken(),
|
|
332
|
-
|
|
332
|
+
deploymentId: streamOptions.deploymentId,
|
|
333
333
|
signal: streamOptions.signal
|
|
334
334
|
}, streamOptions.onRecord);
|
|
335
335
|
if (result.isErr()) {
|
|
@@ -382,7 +382,7 @@ async function listComputeServices(client, options) {
|
|
|
382
382
|
const services = [];
|
|
383
383
|
let cursor;
|
|
384
384
|
while (true) {
|
|
385
|
-
const result = await client.GET("/v1/
|
|
385
|
+
const result = await client.GET("/v1/apps", {
|
|
386
386
|
params: { query: {
|
|
387
387
|
projectId: options.projectId,
|
|
388
388
|
branchGitName: options.branchGitName,
|
|
@@ -400,13 +400,13 @@ async function listComputeServices(client, options) {
|
|
|
400
400
|
name: service.name,
|
|
401
401
|
region: service.region.id ?? null,
|
|
402
402
|
branchId: service.branchId,
|
|
403
|
-
liveDeploymentId: service.
|
|
404
|
-
liveUrl: toAbsoluteUrl(service.
|
|
403
|
+
liveDeploymentId: service.latestDeploymentId ?? null,
|
|
404
|
+
liveUrl: toAbsoluteUrl(service.appEndpointDomain ?? null)
|
|
405
405
|
}));
|
|
406
406
|
}
|
|
407
407
|
async function listComputeServiceDomains(client, computeServiceId, signal) {
|
|
408
|
-
const result = await client.GET("/v1/
|
|
409
|
-
params: { path: { computeServiceId } },
|
|
408
|
+
const result = await client.GET("/v1/apps/{appId}/domains", {
|
|
409
|
+
params: { path: { appId: computeServiceId } },
|
|
410
410
|
signal
|
|
411
411
|
});
|
|
412
412
|
if (result.error || !result.data) throw domainApiCallError("Failed to list custom domains", result.response, result.error);
|
|
@@ -453,7 +453,7 @@ async function createBranchApp(client, options) {
|
|
|
453
453
|
gitName: options.branchName,
|
|
454
454
|
signal: options.signal
|
|
455
455
|
});
|
|
456
|
-
const result = await client.POST("/v1/
|
|
456
|
+
const result = await client.POST("/v1/apps", {
|
|
457
457
|
body: {
|
|
458
458
|
projectId: options.projectId,
|
|
459
459
|
branchId: branch.id,
|
|
@@ -503,7 +503,7 @@ async function findAppForDeployment(sdk, deploymentId, signal) {
|
|
|
503
503
|
const projectsResult = await sdk.listProjects({ signal });
|
|
504
504
|
if (projectsResult.isErr()) throw new Error(projectsResult.error.message);
|
|
505
505
|
for (const project of projectsResult.value) {
|
|
506
|
-
const servicesResult = await sdk.
|
|
506
|
+
const servicesResult = await sdk.listApps({
|
|
507
507
|
projectId: project.id,
|
|
508
508
|
signal
|
|
509
509
|
});
|
|
@@ -516,8 +516,8 @@ async function findAppForDeployment(sdk, deploymentId, signal) {
|
|
|
516
516
|
return null;
|
|
517
517
|
}
|
|
518
518
|
async function findServiceAppForDeployment(sdk, serviceId, deploymentId, signal) {
|
|
519
|
-
const detailResult = await sdk.
|
|
520
|
-
serviceId,
|
|
519
|
+
const detailResult = await sdk.showApp({
|
|
520
|
+
appId: serviceId,
|
|
521
521
|
signal
|
|
522
522
|
});
|
|
523
523
|
if (detailResult.isErr()) throw new Error(detailResult.error.message);
|
|
@@ -525,12 +525,12 @@ async function findServiceAppForDeployment(sdk, serviceId, deploymentId, signal)
|
|
|
525
525
|
id: detailResult.value.id,
|
|
526
526
|
name: detailResult.value.name,
|
|
527
527
|
region: detailResult.value.region ?? null,
|
|
528
|
-
liveDeploymentId: detailResult.value.
|
|
529
|
-
liveUrl: toAbsoluteUrl(detailResult.value.
|
|
528
|
+
liveDeploymentId: detailResult.value.latestDeploymentId ?? null,
|
|
529
|
+
liveUrl: toAbsoluteUrl(detailResult.value.appEndpointDomain ?? null)
|
|
530
530
|
};
|
|
531
531
|
if (app.liveDeploymentId === deploymentId) return app;
|
|
532
|
-
const versionsResult = await sdk.
|
|
533
|
-
serviceId,
|
|
532
|
+
const versionsResult = await sdk.listDeployments({
|
|
533
|
+
appId: serviceId,
|
|
534
534
|
signal
|
|
535
535
|
});
|
|
536
536
|
if (versionsResult.isErr()) throw new Error(versionsResult.error.message);
|
|
@@ -6,7 +6,7 @@ function createDeployProgressState() {
|
|
|
6
6
|
buildCompleted: false,
|
|
7
7
|
archiveReady: false,
|
|
8
8
|
uploadCompleted: false,
|
|
9
|
-
|
|
9
|
+
deploymentId: null,
|
|
10
10
|
startRequested: false,
|
|
11
11
|
containerLive: false,
|
|
12
12
|
deploymentUrl: null,
|
|
@@ -39,8 +39,8 @@ function createDeployProgress(output, ui, enabled, state = createDeployProgressS
|
|
|
39
39
|
onUploadStart() {
|
|
40
40
|
write("Uploading...");
|
|
41
41
|
},
|
|
42
|
-
|
|
43
|
-
state.
|
|
42
|
+
onDeploymentCreated(deploymentId) {
|
|
43
|
+
state.deploymentId = deploymentId;
|
|
44
44
|
},
|
|
45
45
|
onUploadComplete() {
|
|
46
46
|
state.uploadCompleted = true;
|
|
@@ -69,16 +69,16 @@ function createPromoteProgress(output, enabled) {
|
|
|
69
69
|
output.write(`${line}\n`);
|
|
70
70
|
};
|
|
71
71
|
return {
|
|
72
|
-
|
|
73
|
-
write(`Starting deployment ${
|
|
72
|
+
onDeploymentStarting(deploymentId) {
|
|
73
|
+
write(`Starting deployment ${deploymentId}...`);
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
onDeploymentStartRequested() {
|
|
76
76
|
write("Requesting deployment start...");
|
|
77
77
|
},
|
|
78
78
|
onStatusChange(status) {
|
|
79
79
|
write(`Status: ${status}`);
|
|
80
80
|
},
|
|
81
|
-
|
|
81
|
+
onDeploymentRunning() {
|
|
82
82
|
write("Deployment is running.");
|
|
83
83
|
},
|
|
84
84
|
onPromoteStart() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.102.1",
|
|
4
4
|
"description": "Command-line interface for the Prisma Developer Platform.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@clack/prompts": "^1.5.0",
|
|
47
|
-
"@prisma/compute-sdk": "
|
|
47
|
+
"@prisma/compute-sdk": "0.30.0",
|
|
48
48
|
"@prisma/credentials-store": "^7.8.0",
|
|
49
|
-
"@prisma/management-api-sdk": "^1.
|
|
49
|
+
"@prisma/management-api-sdk": "^1.44.0",
|
|
50
50
|
"better-result": "^2.9.2",
|
|
51
51
|
"colorette": "^2.0.20",
|
|
52
52
|
"commander": "^14.0.3",
|