@prisma/composer-prisma-cloud 0.17.0-dev.1 → 0.17.0-dev.3

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.
@@ -1,8 +1,21 @@
1
1
  import { t as ProviderParamEntry } from "./serializer-BD_6nkr4-DWn5NNTC.mjs";
2
+ import "effect/Context";
2
3
  import "effect/Effect";
4
+ import "effect/Layer";
5
+ import "effect/Config";
6
+ import { createManagementApiClient, paths } from "@prisma/management-api-sdk";
7
+ import "effect/Redacted";
8
+ import "alchemy/Provider";
3
9
  import * as Output from "alchemy/Output";
4
- import * as AlchemyPrisma from "alchemy/Prisma";
10
+ import { Resource } from "alchemy";
11
+ import { EnvironmentVariable } from "alchemy/Prisma";
5
12
  import { ExtensionDescriptor, StateDescriptor } from "@prisma/composer/config";
13
+ //#region ../../1-prisma-cloud/0-lowering/lowering/dist/index.d.mts
14
+ //#endregion
15
+ //#region src/container.d.ts
16
+ /** The region ids the Management API accepts for a new Project — the platform's published contract, not a Composer-owned list. */
17
+ type ProjectRegion = NonNullable<NonNullable<paths['/v1/projects']['post']['requestBody']>['content']['application/json']['region']>;
18
+ //#endregion
6
19
  //#region ../../1-prisma-cloud/1-extensions/target/dist/control.d.mts
7
20
  //#region src/descriptors/shared.d.ts
8
21
  /**
@@ -60,7 +73,7 @@ interface PrismaCloudOptions {
60
73
  /** Defaults to the PRISMA_WORKSPACE_ID environment variable. */
61
74
  workspaceId?: string;
62
75
  /** Defaults to the PRISMA_REGION environment variable when set. */
63
- region?: AlchemyPrisma.Types.PrismaRegionId;
76
+ region?: ProjectRegion;
64
77
  }
65
78
  /**
66
79
  * One brand's deploy-side value registration: edge-derived (`value(refs)`,
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;UAqBU,sBAAsB;;;;;;;;WAQrB,QAAQ,6BAA6B,OAAO;;;;;;;;UAQ7C;WACC,gBAAgB,OAAO;;;;;;;;;;;;UAYxB,6BAA6B;WAC5B,kBAAkB,aAAa,8BAA8B,oBAAoB,OAAO;;;;;cAKrF,mBAAmB;UACvB;;EAER;;EAEA,SAAS,cAAc,MAAM;;;;;;;;KAQ1B,qBAAqB,KAAK,0BAA0B,KAAK;;;;;;;;;;iBAU7C,oBAAoB,kBAAkB,sBAAsB,QAAQ,oBAAoB,sBAAsB,oBAAoB,gBAAgB;cACrJ,iBAAiB,oBAAoB,gBAAgB;;cAErD,cAAc,OAAO,uBAAuB"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/index.d.mts","../../../1-prisma-cloud/1-extensions/target/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;;;KAkBK,gBAAgB,YAAY,YAAY;;;;;;;;;;;;;;;;;;;UCInC,sBAAsB;;;;;;;;WAQrB,QAAQ,6BAA6B,OAAO;;;;;;;;UAQ7C;WACC,gBAAgB,OAAO;;;;;;;;;;;;UAYxB,6BAA6B;WAC5B,kBAAkB,aAAa,8BAA8B,oBAAoB,OAAO;;;;;cAKrF,mBAAmB;UACvB;;EAER;;EAEA,SAAS;;;;;;;;KAQN,qBAAqB,KAAK,0BAA0B,KAAK;;;;;;;;;;iBAU7C,oBAAoB,kBAAkB,sBAAsB,QAAQ,oBAAoB,sBAAsB,oBAAoB,gBAAgB;cACrJ,iBAAiB,oBAAoB,gBAAgB;;cAErD,cAAc,OAAO,uBAAuB"}
package/dist/control.mjs CHANGED
@@ -2,7 +2,7 @@ import { o as paramBindingFor, s as paramName } from "./secret-Dgyg1WyG-Dzz95fGI
2
2
  import { a as encode, c as paramEntries, d as serializeInput, n as configKey, o as encodeParamPointer, r as decodeParamPointer, s as isParamPointerRow } from "./serializer-DTCrRl7S-CN0q1ZFB.mjs";
3
3
  import { a as provisionedEdges, n as SELF_ORIGIN, r as STREAMS_API_KEY, t as RESERVED_PROVIDER_PARAMS } from "./provisioned-edges-DKsBi7uK-BmsYKWZI.mjs";
4
4
  import { n as requiredPackHeadOf } from "./required-pack-head-CMMJ2LaU-CfWu5JMj.mjs";
5
- import { A as collectPages, C as appAfterEnvironment, D as RESERVED_DATABASE_URL_KEYS, E as PrismaApiError, F as fromEnv, I as managementApiBaseUrl, M as layer, N as resolveDefaultBranchId, O as call, P as PrismaCredentials, S as ServiceKeyProvider, T as ManagementClient, _ as resolveTargetRef, a as PRISMA_CLOUD_EXTENSION_ID, b as providers, d as collectPreflightNames, f as containerDescriptor, g as resolveOrmConfig, h as prismaCloudContainerOf, i as OrmMigrationProvider, j as drivePagesAsync, k as claimDatabaseUrlKeys, l as S3Credentials, m as packHeadRefHashes, n as GeneratedParamProvider, o as PgWarm, r as OrmMigration, s as PgWarmProvider, t as GeneratedParam, u as S3CredentialsProvider, w as isWithin, x as ServiceKey } from "./s3-credentials-resource-D_qSGYMM-BiT5e-MA.mjs";
5
+ import { A as collectPages, C as appAfterEnvironment, D as RESERVED_DATABASE_URL_KEYS, E as PrismaApiError, F as fromEnv, I as managementApiBaseUrl, M as layer, N as resolveDefaultBranchId, O as call, P as PrismaCredentials, S as ServiceKeyProvider, T as ManagementClient, _ as resolveTargetRef, a as PRISMA_CLOUD_EXTENSION_ID, b as providers, d as collectPreflightNames, f as containerDescriptor, g as resolveOrmConfig, h as prismaCloudContainerOf, i as OrmMigrationProvider, j as drivePagesAsync, k as claimDatabaseUrlKeys, l as S3Credentials, m as packHeadRefHashes, n as GeneratedParamProvider, o as PgWarm, r as OrmMigration, s as PgWarmProvider, t as GeneratedParam, u as S3CredentialsProvider, w as isWithin, x as ServiceKey } from "./s3-credentials-resource-CDab6Xhp-DhYo1-tR.mjs";
6
6
  import { r as isPostgresResourceNode } from "./orm-postgres-ChW2Ewj7-Dnas0G3L.mjs";
7
7
  import { isParamSource } from "@prisma/composer";
8
8
  import { blindCast } from "@prisma/composer/casts";
@@ -1501,7 +1501,7 @@ const stageDatabase = ({ id, application, region }) => Effect.gen(function* () {
1501
1501
  const branchId = attachmentBranchIdOf(application, id);
1502
1502
  const db = yield* Prisma$1.Database(`${id}-db`, {
1503
1503
  project: projectIdOf(application),
1504
- region: region ?? "us-east-1",
1504
+ region: region ?? "inherit",
1505
1505
  ...branchId !== void 0 ? { branchId } : { name: id }
1506
1506
  });
1507
1507
  const conn = yield* Prisma$1.Connection(`${id}-conn`, {
@@ -1578,7 +1578,7 @@ function computeDescriptor(o) {
1578
1578
  const svc = yield* Prisma$1.App(`${id}-svc`, {
1579
1579
  project: projectId,
1580
1580
  displayName: id,
1581
- regionId: o().region ?? "us-east-1",
1581
+ ...o().region !== void 0 ? { regionId: o().region } : {},
1582
1582
  ...branchId !== void 0 ? { branchId } : {}
1583
1583
  });
1584
1584
  return {
@@ -2173,10 +2173,6 @@ const prismaState = () => ({
2173
2173
  });
2174
2174
  }
2175
2175
  });
2176
- const KNOWN_REGION_SET = new Set(Prisma$1.KNOWN_REGION_IDS);
2177
- function isComputeRegion(value) {
2178
- return KNOWN_REGION_SET.has(value);
2179
- }
2180
2176
  /** Prisma.providers()'s ProviderCollection doesn't structurally unify with Alchemy's inferred providers Layer (a @internal/lowering typings gap); it satisfies it at runtime. */
2181
2177
  function asProvidersLayer(layer) {
2182
2178
  return layer;
@@ -2236,11 +2232,10 @@ const PROVIDER_PARAMS = buildProviderParams(RESERVED_PROVIDER_PARAMS, PROVIDER_P
2236
2232
  * `PRISMA_WORKSPACE_ID`: nothing in this file reads `ResolvedCloudOptions.workspaceId`
2237
2233
  * downstream — it exists only so a caller MAY pin an explicit workspace, and
2238
2234
  * the real workspace check for a real deploy lives where the value actually
2239
- * matters, `container.ts`'s `ensureContainer`/`locateContainer`. Region
2240
- * validation stays eager-on-call (a garbage `PRISMA_REGION` still fails
2241
- * loudly), but an ABSENT one resolves to `undefined` without touching
2242
- * anything else required for `prisma-composer dev`, which never sets
2243
- * `PRISMA_REGION` and must not fail on its absence (local-dev spec § 5).
2235
+ * matters, `container.ts`'s `ensureContainer`/`locateContainer`. An absent
2236
+ * `PRISMA_REGION` resolves to `undefined` without touching anything else —
2237
+ * required for `prisma-composer dev`, which never sets `PRISMA_REGION` and
2238
+ * must not fail on its absence (local-dev spec § 5).
2244
2239
  */
2245
2240
  function resolveOptions(opts) {
2246
2241
  const workspaceId = opts.workspaceId ?? process.env["PRISMA_WORKSPACE_ID"] ?? "";
@@ -2254,10 +2249,9 @@ function resolveOptions(opts) {
2254
2249
  workspaceId,
2255
2250
  providerParams: PROVIDER_PARAMS
2256
2251
  };
2257
- if (!isComputeRegion(region)) throw new Error(`prismaCloud(): environment variable PRISMA_REGION="${region}" is not a known region (expected one of: ${Prisma$1.KNOWN_REGION_IDS.join(", ")}).`);
2258
2252
  return {
2259
2253
  workspaceId,
2260
- region,
2254
+ region: blindCast(region),
2261
2255
  providerParams: PROVIDER_PARAMS
2262
2256
  };
2263
2257
  }
@@ -2285,7 +2279,7 @@ const prismaCloud = (opts = {}) => {
2285
2279
  const o = lazyOptions(opts, pointerUpdatedAtLookup(preflightTimestamps, process.env));
2286
2280
  return {
2287
2281
  id: PRISMA_CLOUD_EXTENSION_ID,
2288
- container: containerDescriptor(),
2282
+ container: containerDescriptor({ region: () => o().region }),
2289
2283
  providers: () => asProvidersLayer(Layer.mergeAll(providers(), PgWarmProvider(), OrmMigrationProvider(), S3CredentialsProvider(), GeneratedParamProvider(), ServiceKeyProvider())),
2290
2284
  preflight: (input) => runPreflight(input).then((timestamps) => {
2291
2285
  for (const [name, updatedAt] of timestamps) preflightTimestamps.set(name, updatedAt);