@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,381 @@
|
|
|
1
|
+
import { type Context, type Effect, type Exit, type Option, Schema, type Scope, type Stream } from "effect";
|
|
2
|
+
import type { Access } from "../policies/access.ts";
|
|
3
|
+
import type { SubscriptionFailure } from "../errors/subscription.ts";
|
|
4
|
+
import type { RetentionGap, UnknownCursor } from "../errors/events.ts";
|
|
5
|
+
import type { ActorRef, Caller, Principal } from "../identity/caller.ts";
|
|
6
|
+
import type { Placement } from "./storage/codec.ts";
|
|
7
|
+
import type { ConnectionCommands } from "../identity/connection.ts";
|
|
8
|
+
import type { TurnPolicy } from "../policies/command.ts";
|
|
9
|
+
import type { CronEntry } from "./cron/schedule.ts";
|
|
10
|
+
import type { StagedOutbox } from "../handles/intents.ts";
|
|
11
|
+
import type { AnyBlob } from "../members/blob.ts";
|
|
12
|
+
import type { AnyOwnedTable } from "../tables/owned.ts";
|
|
13
|
+
import type { RecordedExit, StoredResult, WorkflowContext } from "../contexts/workflow.ts";
|
|
14
|
+
import type { ReadSet } from "./connections/reads.ts";
|
|
15
|
+
import type { AnyWorkflow } from "../members/workflow.ts";
|
|
16
|
+
import type { PayloadDeclaration } from "../members/payload.ts";
|
|
17
|
+
import type { Outcome, Request } from "./request.ts";
|
|
18
|
+
/** What a command handler leaves for the turn to commit: its outcome, the state to store, and the events, intents, and frames it staged. */
|
|
19
|
+
export interface BusinessResult {
|
|
20
|
+
readonly outcome: Outcome;
|
|
21
|
+
readonly state: ReadonlyArray<readonly [string, string]>;
|
|
22
|
+
/** `state` lists every stored key; the turn deletes any other stored key. */
|
|
23
|
+
readonly complete: boolean;
|
|
24
|
+
/** Encoded events in emit order, appended with the commit. */
|
|
25
|
+
readonly events: ReadonlyArray<EmittedEvent>;
|
|
26
|
+
/** Intents and jobs to commit with the turn; a declared failure stages none. */
|
|
27
|
+
readonly outbox: StagedOutbox;
|
|
28
|
+
/** Frames to send to open connections once the turn commits; a declared failure sends none. */
|
|
29
|
+
readonly broadcasts?: ReadonlyArray<Broadcast>;
|
|
30
|
+
/** The declared tables and blobs the turn wrote; a declared failure wrote none. */
|
|
31
|
+
readonly writes?: {
|
|
32
|
+
readonly tables: ReadonlyArray<string>;
|
|
33
|
+
readonly blobs: ReadonlyArray<string>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** One encoded frame for a connection member's open connections. */
|
|
37
|
+
export interface Broadcast {
|
|
38
|
+
readonly member: string;
|
|
39
|
+
readonly frame: string;
|
|
40
|
+
/** The cursor of the event the frame was sent from. */
|
|
41
|
+
readonly event?: string | undefined;
|
|
42
|
+
readonly to?: ReadonlyArray<string> | undefined;
|
|
43
|
+
readonly except?: ReadonlyArray<string> | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** An open connection as a turn or connection handler lists it. */
|
|
46
|
+
export interface OpenConnection {
|
|
47
|
+
readonly connectionId: string;
|
|
48
|
+
readonly caller: Caller;
|
|
49
|
+
readonly session: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/** Lists one connection member's open connections. */
|
|
52
|
+
export type ConnectionLister = (member: string) => Effect.Effect<ReadonlyArray<OpenConnection>>;
|
|
53
|
+
/** One event a turn emitted, encoded for the append. */
|
|
54
|
+
export interface EmittedEvent {
|
|
55
|
+
readonly tag: string;
|
|
56
|
+
readonly value: string;
|
|
57
|
+
/** The payload version `value` is encoded at. */
|
|
58
|
+
readonly version: number;
|
|
59
|
+
}
|
|
60
|
+
/** One committed event as the log returns it. */
|
|
61
|
+
export interface StoredEvent {
|
|
62
|
+
readonly cursor: string;
|
|
63
|
+
readonly commandId: string;
|
|
64
|
+
readonly value: string;
|
|
65
|
+
/** The payload version `value` was written at; readers upcast it through the class's chain. */
|
|
66
|
+
readonly version: number;
|
|
67
|
+
readonly timestampMs: number;
|
|
68
|
+
}
|
|
69
|
+
/** Reads one actor's committed events of one tag after an exclusive cursor, up to the query's snapshot. */
|
|
70
|
+
export type EventReader = (tag: string, after: string | undefined, limit: number) => Effect.Effect<ReadonlyArray<StoredEvent>, UnknownCursor | RetentionGap>;
|
|
71
|
+
/** A command bound to its handler when the actor's layer was built. */
|
|
72
|
+
export interface RegisteredCommand {
|
|
73
|
+
readonly internal: boolean;
|
|
74
|
+
/** Named as a subscription's handler: only subscription deliveries reach it. */
|
|
75
|
+
readonly handler: boolean;
|
|
76
|
+
readonly run: (request: Request, state: ReadonlyArray<readonly [string, string]>, turn: {
|
|
77
|
+
/** The actor's event sequence before this turn's emits. */
|
|
78
|
+
readonly head: string;
|
|
79
|
+
readonly connections?: ConnectionLister | undefined;
|
|
80
|
+
}) => Effect.Effect<BusinessResult, BusinessResult>;
|
|
81
|
+
/**
|
|
82
|
+
* A commutative reducer's merged turn: the inputs of `requests`, combined
|
|
83
|
+
* in order, reduced once. Every request's outcome is the one `outcome`, and
|
|
84
|
+
* the merge law makes the state equal to applying them one at a time.
|
|
85
|
+
*/
|
|
86
|
+
readonly merge?: (requests: ReadonlyArray<Request>, state: ReadonlyArray<readonly [string, string]>) => Effect.Effect<BusinessResult>;
|
|
87
|
+
}
|
|
88
|
+
/** What one connection handler is asked to do. */
|
|
89
|
+
export declare const ConnectionPhase: Schema.TaggedUnion<{
|
|
90
|
+
readonly Close: Schema.TaggedStruct<"Close", {
|
|
91
|
+
readonly reason: Schema.String;
|
|
92
|
+
}>;
|
|
93
|
+
readonly Frame: Schema.TaggedStruct<"Frame", {
|
|
94
|
+
readonly frame: Schema.String;
|
|
95
|
+
}>;
|
|
96
|
+
readonly Open: Schema.TaggedStruct<"Open", {
|
|
97
|
+
readonly params: Schema.String;
|
|
98
|
+
}>;
|
|
99
|
+
readonly Resync: Schema.TaggedStruct<"Resync", {
|
|
100
|
+
readonly after: Schema.UndefinedOr<Schema.String>;
|
|
101
|
+
}>;
|
|
102
|
+
}>;
|
|
103
|
+
/** One connection handler phase. */
|
|
104
|
+
export type ConnectionPhase = typeof ConnectionPhase.Type;
|
|
105
|
+
/** The committed view and capabilities one connection handler runs with. */
|
|
106
|
+
interface ConnectionInput {
|
|
107
|
+
readonly ref: ActorRef;
|
|
108
|
+
readonly connectionId: string;
|
|
109
|
+
readonly member: string;
|
|
110
|
+
readonly caller: Caller;
|
|
111
|
+
readonly resumed: boolean;
|
|
112
|
+
readonly cursor: string;
|
|
113
|
+
readonly state: ReadonlyArray<readonly [string, string]>;
|
|
114
|
+
readonly session: string | undefined;
|
|
115
|
+
readonly connections: ConnectionLister;
|
|
116
|
+
readonly events: EventReader;
|
|
117
|
+
/** Present for open and frame phases, so command calls get redelivery-stable ids. */
|
|
118
|
+
readonly commands?: ConnectionCommands | undefined;
|
|
119
|
+
}
|
|
120
|
+
/** What a connection handler leaves to write and send once it returns. */
|
|
121
|
+
export interface ConnectionResult {
|
|
122
|
+
/** The encoded session after the handler, or undefined when it has none. */
|
|
123
|
+
readonly session: string | undefined;
|
|
124
|
+
readonly changed: boolean;
|
|
125
|
+
readonly sends: ReadonlyArray<{
|
|
126
|
+
readonly frame: string;
|
|
127
|
+
readonly event?: string | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
readonly broadcasts: ReadonlyArray<Broadcast>;
|
|
130
|
+
readonly close: boolean;
|
|
131
|
+
}
|
|
132
|
+
/** A connection member bound to its handler. */
|
|
133
|
+
export interface RegisteredConnection {
|
|
134
|
+
readonly stampCursor: boolean;
|
|
135
|
+
/** Job tags whose progress this member receives, and its audience. */
|
|
136
|
+
readonly progress: {
|
|
137
|
+
readonly jobs: ReadonlySet<string>;
|
|
138
|
+
readonly to: "principal" | "all";
|
|
139
|
+
} | undefined;
|
|
140
|
+
readonly hasResync: boolean;
|
|
141
|
+
/** Fails with an encoded declared error only while opening. */
|
|
142
|
+
readonly run: (input: ConnectionInput, phase: ConnectionPhase) => Effect.Effect<ConnectionResult, {
|
|
143
|
+
readonly failure: string;
|
|
144
|
+
}>;
|
|
145
|
+
}
|
|
146
|
+
/** The committed view one stream handler starts from, and its live event feed. */
|
|
147
|
+
export interface StreamInput {
|
|
148
|
+
readonly ref: ActorRef;
|
|
149
|
+
readonly caller: Caller;
|
|
150
|
+
/** The committed event head when the subscription started. */
|
|
151
|
+
readonly cursor: string;
|
|
152
|
+
readonly state: ReadonlyArray<readonly [string, string]>;
|
|
153
|
+
readonly events: EventReader;
|
|
154
|
+
/** Committed events of one tag after `after`, then each one as its turn commits. */
|
|
155
|
+
readonly follow: (tag: string, after: string | undefined) => Stream.Stream<StoredEvent, UnknownCursor | RetentionGap>;
|
|
156
|
+
/** Accepted progress of one job tag from now on; empty for a tag the member does not list. */
|
|
157
|
+
readonly progress: (tag: string, jobId: string | undefined) => Stream.Stream<StoredProgress>;
|
|
158
|
+
}
|
|
159
|
+
/** One accepted progress frame, still encoded. */
|
|
160
|
+
export interface StoredProgress {
|
|
161
|
+
readonly jobId: string;
|
|
162
|
+
/** The job's encoded payload, as enqueued. */
|
|
163
|
+
readonly job: string;
|
|
164
|
+
readonly attempt: number;
|
|
165
|
+
readonly seq: number;
|
|
166
|
+
/** The frame, JSON-encoded under the job's progress schema. */
|
|
167
|
+
readonly frame: string;
|
|
168
|
+
}
|
|
169
|
+
/** A stream member bound to its handler. */
|
|
170
|
+
export interface RegisteredStream {
|
|
171
|
+
/** Effect tags whose progress the handler may read. */
|
|
172
|
+
readonly progress: ReadonlySet<string>;
|
|
173
|
+
/** Encoded elements; a declared failure is encoded, anything else is a defect. */
|
|
174
|
+
readonly run: (payload: string, input: StreamInput) => Stream.Stream<string, {
|
|
175
|
+
readonly failure: string;
|
|
176
|
+
}>;
|
|
177
|
+
}
|
|
178
|
+
/** A command a job's outcome is delivered to, with its encoded input. */
|
|
179
|
+
export interface JobRoute {
|
|
180
|
+
readonly command: string;
|
|
181
|
+
readonly payload: string;
|
|
182
|
+
}
|
|
183
|
+
/** How one executor attempt ended without a result. */
|
|
184
|
+
export interface JobFailure {
|
|
185
|
+
readonly cause: string;
|
|
186
|
+
/** True when the provider may have applied the call anyway. */
|
|
187
|
+
readonly ambiguous: boolean;
|
|
188
|
+
/** Retrying cannot help, so the job is dead-lettered now. */
|
|
189
|
+
readonly final?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* The executor never ran, as when the stored payload does not decode, so
|
|
192
|
+
* this attempt applied nothing and the row keeps what earlier attempts may
|
|
193
|
+
* have applied; `ambiguous` is ignored.
|
|
194
|
+
*/
|
|
195
|
+
readonly notStarted?: boolean;
|
|
196
|
+
}
|
|
197
|
+
/** What the relay gives one attempt; the executor sees it as `X.Executor`. */
|
|
198
|
+
export interface AttemptContext {
|
|
199
|
+
/** Stable across every attempt of the job. */
|
|
200
|
+
readonly jobId: string;
|
|
201
|
+
/** 1 on the first attempt. */
|
|
202
|
+
readonly attempt: number;
|
|
203
|
+
/** The principal of the turn that enqueued the job. */
|
|
204
|
+
readonly principal: Option.Option<Principal>;
|
|
205
|
+
/** The actor that enqueued the job. */
|
|
206
|
+
readonly ref: ActorRef;
|
|
207
|
+
/** False when progress reports go nowhere, so frames need not be encoded. */
|
|
208
|
+
readonly reporting: () => boolean;
|
|
209
|
+
/** Offers one encoded progress frame to the attempt's slot. */
|
|
210
|
+
readonly report: (frame: Uint8Array) => Effect.Effect<void>;
|
|
211
|
+
}
|
|
212
|
+
/** What a settled job reports to its `onCancelled` or `onDeadLetter` route. */
|
|
213
|
+
export interface JobLetter {
|
|
214
|
+
readonly jobId: string;
|
|
215
|
+
readonly attempts: number;
|
|
216
|
+
readonly ambiguous: boolean;
|
|
217
|
+
}
|
|
218
|
+
/** A job class bound to its executor and retry policy. */
|
|
219
|
+
export interface RegisteredJob {
|
|
220
|
+
/** Total attempts before the job is dead-lettered. */
|
|
221
|
+
readonly attempts: number;
|
|
222
|
+
/** The least time between two progress frames of one attempt; undefined when the job declares no progress. */
|
|
223
|
+
readonly progressEveryMs: number | undefined;
|
|
224
|
+
/** The wait after failed attempt `n` is `min(baseMs × 2^(n − 1), maxMs)`. */
|
|
225
|
+
readonly backoff: {
|
|
226
|
+
readonly baseMs: number;
|
|
227
|
+
readonly maxMs: number;
|
|
228
|
+
};
|
|
229
|
+
/** Attempts running at once per actor across runners; unlimited when undefined. */
|
|
230
|
+
readonly perActor: number | undefined;
|
|
231
|
+
/** Whether the job declares an `onCancelled` route. */
|
|
232
|
+
readonly routesCancelled: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Runs one attempt; succeeds with the `onSuccess` route and the
|
|
235
|
+
* `onCancelled` route of its result, each if declared, or with the reason
|
|
236
|
+
* `onSuccess` rejects the result.
|
|
237
|
+
*/
|
|
238
|
+
readonly execute: (payload: string, version: number, context: AttemptContext) => Effect.Effect<{
|
|
239
|
+
readonly success: JobRoute | undefined;
|
|
240
|
+
readonly cancelled: JobRoute | undefined;
|
|
241
|
+
/** Why `onSuccess` cannot accept the result, when it cannot. */
|
|
242
|
+
readonly rejected: JobFailure | undefined;
|
|
243
|
+
}, JobFailure>;
|
|
244
|
+
/** The `onCancelled` route for a cancelled job without a result, if declared. */
|
|
245
|
+
readonly cancelled: (payload: string, version: number, letter: JobLetter & {
|
|
246
|
+
readonly outcome: {
|
|
247
|
+
readonly _tag: "Failed" | "Unknown";
|
|
248
|
+
readonly cause: string;
|
|
249
|
+
};
|
|
250
|
+
}) => Effect.Effect<JobRoute | undefined>;
|
|
251
|
+
/** The `onDeadLetter` route for an exhausted job, if declared. */
|
|
252
|
+
readonly deadLetter: (payload: string, version: number, letter: JobLetter & {
|
|
253
|
+
readonly cause: string;
|
|
254
|
+
}) => Effect.Effect<JobRoute | undefined>;
|
|
255
|
+
}
|
|
256
|
+
/** What an actor type's job layer registers with the runtime. */
|
|
257
|
+
export interface JobRegistration {
|
|
258
|
+
readonly name: string;
|
|
259
|
+
/** Job tags some connection or stream member of the actor receives progress of. */
|
|
260
|
+
readonly progress: ReadonlySet<string>;
|
|
261
|
+
/** The job layer's build context; executor attempts run in it. */
|
|
262
|
+
readonly services: Context.Context<never>;
|
|
263
|
+
readonly jobs: ReadonlyMap<string, RegisteredJob>;
|
|
264
|
+
/** The job classes the layer reads, for the startup payload check. */
|
|
265
|
+
readonly payloads: ReadonlyArray<PayloadDeclaration>;
|
|
266
|
+
}
|
|
267
|
+
/** One result of a watch: the query's encoded output, and the commit version its rerun waited for when there was one. */
|
|
268
|
+
export interface WatchResult {
|
|
269
|
+
readonly version: string | undefined;
|
|
270
|
+
readonly value: string;
|
|
271
|
+
}
|
|
272
|
+
/** A query reads committed state; it never activates, fences, or receipts. */
|
|
273
|
+
export interface RegisteredQuery {
|
|
274
|
+
/** Whether the member is declared `watch: true`, so its handler needs nothing but `X.Read`. */
|
|
275
|
+
readonly watch: boolean;
|
|
276
|
+
/** With `reads`, the handler runs on a recording `X.Read` and fills `reads`, and no service but `X.Read` is provided. */
|
|
277
|
+
readonly run: (request: Request, state: ReadonlyArray<readonly [string, string]>, cursor: string, events: EventReader, reads?: ReadSet) => Effect.Effect<Outcome>;
|
|
278
|
+
}
|
|
279
|
+
/** What an actor type's query layer registers with the runtime. */
|
|
280
|
+
export interface QueryRegistration {
|
|
281
|
+
readonly name: string;
|
|
282
|
+
readonly placement: Placement;
|
|
283
|
+
/** `commandTimeout`: a query's reads are cancelled on the server past it. */
|
|
284
|
+
readonly timeoutMs: number;
|
|
285
|
+
readonly tables: ReadonlyArray<AnyOwnedTable>;
|
|
286
|
+
readonly blobs: ReadonlyArray<AnyBlob>;
|
|
287
|
+
readonly queries: ReadonlyMap<string, RegisteredQuery>;
|
|
288
|
+
/** The actor's `access` policy; undefined when it declares none. */
|
|
289
|
+
readonly access: Access | undefined;
|
|
290
|
+
/** The event classes the layer reads, for the startup payload check. */
|
|
291
|
+
readonly payloads: ReadonlyArray<PayloadDeclaration>;
|
|
292
|
+
}
|
|
293
|
+
/** What an actor type's command layer registers with the runtime. */
|
|
294
|
+
export interface Registration {
|
|
295
|
+
readonly name: string;
|
|
296
|
+
readonly singleton: boolean;
|
|
297
|
+
/** Unkeyed with `policy.createdBy`: its UUIDv8 ids come only from `turn.mint`. */
|
|
298
|
+
readonly mintable: boolean;
|
|
299
|
+
/** The deployment's default tenant: the ambient `Tenant` when the actor's layer is built. */
|
|
300
|
+
readonly tenant: string;
|
|
301
|
+
/** The actor's `access` policy; undefined when it declares none. */
|
|
302
|
+
readonly access: Access | undefined;
|
|
303
|
+
readonly placement: Placement;
|
|
304
|
+
readonly policy: TurnPolicy;
|
|
305
|
+
readonly tables: ReadonlyArray<AnyOwnedTable>;
|
|
306
|
+
readonly blobs: ReadonlyArray<AnyBlob>;
|
|
307
|
+
/**
|
|
308
|
+
* Resolves one activation's commands in the activation's scope. A singleton
|
|
309
|
+
* runs its build here, so fibers it forks live as long as the activation,
|
|
310
|
+
* and a build failure defects that activation rather than failing its layer.
|
|
311
|
+
*/
|
|
312
|
+
readonly activate: (ref: ActorRef) => Effect.Effect<ReadonlyMap<string, RegisteredCommand>, never, Scope.Scope>;
|
|
313
|
+
readonly connections: ReadonlyMap<string, RegisteredConnection>;
|
|
314
|
+
readonly streams: ReadonlyMap<string, RegisteredStream>;
|
|
315
|
+
/** Tags of the events this actor type serves as event feeds. */
|
|
316
|
+
readonly feeds: ReadonlySet<string>;
|
|
317
|
+
/** Tags of the queries declared `watch: true`. */
|
|
318
|
+
readonly watches: ReadonlySet<string>;
|
|
319
|
+
/** Workflow members with their bodies, keyed by tag. */
|
|
320
|
+
readonly workflows: ReadonlyMap<string, RegisteredWorkflow>;
|
|
321
|
+
/** `policy.cron` entries; each is one keyed tick row per actor. */
|
|
322
|
+
readonly cron: ReadonlyArray<CronEntry>;
|
|
323
|
+
/** The subscriptions this actor type declares, as its subscriber. */
|
|
324
|
+
readonly subscriptions: ReadonlyArray<RegisteredSubscription>;
|
|
325
|
+
/** `policy.subscribers` of this actor type as a source; undefined allows every type. */
|
|
326
|
+
readonly subscribers: ReadonlyArray<string> | undefined;
|
|
327
|
+
/**
|
|
328
|
+
* Every event and job class the layer writes or reads, its
|
|
329
|
+
* subscriptions' source events included, for the startup payload check.
|
|
330
|
+
*/
|
|
331
|
+
readonly payloads: ReadonlyArray<PayloadDeclaration>;
|
|
332
|
+
/**
|
|
333
|
+
* A stored event of this type as the current class encodes it; a value
|
|
334
|
+
* the chain cannot read is a defect. Unchanged at the current version.
|
|
335
|
+
*/
|
|
336
|
+
readonly upcastEvent: (tag: string, version: number, value: string) => Effect.Effect<string>;
|
|
337
|
+
}
|
|
338
|
+
/** One `Actor.subscription` of a registered subscriber type. */
|
|
339
|
+
export interface RegisteredSubscription {
|
|
340
|
+
readonly tag: string;
|
|
341
|
+
readonly sourceType: string;
|
|
342
|
+
/** The internal command deliveries run. */
|
|
343
|
+
readonly handler: string;
|
|
344
|
+
/** Event tags this declaration delivers. */
|
|
345
|
+
readonly events: ReadonlyArray<string>;
|
|
346
|
+
/** Event tags it once delivered; rows carrying them stay claimable and skip them. */
|
|
347
|
+
readonly retired: ReadonlyArray<string>;
|
|
348
|
+
/** How a routed subscription names its subscriber; undefined for a dynamic one. */
|
|
349
|
+
readonly routed: "id" | "singleton" | undefined;
|
|
350
|
+
/**
|
|
351
|
+
* The subscriber id of one event of a routed subscription: decodes the
|
|
352
|
+
* stored event, applies `route`, and checks the id against the subscriber's
|
|
353
|
+
* key schema. Fails when any step fails.
|
|
354
|
+
*/
|
|
355
|
+
readonly route: (tag: string, value: string, source: ActorRef) => Effect.Effect<string, SubscriptionFailure>;
|
|
356
|
+
/**
|
|
357
|
+
* A stored source event as the subscriber's class encodes it; fails when
|
|
358
|
+
* the chain cannot read it, so the delivery backs off instead of skipping.
|
|
359
|
+
*/
|
|
360
|
+
readonly upcast: (tag: string, version: number, value: string) => Effect.Effect<string, SubscriptionFailure>;
|
|
361
|
+
}
|
|
362
|
+
/** A workflow member bound to its body when the actor's layer was built. */
|
|
363
|
+
export interface RegisteredWorkflow {
|
|
364
|
+
readonly member: AnyWorkflow;
|
|
365
|
+
/** The member's constructors when the layer was built; any other step dies. */
|
|
366
|
+
readonly steps: ReadonlyMap<string, {
|
|
367
|
+
readonly kind: string;
|
|
368
|
+
}>;
|
|
369
|
+
/** The execution key of an encoded input; `fallback` when the member declares no key. */
|
|
370
|
+
readonly key: (payload: string, fallback: string) => Effect.Effect<string>;
|
|
371
|
+
/** Runs the body once from its start; recorded steps replay instead of running again. */
|
|
372
|
+
readonly run: (payload: string, context: WorkflowContext) => Effect.Effect<Exit.Exit<unknown, unknown>>;
|
|
373
|
+
readonly encodeExit: (exit: Exit.Exit<unknown, unknown>) => Effect.Effect<RecordedExit>;
|
|
374
|
+
}
|
|
375
|
+
/** One execution's committed status as `poll` reads it. */
|
|
376
|
+
export interface WorkflowStatus {
|
|
377
|
+
readonly finished: boolean;
|
|
378
|
+
/** The recorded exit, once finished; `Interrupt` for an interrupted execution. */
|
|
379
|
+
readonly result: StoredResult | undefined;
|
|
380
|
+
}
|
|
381
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Schema, } from "effect";
|
|
2
|
+
/** What one connection handler is asked to do. */
|
|
3
|
+
export const ConnectionPhase = Schema.TaggedUnion({
|
|
4
|
+
Open: { params: Schema.String },
|
|
5
|
+
Frame: { frame: Schema.String },
|
|
6
|
+
Close: { reason: Schema.String },
|
|
7
|
+
Resync: { after: Schema.UndefinedOr(Schema.String) },
|
|
8
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Crypto, Effect, Option, Schema } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/sql";
|
|
3
|
+
import { type Placement } from "../storage/codec.ts";
|
|
4
|
+
import { Capability, type OperatorAction } from "./grants.ts";
|
|
5
|
+
/** One operator action as the audit log records it. */
|
|
6
|
+
export interface AuditEntry {
|
|
7
|
+
readonly operator: string;
|
|
8
|
+
readonly action: OperatorAction;
|
|
9
|
+
readonly tenant: string;
|
|
10
|
+
readonly actorType?: string | undefined;
|
|
11
|
+
readonly actorId?: string | undefined;
|
|
12
|
+
/** The job id or command id the action named. */
|
|
13
|
+
readonly target?: string | undefined;
|
|
14
|
+
/** The capability that allowed it; none when it was refused. */
|
|
15
|
+
readonly capability: Option.Option<Capability>;
|
|
16
|
+
readonly reason?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The routing key an entry is stored under: its actor's, so a repair and its
|
|
20
|
+
* record share a shard, or the tenant's for a tenant-wide action.
|
|
21
|
+
*/
|
|
22
|
+
export declare const auditRoutingKey: ({ entry, placement, }: {
|
|
23
|
+
readonly entry: Pick<AuditEntry, "tenant" | "actorType" | "actorId">;
|
|
24
|
+
readonly placement: Placement | undefined;
|
|
25
|
+
}) => bigint;
|
|
26
|
+
/** Writes one audit row in the caller's transaction; `outcome` is stored as JSON. */
|
|
27
|
+
export declare const writeAudit: (args_0: {
|
|
28
|
+
readonly entry: AuditEntry;
|
|
29
|
+
readonly key: bigint;
|
|
30
|
+
readonly outcome: Schema.Json;
|
|
31
|
+
}) => Effect.Effect<string, import("effect/sql/SqlError").SqlError, Crypto.Crypto | SqlClient.SqlClient>;
|
|
32
|
+
/** An audit row as an operator reads it. */
|
|
33
|
+
export declare const AuditRecord: Schema.Struct<{
|
|
34
|
+
readonly auditId: Schema.String;
|
|
35
|
+
readonly atMs: Schema.Finite;
|
|
36
|
+
readonly operator: Schema.String;
|
|
37
|
+
readonly action: Schema.String;
|
|
38
|
+
readonly tenant: Schema.String;
|
|
39
|
+
readonly actorType: Schema.NullOr<Schema.String>;
|
|
40
|
+
readonly actorId: Schema.NullOr<Schema.String>;
|
|
41
|
+
readonly target: Schema.NullOr<Schema.String>;
|
|
42
|
+
readonly capability: Schema.NullOr<Schema.String>;
|
|
43
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
44
|
+
readonly outcome: Schema.String;
|
|
45
|
+
}>;
|
|
46
|
+
/** A decoded `AuditRecord`. */
|
|
47
|
+
export type AuditRecord = typeof AuditRecord.Type;
|
|
48
|
+
/** A tenant's newest audit rows, or every tenant's for `"*"`, newest first. */
|
|
49
|
+
export declare const listAudit: (args_0: {
|
|
50
|
+
readonly tenant: string;
|
|
51
|
+
readonly limit: number;
|
|
52
|
+
}) => Effect.Effect<readonly {
|
|
53
|
+
readonly auditId: string;
|
|
54
|
+
readonly atMs: number;
|
|
55
|
+
readonly operator: string;
|
|
56
|
+
readonly action: string;
|
|
57
|
+
readonly tenant: string;
|
|
58
|
+
readonly actorType: string | null;
|
|
59
|
+
readonly actorId: string | null;
|
|
60
|
+
readonly target: string | null;
|
|
61
|
+
readonly capability: string | null;
|
|
62
|
+
readonly reason: string | null;
|
|
63
|
+
readonly outcome: string;
|
|
64
|
+
}[], import("effect/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Crypto, Effect, Option, Schema } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/sql";
|
|
3
|
+
import { routingKey } from "../storage/codec.js";
|
|
4
|
+
import { databaseTime } from "../turn/admission.js";
|
|
5
|
+
import { Capability } from "./grants.js";
|
|
6
|
+
const encodeJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Json));
|
|
7
|
+
const encodeCapability = Schema.encodeEffect(Schema.fromJsonString(Capability));
|
|
8
|
+
/**
|
|
9
|
+
* The routing key an entry is stored under: its actor's, so a repair and its
|
|
10
|
+
* record share a shard, or the tenant's for a tenant-wide action.
|
|
11
|
+
*/
|
|
12
|
+
export const auditRoutingKey = ({ entry, placement, }) => entry.actorType === undefined || entry.actorId === undefined || placement === undefined
|
|
13
|
+
? routingKey({ ref: { tenant: entry.tenant, actor: "", id: "" }, placement: "tenant" })
|
|
14
|
+
: routingKey({
|
|
15
|
+
ref: { tenant: entry.tenant, actor: entry.actorType, id: entry.actorId },
|
|
16
|
+
placement,
|
|
17
|
+
});
|
|
18
|
+
/** Writes one audit row in the caller's transaction; `outcome` is stored as JSON. */
|
|
19
|
+
export const writeAudit = Effect.fnUntraced(function* ({ entry, key, outcome, }) {
|
|
20
|
+
const sql = yield* SqlClient.SqlClient;
|
|
21
|
+
const crypto = yield* Crypto.Crypto;
|
|
22
|
+
const auditId = yield* crypto.randomUUIDv4.pipe(Effect.orDie);
|
|
23
|
+
const capability = Option.isNone(entry.capability)
|
|
24
|
+
? null
|
|
25
|
+
: yield* encodeCapability(entry.capability.value).pipe(Effect.orDie);
|
|
26
|
+
yield* sql `INSERT INTO actor_operator_audit (routing_key, audit_id, at_ms, operator, action,
|
|
27
|
+
tenant_id, actor_type, actor_id, target, capability, reason, outcome)
|
|
28
|
+
VALUES (${key}, ${auditId}, ${yield* databaseTime}, ${entry.operator}, ${entry.action},
|
|
29
|
+
${entry.tenant}, ${entry.actorType ?? null}, ${entry.actorId ?? null}, ${entry.target ?? null},
|
|
30
|
+
${capability}, ${entry.reason ?? null}, ${yield* encodeJson(outcome).pipe(Effect.orDie)})`;
|
|
31
|
+
return auditId;
|
|
32
|
+
});
|
|
33
|
+
/** An audit row as an operator reads it. */
|
|
34
|
+
export const AuditRecord = Schema.Struct({
|
|
35
|
+
auditId: Schema.String,
|
|
36
|
+
atMs: Schema.Finite,
|
|
37
|
+
operator: Schema.String,
|
|
38
|
+
action: Schema.String,
|
|
39
|
+
tenant: Schema.String,
|
|
40
|
+
actorType: Schema.NullOr(Schema.String),
|
|
41
|
+
actorId: Schema.NullOr(Schema.String),
|
|
42
|
+
target: Schema.NullOr(Schema.String),
|
|
43
|
+
capability: Schema.NullOr(Schema.String),
|
|
44
|
+
reason: Schema.NullOr(Schema.String),
|
|
45
|
+
outcome: Schema.String,
|
|
46
|
+
});
|
|
47
|
+
/** A tenant's newest audit rows, or every tenant's for `"*"`, newest first. */
|
|
48
|
+
export const listAudit = Effect.fnUntraced(function* ({ tenant, limit, }) {
|
|
49
|
+
const sql = yield* SqlClient.SqlClient;
|
|
50
|
+
const filter = tenant === "*" ? sql `` : sql `WHERE tenant_id = ${tenant}`;
|
|
51
|
+
return yield* sql `SELECT audit_id AS "auditId", at_ms::float8 AS "atMs", operator,
|
|
52
|
+
action, tenant_id AS tenant, actor_type AS "actorType", actor_id AS "actorId", target,
|
|
53
|
+
capability, reason, outcome
|
|
54
|
+
FROM actor_operator_audit ${filter}
|
|
55
|
+
ORDER BY at_ms DESC, audit_id COLLATE "C" LIMIT ${limit}`;
|
|
56
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Effect, Redacted } from "effect";
|
|
2
|
+
import type { ActorUnavailable } from "../../errors/actor.ts";
|
|
3
|
+
import { Unauthorized } from "../../errors/actor.ts";
|
|
4
|
+
import { type AuthRequest } from "../../serve/auth.ts";
|
|
5
|
+
import type { OperatorGrant } from "./grants.ts";
|
|
6
|
+
/**
|
|
7
|
+
* Authenticates an operator request to a grant. It is a different type from
|
|
8
|
+
* `Actor.auth`'s providers, which return an application caller, so no
|
|
9
|
+
* application credential can reach an operator route.
|
|
10
|
+
*/
|
|
11
|
+
export interface OperatorAuth<R = never> {
|
|
12
|
+
readonly authenticate: (request: AuthRequest) => Effect.Effect<OperatorGrant, Unauthorized | ActorUnavailable, R>;
|
|
13
|
+
}
|
|
14
|
+
/** An operator provider from a function, e.g. one that verifies an identity provider's token. */
|
|
15
|
+
declare const make: <R = never>(authenticate: OperatorAuth<R>["authenticate"]) => OperatorAuth<R>;
|
|
16
|
+
/**
|
|
17
|
+
* Bearer tokens configured with the deployment, each with its grant. Only
|
|
18
|
+
* SHA-256 digests of the tokens are kept after construction.
|
|
19
|
+
*/
|
|
20
|
+
declare const tokens: (entries: ReadonlyArray<{
|
|
21
|
+
readonly token: Redacted.Redacted<string>;
|
|
22
|
+
readonly grant: OperatorGrant;
|
|
23
|
+
}>) => OperatorAuth;
|
|
24
|
+
/** Constructors for operator providers: `make` from a function, `tokens` from configured bearer tokens. */
|
|
25
|
+
export declare const OperatorAuth: {
|
|
26
|
+
make: typeof make;
|
|
27
|
+
tokens: typeof tokens;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Effect, Redacted } from "effect";
|
|
2
|
+
import { sha256Bytes } from "../../identity/digest.js";
|
|
3
|
+
import { Unauthorized } from "../../errors/actor.js";
|
|
4
|
+
import { bearerToken } from "../../serve/auth.js";
|
|
5
|
+
/** An operator provider from a function, e.g. one that verifies an identity provider's token. */
|
|
6
|
+
const make = (authenticate) => ({
|
|
7
|
+
authenticate,
|
|
8
|
+
});
|
|
9
|
+
const digest = (text) => sha256Bytes(new TextEncoder().encode(text));
|
|
10
|
+
/**
|
|
11
|
+
* Compares digests without an early exit, and every configured digest is
|
|
12
|
+
* compared in full, so timing reveals neither which entry matched nor how much
|
|
13
|
+
* of a digest did.
|
|
14
|
+
*/
|
|
15
|
+
const equalDigests = (a, b) => {
|
|
16
|
+
let difference = a.length ^ b.length;
|
|
17
|
+
for (let index = 0; index < a.length; index++)
|
|
18
|
+
difference |= a[index] ^ (b[index] ?? 0);
|
|
19
|
+
return difference === 0;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Bearer tokens configured with the deployment, each with its grant. Only
|
|
23
|
+
* SHA-256 digests of the tokens are kept after construction.
|
|
24
|
+
*/
|
|
25
|
+
const tokens = (entries) => {
|
|
26
|
+
const digests = entries.map(({ token, grant }) => ({
|
|
27
|
+
digest: digest(Redacted.value(token)),
|
|
28
|
+
grant,
|
|
29
|
+
}));
|
|
30
|
+
return make((request) => Effect.flatMap(bearerToken(request), (token) => {
|
|
31
|
+
const presented = digest(token);
|
|
32
|
+
let found;
|
|
33
|
+
for (const entry of digests)
|
|
34
|
+
if (equalDigests(entry.digest, presented))
|
|
35
|
+
found = entry.grant;
|
|
36
|
+
return found === undefined
|
|
37
|
+
? Effect.fail(Unauthorized.make({ code: "invalid_credentials" }))
|
|
38
|
+
: Effect.succeed(found);
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
/** Constructors for operator providers: `make` from a function, `tokens` from configured bearer tokens. */
|
|
42
|
+
export const OperatorAuth = { make, tokens };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Effect, Option, Schema } from "effect";
|
|
2
|
+
import { SqlClient } from "effect/sql";
|
|
3
|
+
/** The most pending intents, and the most pending jobs, one export carries. */
|
|
4
|
+
export declare const MAX_EXPORT_ROWS = 10000;
|
|
5
|
+
declare const ExportRefused_base: Schema.Class<ExportRefused, Schema.TaggedStruct<"ExportRefused", {
|
|
6
|
+
readonly reason: Schema.Literals<readonly ["undecodable", "too_large"]>;
|
|
7
|
+
readonly detail: Schema.String;
|
|
8
|
+
}>, import("effect/Cause").YieldableError>;
|
|
9
|
+
/**
|
|
10
|
+
* The actor cannot be exported faithfully: a stored value does not decode, or
|
|
11
|
+
* it holds more pending work than one export carries. `detail` names the row,
|
|
12
|
+
* never its contents.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ExportRefused extends ExportRefused_base {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reads one actor's seed in a tenant-bound read-only snapshot: current
|
|
18
|
+
* state, the pending intents and timers, and the jobs not yet settled.
|
|
19
|
+
* Callers, credentials, receipts, event history, workflow executions, dead
|
|
20
|
+
* letters, owned-table rows, and blob entries are not carried; the seed counts
|
|
21
|
+
* them in `omitted`. Subscription cursors and connections are neither carried
|
|
22
|
+
* nor counted. A job whose attempt has been cancelled or has finally failed
|
|
23
|
+
* is not pending and is left out. It reads the runtime tables, not the
|
|
24
|
+
* inspection views, because the views do not show a cancelled job. `None`
|
|
25
|
+
* when the tenant has no such actor.
|
|
26
|
+
*/
|
|
27
|
+
export declare const exportActor: (page: {
|
|
28
|
+
readonly tenant: string;
|
|
29
|
+
readonly actorType: string;
|
|
30
|
+
readonly actorId: string;
|
|
31
|
+
}) => Effect.Effect<Option.Option<{
|
|
32
|
+
readonly format: 1;
|
|
33
|
+
readonly actor: {
|
|
34
|
+
readonly type: string;
|
|
35
|
+
readonly id: string;
|
|
36
|
+
};
|
|
37
|
+
readonly created: boolean;
|
|
38
|
+
readonly stateVersion: number;
|
|
39
|
+
readonly state: {
|
|
40
|
+
readonly [x: string]: Schema.Json;
|
|
41
|
+
};
|
|
42
|
+
readonly intents: readonly {
|
|
43
|
+
readonly target: {
|
|
44
|
+
readonly actor: string;
|
|
45
|
+
readonly id: string;
|
|
46
|
+
};
|
|
47
|
+
readonly command: string;
|
|
48
|
+
readonly payload: Schema.Json;
|
|
49
|
+
readonly key?: string | undefined;
|
|
50
|
+
readonly dueInMs: number;
|
|
51
|
+
}[];
|
|
52
|
+
readonly jobs: readonly {
|
|
53
|
+
readonly job: string;
|
|
54
|
+
readonly payload: Schema.Json;
|
|
55
|
+
readonly payloadVersion: number;
|
|
56
|
+
readonly key?: string | undefined;
|
|
57
|
+
readonly dueInMs: number;
|
|
58
|
+
}[];
|
|
59
|
+
readonly omitted: {
|
|
60
|
+
readonly receipts: number;
|
|
61
|
+
readonly events: number;
|
|
62
|
+
readonly workflows: number;
|
|
63
|
+
readonly deadLetters: number;
|
|
64
|
+
readonly tableRows: number;
|
|
65
|
+
readonly blobs: number;
|
|
66
|
+
};
|
|
67
|
+
}>, ExportRefused | import("effect/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
68
|
+
export {};
|