@prisma/composer-prisma-cloud 0.32.0-dev.1 → 0.32.0-dev.2
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.mjs +24 -16
- package/dist/control.mjs.map +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/{s3-credentials-resource-D4jcpAZp-Dv9N3Jxc.mjs → s3-credentials-resource-D4jcpAZp-CXdZPtn1.mjs} +4 -4
- package/dist/{s3-credentials-resource-D4jcpAZp-Dv9N3Jxc.mjs.map → s3-credentials-resource-D4jcpAZp-CXdZPtn1.mjs.map} +1 -1
- package/package.json +19 -19
package/dist/control.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { c as paramBindingFor, l as paramName } from "./casts-DpaahrlC-Ykus3kCE.
|
|
|
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-CE3hLPYz-DfUFvkm9.mjs";
|
|
3
3
|
import { a as provisionedEdges, n as SELF_ORIGIN, r as STREAMS_API_KEY, t as RESERVED_PROVIDER_PARAMS } from "./provisioned-edges-CPrUiJ1K--R7PIGoz.mjs";
|
|
4
4
|
import { n as requiredPackHeadOf } from "./required-pack-head-CMMJ2LaU-CfWu5JMj.mjs";
|
|
5
|
-
import { A as PrismaApiError, B as managementApiBaseUrl, D as appAfterEnvironment, E as ServiceKeyProvider, F as drivePagesAsync, I as layer, L as resolveDefaultBranchId, M as call, N as claimDatabaseUrlKeys, O as isWithin, P as collectPages, R as PrismaCredentials, T as ServiceKey, _ as resolveOrmConfig, a as OrmMigrationProvider, b as serviceAppName, c as PgWarmProvider, d as S3CredentialsProvider, f as collectPreflightNames, g as prismaCloudContainerOf, h as packHeadRefHashes, i as OrmMigration, j as RESERVED_DATABASE_URL_KEYS, k as ManagementClient, n as GeneratedParamProvider, o as PRISMA_CLOUD_EXTENSION_ID, p as containerDescriptor, s as PgWarm, t as GeneratedParam, u as S3Credentials, v as resolveTargetRef, w as providers, x as targetStorageHash, y as resourceName, z as fromEnv } from "./s3-credentials-resource-D4jcpAZp-
|
|
5
|
+
import { A as PrismaApiError, B as managementApiBaseUrl, D as appAfterEnvironment, E as ServiceKeyProvider, F as drivePagesAsync, I as layer, L as resolveDefaultBranchId, M as call, N as claimDatabaseUrlKeys, O as isWithin, P as collectPages, R as PrismaCredentials, T as ServiceKey, _ as resolveOrmConfig, a as OrmMigrationProvider, b as serviceAppName, c as PgWarmProvider, d as S3CredentialsProvider, f as collectPreflightNames, g as prismaCloudContainerOf, h as packHeadRefHashes, i as OrmMigration, j as RESERVED_DATABASE_URL_KEYS, k as ManagementClient, n as GeneratedParamProvider, o as PRISMA_CLOUD_EXTENSION_ID, p as containerDescriptor, s as PgWarm, t as GeneratedParam, u as S3Credentials, v as resolveTargetRef, w as providers, x as targetStorageHash, y as resourceName, z as fromEnv } from "./s3-credentials-resource-D4jcpAZp-CXdZPtn1.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";
|
|
@@ -25,6 +25,7 @@ import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
|
25
25
|
import { State, makeHttpStateStore } from "alchemy/State";
|
|
26
26
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
27
27
|
import * as Headers from "effect/http/Headers";
|
|
28
|
+
import { adopt } from "alchemy/AdoptPolicy";
|
|
28
29
|
import { execFileSync } from "node:child_process";
|
|
29
30
|
import { readPreflightPayload } from "@prisma/composer/config";
|
|
30
31
|
//#region ../../1-prisma-cloud/0-lowering/lowering/dist/artifact-DX6mRqat.mjs
|
|
@@ -533,13 +534,12 @@ const listBranchResources = (client, projectId, branchId) => Effect.gen(function
|
|
|
533
534
|
/**
|
|
534
535
|
* The empty-scope-with-live-resources case: the platform state API holds no
|
|
535
536
|
* resources for (stack, stage) while the platform already has Compute apps,
|
|
536
|
-
* databases, or buckets on the target Branch —
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
* passes. Connections are not counted: they are children of databases, which
|
|
537
|
+
* databases, or buckets on the target Branch — the stage was deployed by an
|
|
538
|
+
* older Composer version whose state store is never read, or the resources
|
|
539
|
+
* belong to something other than this app. The rows could be identified by
|
|
540
|
+
* logicalId, but the rest of the state could not be rebuilt from them
|
|
541
|
+
* (ADR-0051), so fail once, up front. A genuinely fresh deploy sees an empty
|
|
542
|
+
* Branch and passes. Connections are not counted: they are children of databases, which
|
|
543
543
|
* are. Local dev never reaches this — the dev stack pins
|
|
544
544
|
* `state: localState()` (generate-dev-stack.ts).
|
|
545
545
|
*/
|
|
@@ -550,7 +550,7 @@ const failOnEmptyScopeWithLiveResources = (projectId, branchId, stack, stage) =>
|
|
|
550
550
|
const names = resources.map((r) => `${r.kind} "${r.name}"`).join(", ");
|
|
551
551
|
return yield* Effect.fail(new PrismaApiError({
|
|
552
552
|
status: 0,
|
|
553
|
-
message: `
|
|
553
|
+
message: `stage "${stage}" (stack "${stack}") has no deploy state, but its branch ${branchId} already holds ${String(resources.length)} resource(s): ${names}. Without state, a deploy would try to recreate them and a destroy would remove nothing. This happens when the stage was deployed by a Composer version that kept deploy state elsewhere, or when the resources belong to something other than this app. Delete the stage (its branch, or the project for production) in the Prisma Console or via the Management API, then deploy again; a stage from an older version can instead be destroyed with that version first. If the resources belong to something else, remove them or deploy into a different project.`
|
|
554
554
|
}));
|
|
555
555
|
});
|
|
556
556
|
/**
|
|
@@ -1504,6 +1504,14 @@ function logicalIdProp(application, address) {
|
|
|
1504
1504
|
return cloudApplicationOf(application).branchless ? {} : { logicalId: address };
|
|
1505
1505
|
}
|
|
1506
1506
|
/**
|
|
1507
|
+
* Declares one of the app's own App, Database, Bucket or `COMPOSER_` variable rows. On the app's
|
|
1508
|
+
* Project and branch, the row holding a node's logicalId (or a variable's key) is that node's row,
|
|
1509
|
+
* so a deploy resuming an interrupted create uses it instead of refusing it (ADR-0051). Only for
|
|
1510
|
+
* resources declared with their identity: `logicalIdProp` on App, Database and Bucket, a
|
|
1511
|
+
* `COMPOSER_` key on variables. Without one, upstream falls back to matching by display name.
|
|
1512
|
+
*/
|
|
1513
|
+
const asOwnRow = adopt(true);
|
|
1514
|
+
/**
|
|
1507
1515
|
* The Branch a database attaches to. Upstream treats an omitted branch as
|
|
1508
1516
|
* desired-unassigned (`branchId` PATCHed back to `null` on reconcile), so a
|
|
1509
1517
|
* deploy container carrying neither id is a broken transport; only a
|
|
@@ -1529,7 +1537,7 @@ const stageDatabase = ({ id, address, application, region }) => Effect.gen(funct
|
|
|
1529
1537
|
region: region ?? "inherit",
|
|
1530
1538
|
...branchId !== void 0 ? { branchId } : { name: resourceName(id) },
|
|
1531
1539
|
...logicalIdProp(application, address)
|
|
1532
|
-
});
|
|
1540
|
+
}).pipe(asOwnRow);
|
|
1533
1541
|
const conn = yield* Prisma$1.Connection(`${id}-conn`, {
|
|
1534
1542
|
database: db,
|
|
1535
1543
|
name: id
|
|
@@ -1558,7 +1566,7 @@ function bucketDescriptor(_o) {
|
|
|
1558
1566
|
name: resourceName(id),
|
|
1559
1567
|
...branchId !== void 0 ? { branchId } : {},
|
|
1560
1568
|
...logicalIdProp(application, address)
|
|
1561
|
-
});
|
|
1569
|
+
}).pipe(asOwnRow);
|
|
1562
1570
|
const key = yield* Prisma$1.BucketAccessKey(`${id}-key`, {
|
|
1563
1571
|
bucket: bkt.bucketId,
|
|
1564
1572
|
name: id,
|
|
@@ -1627,7 +1635,7 @@ function computeDescriptor(o) {
|
|
|
1627
1635
|
...o().region !== void 0 ? { regionId: o().region } : {},
|
|
1628
1636
|
...branchId !== void 0 ? { branchId } : {},
|
|
1629
1637
|
...logicalIdProp(application, address)
|
|
1630
|
-
});
|
|
1638
|
+
}).pipe(asOwnRow);
|
|
1631
1639
|
return {
|
|
1632
1640
|
serviceId: svc.appId,
|
|
1633
1641
|
projectId,
|
|
@@ -1655,7 +1663,7 @@ function computeDescriptor(o) {
|
|
|
1655
1663
|
value: wrapped,
|
|
1656
1664
|
class: cls,
|
|
1657
1665
|
...branch
|
|
1658
|
-
});
|
|
1666
|
+
}).pipe(asOwnRow);
|
|
1659
1667
|
const pointer = d.owner === "service" && isParamPointerRow(rowValue) ? decodeParamPointer(rowValue) : void 0;
|
|
1660
1668
|
rows.push({
|
|
1661
1669
|
record,
|
|
@@ -1674,7 +1682,7 @@ function computeDescriptor(o) {
|
|
|
1674
1682
|
value: inputValue,
|
|
1675
1683
|
class: cls,
|
|
1676
1684
|
...branch
|
|
1677
|
-
}),
|
|
1685
|
+
}).pipe(asOwnRow),
|
|
1678
1686
|
key: inputRow.key,
|
|
1679
1687
|
value: inputValue,
|
|
1680
1688
|
pointers: inputRow.secrets
|
|
@@ -1689,7 +1697,7 @@ function computeDescriptor(o) {
|
|
|
1689
1697
|
value: generatedValue,
|
|
1690
1698
|
class: cls,
|
|
1691
1699
|
...branch
|
|
1692
|
-
}),
|
|
1700
|
+
}).pipe(asOwnRow),
|
|
1693
1701
|
key: leaf.varName,
|
|
1694
1702
|
value: generatedValue
|
|
1695
1703
|
});
|
|
@@ -1721,7 +1729,7 @@ function computeDescriptor(o) {
|
|
|
1721
1729
|
value: providerValue,
|
|
1722
1730
|
class: cls,
|
|
1723
1731
|
...branch
|
|
1724
|
-
}),
|
|
1732
|
+
}).pipe(asOwnRow),
|
|
1725
1733
|
key,
|
|
1726
1734
|
value: providerValue
|
|
1727
1735
|
});
|