@prisma/composer 0.6.0-dev.15 → 0.6.0-dev.16

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-CrYVbsvO.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
  *
@@ -330,11 +707,11 @@ const createDeployCommand = (operations) => defineCommand({
330
707
  })), ctx, ({ summary }) => ctx.present({ data: { summary: summary ?? null } }, {
331
708
  human: (ui) => summary === void 0 ? [{
332
709
  kind: "summary",
333
- tone: "ok",
710
+ status: "ok",
334
711
  text: "Deployed."
335
712
  }] : [{
336
713
  kind: "summary",
337
- tone: "ok",
714
+ status: "ok",
338
715
  text: `Deployed ${ui.emphasize(summary.app)}.`
339
716
  }, {
340
717
  kind: "table",
@@ -422,7 +799,7 @@ const createDestroyCommand = (operations) => defineCommand({
422
799
  client: ctx.api
423
800
  })), ctx, () => ctx.present({ data: void 0 }, { human: () => [{
424
801
  kind: "summary",
425
- tone: "ok",
802
+ status: "ok",
426
803
  text: "Destroyed."
427
804
  }] }));
428
805
  }
@@ -781,19 +1158,21 @@ function clientConfig(env, apiBaseUrl) {
781
1158
  /**
782
1159
  * Which package manager invoked us, read from the `npm_config_user_agent`
783
1160
  * every major manager sets (`pnpm/10.27.0 npm/? node/v24.16.0 darwin arm64`).
784
- * `unknown` when the CLI was run directly rather than through a manager — a
785
- * normal case, not a failure, so nothing is inferred from the filesystem.
1161
+ * `undefined` when the CLI was run directly rather than through a manager — a
1162
+ * normal case, not a failure, so nothing is inferred from the filesystem, and
1163
+ * the engine falls back to its own detection from the project at cwd.
786
1164
  */
787
1165
  function detectPackageManager(env) {
788
1166
  const agent = env["npm_config_user_agent"];
789
- if (agent === void 0) return "unknown";
1167
+ if (agent === void 0) return void 0;
790
1168
  const name = agent.split("/")[0];
791
1169
  switch (name) {
792
1170
  case "npm":
793
1171
  case "pnpm":
794
1172
  case "yarn":
795
- case "bun": return name;
796
- default: return "unknown";
1173
+ case "bun":
1174
+ case "deno": return name;
1175
+ default: return;
797
1176
  }
798
1177
  }
799
1178
  /**
@@ -802,10 +1181,17 @@ function detectPackageManager(env) {
802
1181
  * it is about to run declares a config section, and with whatever file
803
1182
  * `--config` named. A host that loaded the file up front would read it for runs
804
1183
  * that never needed it, and would have nowhere to put `--config`.
1184
+ *
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.
805
1190
  */
806
- function createRuntime(host, loadConfig) {
1191
+ function createRuntime(host, loadConfig, inCI = import_ci_info.isCI) {
807
1192
  const env = host.env;
808
1193
  const apiBaseUrl = env["PRISMA_MANAGEMENT_API_URL"] ?? DEFAULT_MANAGEMENT_API_BASE_URL;
1194
+ const packageManager = detectPackageManager(env);
809
1195
  return {
810
1196
  stdout: host.stdout,
811
1197
  stderr: host.stderr,
@@ -837,7 +1223,8 @@ function createRuntime(host, loadConfig) {
837
1223
  managementApiClientConfig: clientConfig(env, apiBaseUrl),
838
1224
  spawn: spawnChild,
839
1225
  managementApi: { baseUrl: apiBaseUrl },
840
- packageManager: detectPackageManager(env)
1226
+ ...packageManager !== void 0 && { packageManager },
1227
+ isCI: inCI
841
1228
  };
842
1229
  }
843
1230
  /**
@@ -891,7 +1278,7 @@ function runComposerCli(argv, host, spec, hooks) {
891
1278
  return createComposerCli(spec).run(argv, runtime, hooks);
892
1279
  }
893
1280
  //#endregion
894
- //#region ../../0-framework/3-tooling/cli/dist/cli-DKVwu4w4.mjs
1281
+ //#region ../../0-framework/3-tooling/cli/dist/cli-C8cVG9HU.mjs
895
1282
  /**
896
1283
  * The `prisma-composer` entrypoint: adapt this process into the engine's
897
1284
  * `HostProcess`, run one invocation of composer's own CLI, and hand back an