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