@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,594 @@
|
|
|
1
|
+
// ../diagnostics/src/index.ts
|
|
2
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
3
|
+
|
|
4
|
+
// ../diagnostics/src/report.ts
|
|
5
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
6
|
+
|
|
7
|
+
// ../diagnostics/src/redact.ts
|
|
8
|
+
function makeRedactor(values = []) {
|
|
9
|
+
const secrets = [
|
|
10
|
+
...new Set(values.filter((v) => typeof v === "string" && v.length > 0))
|
|
11
|
+
].sort((a, b) => b.length - a.length);
|
|
12
|
+
return (input) => {
|
|
13
|
+
let text = input;
|
|
14
|
+
for (const value of secrets) text = text.replaceAll(value, "[REDACTED]");
|
|
15
|
+
return redactCopyContext(redactPrivateKeys(text)).replace(
|
|
16
|
+
/\b(?:postgres(?:ql)?|mysql|mongodb(?:\+srv)?):\/\/\S+/gi,
|
|
17
|
+
"[REDACTED CONNECTION URI]"
|
|
18
|
+
).replace(
|
|
19
|
+
/\b(?:sscli_(?:access_|key_)?v1|ssbrowser_(?:link_)?v1)\.[a-f0-9-]{36}\.[A-Za-z0-9_-]{43}\b/gi,
|
|
20
|
+
"[REDACTED CLI CREDENTIAL]"
|
|
21
|
+
).replace(/\b(?:Bearer|Basic)\s+[A-Za-z0-9+/_=.:~-]+/gi, "[REDACTED AUTHORIZATION]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[REDACTED JWT]").replace(
|
|
22
|
+
/\b(?:sk|rk|vercel_blob_rw|vercel_blob_r|access_token|refresh_token)_[A-Za-z0-9._~-]{8,}/g,
|
|
23
|
+
"[REDACTED]"
|
|
24
|
+
).replace(/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/@]+@/gi, "$1[REDACTED]@").replace(
|
|
25
|
+
/([?&](?:access_token|api_key|apikey|key|password|refresh_token|secret|token|signature|sig)=)[^&#\s]*/gi,
|
|
26
|
+
"$1[REDACTED]"
|
|
27
|
+
).replace(
|
|
28
|
+
/((?:["']?)(?:password|passwd|credential|secret|client_secret|api_key|access_token|refresh_token|authorization|cookie|set-cookie|token)(?:["']?)\s*[:=]\s*)(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s,;})]+)/gi,
|
|
29
|
+
"$1[REDACTED]"
|
|
30
|
+
).replace(/(Key\s*\([^)]*\)\s*=\s*)\([\s\S]*/gi, (match, prefix) => {
|
|
31
|
+
const endings = [") already exists", ") is not present"];
|
|
32
|
+
const end = Math.max(...endings.map((ending) => match.lastIndexOf(ending)));
|
|
33
|
+
return `${prefix}([REDACTED])${end < 0 ? "" : match.slice(end + 1)}`;
|
|
34
|
+
}).replace(/(Failing row contains\s+)[\s\S]*/gi, "$1[REDACTED]").replace(/(SQL statement\s+)[\s\S]*/gi, "$1[REDACTED]").replace(/(JSON data, line \d+:\s*)[\s\S]*/gi, "$1[REDACTED]").replace(/((?:Token|Escape sequence|but found)\s+")[\s\S]*/gi, (match, prefix) => {
|
|
35
|
+
const end = Math.max(match.lastIndexOf('" is invalid'), match.lastIndexOf('".'));
|
|
36
|
+
return `${prefix}[REDACTED]${end < 0 ? '"' : match.slice(end)}`;
|
|
37
|
+
}).replace(/(invalid input syntax for [^:]+:\s*)"[^"]*"/gi, "$1[REDACTED]");
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function redactCopyContext(text) {
|
|
41
|
+
const lines = /\bCOPY [^\n]*/gi;
|
|
42
|
+
let line;
|
|
43
|
+
while ((line = lines.exec(text)) !== null) {
|
|
44
|
+
const position = line[0].indexOf(", line ");
|
|
45
|
+
if (position < 0) continue;
|
|
46
|
+
const header = /^, line \d+(?:, column [^:\n]+)?:\s*/i.exec(line[0].slice(position));
|
|
47
|
+
return text.slice(0, line.index + (header ? position + header[0].length : 5)) + "[REDACTED]";
|
|
48
|
+
}
|
|
49
|
+
return text;
|
|
50
|
+
}
|
|
51
|
+
function environmentSecrets(env) {
|
|
52
|
+
return Object.entries(env).filter(
|
|
53
|
+
([key]) => /(?:TOKEN|SECRET|PASSWORD|PRIVATE_KEY|API_KEY|COOKIE|SIGNING_KEY|DATABASE_URL|POSTGRES_URL|GRANT)/i.test(
|
|
54
|
+
key
|
|
55
|
+
)
|
|
56
|
+
).map(([, value]) => value);
|
|
57
|
+
}
|
|
58
|
+
function isSensitiveField(key) {
|
|
59
|
+
return /password|passwd|credential|secret|token|authorization|cookie|private[_-]?key|api[_-]?key|grant/i.test(
|
|
60
|
+
key
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function redactPrivateKeys(text) {
|
|
64
|
+
const begin = /-----BEGIN [^-]*PRIVATE KEY-----/g;
|
|
65
|
+
const end = /-----END [^-]*PRIVATE KEY-----/g;
|
|
66
|
+
const parts = [];
|
|
67
|
+
let copiedThrough = 0;
|
|
68
|
+
let opening;
|
|
69
|
+
while ((opening = begin.exec(text)) !== null) {
|
|
70
|
+
end.lastIndex = begin.lastIndex;
|
|
71
|
+
if (end.exec(text) === null) {
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
parts.push(text.slice(copiedThrough, opening.index), "[REDACTED PRIVATE KEY]");
|
|
75
|
+
copiedThrough = end.lastIndex;
|
|
76
|
+
begin.lastIndex = copiedThrough;
|
|
77
|
+
}
|
|
78
|
+
parts.push(text.slice(copiedThrough));
|
|
79
|
+
return parts.join("");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ../diagnostics/src/report.ts
|
|
83
|
+
var failureRedactions = /* @__PURE__ */ new WeakMap();
|
|
84
|
+
var MAX_BYTES = 1024 * 1024;
|
|
85
|
+
var MAX_NODES = 1024;
|
|
86
|
+
var FIELDS = [
|
|
87
|
+
"fiberId",
|
|
88
|
+
"code",
|
|
89
|
+
"status",
|
|
90
|
+
"statusCode",
|
|
91
|
+
"provider",
|
|
92
|
+
"providerCode",
|
|
93
|
+
"providerRequestId",
|
|
94
|
+
"method",
|
|
95
|
+
"host",
|
|
96
|
+
"path",
|
|
97
|
+
"retryable",
|
|
98
|
+
"constraint",
|
|
99
|
+
"detail",
|
|
100
|
+
"hint",
|
|
101
|
+
"table",
|
|
102
|
+
"column",
|
|
103
|
+
"where",
|
|
104
|
+
"position",
|
|
105
|
+
"sqlState",
|
|
106
|
+
"field",
|
|
107
|
+
"expected",
|
|
108
|
+
"actual",
|
|
109
|
+
"setting",
|
|
110
|
+
"resourceId",
|
|
111
|
+
"runtimeAttemptId",
|
|
112
|
+
"sandboxId",
|
|
113
|
+
"sessionId",
|
|
114
|
+
"remoteErrorId",
|
|
115
|
+
"endpoint",
|
|
116
|
+
"requestId",
|
|
117
|
+
"reason",
|
|
118
|
+
"connection",
|
|
119
|
+
"providerMessage",
|
|
120
|
+
"providerDescription",
|
|
121
|
+
"stderr",
|
|
122
|
+
"exitCode"
|
|
123
|
+
];
|
|
124
|
+
var links = Symbol.for("segmentstream.diagnostic.links");
|
|
125
|
+
var incomplete = Symbol.for("segmentstream.diagnostic.omissions");
|
|
126
|
+
var RELATIONS = ["cause", "aggregate", "primary", "cleanup", "concurrent"];
|
|
127
|
+
var MAX_EDGES = 8192;
|
|
128
|
+
function property(value, key) {
|
|
129
|
+
if ((typeof value !== "object" || value === null) && typeof value !== "function")
|
|
130
|
+
return void 0;
|
|
131
|
+
try {
|
|
132
|
+
return Reflect.get(value, key);
|
|
133
|
+
} catch {
|
|
134
|
+
return void 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function scalar(value) {
|
|
138
|
+
return typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
|
|
139
|
+
}
|
|
140
|
+
function effectCause(value) {
|
|
141
|
+
if (property(value, "~effect/Cause") === "~effect/Cause") {
|
|
142
|
+
const reasons = property(value, "reasons");
|
|
143
|
+
if (Array.isArray(reasons))
|
|
144
|
+
return {
|
|
145
|
+
type: "EffectCause",
|
|
146
|
+
message: "Effect execution failed",
|
|
147
|
+
children: reasons.slice(0, MAX_NODES).map((error) => ({ error, relation: "concurrent" })),
|
|
148
|
+
limited: reasons.length > MAX_NODES
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const legacy = property(value, Symbol.for("effect/Cause")) !== void 0;
|
|
152
|
+
if (!legacy && property(value, "~effect/Cause/Reason") !== "~effect/Cause/Reason")
|
|
153
|
+
return void 0;
|
|
154
|
+
const type = property(value, "_tag");
|
|
155
|
+
switch (type) {
|
|
156
|
+
case "Fail":
|
|
157
|
+
return {
|
|
158
|
+
type,
|
|
159
|
+
message: "Typed failure",
|
|
160
|
+
children: [{ error: property(value, "error"), relation: "cause" }]
|
|
161
|
+
};
|
|
162
|
+
case "Die":
|
|
163
|
+
return {
|
|
164
|
+
type,
|
|
165
|
+
message: "Unexpected defect",
|
|
166
|
+
children: [{ error: property(value, "defect"), relation: "cause" }]
|
|
167
|
+
};
|
|
168
|
+
case "Interrupt":
|
|
169
|
+
return { type, message: "Fiber interrupted", children: [] };
|
|
170
|
+
case "Empty":
|
|
171
|
+
return legacy ? { type, message: "Empty Effect cause", children: [] } : void 0;
|
|
172
|
+
case "Sequential":
|
|
173
|
+
case "Parallel":
|
|
174
|
+
return legacy ? {
|
|
175
|
+
type,
|
|
176
|
+
message: `${type} Effect causes`,
|
|
177
|
+
children: ["left", "right"].map((key) => ({
|
|
178
|
+
error: property(value, key),
|
|
179
|
+
relation: type === "Parallel" ? "concurrent" : "cause"
|
|
180
|
+
}))
|
|
181
|
+
} : void 0;
|
|
182
|
+
default:
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function ownValues(value) {
|
|
187
|
+
if (!value || typeof value !== "object") return [];
|
|
188
|
+
try {
|
|
189
|
+
return Object.values(Object.getOwnPropertyDescriptors(value)).filter((descriptor) => "value" in descriptor).map((descriptor) => descriptor.value);
|
|
190
|
+
} catch {
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function schemaInputRedactions(root) {
|
|
195
|
+
const values = /* @__PURE__ */ new Set();
|
|
196
|
+
const seen = /* @__PURE__ */ new Set();
|
|
197
|
+
const errors = [root];
|
|
198
|
+
const issues = [];
|
|
199
|
+
let limited = false;
|
|
200
|
+
let traversed = 0;
|
|
201
|
+
while (errors.length && seen.size < MAX_NODES) {
|
|
202
|
+
if (++traversed > MAX_EDGES || errors.length > MAX_EDGES) {
|
|
203
|
+
limited = true;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
const value = errors.shift();
|
|
207
|
+
if (seen.has(value)) continue;
|
|
208
|
+
seen.add(value);
|
|
209
|
+
if (value !== null && (typeof value === "object" || typeof value === "function")) {
|
|
210
|
+
for (const secret of failureRedactions.get(value) ?? []) {
|
|
211
|
+
if (secret) values.add(secret);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (property(value, "_tag") === "SchemaError" || property(value, "name") === "SchemaError")
|
|
215
|
+
issues.push(property(value, "issue"));
|
|
216
|
+
const effect = effectCause(value);
|
|
217
|
+
if (effect?.limited) limited = true;
|
|
218
|
+
if (effect) errors.push(...effect.children.map((child) => child.error));
|
|
219
|
+
const explicit = property(value, links);
|
|
220
|
+
if (Array.isArray(explicit)) {
|
|
221
|
+
if (explicit.length > MAX_NODES) limited = true;
|
|
222
|
+
errors.push(...explicit.slice(0, MAX_NODES).map((item) => property(item, "error")));
|
|
223
|
+
}
|
|
224
|
+
const cause = property(value, "cause");
|
|
225
|
+
if (cause !== void 0) errors.push(cause);
|
|
226
|
+
const aggregate = property(value, "errors");
|
|
227
|
+
if (property(value, "name") === "AggregateError" && Array.isArray(aggregate)) {
|
|
228
|
+
if (aggregate.length > MAX_NODES) limited = true;
|
|
229
|
+
errors.push(...aggregate.slice(0, MAX_NODES));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (errors.length) limited = true;
|
|
233
|
+
seen.clear();
|
|
234
|
+
const inputs = [];
|
|
235
|
+
while (issues.length && seen.size < MAX_NODES) {
|
|
236
|
+
if (++traversed > MAX_EDGES || issues.length > MAX_EDGES) {
|
|
237
|
+
limited = true;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
const issue = issues.pop();
|
|
241
|
+
if (!issue || seen.has(issue)) continue;
|
|
242
|
+
seen.add(issue);
|
|
243
|
+
for (const key of ["input", "actual"]) {
|
|
244
|
+
const input = property(issue, key);
|
|
245
|
+
if (input !== void 0) inputs.push(input);
|
|
246
|
+
}
|
|
247
|
+
const child = property(issue, "issue");
|
|
248
|
+
if (child !== void 0) issues.push(child);
|
|
249
|
+
const children = property(issue, "issues");
|
|
250
|
+
if (Array.isArray(children)) {
|
|
251
|
+
if (children.length > MAX_NODES) limited = true;
|
|
252
|
+
issues.push(...children.slice(0, MAX_NODES));
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (issues.length) limited = true;
|
|
256
|
+
seen.clear();
|
|
257
|
+
let characters = 0;
|
|
258
|
+
while (inputs.length && seen.size < 4096 && characters < MAX_BYTES) {
|
|
259
|
+
if (++traversed > MAX_EDGES || inputs.length > MAX_EDGES) {
|
|
260
|
+
limited = true;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
const value = inputs.pop();
|
|
264
|
+
if (seen.has(value)) continue;
|
|
265
|
+
seen.add(value);
|
|
266
|
+
if (scalar(value) && String(value)) {
|
|
267
|
+
const text = String(value);
|
|
268
|
+
characters += text.length;
|
|
269
|
+
values.add(text);
|
|
270
|
+
if (typeof value === "string") values.add(JSON.stringify(value).slice(1, -1));
|
|
271
|
+
} else {
|
|
272
|
+
const children = ownValues(value);
|
|
273
|
+
if (children.length > 4096) limited = true;
|
|
274
|
+
inputs.push(...children.slice(0, 4096));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (inputs.length) limited = true;
|
|
278
|
+
return { values: [...values], limited };
|
|
279
|
+
}
|
|
280
|
+
function createFailureReport(error, options) {
|
|
281
|
+
const schemaInputs = schemaInputRedactions(error);
|
|
282
|
+
if (schemaInputs.limited) return redactionLimitReport();
|
|
283
|
+
const redact = makeRedactor([...options.redactedValues ?? [], ...schemaInputs.values]);
|
|
284
|
+
let remaining = MAX_BYTES - 4096;
|
|
285
|
+
const omissions = /* @__PURE__ */ new Set();
|
|
286
|
+
const clean = (value) => {
|
|
287
|
+
const safe = redact(value.slice(0, MAX_BYTES));
|
|
288
|
+
if (value.length > MAX_BYTES) omissions.add("field input exceeded 1 MiB");
|
|
289
|
+
const bytes = Buffer.from(JSON.stringify(safe));
|
|
290
|
+
const allowance = Math.max(0, remaining);
|
|
291
|
+
if (bytes.length > allowance) {
|
|
292
|
+
omissions.add("report exceeded 1 MiB");
|
|
293
|
+
remaining = 0;
|
|
294
|
+
let low = 0;
|
|
295
|
+
let high = safe.length;
|
|
296
|
+
while (low < high) {
|
|
297
|
+
const middle = Math.ceil((low + high) / 2);
|
|
298
|
+
if (Buffer.byteLength(JSON.stringify(safe.slice(0, middle))) + 20 <= allowance)
|
|
299
|
+
low = middle;
|
|
300
|
+
else high = middle - 1;
|
|
301
|
+
}
|
|
302
|
+
return safe.slice(0, low).replace(/[\uD800-\uDBFF]$/, "") + " [TRUNCATED]";
|
|
303
|
+
}
|
|
304
|
+
remaining -= bytes.length;
|
|
305
|
+
return safe;
|
|
306
|
+
};
|
|
307
|
+
const report = {
|
|
308
|
+
version: 1,
|
|
309
|
+
errorId: options.errorId && /^[A-Za-z0-9_.:-]{1,200}$/.test(options.errorId) ? options.errorId : `err_${randomUUID().replaceAll("-", "")}`,
|
|
310
|
+
timestamp: options.timestamp?.slice(0, 100) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
311
|
+
service: clean(options.service),
|
|
312
|
+
context: {},
|
|
313
|
+
roots: [],
|
|
314
|
+
nodes: [],
|
|
315
|
+
complete: true,
|
|
316
|
+
omissions: []
|
|
317
|
+
};
|
|
318
|
+
const contextEntries = Object.entries(options.context ?? {});
|
|
319
|
+
if (contextEntries.length > 128) omissions.add("context exceeded 128 fields");
|
|
320
|
+
for (const [key, value] of contextEntries.slice(0, 128)) {
|
|
321
|
+
if (scalar(value))
|
|
322
|
+
report.context[clean(key)] = isSensitiveField(key) ? "[REDACTED]" : typeof value === "string" ? clean(value) : value;
|
|
323
|
+
}
|
|
324
|
+
const seen = /* @__PURE__ */ new Map();
|
|
325
|
+
const queue = [];
|
|
326
|
+
const add = (value) => {
|
|
327
|
+
const object = typeof value === "object" && value !== null || typeof value === "function";
|
|
328
|
+
if (object && seen.has(value)) return seen.get(value);
|
|
329
|
+
if (queue.length >= MAX_NODES || remaining < 1024) {
|
|
330
|
+
omissions.add(
|
|
331
|
+
queue.length >= MAX_NODES ? "report exceeded 1024 nodes" : "report exceeded 1 MiB"
|
|
332
|
+
);
|
|
333
|
+
return void 0;
|
|
334
|
+
}
|
|
335
|
+
const id = `n${queue.length + 1}`;
|
|
336
|
+
if (object) seen.set(value, id);
|
|
337
|
+
queue.push({ value, id });
|
|
338
|
+
remaining -= 512;
|
|
339
|
+
return id;
|
|
340
|
+
};
|
|
341
|
+
const root = add(error);
|
|
342
|
+
if (root) report.roots.push(root);
|
|
343
|
+
let edges = 0;
|
|
344
|
+
for (let index = 0; index < queue.length; index++) {
|
|
345
|
+
const { value, id } = queue[index];
|
|
346
|
+
const inheritedOmissions = property(value, incomplete);
|
|
347
|
+
if (Array.isArray(inheritedOmissions)) {
|
|
348
|
+
for (const reason of inheritedOmissions.slice(0, 128)) {
|
|
349
|
+
if (typeof reason === "string") omissions.add(clean(reason));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const effect = effectCause(value);
|
|
353
|
+
const name = property(value, "_tag") ?? property(value, "name") ?? effect?.type;
|
|
354
|
+
const message = property(value, "message") ?? effect?.message;
|
|
355
|
+
const node = {
|
|
356
|
+
id,
|
|
357
|
+
type: typeof name === "string" ? clean(name) : "NonErrorThrow",
|
|
358
|
+
message: clean(
|
|
359
|
+
typeof message === "string" && message ? message : typeof value === "string" ? value : `Thrown ${typeof value} value`
|
|
360
|
+
),
|
|
361
|
+
causes: []
|
|
362
|
+
};
|
|
363
|
+
for (const key of ["stack", "operation", "diagnostic"]) {
|
|
364
|
+
const field = property(value, key);
|
|
365
|
+
if (typeof field === "string") node[key] = clean(field);
|
|
366
|
+
}
|
|
367
|
+
const details = {};
|
|
368
|
+
for (const key of FIELDS) {
|
|
369
|
+
const field = property(value, key);
|
|
370
|
+
if (scalar(field))
|
|
371
|
+
details[key] = (key === "expected" || key === "actual") && isSensitiveField(String(property(value, "field") ?? "")) ? "[REDACTED]" : typeof field === "string" ? clean(field) : field;
|
|
372
|
+
}
|
|
373
|
+
if (Object.keys(details).length) node.details = details;
|
|
374
|
+
const children = effect?.children ?? [];
|
|
375
|
+
if (effect?.limited) omissions.add("Effect cause exceeded 1024 reasons");
|
|
376
|
+
const explicit = property(value, links);
|
|
377
|
+
if (Array.isArray(explicit)) {
|
|
378
|
+
for (const item of explicit.slice(0, MAX_NODES)) {
|
|
379
|
+
const relation = property(item, "relation");
|
|
380
|
+
if (typeof relation === "string" && RELATIONS.includes(relation))
|
|
381
|
+
children.push({ error: property(item, "error"), relation });
|
|
382
|
+
else omissions.add("invalid diagnostic cause link");
|
|
383
|
+
}
|
|
384
|
+
if (explicit.length > MAX_NODES) omissions.add("cause links exceeded 1024 children");
|
|
385
|
+
}
|
|
386
|
+
const cause = property(value, "cause");
|
|
387
|
+
if (cause !== void 0) children.push({ error: cause, relation: "cause" });
|
|
388
|
+
if (value instanceof AggregateError || property(value, "name") === "AggregateError") {
|
|
389
|
+
const errors = property(value, "errors");
|
|
390
|
+
if (Array.isArray(errors)) {
|
|
391
|
+
for (const item of errors.slice(0, MAX_NODES))
|
|
392
|
+
children.push({ error: item, relation: "aggregate" });
|
|
393
|
+
if (errors.length > MAX_NODES) omissions.add("aggregate exceeded 1024 children");
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
for (const child of children) {
|
|
397
|
+
if (edges >= MAX_EDGES || remaining < 100) {
|
|
398
|
+
omissions.add(
|
|
399
|
+
edges >= MAX_EDGES ? "report exceeded 8192 cause links" : "report exceeded 1 MiB"
|
|
400
|
+
);
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
edges++;
|
|
404
|
+
remaining -= 100;
|
|
405
|
+
const childId = add(child.error);
|
|
406
|
+
if (childId) node.causes.push({ id: childId, relation: child.relation });
|
|
407
|
+
}
|
|
408
|
+
report.nodes.push(node);
|
|
409
|
+
}
|
|
410
|
+
report.omissions = [...omissions];
|
|
411
|
+
report.complete = !report.omissions.length;
|
|
412
|
+
return fitReport(report);
|
|
413
|
+
}
|
|
414
|
+
function redactionLimitReport() {
|
|
415
|
+
return {
|
|
416
|
+
version: 1,
|
|
417
|
+
errorId: `err_${randomUUID().replaceAll("-", "")}`,
|
|
418
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
419
|
+
service: "diagnostics",
|
|
420
|
+
context: {},
|
|
421
|
+
roots: ["n1"],
|
|
422
|
+
nodes: [
|
|
423
|
+
{
|
|
424
|
+
id: "n1",
|
|
425
|
+
type: "RedactionLimitError",
|
|
426
|
+
message: "Failure details omitted because secret-redaction traversal was incomplete.",
|
|
427
|
+
causes: []
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
complete: false,
|
|
431
|
+
omissions: [
|
|
432
|
+
"secret redaction traversal exceeded its defensive budget (1024 graph/issue nodes, 4096 input values, 8192 traversal steps, 1 MiB)"
|
|
433
|
+
]
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
function fitReport(report) {
|
|
437
|
+
const wireBytes = () => Buffer.byteLength(JSON.stringify(report));
|
|
438
|
+
if (wireBytes() <= MAX_BYTES) return report;
|
|
439
|
+
report.complete = false;
|
|
440
|
+
report.omissions.push("serialized report exceeded 1 MiB");
|
|
441
|
+
while (wireBytes() > MAX_BYTES && report.nodes.length > 1) report.nodes.pop();
|
|
442
|
+
const retained = new Set(report.nodes.map((node) => node.id));
|
|
443
|
+
report.roots = report.roots.filter((id) => retained.has(id));
|
|
444
|
+
for (const node of report.nodes)
|
|
445
|
+
node.causes = node.causes.filter((edge) => retained.has(edge.id));
|
|
446
|
+
if (wireBytes() > MAX_BYTES) {
|
|
447
|
+
report.context = {};
|
|
448
|
+
report.service = report.service.slice(0, 200);
|
|
449
|
+
report.omissions = report.omissions.map((message) => message.slice(0, 1e3)).slice(0, 128);
|
|
450
|
+
report.nodes = report.nodes.map((node) => ({
|
|
451
|
+
id: node.id,
|
|
452
|
+
type: node.type.slice(0, 200),
|
|
453
|
+
message: node.message.slice(0, 1e3) + " [TRUNCATED]",
|
|
454
|
+
causes: node.causes
|
|
455
|
+
}));
|
|
456
|
+
}
|
|
457
|
+
return report;
|
|
458
|
+
}
|
|
459
|
+
function renderFailure(report, maxBytes = 8192) {
|
|
460
|
+
const nodes = new Map(report.nodes.map((node) => [node.id, node]));
|
|
461
|
+
const seen = /* @__PURE__ */ new Set();
|
|
462
|
+
const pending = report.roots.map((id) => ({ id, depth: 0, relation: "root" }));
|
|
463
|
+
const lines = [`Failure ${report.errorId} (${report.service})`];
|
|
464
|
+
while (pending.length) {
|
|
465
|
+
const item = pending.pop();
|
|
466
|
+
const prefix = `${" ".repeat(Math.min(item.depth, 32))}${item.relation}: `;
|
|
467
|
+
if (seen.has(item.id)) {
|
|
468
|
+
lines.push(`${prefix}[reference ${item.id}]`);
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
seen.add(item.id);
|
|
472
|
+
const node = nodes.get(item.id);
|
|
473
|
+
if (!node) {
|
|
474
|
+
lines.push(`${prefix}[missing ${item.id}]`);
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
lines.push(
|
|
478
|
+
`${prefix}${node.type}${node.diagnostic ? `:${node.diagnostic}` : ""}${node.operation ? ` at ${node.operation}` : ""}: ${node.message}`
|
|
479
|
+
);
|
|
480
|
+
if (node.details) lines.push(`${prefix}${JSON.stringify(node.details)}`);
|
|
481
|
+
for (const child of [...node.causes].reverse())
|
|
482
|
+
pending.push({ ...child, depth: item.depth + 1 });
|
|
483
|
+
}
|
|
484
|
+
if (!report.complete) lines.push(`Incomplete: ${report.omissions.join("; ")}`);
|
|
485
|
+
const text = lines.join("\n");
|
|
486
|
+
if (Buffer.byteLength(text) <= maxBytes) return text;
|
|
487
|
+
const suffix = `
|
|
488
|
+
[Journal shortened; complete report in diagnostics logs: ${report.errorId}]`;
|
|
489
|
+
return Buffer.from(text).subarray(0, Math.max(0, maxBytes - Buffer.byteLength(suffix) - 3)).toString("utf8").replace(/\uFFFD$/, "") + suffix;
|
|
490
|
+
}
|
|
491
|
+
function encodeReport(report) {
|
|
492
|
+
const direct = JSON.stringify({ event: "diagnostics.report", report });
|
|
493
|
+
if (Buffer.byteLength(direct) <= 4096) return [direct];
|
|
494
|
+
const bytes = Buffer.from(JSON.stringify(report));
|
|
495
|
+
const checksum = createHash("sha256").update(bytes).digest("hex");
|
|
496
|
+
const size = 2e3;
|
|
497
|
+
const correlation = Object.fromEntries(
|
|
498
|
+
["workflowRunId", "requestId", "pipelineRunId"].flatMap(
|
|
499
|
+
(key) => typeof report.context[key] === "string" && /^[A-Za-z0-9_.:-]{1,200}$/.test(String(report.context[key])) ? [[key, String(report.context[key]).slice(0, 200)]] : []
|
|
500
|
+
)
|
|
501
|
+
);
|
|
502
|
+
const total = Math.ceil(bytes.length / size);
|
|
503
|
+
return Array.from(
|
|
504
|
+
{ length: total },
|
|
505
|
+
(_, i) => JSON.stringify({
|
|
506
|
+
event: "diagnostics.chunk",
|
|
507
|
+
errorId: report.errorId,
|
|
508
|
+
part: i + 1,
|
|
509
|
+
total,
|
|
510
|
+
checksum,
|
|
511
|
+
correlation,
|
|
512
|
+
encoding: "base64",
|
|
513
|
+
data: bytes.subarray(i * size, (i + 1) * size).toString("base64")
|
|
514
|
+
})
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// ../diagnostics/src/index.ts
|
|
519
|
+
function makeErrorReporter({
|
|
520
|
+
configuration,
|
|
521
|
+
generateId = randomUUID2,
|
|
522
|
+
now = () => /* @__PURE__ */ new Date(),
|
|
523
|
+
observe,
|
|
524
|
+
write = (severity, line) => severity === "warning" ? console.warn(line) : console.error(line)
|
|
525
|
+
}) {
|
|
526
|
+
function capture(error, context) {
|
|
527
|
+
let report;
|
|
528
|
+
const errorId = context.errorReference ?? `err_${randomUUID2().replaceAll("-", "")}`;
|
|
529
|
+
try {
|
|
530
|
+
report = createFailureReport(error, {
|
|
531
|
+
service: configuration.service,
|
|
532
|
+
context: {
|
|
533
|
+
environment: configuration.environment,
|
|
534
|
+
release: configuration.release,
|
|
535
|
+
region: configuration.region,
|
|
536
|
+
...context
|
|
537
|
+
},
|
|
538
|
+
errorId: context.errorReference ?? `err_${generateId().replaceAll("-", "").toLowerCase()}`,
|
|
539
|
+
timestamp: now().toISOString(),
|
|
540
|
+
redactedValues: configuration.redactedValues
|
|
541
|
+
});
|
|
542
|
+
} catch {
|
|
543
|
+
report = createFailureReport(error, {
|
|
544
|
+
service: configuration.service,
|
|
545
|
+
errorId,
|
|
546
|
+
redactedValues: configuration.redactedValues,
|
|
547
|
+
context: { reportingFailure: true }
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
try {
|
|
551
|
+
const lines = encodeReport(report);
|
|
552
|
+
if (lines.length > 1) {
|
|
553
|
+
let budget = 2e3;
|
|
554
|
+
let summary;
|
|
555
|
+
do {
|
|
556
|
+
summary = JSON.stringify({
|
|
557
|
+
event: "diagnostics.summary",
|
|
558
|
+
errorId: report.errorId,
|
|
559
|
+
tree: renderFailure(report, budget),
|
|
560
|
+
completeReport: "Reconstruct diagnostics.chunk entries by errorId"
|
|
561
|
+
});
|
|
562
|
+
budget = Math.floor(budget / 2);
|
|
563
|
+
} while (Buffer.byteLength(summary) > 4096 && budget > 128);
|
|
564
|
+
if (Buffer.byteLength(summary) <= 4096) write(context.severity ?? "error", summary);
|
|
565
|
+
}
|
|
566
|
+
for (const line of lines) write(context.severity ?? "error", line);
|
|
567
|
+
} catch {
|
|
568
|
+
report.context.reportingFailure = true;
|
|
569
|
+
try {
|
|
570
|
+
for (const line of encodeReport(report)) process.stderr.write(line + "\n");
|
|
571
|
+
} catch {
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
try {
|
|
575
|
+
observe?.(report);
|
|
576
|
+
} catch {
|
|
577
|
+
}
|
|
578
|
+
return report;
|
|
579
|
+
}
|
|
580
|
+
return { capture, report: (error, context) => capture(error, context).errorId };
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// ../diagnostics/src/runtime.js
|
|
584
|
+
function captureRuntimeFailure(error, context, environment = process.env, values = []) {
|
|
585
|
+
const { service, ...details } = context;
|
|
586
|
+
return makeErrorReporter({
|
|
587
|
+
configuration: { service, redactedValues: [...environmentSecrets(environment), ...values] }
|
|
588
|
+
}).capture(error, details);
|
|
589
|
+
}
|
|
590
|
+
export {
|
|
591
|
+
captureRuntimeFailure,
|
|
592
|
+
environmentSecrets,
|
|
593
|
+
makeRedactor
|
|
594
|
+
};
|