@prisma/composer-cli 0.6.0 → 0.8.0

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/bin.mjs CHANGED
@@ -1,17 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as executionDiagnostics, l as DOCS_BASE, o as executorLoadFailure, t as notOk$1 } from "./result-B4XjxVK6.mjs";
3
3
  import { t as alchemyCommandLine } from "./run-alchemy-D44OZlyB-DA7s331N.mjs";
4
- import "node:module";
5
4
  import * as fs from "node:fs";
6
5
  import * as path from "node:path";
7
6
  import { spawn } from "node:child_process";
8
7
  import { EnvironmentCredentialManager, createCli, defineCommand, defineCommandFamily, defineConfigSection, defineSessionCommand, exitWithChildStatus, flag, loadConfig, positional } from "@prisma/cli-engine";
9
8
  import { CliStructuredError, notOk, ok } from "@prisma/cli-engine/protocol";
10
9
  import { fileURLToPath } from "node:url";
11
- //#region \0rolldown/runtime.js
12
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
13
- //#endregion
14
- //#region ../../0-framework/3-tooling/cli/dist/log-DfT2hHqi.mjs
10
+ //#region ../../0-framework/3-tooling/cli/dist/log-B1EJJGSl.mjs
15
11
  /** In-package variant threading the injection seam (the CLI's RunDeps, unit
16
12
  * tests). Deliberately NOT re-exported through `./control` — the seam mirrors
17
13
  * internal types and is not part of the published surface. */
@@ -19,7 +15,7 @@ async function deployWithDeps(input, deps) {
19
15
  const cwd = input.cwd ?? process.cwd();
20
16
  let executor;
21
17
  try {
22
- executor = await import("./execute-deploy-destroy-DfVJUICu-quUQ08T8.mjs");
18
+ executor = await import("./execute-deploy-destroy-DRl6Tfg9-C6DPd1Ks.mjs");
23
19
  } catch (error) {
24
20
  return notOk$1(executorLoadFailure("deploy", error, cwd));
25
21
  }
@@ -32,7 +28,7 @@ async function destroyWithDeps(input, deps) {
32
28
  const cwd = input.cwd ?? process.cwd();
33
29
  let executor;
34
30
  try {
35
- executor = await import("./execute-deploy-destroy-DfVJUICu-quUQ08T8.mjs");
31
+ executor = await import("./execute-deploy-destroy-DRl6Tfg9-C6DPd1Ks.mjs");
36
32
  } catch (error) {
37
33
  return notOk$1(executorLoadFailure("destroy", error, cwd));
38
34
  }
@@ -65,380 +61,7 @@ async function logWithDeps(input, deps) {
65
61
  return executor.executeLog(input, deps, cwd);
66
62
  }
67
63
  //#endregion
68
- //#region ../../../node_modules/ci-info/vendors.json
69
- var require_vendors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
70
- module.exports = [
71
- {
72
- "name": "Agola CI",
73
- "constant": "AGOLA",
74
- "env": "AGOLA_GIT_REF",
75
- "pr": "AGOLA_PULL_REQUEST_ID"
76
- },
77
- {
78
- "name": "Alpic",
79
- "constant": "ALPIC",
80
- "env": "ALPIC_HOST"
81
- },
82
- {
83
- "name": "Appcircle",
84
- "constant": "APPCIRCLE",
85
- "env": "AC_APPCIRCLE",
86
- "pr": {
87
- "env": "AC_GIT_PR",
88
- "ne": "false"
89
- }
90
- },
91
- {
92
- "name": "AppVeyor",
93
- "constant": "APPVEYOR",
94
- "env": "APPVEYOR",
95
- "pr": "APPVEYOR_PULL_REQUEST_NUMBER"
96
- },
97
- {
98
- "name": "AWS CodeBuild",
99
- "constant": "CODEBUILD",
100
- "env": "CODEBUILD_BUILD_ARN",
101
- "pr": {
102
- "env": "CODEBUILD_WEBHOOK_EVENT",
103
- "any": [
104
- "PULL_REQUEST_CREATED",
105
- "PULL_REQUEST_UPDATED",
106
- "PULL_REQUEST_REOPENED"
107
- ]
108
- }
109
- },
110
- {
111
- "name": "Azure Pipelines",
112
- "constant": "AZURE_PIPELINES",
113
- "env": "TF_BUILD",
114
- "pr": { "BUILD_REASON": "PullRequest" }
115
- },
116
- {
117
- "name": "Bamboo",
118
- "constant": "BAMBOO",
119
- "env": "bamboo_planKey"
120
- },
121
- {
122
- "name": "Bitbucket Pipelines",
123
- "constant": "BITBUCKET",
124
- "env": "BITBUCKET_COMMIT",
125
- "pr": "BITBUCKET_PR_ID"
126
- },
127
- {
128
- "name": "Bitrise",
129
- "constant": "BITRISE",
130
- "env": "BITRISE_IO",
131
- "pr": "BITRISE_PULL_REQUEST"
132
- },
133
- {
134
- "name": "Buddy",
135
- "constant": "BUDDY",
136
- "env": "BUDDY_WORKSPACE_ID",
137
- "pr": "BUDDY_EXECUTION_PULL_REQUEST_ID"
138
- },
139
- {
140
- "name": "Buildkite",
141
- "constant": "BUILDKITE",
142
- "env": "BUILDKITE",
143
- "pr": {
144
- "env": "BUILDKITE_PULL_REQUEST",
145
- "ne": "false"
146
- }
147
- },
148
- {
149
- "name": "CircleCI",
150
- "constant": "CIRCLE",
151
- "env": "CIRCLECI",
152
- "pr": "CIRCLE_PULL_REQUEST"
153
- },
154
- {
155
- "name": "Cirrus CI",
156
- "constant": "CIRRUS",
157
- "env": "CIRRUS_CI",
158
- "pr": "CIRRUS_PR"
159
- },
160
- {
161
- "name": "Cloudflare Pages",
162
- "constant": "CLOUDFLARE_PAGES",
163
- "env": "CF_PAGES"
164
- },
165
- {
166
- "name": "Cloudflare Workers",
167
- "constant": "CLOUDFLARE_WORKERS",
168
- "env": "WORKERS_CI"
169
- },
170
- {
171
- "name": "Codefresh",
172
- "constant": "CODEFRESH",
173
- "env": "CF_BUILD_ID",
174
- "pr": { "any": ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"] }
175
- },
176
- {
177
- "name": "Codemagic",
178
- "constant": "CODEMAGIC",
179
- "env": "CM_BUILD_ID",
180
- "pr": "CM_PULL_REQUEST"
181
- },
182
- {
183
- "name": "Codeship",
184
- "constant": "CODESHIP",
185
- "env": { "CI_NAME": "codeship" }
186
- },
187
- {
188
- "name": "Drone",
189
- "constant": "DRONE",
190
- "env": "DRONE",
191
- "pr": { "DRONE_BUILD_EVENT": "pull_request" }
192
- },
193
- {
194
- "name": "dsari",
195
- "constant": "DSARI",
196
- "env": "DSARI"
197
- },
198
- {
199
- "name": "Earthly",
200
- "constant": "EARTHLY",
201
- "env": "EARTHLY_CI"
202
- },
203
- {
204
- "name": "Expo Application Services",
205
- "constant": "EAS",
206
- "env": "EAS_BUILD"
207
- },
208
- {
209
- "name": "Gerrit",
210
- "constant": "GERRIT",
211
- "env": "GERRIT_PROJECT"
212
- },
213
- {
214
- "name": "Gitea Actions",
215
- "constant": "GITEA_ACTIONS",
216
- "env": "GITEA_ACTIONS"
217
- },
218
- {
219
- "name": "GitHub Actions",
220
- "constant": "GITHUB_ACTIONS",
221
- "env": "GITHUB_ACTIONS",
222
- "pr": { "GITHUB_EVENT_NAME": "pull_request" }
223
- },
224
- {
225
- "name": "GitLab CI",
226
- "constant": "GITLAB",
227
- "env": "GITLAB_CI",
228
- "pr": "CI_MERGE_REQUEST_ID"
229
- },
230
- {
231
- "name": "GoCD",
232
- "constant": "GOCD",
233
- "env": "GO_PIPELINE_LABEL"
234
- },
235
- {
236
- "name": "Google Cloud Build",
237
- "constant": "GOOGLE_CLOUD_BUILD",
238
- "env": "BUILDER_OUTPUT"
239
- },
240
- {
241
- "name": "Harness CI",
242
- "constant": "HARNESS",
243
- "env": "HARNESS_BUILD_ID"
244
- },
245
- {
246
- "name": "Heroku",
247
- "constant": "HEROKU",
248
- "env": {
249
- "env": "NODE",
250
- "includes": "/app/.heroku/node/bin/node"
251
- }
252
- },
253
- {
254
- "name": "Hudson",
255
- "constant": "HUDSON",
256
- "env": "HUDSON_URL"
257
- },
258
- {
259
- "name": "Jenkins",
260
- "constant": "JENKINS",
261
- "env": ["JENKINS_URL", "BUILD_ID"],
262
- "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
263
- },
264
- {
265
- "name": "LayerCI",
266
- "constant": "LAYERCI",
267
- "env": "LAYERCI",
268
- "pr": "LAYERCI_PULL_REQUEST"
269
- },
270
- {
271
- "name": "Magnum CI",
272
- "constant": "MAGNUM",
273
- "env": "MAGNUM"
274
- },
275
- {
276
- "name": "Netlify CI",
277
- "constant": "NETLIFY",
278
- "env": "NETLIFY",
279
- "pr": {
280
- "env": "PULL_REQUEST",
281
- "ne": "false"
282
- }
283
- },
284
- {
285
- "name": "Nevercode",
286
- "constant": "NEVERCODE",
287
- "env": "NEVERCODE",
288
- "pr": {
289
- "env": "NEVERCODE_PULL_REQUEST",
290
- "ne": "false"
291
- }
292
- },
293
- {
294
- "name": "Prow",
295
- "constant": "PROW",
296
- "env": "PROW_JOB_ID"
297
- },
298
- {
299
- "name": "ReleaseHub",
300
- "constant": "RELEASEHUB",
301
- "env": "RELEASE_BUILD_ID"
302
- },
303
- {
304
- "name": "Render",
305
- "constant": "RENDER",
306
- "env": "RENDER",
307
- "pr": { "IS_PULL_REQUEST": "true" }
308
- },
309
- {
310
- "name": "Sail CI",
311
- "constant": "SAIL",
312
- "env": "SAILCI",
313
- "pr": "SAIL_PULL_REQUEST_NUMBER"
314
- },
315
- {
316
- "name": "Screwdriver",
317
- "constant": "SCREWDRIVER",
318
- "env": "SCREWDRIVER",
319
- "pr": {
320
- "env": "SD_PULL_REQUEST",
321
- "ne": "false"
322
- }
323
- },
324
- {
325
- "name": "Semaphore",
326
- "constant": "SEMAPHORE",
327
- "env": "SEMAPHORE",
328
- "pr": "PULL_REQUEST_NUMBER"
329
- },
330
- {
331
- "name": "Sourcehut",
332
- "constant": "SOURCEHUT",
333
- "env": { "CI_NAME": "sourcehut" }
334
- },
335
- {
336
- "name": "Strider CD",
337
- "constant": "STRIDER",
338
- "env": "STRIDER"
339
- },
340
- {
341
- "name": "TaskCluster",
342
- "constant": "TASKCLUSTER",
343
- "env": ["TASK_ID", "RUN_ID"]
344
- },
345
- {
346
- "name": "TeamCity",
347
- "constant": "TEAMCITY",
348
- "env": "TEAMCITY_VERSION"
349
- },
350
- {
351
- "name": "Travis CI",
352
- "constant": "TRAVIS",
353
- "env": "TRAVIS",
354
- "pr": {
355
- "env": "TRAVIS_PULL_REQUEST",
356
- "ne": "false"
357
- }
358
- },
359
- {
360
- "name": "Vela",
361
- "constant": "VELA",
362
- "env": "VELA",
363
- "pr": { "VELA_PULL_REQUEST": "1" }
364
- },
365
- {
366
- "name": "Vercel",
367
- "constant": "VERCEL",
368
- "env": { "any": ["NOW_BUILDER", "VERCEL"] },
369
- "pr": "VERCEL_GIT_PULL_REQUEST_ID"
370
- },
371
- {
372
- "name": "Visual Studio App Center",
373
- "constant": "APPCENTER",
374
- "env": "APPCENTER_BUILD_ID"
375
- },
376
- {
377
- "name": "Woodpecker",
378
- "constant": "WOODPECKER",
379
- "env": { "CI": "woodpecker" },
380
- "pr": { "CI_BUILD_EVENT": "pull_request" }
381
- },
382
- {
383
- "name": "Xcode Cloud",
384
- "constant": "XCODE_CLOUD",
385
- "env": "CI_XCODE_PROJECT",
386
- "pr": "CI_PULL_REQUEST_NUMBER"
387
- },
388
- {
389
- "name": "Xcode Server",
390
- "constant": "XCODE_SERVER",
391
- "env": "XCS"
392
- }
393
- ];
394
- }));
395
- //#endregion
396
- //#region ../../0-framework/3-tooling/cli/dist/engine-cli-BXXH4fM-.mjs
397
- var import_ci_info = (/* @__PURE__ */ __commonJSMin(((exports) => {
398
- const vendors = require_vendors();
399
- const env = process.env;
400
- Object.defineProperty(exports, "_vendors", { value: vendors.map(function(v) {
401
- return v.constant;
402
- }) });
403
- exports.name = null;
404
- exports.isPR = null;
405
- exports.id = null;
406
- if (env.CI !== "false") vendors.forEach(function(vendor) {
407
- const isCI = (Array.isArray(vendor.env) ? vendor.env : [vendor.env]).every(function(obj) {
408
- return checkEnv(obj);
409
- });
410
- exports[vendor.constant] = isCI;
411
- if (!isCI) return;
412
- exports.name = vendor.name;
413
- exports.isPR = checkPR(vendor);
414
- exports.id = vendor.constant;
415
- });
416
- exports.isCI = !!(env.CI !== "false" && (env.BUILD_ID || env.BUILD_NUMBER || env.CI || env.CI_APP_ID || env.CI_BUILD_ID || env.CI_BUILD_NUMBER || env.CI_NAME || env.CONTINUOUS_INTEGRATION || env.RUN_ID || exports.name || false));
417
- function checkEnv(obj) {
418
- if (typeof obj === "string") return !!env[obj];
419
- if ("env" in obj) return env[obj.env] && env[obj.env].includes(obj.includes);
420
- if ("any" in obj) return obj.any.some(function(k) {
421
- return !!env[k];
422
- });
423
- return Object.keys(obj).every(function(k) {
424
- return env[k] === obj[k];
425
- });
426
- }
427
- function checkPR(vendor) {
428
- switch (typeof vendor.pr) {
429
- case "string": return !!env[vendor.pr];
430
- case "object": if ("env" in vendor.pr) if ("any" in vendor.pr) return vendor.pr.any.some(function(key) {
431
- return env[vendor.pr.env] === key;
432
- });
433
- else return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
434
- else if ("any" in vendor.pr) return vendor.pr.any.some(function(key) {
435
- return !!env[key];
436
- });
437
- else return checkEnv(vendor.pr);
438
- default: return null;
439
- }
440
- }
441
- })))();
64
+ //#region ../../0-framework/3-tooling/cli/dist/engine-cli-CaEeyz5M.mjs
442
65
  /**
443
66
  * The family boundary's error translation.
444
67
  *
@@ -684,6 +307,14 @@ const createDeployCommand = (operations) => defineCommand({
684
307
  stage: flag.string({
685
308
  brief: "Deploy scope to target; omit for production.",
686
309
  placeholder: "stage"
310
+ }),
311
+ report: flag.string({
312
+ brief: "Write the deploy's outcome as JSON to this path — resources, preview URLs, and the failure cause. Also settable as PRISMA_COMPOSER_REPORT_FILE.",
313
+ placeholder: "path"
314
+ }),
315
+ buildId: flag.string({
316
+ brief: "Join the deploy record your CI already created rather than letting the target create one. Each target also reads its own environment variable for this; the flag wins.",
317
+ placeholder: "id"
687
318
  })
688
319
  }
689
320
  },
@@ -698,7 +329,9 @@ const createDeployCommand = (operations) => defineCommand({
698
329
  entry: args.positionals.entry,
699
330
  name: args.flags.name,
700
331
  stage: args.flags.stage,
701
- cwd: ctx.cwd
332
+ cwd: ctx.cwd,
333
+ reportPath: args.flags.report,
334
+ reportId: args.flags.buildId
702
335
  }, operationDeps({
703
336
  alchemy,
704
337
  configPath: ctx.config.configPath,
@@ -718,7 +351,9 @@ const createDeployCommand = (operations) => defineCommand({
718
351
  columns: ["Address", "Deployed"],
719
352
  rows: summary.nodes.map((node) => [node.address, node.entities.map((entity) => `${entity.kind} ${entity.id}`).join(", ")])
720
353
  }],
721
- json: () => ({ summary: summary ?? null })
354
+ stdout: () => [],
355
+ json: () => ({ summary: summary ?? null }),
356
+ next: () => []
722
357
  }));
723
358
  }
724
359
  });
@@ -797,11 +432,16 @@ const createDestroyCommand = (operations) => defineCommand({
797
432
  configPath: ctx.config.configPath,
798
433
  workspaceId: await workspaceIdOf(ctx),
799
434
  client: ctx.api
800
- })), ctx, () => ctx.present({ data: void 0 }, { human: () => [{
801
- kind: "summary",
802
- status: "ok",
803
- text: "Destroyed."
804
- }] }));
435
+ })), ctx, () => ctx.present({ data: void 0 }, {
436
+ human: () => [{
437
+ kind: "summary",
438
+ status: "ok",
439
+ text: "Destroyed."
440
+ }],
441
+ stdout: () => [],
442
+ json: () => void 0,
443
+ next: () => []
444
+ }));
805
445
  }
806
446
  });
807
447
  const STOP_STEP = "Stopping the app's services — emulators and data stay up";
@@ -1156,6 +796,21 @@ function clientConfig(env, apiBaseUrl) {
1156
796
  };
1157
797
  }
1158
798
  /**
799
+ * What this process runs on, for `ctx.host`. Bun and Deno both announce
800
+ * themselves in `versions`; nothing else does, so an absent marker means Node.
801
+ */
802
+ function describeHost(host) {
803
+ const name = ["bun", "deno"].find((candidate) => host.versions[candidate] !== void 0) ?? "node";
804
+ return {
805
+ runtime: {
806
+ name,
807
+ version: host.versions[name] ?? host.version
808
+ },
809
+ platform: host.platform,
810
+ arch: host.arch
811
+ };
812
+ }
813
+ /**
1159
814
  * Which package manager invoked us, read from the `npm_config_user_agent`
1160
815
  * every major manager sets (`pnpm/10.27.0 npm/? node/v24.16.0 darwin arm64`).
1161
816
  * `undefined` when the CLI was run directly rather than through a manager — a
@@ -1182,13 +837,11 @@ function detectPackageManager(env) {
1182
837
  * `--config` named. A host that loaded the file up front would read it for runs
1183
838
  * that never needed it, and would have nowhere to put `--config`.
1184
839
  *
1185
- * `inCI` is the one thing here not derived from the host: `ci-info` answers it
1186
- * from the real `process.env` at import, which is what the engine's `isCI` doc
1187
- * asks a host to wire and what the `prisma` bin already does. Production passes
1188
- * nothing. It is a parameter so a test can still drive CI state without
1189
- * touching a process global.
840
+ * Nothing here answers "is this CI": the engine detects it from `env` itself,
841
+ * and `isCIOverride` exists only for hosts where that detection cannot be
842
+ * right composer is not one.
1190
843
  */
1191
- function createRuntime(host, loadConfig, inCI = import_ci_info.isCI) {
844
+ function createRuntime(host, loadConfig) {
1192
845
  const env = host.env;
1193
846
  const apiBaseUrl = env["PRISMA_MANAGEMENT_API_URL"] ?? DEFAULT_MANAGEMENT_API_BASE_URL;
1194
847
  const packageManager = detectPackageManager(env);
@@ -1224,7 +877,7 @@ function createRuntime(host, loadConfig, inCI = import_ci_info.isCI) {
1224
877
  spawn: spawnChild,
1225
878
  managementApi: { baseUrl: apiBaseUrl },
1226
879
  ...packageManager !== void 0 && { packageManager },
1227
- isCI: inCI
880
+ host: describeHost(host)
1228
881
  };
1229
882
  }
1230
883
  /**
@@ -1278,7 +931,7 @@ function runComposerCli(argv, host, spec, hooks) {
1278
931
  return createComposerCli(spec).run(argv, runtime, hooks);
1279
932
  }
1280
933
  //#endregion
1281
- //#region ../../0-framework/3-tooling/cli/dist/cli-C8cVG9HU.mjs
934
+ //#region ../../0-framework/3-tooling/cli/dist/cli-J3J8rE2u.mjs
1282
935
  /**
1283
936
  * The `prisma-composer` entrypoint: adapt this process into the engine's
1284
937
  * `HostProcess`, run one invocation of composer's own CLI, and hand back an