@prisma/composer-prisma-cloud 0.26.0 → 0.27.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.
Files changed (31) hide show
  1. package/dist/auth/pack.mjs +1 -1
  2. package/dist/auth/pack.mjs.map +1 -1
  3. package/dist/auth/testing.mjs +9510 -2309
  4. package/dist/auth/testing.mjs.map +1 -1
  5. package/dist/buckets-main.mjs +1 -1
  6. package/dist/buckets-main.mjs.map +1 -1
  7. package/dist/{secret-C__qAfZr-CUc_Mgbg.mjs → casts-DpaahrlC-Ykus3kCE.mjs} +42 -2
  8. package/dist/casts-DpaahrlC-Ykus3kCE.mjs.map +1 -0
  9. package/dist/compute-main.mjs +1 -1
  10. package/dist/compute-main.mjs.map +1 -1
  11. package/dist/control.mjs +4 -4
  12. package/dist/control.mjs.map +1 -1
  13. package/dist/index.mjs +3 -3
  14. package/dist/local-target.d.mts +7 -1
  15. package/dist/local-target.d.mts.map +1 -1
  16. package/dist/local-target.mjs +108 -10
  17. package/dist/local-target.mjs.map +1 -1
  18. package/dist/postgres-main.mjs +1 -1
  19. package/dist/postgres-main.mjs.map +1 -1
  20. package/dist/{provisioned-edges-CPrUiJ1K-DKbfx776.mjs → provisioned-edges-CPrUiJ1K--R7PIGoz.mjs} +2 -2
  21. package/dist/{provisioned-edges-CPrUiJ1K-DKbfx776.mjs.map → provisioned-edges-CPrUiJ1K--R7PIGoz.mjs.map} +1 -1
  22. package/dist/{s3-credentials-resource-CySVP49N-BQLhUtvi.mjs → s3-credentials-resource-CySVP49N-CcuzGUpr.mjs} +5 -5
  23. package/dist/{s3-credentials-resource-CySVP49N-BQLhUtvi.mjs.map → s3-credentials-resource-CySVP49N-CcuzGUpr.mjs.map} +1 -1
  24. package/dist/{segments-D-anjQ84-BNgikNpo.mjs → segments-DRPHe3kK-BNgikNpo.mjs} +1 -1
  25. package/dist/{segments-D-anjQ84-BNgikNpo.mjs.map → segments-DRPHe3kK-BNgikNpo.mjs.map} +1 -1
  26. package/dist/{serializer-CE3hLPYz-BnSjO4w7.mjs → serializer-CE3hLPYz-DfUFvkm9.mjs} +2 -42
  27. package/dist/serializer-CE3hLPYz-DfUFvkm9.mjs.map +1 -0
  28. package/dist/testing.mjs +1 -1
  29. package/package.json +18 -18
  30. package/dist/secret-C__qAfZr-CUc_Mgbg.mjs.map +0 -1
  31. package/dist/serializer-CE3hLPYz-BnSjO4w7.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { a as isGeneratedParamSource, c as paramName, l as secretName, n as envSecret, o as isOriginParamSource, r as generatedParam, t as envParam, u as serviceOrigin } from "./secret-C__qAfZr-CUc_Mgbg.mjs";
2
- import { f as stash, i as deserialize, l as readInput, m as stashProviderParams, n as configKey, p as stashInput, u as readOrigin } from "./serializer-CE3hLPYz-BnSjO4w7.mjs";
3
- import { a as provisionedEdges, i as STREAMS_API_KEY_ENV, o as streamsApiKeyNeed, r as STREAMS_API_KEY, t as RESERVED_PROVIDER_PARAMS } from "./provisioned-edges-CPrUiJ1K-DKbfx776.mjs";
1
+ import { d as serviceOrigin, i as generatedParam, l as paramName, n as envParam, o as isGeneratedParamSource, r as envSecret, s as isOriginParamSource, u as secretName } from "./casts-DpaahrlC-Ykus3kCE.mjs";
2
+ import { f as stash, i as deserialize, l as readInput, m as stashProviderParams, n as configKey, p as stashInput, u as readOrigin } from "./serializer-CE3hLPYz-DfUFvkm9.mjs";
3
+ import { a as provisionedEdges, i as STREAMS_API_KEY_ENV, o as streamsApiKeyNeed, r as STREAMS_API_KEY, t as RESERVED_PROVIDER_PARAMS } from "./provisioned-edges-CPrUiJ1K--R7PIGoz.mjs";
4
4
  import { n as requiredPackHeadOf, t as requiredPackHead } from "./required-pack-head-CMMJ2LaU-CfWu5JMj.mjs";
5
5
  import { dependency, hydrateSync, number, resource, service, string } from "@prisma/composer";
6
6
  import { blindCast } from "@prisma/composer/casts";
@@ -1,4 +1,10 @@
1
1
  import { LocalTargetDescriptor } from "@prisma/composer/config";
2
+ //#region ../../1-prisma-cloud/0-lowering/dev-emulators/dist/index.d.mts
3
+ /** The environment variable that names the emulator registry root. */
4
+ declare const EMULATORS_DIR_ENV = "PRISMA_COMPOSER_EMULATORS_DIR";
5
+ /** `registryRoot`'s default: `$PRISMA_COMPOSER_EMULATORS_DIR` (an absolute path, normalised) when set, else `~/.prisma-composer/emulators/`. */
6
+ declare function defaultRegistryRoot(): string;
7
+ //#endregion
2
8
  //#region ../../1-prisma-cloud/1-extensions/target/dist/local-target.d.mts
3
9
  //#region src/local-target/descriptor.d.ts
4
10
  /**
@@ -8,5 +14,5 @@ import { LocalTargetDescriptor } from "@prisma/composer/config";
8
14
  */
9
15
  declare function localTargetDescriptor(): LocalTargetDescriptor;
10
16
  //#endregion
11
- export { localTargetDescriptor };
17
+ export { EMULATORS_DIR_ENV, defaultRegistryRoot as emulatorRegistryRoot, localTargetDescriptor };
12
18
  //# sourceMappingURL=local-target.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"local-target.d.mts","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/local-target.d.mts"],"mappings":";;;;;;;;iBAOiB,yBAAyB"}
1
+ {"version":3,"file":"local-target.d.mts","names":[],"sources":["../../../1-prisma-cloud/0-lowering/dev-emulators/dist/index.d.mts","../../../1-prisma-cloud/1-extensions/target/dist/local-target.d.mts"],"mappings":";;;cAac;;iBAEG;;;;;;;;;iBCPA,yBAAyB"}
@@ -1,4 +1,5 @@
1
- import { C as ServiceKeyProvider, T as isWithin, b as Providers, c as PrismaCloudContainer, d as collectPreflightNames, h as prismaCloudContainerOf, i as OrmMigrationProvider, n as GeneratedParamProvider, p as deserialize, s as PgWarmProvider, u as S3CredentialsProvider, y as mintKeyPair } from "./s3-credentials-resource-CySVP49N-BQLhUtvi.mjs";
1
+ import { t as blindCast$1 } from "./casts-DpaahrlC-Ykus3kCE.mjs";
2
+ import { C as ServiceKeyProvider, T as isWithin, b as Providers, c as PrismaCloudContainer, d as collectPreflightNames, h as prismaCloudContainerOf, i as OrmMigrationProvider, n as GeneratedParamProvider, p as deserialize, s as PgWarmProvider, u as S3CredentialsProvider, y as mintKeyPair } from "./s3-credentials-resource-CySVP49N-CcuzGUpr.mjs";
2
3
  import { createRequire } from "node:module";
3
4
  import { blindCast } from "@prisma/composer/casts";
4
5
  import * as Effect from "effect/Effect";
@@ -57,6 +58,90 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
57
58
  }) : target, mod));
58
59
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
59
60
  //#endregion
61
+ //#region ../../0-framework/0-foundation/foundation/dist/errors.mjs
62
+ /**
63
+ * Returns an object with the key/value if value is defined, otherwise an empty object.
64
+ *
65
+ * Use with spread to conditionally include optional properties while satisfying
66
+ * exactOptionalPropertyTypes. This is explicit about which properties are optional
67
+ * and won't inadvertently strip other undefined values.
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * // Instead of:
72
+ * const obj = {
73
+ * required: 'value',
74
+ * ...(optional ? { optional } : {}),
75
+ * };
76
+ *
77
+ * // Use:
78
+ * const obj = {
79
+ * required: 'value',
80
+ * ...ifDefined('optional', optional),
81
+ * };
82
+ * ```
83
+ */
84
+ function ifDefined(key, value) {
85
+ return value !== void 0 ? blindCast$1({ [key]: value }) : {};
86
+ }
87
+ /**
88
+ * Structured CLI error that contains all information needed for error envelopes.
89
+ * Call sites throw these errors with full context.
90
+ *
91
+ * A `CliStructuredError` is a `StructuredError` (see
92
+ * `./structured-error.ts`): `code` is a dotted
93
+ * `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's
94
+ * category — there is no separate `domain` field. See ADR 239 in
95
+ * prisma/prisma and composer's ADR-0044 for the namespace taxonomy.
96
+ */
97
+ var CliStructuredError = class extends Error {
98
+ code;
99
+ severity;
100
+ constructor(code, summary, options) {
101
+ super(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);
102
+ this.name = "CliStructuredError";
103
+ this.code = code;
104
+ this.severity = options?.severity ?? "error";
105
+ const fix = options?.fix === options?.why ? void 0 : options?.fix;
106
+ const where = options?.where ? {
107
+ ...ifDefined("path", options.where.path),
108
+ ...ifDefined("line", options.where.line)
109
+ } : void 0;
110
+ Object.assign(this, {
111
+ ...ifDefined("why", options?.why),
112
+ ...ifDefined("fix", fix),
113
+ ...ifDefined("where", where),
114
+ ...ifDefined("meta", options?.meta),
115
+ ...ifDefined("docsUrl", options?.docsUrl)
116
+ });
117
+ }
118
+ /**
119
+ * Converts this error to a CLI error envelope for output formatting.
120
+ */
121
+ toEnvelope() {
122
+ return {
123
+ ok: false,
124
+ code: this.code,
125
+ severity: this.severity,
126
+ summary: this.message,
127
+ ...ifDefined("why", this.why),
128
+ ...ifDefined("fix", this.fix),
129
+ ...ifDefined("where", this.where),
130
+ ...ifDefined("meta", this.meta),
131
+ ...ifDefined("docsUrl", this.docsUrl)
132
+ };
133
+ }
134
+ /**
135
+ * Type guard to check if an error is a CliStructuredError.
136
+ * Uses duck-typing to work across module boundaries where instanceof may fail.
137
+ */
138
+ static is(error) {
139
+ if (!(error instanceof Error)) return false;
140
+ const candidate = blindCast$1(error);
141
+ return candidate.name === "CliStructuredError" && typeof candidate.code === "string" && typeof candidate.toEnvelope === "function";
142
+ }
143
+ };
144
+ //#endregion
60
145
  //#region ../../../node_modules/get-port/index.js
61
146
  var Locked = class extends Error {
62
147
  constructor(port) {
@@ -1479,7 +1564,7 @@ var require_adapter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1479
1564
  };
1480
1565
  }));
1481
1566
  //#endregion
1482
- //#region ../../1-prisma-cloud/0-lowering/dev-emulators/dist/segments-D-anjQ84.mjs
1567
+ //#region ../../1-prisma-cloud/0-lowering/dev-emulators/dist/segments-DRPHe3kK.mjs
1483
1568
  var import_proper_lockfile = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
1484
1569
  const lockfile = require_lockfile();
1485
1570
  const { toPromise, toSync, toSyncOptions } = require_adapter();
@@ -1578,11 +1663,12 @@ async function readJsonFile(filePath, isValid) {
1578
1663
  * `unref()`'d child process that outlives whatever called `ensureDaemon` —
1579
1664
  * the registry is how a later call finds it again.
1580
1665
  *
1581
- * `registryRoot` defaults to `~/.prisma-composer/emulators/` and governs
1582
- * every path this module manages for a given daemon: the registry JSON
1583
- * itself, the daemon's own state directory, and its stdio log file. The
1584
- * `{ registryRoot }` override exists solely so tests never touch the real
1585
- * home directory; production code never passes it.
1666
+ * `registryRoot` defaults to `$PRISMA_COMPOSER_EMULATORS_DIR`, else
1667
+ * `~/.prisma-composer/emulators/`, and governs every path this module
1668
+ * manages for a given daemon: the registry JSON itself, the daemon's own
1669
+ * state directory, and its stdio log file. The `{ registryRoot }` override
1670
+ * exists solely so tests never touch the real home directory; production
1671
+ * code never passes it.
1586
1672
  */
1587
1673
  const MIN_PORT = 4300;
1588
1674
  const MAX_PORT = 65535;
@@ -1625,9 +1711,21 @@ function isPackageJson(value) {
1625
1711
  function sleep(ms) {
1626
1712
  return new Promise((resolve) => setTimeout(resolve, ms));
1627
1713
  }
1628
- /** `~/.prisma-composer/emulators/` — `registryRoot`'s default. */
1714
+ /** The environment variable that names the emulator registry root. */
1715
+ const EMULATORS_DIR_ENV = "PRISMA_COMPOSER_EMULATORS_DIR";
1716
+ /** `registryRoot`'s default: `$PRISMA_COMPOSER_EMULATORS_DIR` (an absolute path, normalised) when set, else `~/.prisma-composer/emulators/`. */
1629
1717
  function defaultRegistryRoot() {
1630
- return path$1.join(os$2.homedir(), ".prisma-composer", "emulators");
1718
+ const dir = process.env[EMULATORS_DIR_ENV];
1719
+ if (dir === void 0 || dir === "") return path$1.join(os$2.homedir(), ".prisma-composer", "emulators");
1720
+ if (!path$1.isAbsolute(dir)) throw new CliStructuredError("DEV.EMULATORS_DIR_INVALID", `${EMULATORS_DIR_ENV} must be an absolute path; got "${dir}".`, {
1721
+ why: "Every process that starts or reaches the local emulators resolves this directory, and a relative path would name a different one in each working directory.",
1722
+ fix: `Set ${EMULATORS_DIR_ENV} to an absolute path (\`~\` is not expanded), or unset it to use ~/.prisma-composer/emulators.`,
1723
+ meta: {
1724
+ variable: EMULATORS_DIR_ENV,
1725
+ value: dir
1726
+ }
1727
+ });
1728
+ return path$1.resolve(dir);
1631
1729
  }
1632
1730
  /** `<registryRoot>/<name>.json`. */
1633
1731
  function registryFilePath(registryRoot, name) {
@@ -6313,6 +6411,6 @@ function localTargetDescriptor() {
6313
6411
  };
6314
6412
  }
6315
6413
  //#endregion
6316
- export { localTargetDescriptor };
6414
+ export { EMULATORS_DIR_ENV, defaultRegistryRoot as emulatorRegistryRoot, localTargetDescriptor };
6317
6415
 
6318
6416
  //# sourceMappingURL=local-target.mjs.map