@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,272 @@
|
|
|
1
|
+
import { GENERATED_UPSERT_PREFIX, toSnakeCase } from "./names.js";
|
|
2
|
+
/**
|
|
3
|
+
* Permissions are `<entity>:<verb>` strings. The verbs are `read`, the generated `create`, `update`,
|
|
4
|
+
* `delete`, `link` and `unlink`, and the snake_case name of an authored action. A role may use `*` for
|
|
5
|
+
* the entity (`*:read`), the verb (`lead:*`) or both (`*:*`); what an action or a read requires never
|
|
6
|
+
* holds a wildcard. A wildcard entity does not cover the entities in {@link EXPLICIT_GRANT_ENTITIES},
|
|
7
|
+
* and covers only some verbs of those in {@link WILDCARD_ENTITY_VERBS}.
|
|
8
|
+
*/
|
|
9
|
+
/** Any entity or any verb, in a role's permissions. */
|
|
10
|
+
export const WILDCARD = "*";
|
|
11
|
+
/** The verb of every read: lists, queries, records, history, traversals and `include`. */
|
|
12
|
+
export const READ_VERB = "read";
|
|
13
|
+
/**
|
|
14
|
+
* Entities only a permission that names them covers: `*:read` or `*:*` grant nothing on them. The
|
|
15
|
+
* built-in agent chat is in every ontology, and member's default `*:read` would otherwise show anyone
|
|
16
|
+
* who signs in the workspace's chats and who is in them; `agent_chat:read` or `agent_chat:*` does.
|
|
17
|
+
* App feedback is a member's own message to the builders: a member reads theirs through a scoped
|
|
18
|
+
* `app_feedback:read`, and only the builders' roles name it unscoped. The built-in sign-in
|
|
19
|
+
* identities hold every member's external accounts, such as their Telegram id and username: only a
|
|
20
|
+
* role that names `user_identity` reads them.
|
|
21
|
+
*/
|
|
22
|
+
export const EXPLICIT_GRANT_ENTITIES = new Set([
|
|
23
|
+
"agent_chat",
|
|
24
|
+
"app_feedback",
|
|
25
|
+
"app_feedback_file",
|
|
26
|
+
"user_identity",
|
|
27
|
+
]);
|
|
28
|
+
/** The built-in user's entity name in permissions. */
|
|
29
|
+
const USER_ENTITY = "user";
|
|
30
|
+
/**
|
|
31
|
+
* The verbs of the built-in user's member management: inviting a member, granting and revoking
|
|
32
|
+
* roles, and deactivating and reactivating a member. Like every other verb on `user` but `read` and
|
|
33
|
+
* `update`, only `user:<verb>` or `user:*` grants them.
|
|
34
|
+
*/
|
|
35
|
+
export const USER_MEMBER_VERBS = [
|
|
36
|
+
"invite",
|
|
37
|
+
"grant_roles",
|
|
38
|
+
"revoke_roles",
|
|
39
|
+
"deactivate",
|
|
40
|
+
"reactivate",
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Entities of which a wildcard entity (`*:*`, `*:<verb>`) covers only the listed verbs; any other
|
|
44
|
+
* verb needs a permission that names the entity. A role written for business data must not
|
|
45
|
+
* administer members by accident, and an API key holding `*:*` must not grant itself roles, so
|
|
46
|
+
* `*:*` reaches `user:read` and `user:update` but none of {@link USER_MEMBER_VERBS} or an authored
|
|
47
|
+
* action on `user`.
|
|
48
|
+
*/
|
|
49
|
+
export const WILDCARD_ENTITY_VERBS = new Map([
|
|
50
|
+
[USER_ENTITY, new Set([READ_VERB, "update"])],
|
|
51
|
+
]);
|
|
52
|
+
/** Whether a wildcard entity covers this verb of this entity, both in snake_case. */
|
|
53
|
+
export function wildcardEntityCovers(entity, verb) {
|
|
54
|
+
if (EXPLICIT_GRANT_ENTITIES.has(entity)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const verbs = WILDCARD_ENTITY_VERBS.get(entity);
|
|
58
|
+
return verbs === undefined || verbs.has(verb);
|
|
59
|
+
}
|
|
60
|
+
/** What the built-in `member` role holds when `defineOntology` does not say: reading everything. */
|
|
61
|
+
export const DEFAULT_MEMBER_PERMISSIONS = [`${WILDCARD}:${READ_VERB}`];
|
|
62
|
+
/** `<entity>:<verb>` with lowercase snake_case entities and lowercase snake_case verbs, or `*` for either. */
|
|
63
|
+
const PERMISSION = /^(\*|[a-z][a-zA-Z0-9]*(?:_[a-z0-9]+)*):(\*|[a-z][a-zA-Z0-9]*(?:_[a-z0-9]+)*)$/;
|
|
64
|
+
/** The entity and verb of a permission, or `undefined` when the value is not one. */
|
|
65
|
+
export function parsePermission(value) {
|
|
66
|
+
if (typeof value !== "string") {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const match = PERMISSION.exec(value);
|
|
70
|
+
return match === null ? undefined : { entity: match[1], verb: match[2] };
|
|
71
|
+
}
|
|
72
|
+
/** The scope of workflow permissions: `workflow:<workflow>:<verb>`. */
|
|
73
|
+
export const WORKFLOW_PERMISSION_SCOPE = "workflow";
|
|
74
|
+
/** The verbs of a workflow: starting a run and reading its runs. */
|
|
75
|
+
export const WORKFLOW_VERBS = ["start", "read"];
|
|
76
|
+
const WORKFLOW_PERMISSION = /^workflow:(\*|[a-z][a-zA-Z0-9]*(?:_[a-z0-9]+)*):(\*|start|read)$/;
|
|
77
|
+
/**
|
|
78
|
+
* The workflow and verb of `workflow:<workflow>:<verb>`, or `undefined` when the value is not one.
|
|
79
|
+
* Workflow permissions are a scope of their own: only a permission that starts with `workflow:`
|
|
80
|
+
* grants them, so `*:*` and `*:read` cover none.
|
|
81
|
+
*/
|
|
82
|
+
export function parseWorkflowPermission(value) {
|
|
83
|
+
if (typeof value !== "string") {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
const match = WORKFLOW_PERMISSION.exec(value);
|
|
87
|
+
return match === null ? undefined : { workflow: match[1], verb: match[2] };
|
|
88
|
+
}
|
|
89
|
+
/** `workflow:remind_stale_leads:start`. */
|
|
90
|
+
export function workflowPermission(workflow, verb) {
|
|
91
|
+
return `${WORKFLOW_PERMISSION_SCOPE}:${workflow}:${verb}`;
|
|
92
|
+
}
|
|
93
|
+
/** `lead:changeStatus`. */
|
|
94
|
+
export function permissionOf(entity, verb) {
|
|
95
|
+
return `${entity}:${verb}`;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether a granted permission, which may hold wildcards, covers the required one. A wildcard entity
|
|
99
|
+
* covers every entity but those in {@link EXPLICIT_GRANT_ENTITIES}, and of those in
|
|
100
|
+
* {@link WILDCARD_ENTITY_VERBS} only the listed verbs.
|
|
101
|
+
*/
|
|
102
|
+
export function grants(granted, required) {
|
|
103
|
+
const workflow = parseWorkflowPermission(required);
|
|
104
|
+
if (workflow !== undefined) {
|
|
105
|
+
const holds = parseWorkflowPermission(granted);
|
|
106
|
+
return (holds !== undefined &&
|
|
107
|
+
workflow.workflow !== WILDCARD &&
|
|
108
|
+
workflow.verb !== WILDCARD &&
|
|
109
|
+
(holds.workflow === WILDCARD ||
|
|
110
|
+
toSnakeCase(holds.workflow) === toSnakeCase(workflow.workflow)) &&
|
|
111
|
+
(holds.verb === WILDCARD || holds.verb === workflow.verb));
|
|
112
|
+
}
|
|
113
|
+
const held = parsePermission(granted);
|
|
114
|
+
const wanted = parsePermission(required);
|
|
115
|
+
if (held === undefined || wanted === undefined) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
const entity = toSnakeCase(wanted.entity);
|
|
119
|
+
return ((held.entity === WILDCARD
|
|
120
|
+
? wildcardEntityCovers(entity, toSnakeCase(wanted.verb))
|
|
121
|
+
: toSnakeCase(held.entity) === entity) &&
|
|
122
|
+
(held.verb === WILDCARD || toSnakeCase(held.verb) === toSnakeCase(wanted.verb)));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A permission as {@link grants} compares it: entity, workflow and verb names in snake_case,
|
|
126
|
+
* wildcards kept. Two permissions that grant the same thing normalise to the same string; a value
|
|
127
|
+
* that is not a permission is returned as it is.
|
|
128
|
+
*/
|
|
129
|
+
export function normalizePermission(value) {
|
|
130
|
+
const snake = (name) => (name === WILDCARD ? WILDCARD : toSnakeCase(name));
|
|
131
|
+
const workflow = parseWorkflowPermission(value);
|
|
132
|
+
if (workflow !== undefined) {
|
|
133
|
+
return `${WORKFLOW_PERMISSION_SCOPE}:${snake(workflow.workflow)}:${workflow.verb}`;
|
|
134
|
+
}
|
|
135
|
+
const parsed = parsePermission(value);
|
|
136
|
+
return parsed === undefined ? value : permissionOf(snake(parsed.entity), snake(parsed.verb));
|
|
137
|
+
}
|
|
138
|
+
/** Whether a required permission is one only a named `user` permission grants, workloads included. */
|
|
139
|
+
function isUserAdministration(required) {
|
|
140
|
+
const wanted = parsePermission(required);
|
|
141
|
+
return (wanted !== undefined &&
|
|
142
|
+
toSnakeCase(wanted.entity) === USER_ENTITY &&
|
|
143
|
+
!wildcardEntityCovers(USER_ENTITY, toSnakeCase(wanted.verb)));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Feedback always needs named grants, including for pipeline workloads. The workspace's own pipeline
|
|
147
|
+
* code reads sign-in identities, for example to address a member in a chat, but nothing it runs
|
|
148
|
+
* writes them: only the platform does.
|
|
149
|
+
*/
|
|
150
|
+
function workloadWildcardCovers(required) {
|
|
151
|
+
const wanted = parsePermission(required);
|
|
152
|
+
if (wanted !== undefined && toSnakeCase(wanted.entity) === "user_identity") {
|
|
153
|
+
return wanted.verb === READ_VERB;
|
|
154
|
+
}
|
|
155
|
+
return (!isUserAdministration(required) &&
|
|
156
|
+
(wanted === undefined ||
|
|
157
|
+
!["app_feedback", "app_feedback_file"].includes(toSnakeCase(wanted.entity))));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Whether the principal may do what `required` names: one of its permissions equals it, or covers it
|
|
161
|
+
* through a wildcard. Workload wildcards exclude user administration, feedback and writes of sign-in
|
|
162
|
+
* identities.
|
|
163
|
+
*/
|
|
164
|
+
export function isAllowed(required, principal) {
|
|
165
|
+
return (
|
|
166
|
+
// Exact authored grants are common in large catalogs. Validate the match
|
|
167
|
+
// with the same matcher: an identical malformed or wildcard workflow name
|
|
168
|
+
// must not become a grant. No authorization result survives this call.
|
|
169
|
+
(principal.permissions.includes(required) && grants(required, required)) ||
|
|
170
|
+
(principal.execution !== undefined &&
|
|
171
|
+
principal.permissions.includes("*:*") &&
|
|
172
|
+
workloadWildcardCovers(required)) ||
|
|
173
|
+
principal.permissions.some((granted) => grants(granted, required)));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Which records of `required` the principal's grants cover, once {@link isAllowed} said it holds
|
|
177
|
+
* it: `undefined` when some grant covers it unscoped, wildcards included; otherwise the `where` of
|
|
178
|
+
* the one scoped grant that names it, or the `or` of several. Without any grant the result is
|
|
179
|
+
* `{ or: [] }`, which matches no record.
|
|
180
|
+
*/
|
|
181
|
+
export function effectiveScope(required, principal) {
|
|
182
|
+
const scopes = principal.scopes ?? [];
|
|
183
|
+
const scoped = new Set(scopes.map((candidate) => normalizePermission(candidate.permission)));
|
|
184
|
+
if ((principal.execution !== undefined &&
|
|
185
|
+
principal.permissions.includes("*:*") &&
|
|
186
|
+
workloadWildcardCovers(required)) ||
|
|
187
|
+
principal.permissions.some((granted) => !scoped.has(normalizePermission(granted)) && grants(granted, required))) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
const wheres = scopes
|
|
191
|
+
.filter((candidate) => grants(candidate.permission, required))
|
|
192
|
+
.map((candidate) => candidate.where);
|
|
193
|
+
return wheres.length === 1 ? wheres[0] : { or: wheres };
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The records of `entity` a holder reads: `undefined` when it holds no scoped permission or reads
|
|
197
|
+
* the entity unscoped, else the {@link effectiveScope} of `<entity>:read`. A holder without the read
|
|
198
|
+
* permission gets `undefined` too: whether it may read at all is the permission check's decision.
|
|
199
|
+
*/
|
|
200
|
+
export function readScope(entity, holder) {
|
|
201
|
+
if (holder.scopes === undefined || holder.scopes.length === 0) {
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
const permission = permissionOf(entity, READ_VERB);
|
|
205
|
+
return isAllowed(permission, holder) ? effectiveScope(permission, holder) : undefined;
|
|
206
|
+
}
|
|
207
|
+
/** Expand workload authority for permission-only catalog and documentation readers. */
|
|
208
|
+
export function effectivePermissions(principal) {
|
|
209
|
+
return principal.execution !== undefined && principal.permissions.includes("*:*")
|
|
210
|
+
? [...principal.permissions, "agent_chat:*"]
|
|
211
|
+
: principal.permissions;
|
|
212
|
+
}
|
|
213
|
+
/** The first of the required permissions the principal lacks, or `undefined` when it holds all. */
|
|
214
|
+
export function missingPermission(required, principal) {
|
|
215
|
+
return required.find((permission) => !isAllowed(permission, principal));
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* What a generated action requires: `<entity>:<action>`, except `upsert_by_<property>`, which may
|
|
219
|
+
* create or update and so requires both `<entity>:create` and `<entity>:update`.
|
|
220
|
+
*/
|
|
221
|
+
export function generatedActionPermissions(entity, action) {
|
|
222
|
+
return toSnakeCase(action).startsWith(GENERATED_UPSERT_PREFIX)
|
|
223
|
+
? [permissionOf(entity, "create"), permissionOf(entity, "update")]
|
|
224
|
+
: [permissionOf(entity, action)];
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The union of the permissions of the roles a principal holds, in the order the ontology declares
|
|
228
|
+
* them. A held role the ontology does not declare grants nothing.
|
|
229
|
+
*/
|
|
230
|
+
export function permissionsOf(roles, held) {
|
|
231
|
+
const permissions = new Set();
|
|
232
|
+
for (const candidate of roles) {
|
|
233
|
+
if (held.includes(candidate.name)) {
|
|
234
|
+
for (const permission of candidate.permissions ?? []) {
|
|
235
|
+
permissions.add(permission);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return [...permissions];
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The scoped entries of the roles a principal holds, in the order the ontology declares them,
|
|
243
|
+
* without the dead ones: those a held role grants unscoped, by the same permission or through a
|
|
244
|
+
* wildcard, since an unscoped grant covers every record. With {@link permissionsOf}, what a
|
|
245
|
+
* principal's `scopes` holds; {@link effectiveScope} stays the authority either way.
|
|
246
|
+
*/
|
|
247
|
+
export function scopesOf(roles, held) {
|
|
248
|
+
const holding = roles.filter((candidate) => held.includes(candidate.name));
|
|
249
|
+
const unscoped = [
|
|
250
|
+
...new Set(holding.flatMap((candidate) => {
|
|
251
|
+
const scoped = new Set((candidate.scopes ?? []).map((scope) => normalizePermission(scope.permission)));
|
|
252
|
+
return (candidate.permissions ?? [])
|
|
253
|
+
.map(normalizePermission)
|
|
254
|
+
.filter((permission) => !scoped.has(permission));
|
|
255
|
+
})),
|
|
256
|
+
];
|
|
257
|
+
return holding.flatMap((candidate) => (candidate.scopes ?? []).filter((scope) => !unscoped.some((permission) => grants(permission, scope.permission))));
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* {@link scopesOf} as a principal carries it: absent when no held role scopes a permission, so that
|
|
261
|
+
* a principal of an ontology without scoped permissions is what it was before them.
|
|
262
|
+
*/
|
|
263
|
+
export function principalScopes(roles, held) {
|
|
264
|
+
const scopes = scopesOf(roles, held);
|
|
265
|
+
return scopes.length === 0 ? {} : { scopes };
|
|
266
|
+
}
|
|
267
|
+
/** The roles whose permissions cover `required`, by name. */
|
|
268
|
+
export function rolesGranting(roles, required) {
|
|
269
|
+
return roles
|
|
270
|
+
.filter((candidate) => isAllowed(required, { permissions: candidate.permissions ?? [] }))
|
|
271
|
+
.map((candidate) => candidate.name);
|
|
272
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { BlobValue } from "./blob.js";
|
|
3
|
+
/** The closed set of storage types. Each has a known column, JSON Schema, filters and rendering. */
|
|
4
|
+
export declare const PROPERTY_TYPES: readonly ["text", "email", "url", "integer", "number", "boolean", "date", "timestamp", "select", "json", "blob", "list"];
|
|
5
|
+
export type PropertyType = (typeof PROPERTY_TYPES)[number];
|
|
6
|
+
/** Schema annotation that carries a property's storage metadata. */
|
|
7
|
+
export declare const PROPERTY_ANNOTATION = "segmentstream/ontology/property";
|
|
8
|
+
/**
|
|
9
|
+
* Schema annotation that marks a record reference in an action input. It is emitted into the input's
|
|
10
|
+
* JSON Schema so that consumers can offer a record picker.
|
|
11
|
+
*/
|
|
12
|
+
export declare const REFERENCE_ANNOTATION = "x-ontology-ref";
|
|
13
|
+
/**
|
|
14
|
+
* An email address: a local part, one `@`, and a domain of dot-separated labels. The labels exclude
|
|
15
|
+
* the dot that separates them, so no two parts of the pattern can match the same characters and it
|
|
16
|
+
* runs in linear time on any input.
|
|
17
|
+
*/
|
|
18
|
+
export declare const EMAIL_PATTERN: RegExp;
|
|
19
|
+
/** A described value of a `select` property. */
|
|
20
|
+
export interface SelectOption {
|
|
21
|
+
readonly value: string;
|
|
22
|
+
readonly label: string;
|
|
23
|
+
/** Absent only for options given as plain strings, which `check` rejects. */
|
|
24
|
+
readonly description?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Storage metadata of a property, kept in the schema's annotations under {@link PROPERTY_ANNOTATION}. */
|
|
27
|
+
export interface PropertyDefinition {
|
|
28
|
+
readonly column?: string;
|
|
29
|
+
readonly scope?: ReadonlyArray<string>;
|
|
30
|
+
readonly type: PropertyType;
|
|
31
|
+
readonly optional: boolean;
|
|
32
|
+
readonly unique: boolean;
|
|
33
|
+
readonly managed: boolean;
|
|
34
|
+
/** Present only when the property declares a default. */
|
|
35
|
+
readonly default?: unknown;
|
|
36
|
+
readonly label?: string;
|
|
37
|
+
readonly description?: string;
|
|
38
|
+
readonly renamedFrom?: string;
|
|
39
|
+
readonly display?: string;
|
|
40
|
+
readonly min?: number;
|
|
41
|
+
readonly max?: number;
|
|
42
|
+
readonly maxLength?: number;
|
|
43
|
+
readonly options?: ReadonlyArray<SelectOption>;
|
|
44
|
+
readonly accept?: ReadonlyArray<string>;
|
|
45
|
+
readonly maxBytes?: number;
|
|
46
|
+
/** The type of a `list` property's items. */
|
|
47
|
+
readonly items?: PropertyType;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A property: an Effect Schema of its value, usable in action inputs, with its storage metadata in
|
|
51
|
+
* the schema's annotations. The two `~ontology` members exist only in the type. They record whether
|
|
52
|
+
* the property has a default (which makes it optional in `create`) and whether it is unique (which
|
|
53
|
+
* makes it a key for `upsertBy`).
|
|
54
|
+
*/
|
|
55
|
+
export interface Property<T, Defaulted extends boolean = boolean, Unique extends boolean = boolean> extends Schema.Codec<T> {
|
|
56
|
+
readonly "~ontology.defaulted": Defaulted;
|
|
57
|
+
readonly "~ontology.unique": Unique;
|
|
58
|
+
}
|
|
59
|
+
/** Any property, required or optional, as entity `properties` accept it. */
|
|
60
|
+
export type AnyProperty = Property<unknown, boolean, boolean> | Schema.optionalKey<Property<unknown, boolean, boolean>>;
|
|
61
|
+
export interface PropertyOptions<T> {
|
|
62
|
+
readonly column?: string;
|
|
63
|
+
readonly scope?: ReadonlyArray<string>;
|
|
64
|
+
/** The value may be absent: an optional key in inputs and `null` in records. */
|
|
65
|
+
readonly optional?: boolean;
|
|
66
|
+
/** Stored when `create` omits the property. */
|
|
67
|
+
readonly default?: T;
|
|
68
|
+
readonly unique?: boolean;
|
|
69
|
+
readonly label?: string;
|
|
70
|
+
readonly description?: string;
|
|
71
|
+
/** The property's previous name, for one deploy, so that the column is renamed instead of replaced. */
|
|
72
|
+
readonly renamedFrom?: string;
|
|
73
|
+
/** Excluded from the generated `update` action: it changes only through authored actions. */
|
|
74
|
+
readonly managed?: boolean;
|
|
75
|
+
/** A display hint independent of the storage type, for example `multiline` for text. */
|
|
76
|
+
readonly display?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface TextOptions extends PropertyOptions<string> {
|
|
79
|
+
readonly maxLength?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface NumberOptions extends PropertyOptions<number> {
|
|
82
|
+
readonly min?: number;
|
|
83
|
+
readonly max?: number;
|
|
84
|
+
}
|
|
85
|
+
/** A `select` option: a plain string for quick use, or a described option. */
|
|
86
|
+
export type SelectOptionInput<V extends string> = V | {
|
|
87
|
+
readonly value: V;
|
|
88
|
+
readonly label?: string;
|
|
89
|
+
readonly description: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The options a constructor was given, refusing keys its options do not declare: a `const` type
|
|
93
|
+
* parameter is not checked for excess properties, so `p.integer({ minimum: 1 })` would pass.
|
|
94
|
+
*/
|
|
95
|
+
type Known<O, T> = O & {
|
|
96
|
+
readonly [K in Exclude<keyof O, keyof T>]: never;
|
|
97
|
+
};
|
|
98
|
+
type HasDefault<O> = O extends {
|
|
99
|
+
readonly default: unknown;
|
|
100
|
+
} ? true : false;
|
|
101
|
+
type IsUnique<O> = O extends {
|
|
102
|
+
readonly unique: true;
|
|
103
|
+
} ? true : false;
|
|
104
|
+
/** The schema type a property constructor returns for the given options. */
|
|
105
|
+
export type PropertyOf<T, O> = O extends {
|
|
106
|
+
readonly optional: true;
|
|
107
|
+
} ? Schema.optionalKey<Property<T, HasDefault<O>, IsUnique<O>>> : Property<T, HasDefault<O>, IsUnique<O>>;
|
|
108
|
+
/**
|
|
109
|
+
* The options a property was given that its constructor does not take, such as `minimum` for
|
|
110
|
+
* `p.integer`, which takes `min`. TypeScript refuses them in a literal; `check` reports them for
|
|
111
|
+
* code that is evaluated without type checking.
|
|
112
|
+
*/
|
|
113
|
+
export declare function unknownPropertyOptions(value: unknown): ReadonlyArray<string>;
|
|
114
|
+
/** Keeps the unknown options of a property on the schema the SDK rebuilt it as. */
|
|
115
|
+
export declare function inheritUnknownOptions(from: unknown, to: unknown): void;
|
|
116
|
+
/** What a constructor takes, for the message that names an unknown option. */
|
|
117
|
+
export declare function propertyOptionNames(type: PropertyType): ReadonlyArray<string>;
|
|
118
|
+
declare function text<const O extends TextOptions>(options?: Known<O, TextOptions>): PropertyOf<string, O>;
|
|
119
|
+
declare function email<const O extends PropertyOptions<string>>(options?: Known<O, PropertyOptions<string>>): PropertyOf<string, O>;
|
|
120
|
+
declare function url<const O extends PropertyOptions<string>>(options?: Known<O, PropertyOptions<string>>): PropertyOf<string, O>;
|
|
121
|
+
declare function integer<const O extends NumberOptions>(options?: Known<O, NumberOptions>): PropertyOf<number, O>;
|
|
122
|
+
declare function number<const O extends NumberOptions>(options?: Known<O, NumberOptions>): PropertyOf<number, O>;
|
|
123
|
+
declare function boolean<const O extends PropertyOptions<boolean>>(options?: Known<O, PropertyOptions<boolean>>): PropertyOf<boolean, O>;
|
|
124
|
+
/** A calendar date as `YYYY-MM-DD`. */
|
|
125
|
+
declare function date<const O extends PropertyOptions<string>>(options?: Known<O, PropertyOptions<string>>): PropertyOf<string, O>;
|
|
126
|
+
/** An instant as an ISO 8601 string with a time zone, for example `2026-10-04T09:30:00Z`. */
|
|
127
|
+
declare function timestamp<const O extends PropertyOptions<string>>(options?: Known<O, PropertyOptions<string>>): PropertyOf<string, O>;
|
|
128
|
+
/**
|
|
129
|
+
* One of a closed set of described values. Each option becomes its own JSON Schema branch with its
|
|
130
|
+
* label as `title` and its description, so that agents see what every value means.
|
|
131
|
+
*/
|
|
132
|
+
declare function select<const V extends string, const O extends PropertyOptions<NoInfer<V>>>(options: ReadonlyArray<SelectOptionInput<V>>, settings?: Known<O, PropertyOptions<NoInfer<V>>>): PropertyOf<V, O>;
|
|
133
|
+
/** Any JSON value. */
|
|
134
|
+
declare function json<const O extends PropertyOptions<Schema.Json>>(options?: Known<O, PropertyOptions<Schema.Json>>): PropertyOf<Schema.Json, O>;
|
|
135
|
+
export interface ReferenceOptions {
|
|
136
|
+
readonly optional?: boolean;
|
|
137
|
+
readonly label?: string;
|
|
138
|
+
readonly description?: string;
|
|
139
|
+
}
|
|
140
|
+
/** The schema type of a record reference: the referenced record's id. */
|
|
141
|
+
export type ReferenceOf<O> = O extends {
|
|
142
|
+
readonly optional: true;
|
|
143
|
+
} ? Schema.optionalKey<Schema.Codec<string>> : Schema.Codec<string>;
|
|
144
|
+
/**
|
|
145
|
+
* A reference to a record of an entity, by id, for action inputs. Relationships between entities
|
|
146
|
+
* are declared with `rel.one` and `rel.many`, not with references.
|
|
147
|
+
*/
|
|
148
|
+
declare function ref<const O extends ReferenceOptions>(target: string | {
|
|
149
|
+
readonly name: string;
|
|
150
|
+
}, options?: Known<O, ReferenceOptions>): ReferenceOf<O>;
|
|
151
|
+
/** Property constructors. */
|
|
152
|
+
export interface BlobOptions extends Omit<PropertyOptions<BlobValue>, "default" | "unique"> {
|
|
153
|
+
/** MIME types or ranges such as image/*; omitted means any file. */
|
|
154
|
+
readonly accept?: ReadonlyArray<string>;
|
|
155
|
+
readonly maxBytes?: number;
|
|
156
|
+
}
|
|
157
|
+
declare function blob<const O extends BlobOptions>(options?: Known<O, BlobOptions>): PropertyOf<BlobValue, O>;
|
|
158
|
+
export interface ListOptions extends Omit<PropertyOptions<ReadonlyArray<string>>, "column" | "scope" | "optional" | "default" | "unique" | "renamedFrom"> {
|
|
159
|
+
/** Lists are managed: the platform keeps their values. */
|
|
160
|
+
readonly managed: true;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A list of values of one property type, read-only and kept by the platform. Only the built-in
|
|
164
|
+
* `User` has one, `roles`, which the runtime reads from the role assignments beside the table:
|
|
165
|
+
* `check` refuses a list on any other entity, so no table has an array column and no action
|
|
166
|
+
* writes one. Filters take `has` and `hasAny`; a list cannot be sorted on.
|
|
167
|
+
*/
|
|
168
|
+
declare function list<const O extends ListOptions>(item: Property<string, boolean, boolean>, options: Known<O, ListOptions>): Property<ReadonlyArray<string>, false, false>;
|
|
169
|
+
export declare const p: {
|
|
170
|
+
readonly text: typeof text;
|
|
171
|
+
readonly email: typeof email;
|
|
172
|
+
readonly url: typeof url;
|
|
173
|
+
readonly integer: typeof integer;
|
|
174
|
+
readonly number: typeof number;
|
|
175
|
+
readonly boolean: typeof boolean;
|
|
176
|
+
readonly date: typeof date;
|
|
177
|
+
readonly timestamp: typeof timestamp;
|
|
178
|
+
readonly select: typeof select;
|
|
179
|
+
readonly json: typeof json;
|
|
180
|
+
readonly blob: typeof blob;
|
|
181
|
+
readonly list: typeof list;
|
|
182
|
+
readonly ref: typeof ref;
|
|
183
|
+
};
|
|
184
|
+
/** The storage metadata of a schema built with a `p.*` constructor, or `undefined` for any other value. */
|
|
185
|
+
export declare function propertyDefinition(value: unknown): PropertyDefinition | undefined;
|
|
186
|
+
/** The entity a `p.ref` schema points at, or `undefined` for any other value. */
|
|
187
|
+
export declare function referenceTarget(value: unknown): string | undefined;
|
|
188
|
+
export {};
|