@segmentstream/ontology 0.0.0-stage → 0.92.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/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +1655 -2
- package/dist/action.d.ts +193 -0
- package/dist/action.js +41 -0
- package/dist/agent-chat.d.ts +44 -0
- package/dist/agent-chat.js +91 -0
- package/dist/agent-task-contract.d.ts +64 -0
- package/dist/agent-task-contract.js +15 -0
- package/dist/agent-task.d.ts +39 -0
- package/dist/agent-task.js +112 -0
- package/dist/analyze.d.ts +215 -0
- package/dist/analyze.js +2438 -0
- package/dist/app-feedback.d.ts +167 -0
- package/dist/app-feedback.js +176 -0
- package/dist/authoring-input.d.ts +3 -0
- package/dist/authoring-input.js +107 -0
- package/dist/authoring-names.d.ts +4 -0
- package/dist/authoring-names.js +13 -0
- package/dist/authoring-records.d.ts +35 -0
- package/dist/authoring-records.js +264 -0
- package/dist/authoring.d.ts +15 -0
- package/dist/authoring.js +331 -0
- package/dist/bin/check.d.ts +30 -0
- package/dist/bin/check.js +99 -0
- package/dist/bin/load.d.ts +48 -0
- package/dist/bin/load.js +139 -0
- package/dist/bin/main.d.ts +31 -0
- package/dist/bin/main.js +121 -0
- package/dist/bin/migrate.d.ts +57 -0
- package/dist/bin/migrate.js +170 -0
- package/dist/bin/output.d.ts +31 -0
- package/dist/bin/output.js +84 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +31 -0
- package/dist/blob.d.ts +52 -0
- package/dist/blob.js +87 -0
- package/dist/channel-session.d.ts +16 -0
- package/dist/channel-session.js +16 -0
- package/dist/chat.d.ts +43 -0
- package/dist/chat.js +34 -0
- package/dist/confirmation.d.ts +46 -0
- package/dist/confirmation.js +41 -0
- package/dist/connection.d.ts +213 -0
- package/dist/connection.js +289 -0
- package/dist/deployment.d.ts +35 -0
- package/dist/deployment.js +76 -0
- package/dist/diagnostics.d.ts +27 -0
- package/dist/diagnostics.js +106 -0
- package/dist/emails.d.ts +70 -0
- package/dist/emails.js +221 -0
- package/dist/entity.d.ts +331 -0
- package/dist/entity.js +153 -0
- package/dist/errors.d.ts +154 -0
- package/dist/errors.js +109 -0
- package/dist/feedback-config.d.ts +24 -0
- package/dist/feedback-config.js +126 -0
- package/dist/files.d.ts +39 -0
- package/dist/files.js +4 -0
- package/dist/groups.d.ts +95 -0
- package/dist/groups.js +280 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +70 -0
- package/dist/internal/diagnostics.js +594 -0
- package/dist/legacy.d.ts +160 -0
- package/dist/legacy.js +270 -0
- package/dist/manifest-compatibility.d.ts +8 -0
- package/dist/manifest-compatibility.js +87 -0
- package/dist/manifest.d.ts +3329 -0
- package/dist/manifest.js +757 -0
- package/dist/me.d.ts +46 -0
- package/dist/me.js +109 -0
- package/dist/metric-filters.d.ts +48 -0
- package/dist/metric-filters.js +252 -0
- package/dist/metric-routes.d.ts +132 -0
- package/dist/metric-routes.js +498 -0
- package/dist/metric.d.ts +172 -0
- package/dist/metric.js +132 -0
- package/dist/migrate/apply.d.ts +94 -0
- package/dist/migrate/apply.js +526 -0
- package/dist/migrate/errors.d.ts +46 -0
- package/dist/migrate/errors.js +38 -0
- package/dist/migrate/index.d.ts +10 -0
- package/dist/migrate/index.js +7 -0
- package/dist/migrate/model.d.ts +2311 -0
- package/dist/migrate/model.js +148 -0
- package/dist/migrate/plan.d.ts +51 -0
- package/dist/migrate/plan.js +1856 -0
- package/dist/migrate/preview.d.ts +13 -0
- package/dist/migrate/preview.js +65 -0
- package/dist/migrate/storage.d.ts +226 -0
- package/dist/migrate/storage.js +774 -0
- package/dist/model-metrics.d.ts +22 -0
- package/dist/model-metrics.js +545 -0
- package/dist/names.d.ts +49 -0
- package/dist/names.js +110 -0
- package/dist/navigation-artifact.d.ts +13 -0
- package/dist/navigation-artifact.js +11 -0
- package/dist/navigation-catalog.d.ts +55 -0
- package/dist/navigation-catalog.js +297 -0
- package/dist/nitro-navigation.d.ts +3 -0
- package/dist/nitro-navigation.js +64 -0
- package/dist/nitro-workflows.d.ts +108 -0
- package/dist/nitro-workflows.js +286 -0
- package/dist/nitro.d.ts +40 -0
- package/dist/nitro.js +50 -0
- package/dist/ontology.d.ts +41 -0
- package/dist/ontology.js +46 -0
- package/dist/permissions.d.ts +198 -0
- package/dist/permissions.js +272 -0
- package/dist/property.d.ts +188 -0
- package/dist/property.js +301 -0
- package/dist/query.d.ts +245 -0
- package/dist/query.js +615 -0
- package/dist/relationship.d.ts +99 -0
- package/dist/relationship.js +33 -0
- package/dist/render.d.ts +81 -0
- package/dist/render.js +512 -0
- package/dist/replication/baseline.d.ts +51 -0
- package/dist/replication/baseline.js +215 -0
- package/dist/replication/bigquery.d.ts +37 -0
- package/dist/replication/bigquery.js +211 -0
- package/dist/replication/coverage.d.ts +14 -0
- package/dist/replication/coverage.js +53 -0
- package/dist/replication/evolution.d.ts +25 -0
- package/dist/replication/evolution.js +184 -0
- package/dist/replication/identities.d.ts +6 -0
- package/dist/replication/identities.js +47 -0
- package/dist/replication/legacy-baseline.d.ts +27 -0
- package/dist/replication/legacy-baseline.js +109 -0
- package/dist/replication/legacy-store.d.ts +19 -0
- package/dist/replication/legacy-store.js +63 -0
- package/dist/replication/lineage.d.ts +36 -0
- package/dist/replication/lineage.js +72 -0
- package/dist/replication/migrate.d.ts +21 -0
- package/dist/replication/migrate.js +84 -0
- package/dist/replication/model.d.ts +52 -0
- package/dist/replication/model.js +99 -0
- package/dist/replication/scans.d.ts +34 -0
- package/dist/replication/scans.js +158 -0
- package/dist/replication/schema.d.ts +11 -0
- package/dist/replication/schema.js +226 -0
- package/dist/replication/shadow-schema.d.ts +4 -0
- package/dist/replication/shadow-schema.js +61 -0
- package/dist/replication/shadow.d.ts +127 -0
- package/dist/replication/shadow.js +614 -0
- package/dist/replication/source-replacement.d.ts +33 -0
- package/dist/replication/source-replacement.js +76 -0
- package/dist/replication/store.d.ts +36 -0
- package/dist/replication/store.js +382 -0
- package/dist/replication/transaction.d.ts +23 -0
- package/dist/replication/transaction.js +88 -0
- package/dist/role.d.ts +61 -0
- package/dist/role.js +76 -0
- package/dist/runtime/action-deadlocks.d.ts +21 -0
- package/dist/runtime/action-deadlocks.js +130 -0
- package/dist/runtime/action-transactions.d.ts +35 -0
- package/dist/runtime/action-transactions.js +54 -0
- package/dist/runtime/agent-counters.d.ts +26 -0
- package/dist/runtime/agent-counters.js +98 -0
- package/dist/runtime/agent-tasks.d.ts +63 -0
- package/dist/runtime/agent-tasks.js +120 -0
- package/dist/runtime/agents.d.ts +15 -0
- package/dist/runtime/agents.js +457 -0
- package/dist/runtime/batch-diagnostics.d.ts +22 -0
- package/dist/runtime/batch-diagnostics.js +89 -0
- package/dist/runtime/batch.d.ts +52 -0
- package/dist/runtime/batch.js +534 -0
- package/dist/runtime/channel-session-revocation.d.ts +3 -0
- package/dist/runtime/channel-session-revocation.js +5 -0
- package/dist/runtime/channel-sessions.d.ts +4 -0
- package/dist/runtime/channel-sessions.js +61 -0
- package/dist/runtime/confirmations.d.ts +29 -0
- package/dist/runtime/confirmations.js +57 -0
- package/dist/runtime/cursor.d.ts +23 -0
- package/dist/runtime/cursor.js +100 -0
- package/dist/runtime/deployment.d.ts +7 -0
- package/dist/runtime/deployment.js +4 -0
- package/dist/runtime/errors.d.ts +118 -0
- package/dist/runtime/errors.js +109 -0
- package/dist/runtime/federation-tables.d.ts +2 -0
- package/dist/runtime/federation-tables.js +20 -0
- package/dist/runtime/federation.d.ts +42 -0
- package/dist/runtime/federation.js +222 -0
- package/dist/runtime/files.d.ts +39 -0
- package/dist/runtime/files.js +44 -0
- package/dist/runtime/generated-actions.d.ts +37 -0
- package/dist/runtime/generated-actions.js +307 -0
- package/dist/runtime/history.d.ts +91 -0
- package/dist/runtime/history.js +77 -0
- package/dist/runtime/ids.d.ts +6 -0
- package/dist/runtime/ids.js +39 -0
- package/dist/runtime/member-tables.d.ts +8 -0
- package/dist/runtime/member-tables.js +33 -0
- package/dist/runtime/member-writes.d.ts +78 -0
- package/dist/runtime/member-writes.js +202 -0
- package/dist/runtime/metric-query.d.ts +19 -0
- package/dist/runtime/metric-query.js +411 -0
- package/dist/runtime/model.d.ts +67 -0
- package/dist/runtime/model.js +150 -0
- package/dist/runtime/new-user-hook.d.ts +6 -0
- package/dist/runtime/new-user-hook.js +37 -0
- package/dist/runtime/oauth.d.ts +9 -0
- package/dist/runtime/oauth.js +299 -0
- package/dist/runtime/pipeline.d.ts +155 -0
- package/dist/runtime/pipeline.js +597 -0
- package/dist/runtime/postgres-tls.d.ts +10 -0
- package/dist/runtime/postgres-tls.js +14 -0
- package/dist/runtime/principals.d.ts +302 -0
- package/dist/runtime/principals.js +1307 -0
- package/dist/runtime/reads.d.ts +55 -0
- package/dist/runtime/reads.js +313 -0
- package/dist/runtime/records.d.ts +42 -0
- package/dist/runtime/records.js +245 -0
- package/dist/runtime/resolve-agent-identity.d.ts +6 -0
- package/dist/runtime/resolve-agent-identity.js +181 -0
- package/dist/runtime/service-binding.d.ts +18 -0
- package/dist/runtime/service-binding.js +266 -0
- package/dist/runtime/sign-in-links.d.ts +68 -0
- package/dist/runtime/sign-in-links.js +147 -0
- package/dist/runtime/sql-runtime.d.ts +131 -0
- package/dist/runtime/sql-runtime.js +362 -0
- package/dist/runtime/statement.d.ts +18 -0
- package/dist/runtime/statement.js +31 -0
- package/dist/runtime/user-identities.d.ts +66 -0
- package/dist/runtime/user-identities.js +106 -0
- package/dist/runtime/user-identity-sql.d.ts +86 -0
- package/dist/runtime/user-identity-sql.js +297 -0
- package/dist/runtime/user-roles.d.ts +16 -0
- package/dist/runtime/user-roles.js +32 -0
- package/dist/runtime/validation.d.ts +16 -0
- package/dist/runtime/validation.js +26 -0
- package/dist/runtime/where.d.ts +57 -0
- package/dist/runtime/where.js +404 -0
- package/dist/runtime/workflow-admission.d.ts +49 -0
- package/dist/runtime/workflow-admission.js +92 -0
- package/dist/runtime/workflow-argument-codec.d.ts +10 -0
- package/dist/runtime/workflow-argument-codec.js +120 -0
- package/dist/runtime/workflow-arguments.d.ts +17 -0
- package/dist/runtime/workflow-arguments.js +99 -0
- package/dist/runtime/workflow-starts.d.ts +203 -0
- package/dist/runtime/workflow-starts.js +493 -0
- package/dist/runtime/workflow-users.d.ts +9 -0
- package/dist/runtime/workflow-users.js +17 -0
- package/dist/runtime/workload.d.ts +25 -0
- package/dist/runtime/workload.js +24 -0
- package/dist/runtime/writes.d.ts +108 -0
- package/dist/runtime/writes.js +491 -0
- package/dist/runtime-source.d.ts +22 -0
- package/dist/runtime-source.js +28 -0
- package/dist/runtime.d.ts +310 -0
- package/dist/runtime.js +31 -0
- package/dist/server.d.ts +23 -0
- package/dist/server.js +107 -0
- package/dist/service/agent/attachments.d.ts +33 -0
- package/dist/service/agent/attachments.js +228 -0
- package/dist/service/agent/authentication.d.ts +22 -0
- package/dist/service/agent/authentication.js +58 -0
- package/dist/service/agent/confirmations.d.ts +5 -0
- package/dist/service/agent/confirmations.js +73 -0
- package/dist/service/agent/conversation-routes.d.ts +14 -0
- package/dist/service/agent/conversation-routes.js +45 -0
- package/dist/service/agent/conversations.d.ts +40 -0
- package/dist/service/agent/conversations.js +69 -0
- package/dist/service/agent/files.d.ts +12 -0
- package/dist/service/agent/files.js +69 -0
- package/dist/service/agent/protocol.d.ts +90 -0
- package/dist/service/agent/protocol.js +114 -0
- package/dist/service/agent/server.d.ts +28 -0
- package/dist/service/agent/server.js +374 -0
- package/dist/service/agent/task-caller.d.ts +21 -0
- package/dist/service/agent/task-caller.js +35 -0
- package/dist/service/agent/task-start.d.ts +53 -0
- package/dist/service/agent/task-start.js +161 -0
- package/dist/service/agent/tasks.d.ts +40 -0
- package/dist/service/agent/tasks.js +155 -0
- package/dist/service/api.d.ts +50 -0
- package/dist/service/api.js +288 -0
- package/dist/service/authentication.d.ts +227 -0
- package/dist/service/authentication.js +767 -0
- package/dist/service/caller-context.d.ts +24 -0
- package/dist/service/caller-context.js +6 -0
- package/dist/service/catalog.d.ts +42 -0
- package/dist/service/catalog.js +66 -0
- package/dist/service/channel/provider.d.ts +10 -0
- package/dist/service/channel/provider.js +1 -0
- package/dist/service/channel/providers/telegram.d.ts +18 -0
- package/dist/service/channel/providers/telegram.js +108 -0
- package/dist/service/channel/sessions.d.ts +5 -0
- package/dist/service/channel/sessions.js +53 -0
- package/dist/service/channel/sign-in.d.ts +7 -0
- package/dist/service/channel/sign-in.js +78 -0
- package/dist/service/chat/archive.d.ts +64 -0
- package/dist/service/chat/archive.js +62 -0
- package/dist/service/chat/attribution.d.ts +26 -0
- package/dist/service/chat/attribution.js +28 -0
- package/dist/service/chat/delivery.d.ts +18 -0
- package/dist/service/chat/delivery.js +251 -0
- package/dist/service/chat/diagnostics.d.ts +2 -0
- package/dist/service/chat/diagnostics.js +35 -0
- package/dist/service/chat/envelope.d.ts +96 -0
- package/dist/service/chat/envelope.js +39 -0
- package/dist/service/chat/idempotency.d.ts +19 -0
- package/dist/service/chat/idempotency.js +37 -0
- package/dist/service/chat/providers/telegram.d.ts +36 -0
- package/dist/service/chat/providers/telegram.js +133 -0
- package/dist/service/chat/reads.d.ts +25 -0
- package/dist/service/chat/reads.js +75 -0
- package/dist/service/chat/resolve.d.ts +34 -0
- package/dist/service/chat/resolve.js +150 -0
- package/dist/service/chat/routes.d.ts +23 -0
- package/dist/service/chat/routes.js +75 -0
- package/dist/service/chat/schemas.d.ts +43 -0
- package/dist/service/chat/schemas.js +31 -0
- package/dist/service/config.d.ts +218 -0
- package/dist/service/config.js +265 -0
- package/dist/service/connection-stream.d.ts +10 -0
- package/dist/service/connection-stream.js +191 -0
- package/dist/service/connections.d.ts +60 -0
- package/dist/service/connections.js +271 -0
- package/dist/service/decisions.d.ts +35 -0
- package/dist/service/decisions.js +63 -0
- package/dist/service/descriptions.d.ts +8 -0
- package/dist/service/descriptions.js +20 -0
- package/dist/service/discovery-schemas.d.ts +92 -0
- package/dist/service/discovery-schemas.js +59 -0
- package/dist/service/discovery-search.d.ts +30 -0
- package/dist/service/discovery-search.js +95 -0
- package/dist/service/discovery.d.ts +37 -0
- package/dist/service/discovery.js +436 -0
- package/dist/service/docs.d.ts +9 -0
- package/dist/service/docs.js +197 -0
- package/dist/service/errors.d.ts +145 -0
- package/dist/service/errors.js +704 -0
- package/dist/service/federation-provider.d.ts +36 -0
- package/dist/service/federation-provider.js +110 -0
- package/dist/service/federation-server.d.ts +20 -0
- package/dist/service/federation-server.js +249 -0
- package/dist/service/federation-status.d.ts +40 -0
- package/dist/service/federation-status.js +151 -0
- package/dist/service/handlers.d.ts +18 -0
- package/dist/service/handlers.js +287 -0
- package/dist/service/mcp/confirmation.d.ts +68 -0
- package/dist/service/mcp/confirmation.js +178 -0
- package/dist/service/mcp/find-input.d.ts +12 -0
- package/dist/service/mcp/find-input.js +122 -0
- package/dist/service/mcp/input-schema.d.ts +6 -0
- package/dist/service/mcp/input-schema.js +126 -0
- package/dist/service/mcp/listing.d.ts +26 -0
- package/dist/service/mcp/listing.js +92 -0
- package/dist/service/mcp/metric-tools.d.ts +85 -0
- package/dist/service/mcp/metric-tools.js +258 -0
- package/dist/service/mcp/request-log.d.ts +5 -0
- package/dist/service/mcp/request-log.js +53 -0
- package/dist/service/mcp/runtime-policy.d.ts +27 -0
- package/dist/service/mcp/runtime-policy.js +62 -0
- package/dist/service/mcp/server.d.ts +52 -0
- package/dist/service/mcp/server.js +861 -0
- package/dist/service/mcp/tools.d.ts +99 -0
- package/dist/service/mcp/tools.js +938 -0
- package/dist/service/member-file-routes.d.ts +22 -0
- package/dist/service/member-file-routes.js +52 -0
- package/dist/service/member-files.d.ts +245 -0
- package/dist/service/member-files.js +258 -0
- package/dist/service/metric-query-platform.d.ts +77 -0
- package/dist/service/metric-query-platform.js +198 -0
- package/dist/service/metric-query-scopes.d.ts +43 -0
- package/dist/service/metric-query-scopes.js +147 -0
- package/dist/service/metric-query.d.ts +48 -0
- package/dist/service/metric-query.js +200 -0
- package/dist/service/name-suggestions.d.ts +3 -0
- package/dist/service/name-suggestions.js +38 -0
- package/dist/service/navigation-schemas.d.ts +80 -0
- package/dist/service/navigation-schemas.js +49 -0
- package/dist/service/navigation.d.ts +20 -0
- package/dist/service/navigation.js +165 -0
- package/dist/service/oauth/protocol.d.ts +70 -0
- package/dist/service/oauth/protocol.js +157 -0
- package/dist/service/oauth/refresh-replay.d.ts +2 -0
- package/dist/service/oauth/refresh-replay.js +20 -0
- package/dist/service/oauth/server.d.ts +28 -0
- package/dist/service/oauth/server.js +769 -0
- package/dist/service/operations.d.ts +170 -0
- package/dist/service/operations.js +392 -0
- package/dist/service/plan.d.ts +57 -0
- package/dist/service/plan.js +96 -0
- package/dist/service/rate-limit.d.ts +22 -0
- package/dist/service/rate-limit.js +52 -0
- package/dist/service/record-reads.d.ts +21 -0
- package/dist/service/record-reads.js +155 -0
- package/dist/service/replication.d.ts +5 -0
- package/dist/service/replication.js +39 -0
- package/dist/service/runtime-contract.d.ts +508 -0
- package/dist/service/runtime-contract.js +18 -0
- package/dist/service/runtime-identity.d.ts +71 -0
- package/dist/service/runtime-identity.js +122 -0
- package/dist/service/schemas.d.ts +961 -0
- package/dist/service/schemas.js +639 -0
- package/dist/service/service.d.ts +21 -0
- package/dist/service/service.js +526 -0
- package/dist/service/warehouse-platform.d.ts +17 -0
- package/dist/service/warehouse-platform.js +122 -0
- package/dist/service/warehouse-query.d.ts +24 -0
- package/dist/service/warehouse-query.js +280 -0
- package/dist/service/webhooks.d.ts +106 -0
- package/dist/service/webhooks.js +233 -0
- package/dist/service/workflow-admission-provider.d.ts +31 -0
- package/dist/service/workflow-admission-provider.js +205 -0
- package/dist/service/workflow-argument-serialization.d.ts +2 -0
- package/dist/service/workflow-argument-serialization.js +14 -0
- package/dist/service/workflow-callback.d.ts +22 -0
- package/dist/service/workflow-callback.js +75 -0
- package/dist/service/workflow-deployment.d.ts +8 -0
- package/dist/service/workflow-deployment.js +131 -0
- package/dist/service/workflow-diagnostics.d.ts +23 -0
- package/dist/service/workflow-diagnostics.js +263 -0
- package/dist/service/workflow-errors.d.ts +26 -0
- package/dist/service/workflow-errors.js +181 -0
- package/dist/service/workflow-logging.d.ts +2 -0
- package/dist/service/workflow-logging.js +50 -0
- package/dist/service/workflow-queue-fence.d.ts +6 -0
- package/dist/service/workflow-queue-fence.js +66 -0
- package/dist/service/workflows.d.ts +200 -0
- package/dist/service/workflows.js +1549 -0
- package/dist/sign-in.d.ts +58 -0
- package/dist/sign-in.js +57 -0
- package/dist/source.d.ts +30 -0
- package/dist/source.js +107 -0
- package/dist/start-recovery-contract.d.ts +49 -0
- package/dist/start-recovery-contract.js +26 -0
- package/dist/start-recovery.d.ts +27 -0
- package/dist/start-recovery.js +81 -0
- package/dist/storage/api.d.ts +4 -0
- package/dist/storage/api.js +40 -0
- package/dist/storage/attachments.d.ts +146 -0
- package/dist/storage/attachments.js +733 -0
- package/dist/storage/authorization.d.ts +38 -0
- package/dist/storage/authorization.js +83 -0
- package/dist/storage/file-access.d.ts +17 -0
- package/dist/storage/file-access.js +8 -0
- package/dist/storage/limits.d.ts +12 -0
- package/dist/storage/limits.js +17 -0
- package/dist/storage/maintenance-auth.d.ts +20 -0
- package/dist/storage/maintenance-auth.js +24 -0
- package/dist/storage/maintenance.d.ts +11 -0
- package/dist/storage/maintenance.js +67 -0
- package/dist/storage/neon.d.ts +4 -0
- package/dist/storage/neon.js +318 -0
- package/dist/storage/operator.d.ts +11 -0
- package/dist/storage/operator.js +30 -0
- package/dist/storage/provider.d.ts +93 -0
- package/dist/storage/provider.js +36 -0
- package/dist/storage/sessions.d.ts +184 -0
- package/dist/storage/sessions.js +688 -0
- package/dist/storage/tables.d.ts +54 -0
- package/dist/storage/tables.js +205 -0
- package/dist/storage/transfers.d.ts +16 -0
- package/dist/storage/transfers.js +153 -0
- package/dist/storage/writes.d.ts +7 -0
- package/dist/storage/writes.js +88 -0
- package/dist/telegram.d.ts +35 -0
- package/dist/telegram.js +173 -0
- package/dist/user-identity.d.ts +28 -0
- package/dist/user-identity.js +106 -0
- package/dist/user.d.ts +75 -0
- package/dist/user.js +111 -0
- package/dist/warehouse-backed.d.ts +6 -0
- package/dist/warehouse-backed.js +495 -0
- package/dist/webhook-token.d.ts +11 -0
- package/dist/webhook-token.js +18 -0
- package/dist/webhooks.d.ts +40 -0
- package/dist/webhooks.js +55 -0
- package/dist/wire.d.ts +10 -0
- package/dist/wire.js +35 -0
- package/dist/workflow-runtime.d.ts +116 -0
- package/dist/workflow-runtime.js +109 -0
- package/dist/workflow-topics.d.ts +28 -0
- package/dist/workflow-topics.js +28 -0
- package/dist/workflow.d.ts +284 -0
- package/dist/workflow.js +259 -0
- package/dist/workflows.d.ts +24 -0
- package/dist/workflows.js +18 -0
- package/package.json +127 -4
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
const CODECS = Symbol.for("@segmentstream/ontology/workflow-argument-codecs");
|
|
2
|
+
const globals = globalThis;
|
|
3
|
+
/** Server setup supplies the installed SDK's codecs; all bundled copies share the first one. */
|
|
4
|
+
export function setWorkflowArgumentCodecs(codecs) {
|
|
5
|
+
globals[CODECS] ??= codecs;
|
|
6
|
+
}
|
|
7
|
+
const views = {
|
|
8
|
+
BigInt64Array,
|
|
9
|
+
BigUint64Array,
|
|
10
|
+
Float32Array,
|
|
11
|
+
Float64Array,
|
|
12
|
+
Int8Array,
|
|
13
|
+
Int16Array,
|
|
14
|
+
Int32Array,
|
|
15
|
+
Uint8Array,
|
|
16
|
+
Uint8ClampedArray,
|
|
17
|
+
Uint16Array,
|
|
18
|
+
Uint32Array,
|
|
19
|
+
};
|
|
20
|
+
const prototypes = new Set([
|
|
21
|
+
Object,
|
|
22
|
+
Array,
|
|
23
|
+
ArrayBuffer,
|
|
24
|
+
Date,
|
|
25
|
+
DataView,
|
|
26
|
+
Map,
|
|
27
|
+
Set,
|
|
28
|
+
RegExp,
|
|
29
|
+
URL,
|
|
30
|
+
URLSearchParams,
|
|
31
|
+
Headers,
|
|
32
|
+
...Object.values(views),
|
|
33
|
+
].map((ctor) => ctor.prototype));
|
|
34
|
+
function getter(prototype, key) {
|
|
35
|
+
const read = Object.getOwnPropertyDescriptor(prototype, key).get;
|
|
36
|
+
return (value) => read.call(value);
|
|
37
|
+
}
|
|
38
|
+
// Read native internal slots, like the provider, rather than overridable instance properties.
|
|
39
|
+
const viewReaders = [DataView.prototype, Object.getPrototypeOf(Uint8Array.prototype)].map((prototype) => ({
|
|
40
|
+
buffer: getter(prototype, "buffer"),
|
|
41
|
+
byteOffset: getter(prototype, "byteOffset"),
|
|
42
|
+
byteLength: getter(prototype, "byteLength"),
|
|
43
|
+
}));
|
|
44
|
+
const mapEntries = Map.prototype.entries;
|
|
45
|
+
const setValues = Set.prototype.values;
|
|
46
|
+
const headersForEach = Headers.prototype.forEach;
|
|
47
|
+
const dateTime = Date.prototype.getTime;
|
|
48
|
+
const dateIso = Date.prototype.toISOString;
|
|
49
|
+
const regExpSource = getter(RegExp.prototype, "source");
|
|
50
|
+
const regExpFlags = getter(RegExp.prototype, "flags");
|
|
51
|
+
const urlHref = getter(URL.prototype, "href");
|
|
52
|
+
const paramsToString = URLSearchParams.prototype.toString;
|
|
53
|
+
function bytes(value) {
|
|
54
|
+
const reader = viewReaders[value instanceof DataView ? 0 : 1];
|
|
55
|
+
const view = value instanceof ArrayBuffer
|
|
56
|
+
? new Uint8Array(value)
|
|
57
|
+
: new Uint8Array(reader.buffer(value), reader.byteOffset(value), reader.byteLength(value));
|
|
58
|
+
return view.byteLength === 0 ? "." : Buffer.from(view).toString("base64");
|
|
59
|
+
}
|
|
60
|
+
function buffer(value) {
|
|
61
|
+
return Uint8Array.from(Buffer.from(value === "." ? "" : value, "base64")).buffer;
|
|
62
|
+
}
|
|
63
|
+
// Standalone runtimes may inject a WorkflowStarter without installing a provider. This is the
|
|
64
|
+
// native subset of the version-1 wire format, NOT devalue's different built-in Map/Set/byte format.
|
|
65
|
+
// Unsupported prototypes (including custom serde classes) require the server-installed codecs.
|
|
66
|
+
// Compatibility with the installed public serialization API is checked by the codec tests.
|
|
67
|
+
const nativeCodecs = {
|
|
68
|
+
reducers: {
|
|
69
|
+
Unsupported: (value) => {
|
|
70
|
+
if (value !== null && typeof value === "object") {
|
|
71
|
+
const prototype = Object.getPrototypeOf(value);
|
|
72
|
+
if (prototype !== null && !prototypes.has(prototype)) {
|
|
73
|
+
throw new TypeError("workflow_arguments_provider_codec_required");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
},
|
|
78
|
+
ArrayBuffer: (value) => value instanceof ArrayBuffer && bytes(value),
|
|
79
|
+
BigInt: (value) => typeof value === "bigint" && String(value),
|
|
80
|
+
...Object.fromEntries(Object.entries(views).map(([name, ctor]) => [
|
|
81
|
+
name,
|
|
82
|
+
(value) => value instanceof ctor && bytes(value),
|
|
83
|
+
])),
|
|
84
|
+
DataViewBytes: (value) => value instanceof DataView && bytes(value),
|
|
85
|
+
Date: (value) => value instanceof Date && (Number.isNaN(dateTime.call(value)) ? "." : dateIso.call(value)),
|
|
86
|
+
Headers: (value) => {
|
|
87
|
+
if (!(value instanceof Headers)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
const entries = [];
|
|
91
|
+
headersForEach.call(value, (entry, key) => entries.push([key, entry]));
|
|
92
|
+
return entries;
|
|
93
|
+
},
|
|
94
|
+
Map: (value) => value instanceof Map && Array.from(mapEntries.call(value)),
|
|
95
|
+
RegExp: (value) => value instanceof RegExp && { source: regExpSource(value), flags: regExpFlags(value) },
|
|
96
|
+
Set: (value) => value instanceof Set && Array.from(setValues.call(value)),
|
|
97
|
+
URL: (value) => value instanceof URL && urlHref(value),
|
|
98
|
+
URLSearchParams: (value) => value instanceof URLSearchParams && (paramsToString.call(value) || "."),
|
|
99
|
+
},
|
|
100
|
+
revivers: {
|
|
101
|
+
ArrayBuffer: buffer,
|
|
102
|
+
BigInt: (value) => BigInt(value),
|
|
103
|
+
...Object.fromEntries(Object.entries(views).map(([name, ctor]) => [
|
|
104
|
+
name,
|
|
105
|
+
(value) => new ctor(buffer(value)),
|
|
106
|
+
])),
|
|
107
|
+
DataViewBytes: (value) => new DataView(buffer(value)),
|
|
108
|
+
Date: (value) => new Date(value),
|
|
109
|
+
Headers: (value) => new Headers(value),
|
|
110
|
+
Map: (value) => new Map(value),
|
|
111
|
+
RegExp: (value) => new RegExp(value.source, value.flags),
|
|
112
|
+
Set: (value) => new Set(value),
|
|
113
|
+
URL: (value) => new URL(value),
|
|
114
|
+
URLSearchParams: (value) => new URLSearchParams(value === "." ? "" : value),
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
/** Resolves locally, without loading the Workflow SDK or consulting a provider. */
|
|
118
|
+
export function workflowArgumentCodecs() {
|
|
119
|
+
return globals[CODECS] ?? nativeCodecs;
|
|
120
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** JSONB stores this object; historical rows stored the argument array directly. */
|
|
2
|
+
export interface StoredWorkflowArguments {
|
|
3
|
+
readonly codec: "segmentstream.workflow-arguments";
|
|
4
|
+
readonly version: 1;
|
|
5
|
+
readonly data: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class WorkflowArgumentsError extends TypeError {
|
|
8
|
+
readonly code: "workflow_arguments_unsupported" | "workflow_arguments_invalid_encoding";
|
|
9
|
+
readonly name = "WorkflowArgumentsError";
|
|
10
|
+
constructor(code: "workflow_arguments_unsupported" | "workflow_arguments_invalid_encoding", cause?: unknown);
|
|
11
|
+
}
|
|
12
|
+
/** Deterministic, type-sensitive graph encoding; no provider access or JSON coercion. */
|
|
13
|
+
export declare function encodeWorkflowArguments(args: ReadonlyArray<unknown>): StoredWorkflowArguments;
|
|
14
|
+
/** Read the persisted winner without consulting a newer workflow declaration. */
|
|
15
|
+
export declare function decodeWorkflowArguments(stored: unknown): unknown[];
|
|
16
|
+
/** Only lossless JSON trees may match the previous provider binding format. */
|
|
17
|
+
export declare function legacyWorkflowArgumentsJson(args: ReadonlyArray<unknown>): string | undefined;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { defaultStringifyOperations, parse, stringify } from "devalue";
|
|
2
|
+
import { workflowArgumentCodecs } from "./workflow-argument-codec.js";
|
|
3
|
+
export class WorkflowArgumentsError extends TypeError {
|
|
4
|
+
code;
|
|
5
|
+
name = "WorkflowArgumentsError";
|
|
6
|
+
constructor(code, cause) {
|
|
7
|
+
super(code, { cause });
|
|
8
|
+
this.code = code;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const options = {
|
|
12
|
+
operations: {
|
|
13
|
+
shapeOf(value) {
|
|
14
|
+
const shape = defaultStringifyOperations.shapeOf(value);
|
|
15
|
+
return "keys" in shape ? { ...shape, keys: shape.keys.sort() } : shape;
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
/** Deterministic, type-sensitive graph encoding; no provider access or JSON coercion. */
|
|
20
|
+
export function encodeWorkflowArguments(args) {
|
|
21
|
+
try {
|
|
22
|
+
if (!Array.isArray(args)) {
|
|
23
|
+
throw new TypeError("workflow_arguments_array_required");
|
|
24
|
+
}
|
|
25
|
+
const { reducers, revivers } = workflowArgumentCodecs();
|
|
26
|
+
const data = stringify(args, reducers, options);
|
|
27
|
+
// Reject values the installed runtime cannot hydrate before journal commit
|
|
28
|
+
// (for example a custom-reviver cycle or an unregistered serde class).
|
|
29
|
+
if (stringify(parse(data, revivers), reducers, options) !== data) {
|
|
30
|
+
throw new TypeError("workflow_arguments_unstable_codec");
|
|
31
|
+
}
|
|
32
|
+
return { codec: "segmentstream.workflow-arguments", version: 1, data };
|
|
33
|
+
}
|
|
34
|
+
catch (cause) {
|
|
35
|
+
throw new WorkflowArgumentsError("workflow_arguments_unsupported", cause);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Read the persisted winner without consulting a newer workflow declaration. */
|
|
39
|
+
export function decodeWorkflowArguments(stored) {
|
|
40
|
+
try {
|
|
41
|
+
// @legacy ontology.workflow-run-legacy-encodings
|
|
42
|
+
if (Array.isArray(stored)) {
|
|
43
|
+
return stored;
|
|
44
|
+
}
|
|
45
|
+
if (stored === null ||
|
|
46
|
+
typeof stored !== "object" ||
|
|
47
|
+
!("codec" in stored) ||
|
|
48
|
+
stored.codec !== "segmentstream.workflow-arguments" ||
|
|
49
|
+
!("version" in stored) ||
|
|
50
|
+
stored.version !== 1 ||
|
|
51
|
+
!("data" in stored) ||
|
|
52
|
+
typeof stored.data !== "string") {
|
|
53
|
+
throw new TypeError("workflow_arguments_envelope_required");
|
|
54
|
+
}
|
|
55
|
+
const { reducers, revivers } = workflowArgumentCodecs();
|
|
56
|
+
const args = parse(stored.data, revivers);
|
|
57
|
+
if (!Array.isArray(args)) {
|
|
58
|
+
throw new TypeError("workflow_arguments_array_required");
|
|
59
|
+
}
|
|
60
|
+
if (stringify(args, reducers, options) !== stored.data) {
|
|
61
|
+
throw new TypeError("workflow_arguments_codec_changed");
|
|
62
|
+
}
|
|
63
|
+
return args;
|
|
64
|
+
}
|
|
65
|
+
catch (cause) {
|
|
66
|
+
throw new WorkflowArgumentsError("workflow_arguments_invalid_encoding", cause);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// @legacy ontology.workflow-run-legacy-encodings
|
|
70
|
+
/** Only lossless JSON trees may match the previous provider binding format. */
|
|
71
|
+
export function legacyWorkflowArgumentsJson(args) {
|
|
72
|
+
const seen = new Set();
|
|
73
|
+
const encode = (value) => {
|
|
74
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
75
|
+
return JSON.stringify(value);
|
|
76
|
+
}
|
|
77
|
+
if (typeof value === "number" && Number.isFinite(value) && !Object.is(value, -0)) {
|
|
78
|
+
return JSON.stringify(value);
|
|
79
|
+
}
|
|
80
|
+
if (typeof value !== "object" ||
|
|
81
|
+
seen.has(value) ||
|
|
82
|
+
(!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype)) {
|
|
83
|
+
throw new TypeError("workflow_arguments_not_legacy_json");
|
|
84
|
+
}
|
|
85
|
+
seen.add(value);
|
|
86
|
+
return Array.isArray(value)
|
|
87
|
+
? `[${Array.from(value, encode).join(",")}]`
|
|
88
|
+
: `{${Object.keys(value)
|
|
89
|
+
.sort()
|
|
90
|
+
.map((key) => `${JSON.stringify(key)}:${encode(value[key])}`)
|
|
91
|
+
.join(",")}}`;
|
|
92
|
+
};
|
|
93
|
+
try {
|
|
94
|
+
return encode(args);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { Context, Effect, Schema } from "effect";
|
|
2
|
+
import type { SqlClient } from "effect/unstable/sql";
|
|
3
|
+
import type { SqlError } from "effect/unstable/sql/SqlError";
|
|
4
|
+
import type { AnyAction } from "../action.js";
|
|
5
|
+
import type { Ontology } from "../ontology.js";
|
|
6
|
+
import type { Principal, StoredRecord } from "../runtime.js";
|
|
7
|
+
import { type ActionEvent, type TriggerFunction, type WorkflowRunContext } from "../workflow.js";
|
|
8
|
+
import type { StartRecoveryOutcome } from "../start-recovery-contract.js";
|
|
9
|
+
import { TriggerInputInvalid } from "./errors.js";
|
|
10
|
+
import type { Edit } from "./history.js";
|
|
11
|
+
/** Starts that fail this many times are left for an operator: the automatic sweep skips them. */
|
|
12
|
+
export declare const MAX_START_ATTEMPTS = 10;
|
|
13
|
+
/** How long a pending row waits before a sweep takes it: its own request starts it first. */
|
|
14
|
+
export declare const SWEEP_DELAY_SECONDS = 30;
|
|
15
|
+
/** The most rows one sweep starts. */
|
|
16
|
+
export declare const SWEEP_BATCH = 100;
|
|
17
|
+
/** How long started rows are kept, for the starts listing, before the sweep deletes them. */
|
|
18
|
+
export declare const STARTED_RETENTION_DAYS = 30;
|
|
19
|
+
/** A start an action trigger decided: one row of `_workflow_starts`. */
|
|
20
|
+
export interface PendingStart {
|
|
21
|
+
readonly reservation?: import("./workflow-admission.js").WorkflowReservation;
|
|
22
|
+
readonly arguments?: ReadonlyArray<unknown>;
|
|
23
|
+
readonly attributes?: Readonly<Record<string, string>>;
|
|
24
|
+
readonly workflowId?: string;
|
|
25
|
+
readonly deploymentId?: string;
|
|
26
|
+
/** `<workflow>.<trigger>`, in wire names. */
|
|
27
|
+
readonly trigger: string;
|
|
28
|
+
/** The workflow's wire name. */
|
|
29
|
+
readonly workflow: string;
|
|
30
|
+
readonly actionId: string;
|
|
31
|
+
/** The record the trigger was evaluated for; `null` when it fired once, for the record the input names. */
|
|
32
|
+
readonly recordId: string | null;
|
|
33
|
+
/** The workflow's input in its wire form, as the cron route receives it. */
|
|
34
|
+
readonly input: unknown;
|
|
35
|
+
}
|
|
36
|
+
declare const WorkflowStartFailed_base: Schema.Class<WorkflowStartFailed, Schema.TaggedStruct<"WorkflowStartFailed", {
|
|
37
|
+
readonly reason: Schema.Literals<readonly ["unknown_workflow", "not_compiled", "no_recovery_workflow", "invalid_input", "engine", "timeout"]>;
|
|
38
|
+
readonly message: Schema.String;
|
|
39
|
+
readonly cause: Schema.optionalKey<Schema.Unknown>;
|
|
40
|
+
}>, import("effect/Cause").YieldableError>;
|
|
41
|
+
/** The Workflow SDK refused or did not answer a start; the row stays pending. */
|
|
42
|
+
export declare class WorkflowStartFailed extends WorkflowStartFailed_base {
|
|
43
|
+
}
|
|
44
|
+
declare const WorkflowStarter_base: Context.ServiceClass<WorkflowStarter, "@segmentstream/ontology/WorkflowStarter", {
|
|
45
|
+
readonly recoveryHorizon?: () => number;
|
|
46
|
+
readonly allocateRun?: () => Promise<import("./workflow-admission.js").WorkflowReservation>;
|
|
47
|
+
/** The run id the Workflow SDK accepted. */
|
|
48
|
+
readonly start: (start: PendingStart) => Effect.Effect<string, WorkflowStartFailed>;
|
|
49
|
+
readonly prepare?: (start: PendingStart) => Effect.Effect<import("./workflow-admission.js").AdmittedWorkflowStart, WorkflowStartFailed>;
|
|
50
|
+
/** Pure code-derived binding; safe to capture in the action transaction before commit. */
|
|
51
|
+
readonly capture?: (start: PendingStart) => Omit<import("./workflow-admission.js").AdmittedWorkflowStart, "reservation">;
|
|
52
|
+
/**
|
|
53
|
+
* Makes sure a recovery run will sweep after `commitBy`, the latest instant (epoch ms) the
|
|
54
|
+
* calling action may commit at; it starts one unless an armed run already covers it. An action
|
|
55
|
+
* whose triggers may fire calls it before its transaction opens, and is refused when it fails.
|
|
56
|
+
*/
|
|
57
|
+
readonly ensureRecovery: (input: {
|
|
58
|
+
readonly commitBy: number;
|
|
59
|
+
readonly submit?: (input: {
|
|
60
|
+
readonly workflowId: string;
|
|
61
|
+
readonly arguments: ReadonlyArray<unknown>;
|
|
62
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
63
|
+
}) => Promise<{
|
|
64
|
+
readonly runId: string;
|
|
65
|
+
}>;
|
|
66
|
+
}) => Effect.Effect<void, WorkflowStartFailed>;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Starts the run of a pending row through the Workflow SDK, on the ontology's queue, with
|
|
70
|
+
* `startedBy` naming the trigger, the action and the record, and arms the recovery run that starts
|
|
71
|
+
* what a request leaves pending. The ontology service provides it; a runtime without one leaves its
|
|
72
|
+
* rows pending for an operator's sweep.
|
|
73
|
+
*/
|
|
74
|
+
export declare class WorkflowStarter extends WorkflowStarter_base {
|
|
75
|
+
}
|
|
76
|
+
/** The `startedBy` of a run an action trigger started. */
|
|
77
|
+
export declare function triggerContext(start: PendingStart): WorkflowRunContext;
|
|
78
|
+
/** An action trigger as the runtime evaluates it: the manifest's names and the authored functions. */
|
|
79
|
+
export interface ResolvedActionTrigger {
|
|
80
|
+
/** The workflow's wire name. */
|
|
81
|
+
readonly workflow: string;
|
|
82
|
+
/** `<workflow>.<trigger>`, in wire names. */
|
|
83
|
+
readonly trigger: string;
|
|
84
|
+
/** The entity's wire name. */
|
|
85
|
+
readonly entity: string;
|
|
86
|
+
/** The action's wire name; `undefined` for any action of the entity. */
|
|
87
|
+
readonly action: string | undefined;
|
|
88
|
+
readonly when: TriggerFunction<ActionEvent, unknown, boolean> | undefined;
|
|
89
|
+
readonly input: TriggerFunction<ActionEvent, unknown, unknown> | undefined;
|
|
90
|
+
/** The workflow's input codec, TypeScript names on the type side and wire names encoded. */
|
|
91
|
+
readonly codec: Schema.Top;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The action triggers of the workflows that passed `check`, paired with their declarations. Built
|
|
95
|
+
* once per ontology.
|
|
96
|
+
*/
|
|
97
|
+
export declare function actionTriggers(ontology: Ontology): ReadonlyArray<ResolvedActionTrigger>;
|
|
98
|
+
/** Whether the ontology declares any action trigger, so that `_workflow_starts` exists. */
|
|
99
|
+
export declare function hasActionTriggers(ontology: Ontology): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The triggers that fire for an action of `entity` run by `principal`: on that action or on the
|
|
102
|
+
* entity, except the triggers of the workflow whose user runs it, so that a workflow never starts
|
|
103
|
+
* itself.
|
|
104
|
+
*/
|
|
105
|
+
export declare function matchingTriggers(ontology: Ontology, entity: string, action: string, principal: Principal): ReadonlyArray<ResolvedActionTrigger>;
|
|
106
|
+
/** A record of the trigger's entity the action edited, as stored before and after it. */
|
|
107
|
+
export interface HeldRecord {
|
|
108
|
+
readonly before: StoredRecord | undefined;
|
|
109
|
+
readonly after: StoredRecord | undefined;
|
|
110
|
+
}
|
|
111
|
+
/** What the action's transaction knows when its handler returned. */
|
|
112
|
+
export interface TriggerEvaluation {
|
|
113
|
+
readonly ontology: Ontology;
|
|
114
|
+
/** The entity's wire name. */
|
|
115
|
+
readonly entity: string;
|
|
116
|
+
/** The action's wire name. */
|
|
117
|
+
readonly action: string;
|
|
118
|
+
readonly definition: AnyAction;
|
|
119
|
+
/** A generated action: its input and result are in wire names. */
|
|
120
|
+
readonly generated: boolean;
|
|
121
|
+
readonly actionId: string;
|
|
122
|
+
/** When the action ran: the transaction's time, as history records it. */
|
|
123
|
+
readonly at: string;
|
|
124
|
+
readonly principal: Principal;
|
|
125
|
+
/** The decoded input. */
|
|
126
|
+
readonly input: unknown;
|
|
127
|
+
readonly result: unknown;
|
|
128
|
+
readonly edits: ReadonlyArray<Edit>;
|
|
129
|
+
/** The before and after of each created, updated or deleted record of the entity, by id. */
|
|
130
|
+
readonly held: ReadonlyMap<string, HeldRecord>;
|
|
131
|
+
/** The current record, for a record the action only linked or unlinked. */
|
|
132
|
+
readonly load: (id: string) => Effect.Effect<StoredRecord | undefined, SqlError>;
|
|
133
|
+
}
|
|
134
|
+
/** A trigger function threw, or `when` answered something other than a boolean: a defect. */
|
|
135
|
+
export declare class TriggerFunctionFailed extends Error {
|
|
136
|
+
constructor(trigger: string, part: "when" | "input", cause: unknown);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Evaluates the matching triggers inside the action's transaction: selects the records, runs
|
|
140
|
+
* `when`, maps and validates the input with the workflow's input schema. A function that throws is
|
|
141
|
+
* a defect, which rolls the action back; an input the workflow does not accept fails the action
|
|
142
|
+
* with {@link TriggerInputInvalid}. The starts it answers are in the wire form the rows store.
|
|
143
|
+
*/
|
|
144
|
+
export declare function evaluateTriggers(triggers: ReadonlyArray<ResolvedActionTrigger>, evaluation: TriggerEvaluation): Effect.Effect<ReadonlyArray<PendingStart>, TriggerInputInvalid, never>;
|
|
145
|
+
/** Inserts the starts in the action's transaction, so they commit with its records and history. */
|
|
146
|
+
export declare function insertStarts(sql: SqlClient.SqlClient, starts: ReadonlyArray<PendingStart>): Effect.Effect<void, SqlError>;
|
|
147
|
+
/**
|
|
148
|
+
* Starts the rows an action's transaction inserted, after its commit, in the same request. A
|
|
149
|
+
* failure is logged and leaves the row pending for the sweep; nothing here fails the action.
|
|
150
|
+
*/
|
|
151
|
+
export declare function startCommitted(sql: SqlClient.SqlClient, starter: WorkflowStarter["Service"] | undefined, starts: ReadonlyArray<PendingStart>, requestId: string): Effect.Effect<void>;
|
|
152
|
+
/**
|
|
153
|
+
* What one sweep did: runs started, starts that failed again, rows left for an operator, rows an
|
|
154
|
+
* automatic sweep still takes, and the database's clock. The same shape the recovery run's step
|
|
155
|
+
* answers with.
|
|
156
|
+
*/
|
|
157
|
+
export type SweepResult = StartRecoveryOutcome;
|
|
158
|
+
/**
|
|
159
|
+
* The sweep: starts up to {@link SWEEP_BATCH} rows pending for more than
|
|
160
|
+
* {@link SWEEP_DELAY_SECONDS}, oldest first, locked with `SKIP LOCKED` so that concurrent sweeps
|
|
161
|
+
* take different rows, and records each outcome before the locks are released. Rows that failed
|
|
162
|
+
* {@link MAX_START_ATTEMPTS} times are taken only with `retryAbandoned`. Started rows older than
|
|
163
|
+
* {@link STARTED_RETENTION_DAYS} days are deleted. `waiting` counts the pending rows an automatic
|
|
164
|
+
* sweep still takes, young ones included, created before `before` when it is given: the recovery
|
|
165
|
+
* run's horizon.
|
|
166
|
+
*/
|
|
167
|
+
export declare function sweepStarts(sql: SqlClient.SqlClient, starter: WorkflowStarter["Service"] | undefined, options: {
|
|
168
|
+
readonly retryAbandoned: boolean;
|
|
169
|
+
readonly requestId: string;
|
|
170
|
+
/** ISO 8601; counts as waiting only the rows created before it. */
|
|
171
|
+
readonly before?: string | undefined;
|
|
172
|
+
}): Effect.Effect<SweepResult, SqlError>;
|
|
173
|
+
/** A row of the starts listing; the input stays in the database. */
|
|
174
|
+
export interface WorkflowStartView {
|
|
175
|
+
readonly trigger: string;
|
|
176
|
+
readonly actionId: string;
|
|
177
|
+
readonly recordId: string | null;
|
|
178
|
+
readonly createdAt: string;
|
|
179
|
+
readonly runId: string | null;
|
|
180
|
+
readonly startedAt: string | null;
|
|
181
|
+
readonly attempts: number;
|
|
182
|
+
}
|
|
183
|
+
export interface WorkflowStartsPage {
|
|
184
|
+
readonly items: ReadonlyArray<WorkflowStartView>;
|
|
185
|
+
readonly nextCursor: string | null;
|
|
186
|
+
}
|
|
187
|
+
declare const InvalidStartsCursor_base: Schema.Class<InvalidStartsCursor, Schema.TaggedStruct<"InvalidStartsCursor", {
|
|
188
|
+
readonly message: Schema.String;
|
|
189
|
+
}>, import("effect/Cause").YieldableError>;
|
|
190
|
+
/** The starts listing's cursor does not decode: it was not one this listing gave. */
|
|
191
|
+
export declare class InvalidStartsCursor extends InvalidStartsCursor_base {
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* A page of a workflow's starts, newest first: all of them, or only the pending or the started
|
|
195
|
+
* ones. A database without `_workflow_starts` has none.
|
|
196
|
+
*/
|
|
197
|
+
export declare function listStarts(sql: SqlClient.SqlClient, input: {
|
|
198
|
+
readonly workflow: string;
|
|
199
|
+
readonly pending?: boolean | undefined;
|
|
200
|
+
readonly limit: number;
|
|
201
|
+
readonly after?: string | undefined;
|
|
202
|
+
}): Effect.Effect<WorkflowStartsPage, InvalidStartsCursor | SqlError>;
|
|
203
|
+
export {};
|