@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
package/dist/legacy.d.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @legacy ontology.metric-earlier-names
|
|
3
|
+
* Metrics were called measures before manifest version 14, and metric queries aggregates. This
|
|
4
|
+
* module is the one place that still knows the earlier names: workspace code written for an earlier
|
|
5
|
+
* SDK declares `measures` and calls an entity's `aggregate`, older app SDKs send `measures` and
|
|
6
|
+
* `orderBy[].measure` to the metric query routes at their earlier paths, `…/aggregate`, and
|
|
7
|
+
* deployments built by an earlier SDK store manifests with `measures` and `{ op: "measure", name }`
|
|
8
|
+
* expression nodes. Published manifests use only the current names; API catalogs retain deprecated
|
|
9
|
+
* aliases for released readers. Version 14 renames measures to metrics: entities' and the model's `metrics`,
|
|
10
|
+
* and `metric` expression nodes (`{ op: "metric", name }`, formerly `op: "measure"`).
|
|
11
|
+
*/
|
|
12
|
+
import { Effect, Schema } from "effect";
|
|
13
|
+
import { type MetricConditionOperator, type MetricQueryValue } from "./metric-filters.js";
|
|
14
|
+
import type { Metric, MetricColumnCondition, MetricCondition, MetricExpression, MetricOptions, Metrics, ModelMetric, ModelMetricOptions, ModelMetrics } from "./metric.js";
|
|
15
|
+
import type { EntityRecord, FreshMetricQueryInput, FreshMetricQueryRow, MetricQueryGroupKey } from "./entity.js";
|
|
16
|
+
import type { FreshMetricQueryOptions, OntologyReads, StoredRecord } from "./runtime.js";
|
|
17
|
+
/** @deprecated Use {@link Metric}; measures are called metrics since manifest version 14. */
|
|
18
|
+
export type Measure = Metric;
|
|
19
|
+
/** @deprecated Use {@link Metrics}. */
|
|
20
|
+
export type Measures = Metrics;
|
|
21
|
+
/** @deprecated Use {@link MetricExpression}. */
|
|
22
|
+
export type MeasureExpression = MetricExpression;
|
|
23
|
+
/** @deprecated Use {@link MetricOptions}. */
|
|
24
|
+
export type MeasureOptions = MetricOptions;
|
|
25
|
+
/** @deprecated Use {@link MetricCondition}. */
|
|
26
|
+
export type MeasureCondition = MetricCondition;
|
|
27
|
+
/** @deprecated Use {@link MetricColumnCondition}. */
|
|
28
|
+
export type MeasureColumnCondition = MetricColumnCondition;
|
|
29
|
+
/** @deprecated Use {@link ModelMetric}. */
|
|
30
|
+
export type ModelMeasure = ModelMetric;
|
|
31
|
+
/** @deprecated Use {@link ModelMetricOptions}. */
|
|
32
|
+
export type ModelMeasureOptions = ModelMetricOptions;
|
|
33
|
+
/** @deprecated Use {@link ModelMetrics}. */
|
|
34
|
+
export type ModelMeasures = ModelMetrics;
|
|
35
|
+
/** @deprecated Use {@link MetricConditionOperator}. */
|
|
36
|
+
export type MeasureConditionOperator = MetricConditionOperator;
|
|
37
|
+
/** @deprecated Use {@link METRIC_CONDITION_OPERATORS}. */
|
|
38
|
+
export declare const MEASURE_CONDITION_OPERATORS: readonly ["equals", "in", "notEquals", "notIn", "isNull", "isNotNull", "between", "gt", "gte", "lt", "lte", "contains", "startsWith", "endsWith"];
|
|
39
|
+
/** @deprecated Use `ModelMetricManifest`. */
|
|
40
|
+
export { ModelMetricManifest as ModelMeasureManifest } from "./manifest.js";
|
|
41
|
+
/** @deprecated Use {@link MetricQueryValue}. */
|
|
42
|
+
export type AggregateValue = MetricQueryValue;
|
|
43
|
+
/** @deprecated Use {@link MetricQueryGroupKey}. */
|
|
44
|
+
export type AggregateGroupKey<P, R> = MetricQueryGroupKey<P, R>;
|
|
45
|
+
/** @deprecated Use {@link FreshMetricQueryRow}. */
|
|
46
|
+
export type FreshAggregateRow<Record, Group extends keyof Record, Metric extends string> = FreshMetricQueryRow<Record, Group, Metric>;
|
|
47
|
+
/** @deprecated Use {@link FreshMetricQueryOptions}. */
|
|
48
|
+
export type FreshAggregateOptions<R = StoredRecord, L extends string = never, Metric extends string = string, Group extends string = string> = EarlierFreshMetricQueryOptions<R, L, Metric, Group>;
|
|
49
|
+
/** The earlier spelling of an entity's or the model's `metrics`, which declarations still accept. */
|
|
50
|
+
export interface EarlierMetricsField<M> {
|
|
51
|
+
/** @deprecated Use `metrics`: `measures` is its earlier name. Declaring both is an error. */
|
|
52
|
+
readonly measures?: M;
|
|
53
|
+
}
|
|
54
|
+
/** A warehouse-backed entity's metrics under the name released app SDKs read for their types. */
|
|
55
|
+
export interface EarlierMetricsName<M> {
|
|
56
|
+
/** @deprecated Use `metrics`: `measures` is its earlier name. */
|
|
57
|
+
readonly measures: M;
|
|
58
|
+
}
|
|
59
|
+
/** The earlier property shares the metrics themselves and their declared names. */
|
|
60
|
+
export declare function withEarlierMetricsName<M>(metrics: M): EarlierMetricsName<M>;
|
|
61
|
+
/** A name an SDK release replaced. */
|
|
62
|
+
export interface EarlierName {
|
|
63
|
+
/** The name earlier SDKs used, which this one still accepts as a deprecated alias. */
|
|
64
|
+
readonly earlier: string;
|
|
65
|
+
/** The name that replaced it. */
|
|
66
|
+
readonly current: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A record, such as a fresh metric query's options, with an earlier `measures` and no `metrics` as
|
|
70
|
+
* one with `metrics`; others as given. Definitions use {@link withCurrentDefinitionNames}.
|
|
71
|
+
*/
|
|
72
|
+
export declare function withCurrentMetricsField<T extends object>(record: T): T;
|
|
73
|
+
/**
|
|
74
|
+
* An `entity(…)` or `defineOntology(…)` definition with each field it declares under an earlier name
|
|
75
|
+
* only renamed to the current one; without such a field, the definition itself. The earlier names
|
|
76
|
+
* stay known to {@link earlierNamesOf}, for `check`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function withCurrentDefinitionNames<T extends object>(definition: T): T;
|
|
79
|
+
/**
|
|
80
|
+
* The earlier names a definition uses, for `check` to warn about: those
|
|
81
|
+
* {@link withCurrentDefinitionNames} renamed in it, or those it still declares itself. A field
|
|
82
|
+
* declared under both names is not among them; {@link earlierMetricsFieldProblem} refuses it.
|
|
83
|
+
*/
|
|
84
|
+
export declare function earlierNamesOf(definition: unknown): ReadonlyArray<EarlierName>;
|
|
85
|
+
/**
|
|
86
|
+
* Why a definition's metrics cannot be read, for `check`: it declares them under both names. A
|
|
87
|
+
* definition with only one of them has no such problem.
|
|
88
|
+
*/
|
|
89
|
+
export declare function earlierMetricsFieldProblem(definition: unknown): string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* A fresh metric query that names its metrics `measures`, as workspace code written for an earlier
|
|
92
|
+
* SDK does.
|
|
93
|
+
*/
|
|
94
|
+
export type EarlierFreshMetricQueryOptions<R, L extends string, Metric extends string, Group extends string> = Omit<FreshMetricQueryOptions<R, L, Metric, Group>, "metrics"> & {
|
|
95
|
+
/** @deprecated Use `metrics`: `measures` is its earlier name. */
|
|
96
|
+
readonly measures: readonly [Metric, ...Metric[]];
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* A fresh metric query's options with its metrics under `metrics`, whichever name the action used.
|
|
100
|
+
* Naming them under both is a mistake in the action's code, so it throws, as other malformed
|
|
101
|
+
* options fail the action.
|
|
102
|
+
*/
|
|
103
|
+
export declare function withCurrentFreshMetricQueryNames<R, L extends string, Metric extends string, Group extends string>(options: FreshMetricQueryOptions<R, L, Metric, Group> | EarlierFreshMetricQueryOptions<R, L, Metric, Group>): FreshMetricQueryOptions<R, L, Metric, Group>;
|
|
104
|
+
/** The earlier name of an entity handle's `queryMetrics`, which action code may still call. */
|
|
105
|
+
declare const EARLIER_QUERY_METRICS = "aggregate";
|
|
106
|
+
/** An entity handle's `queryMetrics` under its earlier name. */
|
|
107
|
+
export interface EarlierQueryMetricsName<P, R, M> {
|
|
108
|
+
/** @deprecated Use `queryMetrics`: `aggregate` is its earlier name. */
|
|
109
|
+
aggregate<const Metric extends keyof M & string, const Group extends MetricQueryGroupKey<P, R> = never>(options: FreshMetricQueryInput<P, R, Metric, Group>): Effect.Effect<ReadonlyArray<FreshMetricQueryRow<EntityRecord<P, R>, Group, Metric>>, never, OntologyReads>;
|
|
110
|
+
}
|
|
111
|
+
/** The members an entity handle carries under their earlier names. */
|
|
112
|
+
export declare function withEarlierQueryMetricsName<QueryMetrics>(queryMetrics: QueryMetrics): {
|
|
113
|
+
readonly [EARLIER_QUERY_METRICS]: QueryMetrics;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* A manifest document with the earlier names renamed: an entity's or the top-level `measures`
|
|
117
|
+
* becomes `metrics`, and every `{ op: "measure" }` node of their expressions `{ op: "metric" }`.
|
|
118
|
+
* A pure function on the raw JSON: the input is never changed, and is returned itself when it
|
|
119
|
+
* carries no earlier name, so a document's hash is always computed over what was stored. Every
|
|
120
|
+
* decode of `OntologyManifest` reads documents through it, and readers that serve stored documents
|
|
121
|
+
* use it to answer with the current names.
|
|
122
|
+
*/
|
|
123
|
+
export declare function withCurrentManifestNames(document: Readonly<Record<string, unknown>>): Readonly<Record<string, unknown>>;
|
|
124
|
+
export declare function withCurrentManifestNames(document: unknown): unknown;
|
|
125
|
+
/**
|
|
126
|
+
* The inverse of {@link withCurrentManifestNames}, for a manifest of a version before 14 that is
|
|
127
|
+
* encoded again: its document keeps the names it was hashed with.
|
|
128
|
+
*/
|
|
129
|
+
export declare function withEarlierManifestNames(document: Readonly<Record<string, unknown>>): Readonly<Record<string, unknown>>;
|
|
130
|
+
/** A catalog metric's expression in the spelling released clients understand. */
|
|
131
|
+
export declare function withEarlierMetricExpression(expression: unknown): unknown;
|
|
132
|
+
/**
|
|
133
|
+
* An API catalog in current names with deprecated `measures` aliases on the model and its entities.
|
|
134
|
+
* Only the aliases use `measure` expression nodes. Stored documents and their hashes stay untouched.
|
|
135
|
+
*/
|
|
136
|
+
export declare function withEarlierCatalogNames(document: Readonly<Record<string, unknown>>): Readonly<Record<string, unknown>>;
|
|
137
|
+
/**
|
|
138
|
+
* A manifest schema that reads documents of every version: each is renamed with
|
|
139
|
+
* {@link withCurrentManifestNames} before the schema decodes it. Being a declaration, it keeps
|
|
140
|
+
* doing so on its type side, so `Schema.toType` of it accepts the earlier names too.
|
|
141
|
+
*/
|
|
142
|
+
export declare function acceptingEarlierManifestNames<S extends Schema.Top>(schema: S): Schema.declareConstructor<S["Type"], S["Encoded"], readonly [S]>;
|
|
143
|
+
/**
|
|
144
|
+
* The earlier name of the ontology service's metric query routes, `/api/ontology/aggregate` and
|
|
145
|
+
* `/api/ontology/<entity>/aggregate`, which older app SDKs still call: both are served, and the
|
|
146
|
+
* name stays reserved for entities and metrics of the model.
|
|
147
|
+
*/
|
|
148
|
+
export declare const EARLIER_QUERY_METRICS_ROUTE = "aggregate";
|
|
149
|
+
/**
|
|
150
|
+
* A metric query's body with the earlier names renamed: `measures` becomes `metrics`, and an
|
|
151
|
+
* order's `measure` its `metric`. A body that names one of them twice is returned as it is, for the
|
|
152
|
+
* schema to refuse; a body without earlier names is returned itself.
|
|
153
|
+
*/
|
|
154
|
+
export declare function withCurrentMetricQueryNames(body: unknown): unknown;
|
|
155
|
+
/**
|
|
156
|
+
* A metric query schema that also reads the earlier names older app SDKs send, through
|
|
157
|
+
* {@link withCurrentMetricQueryNames}, and refuses a request that uses both names for one field. Its
|
|
158
|
+
* type side is `schema` itself, which documents the current names only.
|
|
159
|
+
*/
|
|
160
|
+
export declare function acceptingEarlierMetricQueryNames<S extends Schema.Top>(schema: S): Schema.decodeTo<S, Schema.Unknown, never, never>;
|
package/dist/legacy.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @legacy ontology.metric-earlier-names
|
|
3
|
+
* Metrics were called measures before manifest version 14, and metric queries aggregates. This
|
|
4
|
+
* module is the one place that still knows the earlier names: workspace code written for an earlier
|
|
5
|
+
* SDK declares `measures` and calls an entity's `aggregate`, older app SDKs send `measures` and
|
|
6
|
+
* `orderBy[].measure` to the metric query routes at their earlier paths, `…/aggregate`, and
|
|
7
|
+
* deployments built by an earlier SDK store manifests with `measures` and `{ op: "measure", name }`
|
|
8
|
+
* expression nodes. Published manifests use only the current names; API catalogs retain deprecated
|
|
9
|
+
* aliases for released readers. Version 14 renames measures to metrics: entities' and the model's `metrics`,
|
|
10
|
+
* and `metric` expression nodes (`{ op: "metric", name }`, formerly `op: "measure"`).
|
|
11
|
+
*/
|
|
12
|
+
import { Effect, Schema, SchemaIssue, SchemaParser, SchemaTransformation } from "effect";
|
|
13
|
+
import { METRIC_CONDITION_OPERATORS, } from "./metric-filters.js";
|
|
14
|
+
/** The earlier name of `metrics`, in definitions, manifests and metric queries. */
|
|
15
|
+
const EARLIER_METRICS = "measures";
|
|
16
|
+
/** The earlier name of an order's `metric`, and of a `metric` expression node's `op`. */
|
|
17
|
+
const EARLIER_METRIC = "measure";
|
|
18
|
+
const METRICS = "metrics";
|
|
19
|
+
const METRIC = "metric";
|
|
20
|
+
/** @deprecated Use {@link METRIC_CONDITION_OPERATORS}. */
|
|
21
|
+
export const MEASURE_CONDITION_OPERATORS = METRIC_CONDITION_OPERATORS;
|
|
22
|
+
/** @deprecated Use `ModelMetricManifest`. */
|
|
23
|
+
export { ModelMetricManifest as ModelMeasureManifest } from "./manifest.js";
|
|
24
|
+
/** The earlier property shares the metrics themselves and their declared names. */
|
|
25
|
+
export function withEarlierMetricsName(metrics) {
|
|
26
|
+
return { measures: metrics };
|
|
27
|
+
}
|
|
28
|
+
const METRICS_NAME = { earlier: EARLIER_METRICS, current: METRICS };
|
|
29
|
+
/**
|
|
30
|
+
* The fields of `entity(…)` and `defineOntology(…)` definitions that SDK releases renamed. A rename
|
|
31
|
+
* adds one entry: definitions accept the earlier name, and `check` warns where workspace code still
|
|
32
|
+
* uses it, naming the current one.
|
|
33
|
+
*/
|
|
34
|
+
const RENAMED_DEFINITION_FIELDS = [METRICS_NAME];
|
|
35
|
+
/** The earlier names of each definition {@link withCurrentDefinitionNames} renamed. */
|
|
36
|
+
const earlierNamesRenamed = new WeakMap();
|
|
37
|
+
/** The renamed fields a record declares under their earlier name only. */
|
|
38
|
+
function earlierNamesIn(record, names) {
|
|
39
|
+
const fields = record;
|
|
40
|
+
return names.filter(({ earlier, current }) => fields[earlier] !== undefined && fields[current] === undefined);
|
|
41
|
+
}
|
|
42
|
+
/** The record with those fields under their current names, each in its place among the others. */
|
|
43
|
+
function withCurrentNames(record, names) {
|
|
44
|
+
return names.reduce((fields, { earlier, current }) => renamedKey(Object.fromEntries(Object.entries(fields).filter(([key]) => key !== current)), earlier, current), record);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A record, such as a fresh metric query's options, with an earlier `measures` and no `metrics` as
|
|
48
|
+
* one with `metrics`; others as given. Definitions use {@link withCurrentDefinitionNames}.
|
|
49
|
+
*/
|
|
50
|
+
export function withCurrentMetricsField(record) {
|
|
51
|
+
return withCurrentNames(record, earlierNamesIn(record, [METRICS_NAME]));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* An `entity(…)` or `defineOntology(…)` definition with each field it declares under an earlier name
|
|
55
|
+
* only renamed to the current one; without such a field, the definition itself. The earlier names
|
|
56
|
+
* stay known to {@link earlierNamesOf}, for `check`.
|
|
57
|
+
*/
|
|
58
|
+
export function withCurrentDefinitionNames(definition) {
|
|
59
|
+
const names = earlierNamesIn(definition, RENAMED_DEFINITION_FIELDS);
|
|
60
|
+
if (names.length === 0) {
|
|
61
|
+
return definition;
|
|
62
|
+
}
|
|
63
|
+
const renamed = withCurrentNames(definition, names);
|
|
64
|
+
earlierNamesRenamed.set(renamed, names);
|
|
65
|
+
return renamed;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The earlier names a definition uses, for `check` to warn about: those
|
|
69
|
+
* {@link withCurrentDefinitionNames} renamed in it, or those it still declares itself. A field
|
|
70
|
+
* declared under both names is not among them; {@link earlierMetricsFieldProblem} refuses it.
|
|
71
|
+
*/
|
|
72
|
+
export function earlierNamesOf(definition) {
|
|
73
|
+
return isRecord(definition)
|
|
74
|
+
? (earlierNamesRenamed.get(definition) ?? earlierNamesIn(definition, RENAMED_DEFINITION_FIELDS))
|
|
75
|
+
: [];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Why a definition's metrics cannot be read, for `check`: it declares them under both names. A
|
|
79
|
+
* definition with only one of them has no such problem.
|
|
80
|
+
*/
|
|
81
|
+
export function earlierMetricsFieldProblem(definition) {
|
|
82
|
+
return isRecord(definition) &&
|
|
83
|
+
definition[EARLIER_METRICS] !== undefined &&
|
|
84
|
+
definition[METRICS] !== undefined
|
|
85
|
+
? "Declare metrics once, under metrics; measures is their earlier name."
|
|
86
|
+
: undefined;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A fresh metric query's options with its metrics under `metrics`, whichever name the action used.
|
|
90
|
+
* Naming them under both is a mistake in the action's code, so it throws, as other malformed
|
|
91
|
+
* options fail the action.
|
|
92
|
+
*/
|
|
93
|
+
export function withCurrentFreshMetricQueryNames(options) {
|
|
94
|
+
const problem = earlierMetricsFieldProblem(options);
|
|
95
|
+
if (problem !== undefined) {
|
|
96
|
+
throw new TypeError(problem);
|
|
97
|
+
}
|
|
98
|
+
return withCurrentMetricsField(options);
|
|
99
|
+
}
|
|
100
|
+
/** The earlier name of an entity handle's `queryMetrics`, which action code may still call. */
|
|
101
|
+
const EARLIER_QUERY_METRICS = "aggregate";
|
|
102
|
+
/** The members an entity handle carries under their earlier names. */
|
|
103
|
+
export function withEarlierQueryMetricsName(queryMetrics) {
|
|
104
|
+
return { [EARLIER_QUERY_METRICS]: queryMetrics };
|
|
105
|
+
}
|
|
106
|
+
export function withCurrentManifestNames(document) {
|
|
107
|
+
return renamedManifest(document, { from: EARLIER_METRICS, to: METRICS }, EARLIER_METRIC, METRIC);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The inverse of {@link withCurrentManifestNames}, for a manifest of a version before 14 that is
|
|
111
|
+
* encoded again: its document keeps the names it was hashed with.
|
|
112
|
+
*/
|
|
113
|
+
export function withEarlierManifestNames(document) {
|
|
114
|
+
return renamedManifest(document, { from: METRICS, to: EARLIER_METRICS }, METRIC, EARLIER_METRIC);
|
|
115
|
+
}
|
|
116
|
+
/** A catalog metric's expression in the spelling released clients understand. */
|
|
117
|
+
export function withEarlierMetricExpression(expression) {
|
|
118
|
+
return renamedExpression(expression, METRIC, EARLIER_METRIC, 0);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* An API catalog in current names with deprecated `measures` aliases on the model and its entities.
|
|
122
|
+
* Only the aliases use `measure` expression nodes. Stored documents and their hashes stay untouched.
|
|
123
|
+
*/
|
|
124
|
+
export function withEarlierCatalogNames(document) {
|
|
125
|
+
const current = withCurrentManifestNames(document);
|
|
126
|
+
const aliases = (owner) => Object.hasOwn(owner, METRICS)
|
|
127
|
+
? { ...owner, [EARLIER_METRICS]: renamedMetrics(owner[METRICS], METRIC, EARLIER_METRIC) }
|
|
128
|
+
: owner;
|
|
129
|
+
const catalog = aliases(current);
|
|
130
|
+
return Array.isArray(current.entities)
|
|
131
|
+
? {
|
|
132
|
+
...catalog,
|
|
133
|
+
entities: changedItems(current.entities, (entity) => isRecord(entity) ? aliases(entity) : entity),
|
|
134
|
+
}
|
|
135
|
+
: catalog;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A manifest schema that reads documents of every version: each is renamed with
|
|
139
|
+
* {@link withCurrentManifestNames} before the schema decodes it. Being a declaration, it keeps
|
|
140
|
+
* doing so on its type side, so `Schema.toType` of it accepts the earlier names too.
|
|
141
|
+
*/
|
|
142
|
+
export function acceptingEarlierManifestNames(schema) {
|
|
143
|
+
return Schema.declareConstructor()([schema], ([codec]) => (input, _ast, options) => SchemaParser.decodeUnknownEffect(codec)(withCurrentManifestNames(input), options));
|
|
144
|
+
}
|
|
145
|
+
// Metric queries of the ontology service.
|
|
146
|
+
/**
|
|
147
|
+
* The earlier name of the ontology service's metric query routes, `/api/ontology/aggregate` and
|
|
148
|
+
* `/api/ontology/<entity>/aggregate`, which older app SDKs still call: both are served, and the
|
|
149
|
+
* name stays reserved for entities and metrics of the model.
|
|
150
|
+
*/
|
|
151
|
+
export const EARLIER_QUERY_METRICS_ROUTE = "aggregate";
|
|
152
|
+
/**
|
|
153
|
+
* A metric query's body with the earlier names renamed: `measures` becomes `metrics`, and an
|
|
154
|
+
* order's `measure` its `metric`. A body that names one of them twice is returned as it is, for the
|
|
155
|
+
* schema to refuse; a body without earlier names is returned itself.
|
|
156
|
+
*/
|
|
157
|
+
export function withCurrentMetricQueryNames(body) {
|
|
158
|
+
if (!isRecord(body)) {
|
|
159
|
+
return body;
|
|
160
|
+
}
|
|
161
|
+
let renamed = body;
|
|
162
|
+
if (Object.hasOwn(body, EARLIER_METRICS) && !Object.hasOwn(body, METRICS)) {
|
|
163
|
+
renamed = renamedKey(body, EARLIER_METRICS, METRICS);
|
|
164
|
+
}
|
|
165
|
+
if (Array.isArray(body.orderBy)) {
|
|
166
|
+
const orders = changedItems(body.orderBy, (order) => isRecord(order) && Object.hasOwn(order, EARLIER_METRIC) && !Object.hasOwn(order, METRIC)
|
|
167
|
+
? renamedKey(order, EARLIER_METRIC, METRIC)
|
|
168
|
+
: order);
|
|
169
|
+
if (orders !== body.orderBy) {
|
|
170
|
+
renamed = { ...renamed, orderBy: orders };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return renamed;
|
|
174
|
+
}
|
|
175
|
+
/** Where a metric query names something under both names, if it does. */
|
|
176
|
+
function metricQueryNameConflict(body) {
|
|
177
|
+
if (!isRecord(body)) {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
if (Object.hasOwn(body, EARLIER_METRICS) && Object.hasOwn(body, METRICS)) {
|
|
181
|
+
return [EARLIER_METRICS];
|
|
182
|
+
}
|
|
183
|
+
const orders = Array.isArray(body.orderBy) ? body.orderBy : [];
|
|
184
|
+
const index = orders.findIndex((order) => isRecord(order) && Object.hasOwn(order, EARLIER_METRIC) && Object.hasOwn(order, METRIC));
|
|
185
|
+
return index === -1 ? undefined : ["orderBy", index, EARLIER_METRIC];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* A metric query schema that also reads the earlier names older app SDKs send, through
|
|
189
|
+
* {@link withCurrentMetricQueryNames}, and refuses a request that uses both names for one field. Its
|
|
190
|
+
* type side is `schema` itself, which documents the current names only.
|
|
191
|
+
*/
|
|
192
|
+
export function acceptingEarlierMetricQueryNames(schema) {
|
|
193
|
+
return Schema.Unknown.pipe(Schema.decodeTo(schema, SchemaTransformation.transformEffect({
|
|
194
|
+
decode: (body, options) => {
|
|
195
|
+
const conflict = metricQueryNameConflict(body);
|
|
196
|
+
return conflict === undefined
|
|
197
|
+
? Effect.succeed(withCurrentMetricQueryNames(body))
|
|
198
|
+
: Effect.fail(new SchemaIssue.Pointer(conflict, new SchemaIssue.InvalidValue({
|
|
199
|
+
message: conflict.length === 1
|
|
200
|
+
? "Send metrics only; measures is their earlier name."
|
|
201
|
+
: "Send metric only; measure is its earlier name.",
|
|
202
|
+
}, body, options)));
|
|
203
|
+
},
|
|
204
|
+
encode: (body) => Effect.succeed(body),
|
|
205
|
+
})));
|
|
206
|
+
}
|
|
207
|
+
// Helpers.
|
|
208
|
+
function isRecord(value) {
|
|
209
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
210
|
+
}
|
|
211
|
+
/** The record with one key renamed, in its place among the others. */
|
|
212
|
+
function renamedKey(record, from, to) {
|
|
213
|
+
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key === from ? to : key, value]));
|
|
214
|
+
}
|
|
215
|
+
/** The items mapped, or the same array when no item changed. */
|
|
216
|
+
function changedItems(items, map) {
|
|
217
|
+
const mapped = items.map(map);
|
|
218
|
+
return mapped.some((item, index) => item !== items[index]) ? mapped : items;
|
|
219
|
+
}
|
|
220
|
+
/** How deep renaming follows an expression: deeper than `check` lets any metric expression nest. */
|
|
221
|
+
const MAXIMUM_EXPRESSION_DEPTH = 64;
|
|
222
|
+
/** An expression with every `op: from` node renamed to `op: to`, nested arguments included. */
|
|
223
|
+
function renamedExpression(value, from, to, depth) {
|
|
224
|
+
if (!isRecord(value) || depth > MAXIMUM_EXPRESSION_DEPTH) {
|
|
225
|
+
return value;
|
|
226
|
+
}
|
|
227
|
+
const args = Array.isArray(value.args)
|
|
228
|
+
? changedItems(value.args, (arg) => renamedExpression(arg, from, to, depth + 1))
|
|
229
|
+
: value.args;
|
|
230
|
+
if (value.op !== from && args === value.args) {
|
|
231
|
+
return value;
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
...value,
|
|
235
|
+
...(value.op === from ? { op: to } : {}),
|
|
236
|
+
...(args === value.args ? {} : { args }),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** A list of metrics with their expressions renamed. */
|
|
240
|
+
function renamedMetrics(metrics, from, to) {
|
|
241
|
+
return Array.isArray(metrics)
|
|
242
|
+
? changedItems(metrics, (metric) => {
|
|
243
|
+
if (!isRecord(metric)) {
|
|
244
|
+
return metric;
|
|
245
|
+
}
|
|
246
|
+
const expression = renamedExpression(metric.expression, from, to, 0);
|
|
247
|
+
return expression === metric.expression ? metric : { ...metric, expression };
|
|
248
|
+
})
|
|
249
|
+
: metrics;
|
|
250
|
+
}
|
|
251
|
+
/** An entity's or the manifest's record with its list of metrics under its new key, renamed. */
|
|
252
|
+
function renamedOwner(owner, keys, from, to) {
|
|
253
|
+
const key = Object.hasOwn(owner, keys.from) && !Object.hasOwn(owner, keys.to) ? keys.from : keys.to;
|
|
254
|
+
const metrics = owner[key];
|
|
255
|
+
const renamed = renamedMetrics(metrics, from, to);
|
|
256
|
+
if (key === keys.to && renamed === metrics) {
|
|
257
|
+
return owner;
|
|
258
|
+
}
|
|
259
|
+
return Object.fromEntries(Object.entries(owner).map(([name, value]) => name === key ? [keys.to, renamed] : [name, value]));
|
|
260
|
+
}
|
|
261
|
+
function renamedManifest(document, keys, from, to) {
|
|
262
|
+
if (!isRecord(document)) {
|
|
263
|
+
return document;
|
|
264
|
+
}
|
|
265
|
+
const entities = Array.isArray(document.entities)
|
|
266
|
+
? changedItems(document.entities, (entity) => isRecord(entity) ? renamedOwner(entity, keys, from, to) : entity)
|
|
267
|
+
: document.entities;
|
|
268
|
+
const renamed = renamedOwner(document, keys, from, to);
|
|
269
|
+
return entities === document.entities ? renamed : { ...renamed, entities };
|
|
270
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type OntologyManifest } from "./manifest.js";
|
|
2
|
+
/**
|
|
3
|
+
* Whether two manifests differ only in presentation metadata: labels, descriptions, guides, display
|
|
4
|
+
* hints and relationship phrases. Pages and forwarded reads of one keep working against the other,
|
|
5
|
+
* because its schema, permissions and sign-in policy are the same. It is not permission evidence:
|
|
6
|
+
* live users, exact roles and revocations still apply.
|
|
7
|
+
*/
|
|
8
|
+
export declare function browserAuthenticationCompatible(left: OntologyManifest, right: OntologyManifest): boolean;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { canonicalJson, encodeManifest, MANIFEST_VERSION, } from "./manifest.js";
|
|
2
|
+
/** The first version whose documents name metrics as this SDK does. */
|
|
3
|
+
const FIRST_COMPARABLE_VERSION = 14;
|
|
4
|
+
// @legacy ontology.workflow-cutover-artifacts
|
|
5
|
+
/**
|
|
6
|
+
* Capabilities ontology SDKs 0.86.0 to 0.88.0 declared for a deploy guard that was withdrawn.
|
|
7
|
+
* Nothing reads them, so a manifest that declares them equals one that does not.
|
|
8
|
+
*/
|
|
9
|
+
const WITHDRAWN_CAPABILITIES = [
|
|
10
|
+
"workflow-execution-compatibility-v1",
|
|
11
|
+
"workflow-admission-v1",
|
|
12
|
+
"workflow-execution-extension-v1",
|
|
13
|
+
];
|
|
14
|
+
function record(value) {
|
|
15
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
function omit(value, fields) {
|
|
18
|
+
return Object.fromEntries(Object.entries(value).filter(([key]) => !fields.includes(key)));
|
|
19
|
+
}
|
|
20
|
+
function mapRecords(value, project) {
|
|
21
|
+
return Array.isArray(value) ? value.map((item) => (record(item) ? project(item) : item)) : value;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Explicit presentation fields only. Never recursively strip keywords: JSON Schema's descriptions,
|
|
25
|
+
* defaults and arbitrary scope predicates stay opaque, as do fields this SDK does not understand.
|
|
26
|
+
*/
|
|
27
|
+
function entityWithoutPresentation(entity) {
|
|
28
|
+
const projected = omit(entity, ["label", "plural", "description", "guide"]);
|
|
29
|
+
return {
|
|
30
|
+
...projected,
|
|
31
|
+
properties: mapRecords(entity.properties, (property) => ({
|
|
32
|
+
...omit(property, ["label", "description", "display"]),
|
|
33
|
+
...(property.options === undefined
|
|
34
|
+
? {}
|
|
35
|
+
: {
|
|
36
|
+
options: mapRecords(property.options, (option) => omit(option, ["label", "description"])),
|
|
37
|
+
}),
|
|
38
|
+
})),
|
|
39
|
+
relationships: mapRecords(entity.relationships, (relationship) => omit(relationship, ["phrase", "description"])),
|
|
40
|
+
actions: mapRecords(entity.actions, (action) => omit(action, ["description"])),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A manifest without its presentation metadata, version and hash; undefined for a version whose
|
|
45
|
+
* documents this SDK cannot compare. Earlier versions name metrics differently.
|
|
46
|
+
*/
|
|
47
|
+
function withoutPresentation(manifest) {
|
|
48
|
+
const document = encodeManifest(manifest);
|
|
49
|
+
if (manifest.version < FIRST_COMPARABLE_VERSION ||
|
|
50
|
+
manifest.version > MANIFEST_VERSION ||
|
|
51
|
+
document.version !== manifest.version) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
// @legacy ontology.workflow-cutover-artifacts
|
|
56
|
+
...omit(document, ["hash", "version", "executionCompatibility"]),
|
|
57
|
+
runtimeCapabilities: Array.isArray(document.runtimeCapabilities)
|
|
58
|
+
? document.runtimeCapabilities.filter((value) => !WITHDRAWN_CAPABILITIES.includes(value))
|
|
59
|
+
: document.runtimeCapabilities,
|
|
60
|
+
entities: mapRecords(document.entities, entityWithoutPresentation),
|
|
61
|
+
roles: mapRecords(document.roles, (role) => omit(role, ["description"])),
|
|
62
|
+
...(document.connections === undefined
|
|
63
|
+
? {}
|
|
64
|
+
: {
|
|
65
|
+
connections: mapRecords(document.connections, (connection) => omit(connection, ["description"])),
|
|
66
|
+
}),
|
|
67
|
+
...(document.workflows === undefined
|
|
68
|
+
? {}
|
|
69
|
+
: {
|
|
70
|
+
workflows: mapRecords(document.workflows, (workflow) => ({
|
|
71
|
+
...omit(workflow, ["description"]),
|
|
72
|
+
triggers: mapRecords(workflow.triggers, (trigger) => omit(trigger, ["description"])),
|
|
73
|
+
})),
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Whether two manifests differ only in presentation metadata: labels, descriptions, guides, display
|
|
79
|
+
* hints and relationship phrases. Pages and forwarded reads of one keep working against the other,
|
|
80
|
+
* because its schema, permissions and sign-in policy are the same. It is not permission evidence:
|
|
81
|
+
* live users, exact roles and revocations still apply.
|
|
82
|
+
*/
|
|
83
|
+
export function browserAuthenticationCompatible(left, right) {
|
|
84
|
+
const a = withoutPresentation(left);
|
|
85
|
+
const b = withoutPresentation(right);
|
|
86
|
+
return a !== undefined && b !== undefined && canonicalJson(a) === canonicalJson(b);
|
|
87
|
+
}
|