@prisma/composer-prisma-cloud 0.1.0 → 0.2.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.
Files changed (66) hide show
  1. package/dist/control.d.mts +79 -36
  2. package/dist/control.d.mts.map +1 -0
  3. package/dist/control.mjs +1074 -330
  4. package/dist/control.mjs.map +1 -1
  5. package/dist/cron/index.d.mts +63 -10
  6. package/dist/cron/index.d.mts.map +1 -0
  7. package/dist/cron/index.mjs +255 -42
  8. package/dist/cron/index.mjs.map +1 -1
  9. package/dist/cron/scheduler-entrypoint.mjs +563 -289
  10. package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
  11. package/dist/cron/scheduler-service.mjs +255 -42
  12. package/dist/cron/scheduler-service.mjs.map +1 -1
  13. package/dist/index.d.mts +152 -26
  14. package/dist/index.d.mts.map +1 -0
  15. package/dist/index.mjs +108 -43
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/{prisma-next-COrwlg3N.mjs → prisma-next-DlU01kXJ-2sP5mQb6.mjs} +3 -3
  18. package/dist/prisma-next-DlU01kXJ-2sP5mQb6.mjs.map +1 -0
  19. package/dist/prisma-next.d.mts +1 -2
  20. package/dist/prisma-next.d.mts.map +1 -0
  21. package/dist/prisma-next.mjs +1 -1
  22. package/dist/provisioned-edges-B_XS1Mz--NFJgcXK7.mjs +211 -0
  23. package/dist/provisioned-edges-B_XS1Mz--NFJgcXK7.mjs.map +1 -0
  24. package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts +36 -0
  25. package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts.map +1 -0
  26. package/dist/{serializer-C2CsA7xm-29Eg2Tjl.mjs → serializer-D8_84XWO-DA2B6YbX.mjs} +91 -7
  27. package/dist/serializer-D8_84XWO-DA2B6YbX.mjs.map +1 -0
  28. package/dist/storage/index.d.mts +56 -20
  29. package/dist/storage/index.d.mts.map +1 -0
  30. package/dist/storage/index.mjs +267 -44
  31. package/dist/storage/index.mjs.map +1 -1
  32. package/dist/storage/storage-entrypoint.mjs +7395 -53
  33. package/dist/storage/storage-entrypoint.mjs.map +1 -1
  34. package/dist/storage/storage-service.mjs +267 -44
  35. package/dist/storage/storage-service.mjs.map +1 -1
  36. package/dist/storage/testing.d.mts +7 -4
  37. package/dist/storage/testing.d.mts.map +1 -0
  38. package/dist/storage/testing.mjs.map +1 -1
  39. package/dist/streams/index.d.mts +222 -0
  40. package/dist/streams/index.d.mts.map +1 -0
  41. package/dist/streams/index.mjs +4170 -0
  42. package/dist/streams/index.mjs.map +1 -0
  43. package/dist/streams/streams-entrypoint.mjs +48207 -0
  44. package/dist/streams/streams-entrypoint.mjs.map +1 -0
  45. package/dist/streams/streams-service.mjs +923 -0
  46. package/dist/streams/streams-service.mjs.map +1 -0
  47. package/dist/streams/testing.d.mts +33 -0
  48. package/dist/streams/testing.d.mts.map +1 -0
  49. package/dist/streams/testing.mjs +31335 -0
  50. package/dist/streams/testing.mjs.map +1 -0
  51. package/dist/testing.d.mts +1 -2
  52. package/dist/testing.d.mts.map +1 -0
  53. package/dist/testing.mjs +1 -1
  54. package/dist/testing.mjs.map +1 -1
  55. package/package.json +29 -23
  56. package/src/exports/control.ts +1 -0
  57. package/src/exports/cron.ts +1 -0
  58. package/src/exports/index.ts +1 -0
  59. package/src/exports/prisma-next.ts +1 -0
  60. package/src/exports/storage-testing.ts +1 -0
  61. package/src/exports/storage.ts +1 -0
  62. package/src/exports/streams-testing.ts +1 -0
  63. package/src/exports/streams.ts +1 -0
  64. package/src/exports/testing.ts +1 -0
  65. package/dist/prisma-next-COrwlg3N.mjs.map +0 -1
  66. package/dist/serializer-C2CsA7xm-29Eg2Tjl.mjs.map +0 -1
@@ -1,56 +1,99 @@
1
- import * as Layer from "effect/Layer";
1
+ import { t as ProviderParamEntry } from "./serializer-Cx5slrV4-xJfH6EWS.mjs";
2
2
  import { createManagementApiClient } from "@prisma/management-api-sdk";
3
- import { Resource, StackServices } from "alchemy";
4
- import { State, StateStoreError } from "alchemy/State";
5
- import postgres from "postgres";
6
- import { ExtensionDescriptor } from "@prisma/composer/config";
7
-
8
- //#region ../../1-prisma-cloud/0-lowering/lowering/dist/index-KMA4UtwS.d.mts
3
+ import "effect/Context";
4
+ import "effect/Effect";
5
+ import "effect/Layer";
6
+ import "effect/Redacted";
7
+ import "effect/Config";
8
+ import "alchemy/Provider";
9
+ import { Resource } from "alchemy";
10
+ import "effect/Schedule";
11
+ import * as Output from "alchemy/Output";
12
+ import { ExtensionDescriptor, StateDescriptor } from "@prisma/composer/config";
13
+ //#region ../../1-prisma-cloud/0-lowering/lowering/dist/compute.d.mts
9
14
  /** Every region Prisma Compute serves — the runtime source of truth; `ComputeRegion` is derived from it so the two can never drift. */
10
15
  declare const COMPUTE_REGIONS: readonly ["us-east-1", "us-west-1", "eu-west-3", "eu-central-1", "ap-northeast-1", "ap-southeast-1"];
11
16
  type ComputeRegion = (typeof COMPUTE_REGIONS)[number];
12
17
  //#endregion
13
- //#region ../../1-prisma-cloud/0-lowering/lowering/dist/state/index.d.mts
14
- //#region src/state/layer.d.ts
18
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/control.d.mts
19
+ //#region src/descriptors/shared.d.ts
15
20
  /**
16
- * The hosted Alchemy state store. On layer init (scoped, once per stack
17
- * run): find-or-create the workspace's `prisma-composer-state` project, mint a
18
- * fresh connection to its default database, migrate the schema, and
19
- * acquire the (stack, stage) advisory lock see `bootstrap.ts` and
20
- * `lock.ts`. The Management API plumbing (`ManagementClient`,
21
- * `PrismaCredentials`) is provided internally, so the returned layer's
22
- * only requirements are the ones alchemy itself already provides to every
23
- * state store (`StackServices`).
21
+ * The provider-side reserved param for one brand's minted values (ADR-0031:
22
+ * "the provisioner owns mint, size, **aggregation**, stability, and
23
+ * rotation", and ADR-0019: the physical encoding is the target's). `value`
24
+ * is deploy-side: given every inbound edge's minted ref for one provider
25
+ * (possibly empty), it returns the typed value to store, or `undefined` to
26
+ * write no row. The returned value is encoded through the serializer's
27
+ * normal service-own literal path (JSON) the same path any declared param
28
+ * takes never a brand-invented wire format.
24
29
  *
25
- * Any bootstrap/lock/migration failure is wrapped into an operator-facing
26
- * `HostedStateBootstrapError` (naming the workspace and the step that
27
- * failed, never the raw driver/API error see `errors.ts`) before dying the
28
- * layer (loud, immediate, unrecoverable) rather than surfacing as a typed
29
- * error — matching core's `LowerOptions.state: Layer.Layer<State, never,
30
- * StackServices>` contract and alchemy's own convention (e.g. a missing
31
- * state store is `Effect.die` in `Stack.make`).
30
+ * This is the seam that keeps `descriptors/compute.ts` brand-blind: a
31
+ * `ProviderParam` is registered beside its brand's provisioner in
32
+ * `control.ts`; the descriptor asks every registered entry about every
33
+ * exposing service and writes whatever comes back.
34
+ */
35
+ interface ProviderParam extends ProviderParamEntry {
36
+ /**
37
+ * Every inbound edge's minted ref for this provider — POSSIBLY EMPTY. A
38
+ * provider with no wired consumers is still asked, because "no edges" and
39
+ * "no var" mean different things at boot: an absent var reads as "never
40
+ * provisioned" (local dev, tests). What an empty set means is this param's
41
+ * own call — deny everything, or emit nothing and let its reader fail closed.
42
+ */
43
+ readonly value: (refs: readonly unknown[]) => Output.Output<unknown> | unknown | undefined;
44
+ }
45
+ /**
46
+ * The slice of compute's provisioned handoff a service-derived provider param
47
+ * may read. A minimal structural type, not `ComputeProvisioned` itself:
48
+ * shared.ts sits below `descriptors/compute.ts` in the import graph, so
49
+ * naming the full type here would invert it.
32
50
  */
33
- declare const prismaState: (opts?: {
34
- /** Defaults to the PRISMA_WORKSPACE_ID environment variable. */workspaceId?: string;
35
- }) => Layer.Layer<State, never, StackServices>; //#endregion
36
- //#region src/state/schema.d.ts
51
+ interface ServiceProvisionedAttributes {
52
+ readonly endpointDomain: Output.Output<string | undefined>;
53
+ }
37
54
  /**
38
- * Idempotent schema migration for the Prisma-hosted state store safe to run
39
- * on every deploy, since `create table if not exists` no-ops once the tables
40
- * exist. Run this against `sql` before serving a {@link StateService} built
41
- * by `makePrismaStateService` over the same client.
55
+ * A reserved provider param whose value derives from the provider service's
56
+ * OWN provisioned attributes rather than its inbound edges the
57
+ * service-derived sibling of `ProviderParam` (e.g. the service's own origin).
58
+ * Asked for EVERY compute service, exposing or not: a service needs no
59
+ * consumers to have an origin, so the descriptor's expose check applies only
60
+ * to edge-derived entries. Like `ProviderParam.value`, the return is encoded
61
+ * through the serializer's normal service-own literal path (JSON) by the
62
+ * descriptor's generic loop, never here.
42
63
  */
64
+ interface ServiceProviderParam extends ProviderParamEntry {
65
+ readonly valueForService: (provisioned: ServiceProvisionedAttributes, address: string) => Output.Output<unknown> | unknown | undefined;
66
+ }
43
67
  //#endregion
44
- //#region ../../1-prisma-cloud/1-extensions/target/dist/control.d.mts
45
- //#region src/control.d.ts
68
+ //#region src/control/extension.d.ts
69
+ /** The user-facing state descriptor: `state: prismaState()` in `prisma-composer.config.ts` (ADR-0017). */
70
+ declare const prismaState: () => StateDescriptor;
46
71
  interface PrismaCloudOptions {
47
72
  /** Defaults to the PRISMA_WORKSPACE_ID environment variable. */
48
73
  workspaceId?: string;
49
74
  /** Defaults to the PRISMA_REGION environment variable when set. */
50
75
  region?: ComputeRegion;
51
76
  }
77
+ /**
78
+ * One brand's deploy-side value registration: edge-derived (`value(refs)`,
79
+ * fed by the provider's inbound edges) or service-derived
80
+ * (`valueForService(provisioned, address)`, fed by the service's own
81
+ * provisioned attributes).
82
+ */
83
+ type ProviderParamValue = Pick<ProviderParam, 'value'> | Pick<ServiceProviderParam, 'valueForService'>;
84
+ /**
85
+ * Builds the deploy-side registry from the boot-side list, keyed by brand —
86
+ * throws if a boot-side entry has no registered deploy-side value function,
87
+ * so `RESERVED_PROVIDER_PARAMS` stays the single source of which reserved
88
+ * provider params exist: deploy can no longer write a row boot never
89
+ * stashes. Exported (rather than inlined into `PROVIDER_PARAMS` below) so
90
+ * `__tests__/provider-params.test.ts` can drive it directly with a
91
+ * deliberately incomplete value map and watch it throw.
92
+ */
93
+ declare function buildProviderParams(entries: readonly ProviderParamEntry[], values: ReadonlyMap<symbol, ProviderParamValue>): ReadonlyMap<symbol, ProviderParam | ServiceProviderParam>;
94
+ declare const PROVIDER_PARAMS: ReadonlyMap<symbol, ProviderParam | ServiceProviderParam>;
52
95
  /** The Prisma Cloud extension descriptor — `prisma-composer.config.ts` lists it under `extensions`. */
53
- declare const prismaCloud: (opts?: PrismaCloudOptions) => ExtensionDescriptor; //#endregion
96
+ declare const prismaCloud: (opts?: PrismaCloudOptions) => ExtensionDescriptor;
54
97
  //#endregion
55
- export { PrismaCloudOptions, prismaCloud, prismaState };
98
+ export { PROVIDER_PARAMS, PrismaCloudOptions, ProviderParamValue, buildProviderParams, prismaCloud, prismaState };
56
99
  //# sourceMappingURL=control.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/compute.d.mts","../../../1-prisma-cloud/1-extensions/target/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;cAkDc;KACT,wBAAwB;;;;;;;;;;;;;;;;;;;UC/BnB,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"}