@alchemy.run/effect-cluster 0.0.0-stage → 2.0.0-beta.86

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 (233) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +105 -2
  3. package/lib/AWS/Database.d.ts +54 -0
  4. package/lib/AWS/Database.d.ts.map +1 -0
  5. package/lib/AWS/Database.js +96 -0
  6. package/lib/AWS/Database.js.map +1 -0
  7. package/lib/AWS/EcsPool.d.ts +56 -0
  8. package/lib/AWS/EcsPool.d.ts.map +1 -0
  9. package/lib/AWS/EcsPool.js +87 -0
  10. package/lib/AWS/EcsPool.js.map +1 -0
  11. package/lib/AWS/index.d.ts +7 -0
  12. package/lib/AWS/index.d.ts.map +1 -0
  13. package/lib/AWS/index.js +7 -0
  14. package/lib/AWS/index.js.map +1 -0
  15. package/lib/AWS/internal/Gateway.d.ts +23 -0
  16. package/lib/AWS/internal/Gateway.d.ts.map +1 -0
  17. package/lib/AWS/internal/Gateway.js +70 -0
  18. package/lib/AWS/internal/Gateway.js.map +1 -0
  19. package/lib/Cloudflare/DurableObjectPool.d.ts +42 -0
  20. package/lib/Cloudflare/DurableObjectPool.d.ts.map +1 -0
  21. package/lib/Cloudflare/DurableObjectPool.js +136 -0
  22. package/lib/Cloudflare/DurableObjectPool.js.map +1 -0
  23. package/lib/Cloudflare/PoolWorker.d.ts +186 -0
  24. package/lib/Cloudflare/PoolWorker.d.ts.map +1 -0
  25. package/lib/Cloudflare/PoolWorker.js +75 -0
  26. package/lib/Cloudflare/PoolWorker.js.map +1 -0
  27. package/lib/Cloudflare/index.d.ts +7 -0
  28. package/lib/Cloudflare/index.d.ts.map +1 -0
  29. package/lib/Cloudflare/index.js +7 -0
  30. package/lib/Cloudflare/index.js.map +1 -0
  31. package/lib/Cloudflare/internal/Objects.d.ts +38 -0
  32. package/lib/Cloudflare/internal/Objects.d.ts.map +1 -0
  33. package/lib/Cloudflare/internal/Objects.js +102 -0
  34. package/lib/Cloudflare/internal/Objects.js.map +1 -0
  35. package/lib/Cron.d.ts +143 -0
  36. package/lib/Cron.d.ts.map +1 -0
  37. package/lib/Cron.js +83 -0
  38. package/lib/Cron.js.map +1 -0
  39. package/lib/Database.d.ts +95 -0
  40. package/lib/Database.d.ts.map +1 -0
  41. package/lib/Database.js +38 -0
  42. package/lib/Database.js.map +1 -0
  43. package/lib/Docker/Database.d.ts +42 -0
  44. package/lib/Docker/Database.d.ts.map +1 -0
  45. package/lib/Docker/Database.js +53 -0
  46. package/lib/Docker/Database.js.map +1 -0
  47. package/lib/Docker/SwarmPool.d.ts +44 -0
  48. package/lib/Docker/SwarmPool.d.ts.map +1 -0
  49. package/lib/Docker/SwarmPool.js +56 -0
  50. package/lib/Docker/SwarmPool.js.map +1 -0
  51. package/lib/Docker/index.d.ts +7 -0
  52. package/lib/Docker/index.d.ts.map +1 -0
  53. package/lib/Docker/index.js +7 -0
  54. package/lib/Docker/index.js.map +1 -0
  55. package/lib/Entity.d.ts +348 -0
  56. package/lib/Entity.d.ts.map +1 -0
  57. package/lib/Entity.js +308 -0
  58. package/lib/Entity.js.map +1 -0
  59. package/lib/Fly/Database.d.ts +50 -0
  60. package/lib/Fly/Database.d.ts.map +1 -0
  61. package/lib/Fly/Database.js +56 -0
  62. package/lib/Fly/Database.js.map +1 -0
  63. package/lib/Fly/MachinePool.d.ts +39 -0
  64. package/lib/Fly/MachinePool.d.ts.map +1 -0
  65. package/lib/Fly/MachinePool.js +51 -0
  66. package/lib/Fly/MachinePool.js.map +1 -0
  67. package/lib/Fly/index.d.ts +7 -0
  68. package/lib/Fly/index.d.ts.map +1 -0
  69. package/lib/Fly/index.js +7 -0
  70. package/lib/Fly/index.js.map +1 -0
  71. package/lib/GCP/ComputeEnginePool.d.ts +41 -0
  72. package/lib/GCP/ComputeEnginePool.d.ts.map +1 -0
  73. package/lib/GCP/ComputeEnginePool.js +172 -0
  74. package/lib/GCP/ComputeEnginePool.js.map +1 -0
  75. package/lib/GCP/Database.d.ts +48 -0
  76. package/lib/GCP/Database.d.ts.map +1 -0
  77. package/lib/GCP/Database.js +115 -0
  78. package/lib/GCP/Database.js.map +1 -0
  79. package/lib/GCP/index.d.ts +7 -0
  80. package/lib/GCP/index.d.ts.map +1 -0
  81. package/lib/GCP/index.js +7 -0
  82. package/lib/GCP/index.js.map +1 -0
  83. package/lib/Hetzner/Database.d.ts +48 -0
  84. package/lib/Hetzner/Database.d.ts.map +1 -0
  85. package/lib/Hetzner/Database.js +91 -0
  86. package/lib/Hetzner/Database.js.map +1 -0
  87. package/lib/Hetzner/ServerPool.d.ts +35 -0
  88. package/lib/Hetzner/ServerPool.d.ts.map +1 -0
  89. package/lib/Hetzner/ServerPool.js +98 -0
  90. package/lib/Hetzner/ServerPool.js.map +1 -0
  91. package/lib/Hetzner/index.d.ts +7 -0
  92. package/lib/Hetzner/index.d.ts.map +1 -0
  93. package/lib/Hetzner/index.js +7 -0
  94. package/lib/Hetzner/index.js.map +1 -0
  95. package/lib/Host.d.ts +60 -0
  96. package/lib/Host.d.ts.map +1 -0
  97. package/lib/Host.js +31 -0
  98. package/lib/Host.js.map +1 -0
  99. package/lib/Kubernetes/Database.d.ts +40 -0
  100. package/lib/Kubernetes/Database.d.ts.map +1 -0
  101. package/lib/Kubernetes/Database.js +56 -0
  102. package/lib/Kubernetes/Database.js.map +1 -0
  103. package/lib/Kubernetes/DeploymentPool.d.ts +54 -0
  104. package/lib/Kubernetes/DeploymentPool.d.ts.map +1 -0
  105. package/lib/Kubernetes/DeploymentPool.js +49 -0
  106. package/lib/Kubernetes/DeploymentPool.js.map +1 -0
  107. package/lib/Kubernetes/index.d.ts +7 -0
  108. package/lib/Kubernetes/index.d.ts.map +1 -0
  109. package/lib/Kubernetes/index.js +7 -0
  110. package/lib/Kubernetes/index.js.map +1 -0
  111. package/lib/Pool.d.ts +66 -0
  112. package/lib/Pool.d.ts.map +1 -0
  113. package/lib/Pool.js +47 -0
  114. package/lib/Pool.js.map +1 -0
  115. package/lib/Providers.d.ts +19 -0
  116. package/lib/Providers.d.ts.map +1 -0
  117. package/lib/Providers.js +31 -0
  118. package/lib/Providers.js.map +1 -0
  119. package/lib/ShardGroups.d.ts +24 -0
  120. package/lib/ShardGroups.d.ts.map +1 -0
  121. package/lib/ShardGroups.js +19 -0
  122. package/lib/ShardGroups.js.map +1 -0
  123. package/lib/Singleton.d.ts +110 -0
  124. package/lib/Singleton.d.ts.map +1 -0
  125. package/lib/Singleton.js +60 -0
  126. package/lib/Singleton.js.map +1 -0
  127. package/lib/Workflow.d.ts +251 -0
  128. package/lib/Workflow.d.ts.map +1 -0
  129. package/lib/Workflow.js +288 -0
  130. package/lib/Workflow.js.map +1 -0
  131. package/lib/index.d.ts +12 -0
  132. package/lib/index.d.ts.map +1 -0
  133. package/lib/index.js +12 -0
  134. package/lib/index.js.map +1 -0
  135. package/lib/internal/Bootstrap.d.ts +28 -0
  136. package/lib/internal/Bootstrap.d.ts.map +1 -0
  137. package/lib/internal/Bootstrap.js +257 -0
  138. package/lib/internal/Bootstrap.js.map +1 -0
  139. package/lib/internal/EntityRuntime.d.ts +40 -0
  140. package/lib/internal/EntityRuntime.d.ts.map +1 -0
  141. package/lib/internal/EntityRuntime.js +698 -0
  142. package/lib/internal/EntityRuntime.js.map +1 -0
  143. package/lib/internal/Gateway.d.ts +82 -0
  144. package/lib/internal/Gateway.d.ts.map +1 -0
  145. package/lib/internal/Gateway.js +218 -0
  146. package/lib/internal/Gateway.js.map +1 -0
  147. package/lib/internal/HostedPlatform.d.ts +36 -0
  148. package/lib/internal/HostedPlatform.d.ts.map +1 -0
  149. package/lib/internal/HostedPlatform.js +36 -0
  150. package/lib/internal/HostedPlatform.js.map +1 -0
  151. package/lib/internal/HostedRuntime.d.ts +58 -0
  152. package/lib/internal/HostedRuntime.d.ts.map +1 -0
  153. package/lib/internal/HostedRuntime.js +72 -0
  154. package/lib/internal/HostedRuntime.js.map +1 -0
  155. package/lib/internal/Naming.d.ts +12 -0
  156. package/lib/internal/Naming.d.ts.map +1 -0
  157. package/lib/internal/Naming.js +40 -0
  158. package/lib/internal/Naming.js.map +1 -0
  159. package/lib/internal/ObjectSharding.d.ts +141 -0
  160. package/lib/internal/ObjectSharding.d.ts.map +1 -0
  161. package/lib/internal/ObjectSharding.js +337 -0
  162. package/lib/internal/ObjectSharding.js.map +1 -0
  163. package/lib/internal/PoolHost.d.ts +80 -0
  164. package/lib/internal/PoolHost.d.ts.map +1 -0
  165. package/lib/internal/PoolHost.js +203 -0
  166. package/lib/internal/PoolHost.js.map +1 -0
  167. package/lib/internal/PoolHostService.d.ts +25 -0
  168. package/lib/internal/PoolHostService.d.ts.map +1 -0
  169. package/lib/internal/PoolHostService.js +10 -0
  170. package/lib/internal/PoolHostService.js.map +1 -0
  171. package/lib/internal/Wire.d.ts +60 -0
  172. package/lib/internal/Wire.d.ts.map +1 -0
  173. package/lib/internal/Wire.js +36 -0
  174. package/lib/internal/Wire.js.map +1 -0
  175. package/lib/internal/WorkflowGateway.d.ts +36 -0
  176. package/lib/internal/WorkflowGateway.d.ts.map +1 -0
  177. package/lib/internal/WorkflowGateway.js +124 -0
  178. package/lib/internal/WorkflowGateway.js.map +1 -0
  179. package/lib/internal/external-runner.d.ts +2 -0
  180. package/lib/internal/external-runner.d.ts.map +1 -0
  181. package/lib/internal/external-runner.js +7 -0
  182. package/lib/internal/external-runner.js.map +1 -0
  183. package/lib/internal/runner.d.ts +2 -0
  184. package/lib/internal/runner.d.ts.map +1 -0
  185. package/lib/internal/runner.js +5 -0
  186. package/lib/internal/runner.js.map +1 -0
  187. package/package.json +143 -3
  188. package/src/AWS/Database.ts +139 -0
  189. package/src/AWS/EcsPool.ts +118 -0
  190. package/src/AWS/index.ts +6 -0
  191. package/src/AWS/internal/Gateway.ts +82 -0
  192. package/src/Cloudflare/DurableObjectPool.ts +198 -0
  193. package/src/Cloudflare/PoolWorker.ts +124 -0
  194. package/src/Cloudflare/index.ts +6 -0
  195. package/src/Cloudflare/internal/Objects.ts +160 -0
  196. package/src/Cron.ts +202 -0
  197. package/src/Database.ts +116 -0
  198. package/src/Docker/Database.ts +94 -0
  199. package/src/Docker/SwarmPool.ts +83 -0
  200. package/src/Docker/index.ts +6 -0
  201. package/src/Entity.ts +621 -0
  202. package/src/Fly/Database.ts +102 -0
  203. package/src/Fly/MachinePool.ts +72 -0
  204. package/src/Fly/index.ts +6 -0
  205. package/src/GCP/ComputeEnginePool.ts +203 -0
  206. package/src/GCP/Database.ts +168 -0
  207. package/src/GCP/index.ts +6 -0
  208. package/src/Hetzner/Database.ts +142 -0
  209. package/src/Hetzner/ServerPool.ts +116 -0
  210. package/src/Hetzner/index.ts +6 -0
  211. package/src/Host.ts +68 -0
  212. package/src/Kubernetes/Database.ts +89 -0
  213. package/src/Kubernetes/DeploymentPool.ts +77 -0
  214. package/src/Kubernetes/index.ts +6 -0
  215. package/src/Pool.ts +104 -0
  216. package/src/Providers.ts +49 -0
  217. package/src/ShardGroups.ts +41 -0
  218. package/src/Singleton.ts +153 -0
  219. package/src/Workflow.ts +556 -0
  220. package/src/index.ts +11 -0
  221. package/src/internal/Bootstrap.ts +368 -0
  222. package/src/internal/EntityRuntime.ts +996 -0
  223. package/src/internal/Gateway.ts +366 -0
  224. package/src/internal/HostedPlatform.ts +83 -0
  225. package/src/internal/HostedRuntime.ts +118 -0
  226. package/src/internal/Naming.ts +44 -0
  227. package/src/internal/ObjectSharding.ts +578 -0
  228. package/src/internal/PoolHost.ts +330 -0
  229. package/src/internal/PoolHostService.ts +25 -0
  230. package/src/internal/Wire.ts +83 -0
  231. package/src/internal/WorkflowGateway.ts +188 -0
  232. package/src/internal/external-runner.ts +10 -0
  233. package/src/internal/runner.ts +5 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwarmPool.d.ts","sources":["../../src/Docker/SwarmPool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,SAAS,OAChB,MAAM,YACD,gBAAgB,KACxB,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,SAAS,CAgC3E,CAAC"}
@@ -0,0 +1,56 @@
1
+ import * as Docker from "@alchemy.run/docker";
2
+ import * as Output from "alchemy/Output";
3
+ import * as Effect from "effect/Effect";
4
+ import { GATEWAY_PORT } from "../internal/Gateway.js";
5
+ import { makePoolLayer } from "../internal/PoolHost.js";
6
+ /**
7
+ * Run a pool of Effect Cluster runners on a Docker swarm: a swarm service whose
8
+ * tasks host every `Cluster.Entity` given this pool, on the
9
+ * database's overlay network. Runners find each other through the
10
+ * database and talk on the network; the gateway is served on the same
11
+ * network. Requires an `Cluster.Database` on a Docker network —
12
+ * `ClusterDocker.Database`.
13
+ *
14
+ * Every entity given the same pool shares it: declare the pool once
15
+ * and provide them to each class.
16
+ *
17
+ * ### Running entities on Docker
18
+ * **Example:** Two runners on the local swarm
19
+ * ```typescript
20
+ * export const Database = ClusterDocker.Database("Cluster");
21
+ * export const Default = ClusterDocker.SwarmPool("Default", { replicas: 2 }).pipe(
22
+ * Layer.provide(Database),
23
+ * );
24
+ * ```
25
+ *
26
+ * @primitive
27
+ */
28
+ export const SwarmPool = (id, options = {}) => makePoolLayer({
29
+ label: "ClusterDocker.SwarmPool",
30
+ id,
31
+ settings: options,
32
+ expected: "a Docker network (ClusterDocker.Database)",
33
+ network: (database) => (database.network?.kind === "docker" ? database.network : undefined),
34
+ // Callers on the swarm reach the gateway by the service's name.
35
+ gateway: (name) => Effect.succeed({ url: `http://${name}:${GATEWAY_PORT}` }),
36
+ nodes: ({ network, name, program, environment }) => Effect.gen(function* () {
37
+ // Tagged with the program's hash, so a changed program is a new image.
38
+ const image = yield* Docker.Image(`${id}RunnerImage`, {
39
+ build: { context: program.pipe(Output.map((p) => p.dir)) },
40
+ tag: program.pipe(Output.map((p) => p.hash)),
41
+ skipPush: true,
42
+ });
43
+ yield* Docker.Service(`${id}Pool`, {
44
+ name,
45
+ image: image.imageRef,
46
+ replicas: options.replicas ?? 1,
47
+ networks: [{ name: network.name }],
48
+ ports: options.gatewayPort === undefined
49
+ ? []
50
+ : [{ external: options.gatewayPort, internal: GATEWAY_PORT }],
51
+ // Each runner finds its own address among the service's tasks.
52
+ environment: environment.pipe(Output.map((env) => ({ ...env, CLUSTER_PEERS: `tasks.${name}` }))),
53
+ });
54
+ }),
55
+ });
56
+ //# sourceMappingURL=SwarmPool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwarmPool.js","sources":["../../src/Docker/SwarmPool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAqB,MAAM,yBAAyB,CAAC;AAkB3E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,SAAS,GAA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,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;YAClC,KAAK,EACH,OAAO,CAAC,WAAW,KAAK,SAAS;gBAC/B,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;YACjE,+DAA+D;YAC/D,WAAW,EAAE,WAAW,CAAC,IAAI,CAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,aAAa,EAAE,SAAS,IAAI,EAAE,EAAE,CAAC,CAAC,CAC7B;SACvC,CAAC,CAAC;IACL,CAAC,CAAC;CACL,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @alchemy.run/effect-cluster/Docker — run an Effect Cluster's database and
3
+ * runners on a Docker swarm. Requires `@alchemy.run/docker`.
4
+ */
5
+ export * from "./Database.ts";
6
+ export * from "./SwarmPool.ts";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../../src/Docker/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @alchemy.run/effect-cluster/Docker — run an Effect Cluster's database and
3
+ * runners on a Docker swarm. Requires `@alchemy.run/docker`.
4
+ */
5
+ export * from "./Database.js";
6
+ export * from "./SwarmPool.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/Docker/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,348 @@
1
+ import type { InputProps } from "alchemy/Input";
2
+ import type { Named } from "alchemy/Named";
3
+ import { Platform, type PlatformIdentity, type PlatformProps, type PlatformServices } from "alchemy/Platform";
4
+ import * as Provider from "alchemy/Provider";
5
+ import type { Resource } from "alchemy/Resource";
6
+ import { RuntimeContext } from "alchemy/RuntimeContext";
7
+ import type { Self } from "alchemy/Self";
8
+ import { Entity as EffectEntity } from "effect/cluster";
9
+ import type { AlreadyProcessingMessage, EntityNotAssignedToRunner, MailboxFull, PersistenceError } from "effect/cluster/ClusterError";
10
+ import type * as ConfigError from "effect/Config";
11
+ import type * as Context from "effect/Context";
12
+ import type * as Duration from "effect/Duration";
13
+ import * as Effect from "effect/Effect";
14
+ import * as Layer from "effect/Layer";
15
+ import * as Redacted from "effect/Redacted";
16
+ import type { Rpc, RpcClient, RpcClientError, RpcGroup } from "effect/rpc";
17
+ import type { Scope } from "effect/Scope";
18
+ import { type HostedRuntimeContext } from "./internal/HostedRuntime.ts";
19
+ import { PoolHost } from "./internal/PoolHostService.ts";
20
+ import type { Providers } from "./Providers.ts";
21
+ export declare const EntityTypeId = "Cluster.Entity";
22
+ export type EntityTypeId = typeof EntityTypeId;
23
+ export interface EntityProps extends PlatformProps {
24
+ /**
25
+ * The module that exports this entity: the class, or the Layer its
26
+ * `.make(...)` returned. Usually `import.meta.url`.
27
+ */
28
+ main: string;
29
+ /**
30
+ * The export of {@link main} that holds this entity.
31
+ * @default "default"
32
+ */
33
+ handler?: string;
34
+ /**
35
+ * How long an instance may sit idle before the runner stops it. Its next
36
+ * message starts it again.
37
+ * @default the runner's default (1 minute)
38
+ */
39
+ maxIdleTime?: Duration.Input;
40
+ /**
41
+ * How many of an instance's messages run at once. A handler that returns
42
+ * `Rpc.fork(...)` runs outside this limit.
43
+ * @default 1
44
+ */
45
+ concurrency?: number | "unbounded";
46
+ /**
47
+ * How many messages an instance may hold, running or waiting to run.
48
+ * Past that, a message fails with `MailboxFull`, unless it is persisted:
49
+ * a persisted message is stored and runs once there is room.
50
+ * @default 4096
51
+ */
52
+ mailboxCapacity?: number | "unbounded";
53
+ /**
54
+ * Return a handler's defect to its caller instead of restarting the
55
+ * instance. By default, as on Effect Cluster's runners, a defect rebuilds
56
+ * the instance and runs its messages again, backing off between restarts.
57
+ * @default false
58
+ */
59
+ disableFatalDefects?: boolean;
60
+ }
61
+ export interface EntityAttributes {
62
+ /** The entity type: the class's logical id. */
63
+ type: string;
64
+ /** The shard group of the pool that hosts it. */
65
+ pool: string | undefined;
66
+ /** The gateway URL callers send requests to. */
67
+ gateway: string | undefined;
68
+ /** The token callers present to the gateway. */
69
+ token: Redacted.Redacted<string> | undefined;
70
+ }
71
+ /** Data a pool Layer binds onto the entities it hosts. */
72
+ export interface EntityBindingContract {
73
+ pool?: string;
74
+ gateway?: string;
75
+ token?: Redacted.Redacted<string>;
76
+ }
77
+ export interface Entity extends Resource<EntityTypeId, EntityProps, EntityAttributes, EntityBindingContract, Providers> {
78
+ }
79
+ /** The errors a call through the gateway can fail with, beyond the RPC's own. */
80
+ export type GatewayError = RpcClientError.RpcClientError | MailboxFull | AlreadyProcessingMessage | PersistenceError | EntityNotAssignedToRunner;
81
+ /**
82
+ * Every instance of one entity type. `getByName(entityId)` returns a client
83
+ * with the same shape as Effect Cluster's `Entity.client(entityId)`; its
84
+ * calls take Effect's client options (`discard`, `headers`).
85
+ */
86
+ export interface EntityNamespace<Rpcs extends Rpc.Any> {
87
+ readonly getByName: (entityId: string) => Effect.Effect<RpcClient.RpcClient.From<Rpcs, GatewayError>, never, Rpc.MiddlewareClient<Rpcs>>;
88
+ }
89
+ /** What an instance's constructor runs with: once per instance. */
90
+ export type InstanceServices = RuntimeContext | Scope | EffectEntity.CurrentAddress | EffectEntity.CurrentRunnerAddress;
91
+ /** Services the Construction phase may use without the caller providing them. */
92
+ export type EntityServices = Entity | Providers | RuntimeContext | Self | Self<Entity>;
93
+ type ClassRequirements<Req> = Providers | Exclude<Req, EntityServices | PlatformServices>;
94
+ /**
95
+ * An entity's implementation. The outer Effect runs once per runner and
96
+ * resolves bindings; the inner one runs once per instance and returns the
97
+ * instance's handlers as an object, one per RPC in the schema.
98
+ */
99
+ export type EntityImpl<Rpcs extends Rpc.Any, InitReq> = Effect.Effect<Effect.Effect<EffectEntity.HandlersFrom<Rpcs>, never, InstanceServices>, ConfigError.ConfigError, InitReq>;
100
+ /**
101
+ * A declared entity: the tag callers `yield*`, carrying Effect Cluster's
102
+ * entity surface (`.of`, `.protocol`, `.entity`), implemented by
103
+ * `.make(props, impl)`.
104
+ */
105
+ export type EntityTag<Self, Type extends string, Rpcs extends Rpc.Any> = Effect.Effect<EntityNamespace<Rpcs>, never, Providers> & Named<Type> & PlatformIdentity<Type> & {
106
+ /**
107
+ * The Effect Cluster entity behind the class, for Effect Cluster's own
108
+ * APIs: `Counter.entity.client` inside runners, `EntityProxy`,
109
+ * `Entity.makeTestClient`.
110
+ */
111
+ readonly entity: EffectEntity.Entity<Type, Rpcs>;
112
+ /** The entity's RPCs, as an `RpcGroup`. */
113
+ readonly protocol: RpcGroup.RpcGroup<Rpcs>;
114
+ /** Type an instance's handlers against the entity's RPCs, as Effect Cluster's `Entity.of`. */
115
+ of<Handlers extends EffectEntity.HandlersFrom<Rpcs>>(handlers: Handlers): Handlers;
116
+ /**
117
+ * The entity's implementation, as a Layer. Provide a pool Layer to
118
+ * `impl` to deploy it, with its RPCs' middleware provided to the pool;
119
+ * then provide the returned Layer to the Stack.
120
+ */
121
+ make<InitReq = never>(props: InputProps<EntityProps>, impl: EntityImpl<Rpcs, InitReq>): Layer.Layer<Self, never, ClassRequirements<InitReq>>;
122
+ new (_: never): EntityNamespace<Rpcs>;
123
+ };
124
+ /**
125
+ * An entity declared with its implementation: the class callers `yield*`,
126
+ * which also deploys it.
127
+ */
128
+ export type EntityInline<Type extends string, Rpcs extends Rpc.Any, Req> = Effect.Effect<EntityNamespace<Rpcs>, never, Req> & Named<Type> & PlatformIdentity<Type> & {
129
+ /** The Effect Cluster entity behind the class, for Effect Cluster's own APIs. */
130
+ readonly entity: EffectEntity.Entity<Type, Rpcs>;
131
+ /** The entity's RPCs, as an `RpcGroup`. */
132
+ readonly protocol: RpcGroup.RpcGroup<Rpcs>;
133
+ /** Type an instance's handlers against the entity's RPCs, as Effect Cluster's `Entity.of`. */
134
+ of<Handlers extends EffectEntity.HandlersFrom<Rpcs>>(handlers: Handlers): Handlers;
135
+ new (_: never): EntityNamespace<Rpcs>;
136
+ };
137
+ /** Props of an external entity: an existing Effect Cluster program, run as it is. */
138
+ export interface ExternalEntityProps {
139
+ /**
140
+ * The module that exports the Effect Cluster entity, under its type's
141
+ * name, relative to where the deploy runs. The gateway imports it to
142
+ * serve the entity's RPCs.
143
+ */
144
+ main: string;
145
+ /**
146
+ * Your existing Effect Cluster program, relative to where the deploy
147
+ * runs: one that launches its entities on `NodeClusterHttp` with HTTP
148
+ * transport and SQL storage. It is bundled into the pool and run as
149
+ * its own process on every runner, with `HOST`, `PORT` and `DATABASE_URL` set.
150
+ */
151
+ program: string;
152
+ }
153
+ /** The class surface of {@link Entity}. */
154
+ export interface EntityClass {
155
+ /**
156
+ * An external entity: an existing Effect Cluster program, run as it is.
157
+ * Provide a pool Layer to deploy it.
158
+ */
159
+ <const Type extends string, Rpcs extends Rpc.Any>(entity: EffectEntity.Entity<Type, Rpcs>, props: ExternalEntityProps): Effect.Effect<EntityNamespace<Rpcs>, never, PoolHost | Providers> & {
160
+ readonly entity: EffectEntity.Entity<Type, Rpcs>;
161
+ };
162
+ <Self>(): {
163
+ /**
164
+ * Declared from an Effect Cluster entity, with its implementation, which
165
+ * types its handlers with the entity's `.of`. Provide a pool Layer to
166
+ * `impl` to deploy it, with its RPCs' middleware provided to the pool.
167
+ */
168
+ <const Type extends string, Rpcs extends Rpc.Any, InitReq = never>(entity: EffectEntity.Entity<Type, Rpcs>, props: InputProps<EntityProps>, impl: EntityImpl<Rpcs, InitReq>): EntityInline<Type, Rpcs, ClassRequirements<InitReq>>;
169
+ /** Declared from its RPCs, as Effect Cluster's `Entity.make`. */
170
+ <const Type extends string, const Rpcs extends ReadonlyArray<Rpc.Any>>(type: Type, rpcs: Rpcs): EntityTag<Self, Type, Rpcs[number]>;
171
+ /** Declared from an existing Effect Cluster entity. */
172
+ <const Type extends string, Rpcs extends Rpc.Any>(entity: EffectEntity.Entity<Type, Rpcs>): EntityTag<Self, Type, Rpcs>;
173
+ };
174
+ }
175
+ declare const EntityCalledOutsideRuntime_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
176
+ readonly _tag: "Cluster.EntityCalledOutsideRuntime";
177
+ } & Readonly<A>;
178
+ /** A class yielded outside any runtime was called. */
179
+ export declare class EntityCalledOutsideRuntime extends EntityCalledOutsideRuntime_base<{
180
+ readonly message: string;
181
+ }> {
182
+ }
183
+ /**
184
+ * An entity class as a runner runs it: the Effect entity, the instance
185
+ * constructor its Construction phase returned, and the services that phase
186
+ * ran with.
187
+ * @internal
188
+ */
189
+ export interface HostedEntity {
190
+ readonly kind: "entity";
191
+ readonly entity: EffectEntity.Entity<string, Rpc.Any>;
192
+ readonly instance: Effect.Effect<Record<string, unknown>, never, any>;
193
+ readonly context: Context.Context<never>;
194
+ readonly options: Pick<EntityProps, "maxIdleTime" | "concurrency" | "mailboxCapacity" | "disableFatalDefects">;
195
+ }
196
+ export type EntityRuntimeContext = HostedRuntimeContext<HostedEntity>;
197
+ declare const EntityMiddlewareMissing_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
198
+ readonly _tag: "Cluster.EntityMiddlewareMissing";
199
+ } & Readonly<A>;
200
+ /** An entity's RPC uses middleware nothing provided to its pool. */
201
+ export declare class EntityMiddlewareMissing extends EntityMiddlewareMissing_base<{
202
+ readonly message: string;
203
+ }> {
204
+ }
205
+ type EntityPlatform = Platform<Entity, EntityServices, unknown, EntityRuntimeContext>;
206
+ /** The resource type behind every class, which the providers register. @internal */
207
+ export declare const EntityResource: EntityPlatform;
208
+ /** The Platform declaration behind a class, which a runner builds. @internal */
209
+ export declare const PlatformDeclaration: unique symbol;
210
+ /** The Effect entity a class hosts, which a runner reads. @internal */
211
+ export declare const EntityDefinition: unique symbol;
212
+ /**
213
+ * An **Entity** in an Effect Cluster: a stateful, addressable instance per
214
+ * entity id, whose messages are typed by its RPCs. Runners place each
215
+ * instance on one runner and deliver its messages one at a time.
216
+ *
217
+ * Declare it from an Effect Cluster entity with its implementation, and
218
+ * the class is both what callers `yield*` and what deploys it. Or declare
219
+ * it bare, like Effect Cluster's `Entity.make`, from a type and its RPCs,
220
+ * and implement it with `.make(props, impl)`, as a Layer: callers import
221
+ * the bare declaration without bundling the implementation or its pool.
222
+ *
223
+ * The implementation has two phases. The outer Effect runs once per runner
224
+ * and resolves bindings. The inner Effect runs once per instance, on its
225
+ * first message, and returns its handlers, typed by the entity's `.of`. Providing a
226
+ * pool Layer to the implementation, such as
227
+ * `ClusterDocker.SwarmPool("Default")`, is what deploys it.
228
+ *
229
+ * `yield* Counter` from any runtime returns the entity's namespace, like a
230
+ * Durable Object's: `getByName(entityId)` returns a client with the same
231
+ * shape as Effect Cluster's `Entity.client(entityId)`. Inside the cluster,
232
+ * calls go through Effect Cluster directly; elsewhere they go through the
233
+ * pool's gateway over HTTP, so callers need no database access and no
234
+ * route to the pool.
235
+ *
236
+ * ### Declaring an entity
237
+ * **Example:** A counter, with its implementation
238
+ * ```typescript
239
+ * // src/Counter.ts
240
+ * const Counters = Entity.make("Counter", [
241
+ * Rpc.make("Increment", { payload: { amount: Schema.Int }, success: Schema.Int }),
242
+ * ]);
243
+ *
244
+ * export default class Counter extends Cluster.Entity<Counter>()(
245
+ * Counters,
246
+ * { main: import.meta.url },
247
+ * Effect.gen(function* () {
248
+ * return Effect.gen(function* () {
249
+ * const count = yield* Ref.make(0);
250
+ * return Counters.of({
251
+ * Increment: ({ payload }) => Ref.updateAndGet(count, (n) => n + payload.amount),
252
+ * });
253
+ * });
254
+ * }).pipe(Effect.provide(Default)),
255
+ * ) {}
256
+ * ```
257
+ *
258
+ * ### Keeping its code out of its callers
259
+ * **Example:** A bare declaration, which callers import
260
+ * ```typescript
261
+ * // src/Counter.ts
262
+ * export const Increment = Rpc.make("Increment", {
263
+ * payload: { amount: Schema.Int },
264
+ * success: Schema.Int,
265
+ * });
266
+ *
267
+ * export class Counter extends Cluster.Entity<Counter>()("Counter", [Increment]) {}
268
+ * ```
269
+ *
270
+ * **Example:** An existing Effect Cluster entity
271
+ * ```typescript
272
+ * import { Counter as CounterEntity } from "./entities/counter.ts";
273
+ *
274
+ * export class Counter extends Cluster.Entity<Counter>()(CounterEntity) {}
275
+ * ```
276
+ *
277
+ * **Example:** Its implementation, as a Layer, deployed to a pool
278
+ * ```typescript
279
+ * // src/CounterLive.ts
280
+ * export default Counter.make(
281
+ * { main: import.meta.url },
282
+ * Effect.gen(function* () {
283
+ * return Effect.gen(function* () {
284
+ * const count = yield* Ref.make(0);
285
+ * return Counter.of({
286
+ * Increment: ({ payload }) => Ref.updateAndGet(count, (n) => n + payload.amount),
287
+ * });
288
+ * });
289
+ * }).pipe(Effect.provide(Default)),
290
+ * );
291
+ * ```
292
+ *
293
+ * **Example:** Middleware, provided with the pool
294
+ * ```typescript
295
+ * export const Increment = Rpc.make("Increment", {
296
+ * payload: { amount: Schema.Int },
297
+ * success: Schema.Int,
298
+ * }).middleware(Auth);
299
+ *
300
+ * export default Counter.make(
301
+ * { main: import.meta.url },
302
+ * Effect.gen(function* () {
303
+ * return Effect.gen(function* () {
304
+ * return Counter.of({
305
+ * Increment: () => Effect.map(CurrentUser, (user) => user.id.length),
306
+ * });
307
+ * });
308
+ * }).pipe(Effect.provide(Default.pipe(Layer.provide(AuthLive)))),
309
+ * );
310
+ * ```
311
+ *
312
+ * **Example:** An existing Effect Cluster program, run as it is
313
+ * ```typescript
314
+ * import { Tally as TallyEntity } from "./entities/tally.ts";
315
+ *
316
+ * export const Tally = Cluster.Entity(TallyEntity, {
317
+ * main: "./entities/tally.ts",
318
+ * program: "./runner.ts",
319
+ * }).pipe(Effect.provide(Legacy));
320
+ * ```
321
+ *
322
+ * ### Calling an entity
323
+ * **Example:** From any runtime
324
+ * ```typescript
325
+ * const counters = yield* Counter;
326
+ * const counter = yield* counters.getByName("visits");
327
+ * const count = yield* counter.Increment({ amount: 1 });
328
+ * ```
329
+ *
330
+ * **Example:** Without waiting for the reply
331
+ * ```typescript
332
+ * yield* counter.Increment({ amount: 1 }, { discard: true });
333
+ * ```
334
+ *
335
+ * **Example:** Through client middleware
336
+ * ```typescript
337
+ * const counter = yield* counters.getByName("visits");
338
+ * yield* counter.Increment({ amount: 1 }).pipe(Effect.provide(AuthClient));
339
+ * ```
340
+ *
341
+ * @resource
342
+ */
343
+ export declare const Entity: EntityClass;
344
+ /** The environment key holding the shard group an entity's pool serves. @internal */
345
+ export declare const shardGroupKey: (type: string) => string;
346
+ export declare const EntityProvider: () => Layer.Layer<Provider.Provider<Entity>, never, never>;
347
+ export type { RpcGroup };
348
+ //# sourceMappingURL=Entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Entity.d.ts","sources":["../src/Entity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EACL,QAAQ,EACR,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAe,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAiB,MAAM,IAAI,YAAY,EAAE,MAAM,gBAAgB,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