@prisma/composer-prisma-cloud 0.17.0 → 0.18.0-dev.1
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/auth/pack.mjs +1 -1
- package/dist/auth/pack.mjs.map +1 -1
- package/dist/auth/testing.mjs +1 -1
- package/dist/auth/testing.mjs.map +1 -1
- package/dist/control.d.mts +15 -2
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +11 -16
- package/dist/control.mjs.map +1 -1
- package/dist/cron/index.d.mts +17 -6
- package/dist/cron/index.d.mts.map +1 -1
- package/dist/cron/index.mjs +6 -3
- package/dist/cron/index.mjs.map +1 -1
- package/dist/cron/scheduler-entrypoint.mjs +120 -0
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/local-target.mjs.map +1 -1
- package/dist/{s3-credentials-resource-D_qSGYMM-BiT5e-MA.mjs → s3-credentials-resource-CLB5qGGZ-BA7MT-Tb.mjs} +36 -12
- package/dist/s3-credentials-resource-CLB5qGGZ-BA7MT-Tb.mjs.map +1 -0
- package/package.json +18 -18
- package/dist/s3-credentials-resource-D_qSGYMM-BiT5e-MA.mjs.map +0 -1
package/dist/control.d.mts
CHANGED
|
@@ -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
|
|
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?:
|
|
76
|
+
region?: ProjectRegion;
|
|
64
77
|
}
|
|
65
78
|
/**
|
|
66
79
|
* One brand's deploy-side value registration: edge-derived (`value(refs)`,
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/control.d.mts"],"mappings":"
|
|
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
|
|
5
|
+
import { A as claimDatabaseUrlKeys, C as ServiceKeyProvider, D as PrismaApiError, E as ManagementClient, F as PrismaCredentials, I as fromEnv, L as managementApiBaseUrl, M as drivePagesAsync, N as layer, O as RESERVED_DATABASE_URL_KEYS, P as resolveDefaultBranchId, S as ServiceKey, T as isWithin, _ as resolveTargetRef, a as PRISMA_CLOUD_EXTENSION_ID, d as collectPreflightNames, f as containerDescriptor, g as resolveOrmConfig, h as prismaCloudContainerOf, i as OrmMigrationProvider, j as collectPages, k as call, l as S3Credentials, m as packHeadRefHashes, n as GeneratedParamProvider, o as PgWarm, r as OrmMigration, s as PgWarmProvider, t as GeneratedParam, u as S3CredentialsProvider, v as targetStorageHash, w as appAfterEnvironment, x as providers } from "./s3-credentials-resource-CLB5qGGZ-BA7MT-Tb.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 ?? "
|
|
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
|
|
1581
|
+
...o().region !== void 0 ? { regionId: o().region } : {},
|
|
1582
1582
|
...branchId !== void 0 ? { branchId } : {}
|
|
1583
1583
|
});
|
|
1584
1584
|
return {
|
|
@@ -1910,14 +1910,15 @@ function postgresDescriptor(o) {
|
|
|
1910
1910
|
});
|
|
1911
1911
|
if (!isPostgresResourceNode(node)) throw new Error(`postgres lowering received a non-postgres node (${id}).`);
|
|
1912
1912
|
const contractJson = node.provides.__cmp.contractJson;
|
|
1913
|
+
const currentContractHash = targetStorageHash(contractJson);
|
|
1913
1914
|
const { migrationsDir, extensionPacks } = yield* Effect.promise(() => resolveOrmConfig(node.config));
|
|
1914
1915
|
const ref = yield* Effect.promise(() => resolveTargetRef(migrationsDir, contractJson, node.targetRef));
|
|
1915
1916
|
yield* Effect.promise(() => runPackPreflight(graph));
|
|
1916
1917
|
const warm = yield* PgWarm(`${id}-warm`, { url });
|
|
1917
1918
|
yield* OrmMigration(`${id}-migrate`, {
|
|
1918
1919
|
url: warm.url,
|
|
1919
|
-
contractJson,
|
|
1920
1920
|
migrationsDir,
|
|
1921
|
+
currentContractHash,
|
|
1921
1922
|
targetHash: ref.hash,
|
|
1922
1923
|
invariants: [...ref.invariants].sort(),
|
|
1923
1924
|
packHeadRefHashes: packHeadRefHashes(extensionPacks),
|
|
@@ -2173,10 +2174,6 @@ const prismaState = () => ({
|
|
|
2173
2174
|
});
|
|
2174
2175
|
}
|
|
2175
2176
|
});
|
|
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
2177
|
/** 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
2178
|
function asProvidersLayer(layer) {
|
|
2182
2179
|
return layer;
|
|
@@ -2236,11 +2233,10 @@ const PROVIDER_PARAMS = buildProviderParams(RESERVED_PROVIDER_PARAMS, PROVIDER_P
|
|
|
2236
2233
|
* `PRISMA_WORKSPACE_ID`: nothing in this file reads `ResolvedCloudOptions.workspaceId`
|
|
2237
2234
|
* downstream — it exists only so a caller MAY pin an explicit workspace, and
|
|
2238
2235
|
* the real workspace check for a real deploy lives where the value actually
|
|
2239
|
-
* matters, `container.ts`'s `ensureContainer`/`locateContainer`.
|
|
2240
|
-
*
|
|
2241
|
-
*
|
|
2242
|
-
*
|
|
2243
|
-
* `PRISMA_REGION` and must not fail on its absence (local-dev spec § 5).
|
|
2236
|
+
* matters, `container.ts`'s `ensureContainer`/`locateContainer`. An absent
|
|
2237
|
+
* `PRISMA_REGION` resolves to `undefined` without touching anything else —
|
|
2238
|
+
* required for `prisma-composer dev`, which never sets `PRISMA_REGION` and
|
|
2239
|
+
* must not fail on its absence (local-dev spec § 5).
|
|
2244
2240
|
*/
|
|
2245
2241
|
function resolveOptions(opts) {
|
|
2246
2242
|
const workspaceId = opts.workspaceId ?? process.env["PRISMA_WORKSPACE_ID"] ?? "";
|
|
@@ -2254,10 +2250,9 @@ function resolveOptions(opts) {
|
|
|
2254
2250
|
workspaceId,
|
|
2255
2251
|
providerParams: PROVIDER_PARAMS
|
|
2256
2252
|
};
|
|
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
2253
|
return {
|
|
2259
2254
|
workspaceId,
|
|
2260
|
-
region,
|
|
2255
|
+
region: blindCast(region),
|
|
2261
2256
|
providerParams: PROVIDER_PARAMS
|
|
2262
2257
|
};
|
|
2263
2258
|
}
|
|
@@ -2285,7 +2280,7 @@ const prismaCloud = (opts = {}) => {
|
|
|
2285
2280
|
const o = lazyOptions(opts, pointerUpdatedAtLookup(preflightTimestamps, process.env));
|
|
2286
2281
|
return {
|
|
2287
2282
|
id: PRISMA_CLOUD_EXTENSION_ID,
|
|
2288
|
-
container: containerDescriptor(),
|
|
2283
|
+
container: containerDescriptor({ region: () => o().region }),
|
|
2289
2284
|
providers: () => asProvidersLayer(Layer.mergeAll(providers(), PgWarmProvider(), OrmMigrationProvider(), S3CredentialsProvider(), GeneratedParamProvider(), ServiceKeyProvider())),
|
|
2290
2285
|
preflight: (input) => runPreflight(input).then((timestamps) => {
|
|
2291
2286
|
for (const [name, updatedAt] of timestamps) preflightTimestamps.set(name, updatedAt);
|