@dotdo/postgres 0.1.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/README.md +868 -0
- package/dist/cdc/change-stream.d.ts +44 -0
- package/dist/cdc/change-stream.d.ts.map +1 -0
- package/dist/cdc/change-stream.js +95 -0
- package/dist/cdc/change-stream.js.map +1 -0
- package/dist/cdc/filter.d.ts +58 -0
- package/dist/cdc/filter.d.ts.map +1 -0
- package/dist/cdc/filter.js +520 -0
- package/dist/cdc/filter.js.map +1 -0
- package/dist/cdc/index.d.ts +47 -0
- package/dist/cdc/index.d.ts.map +1 -0
- package/dist/cdc/index.js +50 -0
- package/dist/cdc/index.js.map +1 -0
- package/dist/cdc/resume-token.d.ts +60 -0
- package/dist/cdc/resume-token.d.ts.map +1 -0
- package/dist/cdc/resume-token.js +228 -0
- package/dist/cdc/resume-token.js.map +1 -0
- package/dist/cdc/transport/index.d.ts +7 -0
- package/dist/cdc/transport/index.d.ts.map +1 -0
- package/dist/cdc/transport/index.js +7 -0
- package/dist/cdc/transport/index.js.map +1 -0
- package/dist/cdc/transport/sse.d.ts +120 -0
- package/dist/cdc/transport/sse.d.ts.map +1 -0
- package/dist/cdc/transport/sse.js +590 -0
- package/dist/cdc/transport/sse.js.map +1 -0
- package/dist/cdc/transport/websocket.d.ts +130 -0
- package/dist/cdc/transport/websocket.d.ts.map +1 -0
- package/dist/cdc/transport/websocket.js +688 -0
- package/dist/cdc/transport/websocket.js.map +1 -0
- package/dist/cdc/types.d.ts +306 -0
- package/dist/cdc/types.d.ts.map +1 -0
- package/dist/cdc/types.js +8 -0
- package/dist/cdc/types.js.map +1 -0
- package/dist/config/index.d.ts +25 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +25 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/memory.d.ts +139 -0
- package/dist/config/memory.d.ts.map +1 -0
- package/dist/config/memory.js +157 -0
- package/dist/config/memory.js.map +1 -0
- package/dist/config/storage.d.ts +157 -0
- package/dist/config/storage.d.ts.map +1 -0
- package/dist/config/storage.js +178 -0
- package/dist/config/storage.js.map +1 -0
- package/dist/config/streaming.d.ts +117 -0
- package/dist/config/streaming.d.ts.map +1 -0
- package/dist/config/streaming.js +132 -0
- package/dist/config/streaming.js.map +1 -0
- package/dist/config/timeouts.d.ts +168 -0
- package/dist/config/timeouts.d.ts.map +1 -0
- package/dist/config/timeouts.js +192 -0
- package/dist/config/timeouts.js.map +1 -0
- package/dist/extensions/config.d.ts +89 -0
- package/dist/extensions/config.d.ts.map +1 -0
- package/dist/extensions/config.js +216 -0
- package/dist/extensions/config.js.map +1 -0
- package/dist/extensions/geo.d.ts +452 -0
- package/dist/extensions/geo.d.ts.map +1 -0
- package/dist/extensions/geo.js +583 -0
- package/dist/extensions/geo.js.map +1 -0
- package/dist/extensions/index.d.ts +167 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +99 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/loader.d.ts +226 -0
- package/dist/extensions/loader.d.ts.map +1 -0
- package/dist/extensions/loader.js +456 -0
- package/dist/extensions/loader.js.map +1 -0
- package/dist/extensions/pgmq-lite.d.ts +330 -0
- package/dist/extensions/pgmq-lite.d.ts.map +1 -0
- package/dist/extensions/pgmq-lite.js +648 -0
- package/dist/extensions/pgmq-lite.js.map +1 -0
- package/dist/extensions/plugins.d.ts +260 -0
- package/dist/extensions/plugins.d.ts.map +1 -0
- package/dist/extensions/plugins.js +535 -0
- package/dist/extensions/plugins.js.map +1 -0
- package/dist/extensions/registry.d.ts +93 -0
- package/dist/extensions/registry.d.ts.map +1 -0
- package/dist/extensions/registry.js +182 -0
- package/dist/extensions/registry.js.map +1 -0
- package/dist/extensions/vector.d.ts +106 -0
- package/dist/extensions/vector.d.ts.map +1 -0
- package/dist/extensions/vector.js +129 -0
- package/dist/extensions/vector.js.map +1 -0
- package/dist/iceberg/analytics.d.ts +279 -0
- package/dist/iceberg/analytics.d.ts.map +1 -0
- package/dist/iceberg/analytics.js +448 -0
- package/dist/iceberg/analytics.js.map +1 -0
- package/dist/iceberg/catalog-api.d.ts +39 -0
- package/dist/iceberg/catalog-api.d.ts.map +1 -0
- package/dist/iceberg/catalog-api.js +388 -0
- package/dist/iceberg/catalog-api.js.map +1 -0
- package/dist/iceberg/catalog.d.ts +401 -0
- package/dist/iceberg/catalog.d.ts.map +1 -0
- package/dist/iceberg/catalog.js +677 -0
- package/dist/iceberg/catalog.js.map +1 -0
- package/dist/iceberg/duckdb-wasm.d.ts +447 -0
- package/dist/iceberg/duckdb-wasm.d.ts.map +1 -0
- package/dist/iceberg/duckdb-wasm.js +600 -0
- package/dist/iceberg/duckdb-wasm.js.map +1 -0
- package/dist/iceberg/index.d.ts +92 -0
- package/dist/iceberg/index.d.ts.map +1 -0
- package/dist/iceberg/index.js +119 -0
- package/dist/iceberg/index.js.map +1 -0
- package/dist/iceberg/metadata.d.ts +214 -0
- package/dist/iceberg/metadata.d.ts.map +1 -0
- package/dist/iceberg/metadata.js +535 -0
- package/dist/iceberg/metadata.js.map +1 -0
- package/dist/iceberg/optimizer.d.ts +296 -0
- package/dist/iceberg/optimizer.d.ts.map +1 -0
- package/dist/iceberg/optimizer.js +889 -0
- package/dist/iceberg/optimizer.js.map +1 -0
- package/dist/iceberg/parquet.d.ts +447 -0
- package/dist/iceberg/parquet.d.ts.map +1 -0
- package/dist/iceberg/parquet.js +1225 -0
- package/dist/iceberg/parquet.js.map +1 -0
- package/dist/iceberg/r2-organization.d.ts +422 -0
- package/dist/iceberg/r2-organization.d.ts.map +1 -0
- package/dist/iceberg/r2-organization.js +672 -0
- package/dist/iceberg/r2-organization.js.map +1 -0
- package/dist/iceberg/scheduler-do-example.d.ts +158 -0
- package/dist/iceberg/scheduler-do-example.d.ts.map +1 -0
- package/dist/iceberg/scheduler-do-example.js +261 -0
- package/dist/iceberg/scheduler-do-example.js.map +1 -0
- package/dist/iceberg/scheduler.d.ts +434 -0
- package/dist/iceberg/scheduler.d.ts.map +1 -0
- package/dist/iceberg/scheduler.js +818 -0
- package/dist/iceberg/scheduler.js.map +1 -0
- package/dist/iceberg/schema.d.ts +149 -0
- package/dist/iceberg/schema.d.ts.map +1 -0
- package/dist/iceberg/schema.js +525 -0
- package/dist/iceberg/schema.js.map +1 -0
- package/dist/iceberg/snapshot-manager.d.ts +406 -0
- package/dist/iceberg/snapshot-manager.d.ts.map +1 -0
- package/dist/iceberg/snapshot-manager.js +934 -0
- package/dist/iceberg/snapshot-manager.js.map +1 -0
- package/dist/iceberg/sql-router.d.ts +194 -0
- package/dist/iceberg/sql-router.d.ts.map +1 -0
- package/dist/iceberg/sql-router.js +180 -0
- package/dist/iceberg/sql-router.js.map +1 -0
- package/dist/iceberg/test-fixtures.d.ts +151 -0
- package/dist/iceberg/test-fixtures.d.ts.map +1 -0
- package/dist/iceberg/test-fixtures.js +446 -0
- package/dist/iceberg/test-fixtures.js.map +1 -0
- package/dist/iceberg/time-travel-api.d.ts +102 -0
- package/dist/iceberg/time-travel-api.d.ts.map +1 -0
- package/dist/iceberg/time-travel-api.js +437 -0
- package/dist/iceberg/time-travel-api.js.map +1 -0
- package/dist/iceberg/time-travel.d.ts +293 -0
- package/dist/iceberg/time-travel.d.ts.map +1 -0
- package/dist/iceberg/time-travel.js +689 -0
- package/dist/iceberg/time-travel.js.map +1 -0
- package/dist/iceberg/transformer.d.ts +356 -0
- package/dist/iceberg/transformer.d.ts.map +1 -0
- package/dist/iceberg/transformer.js +770 -0
- package/dist/iceberg/transformer.js.map +1 -0
- package/dist/iceberg/types.d.ts +318 -0
- package/dist/iceberg/types.d.ts.map +1 -0
- package/dist/iceberg/types.js +9 -0
- package/dist/iceberg/types.js.map +1 -0
- package/dist/iceberg/writer.d.ts +144 -0
- package/dist/iceberg/writer.d.ts.map +1 -0
- package/dist/iceberg/writer.js +452 -0
- package/dist/iceberg/writer.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/lineage/index.d.ts +11 -0
- package/dist/lineage/index.d.ts.map +1 -0
- package/dist/lineage/index.js +11 -0
- package/dist/lineage/index.js.map +1 -0
- package/dist/lineage/integration.d.ts +134 -0
- package/dist/lineage/integration.d.ts.map +1 -0
- package/dist/lineage/integration.js +258 -0
- package/dist/lineage/integration.js.map +1 -0
- package/dist/lineage/tracker.d.ts +189 -0
- package/dist/lineage/tracker.d.ts.map +1 -0
- package/dist/lineage/tracker.js +1352 -0
- package/dist/lineage/tracker.js.map +1 -0
- package/dist/lineage/types.d.ts +318 -0
- package/dist/lineage/types.d.ts.map +1 -0
- package/dist/lineage/types.js +9 -0
- package/dist/lineage/types.js.map +1 -0
- package/dist/middleware/index.d.ts +11 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +16 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/rate-limit.d.ts +397 -0
- package/dist/middleware/rate-limit.d.ts.map +1 -0
- package/dist/middleware/rate-limit.js +507 -0
- package/dist/middleware/rate-limit.js.map +1 -0
- package/dist/migration-tooling/external-migration.d.ts +601 -0
- package/dist/migration-tooling/external-migration.d.ts.map +1 -0
- package/dist/migration-tooling/external-migration.js +1612 -0
- package/dist/migration-tooling/external-migration.js.map +1 -0
- package/dist/migration-tooling/index.d.ts +19 -0
- package/dist/migration-tooling/index.d.ts.map +1 -0
- package/dist/migration-tooling/index.js +19 -0
- package/dist/migration-tooling/index.js.map +1 -0
- package/dist/migrations/auto-migrator.d.ts +289 -0
- package/dist/migrations/auto-migrator.d.ts.map +1 -0
- package/dist/migrations/auto-migrator.js +396 -0
- package/dist/migrations/auto-migrator.js.map +1 -0
- package/dist/migrations/bulk-orchestrator.d.ts +403 -0
- package/dist/migrations/bulk-orchestrator.d.ts.map +1 -0
- package/dist/migrations/bulk-orchestrator.js +646 -0
- package/dist/migrations/bulk-orchestrator.js.map +1 -0
- package/dist/migrations/compatibility.d.ts +216 -0
- package/dist/migrations/compatibility.d.ts.map +1 -0
- package/dist/migrations/compatibility.js +651 -0
- package/dist/migrations/compatibility.js.map +1 -0
- package/dist/migrations/do-migrations.d.ts +101 -0
- package/dist/migrations/do-migrations.d.ts.map +1 -0
- package/dist/migrations/do-migrations.js +1060 -0
- package/dist/migrations/do-migrations.js.map +1 -0
- package/dist/migrations/do-migrations.types.d.ts +550 -0
- package/dist/migrations/do-migrations.types.d.ts.map +1 -0
- package/dist/migrations/do-migrations.types.js +15 -0
- package/dist/migrations/do-migrations.types.js.map +1 -0
- package/dist/migrations/drizzle-compat.d.ts +163 -0
- package/dist/migrations/drizzle-compat.d.ts.map +1 -0
- package/dist/migrations/drizzle-compat.js +273 -0
- package/dist/migrations/drizzle-compat.js.map +1 -0
- package/dist/migrations/index.d.ts +109 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +127 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/migration-api.d.ts +161 -0
- package/dist/migrations/migration-api.d.ts.map +1 -0
- package/dist/migrations/migration-api.js +499 -0
- package/dist/migrations/migration-api.js.map +1 -0
- package/dist/migrations/progress-tracker-do.d.ts +195 -0
- package/dist/migrations/progress-tracker-do.d.ts.map +1 -0
- package/dist/migrations/progress-tracker-do.js +339 -0
- package/dist/migrations/progress-tracker-do.js.map +1 -0
- package/dist/migrations/progress-tracker-kv.d.ts +103 -0
- package/dist/migrations/progress-tracker-kv.d.ts.map +1 -0
- package/dist/migrations/progress-tracker-kv.js +231 -0
- package/dist/migrations/progress-tracker-kv.js.map +1 -0
- package/dist/migrations/progress-tracker.d.ts +320 -0
- package/dist/migrations/progress-tracker.d.ts.map +1 -0
- package/dist/migrations/progress-tracker.js +443 -0
- package/dist/migrations/progress-tracker.js.map +1 -0
- package/dist/migrations/registry.d.ts +231 -0
- package/dist/migrations/registry.d.ts.map +1 -0
- package/dist/migrations/registry.js +376 -0
- package/dist/migrations/registry.js.map +1 -0
- package/dist/migrations/runner.d.ts +197 -0
- package/dist/migrations/runner.d.ts.map +1 -0
- package/dist/migrations/runner.js +1167 -0
- package/dist/migrations/runner.js.map +1 -0
- package/dist/migrations/schema-generator.d.ts +111 -0
- package/dist/migrations/schema-generator.d.ts.map +1 -0
- package/dist/migrations/schema-generator.js +335 -0
- package/dist/migrations/schema-generator.js.map +1 -0
- package/dist/migrations/testing.d.ts +321 -0
- package/dist/migrations/testing.d.ts.map +1 -0
- package/dist/migrations/testing.js +645 -0
- package/dist/migrations/testing.js.map +1 -0
- package/dist/migrations/types.d.ts +503 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations/types.js +11 -0
- package/dist/migrations/types.js.map +1 -0
- package/dist/migrations/validator.d.ts +215 -0
- package/dist/migrations/validator.d.ts.map +1 -0
- package/dist/migrations/validator.js +494 -0
- package/dist/migrations/validator.js.map +1 -0
- package/dist/observability/alerting.d.ts +116 -0
- package/dist/observability/alerting.d.ts.map +1 -0
- package/dist/observability/alerting.js +353 -0
- package/dist/observability/alerting.js.map +1 -0
- package/dist/observability/analytics-engine.d.ts +357 -0
- package/dist/observability/analytics-engine.d.ts.map +1 -0
- package/dist/observability/analytics-engine.js +430 -0
- package/dist/observability/analytics-engine.js.map +1 -0
- package/dist/observability/cost-metrics.d.ts +269 -0
- package/dist/observability/cost-metrics.d.ts.map +1 -0
- package/dist/observability/cost-metrics.js +560 -0
- package/dist/observability/cost-metrics.js.map +1 -0
- package/dist/observability/cross-do-tracing.d.ts +305 -0
- package/dist/observability/cross-do-tracing.d.ts.map +1 -0
- package/dist/observability/cross-do-tracing.js +431 -0
- package/dist/observability/cross-do-tracing.js.map +1 -0
- package/dist/observability/error-rate-collector.d.ts +163 -0
- package/dist/observability/error-rate-collector.d.ts.map +1 -0
- package/dist/observability/error-rate-collector.js +306 -0
- package/dist/observability/error-rate-collector.js.map +1 -0
- package/dist/observability/exporters.d.ts +231 -0
- package/dist/observability/exporters.d.ts.map +1 -0
- package/dist/observability/exporters.js +479 -0
- package/dist/observability/exporters.js.map +1 -0
- package/dist/observability/health-check.d.ts +106 -0
- package/dist/observability/health-check.d.ts.map +1 -0
- package/dist/observability/health-check.js +243 -0
- package/dist/observability/health-check.js.map +1 -0
- package/dist/observability/index.d.ts +297 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +455 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/instrumentation.d.ts +222 -0
- package/dist/observability/instrumentation.d.ts.map +1 -0
- package/dist/observability/instrumentation.js +532 -0
- package/dist/observability/instrumentation.js.map +1 -0
- package/dist/observability/memory-metrics.d.ts +227 -0
- package/dist/observability/memory-metrics.d.ts.map +1 -0
- package/dist/observability/memory-metrics.js +688 -0
- package/dist/observability/memory-metrics.js.map +1 -0
- package/dist/observability/metrics-endpoint.d.ts +91 -0
- package/dist/observability/metrics-endpoint.d.ts.map +1 -0
- package/dist/observability/metrics-endpoint.js +246 -0
- package/dist/observability/metrics-endpoint.js.map +1 -0
- package/dist/observability/metrics.d.ts +88 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +253 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/observability/observability-features.d.ts +488 -0
- package/dist/observability/observability-features.d.ts.map +1 -0
- package/dist/observability/observability-features.js +773 -0
- package/dist/observability/observability-features.js.map +1 -0
- package/dist/observability/prometheus.d.ts +39 -0
- package/dist/observability/prometheus.d.ts.map +1 -0
- package/dist/observability/prometheus.js +120 -0
- package/dist/observability/prometheus.js.map +1 -0
- package/dist/observability/propagation.d.ts +126 -0
- package/dist/observability/propagation.d.ts.map +1 -0
- package/dist/observability/propagation.js +234 -0
- package/dist/observability/propagation.js.map +1 -0
- package/dist/observability/query-latency.d.ts +243 -0
- package/dist/observability/query-latency.d.ts.map +1 -0
- package/dist/observability/query-latency.js +292 -0
- package/dist/observability/query-latency.js.map +1 -0
- package/dist/observability/query-performance.d.ts +169 -0
- package/dist/observability/query-performance.d.ts.map +1 -0
- package/dist/observability/query-performance.js +290 -0
- package/dist/observability/query-performance.js.map +1 -0
- package/dist/observability/storage-tier-metrics.d.ts +174 -0
- package/dist/observability/storage-tier-metrics.d.ts.map +1 -0
- package/dist/observability/storage-tier-metrics.js +306 -0
- package/dist/observability/storage-tier-metrics.js.map +1 -0
- package/dist/observability/tier-cost-optimizer.d.ts +155 -0
- package/dist/observability/tier-cost-optimizer.d.ts.map +1 -0
- package/dist/observability/tier-cost-optimizer.js +536 -0
- package/dist/observability/tier-cost-optimizer.js.map +1 -0
- package/dist/observability/tracer.d.ts +149 -0
- package/dist/observability/tracer.d.ts.map +1 -0
- package/dist/observability/tracer.js +435 -0
- package/dist/observability/tracer.js.map +1 -0
- package/dist/observability/types.d.ts +402 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js +103 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/pglite/workers-pglite.d.ts +138 -0
- package/dist/pglite/workers-pglite.d.ts.map +1 -0
- package/dist/pglite/workers-pglite.js +143 -0
- package/dist/pglite/workers-pglite.js.map +1 -0
- package/dist/pglite-assets/pglite.data +0 -0
- package/dist/pglite-assets/pglite.wasm +0 -0
- package/dist/playground/index.d.ts +52 -0
- package/dist/playground/index.d.ts.map +1 -0
- package/dist/playground/index.js +55 -0
- package/dist/playground/index.js.map +1 -0
- package/dist/playground/keyboard-shortcuts.d.ts +116 -0
- package/dist/playground/keyboard-shortcuts.d.ts.map +1 -0
- package/dist/playground/keyboard-shortcuts.js +588 -0
- package/dist/playground/keyboard-shortcuts.js.map +1 -0
- package/dist/playground/playground.d.ts +82 -0
- package/dist/playground/playground.d.ts.map +1 -0
- package/dist/playground/playground.js +271 -0
- package/dist/playground/playground.js.map +1 -0
- package/dist/playground/query-executor.d.ts +115 -0
- package/dist/playground/query-executor.d.ts.map +1 -0
- package/dist/playground/query-executor.js +558 -0
- package/dist/playground/query-executor.js.map +1 -0
- package/dist/playground/query-history.d.ts +92 -0
- package/dist/playground/query-history.d.ts.map +1 -0
- package/dist/playground/query-history.js +259 -0
- package/dist/playground/query-history.js.map +1 -0
- package/dist/playground/result-formatter.d.ts +59 -0
- package/dist/playground/result-formatter.d.ts.map +1 -0
- package/dist/playground/result-formatter.js +341 -0
- package/dist/playground/result-formatter.js.map +1 -0
- package/dist/playground/sample-datasets.d.ts +77 -0
- package/dist/playground/sample-datasets.d.ts.map +1 -0
- package/dist/playground/sample-datasets.js +641 -0
- package/dist/playground/sample-datasets.js.map +1 -0
- package/dist/playground/sample-queries.d.ts +73 -0
- package/dist/playground/sample-queries.d.ts.map +1 -0
- package/dist/playground/sample-queries.js +1095 -0
- package/dist/playground/sample-queries.js.map +1 -0
- package/dist/playground/schema-explorer.d.ts +55 -0
- package/dist/playground/schema-explorer.d.ts.map +1 -0
- package/dist/playground/schema-explorer.js +473 -0
- package/dist/playground/schema-explorer.js.map +1 -0
- package/dist/playground/types.d.ts +430 -0
- package/dist/playground/types.d.ts.map +1 -0
- package/dist/playground/types.js +10 -0
- package/dist/playground/types.js.map +1 -0
- package/dist/readonly/cache-reader.d.ts +145 -0
- package/dist/readonly/cache-reader.d.ts.map +1 -0
- package/dist/readonly/cache-reader.js +198 -0
- package/dist/readonly/cache-reader.js.map +1 -0
- package/dist/readonly/config.d.ts +74 -0
- package/dist/readonly/config.d.ts.map +1 -0
- package/dist/readonly/config.js +67 -0
- package/dist/readonly/config.js.map +1 -0
- package/dist/readonly/index.d.ts +22 -0
- package/dist/readonly/index.d.ts.map +1 -0
- package/dist/readonly/index.js +17 -0
- package/dist/readonly/index.js.map +1 -0
- package/dist/readonly/pglite-wrapper.d.ts +82 -0
- package/dist/readonly/pglite-wrapper.d.ts.map +1 -0
- package/dist/readonly/pglite-wrapper.js +123 -0
- package/dist/readonly/pglite-wrapper.js.map +1 -0
- package/dist/readonly/worker.d.ts +142 -0
- package/dist/readonly/worker.d.ts.map +1 -0
- package/dist/readonly/worker.js +187 -0
- package/dist/readonly/worker.js.map +1 -0
- package/dist/readonly/write-blocker.d.ts +47 -0
- package/dist/readonly/write-blocker.d.ts.map +1 -0
- package/dist/readonly/write-blocker.js +136 -0
- package/dist/readonly/write-blocker.js.map +1 -0
- package/dist/recovery/disaster-recovery.d.ts +326 -0
- package/dist/recovery/disaster-recovery.d.ts.map +1 -0
- package/dist/recovery/disaster-recovery.js +799 -0
- package/dist/recovery/disaster-recovery.js.map +1 -0
- package/dist/recovery/index.d.ts +12 -0
- package/dist/recovery/index.d.ts.map +1 -0
- package/dist/recovery/index.js +12 -0
- package/dist/recovery/index.js.map +1 -0
- package/dist/recovery/parquet-parser.d.ts +321 -0
- package/dist/recovery/parquet-parser.d.ts.map +1 -0
- package/dist/recovery/parquet-parser.js +797 -0
- package/dist/recovery/parquet-parser.js.map +1 -0
- package/dist/retention/index.d.ts +50 -0
- package/dist/retention/index.d.ts.map +1 -0
- package/dist/retention/index.js +50 -0
- package/dist/retention/index.js.map +1 -0
- package/dist/retention/policy.d.ts +344 -0
- package/dist/retention/policy.d.ts.map +1 -0
- package/dist/retention/policy.js +472 -0
- package/dist/retention/policy.js.map +1 -0
- package/dist/retention/purger.d.ts +187 -0
- package/dist/retention/purger.d.ts.map +1 -0
- package/dist/retention/purger.js +411 -0
- package/dist/retention/purger.js.map +1 -0
- package/dist/rls/auth-integration.d.ts +280 -0
- package/dist/rls/auth-integration.d.ts.map +1 -0
- package/dist/rls/auth-integration.js +399 -0
- package/dist/rls/auth-integration.js.map +1 -0
- package/dist/rls/generator.d.ts +249 -0
- package/dist/rls/generator.d.ts.map +1 -0
- package/dist/rls/generator.js +495 -0
- package/dist/rls/generator.js.map +1 -0
- package/dist/rls/index.d.ts +26 -0
- package/dist/rls/index.d.ts.map +1 -0
- package/dist/rls/index.js +58 -0
- package/dist/rls/index.js.map +1 -0
- package/dist/rls/policy.d.ts +116 -0
- package/dist/rls/policy.d.ts.map +1 -0
- package/dist/rls/policy.js +77 -0
- package/dist/rls/policy.js.map +1 -0
- package/dist/rls/validator.d.ts +155 -0
- package/dist/rls/validator.d.ts.map +1 -0
- package/dist/rls/validator.js +792 -0
- package/dist/rls/validator.js.map +1 -0
- package/dist/routing/adaptive-router.d.ts +317 -0
- package/dist/routing/adaptive-router.d.ts.map +1 -0
- package/dist/routing/adaptive-router.js +554 -0
- package/dist/routing/adaptive-router.js.map +1 -0
- package/dist/routing/circuit-breaker.d.ts +339 -0
- package/dist/routing/circuit-breaker.d.ts.map +1 -0
- package/dist/routing/circuit-breaker.js +620 -0
- package/dist/routing/circuit-breaker.js.map +1 -0
- package/dist/routing/cost-metrics.d.ts +133 -0
- package/dist/routing/cost-metrics.d.ts.map +1 -0
- package/dist/routing/cost-metrics.js +259 -0
- package/dist/routing/cost-metrics.js.map +1 -0
- package/dist/routing/do-connection-pool.d.ts +243 -0
- package/dist/routing/do-connection-pool.d.ts.map +1 -0
- package/dist/routing/do-connection-pool.js +572 -0
- package/dist/routing/do-connection-pool.js.map +1 -0
- package/dist/routing/index.d.ts +59 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +59 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/query-complexity-estimator.d.ts +73 -0
- package/dist/routing/query-complexity-estimator.d.ts.map +1 -0
- package/dist/routing/query-complexity-estimator.js +327 -0
- package/dist/routing/query-complexity-estimator.js.map +1 -0
- package/dist/routing/request-coalescing.d.ts +178 -0
- package/dist/routing/request-coalescing.d.ts.map +1 -0
- package/dist/routing/request-coalescing.js +325 -0
- package/dist/routing/request-coalescing.js.map +1 -0
- package/dist/routing/runtime-router.d.ts +107 -0
- package/dist/routing/runtime-router.d.ts.map +1 -0
- package/dist/routing/runtime-router.js +246 -0
- package/dist/routing/runtime-router.js.map +1 -0
- package/dist/routing/tenant-router.d.ts +848 -0
- package/dist/routing/tenant-router.d.ts.map +1 -0
- package/dist/routing/tenant-router.js +1056 -0
- package/dist/routing/tenant-router.js.map +1 -0
- package/dist/routing/websocket-pool.d.ts +119 -0
- package/dist/routing/websocket-pool.d.ts.map +1 -0
- package/dist/routing/websocket-pool.js +436 -0
- package/dist/routing/websocket-pool.js.map +1 -0
- package/dist/storage/cache-layer.d.ts +159 -0
- package/dist/storage/cache-layer.d.ts.map +1 -0
- package/dist/storage/cache-layer.js +245 -0
- package/dist/storage/cache-layer.js.map +1 -0
- package/dist/storage/cost-aware-tiering.d.ts +258 -0
- package/dist/storage/cost-aware-tiering.d.ts.map +1 -0
- package/dist/storage/cost-aware-tiering.js +526 -0
- package/dist/storage/cost-aware-tiering.js.map +1 -0
- package/dist/storage/index.d.ts +87 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +78 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/interfaces.d.ts +856 -0
- package/dist/storage/interfaces.d.ts.map +1 -0
- package/dist/storage/interfaces.js +69 -0
- package/dist/storage/interfaces.js.map +1 -0
- package/dist/storage/r2-layer.d.ts +226 -0
- package/dist/storage/r2-layer.d.ts.map +1 -0
- package/dist/storage/r2-layer.js +307 -0
- package/dist/storage/r2-layer.js.map +1 -0
- package/dist/storage/r2-overflow.d.ts +344 -0
- package/dist/storage/r2-overflow.d.ts.map +1 -0
- package/dist/storage/r2-overflow.js +730 -0
- package/dist/storage/r2-overflow.js.map +1 -0
- package/dist/storage/r2-page-vfs.d.ts +374 -0
- package/dist/storage/r2-page-vfs.d.ts.map +1 -0
- package/dist/storage/r2-page-vfs.js +754 -0
- package/dist/storage/r2-page-vfs.js.map +1 -0
- package/dist/storage/swr-cache.d.ts +181 -0
- package/dist/storage/swr-cache.d.ts.map +1 -0
- package/dist/storage/swr-cache.js +295 -0
- package/dist/storage/swr-cache.js.map +1 -0
- package/dist/storage/tiered-orchestrator.d.ts +951 -0
- package/dist/storage/tiered-orchestrator.d.ts.map +1 -0
- package/dist/storage/tiered-orchestrator.js +1731 -0
- package/dist/storage/tiered-orchestrator.js.map +1 -0
- package/dist/storage/tiered-vfs-swr.d.ts +279 -0
- package/dist/storage/tiered-vfs-swr.d.ts.map +1 -0
- package/dist/storage/tiered-vfs-swr.js +584 -0
- package/dist/storage/tiered-vfs-swr.js.map +1 -0
- package/dist/storage/tiered-vfs.d.ts +405 -0
- package/dist/storage/tiered-vfs.d.ts.map +1 -0
- package/dist/storage/tiered-vfs.js +833 -0
- package/dist/storage/tiered-vfs.js.map +1 -0
- package/dist/streaming/backpressure-controller.d.ts +173 -0
- package/dist/streaming/backpressure-controller.d.ts.map +1 -0
- package/dist/streaming/backpressure-controller.js +344 -0
- package/dist/streaming/backpressure-controller.js.map +1 -0
- package/dist/streaming/buffer-pool.d.ts +241 -0
- package/dist/streaming/buffer-pool.d.ts.map +1 -0
- package/dist/streaming/buffer-pool.js +381 -0
- package/dist/streaming/buffer-pool.js.map +1 -0
- package/dist/streaming/cdc-iceberg-connector.d.ts +272 -0
- package/dist/streaming/cdc-iceberg-connector.d.ts.map +1 -0
- package/dist/streaming/cdc-iceberg-connector.js +408 -0
- package/dist/streaming/cdc-iceberg-connector.js.map +1 -0
- package/dist/streaming/index.d.ts +111 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +128 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/live-cdc-stream.d.ts +400 -0
- package/dist/streaming/live-cdc-stream.d.ts.map +1 -0
- package/dist/streaming/live-cdc-stream.js +703 -0
- package/dist/streaming/live-cdc-stream.js.map +1 -0
- package/dist/streaming/memory-bounded-stream.d.ts +207 -0
- package/dist/streaming/memory-bounded-stream.d.ts.map +1 -0
- package/dist/streaming/memory-bounded-stream.js +340 -0
- package/dist/streaming/memory-bounded-stream.js.map +1 -0
- package/dist/streaming/query-streamer.d.ts +379 -0
- package/dist/streaming/query-streamer.d.ts.map +1 -0
- package/dist/streaming/query-streamer.js +495 -0
- package/dist/streaming/query-streamer.js.map +1 -0
- package/dist/streaming/response-streaming.d.ts +203 -0
- package/dist/streaming/response-streaming.d.ts.map +1 -0
- package/dist/streaming/response-streaming.js +449 -0
- package/dist/streaming/response-streaming.js.map +1 -0
- package/dist/types/branded.d.ts +859 -0
- package/dist/types/branded.d.ts.map +1 -0
- package/dist/types/branded.js +891 -0
- package/dist/types/branded.js.map +1 -0
- package/dist/types/utilities.d.ts +757 -0
- package/dist/types/utilities.d.ts.map +1 -0
- package/dist/types/utilities.js +447 -0
- package/dist/types/utilities.js.map +1 -0
- package/dist/wal/replay-engine.d.ts +344 -0
- package/dist/wal/replay-engine.d.ts.map +1 -0
- package/dist/wal/replay-engine.js +975 -0
- package/dist/wal/replay-engine.js.map +1 -0
- package/dist/worker/__mocks__/capnweb.d.ts +13 -0
- package/dist/worker/__mocks__/capnweb.d.ts.map +1 -0
- package/dist/worker/__mocks__/capnweb.js +15 -0
- package/dist/worker/__mocks__/capnweb.js.map +1 -0
- package/dist/worker/__mocks__/cloudflare-workers.d.ts +31 -0
- package/dist/worker/__mocks__/cloudflare-workers.d.ts.map +1 -0
- package/dist/worker/__mocks__/cloudflare-workers.js +33 -0
- package/dist/worker/__mocks__/cloudflare-workers.js.map +1 -0
- package/dist/worker/__mocks__/pglite.data.d.ts +3 -0
- package/dist/worker/__mocks__/pglite.data.d.ts.map +1 -0
- package/dist/worker/__mocks__/pglite.data.js +20 -0
- package/dist/worker/__mocks__/pglite.data.js.map +1 -0
- package/dist/worker/__mocks__/pglite.wasm.d.ts +3 -0
- package/dist/worker/__mocks__/pglite.wasm.d.ts.map +1 -0
- package/dist/worker/__mocks__/pglite.wasm.js +30 -0
- package/dist/worker/__mocks__/pglite.wasm.js.map +1 -0
- package/dist/worker/auth-rate-limiter.d.ts +270 -0
- package/dist/worker/auth-rate-limiter.d.ts.map +1 -0
- package/dist/worker/auth-rate-limiter.js +332 -0
- package/dist/worker/auth-rate-limiter.js.map +1 -0
- package/dist/worker/auth.d.ts +345 -0
- package/dist/worker/auth.d.ts.map +1 -0
- package/dist/worker/auth.js +837 -0
- package/dist/worker/auth.js.map +1 -0
- package/dist/worker/cdc-backpressure.d.ts +338 -0
- package/dist/worker/cdc-backpressure.d.ts.map +1 -0
- package/dist/worker/cdc-backpressure.js +619 -0
- package/dist/worker/cdc-backpressure.js.map +1 -0
- package/dist/worker/cdc-sse.d.ts +277 -0
- package/dist/worker/cdc-sse.d.ts.map +1 -0
- package/dist/worker/cdc-sse.js +528 -0
- package/dist/worker/cdc-sse.js.map +1 -0
- package/dist/worker/cdc-websocket.d.ts +252 -0
- package/dist/worker/cdc-websocket.d.ts.map +1 -0
- package/dist/worker/cdc-websocket.js +940 -0
- package/dist/worker/cdc-websocket.js.map +1 -0
- package/dist/worker/cdc.d.ts +95 -0
- package/dist/worker/cdc.d.ts.map +1 -0
- package/dist/worker/cdc.js +211 -0
- package/dist/worker/cdc.js.map +1 -0
- package/dist/worker/concerns/auth-concern.d.ts +50 -0
- package/dist/worker/concerns/auth-concern.d.ts.map +1 -0
- package/dist/worker/concerns/auth-concern.js +131 -0
- package/dist/worker/concerns/auth-concern.js.map +1 -0
- package/dist/worker/concerns/cdc-concern.d.ts +99 -0
- package/dist/worker/concerns/cdc-concern.d.ts.map +1 -0
- package/dist/worker/concerns/cdc-concern.js +137 -0
- package/dist/worker/concerns/cdc-concern.js.map +1 -0
- package/dist/worker/concerns/index.d.ts +22 -0
- package/dist/worker/concerns/index.d.ts.map +1 -0
- package/dist/worker/concerns/index.js +13 -0
- package/dist/worker/concerns/index.js.map +1 -0
- package/dist/worker/concerns/query-execution-concern.d.ts +104 -0
- package/dist/worker/concerns/query-execution-concern.d.ts.map +1 -0
- package/dist/worker/concerns/query-execution-concern.js +95 -0
- package/dist/worker/concerns/query-execution-concern.js.map +1 -0
- package/dist/worker/concerns/storage-orchestration-concern.d.ts +78 -0
- package/dist/worker/concerns/storage-orchestration-concern.d.ts.map +1 -0
- package/dist/worker/concerns/storage-orchestration-concern.js +240 -0
- package/dist/worker/concerns/storage-orchestration-concern.js.map +1 -0
- package/dist/worker/do-auth-manager.d.ts +108 -0
- package/dist/worker/do-auth-manager.d.ts.map +1 -0
- package/dist/worker/do-auth-manager.js +212 -0
- package/dist/worker/do-auth-manager.js.map +1 -0
- package/dist/worker/do-pglite-manager.d.ts +137 -0
- package/dist/worker/do-pglite-manager.d.ts.map +1 -0
- package/dist/worker/do-pglite-manager.js +228 -0
- package/dist/worker/do-pglite-manager.js.map +1 -0
- package/dist/worker/do.d.ts +556 -0
- package/dist/worker/do.d.ts.map +1 -0
- package/dist/worker/do.js +1441 -0
- package/dist/worker/do.js.map +1 -0
- package/dist/worker/entry.d.ts +23 -0
- package/dist/worker/entry.d.ts.map +1 -0
- package/dist/worker/entry.js +362 -0
- package/dist/worker/entry.js.map +1 -0
- package/dist/worker/errors.d.ts +106 -0
- package/dist/worker/errors.d.ts.map +1 -0
- package/dist/worker/errors.js +178 -0
- package/dist/worker/errors.js.map +1 -0
- package/dist/worker/health-check-manager.d.ts +141 -0
- package/dist/worker/health-check-manager.d.ts.map +1 -0
- package/dist/worker/health-check-manager.js +145 -0
- package/dist/worker/health-check-manager.js.map +1 -0
- package/dist/worker/index.d.ts +60 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +67 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/memory-pressure.d.ts +892 -0
- package/dist/worker/memory-pressure.d.ts.map +1 -0
- package/dist/worker/memory-pressure.js +1990 -0
- package/dist/worker/memory-pressure.js.map +1 -0
- package/dist/worker/migration-manager.d.ts +153 -0
- package/dist/worker/migration-manager.d.ts.map +1 -0
- package/dist/worker/migration-manager.js +461 -0
- package/dist/worker/migration-manager.js.map +1 -0
- package/dist/worker/plugin-manager.d.ts +147 -0
- package/dist/worker/plugin-manager.d.ts.map +1 -0
- package/dist/worker/plugin-manager.js +408 -0
- package/dist/worker/plugin-manager.js.map +1 -0
- package/dist/worker/proxy.d.ts +330 -0
- package/dist/worker/proxy.d.ts.map +1 -0
- package/dist/worker/proxy.js +504 -0
- package/dist/worker/proxy.js.map +1 -0
- package/dist/worker/query-execution-manager.d.ts +107 -0
- package/dist/worker/query-execution-manager.d.ts.map +1 -0
- package/dist/worker/query-execution-manager.js +155 -0
- package/dist/worker/query-execution-manager.js.map +1 -0
- package/dist/worker/query-executor.d.ts +163 -0
- package/dist/worker/query-executor.d.ts.map +1 -0
- package/dist/worker/query-executor.js +413 -0
- package/dist/worker/query-executor.js.map +1 -0
- package/dist/worker/query-stats-manager.d.ts +117 -0
- package/dist/worker/query-stats-manager.d.ts.map +1 -0
- package/dist/worker/query-stats-manager.js +162 -0
- package/dist/worker/query-stats-manager.js.map +1 -0
- package/dist/worker/result-handler.d.ts +192 -0
- package/dist/worker/result-handler.d.ts.map +1 -0
- package/dist/worker/result-handler.js +346 -0
- package/dist/worker/result-handler.js.map +1 -0
- package/dist/worker/routes.d.ts +135 -0
- package/dist/worker/routes.d.ts.map +1 -0
- package/dist/worker/routes.js +460 -0
- package/dist/worker/routes.js.map +1 -0
- package/dist/worker/rpc-methods-manager.d.ts +142 -0
- package/dist/worker/rpc-methods-manager.d.ts.map +1 -0
- package/dist/worker/rpc-methods-manager.js +195 -0
- package/dist/worker/rpc-methods-manager.js.map +1 -0
- package/dist/worker/rpc.d.ts +259 -0
- package/dist/worker/rpc.d.ts.map +1 -0
- package/dist/worker/rpc.js +398 -0
- package/dist/worker/rpc.js.map +1 -0
- package/dist/worker/schema-version.d.ts +209 -0
- package/dist/worker/schema-version.d.ts.map +1 -0
- package/dist/worker/schema-version.js +450 -0
- package/dist/worker/schema-version.js.map +1 -0
- package/dist/worker/session-manager.d.ts +282 -0
- package/dist/worker/session-manager.d.ts.map +1 -0
- package/dist/worker/session-manager.js +523 -0
- package/dist/worker/session-manager.js.map +1 -0
- package/dist/worker/shutdown-manager.d.ts +188 -0
- package/dist/worker/shutdown-manager.d.ts.map +1 -0
- package/dist/worker/shutdown-manager.js +347 -0
- package/dist/worker/shutdown-manager.js.map +1 -0
- package/dist/worker/sql-transform.d.ts +61 -0
- package/dist/worker/sql-transform.d.ts.map +1 -0
- package/dist/worker/sql-transform.js +312 -0
- package/dist/worker/sql-transform.js.map +1 -0
- package/dist/worker/types.d.ts +738 -0
- package/dist/worker/types.d.ts.map +1 -0
- package/dist/worker/types.js +6 -0
- package/dist/worker/types.js.map +1 -0
- package/dist/worker/user-routes.d.ts +76 -0
- package/dist/worker/user-routes.d.ts.map +1 -0
- package/dist/worker/user-routes.js +188 -0
- package/dist/worker/user-routes.js.map +1 -0
- package/dist/worker/wal-facade.d.ts +138 -0
- package/dist/worker/wal-facade.d.ts.map +1 -0
- package/dist/worker/wal-facade.js +184 -0
- package/dist/worker/wal-facade.js.map +1 -0
- package/dist/worker/wal-r2.d.ts +271 -0
- package/dist/worker/wal-r2.d.ts.map +1 -0
- package/dist/worker/wal-r2.js +689 -0
- package/dist/worker/wal-r2.js.map +1 -0
- package/dist/worker/wal-replay.d.ts +361 -0
- package/dist/worker/wal-replay.d.ts.map +1 -0
- package/dist/worker/wal-replay.js +628 -0
- package/dist/worker/wal-replay.js.map +1 -0
- package/dist/worker/wal-retention.d.ts +389 -0
- package/dist/worker/wal-retention.d.ts.map +1 -0
- package/dist/worker/wal-retention.js +763 -0
- package/dist/worker/wal-retention.js.map +1 -0
- package/dist/worker/wal.d.ts +278 -0
- package/dist/worker/wal.d.ts.map +1 -0
- package/dist/worker/wal.js +467 -0
- package/dist/worker/wal.js.map +1 -0
- package/dist/worker/websocket.d.ts +85 -0
- package/dist/worker/websocket.d.ts.map +1 -0
- package/dist/worker/websocket.js +227 -0
- package/dist/worker/websocket.js.map +1 -0
- package/package.json +108 -0
- package/src/cdc/change-stream.ts +137 -0
- package/src/cdc/filter.ts +646 -0
- package/src/cdc/index.ts +112 -0
- package/src/cdc/resume-token.ts +280 -0
- package/src/cdc/transport/index.ts +7 -0
- package/src/cdc/transport/sse.ts +723 -0
- package/src/cdc/transport/websocket.ts +873 -0
- package/src/cdc/types.ts +346 -0
- package/src/config/index.ts +25 -0
- package/src/config/memory.ts +177 -0
- package/src/config/storage.ts +204 -0
- package/src/config/streaming.ts +147 -0
- package/src/config/timeouts.ts +221 -0
- package/src/extensions/config.test.ts +187 -0
- package/src/extensions/config.ts +278 -0
- package/src/extensions/geo.test.ts +455 -0
- package/src/extensions/geo.ts +858 -0
- package/src/extensions/index.test.ts +259 -0
- package/src/extensions/index.ts +227 -0
- package/src/extensions/loader.test.ts +555 -0
- package/src/extensions/loader.ts +588 -0
- package/src/extensions/pgmq-lite.test.ts +727 -0
- package/src/extensions/pgmq-lite.ts +770 -0
- package/src/extensions/plugins.test.ts +528 -0
- package/src/extensions/plugins.ts +718 -0
- package/src/extensions/registry.test.ts +202 -0
- package/src/extensions/registry.ts +267 -0
- package/src/extensions/vector.test.ts +195 -0
- package/src/extensions/vector.ts +217 -0
- package/src/iceberg/SCHEDULER.md +580 -0
- package/src/iceberg/analytics.test.ts +703 -0
- package/src/iceberg/analytics.ts +727 -0
- package/src/iceberg/catalog-api.test.ts +838 -0
- package/src/iceberg/catalog-api.ts +520 -0
- package/src/iceberg/catalog.test.ts +680 -0
- package/src/iceberg/catalog.ts +1007 -0
- package/src/iceberg/iceberg.test.ts +705 -0
- package/src/iceberg/index.ts +406 -0
- package/src/iceberg/metadata.test.ts +632 -0
- package/src/iceberg/metadata.ts +649 -0
- package/src/iceberg/optimizer.test.ts +868 -0
- package/src/iceberg/optimizer.ts +1287 -0
- package/src/iceberg/parquet.test.ts +899 -0
- package/src/iceberg/parquet.ts +1640 -0
- package/src/iceberg/r2-organization.test.ts +615 -0
- package/src/iceberg/r2-organization.ts +951 -0
- package/src/iceberg/scheduler-do-example.ts +364 -0
- package/src/iceberg/scheduler.test.ts +861 -0
- package/src/iceberg/scheduler.ts +1201 -0
- package/src/iceberg/schema.test.ts +547 -0
- package/src/iceberg/schema.ts +616 -0
- package/src/iceberg/snapshot-manager.test.ts +919 -0
- package/src/iceberg/snapshot-manager.ts +1369 -0
- package/src/iceberg/sql-router.test.ts +334 -0
- package/src/iceberg/sql-router.ts +337 -0
- package/src/iceberg/test-fixtures.ts +605 -0
- package/src/iceberg/time-travel-api.test.ts +1029 -0
- package/src/iceberg/time-travel-api.ts +731 -0
- package/src/iceberg/time-travel.test.ts +1218 -0
- package/src/iceberg/time-travel.ts +1052 -0
- package/src/iceberg/transformer.test.ts +689 -0
- package/src/iceberg/transformer.ts +1029 -0
- package/src/iceberg/types.ts +373 -0
- package/src/iceberg/writer.test.ts +716 -0
- package/src/iceberg/writer.ts +590 -0
- package/src/index.ts +212 -0
- package/src/lineage/index.ts +42 -0
- package/src/lineage/integration.ts +334 -0
- package/src/lineage/tracker.ts +1618 -0
- package/src/lineage/types.ts +354 -0
- package/src/middleware/index.ts +36 -0
- package/src/middleware/rate-limit-concurrent.test.ts +794 -0
- package/src/middleware/rate-limit.test.ts +1568 -0
- package/src/middleware/rate-limit.ts +840 -0
- package/src/migration-tooling/external-migration.test.ts +1864 -0
- package/src/migration-tooling/external-migration.ts +2355 -0
- package/src/migration-tooling/index.ts +19 -0
- package/src/migrations/ARCHITECTURE.md +474 -0
- package/src/migrations/PROGRESS_TRACKING.md +485 -0
- package/src/migrations/auto-migrator.test.ts +732 -0
- package/src/migrations/auto-migrator.ts +531 -0
- package/src/migrations/bulk-orchestrator.test.ts +801 -0
- package/src/migrations/bulk-orchestrator.ts +1039 -0
- package/src/migrations/compatibility.test.ts +958 -0
- package/src/migrations/compatibility.ts +902 -0
- package/src/migrations/do-migrations.test.ts +2620 -0
- package/src/migrations/do-migrations.ts +1289 -0
- package/src/migrations/do-migrations.types.ts +715 -0
- package/src/migrations/drizzle-compat.test.ts +210 -0
- package/src/migrations/drizzle-compat.ts +337 -0
- package/src/migrations/index.ts +334 -0
- package/src/migrations/migration-api.test.ts +438 -0
- package/src/migrations/migration-api.ts +704 -0
- package/src/migrations/progress-tracker-do.ts +518 -0
- package/src/migrations/progress-tracker-kv.ts +305 -0
- package/src/migrations/progress-tracker.test.ts +937 -0
- package/src/migrations/progress-tracker.ts +665 -0
- package/src/migrations/registry.test.ts +331 -0
- package/src/migrations/registry.ts +468 -0
- package/src/migrations/rollback.test.ts +644 -0
- package/src/migrations/runner.test.ts +807 -0
- package/src/migrations/runner.test.ts.backup +759 -0
- package/src/migrations/runner.ts +1459 -0
- package/src/migrations/schema-generator.test.ts +649 -0
- package/src/migrations/schema-generator.ts +513 -0
- package/src/migrations/testing.ts +1037 -0
- package/src/migrations/types.ts +573 -0
- package/src/migrations/validator.test.ts +660 -0
- package/src/migrations/validator.ts +741 -0
- package/src/observability/alerting.test.ts +1133 -0
- package/src/observability/alerting.ts +455 -0
- package/src/observability/analytics-engine.ts +733 -0
- package/src/observability/cost-metrics.ts +804 -0
- package/src/observability/cross-do-tracing.test.ts +516 -0
- package/src/observability/cross-do-tracing.ts +588 -0
- package/src/observability/dashboards/postgres-do-overview.json +1656 -0
- package/src/observability/error-rate-collector.test.ts +977 -0
- package/src/observability/error-rate-collector.ts +518 -0
- package/src/observability/exporters.test.ts +365 -0
- package/src/observability/exporters.ts +650 -0
- package/src/observability/health-check.test.ts +353 -0
- package/src/observability/health-check.ts +341 -0
- package/src/observability/index.test.ts +298 -0
- package/src/observability/index.ts +885 -0
- package/src/observability/instrumentation.test.ts +428 -0
- package/src/observability/instrumentation.ts +788 -0
- package/src/observability/memory-metrics.test.ts +355 -0
- package/src/observability/memory-metrics.ts +990 -0
- package/src/observability/metrics-endpoint.test.ts +402 -0
- package/src/observability/metrics-endpoint.ts +374 -0
- package/src/observability/metrics.test.ts +291 -0
- package/src/observability/metrics.ts +315 -0
- package/src/observability/observability-features.ts +1296 -0
- package/src/observability/prometheus.test.ts +292 -0
- package/src/observability/prometheus.ts +170 -0
- package/src/observability/propagation.test.ts +417 -0
- package/src/observability/propagation.ts +294 -0
- package/src/observability/query-latency.ts +586 -0
- package/src/observability/query-performance.test.ts +406 -0
- package/src/observability/query-performance.ts +491 -0
- package/src/observability/storage-tier-metrics.test.ts +633 -0
- package/src/observability/storage-tier-metrics.ts +570 -0
- package/src/observability/tier-cost-optimizer.ts +740 -0
- package/src/observability/tracer.test.ts +346 -0
- package/src/observability/tracer.ts +585 -0
- package/src/observability/types.test.ts +726 -0
- package/src/observability/types.ts +434 -0
- package/src/pglite/auto-demotion.test.ts +477 -0
- package/src/pglite/auto-demotion.ts +385 -0
- package/src/pglite/auto-promotion.test.ts +824 -0
- package/src/pglite/auto-promotion.ts +547 -0
- package/src/pglite/cache-layer.test.ts +469 -0
- package/src/pglite/cache-layer.ts +271 -0
- package/src/pglite/cold-start-manager.ts +1260 -0
- package/src/pglite/cold-start-optimizer.test.ts +937 -0
- package/src/pglite/cold-start-optimizer.ts +1895 -0
- package/src/pglite/dovfs-adapter.ts +1122 -0
- package/src/pglite/dovfs.ts +1258 -0
- package/src/pglite/etag-cache.test.ts +844 -0
- package/src/pglite/etag-cache.ts +526 -0
- package/src/pglite/index.ts +442 -0
- package/src/pglite/init.test.ts +455 -0
- package/src/pglite/init.ts +574 -0
- package/src/pglite/lifecycle.test.ts +599 -0
- package/src/pglite/lifecycle.ts +704 -0
- package/src/pglite/parallel-loader.test.ts +586 -0
- package/src/pglite/parallel-loader.ts +481 -0
- package/src/pglite/production-pglite.test.ts +666 -0
- package/src/pglite/production-pglite.ts +537 -0
- package/src/pglite/query-executor.ts +614 -0
- package/src/pglite/r2-layer.test.ts +501 -0
- package/src/pglite/r2-layer.ts +322 -0
- package/src/pglite/tiered-init.test.ts +725 -0
- package/src/pglite/tiered-init.ts +556 -0
- package/src/pglite/tiered-vfs.test.ts +726 -0
- package/src/pglite/tiered-vfs.ts +33 -0
- package/src/pglite/tiering-stats.test.ts +531 -0
- package/src/pglite/tiering-stats.ts +407 -0
- package/src/pglite/transaction-hooks.ts +343 -0
- package/src/pglite/warm-loader.test.ts +1701 -0
- package/src/pglite/warm-loader.ts +528 -0
- package/src/pglite/workers-pglite.ts +224 -0
- package/src/pglite-assets/pglite.data +0 -0
- package/src/pglite-assets/pglite.wasm +0 -0
- package/src/pglite.d.ts +47 -0
- package/src/playground/index.ts +137 -0
- package/src/playground/keyboard-shortcuts.ts +677 -0
- package/src/playground/playground.ts +323 -0
- package/src/playground/query-executor.ts +669 -0
- package/src/playground/query-history.ts +328 -0
- package/src/playground/result-formatter.ts +420 -0
- package/src/playground/sample-datasets.ts +674 -0
- package/src/playground/sample-queries.ts +1168 -0
- package/src/playground/schema-explorer.ts +558 -0
- package/src/playground/types.ts +518 -0
- package/src/readonly/cache-reader.test.ts +460 -0
- package/src/readonly/cache-reader.ts +313 -0
- package/src/readonly/config.test.ts +187 -0
- package/src/readonly/config.ts +128 -0
- package/src/readonly/index.ts +50 -0
- package/src/readonly/pglite-wrapper.test.ts +278 -0
- package/src/readonly/pglite-wrapper.ts +184 -0
- package/src/readonly/worker.test.ts +533 -0
- package/src/readonly/worker.ts +341 -0
- package/src/readonly/write-blocker.test.ts +459 -0
- package/src/readonly/write-blocker.ts +175 -0
- package/src/recovery/disaster-recovery.test.ts +618 -0
- package/src/recovery/disaster-recovery.ts +1181 -0
- package/src/recovery/index.ts +43 -0
- package/src/recovery/parquet-parser.ts +974 -0
- package/src/retention/index.ts +74 -0
- package/src/retention/policy.test.ts +571 -0
- package/src/retention/policy.ts +774 -0
- package/src/retention/purger.test.ts +465 -0
- package/src/retention/purger.ts +558 -0
- package/src/rls/auth-integration.test.ts +752 -0
- package/src/rls/auth-integration.ts +533 -0
- package/src/rls/generator.test.ts +829 -0
- package/src/rls/generator.ts +573 -0
- package/src/rls/index.ts +128 -0
- package/src/rls/policy.ts +208 -0
- package/src/rls/rls.test.ts +1071 -0
- package/src/rls/validator.test.ts +930 -0
- package/src/rls/validator.ts +895 -0
- package/src/routing/adaptive-router.test.ts +884 -0
- package/src/routing/adaptive-router.ts +845 -0
- package/src/routing/circuit-breaker.test.ts +1505 -0
- package/src/routing/circuit-breaker.ts +852 -0
- package/src/routing/cost-metrics.test.ts +565 -0
- package/src/routing/cost-metrics.ts +408 -0
- package/src/routing/do-connection-pool.test.ts +1109 -0
- package/src/routing/do-connection-pool.ts +828 -0
- package/src/routing/index.ts +158 -0
- package/src/routing/query-complexity-estimator.test.ts +356 -0
- package/src/routing/query-complexity-estimator.ts +444 -0
- package/src/routing/request-coalescing.test.ts +738 -0
- package/src/routing/request-coalescing.ts +475 -0
- package/src/routing/runtime-router.test.ts +436 -0
- package/src/routing/runtime-router.ts +357 -0
- package/src/routing/tenant-router.test.ts +2493 -0
- package/src/routing/tenant-router.ts +1908 -0
- package/src/routing/websocket-pool.test.ts +551 -0
- package/src/routing/websocket-pool.ts +577 -0
- package/src/storage/access-pattern-tracker.test.ts +874 -0
- package/src/storage/cache-layer.test.ts +560 -0
- package/src/storage/cache-layer.ts +328 -0
- package/src/storage/cost-aware-tiering.test.ts +652 -0
- package/src/storage/cost-aware-tiering.ts +794 -0
- package/src/storage/do-sqlite-blobs.test.ts +937 -0
- package/src/storage/index.ts +272 -0
- package/src/storage/interfaces.ts +974 -0
- package/src/storage/r2-layer.test.ts +653 -0
- package/src/storage/r2-layer.ts +434 -0
- package/src/storage/r2-overflow.ts +920 -0
- package/src/storage/r2-page-vfs.test.ts +2348 -0
- package/src/storage/r2-page-vfs.ts +1054 -0
- package/src/storage/swr-cache.test.ts +832 -0
- package/src/storage/swr-cache.ts +398 -0
- package/src/storage/swr-tiered-integration.test.ts +617 -0
- package/src/storage/tiered-orchestrator.test.ts +2441 -0
- package/src/storage/tiered-orchestrator.ts +2081 -0
- package/src/storage/tiered-vfs-swr.test.ts +736 -0
- package/src/storage/tiered-vfs-swr.ts +735 -0
- package/src/storage/tiered-vfs.test.ts +793 -0
- package/src/storage/tiered-vfs.ts +1082 -0
- package/src/streaming/backpressure-controller.ts +452 -0
- package/src/streaming/buffer-pool.ts +484 -0
- package/src/streaming/cdc-iceberg-connector.ts +605 -0
- package/src/streaming/index.ts +225 -0
- package/src/streaming/live-cdc-stream.ts +985 -0
- package/src/streaming/memory-bounded-stream.ts +443 -0
- package/src/streaming/query-streamer.ts +662 -0
- package/src/streaming/response-streaming.ts +557 -0
- package/src/types/branded.ts +1075 -0
- package/src/types/branded.ts.backup +273 -0
- package/src/types/utilities.ts +1023 -0
- package/src/types/wasm.d.ts +30 -0
- package/src/validation/typed-errors.test.ts +420 -0
- package/src/wal/replay-engine.ts +1264 -0
- package/src/worker/__mocks__/capnweb.ts +15 -0
- package/src/worker/__mocks__/pglite.data.ts +22 -0
- package/src/worker/__mocks__/pglite.wasm.ts +33 -0
- package/src/worker/auth-rate-limiter.test.ts +272 -0
- package/src/worker/auth-rate-limiter.ts +448 -0
- package/src/worker/auth.security-red.test.ts +1236 -0
- package/src/worker/auth.security.test.ts +822 -0
- package/src/worker/auth.test.ts +469 -0
- package/src/worker/auth.ts +1104 -0
- package/src/worker/cdc-backpressure.test.ts +726 -0
- package/src/worker/cdc-backpressure.ts +866 -0
- package/src/worker/cdc-sse.test.ts +780 -0
- package/src/worker/cdc-sse.ts +728 -0
- package/src/worker/cdc-websocket.ts +1229 -0
- package/src/worker/cdc-ws.test.ts +1009 -0
- package/src/worker/cdc.test.ts +327 -0
- package/src/worker/cdc.ts +289 -0
- package/src/worker/concerns/auth-concern.ts +179 -0
- package/src/worker/concerns/cdc-concern.ts +247 -0
- package/src/worker/concerns/index.ts +58 -0
- package/src/worker/concerns/query-execution-concern.ts +194 -0
- package/src/worker/concerns/storage-orchestration-concern.ts +373 -0
- package/src/worker/discriminated-types.test.ts +280 -0
- package/src/worker/do-auth-manager.ts +257 -0
- package/src/worker/do-decomposition.test.ts +1236 -0
- package/src/worker/do-pglite-manager.ts +302 -0
- package/src/worker/do.test.ts +2254 -0
- package/src/worker/do.ts +1878 -0
- package/src/worker/entry.ts +417 -0
- package/src/worker/errors.ts +285 -0
- package/src/worker/health-check-manager.test.ts +261 -0
- package/src/worker/health-check-manager.ts +231 -0
- package/src/worker/index.ts +389 -0
- package/src/worker/memory-pressure.test.ts +1460 -0
- package/src/worker/memory-pressure.ts +2650 -0
- package/src/worker/migration-manager.ts +582 -0
- package/src/worker/neon-compat.test.ts +332 -0
- package/src/worker/plugin-manager.ts +485 -0
- package/src/worker/postgres.do-rpc.d.ts +76 -0
- package/src/worker/proxy.ts +694 -0
- package/src/worker/query-execution-manager.test.ts +303 -0
- package/src/worker/query-execution-manager.ts +219 -0
- package/src/worker/query-executor.test.ts +282 -0
- package/src/worker/query-executor.ts +560 -0
- package/src/worker/query-stats-manager.ts +229 -0
- package/src/worker/result-handler.test.ts +364 -0
- package/src/worker/result-handler.ts +510 -0
- package/src/worker/routes.test.ts +795 -0
- package/src/worker/routes.ts +650 -0
- package/src/worker/rpc-methods-manager.test.ts +326 -0
- package/src/worker/rpc-methods-manager.ts +276 -0
- package/src/worker/rpc.ts +524 -0
- package/src/worker/schema-version.ts +605 -0
- package/src/worker/session-manager.test.ts +506 -0
- package/src/worker/session-manager.ts +732 -0
- package/src/worker/shutdown-manager.ts +469 -0
- package/src/worker/sql-transform.test.ts +286 -0
- package/src/worker/sql-transform.ts +368 -0
- package/src/worker/supabase-compat.test.ts +621 -0
- package/src/worker/types.test.ts +292 -0
- package/src/worker/types.ts +873 -0
- package/src/worker/user-routes.test.ts +703 -0
- package/src/worker/user-routes.ts +303 -0
- package/src/worker/wal-facade.ts +235 -0
- package/src/worker/wal-r2.test.ts +570 -0
- package/src/worker/wal-r2.ts +930 -0
- package/src/worker/wal-replay.test.ts +845 -0
- package/src/worker/wal-replay.ts +897 -0
- package/src/worker/wal-retention.test.ts +758 -0
- package/src/worker/wal-retention.ts +1075 -0
- package/src/worker/wal.test.ts +618 -0
- package/src/worker/wal.ts +697 -0
- package/src/worker/websocket.test.ts +296 -0
- package/src/worker/websocket.ts +284 -0
|
@@ -0,0 +1,1075 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branded Types for Domain-Specific Identifiers
|
|
3
|
+
*
|
|
4
|
+
* This module provides TypeScript branded types for domain-specific identifiers,
|
|
5
|
+
* preventing accidental mixing of incompatible values at compile time.
|
|
6
|
+
*
|
|
7
|
+
* ## What are Branded Types?
|
|
8
|
+
*
|
|
9
|
+
* Branded types use TypeScript's structural typing system to create nominal-like types.
|
|
10
|
+
* Each branded type carries a unique "brand" that makes it incompatible with other types,
|
|
11
|
+
* even if they have the same underlying primitive type.
|
|
12
|
+
*
|
|
13
|
+
* ## Why Use Branded Types?
|
|
14
|
+
*
|
|
15
|
+
* Without branded types, it's easy to accidentally pass the wrong ID:
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Without branding - compiles but has a bug!
|
|
19
|
+
* function getUser(userId: string) { ... }
|
|
20
|
+
* function getPage(pageId: string) { ... }
|
|
21
|
+
*
|
|
22
|
+
* const userId = 'user-123'
|
|
23
|
+
* const pageId = 'page-456'
|
|
24
|
+
* getUser(pageId) // Compiles! But wrong.
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* With branded types, the compiler catches these mistakes:
|
|
28
|
+
*
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // With branding - compile error!
|
|
31
|
+
* function getUser(userId: TenantId) { ... }
|
|
32
|
+
* function getPage(pageId: BlockId) { ... }
|
|
33
|
+
*
|
|
34
|
+
* const userId = createTenantId('user-123')
|
|
35
|
+
* const pageId = createBlockId('HOT:page-456')
|
|
36
|
+
* getUser(pageId) // Error! Type 'BlockId' is not assignable to type 'TenantId'
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example Creating and using branded types
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { createTenantId, createPageNumber, TenantId, unwrap } from '@dotdo/postgres'
|
|
42
|
+
*
|
|
43
|
+
* // Create a branded value (validates input)
|
|
44
|
+
* const tenantId = createTenantId('acme-corp')
|
|
45
|
+
*
|
|
46
|
+
* // Use in type-safe functions
|
|
47
|
+
* function getTenantData(id: TenantId): Promise<TenantData> {
|
|
48
|
+
* // id is guaranteed to be a valid tenant ID
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* // Unwrap to get the underlying value
|
|
52
|
+
* const rawValue: string = unwrap(tenantId)
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @module types/branded
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Internal brand symbol for nominal typing.
|
|
60
|
+
*
|
|
61
|
+
* This symbol is used as a key in branded types to make them incompatible
|
|
62
|
+
* with plain primitives and each other.
|
|
63
|
+
*/
|
|
64
|
+
declare const brand: unique symbol
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Generic branded type helper for creating nominal types from primitives.
|
|
68
|
+
*
|
|
69
|
+
* This utility type wraps a base type `T` with a unique brand, making it
|
|
70
|
+
* incompatible with plain `T` values and other branded types.
|
|
71
|
+
*
|
|
72
|
+
* @typeParam T - The underlying primitive type (string, number, etc.)
|
|
73
|
+
* @typeParam Brand - A unique string literal to identify this branded type
|
|
74
|
+
*
|
|
75
|
+
* @example Creating a custom branded type
|
|
76
|
+
* ```typescript
|
|
77
|
+
* type UserId = Branded<string, 'UserId'>
|
|
78
|
+
*
|
|
79
|
+
* function createUserId(value: string): UserId {
|
|
80
|
+
* if (!value.startsWith('usr_')) {
|
|
81
|
+
* throw new Error('User IDs must start with usr_')
|
|
82
|
+
* }
|
|
83
|
+
* return value as UserId
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export type Branded<T, Brand extends string> = T & { readonly [brand]: Brand }
|
|
88
|
+
|
|
89
|
+
// =============================================================================
|
|
90
|
+
// Branded Type Definitions
|
|
91
|
+
// =============================================================================
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Branded type for tenant identifiers.
|
|
95
|
+
*
|
|
96
|
+
* Used to uniquely identify tenants in multi-tenant deployments.
|
|
97
|
+
* Must match {@link TENANT_ID_PATTERN} and be at most {@link TENANT_ID_MAX_LENGTH} characters.
|
|
98
|
+
*
|
|
99
|
+
* @see {@link createTenantId} - Factory function with validation
|
|
100
|
+
* @see {@link isTenantId} - Type guard for runtime checking
|
|
101
|
+
*/
|
|
102
|
+
export type TenantId = Branded<string, 'TenantId'>
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Branded type for storage page numbers.
|
|
106
|
+
*
|
|
107
|
+
* Represents a page number in the tiered storage system (0 to {@link MAX_PAGE_NUMBER}).
|
|
108
|
+
*
|
|
109
|
+
* @see {@link createPageNumber} - Factory function with validation
|
|
110
|
+
* @see {@link isPageNumber} - Type guard for runtime checking
|
|
111
|
+
*/
|
|
112
|
+
export type PageNumber = Branded<number, 'PageNumber'>
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Branded type for database migration versions.
|
|
116
|
+
*
|
|
117
|
+
* Represents a sequential migration version number (must be >= 1).
|
|
118
|
+
*
|
|
119
|
+
* @see {@link createMigrationVersion} - Factory function with validation
|
|
120
|
+
*/
|
|
121
|
+
export type MigrationVersion = Branded<number, 'MigrationVersion'>
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Branded type for query identifiers.
|
|
125
|
+
*
|
|
126
|
+
* Used to uniquely identify and track queries for observability and cancellation.
|
|
127
|
+
*
|
|
128
|
+
* @see {@link createQueryId} - Factory function with validation
|
|
129
|
+
*/
|
|
130
|
+
export type QueryId = Branded<string, 'QueryId'>
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Branded type for snapshot identifiers.
|
|
134
|
+
*
|
|
135
|
+
* Represents a PostgreSQL snapshot ID (64-bit integer as string).
|
|
136
|
+
*
|
|
137
|
+
* @see {@link createSnapshotId} - Factory function with validation
|
|
138
|
+
*/
|
|
139
|
+
export type SnapshotId = Branded<string, 'SnapshotId'>
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Branded type for storage block identifiers.
|
|
143
|
+
*
|
|
144
|
+
* Identifies a block in the tiered storage system with format `{TIER}:{key}`.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const hotBlock = createBlockId('HOT:users/page-42')
|
|
149
|
+
* const coldBlock = createBlockId('COLD:archive/2024/data.bin')
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @see {@link createBlockId} - Factory function with validation
|
|
153
|
+
*/
|
|
154
|
+
export type BlockId = Branded<string, 'BlockId'>
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Branded type for shard identifiers.
|
|
158
|
+
*
|
|
159
|
+
* Identifies a data shard in horizontally partitioned deployments.
|
|
160
|
+
*
|
|
161
|
+
* @see {@link createShardId} - Factory function with validation
|
|
162
|
+
*/
|
|
163
|
+
export type ShardId = Branded<string, 'ShardId'>
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Branded type for ingest identifiers.
|
|
167
|
+
*
|
|
168
|
+
* Identifies an ingest operation or stream for data loading.
|
|
169
|
+
*
|
|
170
|
+
* @see {@link createIngestId} - Factory function with validation
|
|
171
|
+
*/
|
|
172
|
+
export type IngestId = Branded<string, 'IngestId'>
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Branded type for replica identifiers.
|
|
176
|
+
*
|
|
177
|
+
* Identifies a database replica in replicated deployments.
|
|
178
|
+
*
|
|
179
|
+
* @see {@link createReplicaId} - Factory function with validation
|
|
180
|
+
*/
|
|
181
|
+
export type ReplicaId = Branded<string, 'ReplicaId'>
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Branded type for batch operation identifiers.
|
|
185
|
+
*
|
|
186
|
+
* Identifies a batch of operations for bulk processing.
|
|
187
|
+
*
|
|
188
|
+
* @see {@link createBatchId} - Factory function with validation
|
|
189
|
+
*/
|
|
190
|
+
export type BatchId = Branded<string, 'BatchId'>
|
|
191
|
+
|
|
192
|
+
// =============================================================================
|
|
193
|
+
// Validation Constants
|
|
194
|
+
// =============================================================================
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Common pattern for alphanumeric identifiers.
|
|
198
|
+
*
|
|
199
|
+
* Many ID types share this pattern: must start with an alphanumeric character
|
|
200
|
+
* and contain only alphanumeric characters, underscores, or hyphens.
|
|
201
|
+
*
|
|
202
|
+
* Used by: TenantId, QueryId, ShardId, IngestId, ReplicaId, BatchId
|
|
203
|
+
*
|
|
204
|
+
* @example Valid patterns
|
|
205
|
+
* - `'tenant1'` - starts with letter
|
|
206
|
+
* - `'123abc'` - starts with number
|
|
207
|
+
* - `'my-id'` - contains hyphens
|
|
208
|
+
* - `'my_id'` - contains underscores
|
|
209
|
+
*
|
|
210
|
+
* @example Invalid patterns
|
|
211
|
+
* - `'-invalid'` - starts with hyphen
|
|
212
|
+
* - `'_invalid'` - starts with underscore
|
|
213
|
+
* - `'has spaces'` - contains spaces
|
|
214
|
+
* - `'has.dots'` - contains dots
|
|
215
|
+
*/
|
|
216
|
+
export const ALPHANUMERIC_ID_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/
|
|
217
|
+
|
|
218
|
+
/** Maximum allowed length for tenant IDs (128 characters). */
|
|
219
|
+
export const TENANT_ID_MAX_LENGTH = 128
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Validation pattern for tenant IDs.
|
|
223
|
+
*
|
|
224
|
+
* Must start with alphanumeric and contain only alphanumeric, underscore, or hyphen.
|
|
225
|
+
*
|
|
226
|
+
* @see {@link ALPHANUMERIC_ID_PATTERN} - This is an alias for the common alphanumeric pattern
|
|
227
|
+
*/
|
|
228
|
+
export const TENANT_ID_PATTERN = ALPHANUMERIC_ID_PATTERN
|
|
229
|
+
|
|
230
|
+
/** Maximum allowed page number (99,999,999). */
|
|
231
|
+
export const MAX_PAGE_NUMBER = 99999999
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Validation pattern for query IDs.
|
|
235
|
+
*
|
|
236
|
+
* @see {@link ALPHANUMERIC_ID_PATTERN} - This is an alias for the common alphanumeric pattern
|
|
237
|
+
*/
|
|
238
|
+
export const QUERY_ID_PATTERN = ALPHANUMERIC_ID_PATTERN
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Validation pattern for snapshot IDs (numeric strings).
|
|
242
|
+
*
|
|
243
|
+
* Matches optional negative sign followed by one or more digits.
|
|
244
|
+
* Used for PostgreSQL 64-bit transaction/snapshot identifiers.
|
|
245
|
+
*/
|
|
246
|
+
export const SNAPSHOT_ID_PATTERN = /^-?[0-9]+$/
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Maximum snapshot ID value (2^63 - 1 as string).
|
|
250
|
+
*
|
|
251
|
+
* Represents the maximum value for a signed 64-bit integer.
|
|
252
|
+
* Stored as string to avoid JavaScript number precision issues.
|
|
253
|
+
*/
|
|
254
|
+
export const MAX_SNAPSHOT_ID = '9223372036854775807'
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Validation pattern for block IDs.
|
|
258
|
+
*
|
|
259
|
+
* Format: `{HOT|WARM|COLD}:{key}`
|
|
260
|
+
* - Tier must be uppercase: HOT, WARM, or COLD
|
|
261
|
+
* - Key can contain alphanumeric, underscore, hyphen, dot, or slash
|
|
262
|
+
*
|
|
263
|
+
* @example Valid block IDs
|
|
264
|
+
* - `'HOT:cache/session-123'`
|
|
265
|
+
* - `'WARM:data/recent.db'`
|
|
266
|
+
* - `'COLD:archive/2024/backup.tar'`
|
|
267
|
+
*/
|
|
268
|
+
export const BLOCK_ID_PATTERN = /^(HOT|WARM|COLD):[a-zA-Z0-9_\-/.]+$/
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Validation pattern for shard IDs.
|
|
272
|
+
*
|
|
273
|
+
* @see {@link ALPHANUMERIC_ID_PATTERN} - This is an alias for the common alphanumeric pattern
|
|
274
|
+
*/
|
|
275
|
+
export const SHARD_ID_PATTERN = ALPHANUMERIC_ID_PATTERN
|
|
276
|
+
|
|
277
|
+
/** Maximum allowed length for shard IDs (64 characters). */
|
|
278
|
+
export const SHARD_ID_MAX_LENGTH = 64
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Validation pattern for ingest IDs.
|
|
282
|
+
*
|
|
283
|
+
* @see {@link ALPHANUMERIC_ID_PATTERN} - This is an alias for the common alphanumeric pattern
|
|
284
|
+
*/
|
|
285
|
+
export const INGEST_ID_PATTERN = ALPHANUMERIC_ID_PATTERN
|
|
286
|
+
|
|
287
|
+
/** Maximum allowed length for ingest IDs (64 characters). */
|
|
288
|
+
export const INGEST_ID_MAX_LENGTH = 64
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Validation pattern for replica IDs.
|
|
292
|
+
*
|
|
293
|
+
* @see {@link ALPHANUMERIC_ID_PATTERN} - This is an alias for the common alphanumeric pattern
|
|
294
|
+
*/
|
|
295
|
+
export const REPLICA_ID_PATTERN = ALPHANUMERIC_ID_PATTERN
|
|
296
|
+
|
|
297
|
+
/** Maximum allowed length for replica IDs (64 characters). */
|
|
298
|
+
export const REPLICA_ID_MAX_LENGTH = 64
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Validation pattern for batch IDs.
|
|
302
|
+
*
|
|
303
|
+
* @see {@link ALPHANUMERIC_ID_PATTERN} - This is an alias for the common alphanumeric pattern
|
|
304
|
+
*/
|
|
305
|
+
export const BATCH_ID_PATTERN = ALPHANUMERIC_ID_PATTERN
|
|
306
|
+
|
|
307
|
+
/** Maximum allowed length for batch IDs (128 characters). */
|
|
308
|
+
export const BATCH_ID_MAX_LENGTH = 128
|
|
309
|
+
|
|
310
|
+
// =============================================================================
|
|
311
|
+
// Factory Functions
|
|
312
|
+
// =============================================================================
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Creates a validated tenant ID from a string.
|
|
316
|
+
*
|
|
317
|
+
* Tenant IDs are used to uniquely identify tenants in multi-tenant deployments.
|
|
318
|
+
* They must start with an alphanumeric character and can only contain
|
|
319
|
+
* alphanumeric characters, underscores, or hyphens.
|
|
320
|
+
*
|
|
321
|
+
* @param value - The raw string to validate and brand
|
|
322
|
+
* @returns A branded TenantId
|
|
323
|
+
* @throws Error if the value is empty, exceeds max length, or has invalid format
|
|
324
|
+
*
|
|
325
|
+
* @example Basic usage
|
|
326
|
+
* ```typescript
|
|
327
|
+
* const tenantId = createTenantId('acme-corp')
|
|
328
|
+
* console.log(unwrap(tenantId)) // 'acme-corp'
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* @example Error handling
|
|
332
|
+
* ```typescript
|
|
333
|
+
* try {
|
|
334
|
+
* createTenantId('-invalid') // Throws: starts with hyphen
|
|
335
|
+
* } catch (error) {
|
|
336
|
+
* console.error('Invalid tenant:', error.message)
|
|
337
|
+
* }
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @example Type-safe function parameter
|
|
341
|
+
* ```typescript
|
|
342
|
+
* function loadTenantData(id: TenantId): Promise<Data> {
|
|
343
|
+
* // id is guaranteed to be valid
|
|
344
|
+
* return fetch(`/api/tenants/${unwrap(id)}`)
|
|
345
|
+
* }
|
|
346
|
+
*
|
|
347
|
+
* const tenantId = createTenantId('acme-corp')
|
|
348
|
+
* await loadTenantData(tenantId) // OK
|
|
349
|
+
* await loadTenantData('plain-string') // Compile error!
|
|
350
|
+
* ```
|
|
351
|
+
*
|
|
352
|
+
* @see {@link isTenantId} - Type guard for checking without throwing
|
|
353
|
+
* @see {@link unsafeTenantId} - Skip validation (use with caution)
|
|
354
|
+
*/
|
|
355
|
+
export function createTenantId(value: string): TenantId {
|
|
356
|
+
if (!value || value.length === 0) {
|
|
357
|
+
throw new Error('Invalid tenant ID: cannot be empty')
|
|
358
|
+
}
|
|
359
|
+
if (value.length > TENANT_ID_MAX_LENGTH) {
|
|
360
|
+
throw new Error(`Invalid tenant ID: exceeds maximum length of ${TENANT_ID_MAX_LENGTH}`)
|
|
361
|
+
}
|
|
362
|
+
if (!TENANT_ID_PATTERN.test(value)) {
|
|
363
|
+
throw new Error(`Invalid tenant ID: "${value}". Must start with alphanumeric and contain only alphanumeric, underscore, or hyphen`)
|
|
364
|
+
}
|
|
365
|
+
return value as TenantId
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Creates a validated page number.
|
|
370
|
+
*
|
|
371
|
+
* Page numbers represent storage pages in the tiered storage system.
|
|
372
|
+
* They must be non-negative integers within the allowed range (0 to 99,999,999).
|
|
373
|
+
*
|
|
374
|
+
* @param value - The raw number to validate and brand
|
|
375
|
+
* @returns A branded PageNumber
|
|
376
|
+
* @throws Error if value is negative, non-integer, or exceeds maximum
|
|
377
|
+
*
|
|
378
|
+
* @example Basic usage
|
|
379
|
+
* ```typescript
|
|
380
|
+
* const page = createPageNumber(42)
|
|
381
|
+
* console.log(unwrap(page)) // 42
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* @example Boundary values
|
|
385
|
+
* ```typescript
|
|
386
|
+
* createPageNumber(0) // Valid: minimum page
|
|
387
|
+
* createPageNumber(99999999) // Valid: maximum page (MAX_PAGE_NUMBER)
|
|
388
|
+
* createPageNumber(-1) // Throws: negative not allowed
|
|
389
|
+
* createPageNumber(100000000) // Throws: exceeds maximum
|
|
390
|
+
* createPageNumber(1.5) // Throws: must be integer
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* @see {@link isPageNumber} - Type guard for checking without throwing
|
|
394
|
+
* @see {@link MAX_PAGE_NUMBER} - Maximum allowed value (99,999,999)
|
|
395
|
+
*/
|
|
396
|
+
export function createPageNumber(value: number): PageNumber {
|
|
397
|
+
if (!Number.isInteger(value) || value < 0 || value > MAX_PAGE_NUMBER) {
|
|
398
|
+
throw new Error(`Invalid page number: ${value}. Must be integer 0-${MAX_PAGE_NUMBER}`)
|
|
399
|
+
}
|
|
400
|
+
return value as PageNumber
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Creates a validated migration version number.
|
|
405
|
+
*
|
|
406
|
+
* Migration versions represent sequential database schema versions.
|
|
407
|
+
* They must be positive integers (>= 1) since version 0 represents no migrations.
|
|
408
|
+
*
|
|
409
|
+
* @param value - The raw number to validate and brand
|
|
410
|
+
* @returns A branded MigrationVersion
|
|
411
|
+
* @throws Error if value is zero, negative, or non-integer
|
|
412
|
+
*
|
|
413
|
+
* @example Basic usage
|
|
414
|
+
* ```typescript
|
|
415
|
+
* const version = createMigrationVersion(3)
|
|
416
|
+
* console.log(unwrap(version)) // 3
|
|
417
|
+
* ```
|
|
418
|
+
*
|
|
419
|
+
* @example Migration tracking
|
|
420
|
+
* ```typescript
|
|
421
|
+
* async function runMigrations(currentVersion: MigrationVersion) {
|
|
422
|
+
* const migrations = [
|
|
423
|
+
* { version: createMigrationVersion(1), sql: 'CREATE TABLE users...' },
|
|
424
|
+
* { version: createMigrationVersion(2), sql: 'ALTER TABLE users...' },
|
|
425
|
+
* { version: createMigrationVersion(3), sql: 'CREATE INDEX...' },
|
|
426
|
+
* ]
|
|
427
|
+
* for (const m of migrations) {
|
|
428
|
+
* if (unwrap(m.version) > unwrap(currentVersion)) {
|
|
429
|
+
* await db.exec(m.sql)
|
|
430
|
+
* }
|
|
431
|
+
* }
|
|
432
|
+
* }
|
|
433
|
+
* ```
|
|
434
|
+
*
|
|
435
|
+
* @see {@link isMigrationVersion} - Type guard for checking without throwing
|
|
436
|
+
*/
|
|
437
|
+
export function createMigrationVersion(value: number): MigrationVersion {
|
|
438
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
439
|
+
throw new Error(`Invalid migration version: ${value}. Must be positive integer`)
|
|
440
|
+
}
|
|
441
|
+
return value as MigrationVersion
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Creates a validated query ID from a string.
|
|
446
|
+
*
|
|
447
|
+
* Query IDs are used to uniquely identify and track queries for observability,
|
|
448
|
+
* logging, tracing, and cancellation purposes.
|
|
449
|
+
*
|
|
450
|
+
* @param value - The raw string to validate and brand
|
|
451
|
+
* @returns A branded QueryId
|
|
452
|
+
* @throws Error if the value is empty or has invalid format
|
|
453
|
+
*
|
|
454
|
+
* @example Basic usage
|
|
455
|
+
* ```typescript
|
|
456
|
+
* const queryId = createQueryId('query-abc123')
|
|
457
|
+
* console.log(unwrap(queryId)) // 'query-abc123'
|
|
458
|
+
* ```
|
|
459
|
+
*
|
|
460
|
+
* @example With tracing/observability
|
|
461
|
+
* ```typescript
|
|
462
|
+
* const queryId = createQueryId(`q-${Date.now()}-${Math.random().toString(36).slice(2)}`)
|
|
463
|
+
* logger.info('Executing query', { queryId: unwrap(queryId), sql })
|
|
464
|
+
* const result = await db.query(sql)
|
|
465
|
+
* logger.info('Query completed', { queryId: unwrap(queryId), rows: result.length })
|
|
466
|
+
* ```
|
|
467
|
+
*
|
|
468
|
+
* @see {@link isQueryId} - Type guard for checking without throwing
|
|
469
|
+
*/
|
|
470
|
+
export function createQueryId(value: string): QueryId {
|
|
471
|
+
if (!value || value.length === 0) {
|
|
472
|
+
throw new Error('Invalid query ID: cannot be empty')
|
|
473
|
+
}
|
|
474
|
+
if (!QUERY_ID_PATTERN.test(value)) {
|
|
475
|
+
throw new Error(`Invalid query ID: "${value}". Must start with alphanumeric and contain only alphanumeric, underscore, or hyphen`)
|
|
476
|
+
}
|
|
477
|
+
return value as QueryId
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Creates a validated snapshot ID from a numeric string.
|
|
482
|
+
*
|
|
483
|
+
* Snapshot IDs represent PostgreSQL transaction snapshots as 64-bit signed integers.
|
|
484
|
+
* They are stored as strings to avoid JavaScript's number precision limitations
|
|
485
|
+
* for values larger than Number.MAX_SAFE_INTEGER.
|
|
486
|
+
*
|
|
487
|
+
* @param value - The raw string to validate and brand (must be numeric)
|
|
488
|
+
* @returns A branded SnapshotId
|
|
489
|
+
* @throws Error if empty, non-numeric, or exceeds 64-bit signed integer range
|
|
490
|
+
*
|
|
491
|
+
* @example Basic usage
|
|
492
|
+
* ```typescript
|
|
493
|
+
* const snapshotId = createSnapshotId('1234567890')
|
|
494
|
+
* console.log(unwrap(snapshotId)) // '1234567890'
|
|
495
|
+
* ```
|
|
496
|
+
*
|
|
497
|
+
* @example Large values (beyond JS number precision)
|
|
498
|
+
* ```typescript
|
|
499
|
+
* // Safe: stored as string, no precision loss
|
|
500
|
+
* const largeId = createSnapshotId('9223372036854775807') // Max 64-bit signed int
|
|
501
|
+
* ```
|
|
502
|
+
*
|
|
503
|
+
* @example Negative values
|
|
504
|
+
* ```typescript
|
|
505
|
+
* const negativeId = createSnapshotId('-123') // Valid
|
|
506
|
+
* ```
|
|
507
|
+
*
|
|
508
|
+
* @see {@link isSnapshotId} - Type guard for checking without throwing
|
|
509
|
+
* @see {@link MAX_SNAPSHOT_ID} - Maximum allowed value (2^63 - 1)
|
|
510
|
+
*/
|
|
511
|
+
export function createSnapshotId(value: string): SnapshotId {
|
|
512
|
+
if (!value || value.length === 0) {
|
|
513
|
+
throw new Error('Invalid snapshot ID: cannot be empty')
|
|
514
|
+
}
|
|
515
|
+
if (!SNAPSHOT_ID_PATTERN.test(value)) {
|
|
516
|
+
throw new Error(`Invalid snapshot ID: "${value}". Must be a numeric string (64-bit integer)`)
|
|
517
|
+
}
|
|
518
|
+
const absValue = value.startsWith('-') ? value.slice(1) : value
|
|
519
|
+
if (absValue.length > MAX_SNAPSHOT_ID.length || (absValue.length === MAX_SNAPSHOT_ID.length && absValue > MAX_SNAPSHOT_ID)) {
|
|
520
|
+
throw new Error(`Invalid snapshot ID: "${value}". Exceeds maximum 64-bit integer value`)
|
|
521
|
+
}
|
|
522
|
+
return value as SnapshotId
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Creates a validated block ID from a string.
|
|
527
|
+
*
|
|
528
|
+
* Block IDs identify storage blocks in the tiered storage system. The format
|
|
529
|
+
* is `{TIER}:{key}` where TIER indicates the storage tier (HOT, WARM, or COLD).
|
|
530
|
+
*
|
|
531
|
+
* Storage tiers:
|
|
532
|
+
* - **HOT**: Cloudflare Cache API - fastest access, frequently used data
|
|
533
|
+
* - **WARM**: Durable Object SQLite - medium access, recent data
|
|
534
|
+
* - **COLD**: R2 object storage - archival, rarely accessed data
|
|
535
|
+
*
|
|
536
|
+
* @param value - The raw string to validate (format: `{HOT|WARM|COLD}:{key}`)
|
|
537
|
+
* @returns A branded BlockId
|
|
538
|
+
* @throws Error if the value is empty or has invalid format
|
|
539
|
+
*
|
|
540
|
+
* @example Basic usage
|
|
541
|
+
* ```typescript
|
|
542
|
+
* const blockId = createBlockId('HOT:users/page-42')
|
|
543
|
+
* console.log(unwrap(blockId)) // 'HOT:users/page-42'
|
|
544
|
+
* ```
|
|
545
|
+
*
|
|
546
|
+
* @example Different storage tiers
|
|
547
|
+
* ```typescript
|
|
548
|
+
* const hot = createBlockId('HOT:cache/session-123') // Frequently accessed
|
|
549
|
+
* const warm = createBlockId('WARM:data/users.db') // Medium access
|
|
550
|
+
* const cold = createBlockId('COLD:archive/2024.tar') // Rarely accessed
|
|
551
|
+
* ```
|
|
552
|
+
*
|
|
553
|
+
* @example Path-like keys
|
|
554
|
+
* ```typescript
|
|
555
|
+
* const block = createBlockId('COLD:archive/2024/01/backup.bin')
|
|
556
|
+
* ```
|
|
557
|
+
*
|
|
558
|
+
* @see {@link isBlockId} - Type guard for checking without throwing
|
|
559
|
+
*/
|
|
560
|
+
export function createBlockId(value: string): BlockId {
|
|
561
|
+
if (!value || value.length === 0) {
|
|
562
|
+
throw new Error('Invalid block ID: cannot be empty')
|
|
563
|
+
}
|
|
564
|
+
if (!BLOCK_ID_PATTERN.test(value)) {
|
|
565
|
+
throw new Error(`Invalid block ID: "${value}". Must be in format "{HOT|WARM|COLD}:{key}" with alphanumeric key`)
|
|
566
|
+
}
|
|
567
|
+
return value as BlockId
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Creates a validated shard ID from a string.
|
|
572
|
+
*
|
|
573
|
+
* Shard IDs identify data partitions in horizontally sharded deployments.
|
|
574
|
+
* Commonly used for geographic or logical data partitioning strategies.
|
|
575
|
+
*
|
|
576
|
+
* @param value - The raw string to validate and brand
|
|
577
|
+
* @returns A branded ShardId
|
|
578
|
+
* @throws Error if empty, exceeds max length (64), or has invalid format
|
|
579
|
+
*
|
|
580
|
+
* @example Basic usage
|
|
581
|
+
* ```typescript
|
|
582
|
+
* const shardId = createShardId('shard-us-west-1')
|
|
583
|
+
* console.log(unwrap(shardId)) // 'shard-us-west-1'
|
|
584
|
+
* ```
|
|
585
|
+
*
|
|
586
|
+
* @example Geographic sharding
|
|
587
|
+
* ```typescript
|
|
588
|
+
* const shards = [
|
|
589
|
+
* createShardId('shard-us-west'),
|
|
590
|
+
* createShardId('shard-us-east'),
|
|
591
|
+
* createShardId('shard-eu-central'),
|
|
592
|
+
* createShardId('shard-ap-south'),
|
|
593
|
+
* ]
|
|
594
|
+
* ```
|
|
595
|
+
*
|
|
596
|
+
* @example Hash-based sharding
|
|
597
|
+
* ```typescript
|
|
598
|
+
* function getShardForUser(userId: string): ShardId {
|
|
599
|
+
* const hash = hashCode(userId) % 4
|
|
600
|
+
* return createShardId(`shard-${hash}`)
|
|
601
|
+
* }
|
|
602
|
+
* ```
|
|
603
|
+
*
|
|
604
|
+
* @see {@link isShardId} - Type guard for checking without throwing
|
|
605
|
+
* @see {@link SHARD_ID_MAX_LENGTH} - Maximum allowed length (64)
|
|
606
|
+
*/
|
|
607
|
+
export function createShardId(value: string): ShardId {
|
|
608
|
+
if (!value || value.length === 0) {
|
|
609
|
+
throw new Error('Invalid shard ID: cannot be empty')
|
|
610
|
+
}
|
|
611
|
+
if (value.length > SHARD_ID_MAX_LENGTH) {
|
|
612
|
+
throw new Error(`Invalid shard ID: exceeds maximum length of ${SHARD_ID_MAX_LENGTH}`)
|
|
613
|
+
}
|
|
614
|
+
if (!SHARD_ID_PATTERN.test(value)) {
|
|
615
|
+
throw new Error(`Invalid shard ID: "${value}". Must start with alphanumeric and contain only alphanumeric, underscore, or hyphen`)
|
|
616
|
+
}
|
|
617
|
+
return value as ShardId
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Creates a validated ingest ID from a string.
|
|
622
|
+
*
|
|
623
|
+
* Ingest IDs identify data loading operations such as bulk imports, streaming
|
|
624
|
+
* data pipelines, or ETL jobs. Useful for tracking and resuming long-running operations.
|
|
625
|
+
*
|
|
626
|
+
* @param value - The raw string to validate and brand
|
|
627
|
+
* @returns A branded IngestId
|
|
628
|
+
* @throws Error if empty, exceeds max length (64), or has invalid format
|
|
629
|
+
*
|
|
630
|
+
* @example Basic usage
|
|
631
|
+
* ```typescript
|
|
632
|
+
* const ingestId = createIngestId('bulk-import-2024-01')
|
|
633
|
+
* console.log(unwrap(ingestId)) // 'bulk-import-2024-01'
|
|
634
|
+
* ```
|
|
635
|
+
*
|
|
636
|
+
* @example Timestamped ingest job
|
|
637
|
+
* ```typescript
|
|
638
|
+
* const ingestId = createIngestId(`csv-import-${Date.now()}`)
|
|
639
|
+
* await startIngestJob(ingestId, 'data.csv')
|
|
640
|
+
* // Later: check status or resume
|
|
641
|
+
* const status = await getIngestStatus(ingestId)
|
|
642
|
+
* ```
|
|
643
|
+
*
|
|
644
|
+
* @see {@link isIngestId} - Type guard for checking without throwing
|
|
645
|
+
* @see {@link INGEST_ID_MAX_LENGTH} - Maximum allowed length (64)
|
|
646
|
+
*/
|
|
647
|
+
export function createIngestId(value: string): IngestId {
|
|
648
|
+
if (!value || value.length === 0) {
|
|
649
|
+
throw new Error('Invalid ingest ID: cannot be empty')
|
|
650
|
+
}
|
|
651
|
+
if (value.length > INGEST_ID_MAX_LENGTH) {
|
|
652
|
+
throw new Error(`Invalid ingest ID: exceeds maximum length of ${INGEST_ID_MAX_LENGTH}`)
|
|
653
|
+
}
|
|
654
|
+
if (!INGEST_ID_PATTERN.test(value)) {
|
|
655
|
+
throw new Error(`Invalid ingest ID: "${value}". Must start with alphanumeric and contain only alphanumeric, underscore, or hyphen`)
|
|
656
|
+
}
|
|
657
|
+
return value as IngestId
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Creates a validated replica ID from a string.
|
|
662
|
+
*
|
|
663
|
+
* Replica IDs identify database read replicas in replicated deployments.
|
|
664
|
+
* Used for routing read queries and tracking replication lag.
|
|
665
|
+
*
|
|
666
|
+
* @param value - The raw string to validate and brand
|
|
667
|
+
* @returns A branded ReplicaId
|
|
668
|
+
* @throws Error if empty, exceeds max length (64), or has invalid format
|
|
669
|
+
*
|
|
670
|
+
* @example Basic usage
|
|
671
|
+
* ```typescript
|
|
672
|
+
* const replicaId = createReplicaId('replica-eu-1')
|
|
673
|
+
* console.log(unwrap(replicaId)) // 'replica-eu-1'
|
|
674
|
+
* ```
|
|
675
|
+
*
|
|
676
|
+
* @example Regional replicas
|
|
677
|
+
* ```typescript
|
|
678
|
+
* const primary = createReplicaId('primary')
|
|
679
|
+
* const replicas = [
|
|
680
|
+
* createReplicaId('replica-us-east'),
|
|
681
|
+
* createReplicaId('replica-eu-west'),
|
|
682
|
+
* createReplicaId('replica-ap-south'),
|
|
683
|
+
* ]
|
|
684
|
+
* ```
|
|
685
|
+
*
|
|
686
|
+
* @example Read routing
|
|
687
|
+
* ```typescript
|
|
688
|
+
* function selectReplica(region: string): ReplicaId {
|
|
689
|
+
* const mapping: Record<string, ReplicaId> = {
|
|
690
|
+
* 'us': createReplicaId('replica-us-east'),
|
|
691
|
+
* 'eu': createReplicaId('replica-eu-west'),
|
|
692
|
+
* }
|
|
693
|
+
* return mapping[region] ?? createReplicaId('primary')
|
|
694
|
+
* }
|
|
695
|
+
* ```
|
|
696
|
+
*
|
|
697
|
+
* @see {@link isReplicaId} - Type guard for checking without throwing
|
|
698
|
+
* @see {@link REPLICA_ID_MAX_LENGTH} - Maximum allowed length (64)
|
|
699
|
+
*/
|
|
700
|
+
export function createReplicaId(value: string): ReplicaId {
|
|
701
|
+
if (!value || value.length === 0) {
|
|
702
|
+
throw new Error('Invalid replica ID: cannot be empty')
|
|
703
|
+
}
|
|
704
|
+
if (value.length > REPLICA_ID_MAX_LENGTH) {
|
|
705
|
+
throw new Error(`Invalid replica ID: exceeds maximum length of ${REPLICA_ID_MAX_LENGTH}`)
|
|
706
|
+
}
|
|
707
|
+
if (!REPLICA_ID_PATTERN.test(value)) {
|
|
708
|
+
throw new Error(`Invalid replica ID: "${value}". Must start with alphanumeric and contain only alphanumeric, underscore, or hyphen`)
|
|
709
|
+
}
|
|
710
|
+
return value as ReplicaId
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Creates a validated batch ID from a string.
|
|
715
|
+
*
|
|
716
|
+
* Batch IDs identify groups of operations processed together. Useful for
|
|
717
|
+
* transactional batches, bulk operations, and audit trails.
|
|
718
|
+
*
|
|
719
|
+
* @param value - The raw string to validate and brand
|
|
720
|
+
* @returns A branded BatchId
|
|
721
|
+
* @throws Error if empty, exceeds max length (128), or has invalid format
|
|
722
|
+
*
|
|
723
|
+
* @example Basic usage
|
|
724
|
+
* ```typescript
|
|
725
|
+
* const batchId = createBatchId('batch-2024-01-21-abc123')
|
|
726
|
+
* console.log(unwrap(batchId)) // 'batch-2024-01-21-abc123'
|
|
727
|
+
* ```
|
|
728
|
+
*
|
|
729
|
+
* @example Daily batch jobs
|
|
730
|
+
* ```typescript
|
|
731
|
+
* const date = new Date().toISOString().slice(0, 10) // '2024-01-21'
|
|
732
|
+
* const batchId = createBatchId(`nightly-sync-${date}`)
|
|
733
|
+
* await runBatchJob(batchId)
|
|
734
|
+
* ```
|
|
735
|
+
*
|
|
736
|
+
* @example Transactional batch
|
|
737
|
+
* ```typescript
|
|
738
|
+
* async function processBatch(operations: Operation[]) {
|
|
739
|
+
* const batchId = createBatchId(`tx-${Date.now()}`)
|
|
740
|
+
* try {
|
|
741
|
+
* for (const op of operations) {
|
|
742
|
+
* await execute(op, batchId)
|
|
743
|
+
* }
|
|
744
|
+
* await commit(batchId)
|
|
745
|
+
* } catch (error) {
|
|
746
|
+
* await rollback(batchId)
|
|
747
|
+
* throw error
|
|
748
|
+
* }
|
|
749
|
+
* }
|
|
750
|
+
* ```
|
|
751
|
+
*
|
|
752
|
+
* @see {@link isBatchId} - Type guard for checking without throwing
|
|
753
|
+
* @see {@link BATCH_ID_MAX_LENGTH} - Maximum allowed length (128)
|
|
754
|
+
*/
|
|
755
|
+
export function createBatchId(value: string): BatchId {
|
|
756
|
+
if (!value || value.length === 0) {
|
|
757
|
+
throw new Error('Invalid batch ID: cannot be empty')
|
|
758
|
+
}
|
|
759
|
+
if (value.length > BATCH_ID_MAX_LENGTH) {
|
|
760
|
+
throw new Error(`Invalid batch ID: exceeds maximum length of ${BATCH_ID_MAX_LENGTH}`)
|
|
761
|
+
}
|
|
762
|
+
if (!BATCH_ID_PATTERN.test(value)) {
|
|
763
|
+
throw new Error(`Invalid batch ID: "${value}". Must start with alphanumeric and contain only alphanumeric, underscore, or hyphen`)
|
|
764
|
+
}
|
|
765
|
+
return value as BatchId
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// =============================================================================
|
|
769
|
+
// Type Guards
|
|
770
|
+
// =============================================================================
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Type guard that checks if a value is a valid TenantId.
|
|
774
|
+
*
|
|
775
|
+
* Use this function to safely narrow an unknown value to TenantId without
|
|
776
|
+
* throwing an exception. Returns false for invalid values instead of throwing.
|
|
777
|
+
*
|
|
778
|
+
* @param value - The value to check (any type)
|
|
779
|
+
* @returns true if value is a valid TenantId, false otherwise
|
|
780
|
+
*
|
|
781
|
+
* @example Basic validation
|
|
782
|
+
* ```typescript
|
|
783
|
+
* if (isTenantId(input)) {
|
|
784
|
+
* // TypeScript knows input is TenantId here
|
|
785
|
+
* await loadTenant(input)
|
|
786
|
+
* }
|
|
787
|
+
* ```
|
|
788
|
+
*
|
|
789
|
+
* @example Filtering array of unknown values
|
|
790
|
+
* ```typescript
|
|
791
|
+
* const inputs: unknown[] = ['valid-tenant', '', 123, '-invalid']
|
|
792
|
+
* const validTenants = inputs.filter(isTenantId)
|
|
793
|
+
* // validTenants: TenantId[] = ['valid-tenant' as TenantId]
|
|
794
|
+
* ```
|
|
795
|
+
*
|
|
796
|
+
* @example Optional value handling
|
|
797
|
+
* ```typescript
|
|
798
|
+
* function getTenant(id: string | undefined): TenantId | undefined {
|
|
799
|
+
* return id && isTenantId(id) ? id : undefined
|
|
800
|
+
* }
|
|
801
|
+
* ```
|
|
802
|
+
*
|
|
803
|
+
* @see {@link createTenantId} - Factory that throws on invalid input
|
|
804
|
+
*/
|
|
805
|
+
export function isTenantId(value: unknown): value is TenantId {
|
|
806
|
+
return typeof value === 'string' && value.length > 0 && value.length <= TENANT_ID_MAX_LENGTH && TENANT_ID_PATTERN.test(value)
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Type guard that checks if a value is a valid PageNumber.
|
|
811
|
+
*
|
|
812
|
+
* Validates that the value is a non-negative integer within the allowed range.
|
|
813
|
+
*
|
|
814
|
+
* @param value - The value to check (any type)
|
|
815
|
+
* @returns true if value is a valid PageNumber, false otherwise
|
|
816
|
+
*
|
|
817
|
+
* @example Basic validation
|
|
818
|
+
* ```typescript
|
|
819
|
+
* if (isPageNumber(pageIndex)) {
|
|
820
|
+
* await loadPage(pageIndex)
|
|
821
|
+
* }
|
|
822
|
+
* ```
|
|
823
|
+
*
|
|
824
|
+
* @see {@link createPageNumber} - Factory that throws on invalid input
|
|
825
|
+
* @see {@link MAX_PAGE_NUMBER} - Maximum allowed value
|
|
826
|
+
*/
|
|
827
|
+
export function isPageNumber(value: unknown): value is PageNumber {
|
|
828
|
+
return typeof value === 'number' && Number.isInteger(value) && value >= 0 && value <= MAX_PAGE_NUMBER
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Type guard that checks if a value is a valid MigrationVersion.
|
|
833
|
+
*
|
|
834
|
+
* Validates that the value is a positive integer (>= 1).
|
|
835
|
+
*
|
|
836
|
+
* @param value - The value to check (any type)
|
|
837
|
+
* @returns true if value is a valid MigrationVersion, false otherwise
|
|
838
|
+
*
|
|
839
|
+
* @example Schema version check
|
|
840
|
+
* ```typescript
|
|
841
|
+
* if (isMigrationVersion(schemaVersion)) {
|
|
842
|
+
* await runMigration(schemaVersion)
|
|
843
|
+
* }
|
|
844
|
+
* ```
|
|
845
|
+
*
|
|
846
|
+
* @see {@link createMigrationVersion} - Factory that throws on invalid input
|
|
847
|
+
*/
|
|
848
|
+
export function isMigrationVersion(value: unknown): value is MigrationVersion {
|
|
849
|
+
return typeof value === 'number' && Number.isInteger(value) && value >= 1
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Type guard that checks if a value is a valid QueryId.
|
|
854
|
+
*
|
|
855
|
+
* @param value - The value to check (any type)
|
|
856
|
+
* @returns true if value is a valid QueryId, false otherwise
|
|
857
|
+
*
|
|
858
|
+
* @see {@link createQueryId} - Factory that throws on invalid input
|
|
859
|
+
*/
|
|
860
|
+
export function isQueryId(value: unknown): value is QueryId {
|
|
861
|
+
return typeof value === 'string' && value.length > 0 && QUERY_ID_PATTERN.test(value)
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Type guard that checks if a value is a valid SnapshotId.
|
|
866
|
+
*
|
|
867
|
+
* @param value - The value to check
|
|
868
|
+
* @returns true if value is a valid SnapshotId
|
|
869
|
+
*/
|
|
870
|
+
export function isSnapshotId(value: unknown): value is SnapshotId {
|
|
871
|
+
if (typeof value !== 'string' || value.length === 0 || !SNAPSHOT_ID_PATTERN.test(value)) return false
|
|
872
|
+
const absValue = value.startsWith('-') ? value.slice(1) : value
|
|
873
|
+
return absValue.length < MAX_SNAPSHOT_ID.length || (absValue.length === MAX_SNAPSHOT_ID.length && absValue <= MAX_SNAPSHOT_ID)
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Type guard that checks if a value is a valid BlockId.
|
|
878
|
+
*
|
|
879
|
+
* @param value - The value to check
|
|
880
|
+
* @returns true if value is a valid BlockId
|
|
881
|
+
*/
|
|
882
|
+
export function isBlockId(value: unknown): value is BlockId {
|
|
883
|
+
return typeof value === 'string' && value.length > 0 && BLOCK_ID_PATTERN.test(value)
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Type guard that checks if a value is a valid ShardId.
|
|
888
|
+
*
|
|
889
|
+
* @param value - The value to check
|
|
890
|
+
* @returns true if value is a valid ShardId
|
|
891
|
+
*/
|
|
892
|
+
export function isShardId(value: unknown): value is ShardId {
|
|
893
|
+
return typeof value === 'string' && value.length > 0 && value.length <= SHARD_ID_MAX_LENGTH && SHARD_ID_PATTERN.test(value)
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Type guard that checks if a value is a valid IngestId.
|
|
898
|
+
*
|
|
899
|
+
* @param value - The value to check
|
|
900
|
+
* @returns true if value is a valid IngestId
|
|
901
|
+
*/
|
|
902
|
+
export function isIngestId(value: unknown): value is IngestId {
|
|
903
|
+
return typeof value === 'string' && value.length > 0 && value.length <= INGEST_ID_MAX_LENGTH && INGEST_ID_PATTERN.test(value)
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Type guard that checks if a value is a valid ReplicaId.
|
|
908
|
+
*
|
|
909
|
+
* @param value - The value to check
|
|
910
|
+
* @returns true if value is a valid ReplicaId
|
|
911
|
+
*/
|
|
912
|
+
export function isReplicaId(value: unknown): value is ReplicaId {
|
|
913
|
+
return typeof value === 'string' && value.length > 0 && value.length <= REPLICA_ID_MAX_LENGTH && REPLICA_ID_PATTERN.test(value)
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Type guard that checks if a value is a valid BatchId.
|
|
918
|
+
*
|
|
919
|
+
* @param value - The value to check
|
|
920
|
+
* @returns true if value is a valid BatchId
|
|
921
|
+
*/
|
|
922
|
+
export function isBatchId(value: unknown): value is BatchId {
|
|
923
|
+
return typeof value === 'string' && value.length > 0 && value.length <= BATCH_ID_MAX_LENGTH && BATCH_ID_PATTERN.test(value)
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// =============================================================================
|
|
927
|
+
// Utility Functions
|
|
928
|
+
// =============================================================================
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* Extracts the underlying primitive value from a branded type.
|
|
932
|
+
*
|
|
933
|
+
* Use this when you need to pass a branded value to an API that expects
|
|
934
|
+
* the raw primitive type (e.g., JSON serialization, external APIs).
|
|
935
|
+
*
|
|
936
|
+
* @typeParam T - The underlying primitive type
|
|
937
|
+
* @typeParam Brand - The brand string
|
|
938
|
+
* @param value - The branded value to unwrap
|
|
939
|
+
* @returns The underlying primitive value
|
|
940
|
+
*
|
|
941
|
+
* @example
|
|
942
|
+
* ```typescript
|
|
943
|
+
* const tenantId = createTenantId('acme-corp')
|
|
944
|
+
* const raw: string = unwrap(tenantId) // 'acme-corp'
|
|
945
|
+
* ```
|
|
946
|
+
*/
|
|
947
|
+
export function unwrap<T, Brand extends string>(value: Branded<T, Brand>): T {
|
|
948
|
+
return value as T
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// =============================================================================
|
|
952
|
+
// Unsafe Factory Functions
|
|
953
|
+
// =============================================================================
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Creates a TenantId without validation.
|
|
957
|
+
*
|
|
958
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
959
|
+
*
|
|
960
|
+
* @param value - Pre-validated tenant ID string
|
|
961
|
+
* @returns A branded TenantId
|
|
962
|
+
*
|
|
963
|
+
* @see {@link createTenantId} - Safe factory with validation
|
|
964
|
+
*/
|
|
965
|
+
export function unsafeTenantId(value: string): TenantId {
|
|
966
|
+
return value as TenantId
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Creates a PageNumber without validation.
|
|
971
|
+
*
|
|
972
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
973
|
+
*
|
|
974
|
+
* @param value - Pre-validated page number
|
|
975
|
+
* @returns A branded PageNumber
|
|
976
|
+
*/
|
|
977
|
+
export function unsafePageNumber(value: number): PageNumber {
|
|
978
|
+
return value as PageNumber
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Creates a MigrationVersion without validation.
|
|
983
|
+
*
|
|
984
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
985
|
+
*
|
|
986
|
+
* @param value - Pre-validated migration version
|
|
987
|
+
* @returns A branded MigrationVersion
|
|
988
|
+
*/
|
|
989
|
+
export function unsafeMigrationVersion(value: number): MigrationVersion {
|
|
990
|
+
return value as MigrationVersion
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/**
|
|
994
|
+
* Creates a QueryId without validation.
|
|
995
|
+
*
|
|
996
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
997
|
+
*
|
|
998
|
+
* @param value - Pre-validated query ID string
|
|
999
|
+
* @returns A branded QueryId
|
|
1000
|
+
*/
|
|
1001
|
+
export function unsafeQueryId(value: string): QueryId {
|
|
1002
|
+
return value as QueryId
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Creates a SnapshotId without validation.
|
|
1007
|
+
*
|
|
1008
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
1009
|
+
*
|
|
1010
|
+
* @param value - Pre-validated snapshot ID string
|
|
1011
|
+
* @returns A branded SnapshotId
|
|
1012
|
+
*/
|
|
1013
|
+
export function unsafeSnapshotId(value: string): SnapshotId {
|
|
1014
|
+
return value as SnapshotId
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Creates a BlockId without validation.
|
|
1019
|
+
*
|
|
1020
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
1021
|
+
*
|
|
1022
|
+
* @param value - Pre-validated block ID string
|
|
1023
|
+
* @returns A branded BlockId
|
|
1024
|
+
*/
|
|
1025
|
+
export function unsafeBlockId(value: string): BlockId {
|
|
1026
|
+
return value as BlockId
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Creates a ShardId without validation.
|
|
1031
|
+
*
|
|
1032
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
1033
|
+
*
|
|
1034
|
+
* @param value - Pre-validated shard ID string
|
|
1035
|
+
* @returns A branded ShardId
|
|
1036
|
+
*/
|
|
1037
|
+
export function unsafeShardId(value: string): ShardId {
|
|
1038
|
+
return value as ShardId
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Creates an IngestId without validation.
|
|
1043
|
+
*
|
|
1044
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
1045
|
+
*
|
|
1046
|
+
* @param value - Pre-validated ingest ID string
|
|
1047
|
+
* @returns A branded IngestId
|
|
1048
|
+
*/
|
|
1049
|
+
export function unsafeIngestId(value: string): IngestId {
|
|
1050
|
+
return value as IngestId
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* Creates a ReplicaId without validation.
|
|
1055
|
+
*
|
|
1056
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
1057
|
+
*
|
|
1058
|
+
* @param value - Pre-validated replica ID string
|
|
1059
|
+
* @returns A branded ReplicaId
|
|
1060
|
+
*/
|
|
1061
|
+
export function unsafeReplicaId(value: string): ReplicaId {
|
|
1062
|
+
return value as ReplicaId
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* Creates a BatchId without validation.
|
|
1067
|
+
*
|
|
1068
|
+
* **WARNING**: Only use this when you are certain the value is valid.
|
|
1069
|
+
*
|
|
1070
|
+
* @param value - Pre-validated batch ID string
|
|
1071
|
+
* @returns A branded BatchId
|
|
1072
|
+
*/
|
|
1073
|
+
export function unsafeBatchId(value: string): BatchId {
|
|
1074
|
+
return value as BatchId
|
|
1075
|
+
}
|