@prisma/composer-prisma-cloud 0.29.1-dev.4 → 0.29.1-dev.5

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.
@@ -10,7 +10,7 @@ import * as Output from "alchemy/Output";
10
10
  import { Resource } from "alchemy";
11
11
  import { Credentials } from "@distilled.cloud/prisma";
12
12
  import { EnvironmentVariable } from "alchemy/Prisma";
13
- import "effect/unstable/http/HttpClient";
13
+ import "effect/http/HttpClient";
14
14
  import { ExtensionDescriptor, StateDescriptor } from "@prisma/composer/config";
15
15
  //#region ../../1-prisma-cloud/0-lowering/lowering/dist/index.d.mts
16
16
  //#endregion
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 call, C as ServiceKey, D as ManagementClient, E as isWithin, F as resolveDefaultBranchId, I as PrismaCredentials, L as fromEnv, M as collectPages, N as drivePagesAsync, O as PrismaApiError, P as layer, R as managementApiBaseUrl, S as providers, T as appAfterEnvironment, _ 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 claimDatabaseUrlKeys, k as RESERVED_DATABASE_URL_KEYS, 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 serviceAppName, w as ServiceKeyProvider, y as targetStorageHash } from "./s3-credentials-resource-BZjtuopJ-D8y42HzH.mjs";
5
+ import { A as call, C as ServiceKey, D as ManagementClient, E as isWithin, F as resolveDefaultBranchId, I as PrismaCredentials, L as fromEnv, M as collectPages, N as drivePagesAsync, O as PrismaApiError, P as layer, R as managementApiBaseUrl, S as providers, T as appAfterEnvironment, _ 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 claimDatabaseUrlKeys, k as RESERVED_DATABASE_URL_KEYS, 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 serviceAppName, w as ServiceKeyProvider, y as targetStorageHash } from "./s3-credentials-resource-BZjtuopJ-Bot_AiJV.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";
@@ -21,10 +21,10 @@ import * as zlib from "node:zlib";
21
21
  import * as Output from "alchemy/Output";
22
22
  import { Stack } from "alchemy";
23
23
  import * as Prisma$1 from "alchemy/Prisma";
24
- import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
24
+ import * as HttpClientRequest from "effect/http/HttpClientRequest";
25
25
  import { State, makeHttpStateStore } from "alchemy/State";
26
- import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
27
- import * as Headers from "effect/unstable/http/Headers";
26
+ import * as FetchHttpClient from "effect/http/FetchHttpClient";
27
+ import * as Headers from "effect/http/Headers";
28
28
  import { execFileSync } from "node:child_process";
29
29
  import { readPreflightPayload } from "@prisma/composer/config";
30
30
  //#region ../../1-prisma-cloud/0-lowering/lowering/dist/artifact-CoKVIyRH.mjs
@@ -1185,12 +1185,17 @@ function applicationTopologyApi(options) {
1185
1185
  const describe = "record this deploy's application topology";
1186
1186
  let result;
1187
1187
  try {
1188
- result = await blindCast(client.PUT)("/v1/projects/{projectId}/branches/{branchId}/application-topology", {
1188
+ result = await client.PUT("/v1/projects/{projectId}/branches/{branchId}/application-topology", {
1189
1189
  params: { path: {
1190
1190
  projectId,
1191
1191
  branchId
1192
1192
  } },
1193
- body: submission,
1193
+ body: {
1194
+ contentHash: submission.contentHash,
1195
+ nodes: [...submission.nodes],
1196
+ ports: [...submission.ports],
1197
+ edges: [...submission.edges]
1198
+ },
1194
1199
  signal: AbortSignal.timeout(REPORT_DEADLINE_MS)
1195
1200
  });
1196
1201
  } catch (error) {
@@ -1475,6 +1480,10 @@ function cloudApplicationOf(application) {
1475
1480
  function projectIdOf(application) {
1476
1481
  return cloudApplicationOf(application).projectId;
1477
1482
  }
1483
+ /** The `logicalId` prop of a node's App, Database or Bucket: its address on every platform deploy, none in branchless dev (ADR-0051). */
1484
+ function logicalIdProp(application, address) {
1485
+ return cloudApplicationOf(application).branchless ? {} : { logicalId: address };
1486
+ }
1478
1487
  /**
1479
1488
  * The Branch a database attaches to. Upstream treats an omitted branch as
1480
1489
  * desired-unassigned (`branchId` PATCHed back to `null` on reconcile), so a
@@ -1494,12 +1503,13 @@ function attachmentBranchIdOf(application, id) {
1494
1503
  * the `name` arm. The returned `url` is direct, not pooled — PgWarm and the
1495
1504
  * migration flows need a direct connection.
1496
1505
  */
1497
- const stageDatabase = ({ id, application, region }) => Effect.gen(function* () {
1506
+ const stageDatabase = ({ id, address, application, region }) => Effect.gen(function* () {
1498
1507
  const branchId = attachmentBranchIdOf(application, id);
1499
1508
  const db = yield* Prisma$1.Database(`${id}-db`, {
1500
1509
  project: projectIdOf(application),
1501
1510
  region: region ?? "inherit",
1502
- ...branchId !== void 0 ? { branchId } : { name: id }
1511
+ ...branchId !== void 0 ? { branchId } : { name: id },
1512
+ ...logicalIdProp(application, address)
1503
1513
  });
1504
1514
  const conn = yield* Prisma$1.Connection(`${id}-conn`, {
1505
1515
  database: db,
@@ -1521,13 +1531,14 @@ const stageDatabase = ({ id, application, region }) => Effect.gen(function* () {
1521
1531
  * secretAccessKey) become the four S3Config outputs consumers resolve by name.
1522
1532
  */
1523
1533
  function bucketDescriptor(_o) {
1524
- const lowering = ({ id, application }) => Effect.gen(function* () {
1534
+ const lowering = ({ id, address, application }) => Effect.gen(function* () {
1525
1535
  validateName(id, "resource name (from provision id)");
1526
- const branchId = cloudApplicationOf(application).branchId;
1536
+ const { branchId } = cloudApplicationOf(application);
1527
1537
  const bkt = yield* Prisma$1.Bucket(`${id}-bucket`, {
1528
1538
  project: projectIdOf(application),
1529
1539
  name: id,
1530
- ...branchId !== void 0 ? { branchId } : {}
1540
+ ...branchId !== void 0 ? { branchId } : {},
1541
+ ...logicalIdProp(application, address)
1531
1542
  });
1532
1543
  const key = yield* Prisma$1.BucketAccessKey(`${id}-key`, {
1533
1544
  bucket: bkt.bucketId,
@@ -1583,15 +1594,16 @@ function isComputeProvisioned(value) {
1583
1594
  function computeDescriptor(o) {
1584
1595
  return {
1585
1596
  kind: "service",
1586
- provision: ({ id, application }) => Effect.gen(function* () {
1597
+ provision: ({ id, address, application }) => Effect.gen(function* () {
1587
1598
  validateName(id, "service name (from provision id)");
1588
1599
  const projectId = projectIdOf(application);
1589
- const branchId = cloudApplicationOf(application).branchId;
1600
+ const { branchId } = cloudApplicationOf(application);
1590
1601
  const svc = yield* Prisma$1.App(`${id}-svc`, {
1591
1602
  project: projectId,
1592
1603
  displayName: serviceAppName(id),
1593
1604
  ...o().region !== void 0 ? { regionId: o().region } : {},
1594
- ...branchId !== void 0 ? { branchId } : {}
1605
+ ...branchId !== void 0 ? { branchId } : {},
1606
+ ...logicalIdProp(application, address)
1595
1607
  });
1596
1608
  return {
1597
1609
  serviceId: svc.appId,
@@ -1605,6 +1617,7 @@ function computeDescriptor(o) {
1605
1617
  const cls = branchId ? "preview" : "production";
1606
1618
  const branch = branchId !== void 0 ? { branchId } : {};
1607
1619
  const projectId = provisioned.projectId;
1620
+ if (node.kind !== "service") throw new Error(`prisma-cloud: cannot serialize non-service node "${address}".`);
1608
1621
  const svc = node;
1609
1622
  const rows = [];
1610
1623
  for (const d of paramEntries(svc)) {
@@ -1929,10 +1942,11 @@ async function runPackPreflight(graph) {
1929
1942
  * no-op, a contract or ref-invariant change re-migrates.
1930
1943
  */
1931
1944
  function postgresDescriptor(o) {
1932
- const lowering = ({ id, node, application, graph }) => Effect.gen(function* () {
1945
+ const lowering = ({ id, address, node, application, graph }) => Effect.gen(function* () {
1933
1946
  validateName(id, "resource name (from provision id)");
1934
1947
  const { db, url } = yield* stageDatabase({
1935
1948
  id,
1949
+ address,
1936
1950
  application,
1937
1951
  region: o().region
1938
1952
  });
@@ -1969,10 +1983,11 @@ function postgresDescriptor(o) {
1969
1983
  * exactly once.
1970
1984
  */
1971
1985
  function rawPostgresDescriptor(o) {
1972
- const lowering = ({ id, application }) => Effect.gen(function* () {
1986
+ const lowering = ({ id, address, application }) => Effect.gen(function* () {
1973
1987
  validateName(id, "resource name (from provision id)");
1974
1988
  const { db, url } = yield* stageDatabase({
1975
1989
  id,
1990
+ address,
1976
1991
  application,
1977
1992
  region: o().region
1978
1993
  });