@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,17 @@
|
|
|
1
|
+
import { Context, type Effect } from "effect";
|
|
2
|
+
import type { ActorError } from "../errors/actor.ts";
|
|
3
|
+
declare const Actors_base: Context.ServiceClass<Actors, "@rikalabs/akter/handles/actors", {
|
|
4
|
+
/**
|
|
5
|
+
* Mints a command id for `Actor.commandId`, so a caller can retry one
|
|
6
|
+
* operation across processes. It reads the database clock, so it fails
|
|
7
|
+
* `ActorUnavailable` while the database is unreachable.
|
|
8
|
+
*/
|
|
9
|
+
readonly mintCommandId: Effect.Effect<string, ActorError>;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* The runtime's public service. Provide it with `Actors.layer` from
|
|
13
|
+
* `@rikalabs/akter/runtime`; handles reach the runtime through it.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Actors extends Actors_base {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Context } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The runtime's public service. Provide it with `Actors.layer` from
|
|
4
|
+
* `@rikalabs/akter/runtime`; handles reach the runtime through it.
|
|
5
|
+
*/
|
|
6
|
+
export class Actors extends Context.Service()("@rikalabs/akter/handles/actors") {
|
|
7
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Context, Effect, type Option, type Stream } from "effect";
|
|
2
|
+
import type { ActorError } from "../errors/actor.ts";
|
|
3
|
+
import type { ContentTooLarge } from "../errors/content.ts";
|
|
4
|
+
import { type ActorRef, type Caller } from "../identity/caller.ts";
|
|
5
|
+
import type { ContentRef } from "../identity/content.ts";
|
|
6
|
+
import type { AnyContent } from "../members/blob.ts";
|
|
7
|
+
declare const ContentStore_base: Context.ServiceClass<ContentStore, "@rikalabs/akter/handles/content/ContentStore", {
|
|
8
|
+
/** Stores bytes already in memory for `tenant` and returns a fresh grant. */
|
|
9
|
+
readonly uploadBytes: (tenant: string, bytes: Uint8Array) => Effect.Effect<ContentRef, ContentTooLarge | ActorError>;
|
|
10
|
+
/**
|
|
11
|
+
* Stores a body as it arrives, hashing it on the way; past `limit` bytes
|
|
12
|
+
* it fails `ContentTooLarge` and stores nothing.
|
|
13
|
+
*/
|
|
14
|
+
readonly upload: (tenant: string, body: Stream.Stream<Uint8Array, ActorError>, limit: number) => Effect.Effect<ContentRef, ContentTooLarge | ActorError>;
|
|
15
|
+
/**
|
|
16
|
+
* A fresh grant for the content `ref` references under `blob`/`name`, after
|
|
17
|
+
* the actor's `access` policy and `authorize` allow `caller` the operation `<blob>.grant`; none for a
|
|
18
|
+
* missing name or content swept meanwhile.
|
|
19
|
+
*/
|
|
20
|
+
readonly grant: (ref: ActorRef, caller: Caller, blob: string, name: string) => Effect.Effect<Option.Option<ContentRef>, ActorError>;
|
|
21
|
+
/**
|
|
22
|
+
* The referenced content's size and bytes, after the actor's `access`
|
|
23
|
+
* policy and `authorize` allow `caller` the operation `<blob>.get`; none for a missing name. The bytes
|
|
24
|
+
* come from one snapshot; content swept after the reference resolved
|
|
25
|
+
* fails the stream before any chunk.
|
|
26
|
+
*/
|
|
27
|
+
readonly download: (ref: ActorRef, caller: Caller, blob: string, name: string) => Effect.Effect<Option.Option<{
|
|
28
|
+
readonly size: number;
|
|
29
|
+
readonly bytes: Stream.Stream<Uint8Array, ActorError>;
|
|
30
|
+
}>, ActorError>;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* The runtime's content operations. They write framework rows on a tenant's
|
|
34
|
+
* shard outside any turn, so effect executors, which hold no database
|
|
35
|
+
* capability, never receive this service.
|
|
36
|
+
*/
|
|
37
|
+
export declare class ContentStore extends ContentStore_base {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Content operations for code outside turns, queries, and executors, with
|
|
41
|
+
* the ambient tenant and caller.
|
|
42
|
+
*/
|
|
43
|
+
export declare const Content: {
|
|
44
|
+
/**
|
|
45
|
+
* Stores `bytes` once for the ambient tenant, up to 64 MiB, and returns a
|
|
46
|
+
* reference whose grant lasts an hour. Uploading bytes the tenant already
|
|
47
|
+
* holds stores nothing new and returns a fresh grant.
|
|
48
|
+
*/
|
|
49
|
+
upload: (bytes: Uint8Array) => Effect.Effect<ContentRef, ContentTooLarge | ActorError, ContentStore>;
|
|
50
|
+
/**
|
|
51
|
+
* A fresh grant for the content an actor references, so another actor's
|
|
52
|
+
* turn can attach it. `access` and `authorize` see the ambient caller with kind
|
|
53
|
+
* `content` and command `<blob>.grant`. None when the actor holds no reference under `name`.
|
|
54
|
+
*/
|
|
55
|
+
grant: (actor: {
|
|
56
|
+
readonly name: string;
|
|
57
|
+
}, id: string, blob: AnyContent, name: string) => Effect.Effect<Option.Option<ContentRef>, ActorError, ContentStore>;
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Context, Effect } from "effect";
|
|
2
|
+
import { outsideTurn } from "../contexts/command.js";
|
|
3
|
+
import { CurrentCaller, Tenant } from "../identity/caller.js";
|
|
4
|
+
/**
|
|
5
|
+
* The runtime's content operations. They write framework rows on a tenant's
|
|
6
|
+
* shard outside any turn, so effect executors, which hold no database
|
|
7
|
+
* capability, never receive this service.
|
|
8
|
+
*/
|
|
9
|
+
export class ContentStore extends Context.Service()("@rikalabs/akter/handles/content/ContentStore") {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Content operations for code outside turns, queries, and executors, with
|
|
13
|
+
* the ambient tenant and caller.
|
|
14
|
+
*/
|
|
15
|
+
export const Content = {
|
|
16
|
+
/**
|
|
17
|
+
* Stores `bytes` once for the ambient tenant, up to 64 MiB, and returns a
|
|
18
|
+
* reference whose grant lasts an hour. Uploading bytes the tenant already
|
|
19
|
+
* holds stores nothing new and returns a fresh grant.
|
|
20
|
+
*/
|
|
21
|
+
upload: (bytes) => Effect.gen(function* () {
|
|
22
|
+
yield* outsideTurn;
|
|
23
|
+
const store = yield* ContentStore;
|
|
24
|
+
return yield* store.uploadBytes(yield* Tenant, bytes);
|
|
25
|
+
}),
|
|
26
|
+
/**
|
|
27
|
+
* A fresh grant for the content an actor references, so another actor's
|
|
28
|
+
* turn can attach it. `access` and `authorize` see the ambient caller with kind
|
|
29
|
+
* `content` and command `<blob>.grant`. None when the actor holds no reference under `name`.
|
|
30
|
+
*/
|
|
31
|
+
grant: (actor, id, blob, name) => Effect.gen(function* () {
|
|
32
|
+
yield* outsideTurn;
|
|
33
|
+
const store = yield* ContentStore;
|
|
34
|
+
return yield* store.grant({ tenant: yield* Tenant, actor: actor.name, id }, yield* CurrentCaller, blob.name, name);
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { Context, DateTime, Duration, Effect, Schema } from "effect";
|
|
2
|
+
import { type ActorRef, type Caller, type MintProof, type Principal } from "../identity/caller.ts";
|
|
3
|
+
/** When a staged intent becomes due: relative to the turn's commit, or at an instant. */
|
|
4
|
+
export declare const Due: Schema.TaggedUnion<{
|
|
5
|
+
readonly After: Schema.TaggedStruct<"After", {
|
|
6
|
+
readonly millis: Schema.Int;
|
|
7
|
+
}>;
|
|
8
|
+
readonly At: Schema.TaggedStruct<"At", {
|
|
9
|
+
readonly epochMillis: Schema.Int;
|
|
10
|
+
}>;
|
|
11
|
+
}>;
|
|
12
|
+
/** When a staged intent becomes due. */
|
|
13
|
+
export type Due = typeof Due.Type;
|
|
14
|
+
/** An intent a turn staged: the command to send `target`, its encoded input, and who it appears to come from. `key` names it for replacement or cancellation. */
|
|
15
|
+
interface StagedIntent {
|
|
16
|
+
readonly target: ActorRef;
|
|
17
|
+
readonly command: string;
|
|
18
|
+
readonly payload: string;
|
|
19
|
+
readonly caller: Caller;
|
|
20
|
+
readonly due: Due | undefined;
|
|
21
|
+
readonly key: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** A job a turn enqueued: its tag, encoded instance, and the caller its routes see. */
|
|
24
|
+
interface StagedJob {
|
|
25
|
+
readonly job: string;
|
|
26
|
+
readonly payload: string;
|
|
27
|
+
/** The payload version `payload` is encoded at. */
|
|
28
|
+
readonly version: number;
|
|
29
|
+
readonly caller: Caller;
|
|
30
|
+
readonly due: Due | undefined;
|
|
31
|
+
readonly key: string | undefined;
|
|
32
|
+
/** Whether the job declares `concurrency.perActor`, so its claims follow `ready_at_ms`. */
|
|
33
|
+
readonly capped: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A dynamic subscription change a turn staged: `subscribe` from a position,
|
|
37
|
+
* or `remove`. The last change a turn stages for one source wins.
|
|
38
|
+
*/
|
|
39
|
+
export interface StagedSubscription {
|
|
40
|
+
readonly subscription: string;
|
|
41
|
+
readonly source: ActorRef;
|
|
42
|
+
readonly op: "subscribe" | "remove";
|
|
43
|
+
/** `"now"`, `"start"`, or an exclusive source cursor; unused by `remove`. */
|
|
44
|
+
readonly from: string;
|
|
45
|
+
/** The declaration's event tags, which decide which of the source's commits wake the row. */
|
|
46
|
+
readonly events: ReadonlyArray<string>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Everything one turn asked the outbox to do. `replaced` lists keys whose
|
|
50
|
+
* committed rows the turn deletes before inserting `intents`;
|
|
51
|
+
* `cancelledJobs` lists job keys whose committed jobs it cancels before
|
|
52
|
+
* inserting `jobs`.
|
|
53
|
+
*/
|
|
54
|
+
export interface StagedOutbox {
|
|
55
|
+
readonly intents: ReadonlyArray<StagedIntent>;
|
|
56
|
+
readonly replaced: ReadonlyArray<string>;
|
|
57
|
+
readonly jobs: ReadonlyArray<StagedJob>;
|
|
58
|
+
readonly subscriptions: ReadonlyArray<StagedSubscription>;
|
|
59
|
+
readonly cancelledJobs: ReadonlyArray<string>;
|
|
60
|
+
}
|
|
61
|
+
/** The outbox of a turn that staged nothing. */
|
|
62
|
+
export declare const emptyOutbox: StagedOutbox;
|
|
63
|
+
/** Job keys live in the actor's key namespace under this prefix, which intent keys may not use. */
|
|
64
|
+
export declare const JOB_KEY_PREFIX = "$job:";
|
|
65
|
+
declare const InTurn_base: Context.ServiceClass<InTurn, "@rikalabs/akter/handles/intents/InTurn", {
|
|
66
|
+
readonly turn: symbol;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Marks a command turn. Only the runtime provides it, and `X.toLayer` removes
|
|
70
|
+
* it from handler requirements, so `X.intents` and `Intent.cancel` outside a
|
|
71
|
+
* command turn leave an unsatisfiable requirement.
|
|
72
|
+
*/
|
|
73
|
+
export declare class InTurn extends InTurn_base {
|
|
74
|
+
}
|
|
75
|
+
interface Minted {
|
|
76
|
+
readonly child: ActorRef;
|
|
77
|
+
readonly createdBy: string;
|
|
78
|
+
readonly proof: MintProof;
|
|
79
|
+
}
|
|
80
|
+
interface Staging {
|
|
81
|
+
readonly sender: ActorRef;
|
|
82
|
+
readonly commandId: string;
|
|
83
|
+
/** The sender's event sequence before this turn's emits. */
|
|
84
|
+
readonly head: string;
|
|
85
|
+
readonly onBehalfOf: Principal | undefined;
|
|
86
|
+
readonly minted: Map<string, Minted>;
|
|
87
|
+
open: boolean;
|
|
88
|
+
intents: Array<StagedIntent>;
|
|
89
|
+
readonly replaced: Set<string>;
|
|
90
|
+
jobs: Array<StagedJob>;
|
|
91
|
+
readonly subscriptions: Map<string, StagedSubscription>;
|
|
92
|
+
readonly cancelledJobs: Set<string>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Opens the outbox of one command turn; `close` returns what it staged and
|
|
96
|
+
* seals it. A staged job's routes deliver to the enqueuing actor as the job,
|
|
97
|
+
* on the turn's principal.
|
|
98
|
+
*/
|
|
99
|
+
export declare const openOutbox: ({ sender, commandId, head, onBehalfOf, }: {
|
|
100
|
+
readonly sender: ActorRef;
|
|
101
|
+
readonly commandId: string;
|
|
102
|
+
readonly head: string;
|
|
103
|
+
readonly onBehalfOf: Principal | undefined;
|
|
104
|
+
}) => {
|
|
105
|
+
marker: {
|
|
106
|
+
readonly turn: symbol;
|
|
107
|
+
};
|
|
108
|
+
/** Stages a job; the caller checks that its turn is still running. */
|
|
109
|
+
enqueue: (job: Pick<StagedJob, "job" | "payload" | "version" | "due" | "key" | "capped">) => void;
|
|
110
|
+
/** Stages the cancellation of the job with `key`; the caller checks the turn. */
|
|
111
|
+
cancelJob: (key: string) => void;
|
|
112
|
+
/** The proof the next `turn.mint` call of this turn carries. */
|
|
113
|
+
nextMint: () => MintProof;
|
|
114
|
+
/** Records a minted id; its creating intent then carries `proof`. */
|
|
115
|
+
minted: (child: ActorRef, createdBy: string, proof: MintProof) => void;
|
|
116
|
+
/** A minted actor that no staged intent to its creating command targets, if any. */
|
|
117
|
+
uncreated: () => ActorRef | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* A minted actor whose creating intent has a key, if any: a later keyed
|
|
120
|
+
* intent or cancel could remove it before delivery and leave the id uncreated.
|
|
121
|
+
*/
|
|
122
|
+
keyedCreation: () => ActorRef | undefined;
|
|
123
|
+
/** Stages a subscription change; a later change for the same source replaces it. */
|
|
124
|
+
subscribe: (change: StagedSubscription) => void;
|
|
125
|
+
close: () => StagedOutbox;
|
|
126
|
+
};
|
|
127
|
+
/** Validates a job key (1-200 characters) and returns it prefixed as it is staged and stored. */
|
|
128
|
+
export declare const jobKey: (key: string) => string;
|
|
129
|
+
/** The staging area of the running turn, checked against `marker` when given; dies once the turn ended, so a capability that escaped its turn stages nothing. */
|
|
130
|
+
export declare const currentStaging: (marker?: {
|
|
131
|
+
readonly turn: symbol;
|
|
132
|
+
} | undefined) => Effect.Effect<{
|
|
133
|
+
marker: {
|
|
134
|
+
readonly turn: symbol;
|
|
135
|
+
};
|
|
136
|
+
staging: Staging;
|
|
137
|
+
}, never, InTurn>;
|
|
138
|
+
/**
|
|
139
|
+
* Stages `intent` in the running turn's outbox with the ambient `Intent`
|
|
140
|
+
* settings. The receiver sees the sending actor, attributed to the sending
|
|
141
|
+
* turn's principal; only a minted child's creating intent carries the proof
|
|
142
|
+
* that lets it create the child.
|
|
143
|
+
*/
|
|
144
|
+
export declare const stageIntent: (marker: {
|
|
145
|
+
readonly turn: symbol;
|
|
146
|
+
}, intent: Pick<StagedIntent, "command" | "payload" | "target">) => Effect.Effect<void, never, InTurn>;
|
|
147
|
+
/**
|
|
148
|
+
* Options for intents staged by the piped Effect. The outermost setting wins,
|
|
149
|
+
* so a later `pipe` step overrides an earlier one.
|
|
150
|
+
*/
|
|
151
|
+
export declare const Intent: {
|
|
152
|
+
/** Delivers no earlier than `duration` after the turn commits. */
|
|
153
|
+
after: (duration: Duration.Input) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
154
|
+
/** Delivers no earlier than `instant`, measured on the database clock. */
|
|
155
|
+
at: (instant: DateTime.DateTime) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
156
|
+
/**
|
|
157
|
+
* Names the intent within its sending actor. Staging another intent with the
|
|
158
|
+
* same key, in this turn or a later one, replaces it while it is pending.
|
|
159
|
+
*/
|
|
160
|
+
key: (key: string) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
161
|
+
/** Removes the sending actor's pending intent with `key` when this turn commits. */
|
|
162
|
+
cancel: (key: string) => Effect.Effect<void, never, InTurn>;
|
|
163
|
+
};
|
|
164
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Context, DateTime, Duration, Effect, Schema } from "effect";
|
|
2
|
+
import { System, } from "../identity/caller.js";
|
|
3
|
+
/** When a staged intent becomes due: relative to the turn's commit, or at an instant. */
|
|
4
|
+
export const Due = Schema.TaggedUnion({
|
|
5
|
+
After: { millis: Schema.Int },
|
|
6
|
+
At: { epochMillis: Schema.Int },
|
|
7
|
+
});
|
|
8
|
+
/** The outbox of a turn that staged nothing. */
|
|
9
|
+
export const emptyOutbox = {
|
|
10
|
+
intents: [],
|
|
11
|
+
replaced: [],
|
|
12
|
+
jobs: [],
|
|
13
|
+
subscriptions: [],
|
|
14
|
+
cancelledJobs: [],
|
|
15
|
+
};
|
|
16
|
+
/** Job keys live in the actor's key namespace under this prefix, which intent keys may not use. */
|
|
17
|
+
export const JOB_KEY_PREFIX = "$job:";
|
|
18
|
+
const checkKey = (what, key) => {
|
|
19
|
+
if (key.length === 0 || key.length > 200)
|
|
20
|
+
throw new Error(`${what} must be 1-200 characters`);
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Outbox keys the framework writes: `$`-prefixed keys and JSON arrays whose
|
|
24
|
+
* first element is `$`-prefixed. An application key of that shape could
|
|
25
|
+
* replace or cancel a framework row of the same actor.
|
|
26
|
+
*/
|
|
27
|
+
const isFrameworkKey = (key) => key.startsWith("$") || key.startsWith('["$');
|
|
28
|
+
/**
|
|
29
|
+
* Marks a command turn. Only the runtime provides it, and `X.toLayer` removes
|
|
30
|
+
* it from handler requirements, so `X.intents` and `Intent.cancel` outside a
|
|
31
|
+
* command turn leave an unsatisfiable requirement.
|
|
32
|
+
*/
|
|
33
|
+
export class InTurn extends Context.Service()("@rikalabs/akter/handles/intents/InTurn") {
|
|
34
|
+
}
|
|
35
|
+
/** Keyed by the provided marker, so a hand-built `InTurn` value stages nothing. */
|
|
36
|
+
const stagings = new WeakMap();
|
|
37
|
+
const mintKey = (ref) => JSON.stringify([ref.actor, ref.id]);
|
|
38
|
+
const isSystem = Schema.is(System);
|
|
39
|
+
const creates = (intent, child, createdBy) => intent.command === createdBy &&
|
|
40
|
+
intent.target.actor === child.actor &&
|
|
41
|
+
intent.target.id === child.id;
|
|
42
|
+
/**
|
|
43
|
+
* Opens the outbox of one command turn; `close` returns what it staged and
|
|
44
|
+
* seals it. A staged job's routes deliver to the enqueuing actor as the job,
|
|
45
|
+
* on the turn's principal.
|
|
46
|
+
*/
|
|
47
|
+
export const openOutbox = ({ sender, commandId, head, onBehalfOf, }) => {
|
|
48
|
+
const marker = InTurn.of({ turn: Symbol() });
|
|
49
|
+
const staging = {
|
|
50
|
+
sender,
|
|
51
|
+
commandId,
|
|
52
|
+
head,
|
|
53
|
+
onBehalfOf,
|
|
54
|
+
minted: new Map(),
|
|
55
|
+
open: true,
|
|
56
|
+
intents: [],
|
|
57
|
+
replaced: new Set(),
|
|
58
|
+
jobs: [],
|
|
59
|
+
subscriptions: new Map(),
|
|
60
|
+
cancelledJobs: new Set(),
|
|
61
|
+
};
|
|
62
|
+
stagings.set(marker, staging);
|
|
63
|
+
return {
|
|
64
|
+
marker,
|
|
65
|
+
/** Stages a job; the caller checks that its turn is still running. */
|
|
66
|
+
enqueue: (job) => {
|
|
67
|
+
if (job.key !== undefined)
|
|
68
|
+
cancelJobKey(staging, job.key);
|
|
69
|
+
staging.jobs.push({
|
|
70
|
+
...job,
|
|
71
|
+
caller: System.make({ source: "job", ref: sender, onBehalfOf }),
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
/** Stages the cancellation of the job with `key`; the caller checks the turn. */
|
|
75
|
+
cancelJob: (key) => cancelJobKey(staging, key),
|
|
76
|
+
/** The proof the next `turn.mint` call of this turn carries. */
|
|
77
|
+
nextMint: () => ({ commandId, ordinal: staging.minted.size }),
|
|
78
|
+
/** Records a minted id; its creating intent then carries `proof`. */
|
|
79
|
+
minted: (child, createdBy, proof) => {
|
|
80
|
+
staging.minted.set(mintKey(child), { child, createdBy, proof });
|
|
81
|
+
staging.intents = staging.intents.map((intent) => creates(intent, child, createdBy) && isSystem(intent.caller)
|
|
82
|
+
? {
|
|
83
|
+
...intent,
|
|
84
|
+
caller: System.make({
|
|
85
|
+
source: intent.caller.source,
|
|
86
|
+
ref: intent.caller.ref,
|
|
87
|
+
onBehalfOf: intent.caller.onBehalfOf,
|
|
88
|
+
mint: proof,
|
|
89
|
+
}),
|
|
90
|
+
}
|
|
91
|
+
: intent);
|
|
92
|
+
},
|
|
93
|
+
/** A minted actor that no staged intent to its creating command targets, if any. */
|
|
94
|
+
uncreated: () => {
|
|
95
|
+
for (const { child, createdBy, proof } of staging.minted.values())
|
|
96
|
+
if (!staging.intents.some((intent) => creates(intent, child, createdBy) &&
|
|
97
|
+
isSystem(intent.caller) &&
|
|
98
|
+
intent.caller.mint?.commandId === proof.commandId &&
|
|
99
|
+
intent.caller.mint.ordinal === proof.ordinal))
|
|
100
|
+
return child;
|
|
101
|
+
return undefined;
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* A minted actor whose creating intent has a key, if any: a later keyed
|
|
105
|
+
* intent or cancel could remove it before delivery and leave the id uncreated.
|
|
106
|
+
*/
|
|
107
|
+
keyedCreation: () => {
|
|
108
|
+
for (const { child, createdBy } of staging.minted.values())
|
|
109
|
+
if (staging.intents.some((intent) => creates(intent, child, createdBy) && intent.key !== undefined))
|
|
110
|
+
return child;
|
|
111
|
+
return undefined;
|
|
112
|
+
},
|
|
113
|
+
/** Stages a subscription change; a later change for the same source replaces it. */
|
|
114
|
+
subscribe: (change) => {
|
|
115
|
+
staging.subscriptions.set(JSON.stringify([change.subscription, change.source.actor, change.source.id]), change);
|
|
116
|
+
},
|
|
117
|
+
close: () => {
|
|
118
|
+
staging.open = false;
|
|
119
|
+
return {
|
|
120
|
+
intents: staging.intents,
|
|
121
|
+
replaced: [...staging.replaced],
|
|
122
|
+
jobs: staging.jobs,
|
|
123
|
+
subscriptions: [...staging.subscriptions.values()],
|
|
124
|
+
cancelledJobs: [...staging.cancelledJobs],
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
const IntentSettings = Context.Reference("akter/IntentSettings", {
|
|
130
|
+
defaultValue: () => ({}),
|
|
131
|
+
});
|
|
132
|
+
/** Validates a job key (1-200 characters) and returns it prefixed as it is staged and stored. */
|
|
133
|
+
export const jobKey = (key) => {
|
|
134
|
+
checkKey("A job key", key);
|
|
135
|
+
return `${JOB_KEY_PREFIX}${key}`;
|
|
136
|
+
};
|
|
137
|
+
const cancelJobKey = (staging, key) => {
|
|
138
|
+
staging.jobs = staging.jobs.filter((job) => job.key !== key);
|
|
139
|
+
staging.cancelledJobs.add(key);
|
|
140
|
+
};
|
|
141
|
+
const replaceKey = (staging, key) => {
|
|
142
|
+
staging.intents = staging.intents.filter((intent) => intent.key !== key);
|
|
143
|
+
staging.replaced.add(key);
|
|
144
|
+
};
|
|
145
|
+
/** The staging area of the running turn, checked against `marker` when given; dies once the turn ended, so a capability that escaped its turn stages nothing. */
|
|
146
|
+
export const currentStaging = Effect.fnUntraced(function* (marker) {
|
|
147
|
+
const current = yield* InTurn;
|
|
148
|
+
const staging = stagings.get(current);
|
|
149
|
+
if (staging === undefined || !staging.open || (marker !== undefined && marker !== current))
|
|
150
|
+
return yield* Effect.die(new Error("Intent capability escaped its turn"));
|
|
151
|
+
return { marker: current, staging };
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* Stages `intent` in the running turn's outbox with the ambient `Intent`
|
|
155
|
+
* settings. The receiver sees the sending actor, attributed to the sending
|
|
156
|
+
* turn's principal; only a minted child's creating intent carries the proof
|
|
157
|
+
* that lets it create the child.
|
|
158
|
+
*/
|
|
159
|
+
export const stageIntent = Effect.fnUntraced(function* (marker, intent) {
|
|
160
|
+
const { staging } = yield* currentStaging(marker);
|
|
161
|
+
const { due, key } = yield* IntentSettings;
|
|
162
|
+
const minted = staging.minted.get(mintKey(intent.target));
|
|
163
|
+
const attribution = {
|
|
164
|
+
source: due === undefined ? "actor" : "timer",
|
|
165
|
+
ref: staging.sender,
|
|
166
|
+
onBehalfOf: staging.onBehalfOf,
|
|
167
|
+
};
|
|
168
|
+
const caller = minted?.createdBy === intent.command
|
|
169
|
+
? System.make({ ...attribution, mint: minted.proof })
|
|
170
|
+
: System.make(attribution);
|
|
171
|
+
if (key !== undefined)
|
|
172
|
+
replaceKey(staging, key);
|
|
173
|
+
staging.intents.push({ ...intent, due, key, caller });
|
|
174
|
+
});
|
|
175
|
+
const configure = (options) => (self) => Effect.gen(function* () {
|
|
176
|
+
const outer = yield* IntentSettings;
|
|
177
|
+
return yield* Effect.provideService(self, IntentSettings, { ...options, ...outer });
|
|
178
|
+
});
|
|
179
|
+
/**
|
|
180
|
+
* Options for intents staged by the piped Effect. The outermost setting wins,
|
|
181
|
+
* so a later `pipe` step overrides an earlier one.
|
|
182
|
+
*/
|
|
183
|
+
export const Intent = {
|
|
184
|
+
/** Delivers no earlier than `duration` after the turn commits. */
|
|
185
|
+
after: (duration) => {
|
|
186
|
+
const millis = Duration.toMillis(duration);
|
|
187
|
+
if (!Number.isFinite(millis) || millis < 0)
|
|
188
|
+
throw new Error("Intent.after needs a finite, non-negative duration");
|
|
189
|
+
return configure({ due: Due.cases.After.make({ millis: Math.ceil(millis) }) });
|
|
190
|
+
},
|
|
191
|
+
/** Delivers no earlier than `instant`, measured on the database clock. */
|
|
192
|
+
at: (instant) => configure({ due: Due.cases.At.make({ epochMillis: DateTime.toEpochMillis(instant) }) }),
|
|
193
|
+
/**
|
|
194
|
+
* Names the intent within its sending actor. Staging another intent with the
|
|
195
|
+
* same key, in this turn or a later one, replaces it while it is pending.
|
|
196
|
+
*/
|
|
197
|
+
key: (key) => {
|
|
198
|
+
checkKey("Intent.key", key);
|
|
199
|
+
if (key.startsWith(JOB_KEY_PREFIX))
|
|
200
|
+
throw new Error(`Intent key "${key}" is reserved for jobs`);
|
|
201
|
+
if (isFrameworkKey(key))
|
|
202
|
+
throw new Error("Intent.key values starting with $ are reserved");
|
|
203
|
+
return configure({ key });
|
|
204
|
+
},
|
|
205
|
+
/** Removes the sending actor's pending intent with `key` when this turn commits. */
|
|
206
|
+
cancel: (key) => Effect.gen(function* () {
|
|
207
|
+
if (key.startsWith(JOB_KEY_PREFIX))
|
|
208
|
+
return yield* Effect.die(new Error(`Intent key "${key}" is reserved for jobs`));
|
|
209
|
+
if (isFrameworkKey(key))
|
|
210
|
+
return yield* Effect.die(new Error("Intent.key values starting with $ are reserved"));
|
|
211
|
+
const { staging } = yield* currentStaging();
|
|
212
|
+
replaceKey(staging, key);
|
|
213
|
+
}),
|
|
214
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Effect, Exit, Option } from "effect";
|
|
2
|
+
import { Workflow as EffectWorkflow } from "effect/workflow";
|
|
3
|
+
import { type RecordedExit } from "../contexts/workflow.ts";
|
|
4
|
+
import type { ActorError } from "../errors/actor.ts";
|
|
5
|
+
import type { AnyWorkflow } from "../members/workflow.ts";
|
|
6
|
+
import type { WorkflowStatus } from "../runtime/members.ts";
|
|
7
|
+
type PollReason = "ActorUnavailable" | "Unauthorized" | "Timeout";
|
|
8
|
+
type CommandReason = "ActorUnavailable" | "CommandConflict" | "CommandExpired" | "InvalidCommandId" | "Unauthorized" | "Timeout" | "RunnerAtCapacity";
|
|
9
|
+
/** One workflow execution, from a start or `X.run(member, executionId)`. */
|
|
10
|
+
export interface WorkflowRun<W extends AnyWorkflow> {
|
|
11
|
+
readonly executionId: string;
|
|
12
|
+
/** `None` for an unknown execution; `Suspended` until it finishes. */
|
|
13
|
+
readonly poll: Effect.Effect<Option.Option<EffectWorkflow.Result<W["success"]["Type"], W["error"]["Type"]>>, ActorError.Of<PollReason>>;
|
|
14
|
+
/** Polls until the execution finishes; an interrupted execution interrupts. */
|
|
15
|
+
readonly result: Effect.Effect<W["success"]["Type"], W["error"]["Type"] | ActorError.Of<PollReason>>;
|
|
16
|
+
/** Durably interrupts the execution; idempotent, and a no-op once it finished. */
|
|
17
|
+
readonly interrupt: Effect.Effect<void, ActorError.Of<CommandReason>>;
|
|
18
|
+
}
|
|
19
|
+
/** Builds the run of one execution from its owner's poll and interrupt. */
|
|
20
|
+
export declare const workflowRun: <W extends AnyWorkflow>(options: {
|
|
21
|
+
readonly executionId: string;
|
|
22
|
+
readonly poll: Effect.Effect<WorkflowStatus | undefined, ActorError>;
|
|
23
|
+
readonly interrupt: Effect.Effect<void, ActorError>;
|
|
24
|
+
readonly decode: (recorded: RecordedExit) => Effect.Effect<Exit.Exit<W["success"]["Type"], W["error"]["Type"]>>;
|
|
25
|
+
}) => {
|
|
26
|
+
executionId: string;
|
|
27
|
+
poll: Effect.Effect<Option.Option<EffectWorkflow.Result<W["success"]["Type"], W["error"]["Type"]>>, ActorError, never>;
|
|
28
|
+
result: Effect.Effect<W["success"]["Type"], ActorError | W["error"]["Type"], never>;
|
|
29
|
+
interrupt: Effect.Effect<void, ActorError, never>;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Effect, Exit, Option, Schedule } from "effect";
|
|
2
|
+
import { Workflow as EffectWorkflow } from "effect/workflow";
|
|
3
|
+
import { StoredResult } from "../contexts/workflow.js";
|
|
4
|
+
const RESULT_POLL = Schedule.spaced("100 millis");
|
|
5
|
+
/** Builds the run of one execution from its owner's poll and interrupt. */
|
|
6
|
+
export const workflowRun = (options) => {
|
|
7
|
+
const poll = Effect.gen(function* () {
|
|
8
|
+
const status = yield* options.poll;
|
|
9
|
+
if (status === undefined)
|
|
10
|
+
return Option.none();
|
|
11
|
+
if (!status.finished || status.result === undefined)
|
|
12
|
+
return Option.some(EffectWorkflow.Suspended.make({}));
|
|
13
|
+
const recorded = status.result;
|
|
14
|
+
const exit = StoredResult.guards.Interrupt(recorded)
|
|
15
|
+
? Exit.interrupt()
|
|
16
|
+
: yield* options.decode(recorded);
|
|
17
|
+
return Option.some(new EffectWorkflow.Complete({ exit }));
|
|
18
|
+
});
|
|
19
|
+
const result = poll.pipe(Effect.map(Option.filter((found) => found instanceof EffectWorkflow.Complete)), Effect.repeat({ until: Option.isSome, schedule: RESULT_POLL }), Effect.flatMap((found) => Option.getOrThrow(found).exit));
|
|
20
|
+
return { executionId: options.executionId, poll, result, interrupt: options.interrupt };
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** The framework command that starts a workflow execution; its payload is a `StartPayload`. */
|
|
3
|
+
export declare const START = "$workflow/start";
|
|
4
|
+
/** The framework command that re-runs an execution's body after a wake, timer, or new event; its payload is an `ExecutionTarget`. */
|
|
5
|
+
export declare const RESUME = "$workflow/resume";
|
|
6
|
+
/** The framework command that durably interrupts an execution; its payload is an `ExecutionTarget`. */
|
|
7
|
+
export declare const INTERRUPT = "$workflow/interrupt";
|
|
8
|
+
/** Names one execution in a resume or interrupt payload. */
|
|
9
|
+
export declare const ExecutionTarget: Schema.fromJsonString<Schema.Struct<{
|
|
10
|
+
readonly executionId: Schema.String;
|
|
11
|
+
}>>;
|
|
12
|
+
/**
|
|
13
|
+
* A workflow start staged as an intent. `after` is the owner's event
|
|
14
|
+
* sequence before the staging turn's emits when the owner staged it, so its
|
|
15
|
+
* waits see every owner event from that turn on, even ones committed before
|
|
16
|
+
* the start is delivered.
|
|
17
|
+
*/
|
|
18
|
+
export declare const StartPayload: Schema.fromJsonString<Schema.Struct<{
|
|
19
|
+
readonly workflow: Schema.String;
|
|
20
|
+
readonly input: Schema.String;
|
|
21
|
+
readonly key: Schema.String;
|
|
22
|
+
readonly after: Schema.NullOr<Schema.String>;
|
|
23
|
+
}>>;
|
|
24
|
+
/** A start's output: the execution id. */
|
|
25
|
+
export declare const ExecutionIdOutput: Schema.fromJsonString<Schema.Struct<{
|
|
26
|
+
readonly value: Schema.String;
|
|
27
|
+
}>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** The framework command that starts a workflow execution; its payload is a `StartPayload`. */
|
|
3
|
+
export const START = "$workflow/start";
|
|
4
|
+
/** The framework command that re-runs an execution's body after a wake, timer, or new event; its payload is an `ExecutionTarget`. */
|
|
5
|
+
export const RESUME = "$workflow/resume";
|
|
6
|
+
/** The framework command that durably interrupts an execution; its payload is an `ExecutionTarget`. */
|
|
7
|
+
export const INTERRUPT = "$workflow/interrupt";
|
|
8
|
+
/** Names one execution in a resume or interrupt payload. */
|
|
9
|
+
export const ExecutionTarget = Schema.fromJsonString(Schema.Struct({ executionId: Schema.String }));
|
|
10
|
+
/**
|
|
11
|
+
* A workflow start staged as an intent. `after` is the owner's event
|
|
12
|
+
* sequence before the staging turn's emits when the owner staged it, so its
|
|
13
|
+
* waits see every owner event from that turn on, even ones committed before
|
|
14
|
+
* the start is delivered.
|
|
15
|
+
*/
|
|
16
|
+
export const StartPayload = Schema.fromJsonString(Schema.Struct({
|
|
17
|
+
workflow: Schema.String,
|
|
18
|
+
input: Schema.String,
|
|
19
|
+
key: Schema.String,
|
|
20
|
+
after: Schema.NullOr(Schema.String),
|
|
21
|
+
}));
|
|
22
|
+
/** A start's output: the execution id. */
|
|
23
|
+
export const ExecutionIdOutput = Schema.fromJsonString(Schema.Struct({ value: Schema.String }));
|