@gscdump/engine 1.3.2 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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} +22 -54
- package/dist/{_chunks/schema.mjs → drizzle-schema.mjs} +2 -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 +110 -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 +4 -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,396 @@
|
|
|
1
|
+
import { buildLogicalComparisonPlan, buildLogicalPlan } from "gscdump/query/plan";
|
|
2
|
+
import { sql } from "drizzle-orm";
|
|
3
|
+
import { and as and$1, gte as gte$1, impressions } from "gscdump/query";
|
|
4
|
+
const COMPARISON_FILTER_SQL = {
|
|
5
|
+
new: sql`AND COALESCE(p.impressions, 0) = 0 AND COALESCE(c.impressions, 0) > 0`,
|
|
6
|
+
lost: sql`AND COALESCE(p.impressions, 0) > 0 AND COALESCE(c.impressions, 0) = 0`,
|
|
7
|
+
improving: sql`AND COALESCE(c.clicks, 0) > COALESCE(p.clicks, 0)`,
|
|
8
|
+
declining: sql`AND COALESCE(c.clicks, 0) < COALESCE(p.clicks, 0) AND COALESCE(p.clicks, 0) > 0`
|
|
9
|
+
};
|
|
10
|
+
function collapseWs(s) {
|
|
11
|
+
return s.replace(/\s+/g, " ").trim();
|
|
12
|
+
}
|
|
13
|
+
function joinAnd(parts) {
|
|
14
|
+
return sql.join(parts, sql` AND `);
|
|
15
|
+
}
|
|
16
|
+
function joinComma(parts) {
|
|
17
|
+
return sql.join(parts, sql`, `);
|
|
18
|
+
}
|
|
19
|
+
const ORDER_BY_HELPER_PREFIX = "__order_";
|
|
20
|
+
function withMinimumImpressions(state, options) {
|
|
21
|
+
if (options.minimumImpressions === void 0) return state;
|
|
22
|
+
const minimum = Number(options.minimumImpressions);
|
|
23
|
+
if (!Number.isFinite(minimum) || minimum < 0) throw new RangeError("minimumImpressions must be a finite non-negative number");
|
|
24
|
+
const guard = gte$1(impressions, minimum);
|
|
25
|
+
return {
|
|
26
|
+
...state,
|
|
27
|
+
prefilter: state.prefilter ? and$1(state.prefilter, guard) : guard
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function orderByClause(state, prefix = "", columnOverride) {
|
|
31
|
+
if (state.orderBy) {
|
|
32
|
+
const safeCol = (columnOverride ?? state.orderBy.column).replace(/\W/g, "");
|
|
33
|
+
const safeDir = state.orderBy.dir.toUpperCase() === "ASC" ? "ASC" : "DESC";
|
|
34
|
+
return sql.raw(`ORDER BY ${prefix}${safeCol} ${safeDir}`);
|
|
35
|
+
}
|
|
36
|
+
return sql.raw(`ORDER BY ${prefix}clicks DESC`);
|
|
37
|
+
}
|
|
38
|
+
function limitOffsetClause(state) {
|
|
39
|
+
const rowLimit = Math.max(0, Math.floor(Number(state.rowLimit ?? 100)));
|
|
40
|
+
const offset = state.startRow ? Math.max(0, Math.floor(Number(state.startRow))) : 0;
|
|
41
|
+
return sql.raw(offset > 0 ? `LIMIT ${rowLimit} OFFSET ${offset}` : `LIMIT ${rowLimit}`);
|
|
42
|
+
}
|
|
43
|
+
function aliasRaw(name) {
|
|
44
|
+
const safe = name.replace(/\W/g, "");
|
|
45
|
+
return sql.raw(`"${safe}"`);
|
|
46
|
+
}
|
|
47
|
+
function toInternalDimensionFilters(filters) {
|
|
48
|
+
return filters.map((filter) => ({
|
|
49
|
+
dimension: filter.dimension,
|
|
50
|
+
operator: filter.operator,
|
|
51
|
+
expression: filter.expression,
|
|
52
|
+
expression2: filter.expression2
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
function toInternalMetricFilters(filters) {
|
|
56
|
+
return filters.map((filter) => ({
|
|
57
|
+
dimension: filter.metric,
|
|
58
|
+
operator: filter.operator,
|
|
59
|
+
expression: String(filter.expression),
|
|
60
|
+
expression2: filter.expression2 == null ? void 0 : String(filter.expression2)
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
function topLevelFilters(plan) {
|
|
64
|
+
if (!plan.specialFilters.topLevel) return [];
|
|
65
|
+
return [{
|
|
66
|
+
dimension: "page",
|
|
67
|
+
operator: "topLevel",
|
|
68
|
+
expression: ""
|
|
69
|
+
}];
|
|
70
|
+
}
|
|
71
|
+
function logicalFilterToInternal(filter) {
|
|
72
|
+
return {
|
|
73
|
+
dimension: filter.dimension,
|
|
74
|
+
operator: filter.operator,
|
|
75
|
+
expression: filter.expression,
|
|
76
|
+
expression2: filter.expression2
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function compileFilterTree(node, adapter, tableKey) {
|
|
80
|
+
if (!node) return void 0;
|
|
81
|
+
if (node.kind === "leaf") return adapter.dimensionPredicates([logicalFilterToInternal(node.filter)], tableKey)[0];
|
|
82
|
+
const childSqls = node.children.map((child) => compileFilterTree(child, adapter, tableKey)).filter((s) => s !== void 0);
|
|
83
|
+
if (childSqls.length === 0) return void 0;
|
|
84
|
+
if (childSqls.length === 1) return childSqls[0];
|
|
85
|
+
const sep = node.groupType === "or" ? sql` OR ` : sql` AND `;
|
|
86
|
+
return sql`(${sql.join(childSqls, sep)})`;
|
|
87
|
+
}
|
|
88
|
+
function buildScope(state, options) {
|
|
89
|
+
const { adapter, siteId, searchType } = options;
|
|
90
|
+
const plan = buildLogicalPlan(state, adapter.capabilities);
|
|
91
|
+
const tableKey = adapter.tableKeyForDataset(plan.dataset);
|
|
92
|
+
const dimFilters = toInternalDimensionFilters(plan.dimensionFilters);
|
|
93
|
+
const metricFilters = toInternalMetricFilters(plan.metricFilters);
|
|
94
|
+
const prefilters = toInternalMetricFilters(plan.prefilters);
|
|
95
|
+
const groupByDims = plan.groupByDimensions;
|
|
96
|
+
const hasDate = plan.hasDate;
|
|
97
|
+
const metrics = plan.metrics;
|
|
98
|
+
const queryCanonicalUsed = groupByDims.includes("queryCanonical") || plan.dimensionFilters.some((filter) => filter.dimension === "queryCanonical");
|
|
99
|
+
const wherePredicates = [];
|
|
100
|
+
if (adapter.siteIdColRef && siteId != null) wherePredicates.push(sql`${adapter.siteIdColRef(tableKey)} = ${siteId}`);
|
|
101
|
+
if (adapter.searchTypeColRef && searchType != null) wherePredicates.push(sql`${adapter.searchTypeColRef(tableKey)} = ${searchType}`);
|
|
102
|
+
wherePredicates.push(sql`${adapter.dateColRef(tableKey)} >= ${plan.dateRange.startDate}`);
|
|
103
|
+
wherePredicates.push(sql`${adapter.dateColRef(tableKey)} <= ${plan.dateRange.endDate}`);
|
|
104
|
+
wherePredicates.push(...adapter.prefilterPredicates(prefilters, tableKey));
|
|
105
|
+
const dimSql = plan.dimensionFilterTree ? compileFilterTree(plan.dimensionFilterTree, adapter, tableKey) : void 0;
|
|
106
|
+
if (dimSql) wherePredicates.push(dimSql);
|
|
107
|
+
else if (!plan.dimensionFilterTree) wherePredicates.push(...adapter.dimensionPredicates(dimFilters, tableKey));
|
|
108
|
+
const tl = adapter.topLevelPredicate(topLevelFilters(plan), tableKey);
|
|
109
|
+
if (tl) wherePredicates.push(tl);
|
|
110
|
+
return {
|
|
111
|
+
plan,
|
|
112
|
+
tableKey,
|
|
113
|
+
groupByDims,
|
|
114
|
+
hasDate,
|
|
115
|
+
metrics,
|
|
116
|
+
wherePredicates,
|
|
117
|
+
having: adapter.havingPredicates(metricFilters, tableKey),
|
|
118
|
+
dimFilters,
|
|
119
|
+
startDate: plan.dateRange.startDate,
|
|
120
|
+
endDate: plan.dateRange.endDate,
|
|
121
|
+
queryCanonicalUsed
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function buildComparisonPlan(current, previous, capabilities) {
|
|
125
|
+
return buildLogicalComparisonPlan(current, previous, capabilities);
|
|
126
|
+
}
|
|
127
|
+
function compileCollapsed(adapter, q) {
|
|
128
|
+
const c = adapter.compile(q);
|
|
129
|
+
return {
|
|
130
|
+
sql: collapseWs(c.sql),
|
|
131
|
+
params: c.params
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function resolveToSQLOptimized(state, options) {
|
|
135
|
+
state = withMinimumImpressions(state, options);
|
|
136
|
+
const { adapter } = options;
|
|
137
|
+
const { tableKey, groupByDims, hasDate, metrics, wherePredicates, having, queryCanonicalUsed } = buildScope(state, options);
|
|
138
|
+
const table = adapter.fromSql(tableKey, { queryCanonical: queryCanonicalUsed });
|
|
139
|
+
const schema = adapter.schema;
|
|
140
|
+
const cteSelect = [];
|
|
141
|
+
for (const d of groupByDims) {
|
|
142
|
+
const expr = adapter.dimExprSql(d, tableKey);
|
|
143
|
+
const colName = adapter.dimColumn(d, tableKey);
|
|
144
|
+
if (d === "page" || colName !== d) cteSelect.push(sql`${expr} as ${aliasRaw(d)}`);
|
|
145
|
+
else cteSelect.push(expr);
|
|
146
|
+
}
|
|
147
|
+
if (hasDate) cteSelect.push(adapter.dateColRef(tableKey));
|
|
148
|
+
const t = schema[tableKey];
|
|
149
|
+
cteSelect.push(sql`CAST(SUM(${t.clicks}) AS DOUBLE) as clicks`);
|
|
150
|
+
cteSelect.push(sql`CAST(SUM(${t.impressions}) AS DOUBLE) as impressions`);
|
|
151
|
+
cteSelect.push(sql`CAST(SUM(${t.sum_position}) AS DOUBLE) as sum_position`);
|
|
152
|
+
const groupByExprs = groupByDims.map((d) => adapter.dimExprSql(d, tableKey));
|
|
153
|
+
if (hasDate) groupByExprs.push(adapter.dateColRef(tableKey));
|
|
154
|
+
const outerSelect = [];
|
|
155
|
+
for (const d of groupByDims) outerSelect.push(aliasRaw(d));
|
|
156
|
+
if (hasDate) outerSelect.push(sql.raw("date"));
|
|
157
|
+
const outerTotals = [];
|
|
158
|
+
for (const m of metrics) switch (m) {
|
|
159
|
+
case "clicks":
|
|
160
|
+
outerSelect.push(sql.raw("clicks"));
|
|
161
|
+
outerTotals.push(sql.raw("CAST(SUM(clicks) OVER() AS DOUBLE) as totalClicks"));
|
|
162
|
+
break;
|
|
163
|
+
case "impressions":
|
|
164
|
+
outerSelect.push(sql.raw("impressions"));
|
|
165
|
+
outerTotals.push(sql.raw("CAST(SUM(impressions) OVER() AS DOUBLE) as totalImpressions"));
|
|
166
|
+
break;
|
|
167
|
+
case "ctr":
|
|
168
|
+
outerSelect.push(sql.raw("CAST(clicks AS REAL) / NULLIF(impressions, 0) as ctr"));
|
|
169
|
+
outerTotals.push(sql.raw("CAST(SUM(clicks) OVER() AS REAL) / NULLIF(SUM(impressions) OVER(), 0) as totalCtr"));
|
|
170
|
+
break;
|
|
171
|
+
case "position":
|
|
172
|
+
outerSelect.push(sql.raw("sum_position / NULLIF(impressions, 0) + 1 as position"));
|
|
173
|
+
outerTotals.push(sql.raw("SUM(sum_position) OVER() / NULLIF(SUM(impressions) OVER(), 0) + 1 as totalPosition"));
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
let orderByColumnOverride;
|
|
177
|
+
const orderColumn = state.orderBy?.column;
|
|
178
|
+
if (orderColumn && orderColumn !== "date" && !metrics.includes(orderColumn)) {
|
|
179
|
+
orderByColumnOverride = `${ORDER_BY_HELPER_PREFIX}${orderColumn}`;
|
|
180
|
+
switch (orderColumn) {
|
|
181
|
+
case "clicks":
|
|
182
|
+
outerSelect.push(sql.raw(`clicks as "${orderByColumnOverride}"`));
|
|
183
|
+
break;
|
|
184
|
+
case "impressions":
|
|
185
|
+
outerSelect.push(sql.raw(`impressions as "${orderByColumnOverride}"`));
|
|
186
|
+
break;
|
|
187
|
+
case "ctr":
|
|
188
|
+
outerSelect.push(sql.raw(`CAST(clicks AS REAL) / NULLIF(impressions, 0) as "${orderByColumnOverride}"`));
|
|
189
|
+
break;
|
|
190
|
+
case "position":
|
|
191
|
+
outerSelect.push(sql.raw(`sum_position / NULLIF(impressions, 0) + 1 as "${orderByColumnOverride}"`));
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
outerSelect.push(sql.raw("COUNT(*) OVER() as totalCount"));
|
|
196
|
+
for (const totalExpr of outerTotals) outerSelect.push(totalExpr);
|
|
197
|
+
let cte = wherePredicates.length > 0 ? sql`SELECT ${joinComma(cteSelect)} FROM ${table} WHERE ${joinAnd(wherePredicates)}` : sql`SELECT ${joinComma(cteSelect)} FROM ${table}`;
|
|
198
|
+
if (groupByExprs.length > 0) cte = sql`${cte} GROUP BY ${joinComma(groupByExprs)}`;
|
|
199
|
+
if (having.length > 0) cte = sql`${cte} HAVING ${joinAnd(having)}`;
|
|
200
|
+
return compileCollapsed(adapter, sql`WITH aggregated AS (${cte}) SELECT ${joinComma(outerSelect)} FROM aggregated ${orderByClause(state, "", orderByColumnOverride)} ${limitOffsetClause(state)}`);
|
|
201
|
+
}
|
|
202
|
+
function resolveToSQL(state, options) {
|
|
203
|
+
state = withMinimumImpressions(state, options);
|
|
204
|
+
const { adapter } = options;
|
|
205
|
+
const { tableKey, groupByDims, hasDate, metrics, wherePredicates, having, queryCanonicalUsed } = buildScope(state, options);
|
|
206
|
+
const table = adapter.fromSql(tableKey, { queryCanonical: queryCanonicalUsed });
|
|
207
|
+
const selectExprs = [];
|
|
208
|
+
for (const d of groupByDims) {
|
|
209
|
+
const expr = adapter.dimExprSql(d, tableKey);
|
|
210
|
+
const colName = adapter.dimColumn(d, tableKey);
|
|
211
|
+
if (d === "page" || colName !== d) selectExprs.push(sql`${expr} as ${aliasRaw(d)}`);
|
|
212
|
+
else selectExprs.push(expr);
|
|
213
|
+
}
|
|
214
|
+
if (hasDate) selectExprs.push(adapter.dateColRef(tableKey));
|
|
215
|
+
for (const m of metrics) selectExprs.push(sql`${adapter.metricSql(m, tableKey)} as ${aliasRaw(m)}`);
|
|
216
|
+
const groupByExprs = groupByDims.map((d) => adapter.dimExprSql(d, tableKey));
|
|
217
|
+
if (hasDate) groupByExprs.push(adapter.dateColRef(tableKey));
|
|
218
|
+
let body = wherePredicates.length > 0 ? sql`SELECT ${joinComma(selectExprs)} FROM ${table} WHERE ${joinAnd(wherePredicates)}` : sql`SELECT ${joinComma(selectExprs)} FROM ${table}`;
|
|
219
|
+
if (groupByExprs.length > 0) body = sql`${body} GROUP BY ${joinComma(groupByExprs)}`;
|
|
220
|
+
if (having.length > 0) body = sql`${body} HAVING ${joinAnd(having)}`;
|
|
221
|
+
const mainQuery = sql`${body} ${orderByClause(state)} ${limitOffsetClause(state)}`;
|
|
222
|
+
let countQuery;
|
|
223
|
+
if (groupByExprs.length > 0) {
|
|
224
|
+
let inner = wherePredicates.length > 0 ? sql`SELECT ${joinComma(groupByExprs)} FROM ${table} WHERE ${joinAnd(wherePredicates)} GROUP BY ${joinComma(groupByExprs)}` : sql`SELECT ${joinComma(groupByExprs)} FROM ${table} GROUP BY ${joinComma(groupByExprs)}`;
|
|
225
|
+
if (having.length > 0) inner = sql`${inner} HAVING ${joinAnd(having)}`;
|
|
226
|
+
countQuery = sql`SELECT COUNT(*) as total FROM (${inner})`;
|
|
227
|
+
} else countQuery = wherePredicates.length > 0 ? sql`SELECT COUNT(*) as total FROM ${table} WHERE ${joinAnd(wherePredicates)}` : sql`SELECT COUNT(*) as total FROM ${table}`;
|
|
228
|
+
const main = compileCollapsed(adapter, mainQuery);
|
|
229
|
+
const count = compileCollapsed(adapter, countQuery);
|
|
230
|
+
return {
|
|
231
|
+
sql: main.sql,
|
|
232
|
+
params: main.params,
|
|
233
|
+
countSql: count.sql,
|
|
234
|
+
countParams: count.params
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function buildTotalsSql(state, options) {
|
|
238
|
+
state = withMinimumImpressions(state, options);
|
|
239
|
+
const { adapter } = options;
|
|
240
|
+
const { tableKey, metrics, wherePredicates, queryCanonicalUsed } = buildScope(state, options);
|
|
241
|
+
const table = adapter.fromSql(tableKey, { queryCanonical: queryCanonicalUsed });
|
|
242
|
+
const selectExprs = metrics.map((m) => sql`${adapter.metricSql(m, tableKey)} as ${aliasRaw(m)}`);
|
|
243
|
+
return compileCollapsed(adapter, wherePredicates.length > 0 ? sql`SELECT ${joinComma(selectExprs)} FROM ${table} WHERE ${joinAnd(wherePredicates)}` : sql`SELECT ${joinComma(selectExprs)} FROM ${table}`);
|
|
244
|
+
}
|
|
245
|
+
function resolveComparisonSQL(current, previous, options, comparisonFilter) {
|
|
246
|
+
const { adapter, siteId, searchType } = options;
|
|
247
|
+
const comparisonPlan = buildComparisonPlan(current, previous, adapter.capabilities);
|
|
248
|
+
const currentScope = buildScope(current, options);
|
|
249
|
+
const previousScope = buildScope(previous, options);
|
|
250
|
+
const { tableKey, groupByDims, metrics, wherePredicates: currentWhere, having } = currentScope;
|
|
251
|
+
const table = adapter.fromSql(tableKey, { queryCanonical: currentScope.queryCanonicalUsed || previousScope.queryCanonicalUsed });
|
|
252
|
+
const dimSelectExprs = [];
|
|
253
|
+
for (const d of groupByDims) {
|
|
254
|
+
const expr = adapter.dimExprSql(d, tableKey);
|
|
255
|
+
const colName = adapter.dimColumn(d, tableKey);
|
|
256
|
+
if (d === "page" || colName !== d) dimSelectExprs.push(sql`${expr} as ${aliasRaw(d)}`);
|
|
257
|
+
else dimSelectExprs.push(expr);
|
|
258
|
+
}
|
|
259
|
+
const currentSelect = [...dimSelectExprs, ...metrics.map((m) => sql`${adapter.metricSql(m, tableKey)} as ${aliasRaw(m)}`)];
|
|
260
|
+
const prevSelect = [...dimSelectExprs, ...adapter.METRIC_NAMES.map((m) => sql`${adapter.metricSql(m, tableKey)} as ${aliasRaw(m)}`)];
|
|
261
|
+
const groupByExprs = groupByDims.map((d) => adapter.dimExprSql(d, tableKey));
|
|
262
|
+
const prevWhere = [];
|
|
263
|
+
if (adapter.siteIdColRef && siteId != null) prevWhere.push(sql`${adapter.siteIdColRef(tableKey)} = ${siteId}`);
|
|
264
|
+
if (adapter.searchTypeColRef && searchType != null) prevWhere.push(sql`${adapter.searchTypeColRef(tableKey)} = ${searchType}`);
|
|
265
|
+
if (previousScope.startDate) prevWhere.push(sql`${adapter.dateColRef(tableKey)} >= ${previousScope.startDate}`);
|
|
266
|
+
if (previousScope.endDate) prevWhere.push(sql`${adapter.dateColRef(tableKey)} <= ${previousScope.endDate}`);
|
|
267
|
+
const prevDimSql = comparisonPlan.current.dimensionFilterTree ? compileFilterTree(comparisonPlan.current.dimensionFilterTree, adapter, tableKey) : void 0;
|
|
268
|
+
if (prevDimSql) prevWhere.push(prevDimSql);
|
|
269
|
+
else if (!comparisonPlan.current.dimensionFilterTree) prevWhere.push(...adapter.dimensionPredicates(toInternalDimensionFilters(comparisonPlan.current.dimensionFilters), tableKey));
|
|
270
|
+
let currentCte = currentWhere.length > 0 ? sql`SELECT ${joinComma(currentSelect)} FROM ${table} WHERE ${joinAnd(currentWhere)}` : sql`SELECT ${joinComma(currentSelect)} FROM ${table}`;
|
|
271
|
+
if (groupByExprs.length > 0) currentCte = sql`${currentCte} GROUP BY ${joinComma(groupByExprs)}`;
|
|
272
|
+
if (having.length > 0) currentCte = sql`${currentCte} HAVING ${joinAnd(having)}`;
|
|
273
|
+
let previousCte = prevWhere.length > 0 ? sql`SELECT ${joinComma(prevSelect)} FROM ${table} WHERE ${joinAnd(prevWhere)}` : sql`SELECT ${joinComma(prevSelect)} FROM ${table}`;
|
|
274
|
+
if (groupByExprs.length > 0) previousCte = sql`${previousCte} GROUP BY ${joinComma(groupByExprs)}`;
|
|
275
|
+
const joinOn = groupByDims.length > 0 ? sql.raw(groupByDims.map((d) => `c.${d.replace(/\W/g, "")} = p.${d.replace(/\W/g, "")}`).join(" AND ")) : sql.raw("1=1");
|
|
276
|
+
const filterClause = comparisonFilter ? COMPARISON_FILTER_SQL[comparisonFilter] : sql.raw("");
|
|
277
|
+
const orderSql = orderByClause(current, "");
|
|
278
|
+
const limitSql = limitOffsetClause(current);
|
|
279
|
+
const outerCurrentCols = [];
|
|
280
|
+
for (const d of groupByDims) {
|
|
281
|
+
const colName = d.replace(/\W/g, "");
|
|
282
|
+
outerCurrentCols.push(sql.raw(`COALESCE(c.${colName}, p.${colName}) as "${colName}"`));
|
|
283
|
+
}
|
|
284
|
+
outerCurrentCols.push(sql.raw("CAST(COALESCE(c.clicks, 0) AS DOUBLE) as \"clicks\""));
|
|
285
|
+
outerCurrentCols.push(sql.raw("CAST(COALESCE(c.impressions, 0) AS DOUBLE) as \"impressions\""));
|
|
286
|
+
outerCurrentCols.push(sql.raw("COALESCE(c.ctr, 0) as \"ctr\""));
|
|
287
|
+
outerCurrentCols.push(sql.raw("COALESCE(c.position, 0) as \"position\""));
|
|
288
|
+
const mainQuery = sql`WITH current AS (${currentCte}), previous AS (${previousCte}) SELECT ${joinComma(outerCurrentCols)}, COALESCE(CAST(p.clicks AS DOUBLE), 0) as "prevClicks", COALESCE(CAST(p.impressions AS DOUBLE), 0) as "prevImpressions", COALESCE(p.ctr, 0) as "prevCtr", COALESCE(p.position, 0) as "prevPosition" FROM current c FULL OUTER JOIN previous p ON ${joinOn} WHERE 1=1 ${filterClause} ${orderSql} ${limitSql}`;
|
|
289
|
+
const firstGroupBy = groupByDims[0] ? groupByDims[0].replace(/\W/g, "") : "clicks";
|
|
290
|
+
const countInnerSelect = groupByDims[0] ? sql.raw(`COALESCE(c.${firstGroupBy}, p.${firstGroupBy})`) : sql.raw(`c.${firstGroupBy}`);
|
|
291
|
+
const countQuery = sql`WITH current AS (${currentCte}), previous AS (${previousCte}) SELECT COUNT(*) as total FROM (SELECT ${countInnerSelect} FROM current c FULL OUTER JOIN previous p ON ${joinOn} WHERE 1=1 ${filterClause})`;
|
|
292
|
+
const main = compileCollapsed(adapter, mainQuery);
|
|
293
|
+
const count = compileCollapsed(adapter, countQuery);
|
|
294
|
+
return {
|
|
295
|
+
sql: main.sql,
|
|
296
|
+
params: main.params,
|
|
297
|
+
countSql: count.sql,
|
|
298
|
+
countParams: count.params
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function buildExtrasQueries(state, options) {
|
|
302
|
+
const { adapter, siteId, searchType } = options;
|
|
303
|
+
const plan = buildLogicalPlan(state, adapter.capabilities);
|
|
304
|
+
const dims = plan.groupByDimensions;
|
|
305
|
+
const extras = [];
|
|
306
|
+
if (!dims.includes("queryCanonical")) return extras;
|
|
307
|
+
const queriesKey = adapter.tableKeyForDataset("queries");
|
|
308
|
+
const t = adapter.schema[queriesKey];
|
|
309
|
+
const table = adapter.fromSql(queriesKey, { queryCanonical: true });
|
|
310
|
+
const whereParts = [];
|
|
311
|
+
if (adapter.siteIdColRef && siteId != null) whereParts.push(sql`${adapter.siteIdColRef(queriesKey)} = ${siteId}`);
|
|
312
|
+
if (adapter.searchTypeColRef && searchType != null) whereParts.push(sql`${adapter.searchTypeColRef(queriesKey)} = ${searchType}`);
|
|
313
|
+
whereParts.push(sql`${adapter.dateColRef(queriesKey)} >= ${plan.dateRange.startDate}`);
|
|
314
|
+
whereParts.push(sql`${adapter.dateColRef(queriesKey)} <= ${plan.dateRange.endDate}`);
|
|
315
|
+
const whereExpr = whereParts.length > 0 ? sql`WHERE ${joinAnd(whereParts)}` : sql``;
|
|
316
|
+
const outerQueryCol = sql.raw("query");
|
|
317
|
+
const canonKey = adapter.dimExprSql("queryCanonical", queriesKey);
|
|
318
|
+
const compiled = compileCollapsed(adapter, sql`WITH per_variant AS (SELECT ${canonKey} as joinKey, ${t.query} as query, SUM(${t.clicks}) as clicks, SUM(${t.impressions}) as impressions, SUM(${t.sum_position}) as sum_pos, ROW_NUMBER() OVER (PARTITION BY ${canonKey} ORDER BY SUM(${t.clicks}) DESC) as rn, COUNT(*) OVER (PARTITION BY ${canonKey}) as variantCount FROM ${table} ${whereExpr} GROUP BY ${canonKey}, ${t.query}) SELECT joinKey, MAX(variantCount) as variantCount, MAX(CASE WHEN rn = 1 THEN ${outerQueryCol} END) as canonicalName, GROUP_CONCAT(CASE WHEN rn <= 10 THEN ${outerQueryCol} || ':::' || clicks || ':::' || impressions || ':::' || CAST(ROUND(CAST(sum_pos AS REAL) / NULLIF(impressions, 0) + 1, 1) AS TEXT) END, '||') as variants FROM per_variant GROUP BY joinKey`);
|
|
319
|
+
extras.push({
|
|
320
|
+
key: "canonicalExtras",
|
|
321
|
+
sql: compiled.sql,
|
|
322
|
+
params: compiled.params
|
|
323
|
+
});
|
|
324
|
+
return extras;
|
|
325
|
+
}
|
|
326
|
+
function mergeExtras(rows, extrasResults) {
|
|
327
|
+
if (extrasResults.length === 0) return rows;
|
|
328
|
+
const lookups = [];
|
|
329
|
+
const parseVariants = (raw) => {
|
|
330
|
+
if (raw.length === 0) return [];
|
|
331
|
+
const encoded = raw.split("||");
|
|
332
|
+
const variants = [];
|
|
333
|
+
for (const value of encoded) {
|
|
334
|
+
if (value.length === 0) continue;
|
|
335
|
+
const parts = value.split(":::");
|
|
336
|
+
variants.push({
|
|
337
|
+
query: parts[0],
|
|
338
|
+
clicks: Number(parts[1] || 0),
|
|
339
|
+
impressions: Number(parts[2] || 0),
|
|
340
|
+
position: Number(parts[3] || 0)
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
return variants;
|
|
344
|
+
};
|
|
345
|
+
for (const { key, results } of extrasResults) {
|
|
346
|
+
if (key === "canonicalExtras") {
|
|
347
|
+
const map = /* @__PURE__ */ new Map();
|
|
348
|
+
for (const r of results) {
|
|
349
|
+
const jk = String(r.joinKey);
|
|
350
|
+
const raw = r.variants;
|
|
351
|
+
map.set(jk, {
|
|
352
|
+
variantCount: r.variantCount,
|
|
353
|
+
variants: typeof raw === "string" ? parseVariants(raw) : [],
|
|
354
|
+
canonicalName: r.canonicalName
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
lookups.push({
|
|
358
|
+
kind: "canonical",
|
|
359
|
+
map
|
|
360
|
+
});
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
const map = /* @__PURE__ */ new Map();
|
|
364
|
+
for (const r of results) {
|
|
365
|
+
if (r.rn !== void 0 && r.rn !== 1) continue;
|
|
366
|
+
let val = r[key];
|
|
367
|
+
if (key === "variants" && typeof val === "string") val = parseVariants(val);
|
|
368
|
+
map.set(String(r.joinKey), val);
|
|
369
|
+
}
|
|
370
|
+
lookups.push({
|
|
371
|
+
kind: "generic",
|
|
372
|
+
key,
|
|
373
|
+
map
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
return rows.map((row) => {
|
|
377
|
+
const enriched = { ...row };
|
|
378
|
+
for (const lookup of lookups) {
|
|
379
|
+
if (lookup.kind === "canonical") {
|
|
380
|
+
const joinValue = String(row.queryCanonical ?? row.query_canonical ?? "");
|
|
381
|
+
const extra = joinValue ? lookup.map.get(joinValue) : void 0;
|
|
382
|
+
enriched.variantCount = extra?.variantCount ?? null;
|
|
383
|
+
enriched.variants = extra?.variants ?? [];
|
|
384
|
+
enriched.canonicalName = extra?.canonicalName ?? null;
|
|
385
|
+
if (enriched.canonicalName) enriched.queryCanonical = enriched.canonicalName;
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
const { key, map } = lookup;
|
|
389
|
+
const joinValue = key === "variantCount" || key === "variants" || key === "canonicalName" ? String(row.queryCanonical ?? row.query_canonical ?? "") : void 0;
|
|
390
|
+
enriched[key] = (joinValue && map.get(joinValue)) ?? (key === "variants" ? [] : null);
|
|
391
|
+
if (key === "canonicalName" && enriched[key]) enriched.queryCanonical = enriched[key];
|
|
392
|
+
}
|
|
393
|
+
return enriched;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
export { buildExtrasQueries, buildTotalsSql, mergeExtras, resolveComparisonSQL, resolveToSQL, resolveToSQLOptimized };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LogicalDataset as LogicalDataset$1, UnresolvableDatasetError, inferDataset as inferLogicalDataset, isDatasetResolvable } from "gscdump/query/plan";
|
|
2
|
+
import { Dimension } from "gscdump/query";
|
|
3
|
+
type DimensionSurface = 'api' | 'stored' | 'derived';
|
|
4
|
+
interface DimensionBinding {
|
|
5
|
+
column: string;
|
|
6
|
+
surfaces: readonly DimensionSurface[];
|
|
7
|
+
}
|
|
8
|
+
interface LogicalDatasetDefinition {
|
|
9
|
+
dimensions: Partial<Record<Dimension, DimensionBinding>>;
|
|
10
|
+
}
|
|
11
|
+
declare const DIMENSION_SURFACES: Record<Dimension, readonly DimensionSurface[]>;
|
|
12
|
+
declare const LOGICAL_DATASETS: Record<LogicalDataset$1, LogicalDatasetDefinition>;
|
|
13
|
+
declare function dimensionColumn(dim: Dimension, dataset: LogicalDataset$1): string;
|
|
14
|
+
declare function supportsDimensionOnSurface(dim: Dimension, surface: DimensionSurface): boolean;
|
|
15
|
+
declare function assertDimensionsSupported(dimensions: readonly Dimension[], surface: DimensionSurface, context: string): void;
|
|
16
|
+
export { DIMENSION_SURFACES, DimensionBinding, DimensionSurface, LOGICAL_DATASETS, type LogicalDataset$1 as LogicalDataset, LogicalDatasetDefinition, UnresolvableDatasetError, assertDimensionsSupported, dimensionColumn, inferLogicalDataset, isDatasetResolvable, supportsDimensionOnSurface };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { UnresolvableDatasetError, inferDataset as inferLogicalDataset, isDatasetResolvable } from "gscdump/query/plan";
|
|
2
|
+
const DIMENSION_SURFACES = {
|
|
3
|
+
page: ["api", "stored"],
|
|
4
|
+
query: ["api", "stored"],
|
|
5
|
+
queryCanonical: ["derived"],
|
|
6
|
+
country: ["api", "stored"],
|
|
7
|
+
device: ["api", "stored"],
|
|
8
|
+
searchAppearance: ["api", "stored"],
|
|
9
|
+
date: ["api", "stored"],
|
|
10
|
+
hour: ["api", "stored"]
|
|
11
|
+
};
|
|
12
|
+
const LOGICAL_DATASETS = {
|
|
13
|
+
pages: { dimensions: {
|
|
14
|
+
page: {
|
|
15
|
+
column: "url",
|
|
16
|
+
surfaces: ["api", "stored"]
|
|
17
|
+
},
|
|
18
|
+
date: {
|
|
19
|
+
column: "date",
|
|
20
|
+
surfaces: ["api", "stored"]
|
|
21
|
+
}
|
|
22
|
+
} },
|
|
23
|
+
queries: { dimensions: {
|
|
24
|
+
query: {
|
|
25
|
+
column: "query",
|
|
26
|
+
surfaces: ["api", "stored"]
|
|
27
|
+
},
|
|
28
|
+
queryCanonical: {
|
|
29
|
+
column: "query_canonical",
|
|
30
|
+
surfaces: ["derived"]
|
|
31
|
+
},
|
|
32
|
+
date: {
|
|
33
|
+
column: "date",
|
|
34
|
+
surfaces: ["api", "stored"]
|
|
35
|
+
}
|
|
36
|
+
} },
|
|
37
|
+
page_queries: { dimensions: {
|
|
38
|
+
page: {
|
|
39
|
+
column: "url",
|
|
40
|
+
surfaces: ["api", "stored"]
|
|
41
|
+
},
|
|
42
|
+
query: {
|
|
43
|
+
column: "query",
|
|
44
|
+
surfaces: ["api", "stored"]
|
|
45
|
+
},
|
|
46
|
+
queryCanonical: {
|
|
47
|
+
column: "query_canonical",
|
|
48
|
+
surfaces: ["derived"]
|
|
49
|
+
},
|
|
50
|
+
date: {
|
|
51
|
+
column: "date",
|
|
52
|
+
surfaces: ["api", "stored"]
|
|
53
|
+
}
|
|
54
|
+
} },
|
|
55
|
+
countries: { dimensions: {
|
|
56
|
+
country: {
|
|
57
|
+
column: "country",
|
|
58
|
+
surfaces: ["api", "stored"]
|
|
59
|
+
},
|
|
60
|
+
date: {
|
|
61
|
+
column: "date",
|
|
62
|
+
surfaces: ["api", "stored"]
|
|
63
|
+
}
|
|
64
|
+
} },
|
|
65
|
+
dates: { dimensions: { date: {
|
|
66
|
+
column: "date",
|
|
67
|
+
surfaces: ["api", "stored"]
|
|
68
|
+
} } },
|
|
69
|
+
search_appearance: { dimensions: {
|
|
70
|
+
searchAppearance: {
|
|
71
|
+
column: "searchAppearance",
|
|
72
|
+
surfaces: ["api", "stored"]
|
|
73
|
+
},
|
|
74
|
+
date: {
|
|
75
|
+
column: "date",
|
|
76
|
+
surfaces: ["api", "stored"]
|
|
77
|
+
}
|
|
78
|
+
} },
|
|
79
|
+
search_appearance_pages: { dimensions: {
|
|
80
|
+
searchAppearance: {
|
|
81
|
+
column: "searchAppearance",
|
|
82
|
+
surfaces: ["stored"]
|
|
83
|
+
},
|
|
84
|
+
page: {
|
|
85
|
+
column: "url",
|
|
86
|
+
surfaces: ["stored"]
|
|
87
|
+
},
|
|
88
|
+
date: {
|
|
89
|
+
column: "date",
|
|
90
|
+
surfaces: ["stored"]
|
|
91
|
+
}
|
|
92
|
+
} },
|
|
93
|
+
search_appearance_queries: { dimensions: {
|
|
94
|
+
searchAppearance: {
|
|
95
|
+
column: "searchAppearance",
|
|
96
|
+
surfaces: ["stored"]
|
|
97
|
+
},
|
|
98
|
+
query: {
|
|
99
|
+
column: "query",
|
|
100
|
+
surfaces: ["stored"]
|
|
101
|
+
},
|
|
102
|
+
queryCanonical: {
|
|
103
|
+
column: "query_canonical",
|
|
104
|
+
surfaces: ["derived"]
|
|
105
|
+
},
|
|
106
|
+
date: {
|
|
107
|
+
column: "date",
|
|
108
|
+
surfaces: ["stored"]
|
|
109
|
+
}
|
|
110
|
+
} },
|
|
111
|
+
search_appearance_page_queries: { dimensions: {
|
|
112
|
+
searchAppearance: {
|
|
113
|
+
column: "searchAppearance",
|
|
114
|
+
surfaces: ["stored"]
|
|
115
|
+
},
|
|
116
|
+
page: {
|
|
117
|
+
column: "url",
|
|
118
|
+
surfaces: ["stored"]
|
|
119
|
+
},
|
|
120
|
+
query: {
|
|
121
|
+
column: "query",
|
|
122
|
+
surfaces: ["stored"]
|
|
123
|
+
},
|
|
124
|
+
queryCanonical: {
|
|
125
|
+
column: "query_canonical",
|
|
126
|
+
surfaces: ["derived"]
|
|
127
|
+
},
|
|
128
|
+
date: {
|
|
129
|
+
column: "date",
|
|
130
|
+
surfaces: ["stored"]
|
|
131
|
+
}
|
|
132
|
+
} },
|
|
133
|
+
hourly_pages: { dimensions: {
|
|
134
|
+
page: {
|
|
135
|
+
column: "url",
|
|
136
|
+
surfaces: ["api", "stored"]
|
|
137
|
+
},
|
|
138
|
+
date: {
|
|
139
|
+
column: "date",
|
|
140
|
+
surfaces: ["api", "stored"]
|
|
141
|
+
},
|
|
142
|
+
hour: {
|
|
143
|
+
column: "hour",
|
|
144
|
+
surfaces: ["api", "stored"]
|
|
145
|
+
}
|
|
146
|
+
} }
|
|
147
|
+
};
|
|
148
|
+
function dimensionColumn(dim, dataset) {
|
|
149
|
+
return LOGICAL_DATASETS[dataset].dimensions[dim]?.column ?? dim;
|
|
150
|
+
}
|
|
151
|
+
function supportsDimensionOnSurface(dim, surface) {
|
|
152
|
+
return DIMENSION_SURFACES[dim].includes(surface);
|
|
153
|
+
}
|
|
154
|
+
function assertDimensionsSupported(dimensions, surface, context) {
|
|
155
|
+
const unsupported = dimensions.filter((dim) => !supportsDimensionOnSurface(dim, surface));
|
|
156
|
+
if (unsupported.length === 0) return;
|
|
157
|
+
throw new Error(`${context}: unsupported dimensions for ${surface}: ${unsupported.join(", ")}`);
|
|
158
|
+
}
|
|
159
|
+
export { DIMENSION_SURFACES, LOGICAL_DATASETS, UnresolvableDatasetError, assertDimensionsSupported, dimensionColumn, inferLogicalDataset, isDatasetResolvable, supportsDimensionOnSurface };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SearchType } from "../storage.mjs";
|
|
2
|
+
import { ResolveExtraFn } from "./run-query.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Host-supplied reader: return the materialised rollup's rows for an
|
|
5
|
+
* `(id, tenant, slice)`, in the exact shape the live extra produces, or `null`
|
|
6
|
+
* when no rollup exists (first sync, never built, stale) so the overlay
|
|
7
|
+
* declines and the resolver falls back to the live query. Typically wired with
|
|
8
|
+
* `readLatestRollup` + a `read_parquet` of the pointer.
|
|
9
|
+
*
|
|
10
|
+
* `dateRange` is the request window. `query_canonical_variants` is full-history
|
|
11
|
+
* (its grouping/variant metrics span all dates), but `buildExtrasQueries`
|
|
12
|
+
* windows the live `canonicalExtras` to the requested range — so for a narrow
|
|
13
|
+
* window the reader MUST decline (return `null`) rather than attach
|
|
14
|
+
* out-of-window variantCount/canonicalName/variants. A common rule: serve only
|
|
15
|
+
* when the request window covers full history.
|
|
16
|
+
*/
|
|
17
|
+
interface RollupRowsReader {
|
|
18
|
+
(opts: {
|
|
19
|
+
id: string;
|
|
20
|
+
ctx: {
|
|
21
|
+
userId: string;
|
|
22
|
+
siteId: string;
|
|
23
|
+
};
|
|
24
|
+
searchType?: SearchType;
|
|
25
|
+
dateRange: {
|
|
26
|
+
startDate: string;
|
|
27
|
+
endDate: string;
|
|
28
|
+
};
|
|
29
|
+
}): Promise<Array<Record<string, unknown>> | null>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build a {@link ResolveExtraFn} that serves resolver extras from materialised
|
|
33
|
+
* rollups when one is mapped for the extra's key, else returns `null` to fall
|
|
34
|
+
* back to the live SQL. Pure wiring around the host's `readRollupRows`.
|
|
35
|
+
*/
|
|
36
|
+
declare function createRollupExtrasOverlay(readRollupRows: RollupRowsReader): ResolveExtraFn;
|
|
37
|
+
export { RollupRowsReader, createRollupExtrasOverlay };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const EXTRA_ROLLUP_IDS = { canonicalExtras: "query_canonical_variants" };
|
|
2
|
+
function createRollupExtrasOverlay(readRollupRows) {
|
|
3
|
+
return async ({ key, ctx, dateRange }) => {
|
|
4
|
+
const id = EXTRA_ROLLUP_IDS[key];
|
|
5
|
+
if (id === void 0) return null;
|
|
6
|
+
return readRollupRows({
|
|
7
|
+
id,
|
|
8
|
+
ctx: {
|
|
9
|
+
userId: ctx.userId,
|
|
10
|
+
siteId: ctx.siteId
|
|
11
|
+
},
|
|
12
|
+
dateRange,
|
|
13
|
+
...ctx.searchType !== void 0 ? { searchType: ctx.searchType } : {}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export { createRollupExtrasOverlay };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dimension, FilterInput, InternalFilter, Metric } from "gscdump/query";
|
|
2
|
+
declare function getInternalFilters(filter: FilterInput | undefined): InternalFilter[];
|
|
3
|
+
declare function getDimensionFilters(filter: FilterInput | undefined, isMetricDimension: (dim: string) => dim is Metric): InternalFilter[];
|
|
4
|
+
declare function getFilterDimensions(filter: FilterInput | undefined, isMetricDimension: (dim: string) => dim is Metric): Dimension[];
|
|
5
|
+
declare function metricValue(row: Record<string, unknown>, metric: string): number;
|
|
6
|
+
declare function dimensionValue(row: Record<string, unknown>, dimension: string): string;
|
|
7
|
+
declare function matchesDimensionFilter(row: Record<string, unknown>, filter: InternalFilter): boolean;
|
|
8
|
+
declare function matchesMetricFilter(row: Record<string, unknown>, filter: InternalFilter): boolean;
|
|
9
|
+
declare function matchesTopLevelPage(row: Record<string, unknown>): boolean;
|
|
10
|
+
export { dimensionValue, getDimensionFilters, getFilterDimensions, getInternalFilters, matchesDimensionFilter, matchesMetricFilter, matchesTopLevelPage, metricValue };
|