@prisma/composer-cli 0.6.0-dev.21 → 0.6.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,12 +1,16 @@
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";
4
5
  import * as fs from "node:fs";
5
6
  import * as path from "node:path";
6
7
  import { spawn } from "node:child_process";
7
8
  import { EnvironmentCredentialManager, createCli, defineCommand, defineCommandFamily, defineConfigSection, defineSessionCommand, exitWithChildStatus, flag, loadConfig, positional } from "@prisma/cli-engine";
8
9
  import { CliStructuredError, notOk, ok } from "@prisma/cli-engine/protocol";
9
10
  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
10
14
  //#region ../../0-framework/3-tooling/cli/dist/log-DfT2hHqi.mjs
11
15
  /** In-package variant threading the injection seam (the CLI's RunDeps, unit
12
16
  * tests). Deliberately NOT re-exported through `./control` — the seam mirrors
@@ -61,7 +65,380 @@ async function logWithDeps(input, deps) {
61
65
  return executor.executeLog(input, deps, cwd);
62
66
  }
63
67
  //#endregion
64
- //#region ../../0-framework/3-tooling/cli/dist/engine-cli-BurDkrQe.mjs
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
+ })))();
65
442
  /**
66
443
  * The family boundary's error translation.
67
444
  *
@@ -341,9 +718,7 @@ const createDeployCommand = (operations) => defineCommand({
341
718
  columns: ["Address", "Deployed"],
342
719
  rows: summary.nodes.map((node) => [node.address, node.entities.map((entity) => `${entity.kind} ${entity.id}`).join(", ")])
343
720
  }],
344
- stdout: () => [],
345
- json: () => ({ summary: summary ?? null }),
346
- next: () => []
721
+ json: () => ({ summary: summary ?? null })
347
722
  }));
348
723
  }
349
724
  });
@@ -422,16 +797,11 @@ const createDestroyCommand = (operations) => defineCommand({
422
797
  configPath: ctx.config.configPath,
423
798
  workspaceId: await workspaceIdOf(ctx),
424
799
  client: ctx.api
425
- })), ctx, () => ctx.present({ data: void 0 }, {
426
- human: () => [{
427
- kind: "summary",
428
- status: "ok",
429
- text: "Destroyed."
430
- }],
431
- stdout: () => [],
432
- json: () => void 0,
433
- next: () => []
434
- }));
800
+ })), ctx, () => ctx.present({ data: void 0 }, { human: () => [{
801
+ kind: "summary",
802
+ status: "ok",
803
+ text: "Destroyed."
804
+ }] }));
435
805
  }
436
806
  });
437
807
  const STOP_STEP = "Stopping the app's services — emulators and data stay up";
@@ -786,21 +1156,6 @@ function clientConfig(env, apiBaseUrl) {
786
1156
  };
787
1157
  }
788
1158
  /**
789
- * What this process runs on, for `ctx.host`. Bun and Deno both announce
790
- * themselves in `versions`; nothing else does, so an absent marker means Node.
791
- */
792
- function describeHost(host) {
793
- const name = ["bun", "deno"].find((candidate) => host.versions[candidate] !== void 0) ?? "node";
794
- return {
795
- runtime: {
796
- name,
797
- version: host.versions[name] ?? host.version
798
- },
799
- platform: host.platform,
800
- arch: host.arch
801
- };
802
- }
803
- /**
804
1159
  * Which package manager invoked us, read from the `npm_config_user_agent`
805
1160
  * every major manager sets (`pnpm/10.27.0 npm/? node/v24.16.0 darwin arm64`).
806
1161
  * `undefined` when the CLI was run directly rather than through a manager — a
@@ -827,11 +1182,13 @@ function detectPackageManager(env) {
827
1182
  * `--config` named. A host that loaded the file up front would read it for runs
828
1183
  * that never needed it, and would have nowhere to put `--config`.
829
1184
  *
830
- * Nothing here answers "is this CI": the engine detects it from `env` itself,
831
- * and `isCIOverride` exists only for hosts where that detection cannot be
832
- * right composer is not one.
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.
833
1190
  */
834
- function createRuntime(host, loadConfig) {
1191
+ function createRuntime(host, loadConfig, inCI = import_ci_info.isCI) {
835
1192
  const env = host.env;
836
1193
  const apiBaseUrl = env["PRISMA_MANAGEMENT_API_URL"] ?? DEFAULT_MANAGEMENT_API_BASE_URL;
837
1194
  const packageManager = detectPackageManager(env);
@@ -867,7 +1224,7 @@ function createRuntime(host, loadConfig) {
867
1224
  spawn: spawnChild,
868
1225
  managementApi: { baseUrl: apiBaseUrl },
869
1226
  ...packageManager !== void 0 && { packageManager },
870
- host: describeHost(host)
1227
+ isCI: inCI
871
1228
  };
872
1229
  }
873
1230
  /**
@@ -921,7 +1278,7 @@ function runComposerCli(argv, host, spec, hooks) {
921
1278
  return createComposerCli(spec).run(argv, runtime, hooks);
922
1279
  }
923
1280
  //#endregion
924
- //#region ../../0-framework/3-tooling/cli/dist/cli-Bkm0Wwfk.mjs
1281
+ //#region ../../0-framework/3-tooling/cli/dist/cli-C8cVG9HU.mjs
925
1282
  /**
926
1283
  * The `prisma-composer` entrypoint: adapt this process into the engine's
927
1284
  * `HostProcess`, run one invocation of composer's own CLI, and hand back an