@gscdump/engine 1.4.0 → 1.4.2
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/dist/adapters/duckdb-node.d.mts +7 -0
- package/dist/adapters/duckdb-node.mjs +94 -0
- package/dist/adapters/filesystem.d.mts +1 -1
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/hyparquet.d.mts +4 -3
- package/dist/adapters/hyparquet.mjs +7 -3
- package/dist/adapters/node-harness.d.mts +38 -0
- package/dist/adapters/node-harness.mjs +47 -0
- package/dist/adapters/node.d.mts +4 -100
- package/dist/adapters/node.mjs +4 -240
- package/dist/adapters/parquet-attach.d.mts +23 -0
- package/dist/adapters/parquet-attach.mjs +21 -0
- package/dist/adapters/r2-manifest.d.mts +82 -0
- package/dist/adapters/r2-manifest.mjs +364 -0
- package/dist/adapters/r2.d.mts +1 -1
- package/dist/adapters/read-optional.mjs +15 -0
- package/dist/adapters/snapshot-attach.d.mts +38 -0
- package/dist/adapters/snapshot-attach.mjs +85 -0
- package/dist/analysis-types.d.mts +56 -1
- package/dist/analyzer/define.d.mts +48 -0
- package/dist/analyzer/define.mjs +60 -0
- package/dist/analyzer/dispatch.d.mts +17 -0
- package/dist/analyzer/index.d.mts +4 -14
- package/dist/analyzer/index.mjs +4 -112
- package/dist/analyzer/registry.d.mts +33 -0
- package/dist/analyzer/registry.mjs +49 -0
- package/dist/analyzer/types.d.mts +95 -0
- package/dist/analyzer/types.mjs +5 -0
- package/dist/coerce.d.mts +4 -0
- package/dist/compaction.d.mts +14 -0
- package/dist/{_chunks/parquet-plan.mjs → compaction.mjs} +2 -138
- package/dist/contracts.d.mts +1 -2
- package/dist/{_chunks/schema.d.mts → drizzle-schema.d.mts} +152 -184
- package/dist/{_chunks/schema.mjs → drizzle-schema.mjs} +6 -78
- package/dist/{_chunks/snapshot.d.mts → duckdb.d.mts} +1 -14
- package/dist/duckdb.mjs +207 -0
- package/dist/engine.d.mts +4 -0
- package/dist/engine.mjs +385 -0
- package/dist/entities.d.mts +3 -52
- package/dist/entities.mjs +867 -2
- package/dist/errors.d.mts +114 -1
- package/dist/gc.mjs +92 -0
- package/dist/iceberg/append-sink.d.mts +14 -0
- package/dist/iceberg/append-sink.mjs +142 -0
- package/dist/iceberg/catalog.d.mts +71 -0
- package/dist/iceberg/catalog.mjs +109 -0
- package/dist/iceberg/index.d.mts +4 -13
- package/dist/iceberg/index.mjs +3 -244
- package/dist/iceberg/overwrite-writer.d.mts +161 -0
- package/dist/iceberg/overwrite-writer.mjs +102 -0
- package/dist/iceberg/pyiceberg-runtime.mjs +34 -0
- package/dist/iceberg/schema.d.mts +69 -0
- package/dist/{_chunks/schema2.mjs → iceberg/schema.mjs} +3 -2
- package/dist/index.d.mts +14 -190
- package/dist/index.mjs +10 -645
- package/dist/ingest-accumulator.d.mts +1 -1
- package/dist/ingest.d.mts +1 -1
- package/dist/layout.d.mts +31 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.bitreader.mjs +88 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.blocks.mjs +120 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.context.mjs +1805 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.contextmap.mjs +49 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.dictionary.mjs +984 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.huffman.mjs +266 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.mjs +340 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.prefix.mjs +109 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.streams.mjs +21 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.transform.mjs +190 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/compressors.mjs +7 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/gzip.huffman.mjs +121 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/gzip.mjs +176 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/index.mjs +7 -0
- package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/lz4.mjs +52 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/bloom.mjs +93 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/bytewriter.mjs +91 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/column.mjs +186 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/datapage.mjs +113 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/delta.mjs +111 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/dictionary.mjs +99 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/dremel.mjs +116 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/encoding.mjs +51 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/geospatial.mjs +84 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/index.mjs +7 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/indexes.mjs +31 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/metadata.mjs +138 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/node.mjs +8 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/parquet-writer.mjs +139 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/plain.mjs +68 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/schema.mjs +254 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/snappy.mjs +125 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/splitstream.mjs +38 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/thrift.mjs +79 -0
- package/dist/{_chunks/libs/hyparquet-writer.d.mts → node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/types.d.mts} +2 -2
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/unconvert.mjs +247 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/variant.mjs +321 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/wkb.mjs +79 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/write-rows.mjs +122 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/write.mjs +5 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/bytewriter.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/index.d.mts +10 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/node.d.mts +3 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/parquet-writer.d.mts +2 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/schema.d.mts +2 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/wkb.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/write-rows.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/write.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/assemble.mjs +3 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/bloom.mjs +69 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/column.mjs +8 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/constants.mjs +80 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/convert.mjs +3 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/datapage.mjs +6 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/delta.mjs +2 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/encoding.mjs +2 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/filter.mjs +3 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/geoparquet.mjs +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/index.mjs +7 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/indexes.mjs +5 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/metadata.mjs +7 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/node.mjs +3 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/plain.mjs +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/plan.mjs +5 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/query.mjs +3 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/read.mjs +6 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/rowgroup.mjs +7 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/schema.mjs +54 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/snappy.mjs +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/thrift.mjs +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/types.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/utils.mjs +19 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/variant.mjs +3 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/wkb.mjs +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/xxhash.mjs +68 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/index.d.mts +7 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/indexes.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/metadata.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/node.d.mts +2 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/query.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/read.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/snappy.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/utils.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/assemble.mjs +144 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/bloom.mjs +124 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/column.mjs +127 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/constants.mjs +75 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/convert.mjs +118 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/datapage.mjs +144 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/delta.mjs +65 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/encoding.mjs +76 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/filter.mjs +98 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/geoparquet.mjs +24 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/index.mjs +7 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/indexes.mjs +16 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/metadata.mjs +235 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/node.mjs +7 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/plain.mjs +78 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/plan.mjs +147 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/query.mjs +3 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/read.mjs +106 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/rowgroup.mjs +154 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/schema.mjs +75 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/snappy.mjs +70 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/thrift.mjs +86 -0
- package/dist/{_chunks/libs/hyparquet.d.mts → node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/types.d.mts} +6 -8
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/utils.mjs +31 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/variant.mjs +225 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/wkb.mjs +94 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/xxhash.mjs +68 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/index.d.mts +10 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/indexes.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/metadata.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/node.d.mts +3 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/query.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/read.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/snappy.d.mts +1 -0
- package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/utils.d.mts +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.metadata.mjs +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.read.mjs +4 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.write.mjs +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/file.mjs +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/loadTable.mjs +3 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/rest.mjs +73 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/create.mjs +67 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/delete.mjs +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/fetch.mjs +8 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/index.mjs +13 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/json.mjs +147 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/manifest.mjs +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/metadata.mjs +3 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/prune.mjs +4 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/deletion-vector.mjs +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/puffin.mjs +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/roaring.mjs +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/read.mjs +9 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/s3.mjs +3 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/schema.mjs +76 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sigv4.mjs +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/icebergDataSource.mjs +8 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/icebergQuery.mjs +5 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/whereFilter.mjs +1 -0
- package/dist/{_chunks/libs/icebird.d.mts → node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/types.d.mts} +5 -33
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/utils.mjs +8 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/commit.mjs +5 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/conversions.mjs +19 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/delete-file.mjs +3 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/geospatial.mjs +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/manifest-list.mjs +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/manifest.mjs +3 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/parquet.mjs +5 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/partition.mjs +75 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/rewrite.mjs +10 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/serde.mjs +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/snapshot.mjs +5 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/sort.mjs +3 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage-deletion-vector.mjs +11 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage-position-delete.mjs +8 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage.mjs +10 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stats.mjs +4 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/transform.mjs +60 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/write.mjs +45 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/catalog/file.d.mts +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/catalog/rest.d.mts +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/create.d.mts +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/fetch.d.mts +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/index.d.mts +13 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/manifest.d.mts +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/metadata.d.mts +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/read.d.mts +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/s3.d.mts +1 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/sql/icebergDataSource.d.mts +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/sql/icebergQuery.d.mts +2 -0
- package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/write/write.d.mts +32 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/ast.d.mts +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/backend/dataSource.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/accumulator.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/aggregates.mjs +10 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/execute.mjs +15 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/join.mjs +5 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/scanColumn.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/sort.mjs +5 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/streamingAggregate.mjs +9 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/utils.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/window.mjs +5 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/yield.mjs +17 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/alias.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/binary.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/date.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/evaluate.mjs +15 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/math.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/regexp.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/strings.mjs +3 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/index.mjs +9 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/expression.mjs +6 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/extractTables.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/functions.mjs +5 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/joins.mjs +7 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/parse.mjs +10 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/primary.mjs +8 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/state.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/tokenize.mjs +3 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/types.d.mts +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/columns.mjs +3 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/plan.mjs +7 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/types.d.mts +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/bbox.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/equality.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/operations.mjs +5 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/pointRelations.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/primitives.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/segments.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/spatial.mjs +6 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/wkt.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/types.d.mts +3 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/aggregates.mjs +3 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/executionErrors.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/functions.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/keywords.mjs +1 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/parseErrors.mjs +2 -0
- package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/tables.mjs +2 -0
- package/dist/parquet-plan.d.mts +15 -0
- package/dist/parquet-plan.mjs +139 -0
- package/dist/parquet-pushdown.mjs +58 -0
- package/dist/period/index.d.mts +52 -1
- package/dist/planner.d.mts +2 -14
- package/dist/planner.mjs +2 -1
- package/dist/profile.d.mts +21 -0
- package/dist/profile.mjs +27 -0
- package/dist/query-dim.d.mts +54 -0
- package/dist/query-dim.mjs +91 -0
- package/dist/report/define.d.mts +8 -0
- package/dist/report/define.mjs +15 -0
- package/dist/report/hash.d.mts +13 -0
- package/dist/report/hash.mjs +29 -0
- package/dist/report/index.d.mts +4 -170
- package/dist/report/index.mjs +3 -55
- package/dist/report/registry.d.mts +18 -0
- package/dist/report/registry.mjs +14 -0
- package/dist/report/types.d.mts +139 -0
- package/dist/resolver/adapter.d.mts +13 -0
- package/dist/resolver/adapter.mjs +27 -0
- package/dist/resolver/canonical-source.d.mts +5 -0
- package/dist/resolver/canonical-source.mjs +14 -0
- package/dist/resolver/compile.d.mts +15 -0
- package/dist/resolver/compile.mjs +396 -0
- package/dist/resolver/datasets.d.mts +16 -0
- package/dist/resolver/datasets.mjs +159 -0
- package/dist/resolver/extras-overlay.d.mts +37 -0
- package/dist/resolver/extras-overlay.mjs +17 -0
- package/dist/resolver/filter-utils.d.mts +10 -0
- package/dist/resolver/filter-utils.mjs +59 -0
- package/dist/resolver/fragments.d.mts +60 -0
- package/dist/resolver/fragments.mjs +206 -0
- package/dist/resolver/index.d.mts +11 -371
- package/dist/resolver/index.mjs +10 -1
- package/dist/resolver/pg-adapter.d.mts +56 -0
- package/dist/resolver/pg-adapter.mjs +112 -0
- package/dist/resolver/run-query.d.mts +172 -0
- package/dist/resolver/run-query.mjs +241 -0
- package/dist/resolver/schema-drift.d.mts +15 -0
- package/dist/resolver/schema-drift.mjs +12 -0
- package/dist/rollups.d.mts +4 -4
- package/dist/rollups.mjs +3 -2
- package/dist/schedule.mjs +100 -0
- package/dist/schema.d.mts +34 -1
- package/dist/schema.mjs +78 -1
- package/dist/sink-node.d.mts +1 -159
- package/dist/sink-node.mjs +1 -133
- package/dist/sink.d.mts +125 -0
- package/dist/sinks/in-memory-sink.d.mts +25 -0
- package/dist/sinks/in-memory-sink.mjs +61 -0
- package/dist/sinks/index.d.mts +2 -0
- package/dist/sinks/index.mjs +2 -0
- package/dist/snapshot.d.mts +14 -0
- package/dist/source/attached-table.d.mts +45 -0
- package/dist/source/attached-table.mjs +55 -0
- package/dist/source/create-sql-query-source.d.mts +24 -0
- package/dist/source/create-sql-query-source.mjs +28 -0
- package/dist/source/index.d.mts +6 -66
- package/dist/source/index.mjs +9 -82
- package/dist/source/source-types.d.mts +49 -0
- package/dist/{_chunks/storage.d.mts → storage.d.mts} +4 -14
- package/dist/sync-config.d.mts +36 -0
- package/dist/sync-config.mjs +98 -0
- package/dist/vendor/hysnappy-purejs.mjs +12 -1
- package/package.json +9 -4
- package/dist/_chunks/analysis-types.d.mts +0 -57
- package/dist/_chunks/contracts.d.mts +0 -1
- package/dist/_chunks/engine.mjs +0 -731
- package/dist/_chunks/entities.mjs +0 -967
- package/dist/_chunks/errors.d.mts +0 -115
- package/dist/_chunks/index.d.mts +0 -53
- package/dist/_chunks/libs/hyparquet-compressors.mjs +0 -2796
- package/dist/_chunks/libs/hyparquet-writer.mjs +0 -2524
- package/dist/_chunks/libs/hyparquet.mjs +0 -2596
- package/dist/_chunks/libs/icebird.mjs +0 -564
- package/dist/_chunks/registry.d.mts +0 -213
- package/dist/_chunks/resolver.mjs +0 -1220
- package/dist/_chunks/sink.d.mts +0 -257
- /package/dist/{_chunks → analyzer}/dispatch.mjs +0 -0
- /package/dist/{_chunks/coerce.mjs → coerce.mjs} +0 -0
- /package/dist/{_chunks/layout.mjs → layout.mjs} +0 -0
- /package/dist/{_chunks/manifest-store-utils.mjs → manifest-store-utils.mjs} +0 -0
- /package/dist/{_chunks/libs/fzstd.mjs → node_modules/.pnpm/fzstd@0.1.1/node_modules/fzstd/esm/index.mjs} +0 -0
- /package/dist/{_chunks → resolver}/types.d.mts +0 -0
- /package/dist/{_chunks/schedule.d.mts → schedule.d.mts} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ManifestStore, TableName } from "../storage.mjs";
|
|
2
|
+
interface R2ObjectMetadata {
|
|
3
|
+
etag: string;
|
|
4
|
+
}
|
|
5
|
+
interface R2ObjectBody extends R2ObjectMetadata {
|
|
6
|
+
text: () => Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
interface R2ListResult {
|
|
9
|
+
objects: Array<{
|
|
10
|
+
key: string;
|
|
11
|
+
}>;
|
|
12
|
+
truncated: boolean;
|
|
13
|
+
cursor?: string;
|
|
14
|
+
}
|
|
15
|
+
interface R2ConditionalPutOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Workers-binding-style precondition. `etagMatches` rejects with `null`
|
|
18
|
+
* return on mismatch; `etagDoesNotMatch: '*'` rejects if the key exists.
|
|
19
|
+
*/
|
|
20
|
+
onlyIf?: {
|
|
21
|
+
etagMatches?: string;
|
|
22
|
+
etagDoesNotMatch?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Minimal Cloudflare R2 binding shape needed for the manifest CAS loop.
|
|
27
|
+
* Structurally compatible with Cloudflare's `R2Bucket` Workers API.
|
|
28
|
+
*/
|
|
29
|
+
interface R2ManifestBucketLike {
|
|
30
|
+
get: (key: string) => Promise<R2ObjectBody | null>;
|
|
31
|
+
put: (key: string, bytes: string | Uint8Array, options?: R2ConditionalPutOptions) => Promise<R2ObjectMetadata | null>;
|
|
32
|
+
list: (options?: {
|
|
33
|
+
prefix?: string;
|
|
34
|
+
cursor?: string;
|
|
35
|
+
limit?: number;
|
|
36
|
+
}) => Promise<R2ListResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Bulk delete. Required by {@link ManifestStore.purgeTenant}. Cloudflare's
|
|
39
|
+
* `R2Bucket.delete` accepts a single key or a string[] batch; both shapes
|
|
40
|
+
* work here.
|
|
41
|
+
*/
|
|
42
|
+
delete: (keys: string | string[]) => Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* CAS lifecycle events emitted by the manifest store. Consumers wire these
|
|
46
|
+
* into metrics (prom-client, console.table, the contention harness) to
|
|
47
|
+
* measure rejection rate and latency under real R2 load.
|
|
48
|
+
*/
|
|
49
|
+
type R2ManifestEvent = {
|
|
50
|
+
kind: 'cas-attempt';
|
|
51
|
+
siteId: string;
|
|
52
|
+
table: TableName;
|
|
53
|
+
attempt: number;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'cas-rejected';
|
|
56
|
+
siteId: string;
|
|
57
|
+
table: TableName;
|
|
58
|
+
attempt: number;
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'cas-committed';
|
|
61
|
+
siteId: string;
|
|
62
|
+
table: TableName;
|
|
63
|
+
attempts: number;
|
|
64
|
+
};
|
|
65
|
+
interface CreateR2ManifestStoreOptions {
|
|
66
|
+
bucket: R2ManifestBucketLike;
|
|
67
|
+
/** Tenant scope. All shard keys are prefixed `u_<userId>/manifest/...`. */
|
|
68
|
+
userId: string;
|
|
69
|
+
/** Override the snapshot version-id generator. Defaults to `${ts}-${random}`. */
|
|
70
|
+
newSnapshotId?: () => string;
|
|
71
|
+
now?: () => number;
|
|
72
|
+
/** Maximum CAS retries before giving up. Defaults to 8. */
|
|
73
|
+
maxRetries?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Optional telemetry hook. Fired synchronously from the CAS loop on each
|
|
76
|
+
* attempt, rejection, and successful commit. Must not throw; exceptions
|
|
77
|
+
* propagate and will fail the mutation.
|
|
78
|
+
*/
|
|
79
|
+
onEvent?: (event: R2ManifestEvent) => void;
|
|
80
|
+
}
|
|
81
|
+
declare function createR2ManifestStore(opts: CreateR2ManifestStoreOptions): ManifestStore;
|
|
82
|
+
export { CreateR2ManifestStoreOptions, R2ManifestBucketLike, R2ManifestEvent, createR2ManifestStore };
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { engineErrorToException, engineErrors } from "../errors.mjs";
|
|
2
|
+
import { inferSearchType } from "../layout.mjs";
|
|
3
|
+
import { matchesManifestEntryFilter, matchesSyncStateFilter, matchesWatermarkFilter } from "../manifest-store-utils.mjs";
|
|
4
|
+
import { err, ok, unwrapResult } from "gscdump/result";
|
|
5
|
+
const SHARD_RE = /^u_[^/]+\/manifest\/(?<siteId>[^/]+)\/(?<table>[^/]+)\/HEAD$/;
|
|
6
|
+
const CAS_BACKOFF_BASE_MS = 5;
|
|
7
|
+
const CAS_BACKOFF_CAP_MS = 250;
|
|
8
|
+
const SHARD_IO_CONCURRENCY = 8;
|
|
9
|
+
const R2_DELETE_BATCH_SIZE = 1e3;
|
|
10
|
+
async function casBackoff(attempt) {
|
|
11
|
+
const ceil = Math.min(CAS_BACKOFF_CAP_MS, CAS_BACKOFF_BASE_MS * 2 ** attempt);
|
|
12
|
+
await new Promise((resolve) => setTimeout(resolve, Math.random() * ceil));
|
|
13
|
+
}
|
|
14
|
+
async function mapWithConcurrency(items, concurrency, fn) {
|
|
15
|
+
if (items.length === 0) return [];
|
|
16
|
+
const workerCount = Math.max(1, Math.min(items.length, Math.floor(concurrency)));
|
|
17
|
+
const results = Array.from({ length: items.length }, () => void 0);
|
|
18
|
+
let nextIndex = 0;
|
|
19
|
+
async function worker() {
|
|
20
|
+
while (true) {
|
|
21
|
+
const index = nextIndex++;
|
|
22
|
+
if (index >= items.length) return;
|
|
23
|
+
results[index] = await fn(items[index], index);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
await Promise.all(Array.from({ length: workerCount }, worker));
|
|
27
|
+
return results;
|
|
28
|
+
}
|
|
29
|
+
function defaultSnapshotId() {
|
|
30
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
|
31
|
+
}
|
|
32
|
+
function shardPrefix(userId, siteId, table) {
|
|
33
|
+
return `u_${userId}/manifest/${siteId}/${table}/`;
|
|
34
|
+
}
|
|
35
|
+
function headKey(userId, siteId, table) {
|
|
36
|
+
return `${shardPrefix(userId, siteId, table)}HEAD`;
|
|
37
|
+
}
|
|
38
|
+
function snapshotKey(userId, siteId, table, snapshotId) {
|
|
39
|
+
return `${shardPrefix(userId, siteId, table)}v${snapshotId}.json`;
|
|
40
|
+
}
|
|
41
|
+
function emptySnapshot() {
|
|
42
|
+
return {
|
|
43
|
+
version: 1,
|
|
44
|
+
entries: [],
|
|
45
|
+
watermarks: [],
|
|
46
|
+
syncStates: []
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function shardScopesFromEntries(entries) {
|
|
50
|
+
const out = /* @__PURE__ */ new Set();
|
|
51
|
+
for (const e of entries) {
|
|
52
|
+
if (e.siteId === void 0) throw new Error("R2 manifest store requires entries to carry siteId; cross-site entries are unshardable");
|
|
53
|
+
out.add(`${e.siteId}\0${e.table}`);
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
function createR2ManifestStore(opts) {
|
|
58
|
+
const { bucket, userId } = opts;
|
|
59
|
+
const newSnapshotId = opts.newSnapshotId ?? defaultSnapshotId;
|
|
60
|
+
const now = opts.now ?? (() => Date.now());
|
|
61
|
+
const maxRetries = opts.maxRetries ?? 16;
|
|
62
|
+
const onEvent = opts.onEvent;
|
|
63
|
+
async function readShard(siteId, table) {
|
|
64
|
+
const head = await bucket.get(headKey(userId, siteId, table));
|
|
65
|
+
if (!head) return {
|
|
66
|
+
snapshot: emptySnapshot(),
|
|
67
|
+
headEtag: void 0
|
|
68
|
+
};
|
|
69
|
+
const snapshotId = (await head.text()).trim();
|
|
70
|
+
if (!snapshotId) return {
|
|
71
|
+
snapshot: emptySnapshot(),
|
|
72
|
+
headEtag: head.etag
|
|
73
|
+
};
|
|
74
|
+
const snap = await bucket.get(snapshotKey(userId, siteId, table, snapshotId));
|
|
75
|
+
if (!snap) return {
|
|
76
|
+
snapshot: emptySnapshot(),
|
|
77
|
+
headEtag: head.etag
|
|
78
|
+
};
|
|
79
|
+
const parsed = JSON.parse(await snap.text());
|
|
80
|
+
if (parsed.version !== 1) throw new Error(`unsupported manifest snapshot version: ${parsed.version}`);
|
|
81
|
+
return {
|
|
82
|
+
snapshot: parsed,
|
|
83
|
+
headEtag: head.etag
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async function writeShardResult(siteId, table, snapshot, headEtag, attempt) {
|
|
87
|
+
const id = newSnapshotId();
|
|
88
|
+
const snapKey = snapshotKey(userId, siteId, table, id);
|
|
89
|
+
await bucket.put(snapKey, JSON.stringify(snapshot));
|
|
90
|
+
const conditional = headEtag ? { onlyIf: { etagMatches: headEtag } } : { onlyIf: { etagDoesNotMatch: "*" } };
|
|
91
|
+
return await bucket.put(headKey(userId, siteId, table), id, conditional) !== null ? ok(void 0) : err(engineErrors.manifestCasRoundLost(siteId, table, attempt));
|
|
92
|
+
}
|
|
93
|
+
async function mutateShardResult(siteId, table, mutate) {
|
|
94
|
+
let attempt = 0;
|
|
95
|
+
while (attempt < maxRetries) {
|
|
96
|
+
onEvent?.({
|
|
97
|
+
kind: "cas-attempt",
|
|
98
|
+
siteId,
|
|
99
|
+
table,
|
|
100
|
+
attempt
|
|
101
|
+
});
|
|
102
|
+
const { snapshot, headEtag } = await readShard(siteId, table);
|
|
103
|
+
await mutate(snapshot);
|
|
104
|
+
const round = await writeShardResult(siteId, table, snapshot, headEtag, attempt);
|
|
105
|
+
if (round.ok) {
|
|
106
|
+
onEvent?.({
|
|
107
|
+
kind: "cas-committed",
|
|
108
|
+
siteId,
|
|
109
|
+
table,
|
|
110
|
+
attempts: attempt + 1
|
|
111
|
+
});
|
|
112
|
+
return round;
|
|
113
|
+
}
|
|
114
|
+
onEvent?.({
|
|
115
|
+
kind: "cas-rejected",
|
|
116
|
+
siteId,
|
|
117
|
+
table,
|
|
118
|
+
attempt
|
|
119
|
+
});
|
|
120
|
+
attempt++;
|
|
121
|
+
if (attempt < maxRetries) await casBackoff(attempt);
|
|
122
|
+
}
|
|
123
|
+
return err(engineErrors.manifestCasExhausted(siteId, table, maxRetries));
|
|
124
|
+
}
|
|
125
|
+
async function mutateShard(siteId, table, mutate) {
|
|
126
|
+
return unwrapResult(await mutateShardResult(siteId, table, mutate), engineErrorToException);
|
|
127
|
+
}
|
|
128
|
+
async function listShards(siteId) {
|
|
129
|
+
const shards = [];
|
|
130
|
+
let cursor;
|
|
131
|
+
const prefix = siteId === void 0 ? `u_${userId}/manifest/` : `u_${userId}/manifest/${siteId}/`;
|
|
132
|
+
do {
|
|
133
|
+
const res = await bucket.list({
|
|
134
|
+
prefix,
|
|
135
|
+
cursor,
|
|
136
|
+
limit: 1e3
|
|
137
|
+
});
|
|
138
|
+
for (const obj of res.objects) {
|
|
139
|
+
const m = SHARD_RE.exec(obj.key);
|
|
140
|
+
if (m?.groups) shards.push({
|
|
141
|
+
siteId: m.groups.siteId,
|
|
142
|
+
table: m.groups.table
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
cursor = res.truncated ? res.cursor : void 0;
|
|
146
|
+
} while (cursor);
|
|
147
|
+
return shards;
|
|
148
|
+
}
|
|
149
|
+
async function shardsForFilter(filter) {
|
|
150
|
+
if (filter.siteId !== void 0 && filter.table !== void 0) return [{
|
|
151
|
+
siteId: filter.siteId,
|
|
152
|
+
table: filter.table
|
|
153
|
+
}];
|
|
154
|
+
return (await listShards(filter.siteId)).filter((s) => (filter.siteId === void 0 || s.siteId === filter.siteId) && (filter.table === void 0 || s.table === filter.table));
|
|
155
|
+
}
|
|
156
|
+
function assertScopedUser(got, op) {
|
|
157
|
+
if (got !== userId) throw new Error(`${op}: R2 manifest store is scoped to userId=${userId}, got ${got}`);
|
|
158
|
+
}
|
|
159
|
+
async function readEntriesAcrossShards(filter, includeRetired) {
|
|
160
|
+
assertScopedUser(filter.userId, includeRetired ? "listAll" : "listLive");
|
|
161
|
+
return (await mapWithConcurrency(await shardsForFilter(filter), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
162
|
+
const { snapshot } = await readShard(siteId, table);
|
|
163
|
+
const entries = [];
|
|
164
|
+
for (const entry of snapshot.entries) {
|
|
165
|
+
if (!includeRetired && entry.retiredAt !== void 0) continue;
|
|
166
|
+
if (matchesManifestEntryFilter(entry, filter, { ignoreUserId: true })) entries.push(entry);
|
|
167
|
+
}
|
|
168
|
+
return entries;
|
|
169
|
+
})).flat();
|
|
170
|
+
}
|
|
171
|
+
function groupBySiteTable(entries) {
|
|
172
|
+
const out = /* @__PURE__ */ new Map();
|
|
173
|
+
for (const e of entries) {
|
|
174
|
+
const key = `${e.siteId}\0${e.table}`;
|
|
175
|
+
if (!out.has(key)) out.set(key, []);
|
|
176
|
+
out.get(key).push(e);
|
|
177
|
+
}
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
async function registerVersionsImpl(newEntries, superseding) {
|
|
181
|
+
if (newEntries.length === 0 && (!superseding || superseding.length === 0)) return;
|
|
182
|
+
const supersededAt = newEntries[0]?.createdAt ?? now();
|
|
183
|
+
const byShard = /* @__PURE__ */ new Map();
|
|
184
|
+
function bucket(entry, kind) {
|
|
185
|
+
assertScopedUser(entry.userId, "registerVersions");
|
|
186
|
+
if (entry.siteId === void 0) throw new Error("R2 manifest store requires entries to carry siteId");
|
|
187
|
+
const key = `${entry.siteId}\0${entry.table}`;
|
|
188
|
+
let bag = byShard.get(key);
|
|
189
|
+
if (!bag) {
|
|
190
|
+
bag = {
|
|
191
|
+
newEntries: [],
|
|
192
|
+
superseding: []
|
|
193
|
+
};
|
|
194
|
+
byShard.set(key, bag);
|
|
195
|
+
}
|
|
196
|
+
if (kind === "new") bag.newEntries.push(entry);
|
|
197
|
+
else bag.superseding.push(entry);
|
|
198
|
+
}
|
|
199
|
+
for (const e of newEntries) bucket(e, "new");
|
|
200
|
+
if (superseding) for (const e of superseding) bucket(e, "super");
|
|
201
|
+
await mapWithConcurrency([...byShard], SHARD_IO_CONCURRENCY, async ([shardKey, { newEntries: news, superseding: supers }]) => {
|
|
202
|
+
const [siteId, table] = shardKey.split("\0");
|
|
203
|
+
await mutateShard(siteId, table, (snap) => {
|
|
204
|
+
const byObjectKey = new Map(snap.entries.map((e) => [e.objectKey, e]));
|
|
205
|
+
for (const s of supers) {
|
|
206
|
+
const existing = byObjectKey.get(s.objectKey);
|
|
207
|
+
if (existing && existing.retiredAt === void 0) byObjectKey.set(s.objectKey, {
|
|
208
|
+
...existing,
|
|
209
|
+
retiredAt: supersededAt
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
for (const n of news) byObjectKey.set(n.objectKey, n);
|
|
213
|
+
snap.entries = Array.from(byObjectKey.values());
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
async listLive(filter) {
|
|
219
|
+
return readEntriesAcrossShards(filter, false);
|
|
220
|
+
},
|
|
221
|
+
async listAll(filter) {
|
|
222
|
+
return readEntriesAcrossShards(filter, true);
|
|
223
|
+
},
|
|
224
|
+
async registerVersion(entry, superseding) {
|
|
225
|
+
return registerVersionsImpl([entry], superseding);
|
|
226
|
+
},
|
|
227
|
+
async registerVersions(entries, superseding) {
|
|
228
|
+
shardScopesFromEntries(entries);
|
|
229
|
+
return registerVersionsImpl(entries, superseding);
|
|
230
|
+
},
|
|
231
|
+
async listRetired(olderThan) {
|
|
232
|
+
return (await mapWithConcurrency(await listShards(), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
233
|
+
const { snapshot } = await readShard(siteId, table);
|
|
234
|
+
const retired = [];
|
|
235
|
+
for (const e of snapshot.entries) if (e.retiredAt !== void 0 && e.retiredAt <= olderThan) retired.push(e);
|
|
236
|
+
return retired;
|
|
237
|
+
})).flat();
|
|
238
|
+
},
|
|
239
|
+
async delete(toDelete) {
|
|
240
|
+
await mapWithConcurrency([...groupBySiteTable(toDelete)], SHARD_IO_CONCURRENCY, async ([shardKey, entries]) => {
|
|
241
|
+
const [siteId, table] = shardKey.split("\0");
|
|
242
|
+
await mutateShard(siteId, table, (snap) => {
|
|
243
|
+
const drop = new Set(entries.map((e) => e.objectKey));
|
|
244
|
+
snap.entries = snap.entries.filter((e) => !drop.has(e.objectKey));
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
},
|
|
248
|
+
async getWatermarks(filter) {
|
|
249
|
+
assertScopedUser(filter.userId, "getWatermarks");
|
|
250
|
+
return (await mapWithConcurrency(await shardsForFilter(filter), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
251
|
+
const { snapshot } = await readShard(siteId, table);
|
|
252
|
+
const watermarks = [];
|
|
253
|
+
for (const w of snapshot.watermarks) if (matchesWatermarkFilter(w, filter, { ignoreUserId: true })) watermarks.push(w);
|
|
254
|
+
return watermarks;
|
|
255
|
+
})).flat();
|
|
256
|
+
},
|
|
257
|
+
async bumpWatermark(scope, date, at) {
|
|
258
|
+
assertScopedUser(scope.userId, "bumpWatermark");
|
|
259
|
+
if (scope.siteId === void 0) throw new Error("R2 manifest store requires watermarks to carry siteId");
|
|
260
|
+
const ts = at ?? now();
|
|
261
|
+
const scopeSearchType = inferSearchType(scope);
|
|
262
|
+
await mutateShard(scope.siteId, scope.table, (snap) => {
|
|
263
|
+
const idx = snap.watermarks.findIndex((w) => w.userId === userId && w.siteId === scope.siteId && w.table === scope.table && inferSearchType(w) === scopeSearchType);
|
|
264
|
+
if (idx === -1) {
|
|
265
|
+
snap.watermarks.push({
|
|
266
|
+
userId,
|
|
267
|
+
siteId: scope.siteId,
|
|
268
|
+
table: scope.table,
|
|
269
|
+
...scope.searchType !== void 0 ? { searchType: scope.searchType } : {},
|
|
270
|
+
newestDateSynced: date,
|
|
271
|
+
oldestDateSynced: date,
|
|
272
|
+
lastSyncAt: ts
|
|
273
|
+
});
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const w = snap.watermarks[idx];
|
|
277
|
+
const newest = date > w.newestDateSynced ? date : w.newestDateSynced;
|
|
278
|
+
const oldest = date < w.oldestDateSynced ? date : w.oldestDateSynced;
|
|
279
|
+
const lastSyncAt = ts > w.lastSyncAt ? ts : w.lastSyncAt;
|
|
280
|
+
snap.watermarks[idx] = {
|
|
281
|
+
...w,
|
|
282
|
+
newestDateSynced: newest,
|
|
283
|
+
oldestDateSynced: oldest,
|
|
284
|
+
lastSyncAt
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
async getSyncStates(filter) {
|
|
289
|
+
assertScopedUser(filter.userId, "getSyncStates");
|
|
290
|
+
return (await mapWithConcurrency(await shardsForFilter(filter), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
291
|
+
const { snapshot } = await readShard(siteId, table);
|
|
292
|
+
const states = [];
|
|
293
|
+
for (const s of snapshot.syncStates) if (matchesSyncStateFilter(s, filter, { ignoreUserId: true })) states.push(s);
|
|
294
|
+
return states;
|
|
295
|
+
})).flat();
|
|
296
|
+
},
|
|
297
|
+
async setSyncState(scope, state, detail) {
|
|
298
|
+
assertScopedUser(scope.userId, "setSyncState");
|
|
299
|
+
if (scope.siteId === void 0) throw new Error("R2 manifest store requires sync states to carry siteId");
|
|
300
|
+
const at = detail?.at ?? now();
|
|
301
|
+
const scopeSearchType = inferSearchType(scope);
|
|
302
|
+
await mutateShard(scope.siteId, scope.table, (snap) => {
|
|
303
|
+
const idx = snap.syncStates.findIndex((s) => s.userId === userId && s.siteId === scope.siteId && s.table === scope.table && s.date === scope.date && inferSearchType(s) === scopeSearchType);
|
|
304
|
+
if (idx === -1) {
|
|
305
|
+
snap.syncStates.push({
|
|
306
|
+
userId,
|
|
307
|
+
siteId: scope.siteId,
|
|
308
|
+
table: scope.table,
|
|
309
|
+
date: scope.date,
|
|
310
|
+
state,
|
|
311
|
+
updatedAt: at,
|
|
312
|
+
attempts: 1,
|
|
313
|
+
error: detail?.error,
|
|
314
|
+
...scope.searchType !== void 0 ? { searchType: scope.searchType } : {}
|
|
315
|
+
});
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const prev = snap.syncStates[idx];
|
|
319
|
+
const attempts = state === "inflight" && prev.state !== "inflight" ? prev.attempts + 1 : prev.attempts;
|
|
320
|
+
const error = state === "done" ? void 0 : detail?.error ?? prev.error;
|
|
321
|
+
snap.syncStates[idx] = {
|
|
322
|
+
...prev,
|
|
323
|
+
state,
|
|
324
|
+
updatedAt: at,
|
|
325
|
+
attempts,
|
|
326
|
+
error
|
|
327
|
+
};
|
|
328
|
+
});
|
|
329
|
+
},
|
|
330
|
+
async withLock(_scope, fn) {
|
|
331
|
+
return fn();
|
|
332
|
+
},
|
|
333
|
+
async purgeTenant(filter) {
|
|
334
|
+
if (filter.userId !== userId) throw new Error(`purgeTenant: store is scoped to userId=${userId}, got ${filter.userId}`);
|
|
335
|
+
const purged = await mapWithConcurrency(await shardsForFilter({ siteId: filter.siteId }), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
336
|
+
const { snapshot } = await readShard(siteId, table);
|
|
337
|
+
const prefix = shardPrefix(userId, siteId, table);
|
|
338
|
+
const keys = [];
|
|
339
|
+
let cursor;
|
|
340
|
+
do {
|
|
341
|
+
const res = await bucket.list({
|
|
342
|
+
prefix,
|
|
343
|
+
cursor,
|
|
344
|
+
limit: 1e3
|
|
345
|
+
});
|
|
346
|
+
for (const obj of res.objects) keys.push(obj.key);
|
|
347
|
+
cursor = res.truncated ? res.cursor : void 0;
|
|
348
|
+
} while (cursor);
|
|
349
|
+
for (let offset = 0; offset < keys.length; offset += R2_DELETE_BATCH_SIZE) await bucket.delete(keys.slice(offset, offset + R2_DELETE_BATCH_SIZE));
|
|
350
|
+
return {
|
|
351
|
+
entriesRemoved: snapshot.entries.length,
|
|
352
|
+
watermarksRemoved: snapshot.watermarks.length,
|
|
353
|
+
syncStatesRemoved: snapshot.syncStates.length
|
|
354
|
+
};
|
|
355
|
+
});
|
|
356
|
+
return {
|
|
357
|
+
entriesRemoved: purged.reduce((sum, result) => sum + result.entriesRemoved, 0),
|
|
358
|
+
watermarksRemoved: purged.reduce((sum, result) => sum + result.watermarksRemoved, 0),
|
|
359
|
+
syncStatesRemoved: purged.reduce((sum, result) => sum + result.syncStatesRemoved, 0)
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
export { createR2ManifestStore };
|
package/dist/adapters/r2.d.mts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function isMissingKeyError(e) {
|
|
2
|
+
if (typeof e !== "object" || e === null) return false;
|
|
3
|
+
if (e.code === "ENOENT") return true;
|
|
4
|
+
if (e.name === "NotFoundError") return true;
|
|
5
|
+
const message = e.message;
|
|
6
|
+
if (typeof message !== "string") return false;
|
|
7
|
+
return /\bnot found\b|\bENOENT\b|\bmissing key\b/i.test(message);
|
|
8
|
+
}
|
|
9
|
+
async function readOptional(ds, key, signal) {
|
|
10
|
+
return await ds.read(key, void 0, signal).catch((e) => {
|
|
11
|
+
if (isMissingKeyError(e)) return void 0;
|
|
12
|
+
throw e;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { isMissingKeyError, readOptional };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SnapshotIndex } from "../snapshot.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Runs arbitrary SQL and returns rows as plain objects. Caller supplies
|
|
4
|
+
* this so the function works with AsyncDuckDB (browser DuckDB-WASM) or
|
|
5
|
+
* @duckdb/node-api (Node) without coupling to either.
|
|
6
|
+
*/
|
|
7
|
+
type SnapshotQueryRunner = (sql: string) => Promise<Array<Record<string, unknown>>>;
|
|
8
|
+
interface AttachSnapshotOptions {
|
|
9
|
+
/** Index produced by the builder. */
|
|
10
|
+
index: SnapshotIndex;
|
|
11
|
+
/**
|
|
12
|
+
* Map from filename (`cold-YYYY-MM.duckdb`, `hot.duckdb`) to an HTTPS
|
|
13
|
+
* URL (typically a pre-signed R2 URL). Must contain an entry for every
|
|
14
|
+
* cold month in `index.cold` and — if `index.hot` — for `hot.duckdb`.
|
|
15
|
+
*/
|
|
16
|
+
attachUrls: Record<string, string>;
|
|
17
|
+
/** Schema the unified views land under. Default `main`. */
|
|
18
|
+
schema?: string;
|
|
19
|
+
/**
|
|
20
|
+
* DuckDB httpfs can error with "Server sent back more data than expected"
|
|
21
|
+
* against some proxies; `force_download=true` sidesteps it. Default true.
|
|
22
|
+
*/
|
|
23
|
+
forceDownload?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface AttachSnapshotResult {
|
|
26
|
+
schema: string;
|
|
27
|
+
/** Aliases we ATTACH'd — e.g. ['cold_2024_09', 'cold_2024_10', 'hot']. */
|
|
28
|
+
aliases: string[];
|
|
29
|
+
/** Table names with a UNION view created under `schema`. */
|
|
30
|
+
tables: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Turns a filename like `cold-2024-09.duckdb` into a valid SQL identifier
|
|
34
|
+
* `cold_2024_09`. `hot.duckdb` → `hot`.
|
|
35
|
+
*/
|
|
36
|
+
declare function snapshotAlias(fileName: string): string;
|
|
37
|
+
declare function attachSnapshotIndex(runner: SnapshotQueryRunner, opts: AttachSnapshotOptions): Promise<AttachSnapshotResult>;
|
|
38
|
+
export { AttachSnapshotOptions, AttachSnapshotResult, SnapshotQueryRunner, attachSnapshotIndex, snapshotAlias };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { engineErrors } from "../errors.mjs";
|
|
2
|
+
import { err, ok, unwrapResult } from "gscdump/result";
|
|
3
|
+
const YEAR_MONTH_RE = /^\d{4}-\d{2}$/;
|
|
4
|
+
const SCHEMA_IDENT_RE = /^[A-Z_][\w$]*$/i;
|
|
5
|
+
const COLD_FILENAME_RE = /^cold-(\d{4}-\d{2})\.duckdb$/;
|
|
6
|
+
function snapshotAlias(fileName) {
|
|
7
|
+
if (fileName === "hot.duckdb") return "hot";
|
|
8
|
+
const m = fileName.match(COLD_FILENAME_RE);
|
|
9
|
+
if (!m?.[1]) throw new TypeError(`snapshotAlias: unrecognised filename ${JSON.stringify(fileName)}`);
|
|
10
|
+
return `cold_${m[1].replace("-", "_")}`;
|
|
11
|
+
}
|
|
12
|
+
const SNAPSHOT_TYPE_ERROR_KINDS = /* @__PURE__ */ new Set([
|
|
13
|
+
"invalid-snapshot-filename",
|
|
14
|
+
"unsupported-snapshot-index-version",
|
|
15
|
+
"invalid-schema-identifier",
|
|
16
|
+
"invalid-year-month"
|
|
17
|
+
]);
|
|
18
|
+
function snapshotAttachErrorToException(error) {
|
|
19
|
+
const exception = SNAPSHOT_TYPE_ERROR_KINDS.has(error.kind) ? new TypeError(error.message) : new Error(error.message);
|
|
20
|
+
exception.engineError = error;
|
|
21
|
+
return exception;
|
|
22
|
+
}
|
|
23
|
+
async function attachSnapshotIndexResult(runner, opts) {
|
|
24
|
+
const { index, attachUrls } = opts;
|
|
25
|
+
const schema = opts.schema ?? "main";
|
|
26
|
+
const forceDownload = opts.forceDownload !== false;
|
|
27
|
+
if (index?.version !== 1) return err(engineErrors.unsupportedSnapshotIndexVersion(index?.version));
|
|
28
|
+
if (!SCHEMA_IDENT_RE.test(schema)) return err(engineErrors.invalidSchemaIdentifier(schema));
|
|
29
|
+
for (const ym of index.cold) if (!YEAR_MONTH_RE.test(ym)) return err(engineErrors.invalidYearMonth(ym));
|
|
30
|
+
await runner("LOAD httpfs").catch(() => void 0);
|
|
31
|
+
if (forceDownload) await runner("SET force_download=true");
|
|
32
|
+
const plan = [];
|
|
33
|
+
for (const ym of index.cold) {
|
|
34
|
+
const fileName = `cold-${ym}.duckdb`;
|
|
35
|
+
const url = attachUrls[fileName];
|
|
36
|
+
if (!url) return err(engineErrors.missingAttachUrl(fileName));
|
|
37
|
+
plan.push({
|
|
38
|
+
fileName,
|
|
39
|
+
alias: snapshotAlias(fileName),
|
|
40
|
+
url
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (index.hot) {
|
|
44
|
+
const fileName = "hot.duckdb";
|
|
45
|
+
const url = attachUrls[fileName];
|
|
46
|
+
if (!url) return err(engineErrors.missingAttachUrl(fileName));
|
|
47
|
+
plan.push({
|
|
48
|
+
fileName,
|
|
49
|
+
alias: snapshotAlias(fileName),
|
|
50
|
+
url
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const aliases = [];
|
|
54
|
+
for (const { alias, url } of plan) {
|
|
55
|
+
await runner(`ATTACH '${url.replace(/'/g, "''")}' AS ${alias} (READ_ONLY)`);
|
|
56
|
+
aliases.push(alias);
|
|
57
|
+
}
|
|
58
|
+
const aliasSet = new Set(aliases);
|
|
59
|
+
const tableRows = await runner("SELECT database_name, table_name FROM duckdb_tables()");
|
|
60
|
+
const present = /* @__PURE__ */ new Map();
|
|
61
|
+
for (const row of tableRows) {
|
|
62
|
+
const db = String(row.database_name ?? "");
|
|
63
|
+
const table = String(row.table_name ?? "");
|
|
64
|
+
if (!aliasSet.has(db) || !table) continue;
|
|
65
|
+
const list = present.get(table);
|
|
66
|
+
if (list) list.push(db);
|
|
67
|
+
else present.set(table, [db]);
|
|
68
|
+
}
|
|
69
|
+
const tables = [];
|
|
70
|
+
for (const [table, dbs] of present) {
|
|
71
|
+
if (!SCHEMA_IDENT_RE.test(table)) continue;
|
|
72
|
+
const dbsSet = new Set(dbs);
|
|
73
|
+
await runner(`CREATE OR REPLACE VIEW ${schema}.${table} AS ${aliases.filter((a) => dbsSet.has(a)).map((db) => `SELECT * FROM ${db}.${table}`).join(" UNION ALL BY NAME ")}`);
|
|
74
|
+
tables.push(table);
|
|
75
|
+
}
|
|
76
|
+
return ok({
|
|
77
|
+
schema,
|
|
78
|
+
aliases,
|
|
79
|
+
tables
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async function attachSnapshotIndex(runner, opts) {
|
|
83
|
+
return unwrapResult(await attachSnapshotIndexResult(runner, opts), snapshotAttachErrorToException);
|
|
84
|
+
}
|
|
85
|
+
export { attachSnapshotIndex, snapshotAlias };
|
|
@@ -1,2 +1,57 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuilderState, SearchType } from "gscdump/query";
|
|
2
|
+
type AnalysisTool = 'striking-distance' | 'opportunity' | 'movers' | 'decay' | 'zero-click' | 'brand' | 'cannibalization' | 'clustering' | 'concentration' | 'seasonality' | 'trends' | 'ctr-anomaly' | 'position-volatility' | 'long-tail' | 'intent-atlas' | 'query-migration' | 'bayesian-ctr' | 'stl-decompose' | 'change-point' | 'bipartite-pagerank' | 'survival' | 'position-distribution' | 'ctr-curve' | 'dark-traffic' | 'content-velocity' | 'keyword-breadth' | 'device-gap' | 'data-query' | 'data-detail';
|
|
3
|
+
interface AnalysisParams {
|
|
4
|
+
type: AnalysisTool;
|
|
5
|
+
startDate?: string;
|
|
6
|
+
endDate?: string;
|
|
7
|
+
prevStartDate?: string;
|
|
8
|
+
prevEndDate?: string;
|
|
9
|
+
brandTerms?: string[];
|
|
10
|
+
limit?: number;
|
|
11
|
+
offset?: number;
|
|
12
|
+
/**
|
|
13
|
+
* movers: select a single direction and paginate within it. When set, the
|
|
14
|
+
* analyzer filters to that direction, reports `meta.total` as the full
|
|
15
|
+
* pre-pagination count for the direction, and applies `limit`/`offset`. When
|
|
16
|
+
* unset, both directions are returned uncapped (the top-N callers slice
|
|
17
|
+
* themselves).
|
|
18
|
+
*/
|
|
19
|
+
direction?: 'rising' | 'declining';
|
|
20
|
+
/** Sort column. Each analyzer enforces its own whitelist. */
|
|
21
|
+
sortBy?: string;
|
|
22
|
+
/** Sort direction. Default per-analyzer. */
|
|
23
|
+
sortDir?: 'asc' | 'desc';
|
|
24
|
+
minPosition?: number;
|
|
25
|
+
maxPosition?: number;
|
|
26
|
+
minImpressions?: number;
|
|
27
|
+
maxCtr?: number;
|
|
28
|
+
minPages?: number;
|
|
29
|
+
maxPositionSpread?: number;
|
|
30
|
+
minClusterSize?: number;
|
|
31
|
+
clusterBy?: 'prefix' | 'intent' | 'both';
|
|
32
|
+
dimension?: 'pages' | 'keywords';
|
|
33
|
+
topN?: number;
|
|
34
|
+
metric?: 'clicks' | 'impressions';
|
|
35
|
+
changeThreshold?: number;
|
|
36
|
+
minPreviousClicks?: number;
|
|
37
|
+
threshold?: number;
|
|
38
|
+
weeks?: number;
|
|
39
|
+
minWeeksWithData?: number;
|
|
40
|
+
/** content-velocity lookback window in days (max 365, default 90). */
|
|
41
|
+
days?: number;
|
|
42
|
+
/** data-query / data-detail primary BuilderState. */
|
|
43
|
+
q?: BuilderState;
|
|
44
|
+
/** data-query / data-detail optional comparison-period BuilderState. */
|
|
45
|
+
qc?: BuilderState;
|
|
46
|
+
/** data-query comparison filter applied to joined current/previous rows. */
|
|
47
|
+
comparisonFilter?: 'new' | 'lost' | 'improving' | 'declining';
|
|
48
|
+
/** GSC slice the analysis is scoped to. Undefined = analyzer runs cross-type (today's behaviour for web-only sites). */
|
|
49
|
+
searchType?: SearchType;
|
|
50
|
+
}
|
|
51
|
+
interface AnalysisResult {
|
|
52
|
+
results: Record<string, unknown>[];
|
|
53
|
+
meta: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
/** Coerce arbitrary value (number, bigint, string, null) to number, defaulting to 0. */
|
|
56
|
+
declare function num(v: unknown): number;
|
|
2
57
|
export { AnalysisParams, AnalysisResult, AnalysisTool, num };
|