@rikalabs/akter 0.1.0-alpha.0
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/CHANGELOG.md +15 -0
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +116 -0
- package/dist/actor/codecs.d.ts +77 -0
- package/dist/actor/codecs.js +87 -0
- package/dist/actor/connections.d.ts +34 -0
- package/dist/actor/connections.js +145 -0
- package/dist/actor/definition.d.ts +893 -0
- package/dist/actor/definition.js +147 -0
- package/dist/actor/descriptor.d.ts +172 -0
- package/dist/actor/descriptor.js +367 -0
- package/dist/actor/handles.d.ts +77 -0
- package/dist/actor/handles.js +265 -0
- package/dist/actor/jobs.d.ts +10 -0
- package/dist/actor/jobs.js +137 -0
- package/dist/actor/layers.d.ts +41 -0
- package/dist/actor/layers.js +177 -0
- package/dist/actor/reads.d.ts +47 -0
- package/dist/actor/reads.js +224 -0
- package/dist/actor/served.d.ts +120 -0
- package/dist/actor/served.js +72 -0
- package/dist/actor/turns.d.ts +13 -0
- package/dist/actor/turns.js +332 -0
- package/dist/actor/workflows.d.ts +16 -0
- package/dist/actor/workflows.js +37 -0
- package/dist/client/calls.d.ts +47 -0
- package/dist/client/calls.js +425 -0
- package/dist/client/clock.d.ts +56 -0
- package/dist/client/clock.js +119 -0
- package/dist/client/fleet-page.d.ts +15 -0
- package/dist/client/fleet-page.js +13 -0
- package/dist/client/fleet.d.ts +29 -0
- package/dist/client/fleet.js +51 -0
- package/dist/client/index.d.ts +17 -0
- package/dist/client/index.js +6 -0
- package/dist/client/make.d.ts +157 -0
- package/dist/client/make.js +221 -0
- package/dist/client/offline/queue.d.ts +118 -0
- package/dist/client/offline/queue.js +292 -0
- package/dist/client/offline/store.d.ts +74 -0
- package/dist/client/offline/store.js +78 -0
- package/dist/client/optimistic.d.ts +57 -0
- package/dist/client/optimistic.js +136 -0
- package/dist/client/report.d.ts +2 -0
- package/dist/client/report.js +8 -0
- package/dist/client/sessions/connection.d.ts +118 -0
- package/dist/client/sessions/connection.js +162 -0
- package/dist/client/sessions/feed.d.ts +42 -0
- package/dist/client/sessions/feed.js +43 -0
- package/dist/client/sessions/sse.d.ts +47 -0
- package/dist/client/sessions/sse.js +112 -0
- package/dist/client/sessions/stream.d.ts +28 -0
- package/dist/client/sessions/stream.js +35 -0
- package/dist/client/sessions/watch.d.ts +34 -0
- package/dist/client/sessions/watch.js +40 -0
- package/dist/client/transport.d.ts +37 -0
- package/dist/client/transport.js +66 -0
- package/dist/contexts/command.d.ts +132 -0
- package/dist/contexts/command.js +20 -0
- package/dist/contexts/connection.d.ts +68 -0
- package/dist/contexts/connection.js +0 -0
- package/dist/contexts/job.d.ts +49 -0
- package/dist/contexts/job.js +0 -0
- package/dist/contexts/workflow.d.ts +147 -0
- package/dist/contexts/workflow.js +22 -0
- package/dist/errors/actor.d.ts +200 -0
- package/dist/errors/actor.js +271 -0
- package/dist/errors/content.d.ts +19 -0
- package/dist/errors/content.js +14 -0
- package/dist/errors/database.d.ts +22 -0
- package/dist/errors/database.js +23 -0
- package/dist/errors/events.d.ts +17 -0
- package/dist/errors/events.js +14 -0
- package/dist/errors/subscription.d.ts +12 -0
- package/dist/errors/subscription.js +8 -0
- package/dist/errors/workflow.d.ts +28 -0
- package/dist/errors/workflow.js +17 -0
- package/dist/handles/actors.d.ts +17 -0
- package/dist/handles/actors.js +7 -0
- package/dist/handles/content.d.ts +59 -0
- package/dist/handles/content.js +36 -0
- package/dist/handles/intents.d.ts +164 -0
- package/dist/handles/intents.js +214 -0
- package/dist/handles/run.d.ts +31 -0
- package/dist/handles/run.js +21 -0
- package/dist/handles/workflow.d.ts +27 -0
- package/dist/handles/workflow.js +23 -0
- package/dist/identity/caller.d.ts +105 -0
- package/dist/identity/caller.js +68 -0
- package/dist/identity/child.d.ts +18 -0
- package/dist/identity/child.js +39 -0
- package/dist/identity/command.d.ts +19 -0
- package/dist/identity/command.js +21 -0
- package/dist/identity/connection.d.ts +24 -0
- package/dist/identity/connection.js +29 -0
- package/dist/identity/content.d.ts +18 -0
- package/dist/identity/content.js +12 -0
- package/dist/identity/digest.d.ts +4 -0
- package/dist/identity/digest.js +5 -0
- package/dist/identity/execution.d.ts +32 -0
- package/dist/identity/execution.js +63 -0
- package/dist/identity/mint.d.ts +51 -0
- package/dist/identity/mint.js +76 -0
- package/dist/identity/version.d.ts +2 -0
- package/dist/identity/version.js +3 -0
- package/dist/index.d.ts +159 -0
- package/dist/index.js +97 -0
- package/dist/members/blob.d.ts +43 -0
- package/dist/members/blob.js +29 -0
- package/dist/members/command.d.ts +109 -0
- package/dist/members/command.js +61 -0
- package/dist/members/connection.d.ts +55 -0
- package/dist/members/connection.js +49 -0
- package/dist/members/event.d.ts +36 -0
- package/dist/members/event.js +24 -0
- package/dist/members/job.d.ts +157 -0
- package/dist/members/job.js +67 -0
- package/dist/members/payload.d.ts +93 -0
- package/dist/members/payload.js +145 -0
- package/dist/members/reducer.d.ts +64 -0
- package/dist/members/reducer.js +27 -0
- package/dist/members/stream.d.ts +36 -0
- package/dist/members/stream.js +14 -0
- package/dist/members/subscription.d.ts +182 -0
- package/dist/members/subscription.js +91 -0
- package/dist/members/workflow.d.ts +99 -0
- package/dist/members/workflow.js +2 -0
- package/dist/policies/access.d.ts +35 -0
- package/dist/policies/access.js +6 -0
- package/dist/policies/command.d.ts +127 -0
- package/dist/policies/command.js +45 -0
- package/dist/policies/job.d.ts +28 -0
- package/dist/policies/job.js +60 -0
- package/dist/policies/schedules.d.ts +33 -0
- package/dist/policies/schedules.js +131 -0
- package/dist/protocol/frames.d.ts +66 -0
- package/dist/protocol/frames.js +55 -0
- package/dist/protocol/inspection.d.ts +807 -0
- package/dist/protocol/inspection.js +243 -0
- package/dist/protocol/wire.d.ts +184 -0
- package/dist/protocol/wire.js +150 -0
- package/dist/runtime/actors.d.ts +155 -0
- package/dist/runtime/actors.js +4 -0
- package/dist/runtime/admission.d.ts +34 -0
- package/dist/runtime/admission.js +72 -0
- package/dist/runtime/adoption/backfill.d.ts +27 -0
- package/dist/runtime/adoption/backfill.js +144 -0
- package/dist/runtime/adoption/enforce.d.ts +55 -0
- package/dist/runtime/adoption/enforce.js +241 -0
- package/dist/runtime/adoption/observe.d.ts +43 -0
- package/dist/runtime/adoption/observe.js +139 -0
- package/dist/runtime/adoption/plan.d.ts +45 -0
- package/dist/runtime/adoption/plan.js +192 -0
- package/dist/runtime/adoption/startup.d.ts +32 -0
- package/dist/runtime/adoption/startup.js +76 -0
- package/dist/runtime/adoption/status.d.ts +23 -0
- package/dist/runtime/adoption/status.js +47 -0
- package/dist/runtime/adoption/target.d.ts +33 -0
- package/dist/runtime/adoption/target.js +49 -0
- package/dist/runtime/connections/holder.d.ts +221 -0
- package/dist/runtime/connections/holder.js +816 -0
- package/dist/runtime/connections/owner.d.ts +263 -0
- package/dist/runtime/connections/owner.js +896 -0
- package/dist/runtime/connections/protocol.d.ts +441 -0
- package/dist/runtime/connections/protocol.js +222 -0
- package/dist/runtime/connections/reads.d.ts +24 -0
- package/dist/runtime/connections/reads.js +19 -0
- package/dist/runtime/connections/streams.d.ts +62 -0
- package/dist/runtime/connections/streams.js +128 -0
- package/dist/runtime/connections/transport.d.ts +40 -0
- package/dist/runtime/connections/transport.js +68 -0
- package/dist/runtime/connections/watch.d.ts +52 -0
- package/dist/runtime/connections/watch.js +159 -0
- package/dist/runtime/content/grant.d.ts +34 -0
- package/dist/runtime/content/grant.js +58 -0
- package/dist/runtime/content/store.d.ts +63 -0
- package/dist/runtime/content/store.js +294 -0
- package/dist/runtime/cron/key.d.ts +2 -0
- package/dist/runtime/cron/key.js +2 -0
- package/dist/runtime/cron/schedule.d.ts +69 -0
- package/dist/runtime/cron/schedule.js +144 -0
- package/dist/runtime/database/bounded.d.ts +43 -0
- package/dist/runtime/database/bounded.js +108 -0
- package/dist/runtime/database/connection.d.ts +8 -0
- package/dist/runtime/database/connection.js +18 -0
- package/dist/runtime/database/coordination.d.ts +19 -0
- package/dist/runtime/database/coordination.js +72 -0
- package/dist/runtime/database/flock.d.ts +10 -0
- package/dist/runtime/database/flock.js +60 -0
- package/dist/runtime/database/gate.d.ts +26 -0
- package/dist/runtime/database/gate.js +54 -0
- package/dist/runtime/database/keepalive.d.ts +11 -0
- package/dist/runtime/database/keepalive.js +22 -0
- package/dist/runtime/database/migrations.d.ts +177 -0
- package/dist/runtime/database/migrations.js +1018 -0
- package/dist/runtime/database/neki/migrations.d.ts +31 -0
- package/dist/runtime/database/neki/migrations.js +276 -0
- package/dist/runtime/database/neki/session.d.ts +23 -0
- package/dist/runtime/database/neki/session.js +31 -0
- package/dist/runtime/database/pglite.d.ts +21 -0
- package/dist/runtime/database/pglite.js +74 -0
- package/dist/runtime/database/replica.d.ts +41 -0
- package/dist/runtime/database/replica.js +51 -0
- package/dist/runtime/database/shards.d.ts +21 -0
- package/dist/runtime/database/shards.js +37 -0
- package/dist/runtime/database/snapshot.d.ts +7 -0
- package/dist/runtime/database/snapshot.js +7 -0
- package/dist/runtime/database/tenancy.d.ts +69 -0
- package/dist/runtime/database/tenancy.js +145 -0
- package/dist/runtime/database/transient.d.ts +10 -0
- package/dist/runtime/database/transient.js +25 -0
- package/dist/runtime/drain.d.ts +132 -0
- package/dist/runtime/drain.js +109 -0
- package/dist/runtime/entity/mailbox.d.ts +86 -0
- package/dist/runtime/entity/mailbox.js +121 -0
- package/dist/runtime/entity/register.d.ts +424 -0
- package/dist/runtime/entity/register.js +669 -0
- package/dist/runtime/events/append.d.ts +192 -0
- package/dist/runtime/events/append.js +128 -0
- package/dist/runtime/events/cursor.d.ts +2 -0
- package/dist/runtime/events/cursor.js +5 -0
- package/dist/runtime/events/replay.d.ts +20 -0
- package/dist/runtime/events/replay.js +45 -0
- package/dist/runtime/feeds.d.ts +26 -0
- package/dist/runtime/feeds.js +100 -0
- package/dist/runtime/fleet/checks.d.ts +17 -0
- package/dist/runtime/fleet/checks.js +106 -0
- package/dist/runtime/fleet/maintainer.d.ts +38 -0
- package/dist/runtime/fleet/maintainer.js +383 -0
- package/dist/runtime/fleet/pgoutput.d.ts +41 -0
- package/dist/runtime/fleet/pgoutput.js +102 -0
- package/dist/runtime/fleet/setup.d.ts +36 -0
- package/dist/runtime/fleet/setup.js +58 -0
- package/dist/runtime/fleet/subscribe.d.ts +42 -0
- package/dist/runtime/fleet/subscribe.js +147 -0
- package/dist/runtime/index.d.ts +66 -0
- package/dist/runtime/index.js +37 -0
- package/dist/runtime/inspector/http.d.ts +19 -0
- package/dist/runtime/inspector/http.js +36 -0
- package/dist/runtime/inspector/layer.d.ts +46 -0
- package/dist/runtime/inspector/layer.js +180 -0
- package/dist/runtime/inspector/queries.d.ts +711 -0
- package/dist/runtime/inspector/queries.js +494 -0
- package/dist/runtime/jobs/attempt.d.ts +254 -0
- package/dist/runtime/jobs/attempt.js +413 -0
- package/dist/runtime/jobs/isolation.d.ts +20 -0
- package/dist/runtime/jobs/isolation.js +10 -0
- package/dist/runtime/jobs/progress.d.ts +95 -0
- package/dist/runtime/jobs/progress.js +144 -0
- package/dist/runtime/layer.d.ts +260 -0
- package/dist/runtime/layer.js +876 -0
- package/dist/runtime/members.d.ts +381 -0
- package/dist/runtime/members.js +8 -0
- package/dist/runtime/operators/audit.d.ts +64 -0
- package/dist/runtime/operators/audit.js +56 -0
- package/dist/runtime/operators/auth.d.ts +29 -0
- package/dist/runtime/operators/auth.js +42 -0
- package/dist/runtime/operators/export.d.ts +68 -0
- package/dist/runtime/operators/export.js +137 -0
- package/dist/runtime/operators/grants.d.ts +45 -0
- package/dist/runtime/operators/grants.js +40 -0
- package/dist/runtime/operators/repair.d.ts +206 -0
- package/dist/runtime/operators/repair.js +226 -0
- package/dist/runtime/operators/routes.d.ts +35 -0
- package/dist/runtime/operators/routes.js +190 -0
- package/dist/runtime/operators/seed.d.ts +123 -0
- package/dist/runtime/operators/seed.js +123 -0
- package/dist/runtime/payloads/versions.d.ts +65 -0
- package/dist/runtime/payloads/versions.js +240 -0
- package/dist/runtime/peering/authority.d.ts +42 -0
- package/dist/runtime/peering/authority.js +132 -0
- package/dist/runtime/peering/credentials.d.ts +21 -0
- package/dist/runtime/peering/credentials.js +13 -0
- package/dist/runtime/peering/transport.d.ts +51 -0
- package/dist/runtime/peering/transport.js +175 -0
- package/dist/runtime/queries.d.ts +18 -0
- package/dist/runtime/queries.js +169 -0
- package/dist/runtime/readiness.d.ts +36 -0
- package/dist/runtime/readiness.js +44 -0
- package/dist/runtime/registration.d.ts +58 -0
- package/dist/runtime/registration.js +186 -0
- package/dist/runtime/request.d.ts +158 -0
- package/dist/runtime/request.js +102 -0
- package/dist/runtime/retry.d.ts +8 -0
- package/dist/runtime/retry.js +11 -0
- package/dist/runtime/runner.d.ts +93 -0
- package/dist/runtime/runner.js +122 -0
- package/dist/runtime/storage/codec.d.ts +39 -0
- package/dist/runtime/storage/codec.js +41 -0
- package/dist/runtime/storage/generation.d.ts +69 -0
- package/dist/runtime/storage/generation.js +49 -0
- package/dist/runtime/storage/placements.d.ts +15 -0
- package/dist/runtime/storage/placements.js +38 -0
- package/dist/runtime/storage/platform.d.ts +6 -0
- package/dist/runtime/storage/platform.js +9 -0
- package/dist/runtime/storage/retention.d.ts +73 -0
- package/dist/runtime/storage/retention.js +158 -0
- package/dist/runtime/subscriptions/identity.d.ts +31 -0
- package/dist/runtime/subscriptions/identity.js +45 -0
- package/dist/runtime/subscriptions/relay.d.ts +175 -0
- package/dist/runtime/subscriptions/relay.js +763 -0
- package/dist/runtime/subscriptions/storage.d.ts +40 -0
- package/dist/runtime/subscriptions/storage.js +98 -0
- package/dist/runtime/sweeps.d.ts +39 -0
- package/dist/runtime/sweeps.js +54 -0
- package/dist/runtime/telemetry/defects.d.ts +57 -0
- package/dist/runtime/telemetry/defects.js +43 -0
- package/dist/runtime/telemetry/metrics.d.ts +52 -0
- package/dist/runtime/telemetry/metrics.js +138 -0
- package/dist/runtime/telemetry/routes.d.ts +19 -0
- package/dist/runtime/telemetry/routes.js +18 -0
- package/dist/runtime/telemetry/sampler.d.ts +26 -0
- package/dist/runtime/telemetry/sampler.js +101 -0
- package/dist/runtime/telemetry/spans.d.ts +38 -0
- package/dist/runtime/telemetry/spans.js +44 -0
- package/dist/runtime/telemetry/usage.d.ts +52 -0
- package/dist/runtime/telemetry/usage.js +30 -0
- package/dist/runtime/topology/admission.d.ts +13 -0
- package/dist/runtime/topology/admission.js +36 -0
- package/dist/runtime/topology/locks.d.ts +56 -0
- package/dist/runtime/topology/locks.js +81 -0
- package/dist/runtime/topology/messages.d.ts +15 -0
- package/dist/runtime/topology/messages.js +32 -0
- package/dist/runtime/turn/admission.d.ts +22 -0
- package/dist/runtime/turn/admission.js +41 -0
- package/dist/runtime/turn/blobs.d.ts +38 -0
- package/dist/runtime/turn/blobs.js +215 -0
- package/dist/runtime/turn/execute.d.ts +208 -0
- package/dist/runtime/turn/execute.js +972 -0
- package/dist/runtime/turn/group.d.ts +165 -0
- package/dist/runtime/turn/group.js +326 -0
- package/dist/runtime/turn/hooks.d.ts +44 -0
- package/dist/runtime/turn/hooks.js +28 -0
- package/dist/runtime/turn/outbox.d.ts +159 -0
- package/dist/runtime/turn/outbox.js +269 -0
- package/dist/runtime/turn/pipeline.d.ts +68 -0
- package/dist/runtime/turn/pipeline.js +83 -0
- package/dist/runtime/turn/receipt.d.ts +81 -0
- package/dist/runtime/turn/receipt.js +32 -0
- package/dist/runtime/turn/relay.d.ts +179 -0
- package/dist/runtime/turn/relay.js +685 -0
- package/dist/runtime/turn/rows.d.ts +43 -0
- package/dist/runtime/turn/rows.js +592 -0
- package/dist/runtime/workflows/compatibility.d.ts +125 -0
- package/dist/runtime/workflows/compatibility.js +285 -0
- package/dist/runtime/workflows/engine.d.ts +107 -0
- package/dist/runtime/workflows/engine.js +826 -0
- package/dist/runtime/workflows/manifest.d.ts +34 -0
- package/dist/runtime/workflows/manifest.js +39 -0
- package/dist/runtime/workflows/steps.d.ts +33 -0
- package/dist/runtime/workflows/steps.js +152 -0
- package/dist/serve/api.d.ts +99 -0
- package/dist/serve/api.js +403 -0
- package/dist/serve/assertion/binding.d.ts +41 -0
- package/dist/serve/assertion/binding.js +92 -0
- package/dist/serve/assertion/verify.d.ts +93 -0
- package/dist/serve/assertion/verify.js +189 -0
- package/dist/serve/auth.d.ts +200 -0
- package/dist/serve/auth.js +92 -0
- package/dist/serve/clock.d.ts +10 -0
- package/dist/serve/clock.js +25 -0
- package/dist/serve/jwt.d.ts +65 -0
- package/dist/serve/jwt.js +202 -0
- package/dist/serve/layer.d.ts +98 -0
- package/dist/serve/layer.js +809 -0
- package/dist/serve/mcp/endpoint.d.ts +39 -0
- package/dist/serve/mcp/endpoint.js +187 -0
- package/dist/serve/mcp/tools.d.ts +37 -0
- package/dist/serve/mcp/tools.js +125 -0
- package/dist/serve/origin.d.ts +6 -0
- package/dist/serve/origin.js +21 -0
- package/dist/serve/sessions/feed.d.ts +79 -0
- package/dist/serve/sessions/feed.js +115 -0
- package/dist/serve/sessions/socket.d.ts +56 -0
- package/dist/serve/sessions/socket.js +212 -0
- package/dist/serve/sessions/sse.d.ts +27 -0
- package/dist/serve/sessions/sse.js +26 -0
- package/dist/serve/sessions/stream.d.ts +9 -0
- package/dist/serve/sessions/stream.js +9 -0
- package/dist/serve/sessions/watch.d.ts +12 -0
- package/dist/serve/sessions/watch.js +11 -0
- package/dist/serve/wire.d.ts +16 -0
- package/dist/serve/wire.js +50 -0
- package/dist/state/blob.d.ts +71 -0
- package/dist/state/blob.js +0 -0
- package/dist/state/migration.d.ts +53 -0
- package/dist/state/migration.js +29 -0
- package/dist/tables/fleet.d.ts +170 -0
- package/dist/tables/fleet.js +214 -0
- package/dist/tables/owned.d.ts +250 -0
- package/dist/tables/owned.js +233 -0
- package/dist/testing/actor-test.d.ts +360 -0
- package/dist/testing/actor-test.js +337 -0
- package/dist/testing/cluster.d.ts +93 -0
- package/dist/testing/cluster.js +296 -0
- package/dist/testing/conformance/access.d.ts +5 -0
- package/dist/testing/conformance/access.js +531 -0
- package/dist/testing/conformance/admission.d.ts +11 -0
- package/dist/testing/conformance/admission.js +182 -0
- package/dist/testing/conformance/adoption.d.ts +2 -0
- package/dist/testing/conformance/adoption.js +1019 -0
- package/dist/testing/conformance/assertions.d.ts +202 -0
- package/dist/testing/conformance/assertions.js +849 -0
- package/dist/testing/conformance/batches.d.ts +41 -0
- package/dist/testing/conformance/batches.js +388 -0
- package/dist/testing/conformance/blobs.d.ts +14 -0
- package/dist/testing/conformance/blobs.js +405 -0
- package/dist/testing/conformance/capacity.d.ts +8 -0
- package/dist/testing/conformance/capacity.js +433 -0
- package/dist/testing/conformance/client.d.ts +5 -0
- package/dist/testing/conformance/client.js +719 -0
- package/dist/testing/conformance/cold-serve.d.ts +16 -0
- package/dist/testing/conformance/cold-serve.js +254 -0
- package/dist/testing/conformance/connections/actors.d.ts +1143 -0
- package/dist/testing/conformance/connections/actors.js +180 -0
- package/dist/testing/conformance/connections/harness.d.ts +1754 -0
- package/dist/testing/conformance/connections/harness.js +142 -0
- package/dist/testing/conformance/connections/holders.d.ts +4 -0
- package/dist/testing/conformance/connections/holders.js +165 -0
- package/dist/testing/conformance/connections/lifecycle.d.ts +4 -0
- package/dist/testing/conformance/connections/lifecycle.js +113 -0
- package/dist/testing/conformance/connections/limits.d.ts +4 -0
- package/dist/testing/conformance/connections/limits.js +127 -0
- package/dist/testing/conformance/connections/reauthorization.d.ts +4 -0
- package/dist/testing/conformance/connections/reauthorization.js +170 -0
- package/dist/testing/conformance/connections/resync.d.ts +4 -0
- package/dist/testing/conformance/connections/resync.js +360 -0
- package/dist/testing/conformance/connections/takeover.d.ts +4 -0
- package/dist/testing/conformance/connections/takeover.js +287 -0
- package/dist/testing/conformance/connections.d.ts +4 -0
- package/dist/testing/conformance/connections.js +15 -0
- package/dist/testing/conformance/content-blobs.d.ts +16 -0
- package/dist/testing/conformance/content-blobs.js +534 -0
- package/dist/testing/conformance/counter.d.ts +16 -0
- package/dist/testing/conformance/counter.js +813 -0
- package/dist/testing/conformance/cron.d.ts +5 -0
- package/dist/testing/conformance/cron.js +665 -0
- package/dist/testing/conformance/drain.d.ts +26 -0
- package/dist/testing/conformance/drain.js +540 -0
- package/dist/testing/conformance/effect-control.d.ts +38 -0
- package/dist/testing/conformance/effect-control.js +1059 -0
- package/dist/testing/conformance/effects.d.ts +23 -0
- package/dist/testing/conformance/effects.js +432 -0
- package/dist/testing/conformance/events.d.ts +28 -0
- package/dist/testing/conformance/events.js +335 -0
- package/dist/testing/conformance/export.d.ts +2 -0
- package/dist/testing/conformance/export.js +368 -0
- package/dist/testing/conformance/fleet.d.ts +444 -0
- package/dist/testing/conformance/fleet.js +1009 -0
- package/dist/testing/conformance/groups.d.ts +7 -0
- package/dist/testing/conformance/groups.js +353 -0
- package/dist/testing/conformance/heap.d.ts +3 -0
- package/dist/testing/conformance/heap.js +149 -0
- package/dist/testing/conformance/http.d.ts +2809 -0
- package/dist/testing/conformance/http.js +1234 -0
- package/dist/testing/conformance/inspection-views.d.ts +8 -0
- package/dist/testing/conformance/inspection-views.js +272 -0
- package/dist/testing/conformance/inspector.d.ts +7 -0
- package/dist/testing/conformance/inspector.js +650 -0
- package/dist/testing/conformance/mint.d.ts +58 -0
- package/dist/testing/conformance/mint.js +692 -0
- package/dist/testing/conformance/multi-runner.d.ts +8 -0
- package/dist/testing/conformance/multi-runner.js +403 -0
- package/dist/testing/conformance/neki/plan.d.ts +19 -0
- package/dist/testing/conformance/neki/plan.js +30 -0
- package/dist/testing/conformance/observability.d.ts +3 -0
- package/dist/testing/conformance/observability.js +343 -0
- package/dist/testing/conformance/offline.d.ts +4 -0
- package/dist/testing/conformance/offline.js +474 -0
- package/dist/testing/conformance/operator-harness.d.ts +57 -0
- package/dist/testing/conformance/operator-harness.js +78 -0
- package/dist/testing/conformance/operator.d.ts +3 -0
- package/dist/testing/conformance/operator.js +379 -0
- package/dist/testing/conformance/outbox-cross-shard.d.ts +14 -0
- package/dist/testing/conformance/outbox-cross-shard.js +160 -0
- package/dist/testing/conformance/outbox.d.ts +36 -0
- package/dist/testing/conformance/outbox.js +437 -0
- package/dist/testing/conformance/payload-migrations.d.ts +3 -0
- package/dist/testing/conformance/payload-migrations.js +612 -0
- package/dist/testing/conformance/pipeline.d.ts +3 -0
- package/dist/testing/conformance/pipeline.js +1040 -0
- package/dist/testing/conformance/placement.d.ts +22 -0
- package/dist/testing/conformance/placement.js +539 -0
- package/dist/testing/conformance/platform.d.ts +40 -0
- package/dist/testing/conformance/platform.js +101 -0
- package/dist/testing/conformance/progress.d.ts +39 -0
- package/dist/testing/conformance/progress.js +666 -0
- package/dist/testing/conformance/properties.d.ts +6 -0
- package/dist/testing/conformance/properties.js +295 -0
- package/dist/testing/conformance/protocols.d.ts +4 -0
- package/dist/testing/conformance/protocols.js +618 -0
- package/dist/testing/conformance/provider/advertise.d.ts +21 -0
- package/dist/testing/conformance/provider/advertise.js +44 -0
- package/dist/testing/conformance/read-your-writes.d.ts +20 -0
- package/dist/testing/conformance/read-your-writes.js +192 -0
- package/dist/testing/conformance/reducers.d.ts +8 -0
- package/dist/testing/conformance/reducers.js +258 -0
- package/dist/testing/conformance/relay.d.ts +42 -0
- package/dist/testing/conformance/relay.js +1115 -0
- package/dist/testing/conformance/restore.d.ts +43 -0
- package/dist/testing/conformance/restore.js +341 -0
- package/dist/testing/conformance/retention.d.ts +14 -0
- package/dist/testing/conformance/retention.js +463 -0
- package/dist/testing/conformance/rls.d.ts +24 -0
- package/dist/testing/conformance/rls.js +576 -0
- package/dist/testing/conformance/simulation.d.ts +31 -0
- package/dist/testing/conformance/simulation.js +167 -0
- package/dist/testing/conformance/single-shard.d.ts +2 -0
- package/dist/testing/conformance/single-shard.js +125 -0
- package/dist/testing/conformance/singleton.d.ts +3 -0
- package/dist/testing/conformance/singleton.js +293 -0
- package/dist/testing/conformance/statements.d.ts +60 -0
- package/dist/testing/conformance/statements.js +108 -0
- package/dist/testing/conformance/streams.d.ts +7 -0
- package/dist/testing/conformance/streams.js +280 -0
- package/dist/testing/conformance/subscriptions/access.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/access.js +98 -0
- package/dist/testing/conformance/subscriptions/actors.d.ts +4910 -0
- package/dist/testing/conformance/subscriptions/actors.js +372 -0
- package/dist/testing/conformance/subscriptions/cluster.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/cluster.js +89 -0
- package/dist/testing/conformance/subscriptions/delivery.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/delivery.js +253 -0
- package/dist/testing/conformance/subscriptions/deploys.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/deploys.js +162 -0
- package/dist/testing/conformance/subscriptions/epochs.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/epochs.js +169 -0
- package/dist/testing/conformance/subscriptions/failures.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/failures.js +108 -0
- package/dist/testing/conformance/subscriptions/feeds.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/feeds.js +218 -0
- package/dist/testing/conformance/subscriptions/harness.d.ts +124 -0
- package/dist/testing/conformance/subscriptions/harness.js +143 -0
- package/dist/testing/conformance/subscriptions/operator.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/operator.js +128 -0
- package/dist/testing/conformance/subscriptions/retention.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/retention.js +288 -0
- package/dist/testing/conformance/subscriptions/routing.d.ts +4 -0
- package/dist/testing/conformance/subscriptions/routing.js +179 -0
- package/dist/testing/conformance/subscriptions.d.ts +4 -0
- package/dist/testing/conformance/subscriptions.js +19 -0
- package/dist/testing/conformance/tables.d.ts +125 -0
- package/dist/testing/conformance/tables.js +664 -0
- package/dist/testing/conformance/transports/actors.d.ts +1907 -0
- package/dist/testing/conformance/transports/actors.js +163 -0
- package/dist/testing/conformance/transports/client.d.ts +3 -0
- package/dist/testing/conformance/transports/client.js +237 -0
- package/dist/testing/conformance/transports/feeds.d.ts +3 -0
- package/dist/testing/conformance/transports/feeds.js +232 -0
- package/dist/testing/conformance/transports/harness.d.ts +93 -0
- package/dist/testing/conformance/transports/harness.js +84 -0
- package/dist/testing/conformance/transports/streams.d.ts +3 -0
- package/dist/testing/conformance/transports/streams.js +96 -0
- package/dist/testing/conformance/transports/websocket.d.ts +3 -0
- package/dist/testing/conformance/transports/websocket.js +384 -0
- package/dist/testing/conformance/transports/wire.d.ts +141 -0
- package/dist/testing/conformance/transports/wire.js +204 -0
- package/dist/testing/conformance/transports.d.ts +3 -0
- package/dist/testing/conformance/transports.js +11 -0
- package/dist/testing/conformance/watch.d.ts +59 -0
- package/dist/testing/conformance/watch.js +879 -0
- package/dist/testing/conformance/workflow-engine.d.ts +97 -0
- package/dist/testing/conformance/workflow-engine.js +253 -0
- package/dist/testing/conformance/workflow-versions.d.ts +3 -0
- package/dist/testing/conformance/workflow-versions.js +545 -0
- package/dist/testing/conformance/workflows/access.d.ts +4 -0
- package/dist/testing/conformance/workflows/access.js +147 -0
- package/dist/testing/conformance/workflows/actors.d.ts +2317 -0
- package/dist/testing/conformance/workflows/actors.js +305 -0
- package/dist/testing/conformance/workflows/basics.d.ts +4 -0
- package/dist/testing/conformance/workflows/basics.js +144 -0
- package/dist/testing/conformance/workflows/engine.d.ts +4 -0
- package/dist/testing/conformance/workflows/engine.js +80 -0
- package/dist/testing/conformance/workflows/guards.d.ts +4 -0
- package/dist/testing/conformance/workflows/guards.js +172 -0
- package/dist/testing/conformance/workflows/harness.d.ts +14 -0
- package/dist/testing/conformance/workflows/harness.js +44 -0
- package/dist/testing/conformance/workflows/recovery.d.ts +4 -0
- package/dist/testing/conformance/workflows/recovery.js +181 -0
- package/dist/testing/conformance/workflows/starts.d.ts +4 -0
- package/dist/testing/conformance/workflows/starts.js +57 -0
- package/dist/testing/conformance/workflows/suspension.d.ts +4 -0
- package/dist/testing/conformance/workflows/suspension.js +106 -0
- package/dist/testing/conformance/workflows/waits.d.ts +4 -0
- package/dist/testing/conformance/workflows/waits.js +284 -0
- package/dist/testing/conformance/workflows.d.ts +4 -0
- package/dist/testing/conformance/workflows.js +19 -0
- package/dist/testing/conformance.d.ts +330 -0
- package/dist/testing/conformance.js +364 -0
- package/dist/testing/database.d.ts +31 -0
- package/dist/testing/database.js +70 -0
- package/dist/testing/foundation.d.ts +41 -0
- package/dist/testing/foundation.js +517 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +12 -0
- package/dist/testing/property.d.ts +40 -0
- package/dist/testing/property.js +95 -0
- package/dist/testing/simulate-cluster.d.ts +112 -0
- package/dist/testing/simulate-cluster.js +257 -0
- package/dist/testing/simulate.d.ts +90 -0
- package/dist/testing/simulate.js +127 -0
- package/package.json +1 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Effect, Schema, Stream } from "effect";
|
|
2
|
+
import { decodeFailure, undecodableFailure } from "../transport.js";
|
|
3
|
+
import { IDLE_MS, readEvents, reconnecting, session } from "./sse.js";
|
|
4
|
+
const VERSION = /^(0|[1-9]\d*)$/;
|
|
5
|
+
const decodeJson = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Json));
|
|
6
|
+
/** The greater of the version held and a result's `id`, when that is a version. */
|
|
7
|
+
const later = (current, seen) => seen !== undefined &&
|
|
8
|
+
VERSION.test(seen) &&
|
|
9
|
+
(current === undefined || BigInt(seen) > BigInt(current))
|
|
10
|
+
? seen
|
|
11
|
+
: current;
|
|
12
|
+
/**
|
|
13
|
+
* One watch of served state, a query declared `watch: true` or a fleet view:
|
|
14
|
+
* its current result, then the newest result after each change. A watch is
|
|
15
|
+
* state, not history, so a dropped connection is reopened after a jittered,
|
|
16
|
+
* growing delay, or the server's `retryAfter`, with the greatest version any
|
|
17
|
+
* result carried as `durable-min-version`; its first result is the current
|
|
18
|
+
* state, never older than one already delivered. It fails with the query's
|
|
19
|
+
* declared error or the `ActorError` that ended it when a retry cannot help,
|
|
20
|
+
* and an expired credential is retried once.
|
|
21
|
+
*/
|
|
22
|
+
export const watchStream = ({ decode, open, declared, token, options, }) => session({
|
|
23
|
+
signal: options.signal,
|
|
24
|
+
run: (emit) => {
|
|
25
|
+
const failureOf = (text, status, headers = new Headers()) => decodeFailure(declared)({ status, headers, text, sentAt: 0 });
|
|
26
|
+
let last = token();
|
|
27
|
+
return reconnecting((delivered) => Effect.gen(function* () {
|
|
28
|
+
const response = yield* open(last, yield* Effect.abortSignal);
|
|
29
|
+
yield* readEvents({ response, refused: failureOf, idleMs: IDLE_MS }).pipe(Stream.runForEach((message) => Effect.gen(function* () {
|
|
30
|
+
if (message.event === "end")
|
|
31
|
+
return yield* failureOf(message.data, 0);
|
|
32
|
+
const json = yield* decodeJson(message.data).pipe(Effect.mapError(undecodableFailure));
|
|
33
|
+
const value = yield* decode(json);
|
|
34
|
+
last = later(last, message.id);
|
|
35
|
+
yield* delivered;
|
|
36
|
+
yield* emit(value);
|
|
37
|
+
})));
|
|
38
|
+
}));
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Effect, Option, Schema } from "effect";
|
|
2
|
+
import { ActorError } from "../errors/actor.ts";
|
|
3
|
+
import type { DeclaredError } from "../members/command.ts";
|
|
4
|
+
import type { OfflineStoreError } from "./offline/store.ts";
|
|
5
|
+
/** A response as the client reads it: status, headers, and the raw body text. */
|
|
6
|
+
export interface Reply {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly headers: Headers;
|
|
9
|
+
readonly text: string;
|
|
10
|
+
/** The local monotonic time its request was sent. */
|
|
11
|
+
readonly sentAt: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What a call rejects with: a declared application error, a typed framework
|
|
15
|
+
* failure, or, on a client with an offline store, the store's own failure.
|
|
16
|
+
*/
|
|
17
|
+
export type Failure = ActorError | OfflineStoreError | DeclaredError["Type"];
|
|
18
|
+
/**
|
|
19
|
+
* An HTTP `retry-after` header as milliseconds: delay seconds, or a date
|
|
20
|
+
* measured from the response's `date` less the `elapsed` time since its
|
|
21
|
+
* request was sent, else from `now`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const retryAfterHeader: ({ headers, now, elapsed, }: {
|
|
24
|
+
readonly headers: Headers;
|
|
25
|
+
readonly now?: number;
|
|
26
|
+
readonly elapsed?: number;
|
|
27
|
+
}) => number | undefined;
|
|
28
|
+
/** A request that got no response, or a body that stopped mid-read; retryable. */
|
|
29
|
+
export declare const networkFailure: () => ActorError;
|
|
30
|
+
/** A response or message the client could not decode; not retryable. */
|
|
31
|
+
export declare const undecodableFailure: () => ActorError;
|
|
32
|
+
/** Succeeds once `signal` aborts, at once when it already has; never without a signal. */
|
|
33
|
+
export declare const aborted: (signal: AbortSignal | undefined) => Effect.Effect<void, never, never>;
|
|
34
|
+
/** Decodes the served body of a failed call; `declared` decodes the member's declared errors. */
|
|
35
|
+
export declare const decodeFailure: (declared: ((body: Schema.Json) => Option.Option<Failure>) | undefined) => (reply: Reply) => Failure;
|
|
36
|
+
/** Decodes a 2xx body with `decode`, as undefined when the body is empty. */
|
|
37
|
+
export declare const decodeSuccess: <A>(decode: (body: Schema.Json | undefined) => Effect.Effect<A, Schema.SchemaError>) => (reply: Reply) => Effect.Effect<A, ActorError>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Effect, Option, Schema } from "effect";
|
|
2
|
+
import { ActorError, TransportError } from "../errors/actor.js";
|
|
3
|
+
import { actorErrorOf, isDefectBody } from "../protocol/wire.js";
|
|
4
|
+
const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Json));
|
|
5
|
+
const isEnvelope = Schema.is(Schema.TaggedStruct("ActorError", {}));
|
|
6
|
+
/**
|
|
7
|
+
* An HTTP `retry-after` header as milliseconds: delay seconds, or a date
|
|
8
|
+
* measured from the response's `date` less the `elapsed` time since its
|
|
9
|
+
* request was sent, else from `now`.
|
|
10
|
+
*/
|
|
11
|
+
export const retryAfterHeader = ({ headers, now, elapsed = 0, }) => {
|
|
12
|
+
const value = headers.get("retry-after")?.trim();
|
|
13
|
+
if (value === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
if (/^\d+$/.test(value))
|
|
16
|
+
return Number(value) * 1_000;
|
|
17
|
+
const at = Date.parse(value);
|
|
18
|
+
const date = Date.parse(headers.get("date") ?? "");
|
|
19
|
+
const sent = Number.isNaN(date) ? now : date + Math.max(0, elapsed);
|
|
20
|
+
return Number.isNaN(at) || sent === undefined ? undefined : Math.max(0, at - sent);
|
|
21
|
+
};
|
|
22
|
+
const transportFailure = (reason) => ActorError.make({ reason });
|
|
23
|
+
/** A request that got no response, or a body that stopped mid-read; retryable. */
|
|
24
|
+
export const networkFailure = () => transportFailure(TransportError.make({ code: "network", retryable: true }));
|
|
25
|
+
/** A response or message the client could not decode; not retryable. */
|
|
26
|
+
export const undecodableFailure = () => transportFailure(TransportError.make({ code: "decode", retryable: false }));
|
|
27
|
+
/** Succeeds once `signal` aborts, at once when it already has; never without a signal. */
|
|
28
|
+
export const aborted = (signal) => Effect.callback((resume) => {
|
|
29
|
+
if (signal === undefined)
|
|
30
|
+
return;
|
|
31
|
+
if (signal.aborted)
|
|
32
|
+
return resume(Effect.void);
|
|
33
|
+
const onAbort = () => resume(Effect.void);
|
|
34
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
35
|
+
return Effect.sync(() => signal.removeEventListener("abort", onAbort));
|
|
36
|
+
});
|
|
37
|
+
/** A status a proxy or gateway may answer before any runner saw the request. */
|
|
38
|
+
const isRetryableStatus = (status) => status >= 500 || status === 429 || status === 408;
|
|
39
|
+
const statusError = (reply) => transportFailure(TransportError.make({
|
|
40
|
+
code: "status",
|
|
41
|
+
status: reply.status,
|
|
42
|
+
retryable: isRetryableStatus(reply.status),
|
|
43
|
+
}));
|
|
44
|
+
/** Decodes the served body of a failed call; `declared` decodes the member's declared errors. */
|
|
45
|
+
export const decodeFailure = (declared) => (reply) => {
|
|
46
|
+
const body = decodeJson(reply.text);
|
|
47
|
+
if (Option.isNone(body))
|
|
48
|
+
return statusError(reply);
|
|
49
|
+
if (isEnvelope(body.value))
|
|
50
|
+
return Option.getOrElse(actorErrorOf({
|
|
51
|
+
body: body.value,
|
|
52
|
+
headerRetryAfterMs: retryAfterHeader({ headers: reply.headers }),
|
|
53
|
+
}), () => statusError(reply));
|
|
54
|
+
if (isDefectBody(body.value))
|
|
55
|
+
return transportFailure(TransportError.make({ code: "defect", status: reply.status, retryable: false }));
|
|
56
|
+
const error = declared?.(body.value) ?? Option.none();
|
|
57
|
+
return Option.isSome(error) ? error.value : statusError(reply);
|
|
58
|
+
};
|
|
59
|
+
/** Decodes a 2xx body with `decode`, as undefined when the body is empty. */
|
|
60
|
+
export const decodeSuccess = (decode) => (reply) => {
|
|
61
|
+
const undecodable = transportFailure(TransportError.make({ code: "decode", status: reply.status, retryable: false }));
|
|
62
|
+
const body = reply.text === "" ? Option.some(undefined) : decodeJson(reply.text);
|
|
63
|
+
if (Option.isNone(body))
|
|
64
|
+
return Effect.fail(undecodable);
|
|
65
|
+
return decode(body.value).pipe(Effect.mapError(() => undecodable));
|
|
66
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Context, type DateTime, Effect, Option, type Stream } from "effect";
|
|
2
|
+
import type { RetentionGap, UnknownCursor } from "../errors/events.ts";
|
|
3
|
+
import type { ActorRef, Caller, Principal } from "../identity/caller.ts";
|
|
4
|
+
import type { AnyBlob } from "../members/blob.ts";
|
|
5
|
+
import type { AnyJob, ProgressJob, ProgressOf } from "../members/job.ts";
|
|
6
|
+
import type { EventClass } from "../members/event.ts";
|
|
7
|
+
import type { BlobReadOf, BlobWriteOf } from "../state/blob.ts";
|
|
8
|
+
import type { Group, AnyOwnedTable, ScopedRead, TurnRows } from "../tables/owned.ts";
|
|
9
|
+
/**
|
|
10
|
+
* The running turn's marker while a command turn executes. Request/reply
|
|
11
|
+
* calls such as a handle's commands and `Content.upload` refuse to run while
|
|
12
|
+
* it is set.
|
|
13
|
+
*/
|
|
14
|
+
export declare const InsideTurn: Context.Reference<symbol | undefined>;
|
|
15
|
+
/** Dies with a defect when run inside a command turn, where request/reply would wait on a transaction it holds. */
|
|
16
|
+
export declare const outsideTurn: Effect.Effect<undefined, never, never>;
|
|
17
|
+
declare const TurnTypeId: unique symbol;
|
|
18
|
+
/** Type-level identity of one actor's command-turn service, so `X.Turn` names only that actor's turn. */
|
|
19
|
+
export interface Turn<Name extends string> {
|
|
20
|
+
readonly [TurnTypeId]: Name;
|
|
21
|
+
}
|
|
22
|
+
declare const MintableTypeId: unique symbol;
|
|
23
|
+
/** Type-level mark of an unkeyed actor that declares `createdBy`, so turns can mint it. */
|
|
24
|
+
export interface Mintable<Id extends string = string> {
|
|
25
|
+
readonly [MintableTypeId]: Id;
|
|
26
|
+
}
|
|
27
|
+
/** The writable context of one command turn, obtained with `yield* X.Turn`. */
|
|
28
|
+
export interface CommandContext<State, Event extends EventClass = never, Tables extends AnyOwnedTable = AnyOwnedTable, Blobs extends AnyBlob = AnyBlob> {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly ref: ActorRef;
|
|
31
|
+
readonly caller: Caller;
|
|
32
|
+
readonly principal: Option.Option<Principal>;
|
|
33
|
+
readonly commandId: string;
|
|
34
|
+
readonly state: Readonly<State> & {
|
|
35
|
+
readonly set: (patch: Partial<State>) => Effect.Effect<void>;
|
|
36
|
+
};
|
|
37
|
+
/** Appends a declared event that is stored, and replayable, only if this turn commits. */
|
|
38
|
+
readonly emit: (event: Event["Type"]) => Effect.Effect<void>;
|
|
39
|
+
/** This actor's rows of a declared table, bound to the turn transaction. */
|
|
40
|
+
readonly rows: <T extends Tables>(table: T) => TurnRows<T>;
|
|
41
|
+
/** Read-only joins across the actor's placement group, inside the turn transaction. */
|
|
42
|
+
readonly group: Group;
|
|
43
|
+
/**
|
|
44
|
+
* This actor's entries of a declared blob, or its references to declared
|
|
45
|
+
* content, bound to the turn transaction. Content bytes are never readable in a turn.
|
|
46
|
+
*/
|
|
47
|
+
readonly blob: <B extends Blobs>(blob: B) => BlobWriteOf<B>;
|
|
48
|
+
/**
|
|
49
|
+
* Derives the id of a new `child` from this command id and the number of
|
|
50
|
+
* earlier mints in the turn; retries of the command mint the same ids. The
|
|
51
|
+
* turn must stage an intent to the child's `createdBy` command, which alone
|
|
52
|
+
* can create it.
|
|
53
|
+
*/
|
|
54
|
+
readonly mint: <Id extends string>(child: Mintable<Id>) => Effect.Effect<Id>;
|
|
55
|
+
}
|
|
56
|
+
/** One committed event and where it sits in its actor's stream. */
|
|
57
|
+
export interface EventEntry<E> {
|
|
58
|
+
/** Exclusive resume point: pass it as `after` to read the events that follow. */
|
|
59
|
+
readonly cursor: string;
|
|
60
|
+
readonly event: E;
|
|
61
|
+
readonly commandId: string;
|
|
62
|
+
readonly timestamp: DateTime.Utc;
|
|
63
|
+
}
|
|
64
|
+
/** One executor progress frame of a job this actor enqueued. */
|
|
65
|
+
export interface ProgressEntry<J extends ProgressJob> {
|
|
66
|
+
readonly jobId: string;
|
|
67
|
+
/** The job as enqueued. */
|
|
68
|
+
readonly job: J["Type"];
|
|
69
|
+
readonly attempt: number;
|
|
70
|
+
/** Per attempt, from 1; a gap means frames of the attempt were lost. */
|
|
71
|
+
readonly seq: number;
|
|
72
|
+
readonly frame: ProgressOf<J>;
|
|
73
|
+
}
|
|
74
|
+
/** The read-only context of one query, obtained with `yield* X.Read`. */
|
|
75
|
+
export interface QueryContext<State, Event extends EventClass = never, Tables extends AnyOwnedTable = AnyOwnedTable, Blobs extends AnyBlob = AnyBlob, Jobs extends AnyJob = never> {
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly ref: ActorRef;
|
|
78
|
+
readonly caller: Caller;
|
|
79
|
+
readonly principal: Option.Option<Principal>;
|
|
80
|
+
/** The last committed state; never uncommitted writes of a running turn. */
|
|
81
|
+
readonly state: Readonly<State>;
|
|
82
|
+
/**
|
|
83
|
+
* The last event committed when `state` was read: resume `events` after it
|
|
84
|
+
* to follow on from this state without missing or repeating an event.
|
|
85
|
+
*/
|
|
86
|
+
readonly cursor: string;
|
|
87
|
+
/**
|
|
88
|
+
* Committed events of one declared class after the exclusive `after` cursor
|
|
89
|
+
* and up to `cursor`, in stream order; omitted, from the start. A cursor this
|
|
90
|
+
* actor never issued fails with `UnknownCursor`, and pruned history after it
|
|
91
|
+
* with `RetentionGap`. One call returns at most `limit` entries (default
|
|
92
|
+
* 1,000, at most 10,000); a full page continues after its last entry's cursor.
|
|
93
|
+
*/
|
|
94
|
+
readonly events: <E extends Event>(event: E, options?: {
|
|
95
|
+
readonly after?: string | undefined;
|
|
96
|
+
readonly limit?: number | undefined;
|
|
97
|
+
}) => Effect.Effect<ReadonlyArray<EventEntry<E["Type"]>>, UnknownCursor | RetentionGap>;
|
|
98
|
+
/** This actor's committed rows of a declared table. */
|
|
99
|
+
readonly rows: <T extends Tables>(table: T) => ScopedRead<T>;
|
|
100
|
+
/** Read-only joins across the actor's placement group. */
|
|
101
|
+
readonly group: Group;
|
|
102
|
+
/** This actor's committed entries of a declared blob, or the content it references. */
|
|
103
|
+
readonly blob: <B extends Blobs>(blob: B) => BlobReadOf<B>;
|
|
104
|
+
/**
|
|
105
|
+
* Committed events of one declared class after the exclusive `after`
|
|
106
|
+
* cursor, then each one as its turn commits, with no gap or repeat between
|
|
107
|
+
* the two. Only stream handlers provide `InStream`, so a query that follows
|
|
108
|
+
* leaves an unsatisfiable requirement; the stream ends with its activation.
|
|
109
|
+
*/
|
|
110
|
+
readonly follow: <E extends Event>(event: E, options?: {
|
|
111
|
+
readonly after?: string | undefined;
|
|
112
|
+
}) => Stream.Stream<EventEntry<E["Type"]>, UnknownCursor | RetentionGap, InStream>;
|
|
113
|
+
/**
|
|
114
|
+
* Live executor progress of this actor's jobs of class `job`, from the
|
|
115
|
+
* moment of the call; it has no history, may skip or coalesce frames, and
|
|
116
|
+
* ends with the stream. Only stream handlers whose member lists `job` in
|
|
117
|
+
* `progress.jobs` receive any.
|
|
118
|
+
*/
|
|
119
|
+
readonly progress: <J extends Extract<Jobs, ProgressJob>>(job: J, options?: {
|
|
120
|
+
readonly jobId?: string | undefined;
|
|
121
|
+
}) => Stream.Stream<ProgressEntry<J>, never, InStream>;
|
|
122
|
+
}
|
|
123
|
+
declare const InStream_base: Context.ServiceClass<InStream, "@rikalabs/akter/contexts/command/InStream", {
|
|
124
|
+
readonly stream: symbol;
|
|
125
|
+
}>;
|
|
126
|
+
/**
|
|
127
|
+
* Provided only while a stream handler runs. `read.follow` requires it and
|
|
128
|
+
* `X.toLayer` removes it from stream handler requirements.
|
|
129
|
+
*/
|
|
130
|
+
export declare class InStream extends InStream_base {
|
|
131
|
+
}
|
|
132
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context, Effect, Option } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The running turn's marker while a command turn executes. Request/reply
|
|
4
|
+
* calls such as a handle's commands and `Content.upload` refuse to run while
|
|
5
|
+
* it is set.
|
|
6
|
+
*/
|
|
7
|
+
export const InsideTurn = Context.Reference("akter/InsideTurn", {
|
|
8
|
+
defaultValue: () => undefined,
|
|
9
|
+
});
|
|
10
|
+
/** Dies with a defect when run inside a command turn, where request/reply would wait on a transaction it holds. */
|
|
11
|
+
export const outsideTurn = Effect.gen(function* () {
|
|
12
|
+
if ((yield* InsideTurn) !== undefined)
|
|
13
|
+
return yield* Effect.die(new Error("Request/reply inside a turn"));
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Provided only while a stream handler runs. `read.follow` requires it and
|
|
17
|
+
* `X.toLayer` removes it from stream handler requirements.
|
|
18
|
+
*/
|
|
19
|
+
export class InStream extends Context.Service()("@rikalabs/akter/contexts/command/InStream") {
|
|
20
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Effect, Option } from "effect";
|
|
2
|
+
import type { RetentionGap, UnknownCursor } from "../errors/events.ts";
|
|
3
|
+
import type { ActorRef, Caller, Principal } from "../identity/caller.ts";
|
|
4
|
+
import type { AnyConnection } from "../members/connection.ts";
|
|
5
|
+
import type { EventClass } from "../members/event.ts";
|
|
6
|
+
import type { EventEntry } from "./command.ts";
|
|
7
|
+
/** Narrows a broadcast: `to` keeps only these connections, `except` removes these. */
|
|
8
|
+
export interface BroadcastOptions {
|
|
9
|
+
readonly to?: ReadonlyArray<string>;
|
|
10
|
+
readonly except?: ReadonlyArray<string>;
|
|
11
|
+
}
|
|
12
|
+
/** One open connection of a member. `session` is present only when asked for. */
|
|
13
|
+
export interface ConnectionInfo<Session = unknown> {
|
|
14
|
+
readonly connectionId: string;
|
|
15
|
+
readonly caller: Caller;
|
|
16
|
+
readonly session?: Session;
|
|
17
|
+
}
|
|
18
|
+
/** The per-connection state a member declares with `session`, at most 16 KiB encoded. */
|
|
19
|
+
export interface SessionAccess<Session> {
|
|
20
|
+
/** The session as last written, or none before the first `set`. */
|
|
21
|
+
readonly get: Effect.Effect<Option.Option<Session>>;
|
|
22
|
+
/** Merges `patch` into the session; written once, fenced, after the handler returns. */
|
|
23
|
+
readonly set: (patch: Partial<Session>) => Effect.Effect<void>;
|
|
24
|
+
}
|
|
25
|
+
/** A frame, or an event entry whose cursor the client deduplicates on. */
|
|
26
|
+
export type FrameOf<Server> = Server | EventEntry<Server>;
|
|
27
|
+
/**
|
|
28
|
+
* The context of one connection handler, obtained with `yield* X.Connection`.
|
|
29
|
+
* It reads committed state and sends frames; durable actor changes go through
|
|
30
|
+
* commands.
|
|
31
|
+
*/
|
|
32
|
+
export interface ConnectionContext<State, Event extends EventClass, Server, Session> {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly ref: ActorRef;
|
|
35
|
+
readonly connectionId: string;
|
|
36
|
+
readonly member: string;
|
|
37
|
+
/** The caller authorized when the connection opened, never frame content. */
|
|
38
|
+
readonly caller: Caller;
|
|
39
|
+
readonly principal: Option.Option<Principal>;
|
|
40
|
+
/** The state the activation last committed. */
|
|
41
|
+
readonly state: Readonly<State>;
|
|
42
|
+
/** The activation's flushed-through event cursor when the handler started. */
|
|
43
|
+
readonly cursor: string;
|
|
44
|
+
/** True when this activation did not run the connection's `open`. */
|
|
45
|
+
readonly resumed: boolean;
|
|
46
|
+
readonly session: SessionAccess<Session>;
|
|
47
|
+
/** Sends a frame to this connection once the handler returns. */
|
|
48
|
+
readonly send: (frame: FrameOf<Server>) => Effect.Effect<void>;
|
|
49
|
+
/** Sends a frame to this member's open connections, parked or not, wherever they are held. */
|
|
50
|
+
readonly broadcast: (frame: FrameOf<Server>, options?: BroadcastOptions) => Effect.Effect<void>;
|
|
51
|
+
/** At most 1,000 of this member's open connections; `session` only when asked for. */
|
|
52
|
+
readonly connections: (options?: {
|
|
53
|
+
readonly session?: boolean;
|
|
54
|
+
}) => Effect.Effect<ReadonlyArray<ConnectionInfo<Session>>>;
|
|
55
|
+
/** Closes this connection with `SessionEnded` cause `ServerClosed` once the handler returns. */
|
|
56
|
+
readonly close: Effect.Effect<void>;
|
|
57
|
+
/** Committed events of one declared class after the exclusive `after` cursor, in stream order, as `read.events` returns them. */
|
|
58
|
+
readonly events: <E extends Event>(event: E, options?: {
|
|
59
|
+
readonly after?: string | undefined;
|
|
60
|
+
readonly limit?: number;
|
|
61
|
+
}) => Effect.Effect<ReadonlyArray<EventEntry<E["Type"]>>, UnknownCursor | RetentionGap>;
|
|
62
|
+
}
|
|
63
|
+
/** How a command turn reaches connections; frames go out only after the turn commits. */
|
|
64
|
+
export interface BroadcastContext<Connections extends AnyConnection = AnyConnection> {
|
|
65
|
+
readonly broadcast: <C extends Connections>(member: C, frame: FrameOf<C["server"]["Type"]>, options?: BroadcastOptions) => Effect.Effect<void>;
|
|
66
|
+
/** At most 1,000 of the member's open connections, to filter into `to`. */
|
|
67
|
+
readonly connections: <C extends Connections>(member: C) => Effect.Effect<ReadonlyArray<ConnectionInfo>>;
|
|
68
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DateTime, Duration, Effect, Option } from "effect";
|
|
2
|
+
import type { ActorRef, Principal } from "../identity/caller.ts";
|
|
3
|
+
import type { AnyJob, ProgressJob, ProgressOf } from "../members/job.ts";
|
|
4
|
+
/** How `turn.enqueue` names and schedules a job. */
|
|
5
|
+
export interface EnqueueOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Names the job within its actor, 1-200 characters. Enqueueing another job
|
|
8
|
+
* with the same key replaces this one when the turn commits, as
|
|
9
|
+
* `turn.cancelJob(key)` would.
|
|
10
|
+
*/
|
|
11
|
+
readonly key?: string;
|
|
12
|
+
/** Runs no earlier than `after` past the turn's commit. */
|
|
13
|
+
readonly after?: Duration.Input;
|
|
14
|
+
/** Runs no earlier than `at`, measured on the database clock. */
|
|
15
|
+
readonly at?: DateTime.DateTime;
|
|
16
|
+
}
|
|
17
|
+
/** The part of a command turn that stages jobs; see `X.Turn`. */
|
|
18
|
+
export interface EnqueueContext<J extends AnyJob> {
|
|
19
|
+
/**
|
|
20
|
+
* Stages `job` in this turn. It is executed only after the turn commits,
|
|
21
|
+
* and a declared failure or rollback discards it.
|
|
22
|
+
*/
|
|
23
|
+
readonly enqueue: (job: J["Type"], options?: EnqueueOptions) => Effect.Effect<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Cancels this actor's job with `key` when the turn commits. One that never
|
|
26
|
+
* started is removed; one that started is never attempted again and reports
|
|
27
|
+
* what is known of it to `onCancelled`.
|
|
28
|
+
*/
|
|
29
|
+
readonly cancelJob: (key: string) => Effect.Effect<void>;
|
|
30
|
+
}
|
|
31
|
+
/** The context of one executor attempt, obtained with `yield* X.Executor`. */
|
|
32
|
+
export interface ExecutorContext<J extends AnyJob = AnyJob> {
|
|
33
|
+
/** Stable across every attempt; use it as the provider's idempotency key. */
|
|
34
|
+
readonly jobId: string;
|
|
35
|
+
/** 1 on the first attempt; a later attempt may follow one whose outcome is unknown. */
|
|
36
|
+
readonly attempt: number;
|
|
37
|
+
/** The principal of the turn that enqueued the job. */
|
|
38
|
+
readonly principal: Option.Option<Principal>;
|
|
39
|
+
/** The actor that enqueued the job. */
|
|
40
|
+
readonly ref: ActorRef;
|
|
41
|
+
/**
|
|
42
|
+
* Reports a transient progress frame of the running job `job`. It never
|
|
43
|
+
* fails or waits and never changes the outcome: a frame that does not
|
|
44
|
+
* encode, exceeds 4 KiB, names another job, or runs after the attempt ended
|
|
45
|
+
* is dropped. Frames are coalesced and may be lost; they are never state,
|
|
46
|
+
* events, or receipts.
|
|
47
|
+
*/
|
|
48
|
+
progress<P extends Extract<J, ProgressJob>>(job: P, frame: ProgressOf<P>): Effect.Effect<void>;
|
|
49
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Context, Data, type Effect, type Option, Schema } from "effect";
|
|
2
|
+
import type { ActorRef, Principal } from "../identity/caller.ts";
|
|
3
|
+
/** The context of one workflow run, obtained with `yield* X.Workflow`. */
|
|
4
|
+
export interface WorkflowContext {
|
|
5
|
+
/** The owner actor's id. */
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly ref: ActorRef;
|
|
8
|
+
/** The principal recorded when the execution started. */
|
|
9
|
+
readonly principal: Option.Option<Principal>;
|
|
10
|
+
readonly executionId: string;
|
|
11
|
+
readonly key: string;
|
|
12
|
+
/** The marker value recorded at start; 0 for an execution older than the marker. */
|
|
13
|
+
readonly version: (name: string) => Effect.Effect<number>;
|
|
14
|
+
}
|
|
15
|
+
/** A step exit as the engine records it: the step's own codecs encode the value. */
|
|
16
|
+
export declare const RecordedExit: Schema.TaggedUnion<{
|
|
17
|
+
readonly Die: Schema.TaggedStruct<"Die", {
|
|
18
|
+
readonly message: Schema.String;
|
|
19
|
+
}>;
|
|
20
|
+
readonly Failure: Schema.TaggedStruct<"Failure", {
|
|
21
|
+
readonly error: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
22
|
+
}>;
|
|
23
|
+
readonly Success: Schema.TaggedStruct<"Success", {
|
|
24
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
/** A step exit as recorded: its encoded value, encoded declared failure, or defect message. */
|
|
28
|
+
export type RecordedExit = typeof RecordedExit.Type;
|
|
29
|
+
/** A finished execution's result: its body's exit, or an interrupt. */
|
|
30
|
+
export declare const StoredResult: Schema.TaggedUnion<{
|
|
31
|
+
readonly Die: Schema.TaggedStruct<"Die", {
|
|
32
|
+
readonly message: Schema.String;
|
|
33
|
+
}>;
|
|
34
|
+
readonly Failure: Schema.TaggedStruct<"Failure", {
|
|
35
|
+
readonly error: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
36
|
+
}>;
|
|
37
|
+
readonly Interrupt: Schema.TaggedStruct<"Interrupt", {}>;
|
|
38
|
+
readonly Success: Schema.TaggedStruct<"Success", {
|
|
39
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
40
|
+
}>;
|
|
41
|
+
}>;
|
|
42
|
+
/** A finished execution's result as stored. */
|
|
43
|
+
export type StoredResult = typeof StoredResult.Type;
|
|
44
|
+
/** What a typed constructor names when it asks the engine to run or replay it. */
|
|
45
|
+
export interface StepIdentity {
|
|
46
|
+
readonly workflow: string;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly kind: "activity" | "clock" | "wait" | "deferred";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The engine of the run the calling fiber belongs to. Only the runtime
|
|
52
|
+
* provides it, to a workflow body's fiber; constructors outside a body die.
|
|
53
|
+
*/
|
|
54
|
+
export interface WorkflowSteps {
|
|
55
|
+
readonly activity: <R>(step: StepIdentity, run: Effect.Effect<RecordedExit, never, R>) => Effect.Effect<RecordedExit, never, R>;
|
|
56
|
+
readonly sleep: (step: StepIdentity, millis: number) => Effect.Effect<void>;
|
|
57
|
+
readonly wait: (step: StepIdentity, event: string,
|
|
58
|
+
/** The stored value upcast to the event's current version when it matches; none otherwise. */
|
|
59
|
+
matches: (value: string, version: number) => Effect.Effect<Option.Option<string>>, timeoutMs: number | undefined) => Effect.Effect<Option.Option<string>>;
|
|
60
|
+
readonly race: <R>(step: StepIdentity, run: Effect.Effect<RecordedExit, never, R>) => Effect.Effect<RecordedExit, never, R>;
|
|
61
|
+
}
|
|
62
|
+
/** The engine of the workflow run the calling fiber belongs to; undefined outside a workflow body. */
|
|
63
|
+
export declare const CurrentWorkflow: Context.Reference<WorkflowSteps | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* Where the calling fiber stands for actor calls: outside any workflow, in a
|
|
66
|
+
* workflow body (where calls die), or inside an activity, which derives each
|
|
67
|
+
* call's command id.
|
|
68
|
+
*/
|
|
69
|
+
export type CallPhase = Data.TaggedEnum<{
|
|
70
|
+
None: {};
|
|
71
|
+
Body: {};
|
|
72
|
+
Activity: {
|
|
73
|
+
readonly nextCommandId: Effect.Effect<string>;
|
|
74
|
+
};
|
|
75
|
+
}>;
|
|
76
|
+
/** Constructors and matchers for `CallPhase`. */
|
|
77
|
+
export declare const CallPhase: {
|
|
78
|
+
readonly $is: <Tag extends "Activity" | "Body" | "None">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
79
|
+
readonly _tag: "Activity";
|
|
80
|
+
readonly nextCommandId: Effect.Effect<string>;
|
|
81
|
+
}, {
|
|
82
|
+
readonly _tag: Tag;
|
|
83
|
+
}> | Extract<{
|
|
84
|
+
readonly _tag: "Body";
|
|
85
|
+
}, {
|
|
86
|
+
readonly _tag: Tag;
|
|
87
|
+
}> | Extract<{
|
|
88
|
+
readonly _tag: "None";
|
|
89
|
+
}, {
|
|
90
|
+
readonly _tag: Tag;
|
|
91
|
+
}>;
|
|
92
|
+
readonly $match: {
|
|
93
|
+
<Cases extends { readonly [Tag in "Activity" | "Body" | "None"]: (args: Extract<{
|
|
94
|
+
readonly _tag: "Activity";
|
|
95
|
+
readonly nextCommandId: Effect.Effect<string>;
|
|
96
|
+
} | {
|
|
97
|
+
readonly _tag: "Body";
|
|
98
|
+
} | {
|
|
99
|
+
readonly _tag: "None";
|
|
100
|
+
}, {
|
|
101
|
+
readonly _tag: Tag;
|
|
102
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
103
|
+
readonly _tag: "Activity";
|
|
104
|
+
readonly nextCommandId: Effect.Effect<string>;
|
|
105
|
+
} | {
|
|
106
|
+
readonly _tag: "Body";
|
|
107
|
+
} | {
|
|
108
|
+
readonly _tag: "None";
|
|
109
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Activity" | "Body" | "None"]>>;
|
|
110
|
+
<Cases extends { readonly [Tag in "Activity" | "Body" | "None"]: (args: Extract<{
|
|
111
|
+
readonly _tag: "Activity";
|
|
112
|
+
readonly nextCommandId: Effect.Effect<string>;
|
|
113
|
+
} | {
|
|
114
|
+
readonly _tag: "Body";
|
|
115
|
+
} | {
|
|
116
|
+
readonly _tag: "None";
|
|
117
|
+
}, {
|
|
118
|
+
readonly _tag: Tag;
|
|
119
|
+
}>) => any; }>(value: {
|
|
120
|
+
readonly _tag: "Activity";
|
|
121
|
+
readonly nextCommandId: Effect.Effect<string>;
|
|
122
|
+
} | {
|
|
123
|
+
readonly _tag: "Body";
|
|
124
|
+
} | {
|
|
125
|
+
readonly _tag: "None";
|
|
126
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Activity" | "Body" | "None"]>>;
|
|
127
|
+
};
|
|
128
|
+
readonly Activity: Data.TaggedEnum.ConstructorFrom<{
|
|
129
|
+
readonly _tag: "Activity";
|
|
130
|
+
readonly nextCommandId: Effect.Effect<string>;
|
|
131
|
+
}, "_tag">;
|
|
132
|
+
readonly Body: Data.TaggedEnum.ConstructorFrom<{
|
|
133
|
+
readonly _tag: "Body";
|
|
134
|
+
}, "_tag">;
|
|
135
|
+
readonly None: Data.TaggedEnum.ConstructorFrom<{
|
|
136
|
+
readonly _tag: "None";
|
|
137
|
+
}, "_tag">;
|
|
138
|
+
};
|
|
139
|
+
/** The calling fiber's `CallPhase`; `None` by default. */
|
|
140
|
+
export declare const CurrentCallPhase: Context.Reference<{
|
|
141
|
+
readonly _tag: "Activity";
|
|
142
|
+
readonly nextCommandId: Effect.Effect<string>;
|
|
143
|
+
} | {
|
|
144
|
+
readonly _tag: "Body";
|
|
145
|
+
} | {
|
|
146
|
+
readonly _tag: "None";
|
|
147
|
+
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Context, Data, Schema } from "effect";
|
|
2
|
+
/** A step exit as the engine records it: the step's own codecs encode the value. */
|
|
3
|
+
export const RecordedExit = Schema.TaggedUnion({
|
|
4
|
+
Success: { value: Schema.Json },
|
|
5
|
+
Failure: { error: Schema.Json },
|
|
6
|
+
Die: { message: Schema.String },
|
|
7
|
+
});
|
|
8
|
+
/** A finished execution's result: its body's exit, or an interrupt. */
|
|
9
|
+
export const StoredResult = Schema.TaggedUnion({
|
|
10
|
+
Success: { value: Schema.Json },
|
|
11
|
+
Failure: { error: Schema.Json },
|
|
12
|
+
Die: { message: Schema.String },
|
|
13
|
+
Interrupt: {},
|
|
14
|
+
});
|
|
15
|
+
/** The engine of the workflow run the calling fiber belongs to; undefined outside a workflow body. */
|
|
16
|
+
export const CurrentWorkflow = Context.Reference("akter/CurrentWorkflow", { defaultValue: () => undefined });
|
|
17
|
+
/** Constructors and matchers for `CallPhase`. */
|
|
18
|
+
export const CallPhase = Data.taggedEnum();
|
|
19
|
+
/** The calling fiber's `CallPhase`; `None` by default. */
|
|
20
|
+
export const CurrentCallPhase = Context.Reference("akter/CurrentCallPhase", {
|
|
21
|
+
defaultValue: () => CallPhase.None(),
|
|
22
|
+
});
|