@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
package/dist/index.mjs
CHANGED
|
@@ -1,646 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { MAX_DAY_BYTES,
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const R2_DELETE_BATCH_SIZE = 1e3;
|
|
12
|
-
async function casBackoff(attempt) {
|
|
13
|
-
const ceil = Math.min(CAS_BACKOFF_CAP_MS, CAS_BACKOFF_BASE_MS * 2 ** attempt);
|
|
14
|
-
await new Promise((resolve) => setTimeout(resolve, Math.random() * ceil));
|
|
15
|
-
}
|
|
16
|
-
async function mapWithConcurrency(items, concurrency, fn) {
|
|
17
|
-
if (items.length === 0) return [];
|
|
18
|
-
const workerCount = Math.max(1, Math.min(items.length, Math.floor(concurrency)));
|
|
19
|
-
const results = Array.from({ length: items.length }, () => void 0);
|
|
20
|
-
let nextIndex = 0;
|
|
21
|
-
async function worker() {
|
|
22
|
-
while (true) {
|
|
23
|
-
const index = nextIndex++;
|
|
24
|
-
if (index >= items.length) return;
|
|
25
|
-
results[index] = await fn(items[index], index);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
await Promise.all(Array.from({ length: workerCount }, worker));
|
|
29
|
-
return results;
|
|
30
|
-
}
|
|
31
|
-
function defaultSnapshotId() {
|
|
32
|
-
return `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
|
33
|
-
}
|
|
34
|
-
function shardPrefix(userId, siteId, table) {
|
|
35
|
-
return `u_${userId}/manifest/${siteId}/${table}/`;
|
|
36
|
-
}
|
|
37
|
-
function headKey(userId, siteId, table) {
|
|
38
|
-
return `${shardPrefix(userId, siteId, table)}HEAD`;
|
|
39
|
-
}
|
|
40
|
-
function snapshotKey(userId, siteId, table, snapshotId) {
|
|
41
|
-
return `${shardPrefix(userId, siteId, table)}v${snapshotId}.json`;
|
|
42
|
-
}
|
|
43
|
-
function emptySnapshot() {
|
|
44
|
-
return {
|
|
45
|
-
version: 1,
|
|
46
|
-
entries: [],
|
|
47
|
-
watermarks: [],
|
|
48
|
-
syncStates: []
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function shardScopesFromEntries(entries) {
|
|
52
|
-
const out = /* @__PURE__ */ new Set();
|
|
53
|
-
for (const e of entries) {
|
|
54
|
-
if (e.siteId === void 0) throw new Error("R2 manifest store requires entries to carry siteId; cross-site entries are unshardable");
|
|
55
|
-
out.add(`${e.siteId}\0${e.table}`);
|
|
56
|
-
}
|
|
57
|
-
return out;
|
|
58
|
-
}
|
|
59
|
-
function createR2ManifestStore(opts) {
|
|
60
|
-
const { bucket, userId } = opts;
|
|
61
|
-
const newSnapshotId = opts.newSnapshotId ?? defaultSnapshotId;
|
|
62
|
-
const now = opts.now ?? (() => Date.now());
|
|
63
|
-
const maxRetries = opts.maxRetries ?? 16;
|
|
64
|
-
const onEvent = opts.onEvent;
|
|
65
|
-
async function readShard(siteId, table) {
|
|
66
|
-
const head = await bucket.get(headKey(userId, siteId, table));
|
|
67
|
-
if (!head) return {
|
|
68
|
-
snapshot: emptySnapshot(),
|
|
69
|
-
headEtag: void 0
|
|
70
|
-
};
|
|
71
|
-
const snapshotId = (await head.text()).trim();
|
|
72
|
-
if (!snapshotId) return {
|
|
73
|
-
snapshot: emptySnapshot(),
|
|
74
|
-
headEtag: head.etag
|
|
75
|
-
};
|
|
76
|
-
const snap = await bucket.get(snapshotKey(userId, siteId, table, snapshotId));
|
|
77
|
-
if (!snap) return {
|
|
78
|
-
snapshot: emptySnapshot(),
|
|
79
|
-
headEtag: head.etag
|
|
80
|
-
};
|
|
81
|
-
const parsed = JSON.parse(await snap.text());
|
|
82
|
-
if (parsed.version !== 1) throw new Error(`unsupported manifest snapshot version: ${parsed.version}`);
|
|
83
|
-
return {
|
|
84
|
-
snapshot: parsed,
|
|
85
|
-
headEtag: head.etag
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
async function writeShardResult(siteId, table, snapshot, headEtag, attempt) {
|
|
89
|
-
const id = newSnapshotId();
|
|
90
|
-
const snapKey = snapshotKey(userId, siteId, table, id);
|
|
91
|
-
await bucket.put(snapKey, JSON.stringify(snapshot));
|
|
92
|
-
const conditional = headEtag ? { onlyIf: { etagMatches: headEtag } } : { onlyIf: { etagDoesNotMatch: "*" } };
|
|
93
|
-
return await bucket.put(headKey(userId, siteId, table), id, conditional) !== null ? ok(void 0) : err(engineErrors.manifestCasRoundLost(siteId, table, attempt));
|
|
94
|
-
}
|
|
95
|
-
async function mutateShardResult(siteId, table, mutate) {
|
|
96
|
-
let attempt = 0;
|
|
97
|
-
while (attempt < maxRetries) {
|
|
98
|
-
onEvent?.({
|
|
99
|
-
kind: "cas-attempt",
|
|
100
|
-
siteId,
|
|
101
|
-
table,
|
|
102
|
-
attempt
|
|
103
|
-
});
|
|
104
|
-
const { snapshot, headEtag } = await readShard(siteId, table);
|
|
105
|
-
await mutate(snapshot);
|
|
106
|
-
const round = await writeShardResult(siteId, table, snapshot, headEtag, attempt);
|
|
107
|
-
if (round.ok) {
|
|
108
|
-
onEvent?.({
|
|
109
|
-
kind: "cas-committed",
|
|
110
|
-
siteId,
|
|
111
|
-
table,
|
|
112
|
-
attempts: attempt + 1
|
|
113
|
-
});
|
|
114
|
-
return round;
|
|
115
|
-
}
|
|
116
|
-
onEvent?.({
|
|
117
|
-
kind: "cas-rejected",
|
|
118
|
-
siteId,
|
|
119
|
-
table,
|
|
120
|
-
attempt
|
|
121
|
-
});
|
|
122
|
-
attempt++;
|
|
123
|
-
if (attempt < maxRetries) await casBackoff(attempt);
|
|
124
|
-
}
|
|
125
|
-
return err(engineErrors.manifestCasExhausted(siteId, table, maxRetries));
|
|
126
|
-
}
|
|
127
|
-
async function mutateShard(siteId, table, mutate) {
|
|
128
|
-
return unwrapResult(await mutateShardResult(siteId, table, mutate), engineErrorToException);
|
|
129
|
-
}
|
|
130
|
-
async function listShards(siteId) {
|
|
131
|
-
const shards = [];
|
|
132
|
-
let cursor;
|
|
133
|
-
const prefix = siteId === void 0 ? `u_${userId}/manifest/` : `u_${userId}/manifest/${siteId}/`;
|
|
134
|
-
do {
|
|
135
|
-
const res = await bucket.list({
|
|
136
|
-
prefix,
|
|
137
|
-
cursor,
|
|
138
|
-
limit: 1e3
|
|
139
|
-
});
|
|
140
|
-
for (const obj of res.objects) {
|
|
141
|
-
const m = SHARD_RE.exec(obj.key);
|
|
142
|
-
if (m?.groups) shards.push({
|
|
143
|
-
siteId: m.groups.siteId,
|
|
144
|
-
table: m.groups.table
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
cursor = res.truncated ? res.cursor : void 0;
|
|
148
|
-
} while (cursor);
|
|
149
|
-
return shards;
|
|
150
|
-
}
|
|
151
|
-
async function shardsForFilter(filter) {
|
|
152
|
-
if (filter.siteId !== void 0 && filter.table !== void 0) return [{
|
|
153
|
-
siteId: filter.siteId,
|
|
154
|
-
table: filter.table
|
|
155
|
-
}];
|
|
156
|
-
return (await listShards(filter.siteId)).filter((s) => (filter.siteId === void 0 || s.siteId === filter.siteId) && (filter.table === void 0 || s.table === filter.table));
|
|
157
|
-
}
|
|
158
|
-
function assertScopedUser(got, op) {
|
|
159
|
-
if (got !== userId) throw new Error(`${op}: R2 manifest store is scoped to userId=${userId}, got ${got}`);
|
|
160
|
-
}
|
|
161
|
-
async function readEntriesAcrossShards(filter, includeRetired) {
|
|
162
|
-
assertScopedUser(filter.userId, includeRetired ? "listAll" : "listLive");
|
|
163
|
-
return (await mapWithConcurrency(await shardsForFilter(filter), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
164
|
-
const { snapshot } = await readShard(siteId, table);
|
|
165
|
-
const entries = [];
|
|
166
|
-
for (const entry of snapshot.entries) {
|
|
167
|
-
if (!includeRetired && entry.retiredAt !== void 0) continue;
|
|
168
|
-
if (matchesManifestEntryFilter(entry, filter, { ignoreUserId: true })) entries.push(entry);
|
|
169
|
-
}
|
|
170
|
-
return entries;
|
|
171
|
-
})).flat();
|
|
172
|
-
}
|
|
173
|
-
function groupBySiteTable(entries) {
|
|
174
|
-
const out = /* @__PURE__ */ new Map();
|
|
175
|
-
for (const e of entries) {
|
|
176
|
-
const key = `${e.siteId}\0${e.table}`;
|
|
177
|
-
if (!out.has(key)) out.set(key, []);
|
|
178
|
-
out.get(key).push(e);
|
|
179
|
-
}
|
|
180
|
-
return out;
|
|
181
|
-
}
|
|
182
|
-
async function registerVersionsImpl(newEntries, superseding) {
|
|
183
|
-
if (newEntries.length === 0 && (!superseding || superseding.length === 0)) return;
|
|
184
|
-
const supersededAt = newEntries[0]?.createdAt ?? now();
|
|
185
|
-
const byShard = /* @__PURE__ */ new Map();
|
|
186
|
-
function bucket(entry, kind) {
|
|
187
|
-
assertScopedUser(entry.userId, "registerVersions");
|
|
188
|
-
if (entry.siteId === void 0) throw new Error("R2 manifest store requires entries to carry siteId");
|
|
189
|
-
const key = `${entry.siteId}\0${entry.table}`;
|
|
190
|
-
let bag = byShard.get(key);
|
|
191
|
-
if (!bag) {
|
|
192
|
-
bag = {
|
|
193
|
-
newEntries: [],
|
|
194
|
-
superseding: []
|
|
195
|
-
};
|
|
196
|
-
byShard.set(key, bag);
|
|
197
|
-
}
|
|
198
|
-
if (kind === "new") bag.newEntries.push(entry);
|
|
199
|
-
else bag.superseding.push(entry);
|
|
200
|
-
}
|
|
201
|
-
for (const e of newEntries) bucket(e, "new");
|
|
202
|
-
if (superseding) for (const e of superseding) bucket(e, "super");
|
|
203
|
-
await mapWithConcurrency([...byShard], SHARD_IO_CONCURRENCY, async ([shardKey, { newEntries: news, superseding: supers }]) => {
|
|
204
|
-
const [siteId, table] = shardKey.split("\0");
|
|
205
|
-
await mutateShard(siteId, table, (snap) => {
|
|
206
|
-
const byObjectKey = new Map(snap.entries.map((e) => [e.objectKey, e]));
|
|
207
|
-
for (const s of supers) {
|
|
208
|
-
const existing = byObjectKey.get(s.objectKey);
|
|
209
|
-
if (existing && existing.retiredAt === void 0) byObjectKey.set(s.objectKey, {
|
|
210
|
-
...existing,
|
|
211
|
-
retiredAt: supersededAt
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
for (const n of news) byObjectKey.set(n.objectKey, n);
|
|
215
|
-
snap.entries = Array.from(byObjectKey.values());
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
return {
|
|
220
|
-
async listLive(filter) {
|
|
221
|
-
return readEntriesAcrossShards(filter, false);
|
|
222
|
-
},
|
|
223
|
-
async listAll(filter) {
|
|
224
|
-
return readEntriesAcrossShards(filter, true);
|
|
225
|
-
},
|
|
226
|
-
async registerVersion(entry, superseding) {
|
|
227
|
-
return registerVersionsImpl([entry], superseding);
|
|
228
|
-
},
|
|
229
|
-
async registerVersions(entries, superseding) {
|
|
230
|
-
shardScopesFromEntries(entries);
|
|
231
|
-
return registerVersionsImpl(entries, superseding);
|
|
232
|
-
},
|
|
233
|
-
async listRetired(olderThan) {
|
|
234
|
-
return (await mapWithConcurrency(await listShards(), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
235
|
-
const { snapshot } = await readShard(siteId, table);
|
|
236
|
-
const retired = [];
|
|
237
|
-
for (const e of snapshot.entries) if (e.retiredAt !== void 0 && e.retiredAt <= olderThan) retired.push(e);
|
|
238
|
-
return retired;
|
|
239
|
-
})).flat();
|
|
240
|
-
},
|
|
241
|
-
async delete(toDelete) {
|
|
242
|
-
await mapWithConcurrency([...groupBySiteTable(toDelete)], SHARD_IO_CONCURRENCY, async ([shardKey, entries]) => {
|
|
243
|
-
const [siteId, table] = shardKey.split("\0");
|
|
244
|
-
await mutateShard(siteId, table, (snap) => {
|
|
245
|
-
const drop = new Set(entries.map((e) => e.objectKey));
|
|
246
|
-
snap.entries = snap.entries.filter((e) => !drop.has(e.objectKey));
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
},
|
|
250
|
-
async getWatermarks(filter) {
|
|
251
|
-
assertScopedUser(filter.userId, "getWatermarks");
|
|
252
|
-
return (await mapWithConcurrency(await shardsForFilter(filter), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
253
|
-
const { snapshot } = await readShard(siteId, table);
|
|
254
|
-
const watermarks = [];
|
|
255
|
-
for (const w of snapshot.watermarks) if (matchesWatermarkFilter(w, filter, { ignoreUserId: true })) watermarks.push(w);
|
|
256
|
-
return watermarks;
|
|
257
|
-
})).flat();
|
|
258
|
-
},
|
|
259
|
-
async bumpWatermark(scope, date, at) {
|
|
260
|
-
assertScopedUser(scope.userId, "bumpWatermark");
|
|
261
|
-
if (scope.siteId === void 0) throw new Error("R2 manifest store requires watermarks to carry siteId");
|
|
262
|
-
const ts = at ?? now();
|
|
263
|
-
const scopeSearchType = inferSearchType(scope);
|
|
264
|
-
await mutateShard(scope.siteId, scope.table, (snap) => {
|
|
265
|
-
const idx = snap.watermarks.findIndex((w) => w.userId === userId && w.siteId === scope.siteId && w.table === scope.table && inferSearchType(w) === scopeSearchType);
|
|
266
|
-
if (idx === -1) {
|
|
267
|
-
snap.watermarks.push({
|
|
268
|
-
userId,
|
|
269
|
-
siteId: scope.siteId,
|
|
270
|
-
table: scope.table,
|
|
271
|
-
...scope.searchType !== void 0 ? { searchType: scope.searchType } : {},
|
|
272
|
-
newestDateSynced: date,
|
|
273
|
-
oldestDateSynced: date,
|
|
274
|
-
lastSyncAt: ts
|
|
275
|
-
});
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
const w = snap.watermarks[idx];
|
|
279
|
-
const newest = date > w.newestDateSynced ? date : w.newestDateSynced;
|
|
280
|
-
const oldest = date < w.oldestDateSynced ? date : w.oldestDateSynced;
|
|
281
|
-
const lastSyncAt = ts > w.lastSyncAt ? ts : w.lastSyncAt;
|
|
282
|
-
snap.watermarks[idx] = {
|
|
283
|
-
...w,
|
|
284
|
-
newestDateSynced: newest,
|
|
285
|
-
oldestDateSynced: oldest,
|
|
286
|
-
lastSyncAt
|
|
287
|
-
};
|
|
288
|
-
});
|
|
289
|
-
},
|
|
290
|
-
async getSyncStates(filter) {
|
|
291
|
-
assertScopedUser(filter.userId, "getSyncStates");
|
|
292
|
-
return (await mapWithConcurrency(await shardsForFilter(filter), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
293
|
-
const { snapshot } = await readShard(siteId, table);
|
|
294
|
-
const states = [];
|
|
295
|
-
for (const s of snapshot.syncStates) if (matchesSyncStateFilter(s, filter, { ignoreUserId: true })) states.push(s);
|
|
296
|
-
return states;
|
|
297
|
-
})).flat();
|
|
298
|
-
},
|
|
299
|
-
async setSyncState(scope, state, detail) {
|
|
300
|
-
assertScopedUser(scope.userId, "setSyncState");
|
|
301
|
-
if (scope.siteId === void 0) throw new Error("R2 manifest store requires sync states to carry siteId");
|
|
302
|
-
const at = detail?.at ?? now();
|
|
303
|
-
const scopeSearchType = inferSearchType(scope);
|
|
304
|
-
await mutateShard(scope.siteId, scope.table, (snap) => {
|
|
305
|
-
const idx = snap.syncStates.findIndex((s) => s.userId === userId && s.siteId === scope.siteId && s.table === scope.table && s.date === scope.date && inferSearchType(s) === scopeSearchType);
|
|
306
|
-
if (idx === -1) {
|
|
307
|
-
snap.syncStates.push({
|
|
308
|
-
userId,
|
|
309
|
-
siteId: scope.siteId,
|
|
310
|
-
table: scope.table,
|
|
311
|
-
date: scope.date,
|
|
312
|
-
state,
|
|
313
|
-
updatedAt: at,
|
|
314
|
-
attempts: 1,
|
|
315
|
-
error: detail?.error,
|
|
316
|
-
...scope.searchType !== void 0 ? { searchType: scope.searchType } : {}
|
|
317
|
-
});
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
const prev = snap.syncStates[idx];
|
|
321
|
-
const attempts = state === "inflight" && prev.state !== "inflight" ? prev.attempts + 1 : prev.attempts;
|
|
322
|
-
const error = state === "done" ? void 0 : detail?.error ?? prev.error;
|
|
323
|
-
snap.syncStates[idx] = {
|
|
324
|
-
...prev,
|
|
325
|
-
state,
|
|
326
|
-
updatedAt: at,
|
|
327
|
-
attempts,
|
|
328
|
-
error
|
|
329
|
-
};
|
|
330
|
-
});
|
|
331
|
-
},
|
|
332
|
-
async withLock(_scope, fn) {
|
|
333
|
-
return fn();
|
|
334
|
-
},
|
|
335
|
-
async purgeTenant(filter) {
|
|
336
|
-
if (filter.userId !== userId) throw new Error(`purgeTenant: store is scoped to userId=${userId}, got ${filter.userId}`);
|
|
337
|
-
const purged = await mapWithConcurrency(await shardsForFilter({ siteId: filter.siteId }), SHARD_IO_CONCURRENCY, async ({ siteId, table }) => {
|
|
338
|
-
const { snapshot } = await readShard(siteId, table);
|
|
339
|
-
const prefix = shardPrefix(userId, siteId, table);
|
|
340
|
-
const keys = [];
|
|
341
|
-
let cursor;
|
|
342
|
-
do {
|
|
343
|
-
const res = await bucket.list({
|
|
344
|
-
prefix,
|
|
345
|
-
cursor,
|
|
346
|
-
limit: 1e3
|
|
347
|
-
});
|
|
348
|
-
for (const obj of res.objects) keys.push(obj.key);
|
|
349
|
-
cursor = res.truncated ? res.cursor : void 0;
|
|
350
|
-
} while (cursor);
|
|
351
|
-
for (let offset = 0; offset < keys.length; offset += R2_DELETE_BATCH_SIZE) await bucket.delete(keys.slice(offset, offset + R2_DELETE_BATCH_SIZE));
|
|
352
|
-
return {
|
|
353
|
-
entriesRemoved: snapshot.entries.length,
|
|
354
|
-
watermarksRemoved: snapshot.watermarks.length,
|
|
355
|
-
syncStatesRemoved: snapshot.syncStates.length
|
|
356
|
-
};
|
|
357
|
-
});
|
|
358
|
-
return {
|
|
359
|
-
entriesRemoved: purged.reduce((sum, result) => sum + result.entriesRemoved, 0),
|
|
360
|
-
watermarksRemoved: purged.reduce((sum, result) => sum + result.watermarksRemoved, 0),
|
|
361
|
-
syncStatesRemoved: purged.reduce((sum, result) => sum + result.syncStatesRemoved, 0)
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
function createQueryProfiler(sink, now = () => Date.now()) {
|
|
367
|
-
return { start(name, meta) {
|
|
368
|
-
const t0 = now();
|
|
369
|
-
return (extra) => {
|
|
370
|
-
const merged = meta || extra ? {
|
|
371
|
-
...meta,
|
|
372
|
-
...extra
|
|
373
|
-
} : void 0;
|
|
374
|
-
sink(merged ? {
|
|
375
|
-
name,
|
|
376
|
-
ms: now() - t0,
|
|
377
|
-
meta: merged
|
|
378
|
-
} : {
|
|
379
|
-
name,
|
|
380
|
-
ms: now() - t0
|
|
381
|
-
});
|
|
382
|
-
};
|
|
383
|
-
} };
|
|
384
|
-
}
|
|
385
|
-
function collectSpans(now) {
|
|
386
|
-
const spans = [];
|
|
387
|
-
return {
|
|
388
|
-
profiler: createQueryProfiler((s) => spans.push(s), now),
|
|
389
|
-
spans
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
const DAY = 24 * (3600 * 1e3);
|
|
393
|
-
function isDue(state, now) {
|
|
394
|
-
return now >= state.nextAt;
|
|
395
|
-
}
|
|
396
|
-
function sitemapCadenceMs(consecutiveUnchanged) {
|
|
397
|
-
if (consecutiveUnchanged >= 7) return 30 * DAY;
|
|
398
|
-
if (consecutiveUnchanged >= 3) return 7 * DAY;
|
|
399
|
-
return DAY;
|
|
400
|
-
}
|
|
401
|
-
const SITEMAP_VERSION = 1;
|
|
402
|
-
const sitemapPolicy = {
|
|
403
|
-
version: SITEMAP_VERSION,
|
|
404
|
-
initial(now) {
|
|
405
|
-
return {
|
|
406
|
-
nextAt: now + DAY,
|
|
407
|
-
consecutiveUnchanged: 0,
|
|
408
|
-
policyVersion: SITEMAP_VERSION
|
|
409
|
-
};
|
|
410
|
-
},
|
|
411
|
-
observe(prev, evt) {
|
|
412
|
-
if (prev.policyVersion !== SITEMAP_VERSION) return {
|
|
413
|
-
nextAt: evt.at + sitemapCadenceMs(0),
|
|
414
|
-
consecutiveUnchanged: 0,
|
|
415
|
-
policyVersion: SITEMAP_VERSION
|
|
416
|
-
};
|
|
417
|
-
if (evt.changed) return {
|
|
418
|
-
nextAt: evt.at + DAY,
|
|
419
|
-
consecutiveUnchanged: 0,
|
|
420
|
-
policyVersion: SITEMAP_VERSION
|
|
421
|
-
};
|
|
422
|
-
const next = prev.consecutiveUnchanged + 1;
|
|
423
|
-
return {
|
|
424
|
-
nextAt: evt.at + sitemapCadenceMs(next),
|
|
425
|
-
consecutiveUnchanged: next,
|
|
426
|
-
policyVersion: SITEMAP_VERSION
|
|
427
|
-
};
|
|
428
|
-
},
|
|
429
|
-
isDue
|
|
430
|
-
};
|
|
431
|
-
const INSPECTION_VERSION = 1;
|
|
432
|
-
function inspectionCadenceMs(verdict) {
|
|
433
|
-
if (verdict === "PASS") return 30 * DAY;
|
|
434
|
-
if (verdict === "FAIL") return 7 * DAY;
|
|
435
|
-
return 14 * DAY;
|
|
436
|
-
}
|
|
437
|
-
function inspectionPolicy(verdict) {
|
|
438
|
-
const cadence = inspectionCadenceMs(verdict);
|
|
439
|
-
return {
|
|
440
|
-
version: INSPECTION_VERSION,
|
|
441
|
-
initial(now) {
|
|
442
|
-
return {
|
|
443
|
-
nextAt: now + cadence,
|
|
444
|
-
consecutiveUnchanged: 0,
|
|
445
|
-
policyVersion: INSPECTION_VERSION
|
|
446
|
-
};
|
|
447
|
-
},
|
|
448
|
-
observe(prev, evt) {
|
|
449
|
-
if (prev.policyVersion !== INSPECTION_VERSION) return {
|
|
450
|
-
nextAt: evt.at + cadence,
|
|
451
|
-
consecutiveUnchanged: 0,
|
|
452
|
-
policyVersion: INSPECTION_VERSION
|
|
453
|
-
};
|
|
454
|
-
const next = evt.changed ? 0 : prev.consecutiveUnchanged + 1;
|
|
455
|
-
return {
|
|
456
|
-
nextAt: evt.at + cadence,
|
|
457
|
-
consecutiveUnchanged: next,
|
|
458
|
-
policyVersion: INSPECTION_VERSION
|
|
459
|
-
};
|
|
460
|
-
},
|
|
461
|
-
isDue
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
const FIXED_VERSION = 1;
|
|
465
|
-
function fixedPolicy(intervalMs) {
|
|
466
|
-
return {
|
|
467
|
-
version: FIXED_VERSION,
|
|
468
|
-
initial(now) {
|
|
469
|
-
return {
|
|
470
|
-
nextAt: now + intervalMs,
|
|
471
|
-
consecutiveUnchanged: 0,
|
|
472
|
-
policyVersion: FIXED_VERSION
|
|
473
|
-
};
|
|
474
|
-
},
|
|
475
|
-
observe(prev, evt) {
|
|
476
|
-
if (prev.policyVersion !== FIXED_VERSION) return {
|
|
477
|
-
nextAt: evt.at + intervalMs,
|
|
478
|
-
consecutiveUnchanged: 0,
|
|
479
|
-
policyVersion: FIXED_VERSION
|
|
480
|
-
};
|
|
481
|
-
const next = evt.changed ? 0 : prev.consecutiveUnchanged + 1;
|
|
482
|
-
return {
|
|
483
|
-
nextAt: evt.at + intervalMs,
|
|
484
|
-
consecutiveUnchanged: next,
|
|
485
|
-
policyVersion: FIXED_VERSION
|
|
486
|
-
};
|
|
487
|
-
},
|
|
488
|
-
isDue
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
const KEY_SEP = "\0";
|
|
492
|
-
function partitionKey(slice) {
|
|
493
|
-
return [
|
|
494
|
-
slice.table,
|
|
495
|
-
slice.ctx.siteId ?? "",
|
|
496
|
-
slice.searchType,
|
|
497
|
-
slice.date
|
|
498
|
-
].join(KEY_SEP);
|
|
499
|
-
}
|
|
500
|
-
function tableOfKey(key) {
|
|
501
|
-
return key.slice(0, key.indexOf(KEY_SEP));
|
|
502
|
-
}
|
|
503
|
-
function withIdentity(slice, rows) {
|
|
504
|
-
return rows.map((r) => ({
|
|
505
|
-
...r,
|
|
506
|
-
site_id: slice.ctx.siteId ?? "",
|
|
507
|
-
search_type: slice.searchType
|
|
508
|
-
}));
|
|
509
|
-
}
|
|
510
|
-
function createInMemorySink() {
|
|
511
|
-
const partitions = /* @__PURE__ */ new Map();
|
|
512
|
-
let closed = false;
|
|
513
|
-
function allRows() {
|
|
514
|
-
return [...partitions.values()].flat();
|
|
515
|
-
}
|
|
516
|
-
return {
|
|
517
|
-
capabilities: { appendOnly: true },
|
|
518
|
-
async emit(slice, rows) {
|
|
519
|
-
const key = partitionKey(slice);
|
|
520
|
-
const stored = withIdentity(slice, rows);
|
|
521
|
-
const existing = partitions.get(key);
|
|
522
|
-
if (existing) existing.push(...stored);
|
|
523
|
-
else partitions.set(key, stored);
|
|
524
|
-
return { rowCount: stored.length };
|
|
525
|
-
},
|
|
526
|
-
async close() {
|
|
527
|
-
closed = true;
|
|
528
|
-
return {
|
|
529
|
-
flushed: [...new Set([...partitions.keys()].map((k) => tableOfKey(k)))],
|
|
530
|
-
failed: []
|
|
531
|
-
};
|
|
532
|
-
},
|
|
533
|
-
get rows() {
|
|
534
|
-
return allRows();
|
|
535
|
-
},
|
|
536
|
-
get closed() {
|
|
537
|
-
return closed;
|
|
538
|
-
},
|
|
539
|
-
rowsFor(table) {
|
|
540
|
-
return [...partitions.entries()].filter(([k]) => tableOfKey(k) === table).flatMap(([, v]) => v);
|
|
541
|
-
},
|
|
542
|
-
rowsForSlice(slice) {
|
|
543
|
-
return [...partitions.get(partitionKey(slice)) ?? []];
|
|
544
|
-
},
|
|
545
|
-
reset() {
|
|
546
|
-
partitions.clear();
|
|
547
|
-
closed = false;
|
|
548
|
-
}
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
const TABLES_BY_SEARCH_TYPE = {
|
|
552
|
-
web: [
|
|
553
|
-
"pages",
|
|
554
|
-
"queries",
|
|
555
|
-
"countries",
|
|
556
|
-
"page_queries",
|
|
557
|
-
"dates"
|
|
558
|
-
],
|
|
559
|
-
discover: [
|
|
560
|
-
"pages",
|
|
561
|
-
"countries",
|
|
562
|
-
"dates"
|
|
563
|
-
],
|
|
564
|
-
news: [
|
|
565
|
-
"pages",
|
|
566
|
-
"countries",
|
|
567
|
-
"dates"
|
|
568
|
-
],
|
|
569
|
-
googleNews: [
|
|
570
|
-
"pages",
|
|
571
|
-
"countries",
|
|
572
|
-
"dates"
|
|
573
|
-
],
|
|
574
|
-
image: [
|
|
575
|
-
"pages",
|
|
576
|
-
"countries",
|
|
577
|
-
"dates"
|
|
578
|
-
],
|
|
579
|
-
video: [
|
|
580
|
-
"pages",
|
|
581
|
-
"countries",
|
|
582
|
-
"dates"
|
|
583
|
-
]
|
|
584
|
-
};
|
|
585
|
-
function parseEnabledSearchTypes(raw) {
|
|
586
|
-
if (!raw) return ["web"];
|
|
587
|
-
const parsed = JSON.parse(raw);
|
|
588
|
-
if (!Array.isArray(parsed) || parsed.length === 0) return ["web"];
|
|
589
|
-
const valid = parsed.filter((v) => typeof v === "string" && v in TABLES_BY_SEARCH_TYPE);
|
|
590
|
-
if (valid.length === 0) return ["web"];
|
|
591
|
-
if (!valid.includes("web")) valid.unshift("web");
|
|
592
|
-
return valid;
|
|
593
|
-
}
|
|
594
|
-
function validateEnabledSearchTypesResult(value) {
|
|
595
|
-
if (!Array.isArray(value) || value.length === 0) return err(engineErrors.searchTypesNotArray());
|
|
596
|
-
const seen = /* @__PURE__ */ new Set();
|
|
597
|
-
const out = [];
|
|
598
|
-
for (const v of value) {
|
|
599
|
-
if (typeof v !== "string" || !(v in TABLES_BY_SEARCH_TYPE)) return err(engineErrors.unknownSearchType(v));
|
|
600
|
-
if (seen.has(v)) continue;
|
|
601
|
-
seen.add(v);
|
|
602
|
-
out.push(v);
|
|
603
|
-
}
|
|
604
|
-
if (!out.includes("web")) return err(engineErrors.searchTypesMissingWeb());
|
|
605
|
-
return ok(out);
|
|
606
|
-
}
|
|
607
|
-
function validateEnabledSearchTypes(value) {
|
|
608
|
-
return unwrapResult(validateEnabledSearchTypesResult(value), engineErrorToException);
|
|
609
|
-
}
|
|
610
|
-
const TABLE_TIERS = {
|
|
611
|
-
pages: "critical",
|
|
612
|
-
queries: "critical",
|
|
613
|
-
countries: "standard",
|
|
614
|
-
dates: "standard",
|
|
615
|
-
page_queries: "extended"
|
|
616
|
-
};
|
|
617
|
-
function getTableTier(table) {
|
|
618
|
-
return TABLE_TIERS[table] || "extended";
|
|
619
|
-
}
|
|
620
|
-
function getTablesForTier(tier) {
|
|
621
|
-
return Object.entries(TABLE_TIERS).filter(([_, t]) => t === tier).map(([name]) => name);
|
|
622
|
-
}
|
|
623
|
-
function getDateWeight(date, now = /* @__PURE__ */ new Date()) {
|
|
624
|
-
const target = new Date(date);
|
|
625
|
-
const daysAgo = Math.floor((now.getTime() - target.getTime()) / (1e3 * 60 * 60 * 24));
|
|
626
|
-
if (daysAgo <= 3) return "fresh";
|
|
627
|
-
if (daysAgo <= 60) return "recent";
|
|
628
|
-
return "historical";
|
|
629
|
-
}
|
|
630
|
-
const TIER_PRIORITY = {
|
|
631
|
-
critical: 0,
|
|
632
|
-
standard: 1,
|
|
633
|
-
extended: 2
|
|
634
|
-
};
|
|
635
|
-
const WEIGHT_PRIORITY = {
|
|
636
|
-
fresh: 0,
|
|
637
|
-
recent: 1,
|
|
638
|
-
historical: 2
|
|
639
|
-
};
|
|
640
|
-
const MAX_GSC_PAGES_R2 = 40;
|
|
641
|
-
const ROW_LIMIT_R2 = 25e3;
|
|
642
|
-
const MIN_SYNC_IMPRESSIONS = 1;
|
|
643
|
-
const MIN_COUNTRY_IMPRESSIONS = 10;
|
|
644
|
-
const MAX_SITEMAP_URLS_PER_SITE = 5e4;
|
|
645
|
-
const MAX_TRACKED_URLS_PER_SITE = 2e5;
|
|
1
|
+
import { DEFAULT_SEARCH_TYPE, dayPartition, hourPartition, inferLegacyTier, inferSearchType, objectKey } from "./layout.mjs";
|
|
2
|
+
import { createR2ManifestStore } from "./adapters/r2-manifest.mjs";
|
|
3
|
+
import { coerceRow, coerceRows } from "./coerce.mjs";
|
|
4
|
+
import { createDuckDBCodec, createDuckDBExecutor } from "./duckdb.mjs";
|
|
5
|
+
import { MAX_DAY_BYTES, createStorageEngine } from "./engine.mjs";
|
|
6
|
+
import { collectSpans, createQueryProfiler } from "./profile.mjs";
|
|
7
|
+
import { fixedPolicy, inspectionPolicy, sitemapPolicy } from "./schedule.mjs";
|
|
8
|
+
import { createInMemorySink } from "./sinks/in-memory-sink.mjs";
|
|
9
|
+
import "./sinks/index.mjs";
|
|
10
|
+
import { MAX_GSC_PAGES_R2, MAX_SITEMAP_URLS_PER_SITE, MAX_TRACKED_URLS_PER_SITE, MIN_COUNTRY_IMPRESSIONS, MIN_SYNC_IMPRESSIONS, ROW_LIMIT_R2, TABLES_BY_SEARCH_TYPE, TABLE_TIERS, TIER_PRIORITY, WEIGHT_PRIORITY, getDateWeight, getTableTier, getTablesForTier, parseEnabledSearchTypes, validateEnabledSearchTypes, validateEnabledSearchTypesResult } from "./sync-config.mjs";
|
|
646
11
|
export { DEFAULT_SEARCH_TYPE, MAX_DAY_BYTES, MAX_GSC_PAGES_R2, MAX_SITEMAP_URLS_PER_SITE, MAX_TRACKED_URLS_PER_SITE, MIN_COUNTRY_IMPRESSIONS, MIN_SYNC_IMPRESSIONS, ROW_LIMIT_R2, TABLES_BY_SEARCH_TYPE, TABLE_TIERS, TIER_PRIORITY, WEIGHT_PRIORITY, coerceRow, coerceRows, collectSpans, createDuckDBCodec, createDuckDBExecutor, createInMemorySink, createQueryProfiler, createR2ManifestStore, createStorageEngine, dayPartition, fixedPolicy, getDateWeight, getTableTier, getTablesForTier, hourPartition, inferLegacyTier, inferSearchType, inspectionPolicy, objectKey, parseEnabledSearchTypes, sitemapPolicy, validateEnabledSearchTypes, validateEnabledSearchTypesResult };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SearchType, TenantCtx as TenantCtx$1 } from "./
|
|
1
|
+
import { SearchType, TenantCtx as TenantCtx$1 } from "./storage.mjs";
|
|
2
2
|
import { GscApiRow, RowAccumulatorOptions } from "./ingest.mjs";
|
|
3
3
|
import { Grain, Row, TableName } from "@gscdump/contracts";
|
|
4
4
|
interface IngestAccumulatorEngine {
|
package/dist/ingest.d.mts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CompactionTier, ManifestEntry } from "./storage.mjs";
|
|
2
|
+
import { SearchType } from "gscdump/query";
|
|
3
|
+
import { TableName, TenantCtx } from "@gscdump/contracts";
|
|
4
|
+
declare function dayPartition(date: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Hourly partition keyed by the PT calendar day (`YYYY-MM-DD`). One parquet
|
|
7
|
+
* per day holds 24 hourly buckets — read-merge-write keeps `(url, hour)`
|
|
8
|
+
* idempotency across retries. Names sort lexically alongside daily ones but
|
|
9
|
+
* never collide because of the `hourly/` prefix.
|
|
10
|
+
*/
|
|
11
|
+
declare function hourPartition(date: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Default `searchType` for entries written before the field landed and for
|
|
14
|
+
* sync paths that don't request a specific type. GSC's own default; the
|
|
15
|
+
* vast majority of stored data is web-search.
|
|
16
|
+
*/
|
|
17
|
+
declare const DEFAULT_SEARCH_TYPE: SearchType;
|
|
18
|
+
declare function objectKey(ctx: TenantCtx, table: TableName, partition: string, version: number, searchType?: SearchType): string;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the search type for an entry, defaulting legacy entries to `web`.
|
|
21
|
+
* Use this anywhere code needs to bucket entries by searchType.
|
|
22
|
+
*/
|
|
23
|
+
declare function inferSearchType(entry: Pick<ManifestEntry, 'searchType'>): SearchType;
|
|
24
|
+
/**
|
|
25
|
+
* Infer the tier for an entry that pre-dates the `tier` field. Daily files
|
|
26
|
+
* are `raw`; monthly files are `d30`. Anything else (already migrated, or
|
|
27
|
+
* a partition shape we haven't seen) returns undefined and the caller must
|
|
28
|
+
* decide how to handle it.
|
|
29
|
+
*/
|
|
30
|
+
declare function inferLegacyTier(entry: Pick<ManifestEntry, 'partition' | 'tier'>): CompactionTier | undefined;
|
|
31
|
+
export { DEFAULT_SEARCH_TYPE, dayPartition, hourPartition, inferLegacyTier, inferSearchType, objectKey };
|