@segmentstream/ontology 0.0.0-stage → 0.92.1
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,96 @@
|
|
|
1
|
+
import { InvalidOntology } from "../diagnostics.js";
|
|
2
|
+
import { generatedActionPermissions } from "../permissions.js";
|
|
3
|
+
const DEFAULT_PHRASE = "has";
|
|
4
|
+
function declaredTraversal({ name, relationship, target }) {
|
|
5
|
+
const pair = relationship.cardinality === "one" ? Object.entries(relationship.on ?? {})[0] : undefined;
|
|
6
|
+
return {
|
|
7
|
+
name,
|
|
8
|
+
kind: relationship.cardinality,
|
|
9
|
+
target: target ?? "",
|
|
10
|
+
opposite: relationship.inverse,
|
|
11
|
+
phrase: relationship.phrase?.[0] ?? DEFAULT_PHRASE,
|
|
12
|
+
description: relationship.description,
|
|
13
|
+
...(pair === undefined ? {} : { match: { source: pair[0], target: pair[1] } }),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function inverseTraversals(owner, entities) {
|
|
17
|
+
return entities.flatMap((source) => source.relationships
|
|
18
|
+
.filter((candidate) => candidate.target === owner)
|
|
19
|
+
.map(({ name, relationship }) => {
|
|
20
|
+
const pair = relationship.cardinality === "one" ? Object.entries(relationship.on ?? {})[0] : undefined;
|
|
21
|
+
return {
|
|
22
|
+
name: relationship.inverse,
|
|
23
|
+
kind: relationship.cardinality === "one"
|
|
24
|
+
? "inverseOfOne"
|
|
25
|
+
: "inverseOfMany",
|
|
26
|
+
target: source.name,
|
|
27
|
+
opposite: name,
|
|
28
|
+
phrase: relationship.phrase?.[1] ?? DEFAULT_PHRASE,
|
|
29
|
+
description: relationship.description,
|
|
30
|
+
...(pair === undefined
|
|
31
|
+
? {}
|
|
32
|
+
: {
|
|
33
|
+
match: {
|
|
34
|
+
source: pair[1],
|
|
35
|
+
target: pair[0],
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
function plannedActions(resolved, generatedActions, report) {
|
|
42
|
+
if (resolved.entity.definition.source !== undefined) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const generated = Object.entries(generatedActions(resolved)).map(([name, action]) => ({
|
|
46
|
+
name,
|
|
47
|
+
action,
|
|
48
|
+
generated: true,
|
|
49
|
+
permissions: generatedActionPermissions(resolved.name, name),
|
|
50
|
+
}));
|
|
51
|
+
const authored = resolved.actions.map(({ name, action, permission, writes }) => ({
|
|
52
|
+
name,
|
|
53
|
+
action,
|
|
54
|
+
generated: false,
|
|
55
|
+
permissions: [permission],
|
|
56
|
+
...(writes === undefined ? {} : { writes }),
|
|
57
|
+
}));
|
|
58
|
+
const actions = [...generated, ...authored];
|
|
59
|
+
const names = new Set();
|
|
60
|
+
for (const { name } of actions) {
|
|
61
|
+
if (names.has(name)) {
|
|
62
|
+
report(`${resolved.name}.actions.${name}`, `${name} is both generated and authored.`);
|
|
63
|
+
}
|
|
64
|
+
names.add(name);
|
|
65
|
+
}
|
|
66
|
+
return actions;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Plans the routes of a checked ontology. `check` already refuses names that would shadow a route of
|
|
70
|
+
* the service; this throws {@link InvalidOntology} when a generated action would shadow an authored
|
|
71
|
+
* one.
|
|
72
|
+
*/
|
|
73
|
+
export function planApi(ontology, generatedActions) {
|
|
74
|
+
const diagnostics = [];
|
|
75
|
+
const report = (path, message) => {
|
|
76
|
+
diagnostics.push({ severity: "error", code: "reserved-name", path, message });
|
|
77
|
+
};
|
|
78
|
+
const entities = ontology.entities.map((resolved) => ({
|
|
79
|
+
name: resolved.name,
|
|
80
|
+
resolved,
|
|
81
|
+
traversals: [
|
|
82
|
+
...resolved.relationships.map(declaredTraversal),
|
|
83
|
+
...inverseTraversals(resolved.name, ontology.entities),
|
|
84
|
+
],
|
|
85
|
+
actions: plannedActions(resolved, (entity) => generatedActions(entity, ontology), report),
|
|
86
|
+
}));
|
|
87
|
+
if (diagnostics.length > 0) {
|
|
88
|
+
throw new InvalidOntology({
|
|
89
|
+
message: `The ontology service cannot serve this ontology:\n${diagnostics
|
|
90
|
+
.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`)
|
|
91
|
+
.join("\n")}`,
|
|
92
|
+
diagnostics,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return { ontology, entities };
|
|
96
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HttpServerRequest } from "effect/unstable/http";
|
|
2
|
+
/** Requests a fixed window allows per key, as one service instance counts them. */
|
|
3
|
+
export interface RateLimit {
|
|
4
|
+
readonly limit: number;
|
|
5
|
+
readonly windowMs: number;
|
|
6
|
+
/** Keys tracked at most; expired windows are dropped first, then the oldest. */
|
|
7
|
+
readonly maxKeys: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RateLimiter {
|
|
10
|
+
/** Counts one request for `key`: the seconds to wait when it is over the limit, else `undefined`. */
|
|
11
|
+
readonly take: (key: string, now?: number) => number | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A fixed-window counter in this instance's memory. Serverless instances do not share it, so it
|
|
15
|
+
* slows a client down rather than enforcing an exact limit across the deployment.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fixedWindowLimiter({ limit, windowMs, maxKeys }: RateLimit): RateLimiter;
|
|
18
|
+
/**
|
|
19
|
+
* The client's address: `x-real-ip`, which Vercel sets, else the first `x-forwarded-for` hop, else
|
|
20
|
+
* the socket's address. Requests that carry none share one key.
|
|
21
|
+
*/
|
|
22
|
+
export declare function clientAddress(request: HttpServerRequest.HttpServerRequest): string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Option } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* A fixed-window counter in this instance's memory. Serverless instances do not share it, so it
|
|
4
|
+
* slows a client down rather than enforcing an exact limit across the deployment.
|
|
5
|
+
*/
|
|
6
|
+
export function fixedWindowLimiter({ limit, windowMs, maxKeys }) {
|
|
7
|
+
const windows = new Map();
|
|
8
|
+
function prune(now) {
|
|
9
|
+
for (const [key, window] of windows) {
|
|
10
|
+
if (now - window.start >= windowMs) {
|
|
11
|
+
windows.delete(key);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
for (const key of windows.keys()) {
|
|
15
|
+
if (windows.size < maxKeys) {
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
windows.delete(key);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
take(key, now = Date.now()) {
|
|
23
|
+
const current = windows.get(key);
|
|
24
|
+
if (current === undefined || now - current.start >= windowMs) {
|
|
25
|
+
if (current === undefined && windows.size >= maxKeys) {
|
|
26
|
+
prune(now);
|
|
27
|
+
}
|
|
28
|
+
windows.set(key, { start: now, count: 1 });
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
current.count += 1;
|
|
32
|
+
return current.count > limit
|
|
33
|
+
? Math.max(1, Math.ceil((current.start + windowMs - now) / 1000))
|
|
34
|
+
: undefined;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The client's address: `x-real-ip`, which Vercel sets, else the first `x-forwarded-for` hop, else
|
|
40
|
+
* the socket's address. Requests that carry none share one key.
|
|
41
|
+
*/
|
|
42
|
+
export function clientAddress(request) {
|
|
43
|
+
const realIp = request.headers["x-real-ip"]?.trim();
|
|
44
|
+
if (realIp !== undefined && realIp !== "") {
|
|
45
|
+
return realIp;
|
|
46
|
+
}
|
|
47
|
+
const forwarded = request.headers["x-forwarded-for"]?.split(",")[0]?.trim();
|
|
48
|
+
if (forwarded !== undefined && forwarded !== "") {
|
|
49
|
+
return forwarded;
|
|
50
|
+
}
|
|
51
|
+
return Option.getOrElse(request.remoteAddress ?? Option.none(), () => "unknown");
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { NotFound, PermissionDenied } from "../errors.js";
|
|
3
|
+
import { type QueryResult } from "../query.js";
|
|
4
|
+
import { InvalidQuery } from "../runtime/errors.js";
|
|
5
|
+
import type { StoredRecord } from "../runtime.js";
|
|
6
|
+
import { CurrentPrincipal } from "./authentication.js";
|
|
7
|
+
import { RequestId, WarehouseReadUnavailable } from "./errors.js";
|
|
8
|
+
import type { ApiPlan } from "./plan.js";
|
|
9
|
+
import type { OntologyBackend } from "./runtime-contract.js";
|
|
10
|
+
type Backend = OntologyBackend["Service"];
|
|
11
|
+
type FindInput = Parameters<Backend["find"]>[0];
|
|
12
|
+
type GetInput = Parameters<Backend["get"]>[0];
|
|
13
|
+
type Failure = InvalidQuery | NotFound | PermissionDenied | WarehouseReadUnavailable;
|
|
14
|
+
type Read<A> = Effect.Effect<A, Failure, CurrentPrincipal | RequestId>;
|
|
15
|
+
export interface RecordReads {
|
|
16
|
+
readonly get: (input: GetInput) => Read<StoredRecord>;
|
|
17
|
+
readonly find: (input: FindInput) => Read<QueryResult<StoredRecord>>;
|
|
18
|
+
}
|
|
19
|
+
/** Composes the existing scoped stored reader with observations, without moving either store. */
|
|
20
|
+
export declare function recordReads(backend: Backend, plan: ApiPlan): RecordReads;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { Effect, Option, Schema } from "effect";
|
|
2
|
+
import { NotFound, PermissionDenied } from "../errors.js";
|
|
3
|
+
import { readScope } from "../permissions.js";
|
|
4
|
+
import { entityQuerySchema, includedRelationships, } from "../query.js";
|
|
5
|
+
import { InvalidQuery } from "../runtime/errors.js";
|
|
6
|
+
import { CurrentPrincipal } from "./authentication.js";
|
|
7
|
+
import { RequestId, schemaIssues, WarehouseReadUnavailable } from "./errors.js";
|
|
8
|
+
import { WarehouseQueries } from "./warehouse-platform.js";
|
|
9
|
+
import { compileWarehouseQuery } from "./warehouse-query.js";
|
|
10
|
+
/** Composes the existing scoped stored reader with observations, without moving either store. */
|
|
11
|
+
export function recordReads(backend, plan) {
|
|
12
|
+
const { manifest } = plan.ontology;
|
|
13
|
+
const entities = new Map(manifest.entities.map((entity) => [entity.name, entity]));
|
|
14
|
+
const planned = new Map(plan.entities.map((entity) => [entity.name, entity]));
|
|
15
|
+
const invalid = (entity, message) => new InvalidQuery({
|
|
16
|
+
entity,
|
|
17
|
+
message,
|
|
18
|
+
issues: [{ path: [], message }],
|
|
19
|
+
});
|
|
20
|
+
const validate = (entity, query) => Schema.decodeUnknownEffect(entityQuerySchema(manifest, entity, true))(query, {
|
|
21
|
+
errors: "all",
|
|
22
|
+
}).pipe(Effect.mapError((error) => new InvalidQuery({
|
|
23
|
+
entity,
|
|
24
|
+
message: "The query does not match the entity.",
|
|
25
|
+
issues: schemaIssues(error.issue),
|
|
26
|
+
})));
|
|
27
|
+
const baseFind = (input) => Effect.gen(function* () {
|
|
28
|
+
const entity = entities.get(input.entity);
|
|
29
|
+
if (entity?.source === undefined) {
|
|
30
|
+
return yield* backend.find(input);
|
|
31
|
+
}
|
|
32
|
+
const principal = yield* CurrentPrincipal;
|
|
33
|
+
if (readScope(entity.name, principal) !== undefined) {
|
|
34
|
+
return yield* new PermissionDenied({
|
|
35
|
+
permission: `${entity.name}:read`,
|
|
36
|
+
message: "Warehouse records do not support scoped warehouse read grants.",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const query = yield* validate(entity.name, input.query);
|
|
40
|
+
const transport = yield* Effect.serviceOption(WarehouseQueries);
|
|
41
|
+
if (Option.isNone(transport)) {
|
|
42
|
+
return yield* new WarehouseReadUnavailable({ reason: "not_configured" });
|
|
43
|
+
}
|
|
44
|
+
const statement = yield* Effect.try({
|
|
45
|
+
try: () => compileWarehouseQuery(manifest, entity, query),
|
|
46
|
+
catch: (error) => error instanceof InvalidQuery
|
|
47
|
+
? error
|
|
48
|
+
: new WarehouseReadUnavailable({ reason: "upstream", cause: error }),
|
|
49
|
+
});
|
|
50
|
+
const requestId = yield* RequestId;
|
|
51
|
+
const rows = yield* transport.value({ statement, requestId, principalId: principal.id });
|
|
52
|
+
return yield* Effect.try({
|
|
53
|
+
try: () => statement.decode(rows),
|
|
54
|
+
catch: (error) => error instanceof InvalidQuery
|
|
55
|
+
? error
|
|
56
|
+
: new WarehouseReadUnavailable({ reason: "upstream", cause: error }),
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
get: (input) => Effect.gen(function* () {
|
|
61
|
+
if (entities.get(input.entity)?.source === undefined) {
|
|
62
|
+
return yield* backend.get(input);
|
|
63
|
+
}
|
|
64
|
+
const result = yield* baseFind({
|
|
65
|
+
entity: input.entity,
|
|
66
|
+
query: { where: { id: input.id }, limit: 1 },
|
|
67
|
+
...(input.reader === undefined ? {} : { reader: input.reader }),
|
|
68
|
+
});
|
|
69
|
+
const record = result.items[0];
|
|
70
|
+
if (record === undefined) {
|
|
71
|
+
return yield* new NotFound({
|
|
72
|
+
entity: input.entity,
|
|
73
|
+
id: input.id,
|
|
74
|
+
message: "The warehouse record was not found.",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return record;
|
|
78
|
+
}),
|
|
79
|
+
find: (input) => Effect.gen(function* () {
|
|
80
|
+
const definition = planned.get(input.entity);
|
|
81
|
+
const names = includedRelationships(input.query.include);
|
|
82
|
+
const matched = definition?.traversals.filter((traversal) => names.includes(traversal.name) && traversal.match !== undefined) ?? [];
|
|
83
|
+
if (matched.length === 0) {
|
|
84
|
+
return yield* baseFind(input);
|
|
85
|
+
}
|
|
86
|
+
const query = yield* validate(input.entity, input.query);
|
|
87
|
+
const physical = names.filter((name) => !matched.some((link) => link.name === name));
|
|
88
|
+
const select = query.select === undefined
|
|
89
|
+
? undefined
|
|
90
|
+
: [...new Set([...query.select, ...matched.map((link) => link.match.source)])];
|
|
91
|
+
const page = yield* baseFind({
|
|
92
|
+
...input,
|
|
93
|
+
query: {
|
|
94
|
+
...query,
|
|
95
|
+
include: physical,
|
|
96
|
+
...(select === undefined ? {} : { select }),
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
let items = [...page.items];
|
|
100
|
+
for (const link of matched) {
|
|
101
|
+
const match = link.match;
|
|
102
|
+
const candidates = items
|
|
103
|
+
.map((item) => item[match.source])
|
|
104
|
+
.filter((value) => value !== null && value !== undefined);
|
|
105
|
+
if (candidates.some((value) => typeof value !== "string" &&
|
|
106
|
+
typeof value !== "number" &&
|
|
107
|
+
typeof value !== "boolean")) {
|
|
108
|
+
return yield* invalid(input.entity, "A relationship key must be a scalar value.");
|
|
109
|
+
}
|
|
110
|
+
const values = [
|
|
111
|
+
...new Set(candidates.filter((value) => typeof value === "string" ||
|
|
112
|
+
typeof value === "number" ||
|
|
113
|
+
typeof value === "boolean")),
|
|
114
|
+
];
|
|
115
|
+
const grouped = new Map();
|
|
116
|
+
if (values.length > 0) {
|
|
117
|
+
const related = yield* baseFind({
|
|
118
|
+
entity: link.target,
|
|
119
|
+
query: { where: { [match.target]: { in: values } }, limit: 200 },
|
|
120
|
+
...(input.reader === undefined ? {} : { reader: input.reader }),
|
|
121
|
+
});
|
|
122
|
+
if (related.nextCursor !== null) {
|
|
123
|
+
return yield* invalid(input.entity, "Related records exceed a bounded include; use the paged relationship route.");
|
|
124
|
+
}
|
|
125
|
+
for (const record of related.items) {
|
|
126
|
+
const key = record[match.target];
|
|
127
|
+
if (key !== null && key !== undefined) {
|
|
128
|
+
const group = grouped.get(key) ?? [];
|
|
129
|
+
group.push(record);
|
|
130
|
+
grouped.set(key, group);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (link.kind === "one" && [...grouped.values()].some((group) => group.length > 1)) {
|
|
135
|
+
return yield* invalid(input.entity, "The target key of a to-one relationship is not unique.");
|
|
136
|
+
}
|
|
137
|
+
items = items.map((record) => ({
|
|
138
|
+
...record,
|
|
139
|
+
[link.name]: link.kind === "one"
|
|
140
|
+
? (grouped.get(record[match.source])?.[0] ?? null)
|
|
141
|
+
: (grouped.get(record[match.source]) ?? []),
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
if (query.select !== undefined) {
|
|
145
|
+
const selected = new Set(["id", ...query.select, ...names]);
|
|
146
|
+
items = items.map((record) => Object.fromEntries(Object.entries(record).filter(([name]) => selected.has(name))));
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
...page,
|
|
150
|
+
items,
|
|
151
|
+
...(query.select === undefined ? {} : { projected: true }),
|
|
152
|
+
};
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { OntologyEnvironment } from "./config.js";
|
|
3
|
+
export type ReplicationKick = (identity: string | undefined) => Effect.Effect<void>;
|
|
4
|
+
/** Coalesce best-effort wakes without adding network latency to committed actions. Durable recovery owns retries. */
|
|
5
|
+
export declare function deployedReplication(environment: OntologyEnvironment, fetchImpl?: typeof fetch): ReplicationKick;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
/** Coalesce best-effort wakes without adding network latency to committed actions. Durable recovery owns retries. */
|
|
3
|
+
export function deployedReplication(environment, fetchImpl = fetch) {
|
|
4
|
+
if (environment.deployment?.target === "preview") {
|
|
5
|
+
return () => Effect.void;
|
|
6
|
+
}
|
|
7
|
+
let inFlight = false;
|
|
8
|
+
let nextWakeAt = 0;
|
|
9
|
+
return (identity) => {
|
|
10
|
+
if (!identity) {
|
|
11
|
+
return Effect.void;
|
|
12
|
+
}
|
|
13
|
+
return Effect.suspend(() => {
|
|
14
|
+
if (inFlight || Date.now() < nextWakeAt) {
|
|
15
|
+
return Effect.void;
|
|
16
|
+
}
|
|
17
|
+
inFlight = true;
|
|
18
|
+
nextWakeAt = Date.now() + 1000;
|
|
19
|
+
return Effect.tryPromise(async () => {
|
|
20
|
+
const response = await fetchImpl(`${environment.segmentstreamUrl}/api/internal/v1/workspaces/` +
|
|
21
|
+
`${encodeURIComponent(environment.workspaceId)}/ontology/replication/drain`, {
|
|
22
|
+
method: "POST",
|
|
23
|
+
redirect: "error",
|
|
24
|
+
signal: AbortSignal.timeout(5000),
|
|
25
|
+
headers: {
|
|
26
|
+
"x-segmentstream-runtime-identity": identity,
|
|
27
|
+
"x-segmentstream-organization-id": environment.organizationId,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
await response.body?.cancel();
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw new Error(`Replication wake-up returned HTTP ${response.status}.`);
|
|
33
|
+
}
|
|
34
|
+
}).pipe(Effect.catchCause((cause) => Effect.logWarning("ontology.replication.deferred", cause)), Effect.ensuring(Effect.sync(() => {
|
|
35
|
+
inFlight = false;
|
|
36
|
+
})), Effect.forkDetach, Effect.asVoid);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
}
|