@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.
Files changed (366) hide show
  1. package/dist/adapters/duckdb-node.d.mts +7 -0
  2. package/dist/adapters/duckdb-node.mjs +94 -0
  3. package/dist/adapters/filesystem.d.mts +1 -1
  4. package/dist/adapters/filesystem.mjs +1 -1
  5. package/dist/adapters/hyparquet.d.mts +4 -3
  6. package/dist/adapters/hyparquet.mjs +7 -3
  7. package/dist/adapters/node-harness.d.mts +38 -0
  8. package/dist/adapters/node-harness.mjs +47 -0
  9. package/dist/adapters/node.d.mts +4 -100
  10. package/dist/adapters/node.mjs +4 -240
  11. package/dist/adapters/parquet-attach.d.mts +23 -0
  12. package/dist/adapters/parquet-attach.mjs +21 -0
  13. package/dist/adapters/r2-manifest.d.mts +82 -0
  14. package/dist/adapters/r2-manifest.mjs +364 -0
  15. package/dist/adapters/r2.d.mts +1 -1
  16. package/dist/adapters/read-optional.mjs +15 -0
  17. package/dist/adapters/snapshot-attach.d.mts +38 -0
  18. package/dist/adapters/snapshot-attach.mjs +85 -0
  19. package/dist/analysis-types.d.mts +56 -1
  20. package/dist/analyzer/define.d.mts +48 -0
  21. package/dist/analyzer/define.mjs +60 -0
  22. package/dist/analyzer/dispatch.d.mts +17 -0
  23. package/dist/analyzer/index.d.mts +4 -14
  24. package/dist/analyzer/index.mjs +4 -112
  25. package/dist/analyzer/registry.d.mts +33 -0
  26. package/dist/analyzer/registry.mjs +49 -0
  27. package/dist/analyzer/types.d.mts +95 -0
  28. package/dist/analyzer/types.mjs +5 -0
  29. package/dist/coerce.d.mts +4 -0
  30. package/dist/compaction.d.mts +14 -0
  31. package/dist/{_chunks/parquet-plan.mjs → compaction.mjs} +2 -138
  32. package/dist/contracts.d.mts +1 -2
  33. package/dist/{_chunks/schema.d.mts → drizzle-schema.d.mts} +22 -54
  34. package/dist/{_chunks/schema.mjs → drizzle-schema.mjs} +2 -78
  35. package/dist/{_chunks/snapshot.d.mts → duckdb.d.mts} +1 -14
  36. package/dist/duckdb.mjs +207 -0
  37. package/dist/engine.d.mts +4 -0
  38. package/dist/engine.mjs +385 -0
  39. package/dist/entities.d.mts +3 -52
  40. package/dist/entities.mjs +867 -2
  41. package/dist/errors.d.mts +114 -1
  42. package/dist/gc.mjs +92 -0
  43. package/dist/iceberg/append-sink.d.mts +14 -0
  44. package/dist/iceberg/append-sink.mjs +142 -0
  45. package/dist/iceberg/catalog.d.mts +71 -0
  46. package/dist/iceberg/catalog.mjs +109 -0
  47. package/dist/iceberg/index.d.mts +4 -13
  48. package/dist/iceberg/index.mjs +3 -244
  49. package/dist/iceberg/overwrite-writer.d.mts +161 -0
  50. package/dist/iceberg/overwrite-writer.mjs +102 -0
  51. package/dist/iceberg/pyiceberg-runtime.mjs +34 -0
  52. package/dist/iceberg/schema.d.mts +69 -0
  53. package/dist/{_chunks/schema2.mjs → iceberg/schema.mjs} +3 -2
  54. package/dist/index.d.mts +14 -190
  55. package/dist/index.mjs +10 -645
  56. package/dist/ingest-accumulator.d.mts +1 -1
  57. package/dist/ingest.d.mts +1 -1
  58. package/dist/layout.d.mts +31 -0
  59. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.bitreader.mjs +88 -0
  60. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.blocks.mjs +120 -0
  61. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.context.mjs +1805 -0
  62. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.contextmap.mjs +49 -0
  63. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.dictionary.mjs +984 -0
  64. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.huffman.mjs +266 -0
  65. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.mjs +340 -0
  66. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.prefix.mjs +109 -0
  67. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.streams.mjs +21 -0
  68. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.transform.mjs +190 -0
  69. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/compressors.mjs +7 -0
  70. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/gzip.huffman.mjs +121 -0
  71. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/gzip.mjs +176 -0
  72. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/index.mjs +7 -0
  73. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/lz4.mjs +52 -0
  74. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/bloom.mjs +93 -0
  75. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/bytewriter.mjs +91 -0
  76. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/column.mjs +186 -0
  77. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/datapage.mjs +113 -0
  78. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/delta.mjs +111 -0
  79. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/dictionary.mjs +99 -0
  80. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/dremel.mjs +116 -0
  81. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/encoding.mjs +51 -0
  82. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/geospatial.mjs +84 -0
  83. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/index.mjs +7 -0
  84. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/indexes.mjs +31 -0
  85. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/metadata.mjs +138 -0
  86. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/node.mjs +8 -0
  87. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/parquet-writer.mjs +139 -0
  88. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/plain.mjs +68 -0
  89. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/schema.mjs +254 -0
  90. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/snappy.mjs +125 -0
  91. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/splitstream.mjs +38 -0
  92. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/thrift.mjs +79 -0
  93. 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
  94. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/unconvert.mjs +247 -0
  95. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/variant.mjs +321 -0
  96. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/wkb.mjs +79 -0
  97. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/write-rows.mjs +122 -0
  98. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/write.mjs +5 -0
  99. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/bytewriter.d.mts +1 -0
  100. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/index.d.mts +10 -0
  101. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/node.d.mts +3 -0
  102. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/parquet-writer.d.mts +2 -0
  103. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/schema.d.mts +2 -0
  104. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/wkb.d.mts +1 -0
  105. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/write-rows.d.mts +1 -0
  106. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/write.d.mts +1 -0
  107. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/assemble.mjs +3 -0
  108. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/bloom.mjs +69 -0
  109. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/column.mjs +8 -0
  110. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/constants.mjs +80 -0
  111. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/convert.mjs +3 -0
  112. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/datapage.mjs +6 -0
  113. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/delta.mjs +2 -0
  114. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/encoding.mjs +2 -0
  115. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/filter.mjs +3 -0
  116. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/geoparquet.mjs +1 -0
  117. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/index.mjs +7 -0
  118. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/indexes.mjs +5 -0
  119. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/metadata.mjs +7 -0
  120. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/node.mjs +3 -0
  121. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/plain.mjs +1 -0
  122. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/plan.mjs +5 -0
  123. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/query.mjs +3 -0
  124. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/read.mjs +6 -0
  125. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/rowgroup.mjs +7 -0
  126. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/schema.mjs +54 -0
  127. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/snappy.mjs +1 -0
  128. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/thrift.mjs +1 -0
  129. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/types.d.mts +1 -0
  130. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/utils.mjs +19 -0
  131. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/variant.mjs +3 -0
  132. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/wkb.mjs +1 -0
  133. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/xxhash.mjs +68 -0
  134. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/index.d.mts +7 -0
  135. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/indexes.d.mts +1 -0
  136. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/metadata.d.mts +1 -0
  137. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/node.d.mts +2 -0
  138. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/query.d.mts +1 -0
  139. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/read.d.mts +1 -0
  140. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/snappy.d.mts +1 -0
  141. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/utils.d.mts +1 -0
  142. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/assemble.mjs +144 -0
  143. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/bloom.mjs +124 -0
  144. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/column.mjs +127 -0
  145. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/constants.mjs +75 -0
  146. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/convert.mjs +118 -0
  147. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/datapage.mjs +144 -0
  148. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/delta.mjs +65 -0
  149. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/encoding.mjs +76 -0
  150. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/filter.mjs +98 -0
  151. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/geoparquet.mjs +24 -0
  152. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/index.mjs +7 -0
  153. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/indexes.mjs +16 -0
  154. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/metadata.mjs +235 -0
  155. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/node.mjs +7 -0
  156. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/plain.mjs +78 -0
  157. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/plan.mjs +147 -0
  158. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/query.mjs +3 -0
  159. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/read.mjs +106 -0
  160. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/rowgroup.mjs +154 -0
  161. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/schema.mjs +75 -0
  162. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/snappy.mjs +70 -0
  163. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/thrift.mjs +86 -0
  164. package/dist/{_chunks/libs/hyparquet.d.mts → node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/types.d.mts} +6 -8
  165. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/utils.mjs +31 -0
  166. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/variant.mjs +225 -0
  167. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/wkb.mjs +94 -0
  168. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/xxhash.mjs +68 -0
  169. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/index.d.mts +10 -0
  170. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/indexes.d.mts +1 -0
  171. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/metadata.d.mts +1 -0
  172. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/node.d.mts +3 -0
  173. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/query.d.mts +1 -0
  174. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/read.d.mts +1 -0
  175. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/snappy.d.mts +1 -0
  176. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/utils.d.mts +1 -0
  177. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.metadata.mjs +1 -0
  178. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.read.mjs +4 -0
  179. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.write.mjs +2 -0
  180. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/file.mjs +1 -0
  181. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/loadTable.mjs +3 -0
  182. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/rest.mjs +73 -0
  183. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/create.mjs +67 -0
  184. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/delete.mjs +2 -0
  185. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/fetch.mjs +8 -0
  186. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/index.mjs +13 -0
  187. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/json.mjs +147 -0
  188. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/manifest.mjs +2 -0
  189. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/metadata.mjs +3 -0
  190. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/prune.mjs +4 -0
  191. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/deletion-vector.mjs +2 -0
  192. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/puffin.mjs +2 -0
  193. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/roaring.mjs +1 -0
  194. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/read.mjs +9 -0
  195. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/s3.mjs +3 -0
  196. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/schema.mjs +76 -0
  197. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sigv4.mjs +2 -0
  198. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/icebergDataSource.mjs +8 -0
  199. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/icebergQuery.mjs +5 -0
  200. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/whereFilter.mjs +1 -0
  201. 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
  202. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/utils.mjs +8 -0
  203. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/commit.mjs +5 -0
  204. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/conversions.mjs +19 -0
  205. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/delete-file.mjs +3 -0
  206. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/geospatial.mjs +1 -0
  207. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/manifest-list.mjs +2 -0
  208. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/manifest.mjs +3 -0
  209. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/parquet.mjs +5 -0
  210. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/partition.mjs +75 -0
  211. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/rewrite.mjs +10 -0
  212. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/serde.mjs +2 -0
  213. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/snapshot.mjs +5 -0
  214. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/sort.mjs +3 -0
  215. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage-deletion-vector.mjs +11 -0
  216. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage-position-delete.mjs +8 -0
  217. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage.mjs +10 -0
  218. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stats.mjs +4 -0
  219. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/transform.mjs +60 -0
  220. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/write.mjs +45 -0
  221. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/catalog/file.d.mts +1 -0
  222. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/catalog/rest.d.mts +1 -0
  223. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/create.d.mts +1 -0
  224. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/fetch.d.mts +1 -0
  225. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/index.d.mts +13 -0
  226. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/manifest.d.mts +1 -0
  227. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/metadata.d.mts +1 -0
  228. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/read.d.mts +2 -0
  229. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/s3.d.mts +1 -0
  230. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/sql/icebergDataSource.d.mts +2 -0
  231. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/sql/icebergQuery.d.mts +2 -0
  232. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/write/write.d.mts +32 -0
  233. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/ast.d.mts +1 -0
  234. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/backend/dataSource.mjs +1 -0
  235. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/accumulator.mjs +2 -0
  236. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/aggregates.mjs +10 -0
  237. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/execute.mjs +15 -0
  238. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/join.mjs +5 -0
  239. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/scanColumn.mjs +1 -0
  240. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/sort.mjs +5 -0
  241. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/streamingAggregate.mjs +9 -0
  242. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/utils.mjs +1 -0
  243. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/window.mjs +5 -0
  244. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/yield.mjs +17 -0
  245. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/alias.mjs +1 -0
  246. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/binary.mjs +1 -0
  247. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/date.mjs +1 -0
  248. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/evaluate.mjs +15 -0
  249. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/math.mjs +1 -0
  250. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/regexp.mjs +2 -0
  251. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/strings.mjs +3 -0
  252. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/index.d.mts +1 -0
  253. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/index.mjs +9 -0
  254. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/expression.mjs +6 -0
  255. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/extractTables.mjs +1 -0
  256. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/functions.mjs +5 -0
  257. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/joins.mjs +7 -0
  258. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/parse.mjs +10 -0
  259. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/primary.mjs +8 -0
  260. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/state.mjs +2 -0
  261. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/tokenize.mjs +3 -0
  262. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/types.d.mts +1 -0
  263. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/columns.mjs +3 -0
  264. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/plan.mjs +7 -0
  265. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/types.d.mts +1 -0
  266. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/bbox.mjs +2 -0
  267. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/equality.mjs +2 -0
  268. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/operations.mjs +5 -0
  269. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/pointRelations.mjs +2 -0
  270. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/primitives.mjs +2 -0
  271. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/segments.mjs +2 -0
  272. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/spatial.mjs +6 -0
  273. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/wkt.mjs +1 -0
  274. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/types.d.mts +3 -0
  275. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/aggregates.mjs +3 -0
  276. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/executionErrors.mjs +2 -0
  277. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/functions.mjs +2 -0
  278. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/keywords.mjs +1 -0
  279. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/parseErrors.mjs +2 -0
  280. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/tables.mjs +2 -0
  281. package/dist/parquet-plan.d.mts +15 -0
  282. package/dist/parquet-plan.mjs +139 -0
  283. package/dist/parquet-pushdown.mjs +58 -0
  284. package/dist/period/index.d.mts +52 -1
  285. package/dist/planner.d.mts +2 -14
  286. package/dist/planner.mjs +2 -1
  287. package/dist/profile.d.mts +21 -0
  288. package/dist/profile.mjs +27 -0
  289. package/dist/query-dim.d.mts +54 -0
  290. package/dist/query-dim.mjs +91 -0
  291. package/dist/report/define.d.mts +8 -0
  292. package/dist/report/define.mjs +15 -0
  293. package/dist/report/hash.d.mts +13 -0
  294. package/dist/report/hash.mjs +29 -0
  295. package/dist/report/index.d.mts +4 -170
  296. package/dist/report/index.mjs +3 -55
  297. package/dist/report/registry.d.mts +18 -0
  298. package/dist/report/registry.mjs +14 -0
  299. package/dist/report/types.d.mts +139 -0
  300. package/dist/resolver/adapter.d.mts +13 -0
  301. package/dist/resolver/adapter.mjs +27 -0
  302. package/dist/resolver/canonical-source.d.mts +5 -0
  303. package/dist/resolver/canonical-source.mjs +14 -0
  304. package/dist/resolver/compile.d.mts +15 -0
  305. package/dist/resolver/compile.mjs +396 -0
  306. package/dist/resolver/datasets.d.mts +16 -0
  307. package/dist/resolver/datasets.mjs +159 -0
  308. package/dist/resolver/extras-overlay.d.mts +37 -0
  309. package/dist/resolver/extras-overlay.mjs +17 -0
  310. package/dist/resolver/filter-utils.d.mts +10 -0
  311. package/dist/resolver/filter-utils.mjs +59 -0
  312. package/dist/resolver/fragments.d.mts +60 -0
  313. package/dist/resolver/fragments.mjs +206 -0
  314. package/dist/resolver/index.d.mts +11 -371
  315. package/dist/resolver/index.mjs +10 -1
  316. package/dist/resolver/pg-adapter.d.mts +56 -0
  317. package/dist/resolver/pg-adapter.mjs +110 -0
  318. package/dist/resolver/run-query.d.mts +172 -0
  319. package/dist/resolver/run-query.mjs +241 -0
  320. package/dist/resolver/schema-drift.d.mts +15 -0
  321. package/dist/resolver/schema-drift.mjs +12 -0
  322. package/dist/rollups.d.mts +4 -4
  323. package/dist/rollups.mjs +3 -2
  324. package/dist/schedule.mjs +100 -0
  325. package/dist/schema.d.mts +34 -1
  326. package/dist/schema.mjs +78 -1
  327. package/dist/sink-node.d.mts +1 -159
  328. package/dist/sink-node.mjs +1 -133
  329. package/dist/sink.d.mts +125 -0
  330. package/dist/sinks/in-memory-sink.d.mts +25 -0
  331. package/dist/sinks/in-memory-sink.mjs +61 -0
  332. package/dist/sinks/index.d.mts +2 -0
  333. package/dist/sinks/index.mjs +2 -0
  334. package/dist/snapshot.d.mts +14 -0
  335. package/dist/source/attached-table.d.mts +45 -0
  336. package/dist/source/attached-table.mjs +55 -0
  337. package/dist/source/create-sql-query-source.d.mts +24 -0
  338. package/dist/source/create-sql-query-source.mjs +28 -0
  339. package/dist/source/index.d.mts +6 -66
  340. package/dist/source/index.mjs +9 -82
  341. package/dist/source/source-types.d.mts +49 -0
  342. package/dist/{_chunks/storage.d.mts → storage.d.mts} +4 -14
  343. package/dist/sync-config.d.mts +36 -0
  344. package/dist/sync-config.mjs +98 -0
  345. package/dist/vendor/hysnappy-purejs.mjs +12 -1
  346. package/package.json +4 -4
  347. package/dist/_chunks/analysis-types.d.mts +0 -57
  348. package/dist/_chunks/contracts.d.mts +0 -1
  349. package/dist/_chunks/engine.mjs +0 -731
  350. package/dist/_chunks/entities.mjs +0 -967
  351. package/dist/_chunks/errors.d.mts +0 -115
  352. package/dist/_chunks/index.d.mts +0 -53
  353. package/dist/_chunks/libs/hyparquet-compressors.mjs +0 -2796
  354. package/dist/_chunks/libs/hyparquet-writer.mjs +0 -2524
  355. package/dist/_chunks/libs/hyparquet.mjs +0 -2596
  356. package/dist/_chunks/libs/icebird.mjs +0 -564
  357. package/dist/_chunks/registry.d.mts +0 -213
  358. package/dist/_chunks/resolver.mjs +0 -1220
  359. package/dist/_chunks/sink.d.mts +0 -257
  360. /package/dist/{_chunks → analyzer}/dispatch.mjs +0 -0
  361. /package/dist/{_chunks/coerce.mjs → coerce.mjs} +0 -0
  362. /package/dist/{_chunks/layout.mjs → layout.mjs} +0 -0
  363. /package/dist/{_chunks/manifest-store-utils.mjs → manifest-store-utils.mjs} +0 -0
  364. /package/dist/{_chunks/libs/fzstd.mjs → node_modules/.pnpm/fzstd@0.1.1/node_modules/fzstd/esm/index.mjs} +0 -0
  365. /package/dist/{_chunks → resolver}/types.d.mts +0 -0
  366. /package/dist/{_chunks/schedule.d.mts → schedule.d.mts} +0 -0
@@ -1,372 +1,12 @@
1
- import { SearchType as SearchType$1, TableName as TableName$1 } from "../_chunks/storage.mjs";
2
- import { ComparisonFilter, ExtraQuery, ResolvedComparisonSQL, ResolvedSQL, ResolvedSQLOptimized, ResolverAdapter, ResolverOptions } from "../_chunks/types.mjs";
3
- import { LogicalDataset, LogicalDataset as LogicalDataset$1, PlannerCapabilities, UnresolvableDatasetError, inferDataset as inferLogicalDataset, isDatasetResolvable } from "gscdump/query/plan";
4
- import { SQL } from "drizzle-orm";
5
- import { BuilderState, Dimension, FilterInput, InternalFilter, Metric } from "gscdump/query";
6
- import { Grain, TableName } from "@gscdump/contracts";
7
- type DimensionSurface = 'api' | 'stored' | 'derived';
8
- interface DimensionBinding {
9
- column: string;
10
- surfaces: readonly DimensionSurface[];
11
- }
12
- interface LogicalDatasetDefinition {
13
- dimensions: Partial<Record<Dimension, DimensionBinding>>;
14
- }
15
- declare const DIMENSION_SURFACES: Record<Dimension, readonly DimensionSurface[]>;
16
- declare const LOGICAL_DATASETS: Record<LogicalDataset, LogicalDatasetDefinition>;
17
- declare function dimensionColumn(dim: Dimension, dataset: LogicalDataset): string;
18
- declare function supportsDimensionOnSurface(dim: Dimension, surface: DimensionSurface): boolean;
19
- declare function assertDimensionsSupported(dimensions: readonly Dimension[], surface: DimensionSurface, context: string): void;
20
- interface SqlFragmentsConfig<TableKey extends string> {
21
- schema: Record<TableKey, unknown>;
22
- datasetToTableKey: Record<keyof typeof LOGICAL_DATASETS, TableKey>;
23
- metricCast: 'REAL' | 'DOUBLE';
24
- regexPredicate: (expr: SQL, pattern: string, negate: boolean) => SQL;
25
- tableLabel: string;
26
- includeSiteId: boolean;
27
- includeSearchType?: boolean;
28
- urlToPathExpr?: (col: string) => string;
29
- /**
30
- * Override the FROM-clause table reference. Default emits the bound drizzle
31
- * table (e.g. `"pages"`). Parquet/R2 adapter overrides this to emit
32
- * `read_parquet({{FILES}}, ...) AS "${tk}"` so the runSQL pipeline can swap
33
- * in an object-key list while column refs (`"pages"."url"`) still resolve
34
- * against the alias.
35
- */
36
- tableRef?: (tableKey: TableKey) => SQL;
37
- /**
38
- * Where `queryCanonical` comes from when compiling fact-table reads.
39
- *
40
- * - `queryDim` (default): LEFT JOIN a query dimension relation and derive
41
- * `COALESCE(query_dim.query_canonical, fact.query)`.
42
- * - `column`: read a `query_canonical` column from the primary relation. This
43
- * is reserved for derived canonical rollup relations, not fact tables.
44
- */
45
- queryCanonicalSource?: 'queryDim' | 'column';
46
- /** Relation used for the query-dimension join when `queryCanonicalSource=queryDim`. */
47
- queryDimTableRef?: () => SQL;
48
- /** When true, also joins query_dim on site_id (SQLite/D1 dimension table). */
49
- queryDimSiteScoped?: boolean;
50
- }
51
- interface SqlFragments<TableKey extends string> {
52
- METRIC_NAMES: Metric[];
53
- DIM_COLUMN_MAP: Record<TableKey, Record<string, string>>;
54
- isMetricDimension: (dim: string) => dim is Metric;
55
- tableKeyForDataset: (dataset: LogicalDataset$1) => TableKey;
56
- dimColumn: (dim: Dimension, table: TableKey) => string;
57
- inferTable: (dimensions: Dimension[], filterDims?: Dimension[]) => TableKey;
58
- urlToPathExpr: (col: string) => string;
59
- colRef: (tableKey: TableKey, colName: string) => SQL;
60
- tableRef: (tableKey: TableKey) => SQL;
61
- fromSql: (tableKey: TableKey, options?: {
62
- queryCanonical?: boolean;
63
- }) => SQL;
64
- dateColRef: (tableKey: TableKey) => SQL;
65
- siteIdColRef?: (tableKey: TableKey) => SQL;
66
- searchTypeColRef?: (tableKey: TableKey) => SQL;
67
- dimExprSql: (dim: Dimension, tableKey: TableKey) => SQL;
68
- metricSql: (metric: Metric, tableKey: TableKey) => SQL;
69
- havingPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
70
- prefilterPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
71
- dimensionPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
72
- topLevelPredicate: (filters: InternalFilter[], tableKey: TableKey) => SQL | undefined;
73
- }
74
- declare function createSqlFragments<TableKey extends string>(config: SqlFragmentsConfig<TableKey>): SqlFragments<TableKey>;
75
- interface CreateResolverAdapterConfig<TableKey extends string> extends SqlFragmentsConfig<TableKey> {
76
- compile: (query: SQL) => {
77
- sql: string;
78
- params: unknown[];
79
- };
80
- capabilities: PlannerCapabilities;
81
- }
82
- declare function createResolverAdapter<TableKey extends string>(config: CreateResolverAdapterConfig<TableKey>): ResolverAdapter<TableKey>;
83
- /** State-level convenience: build the plan then gate. */
84
- declare function canonicalRollupCovers(state: BuilderState, capabilities: PlannerCapabilities): boolean;
85
- declare function resolveToSQLOptimized<TK extends string>(state: BuilderState, options: ResolverOptions<TK>): ResolvedSQLOptimized;
86
- declare function resolveToSQL<TK extends string>(state: BuilderState, options: ResolverOptions<TK>): ResolvedSQL;
87
- declare function buildTotalsSql<TK extends string>(state: BuilderState, options: ResolverOptions<TK>): {
88
- sql: string;
89
- params: unknown[];
90
- };
91
- declare function resolveComparisonSQL<TK extends string>(current: BuilderState, previous: BuilderState, options: ResolverOptions<TK>, comparisonFilter?: ComparisonFilter): ResolvedComparisonSQL;
92
- declare function buildExtrasQueries<TK extends string>(state: BuilderState, options: ResolverOptions<TK>): ExtraQuery[];
93
- declare function mergeExtras(rows: Record<string, unknown>[], extrasResults: {
94
- key: string;
95
- results: Record<string, unknown>[];
96
- }[]): Record<string, unknown>[];
97
- interface RunQueryCtx {
98
- userId: string;
99
- siteId: string;
100
- table: TableName$1;
101
- searchType?: SearchType$1;
102
- /**
103
- * Temporal granularity. `'day'` (default) drives `enumeratePartitions` to
104
- * emit `daily/{date}` only; hourly partitions are skipped by construction.
105
- * `'hour'` is reserved for hourly read paths and must use the dedicated
106
- * hourly query surface (callers pass `partitions: [hourly/{date}]`
107
- * directly through `runSQL`).
108
- */
109
- grain?: Grain;
110
- }
111
- interface RunSQLFn {
112
- (opts: {
113
- ctx: {
114
- userId: string;
115
- siteId: string;
116
- };
117
- table: TableName$1;
118
- fileSets: Record<string, {
119
- table: TableName$1;
120
- partitions?: string[];
121
- keys?: string[];
122
- }>;
123
- sql: string;
124
- params: unknown[];
125
- searchType?: SearchType$1;
126
- }): Promise<{
127
- rows: Array<Record<string, unknown>>;
128
- }>;
129
- }
130
- interface CanonicalQueryDimSource {
131
- /** Object keys for the versioned query_dim parquet. */
132
- keys: string[];
133
- normalizerVersion: number;
134
- intentVersion?: number;
135
- builtAt?: number;
136
- }
137
- interface PrimaryColumnarSource {
138
- /** Pre-resolved compacted/Iceberg parquet object keys for the requested fact table. */
139
- keys: string[];
140
- /** Oldest covered date (`YYYY-MM-DD`). Omit to assert the source covers all older dates. */
141
- coversFrom?: string;
142
- /** Newest covered date (`YYYY-MM-DD`). Omit to assert the source covers the current tail. */
143
- coversThrough?: string;
144
- }
145
- /**
146
- * Optional overlay that serves a resolver extra (e.g. canonical-variant
147
- * grouping, keyed `'canonicalExtras'`) from a precomputed source — typically a
148
- * materialised rollup — instead of the live window-function SQL. Return the
149
- * rows in the exact shape the live extra produces (`mergeExtras` consumes
150
- * either source unchanged), or `null` to decline so the caller falls back to
151
- * the live query. Pure seam: storage/tenant routing lives in the host's
152
- * implementation, not here. See ADR-0017.
153
- */
154
- interface ResolveExtraFn {
155
- (opts: {
156
- key: string;
157
- state: BuilderState;
158
- ctx: RunQueryCtx;
159
- dateRange: {
160
- startDate: string;
161
- endDate: string;
162
- };
163
- }): Promise<Array<Record<string, unknown>> | null>;
164
- }
165
- interface RunOptimizedQueryOptions {
166
- /** Overlay tried per extra before the live SQL; absent → today's live path. */
167
- resolveExtra?: ResolveExtraFn;
168
- /**
169
- * Versioned query dimension backing canonical reads over fact rows. Required
170
- * whenever a query groups or filters by `queryCanonical`; a canonical rollup
171
- * source may carry the same metadata/key set via `canonicalSource.queryDim`.
172
- */
173
- queryDim?: CanonicalQueryDimSource;
174
- /**
175
- * Primary fact-file source for consumer reads. Callers pass compacted or
176
- * Iceberg data-file keys with explicit coverage metadata; raw daily
177
- * partitions are only used when `primarySourceFallback: 'raw'` is set.
178
- */
179
- primarySource?: PrimaryColumnarSource;
180
- /**
181
- * Explicit compatibility escape hatch for raw daily shards. Default is
182
- * strict: missing/empty/stale primary coverage fails with
183
- * `QuerySourceCoverageError`.
184
- */
185
- primarySourceFallback?: 'raw';
186
- /**
187
- * Opt-in canonical-primary performance (ADR-0018 Gap 2): object keys of the
188
- * `query_canonical_daily` rollup parquet(s). When supplied AND the query is
189
- * coverable (`canonicalRollupCovers`) AND the window is within the rollup's
190
- * coverage, the MAIN query reads these
191
- * pre-summed `(query_canonical × date)` rows instead of re-aggregating raw
192
- * partitions. Variant extras still need fact-grain rows, so they read
193
- * `primarySource` when present and raw partitions only via
194
- * `primarySourceFallback: 'raw'`.
195
- *
196
- * `coversThrough` (ISO `YYYY-MM-DD`, the rollup's newest covered date) gates
197
- * staleness: the source is used only when `dateRange.endDate <= coversThrough`,
198
- * else strict mode fails so the recent tail is never silently undercounted.
199
- * Omit to assert full coverage (use with care).
200
- */
201
- canonicalSource?: {
202
- keys: string[];
203
- coversThrough?: string;
204
- queryDim?: CanonicalQueryDimSource;
205
- };
206
- /** Optional version gates for the query dimension backing `canonicalSource`. */
207
- canonicalRequirements?: {
208
- normalizerVersion?: number;
209
- intentVersion?: number;
210
- };
211
- }
212
- type QuerySourceKind = 'canonical-rollup' | 'primary-columnar' | 'raw-partitions';
213
- type QuerySourceFallbackKind = 'primary-source-missing' | 'primary-source-empty' | 'primary-source-missing-coverage' | 'primary-source-stale-coverage' | 'canonical-source-missing' | 'canonical-source-empty' | 'canonical-source-not-coverable' | 'canonical-source-stale-coverage' | 'query-dim-missing' | 'query-dim-empty' | 'query-dim-stale-version';
214
- interface QuerySourceFallback {
215
- kind: QuerySourceFallbackKind;
216
- message: string;
217
- }
218
- interface QuerySourceDecision {
219
- kind: QuerySourceKind;
220
- fallback?: QuerySourceFallback;
221
- fallbacks?: QuerySourceFallback[];
222
- }
223
- declare class QuerySourceCoverageError extends Error {
224
- readonly fallback: QuerySourceFallback;
225
- name: string;
226
- constructor(fallback: QuerySourceFallback);
227
- }
228
- interface OptimizedQueryResult {
229
- rows: Array<Record<string, unknown>>;
230
- totalCount: number;
231
- totals: {
232
- clicks: number;
233
- impressions: number;
234
- ctr: number;
235
- position: number;
236
- };
237
- extras: Array<{
238
- key: string;
239
- rows: Array<Record<string, unknown>>;
240
- }>;
241
- source: QuerySourceDecision;
242
- extraSource?: QuerySourceDecision;
243
- }
244
- interface ComparisonQueryResult {
245
- rows: Array<Record<string, unknown>>;
246
- totalCount: number;
247
- totals: Record<string, unknown>;
248
- source: QuerySourceDecision;
249
- }
250
- declare function runOptimizedQuery(runSQL: RunSQLFn, ctx: RunQueryCtx, state: BuilderState, dateRange: {
251
- startDate: string;
252
- endDate: string;
253
- }, options?: RunOptimizedQueryOptions): Promise<OptimizedQueryResult>;
254
- declare function runComparisonQuery(runSQL: RunSQLFn, ctx: RunQueryCtx, current: BuilderState, previous: BuilderState, windows: {
255
- current: {
256
- startDate: string;
257
- endDate: string;
258
- };
259
- previous: {
260
- startDate: string;
261
- endDate: string;
262
- };
263
- }, filter?: ComparisonFilter, options?: RunOptimizedQueryOptions): Promise<ComparisonQueryResult>;
264
- /**
265
- * Host-supplied reader: return the materialised rollup's rows for an
266
- * `(id, tenant, slice)`, in the exact shape the live extra produces, or `null`
267
- * when no rollup exists (first sync, never built, stale) so the overlay
268
- * declines and the resolver falls back to the live query. Typically wired with
269
- * `readLatestRollup` + a `read_parquet` of the pointer.
270
- *
271
- * `dateRange` is the request window. `query_canonical_variants` is full-history
272
- * (its grouping/variant metrics span all dates), but `buildExtrasQueries`
273
- * windows the live `canonicalExtras` to the requested range — so for a narrow
274
- * window the reader MUST decline (return `null`) rather than attach
275
- * out-of-window variantCount/canonicalName/variants. A common rule: serve only
276
- * when the request window covers full history.
277
- */
278
- interface RollupRowsReader {
279
- (opts: {
280
- id: string;
281
- ctx: {
282
- userId: string;
283
- siteId: string;
284
- };
285
- searchType?: SearchType$1;
286
- dateRange: {
287
- startDate: string;
288
- endDate: string;
289
- };
290
- }): Promise<Array<Record<string, unknown>> | null>;
291
- }
292
- /**
293
- * Build a {@link ResolveExtraFn} that serves resolver extras from materialised
294
- * rollups when one is mapped for the extra's key, else returns `null` to fall
295
- * back to the live SQL. Pure wiring around the host's `readRollupRows`.
296
- */
297
- declare function createRollupExtrasOverlay(readRollupRows: RollupRowsReader): ResolveExtraFn;
298
- declare function getInternalFilters(filter: FilterInput | undefined): InternalFilter[];
299
- declare function getDimensionFilters(filter: FilterInput | undefined, isMetricDimension: (dim: string) => dim is Metric): InternalFilter[];
300
- declare function getFilterDimensions(filter: FilterInput | undefined, isMetricDimension: (dim: string) => dim is Metric): Dimension[];
301
- declare function metricValue(row: Record<string, unknown>, metric: string): number;
302
- declare function dimensionValue(row: Record<string, unknown>, dimension: string): string;
303
- declare function matchesDimensionFilter(row: Record<string, unknown>, filter: InternalFilter): boolean;
304
- declare function matchesMetricFilter(row: Record<string, unknown>, filter: InternalFilter): boolean;
305
- declare function matchesTopLevelPage(row: Record<string, unknown>): boolean;
306
- type PgTableKey = TableName;
307
- declare const pgResolverAdapter: ResolverAdapter<PgTableKey>;
308
- /**
309
- * Parquet-aware variant of {@link pgResolverAdapter}. Identical SQL output
310
- * except FROM clauses emit `read_parquet({{FILES}}, union_by_name = true) AS
311
- * "${tk}"`. The runSQL pipeline substitutes `{{FILES}}` with R2 object keys
312
- * resolved from the manifest. The `AS "${tk}"` alias is mandatory — drizzle
313
- * compiles `colRef` to table-qualified `"pages"."url"`, which would not
314
- * resolve against an unaliased FROM.
315
- *
316
- * Single-use: build a fresh adapter per query. Cheap (no I/O) and avoids
317
- * accidental adapter caching that would lock in a stale `{{FILES}}` set.
318
- */
319
- interface ResolverAdapterOptions {
320
- /**
321
- * `queryDim` reads canonical from a joined query dimension. `column` is only
322
- * for derived canonical rollup relations whose primary relation already
323
- * carries a null-free `query_canonical` output column.
324
- */
325
- queryCanonicalSource?: 'queryDim' | 'column';
326
- }
327
- interface R2SqlResolverAdapterOptions extends ResolverAdapterOptions {
328
- /**
329
- * R2 SQL string partition equality can undercount on identity partitions;
330
- * string-encoded catalogs use CONCAT(col, '') in partition predicates. Int
331
- * catalogs do not need the workaround and keep bare equality for pruning.
332
- */
333
- partitionKeyEncoding?: 'string' | 'int';
334
- }
335
- declare function createParquetResolverAdapter(options?: ResolverAdapterOptions): ResolverAdapter<PgTableKey>;
336
- /**
337
- * Multi-tenant pg-flavored adapter for the Iceberg / R2 SQL read path.
338
- * Identical SQL output to `pgResolverAdapter` except WHERE clauses inject
339
- * `site_id = ?` AND `search_type = ?` automatically when those scopes are
340
- * passed to `resolveToSQL`. Required for the Iceberg fact tables which are
341
- * shared across tenants — querying without these predicates would leak
342
- * cross-tenant data. Single-use: the adapter has no `tableRef` override,
343
- * so callers must rewrite bare table names to their qualified form (e.g.
344
- * `${namespace}.pages`) before sending to R2 SQL.
345
- */
346
- declare function createIcebergResolverAdapter(options?: ResolverAdapterOptions): ResolverAdapter<PgTableKey>;
347
- /**
348
- * R2 SQL adapter for the Iceberg fact tables.
349
- *
350
- * It shares the multi-tenant Iceberg schema with `createIcebergResolverAdapter`
351
- * but models R2 SQL's narrower execution surface: no window-total plans and no
352
- * comparison joins. Int-partition catalogs are the default and emit bare
353
- * equality predicates for pruning. Legacy string-partition catalogs must pass
354
- * `partitionKeyEncoding: 'string'` to emit `CONCAT(partition_col, '') = ?`,
355
- * working around R2 SQL's partition-string equality undercount while preserving
356
- * bound params.
357
- */
358
- declare function createR2SqlResolverAdapter(options?: R2SqlResolverAdapterOptions): ResolverAdapter<PgTableKey>;
359
- interface AssertSchemaInSyncOptions {
360
- /** Label used in the thrown error (e.g. 'browser', 'sqlite'). */
361
- label: string;
362
- /** Drizzle schema keyed by table name. For sqlite, strip the `gsc_` prefix before passing. */
363
- schema: Record<string, unknown>;
364
- /**
365
- * Map drizzle table key → canonical `TableName`. For browser this is identity;
366
- * for sqlite this strips the `gsc_` prefix.
367
- */
368
- tableKeyToName: (key: string) => TableName;
369
- mode: 'exact' | 'superset';
370
- }
371
- declare function assertSchemaInSync(options: AssertSchemaInSyncOptions): void;
1
+ import { ComparisonFilter, ExtraQuery, ResolvedComparisonSQL, ResolvedSQL, ResolvedSQLOptimized, ResolverAdapter, ResolverOptions } from "./types.mjs";
2
+ import { DIMENSION_SURFACES, DimensionBinding, DimensionSurface, LOGICAL_DATASETS, LogicalDataset, LogicalDatasetDefinition, UnresolvableDatasetError, assertDimensionsSupported, dimensionColumn, inferLogicalDataset, isDatasetResolvable, supportsDimensionOnSurface } from "./datasets.mjs";
3
+ import { SqlFragments, SqlFragmentsConfig, createSqlFragments } from "./fragments.mjs";
4
+ import { CreateResolverAdapterConfig, createResolverAdapter } from "./adapter.mjs";
5
+ import { canonicalRollupCovers } from "./canonical-source.mjs";
6
+ import { buildExtrasQueries, buildTotalsSql, mergeExtras, resolveComparisonSQL, resolveToSQL, resolveToSQLOptimized } from "./compile.mjs";
7
+ import { CanonicalQueryDimSource, ComparisonQueryResult, OptimizedQueryResult, PrimaryColumnarSource, QuerySourceCoverageError, QuerySourceDecision, QuerySourceFallback, QuerySourceFallbackKind, QuerySourceKind, ResolveExtraFn, RunOptimizedQueryOptions, RunQueryCtx, RunSQLFn, runComparisonQuery, runOptimizedQuery } from "./run-query.mjs";
8
+ import { RollupRowsReader, createRollupExtrasOverlay } from "./extras-overlay.mjs";
9
+ import { dimensionValue, getDimensionFilters, getFilterDimensions, getInternalFilters, matchesDimensionFilter, matchesMetricFilter, matchesTopLevelPage, metricValue } from "./filter-utils.mjs";
10
+ import { PgTableKey, R2SqlResolverAdapterOptions, ResolverAdapterOptions, createIcebergResolverAdapter, createParquetResolverAdapter, createR2SqlResolverAdapter, pgResolverAdapter } from "./pg-adapter.mjs";
11
+ import { AssertSchemaInSyncOptions, assertSchemaInSync } from "./schema-drift.mjs";
372
12
  export { type AssertSchemaInSyncOptions, type CanonicalQueryDimSource, type ComparisonFilter, type ComparisonQueryResult, type CreateResolverAdapterConfig, DIMENSION_SURFACES, type DimensionBinding, type DimensionSurface, type ExtraQuery, LOGICAL_DATASETS, type LogicalDataset, type LogicalDatasetDefinition, type OptimizedQueryResult, type PgTableKey, type PrimaryColumnarSource, QuerySourceCoverageError, type QuerySourceDecision, type QuerySourceFallback, type QuerySourceFallbackKind, type QuerySourceKind, type R2SqlResolverAdapterOptions, type ResolveExtraFn, type ResolvedComparisonSQL, type ResolvedSQL, type ResolvedSQLOptimized, type ResolverAdapter, type ResolverAdapterOptions, type ResolverOptions, type RollupRowsReader, type RunOptimizedQueryOptions, type RunQueryCtx, type RunSQLFn, type SqlFragments, type SqlFragmentsConfig, UnresolvableDatasetError, assertDimensionsSupported, assertSchemaInSync, buildExtrasQueries, buildTotalsSql, canonicalRollupCovers, createIcebergResolverAdapter, createParquetResolverAdapter, createR2SqlResolverAdapter, createResolverAdapter, createRollupExtrasOverlay, createSqlFragments, dimensionColumn, dimensionValue, getDimensionFilters, getFilterDimensions, getInternalFilters, inferLogicalDataset, isDatasetResolvable, matchesDimensionFilter, matchesMetricFilter, matchesTopLevelPage, mergeExtras, metricValue, pgResolverAdapter, resolveComparisonSQL, resolveToSQL, resolveToSQLOptimized, runComparisonQuery, runOptimizedQuery, supportsDimensionOnSurface };
@@ -1,2 +1,11 @@
1
- import { DIMENSION_SURFACES, LOGICAL_DATASETS, QuerySourceCoverageError, UnresolvableDatasetError, assertDimensionsSupported, assertSchemaInSync, buildExtrasQueries, buildTotalsSql, canonicalRollupCovers, createIcebergResolverAdapter, createParquetResolverAdapter, createR2SqlResolverAdapter, createResolverAdapter, createRollupExtrasOverlay, createSqlFragments, dimensionColumn, dimensionValue, getDimensionFilters, getFilterDimensions, getInternalFilters, inferLogicalDataset, isDatasetResolvable, matchesDimensionFilter, matchesMetricFilter, matchesTopLevelPage, mergeExtras, metricValue, pgResolverAdapter, resolveComparisonSQL, resolveToSQL, resolveToSQLOptimized, runComparisonQuery, runOptimizedQuery, supportsDimensionOnSurface } from "../_chunks/resolver.mjs";
1
+ import { DIMENSION_SURFACES, LOGICAL_DATASETS, UnresolvableDatasetError, assertDimensionsSupported, dimensionColumn, inferLogicalDataset, isDatasetResolvable, supportsDimensionOnSurface } from "./datasets.mjs";
2
+ import { createSqlFragments } from "./fragments.mjs";
3
+ import { createResolverAdapter } from "./adapter.mjs";
4
+ import { canonicalRollupCovers } from "./canonical-source.mjs";
5
+ import { buildExtrasQueries, buildTotalsSql, mergeExtras, resolveComparisonSQL, resolveToSQL, resolveToSQLOptimized } from "./compile.mjs";
6
+ import { createRollupExtrasOverlay } from "./extras-overlay.mjs";
7
+ import { dimensionValue, getDimensionFilters, getFilterDimensions, getInternalFilters, matchesDimensionFilter, matchesMetricFilter, matchesTopLevelPage, metricValue } from "./filter-utils.mjs";
8
+ import { createIcebergResolverAdapter, createParquetResolverAdapter, createR2SqlResolverAdapter, pgResolverAdapter } from "./pg-adapter.mjs";
9
+ import { QuerySourceCoverageError, runComparisonQuery, runOptimizedQuery } from "./run-query.mjs";
10
+ import { assertSchemaInSync } from "./schema-drift.mjs";
2
11
  export { DIMENSION_SURFACES, LOGICAL_DATASETS, QuerySourceCoverageError, UnresolvableDatasetError, assertDimensionsSupported, assertSchemaInSync, buildExtrasQueries, buildTotalsSql, canonicalRollupCovers, createIcebergResolverAdapter, createParquetResolverAdapter, createR2SqlResolverAdapter, createResolverAdapter, createRollupExtrasOverlay, createSqlFragments, dimensionColumn, dimensionValue, getDimensionFilters, getFilterDimensions, getInternalFilters, inferLogicalDataset, isDatasetResolvable, matchesDimensionFilter, matchesMetricFilter, matchesTopLevelPage, mergeExtras, metricValue, pgResolverAdapter, resolveComparisonSQL, resolveToSQL, resolveToSQLOptimized, runComparisonQuery, runOptimizedQuery, supportsDimensionOnSurface };
@@ -0,0 +1,56 @@
1
+ import { ResolverAdapter } from "./types.mjs";
2
+ import { TableName } from "@gscdump/contracts";
3
+ type PgTableKey = TableName;
4
+ declare const pgResolverAdapter: ResolverAdapter<PgTableKey>;
5
+ /**
6
+ * Parquet-aware variant of {@link pgResolverAdapter}. Identical SQL output
7
+ * except FROM clauses emit `read_parquet({{FILES}}, union_by_name = true) AS
8
+ * "${tk}"`. The runSQL pipeline substitutes `{{FILES}}` with R2 object keys
9
+ * resolved from the manifest. The `AS "${tk}"` alias is mandatory — drizzle
10
+ * compiles `colRef` to table-qualified `"pages"."url"`, which would not
11
+ * resolve against an unaliased FROM.
12
+ *
13
+ * Single-use: build a fresh adapter per query. Cheap (no I/O) and avoids
14
+ * accidental adapter caching that would lock in a stale `{{FILES}}` set.
15
+ */
16
+ interface ResolverAdapterOptions {
17
+ /**
18
+ * `queryDim` reads canonical from a joined query dimension. `column` is only
19
+ * for derived canonical rollup relations whose primary relation already
20
+ * carries a null-free `query_canonical` output column.
21
+ */
22
+ queryCanonicalSource?: 'queryDim' | 'column';
23
+ }
24
+ interface R2SqlResolverAdapterOptions extends ResolverAdapterOptions {
25
+ /**
26
+ * R2 SQL string partition equality can undercount on identity partitions;
27
+ * string-encoded catalogs use CONCAT(col, '') in partition predicates. Int
28
+ * catalogs do not need the workaround and keep bare equality for pruning.
29
+ */
30
+ partitionKeyEncoding?: 'string' | 'int';
31
+ }
32
+ declare function createParquetResolverAdapter(options?: ResolverAdapterOptions): ResolverAdapter<PgTableKey>;
33
+ /**
34
+ * Multi-tenant pg-flavored adapter for the Iceberg / R2 SQL read path.
35
+ * Identical SQL output to `pgResolverAdapter` except WHERE clauses inject
36
+ * `site_id = ?` AND `search_type = ?` automatically when those scopes are
37
+ * passed to `resolveToSQL`. Required for the Iceberg fact tables which are
38
+ * shared across tenants — querying without these predicates would leak
39
+ * cross-tenant data. Single-use: the adapter has no `tableRef` override,
40
+ * so callers must rewrite bare table names to their qualified form (e.g.
41
+ * `${namespace}.pages`) before sending to R2 SQL.
42
+ */
43
+ declare function createIcebergResolverAdapter(options?: ResolverAdapterOptions): ResolverAdapter<PgTableKey>;
44
+ /**
45
+ * R2 SQL adapter for the Iceberg fact tables.
46
+ *
47
+ * It shares the multi-tenant Iceberg schema with `createIcebergResolverAdapter`
48
+ * but models R2 SQL's narrower execution surface: no window-total plans and no
49
+ * comparison joins. Int-partition catalogs are the default and emit bare
50
+ * equality predicates for pruning. Legacy string-partition catalogs must pass
51
+ * `partitionKeyEncoding: 'string'` to emit `CONCAT(partition_col, '') = ?`,
52
+ * working around R2 SQL's partition-string equality undercount while preserving
53
+ * bound params.
54
+ */
55
+ declare function createR2SqlResolverAdapter(options?: R2SqlResolverAdapterOptions): ResolverAdapter<PgTableKey>;
56
+ export { PgTableKey, R2SqlResolverAdapterOptions, ResolverAdapterOptions, createIcebergResolverAdapter, createParquetResolverAdapter, createR2SqlResolverAdapter, pgResolverAdapter };
@@ -0,0 +1,110 @@
1
+ import { drizzleSchema } from "../drizzle-schema.mjs";
2
+ import { createResolverAdapter } from "./adapter.mjs";
3
+ import { PgDialect, pgTable, varchar } from "drizzle-orm/pg-core";
4
+ import { DEFAULT_PARTITION_KEY_ENCODING } from "@gscdump/lakehouse/schema";
5
+ import { sql } from "drizzle-orm";
6
+ const pgDialect = new PgDialect();
7
+ function withTenantCols(tableName, baseTable) {
8
+ const t = pgTable(tableName, {
9
+ site_id: varchar("site_id").notNull(),
10
+ search_type: varchar("search_type").notNull()
11
+ });
12
+ return {
13
+ ...baseTable,
14
+ site_id: t.site_id,
15
+ search_type: t.search_type
16
+ };
17
+ }
18
+ const icebergSchema = {
19
+ pages: withTenantCols("pages", drizzleSchema.pages),
20
+ queries: withTenantCols("queries", drizzleSchema.queries),
21
+ countries: withTenantCols("countries", drizzleSchema.countries),
22
+ page_queries: withTenantCols("page_queries", drizzleSchema.page_queries),
23
+ dates: withTenantCols("dates", drizzleSchema.dates),
24
+ search_appearance: withTenantCols("search_appearance", drizzleSchema.search_appearance),
25
+ search_appearance_pages: withTenantCols("search_appearance_pages", drizzleSchema.search_appearance_pages),
26
+ search_appearance_queries: withTenantCols("search_appearance_queries", drizzleSchema.search_appearance_queries),
27
+ search_appearance_page_queries: withTenantCols("search_appearance_page_queries", drizzleSchema.search_appearance_page_queries),
28
+ hourly_pages: withTenantCols("hourly_pages", drizzleSchema.hourly_pages)
29
+ };
30
+ function compilePg(query) {
31
+ const compiled = pgDialect.sqlToQuery(query);
32
+ return {
33
+ sql: compiled.sql,
34
+ params: compiled.params
35
+ };
36
+ }
37
+ const PG_BASE_CONFIG = {
38
+ schema: drizzleSchema,
39
+ datasetToTableKey: {
40
+ pages: "pages",
41
+ queries: "queries",
42
+ page_queries: "page_queries",
43
+ countries: "countries",
44
+ dates: "dates",
45
+ search_appearance: "search_appearance",
46
+ search_appearance_pages: "search_appearance_pages",
47
+ search_appearance_queries: "search_appearance_queries",
48
+ search_appearance_page_queries: "search_appearance_page_queries",
49
+ hourly_pages: "hourly_pages"
50
+ },
51
+ metricCast: "DOUBLE",
52
+ regexPredicate: (expr, pattern, negate) => negate ? sql`NOT regexp_matches(${expr}, ${pattern})` : sql`regexp_matches(${expr}, ${pattern})`,
53
+ urlToPathExpr: (col) => `CASE WHEN ${col} LIKE 'http%' THEN COALESCE(NULLIF(regexp_replace(${col}, '^https?://[^/]+', ''), ''), '/') ELSE ${col} END`,
54
+ includeSiteId: false,
55
+ compile: compilePg,
56
+ capabilities: {
57
+ regex: true,
58
+ comparisonJoin: true,
59
+ windowTotals: true
60
+ }
61
+ };
62
+ const pgResolverAdapter = createResolverAdapter({
63
+ ...PG_BASE_CONFIG,
64
+ tableLabel: "pg-resolver-adapter"
65
+ });
66
+ function createParquetResolverAdapter(options = {}) {
67
+ return createResolverAdapter({
68
+ ...PG_BASE_CONFIG,
69
+ tableLabel: "parquet-resolver-adapter",
70
+ queryCanonicalSource: options.queryCanonicalSource ?? "queryDim",
71
+ tableRef: (tk) => sql.raw(`read_parquet({{FILES}}, union_by_name = true) AS "${tk}"`),
72
+ queryDimTableRef: () => sql.raw("read_parquet({{QUERY_DIM}}, union_by_name = true) AS \"query_dim\"")
73
+ });
74
+ }
75
+ function createIcebergResolverAdapter(options = {}) {
76
+ return createResolverAdapter({
77
+ ...PG_BASE_CONFIG,
78
+ schema: icebergSchema,
79
+ includeSiteId: true,
80
+ includeSearchType: true,
81
+ tableLabel: "iceberg-resolver-adapter",
82
+ queryCanonicalSource: options.queryCanonicalSource ?? "queryDim",
83
+ tableRef: (tk) => sql.raw(`"${tk}"`),
84
+ queryDimTableRef: () => sql.raw("\"query_dim\"")
85
+ });
86
+ }
87
+ function createR2SqlResolverAdapter(options = {}) {
88
+ const adapter = createResolverAdapter({
89
+ ...PG_BASE_CONFIG,
90
+ schema: icebergSchema,
91
+ includeSiteId: true,
92
+ includeSearchType: true,
93
+ tableLabel: "r2-sql-resolver-adapter",
94
+ queryCanonicalSource: options.queryCanonicalSource ?? "queryDim",
95
+ capabilities: {
96
+ regex: false,
97
+ comparisonJoin: false,
98
+ windowTotals: false
99
+ },
100
+ tableRef: (tk) => sql.raw(`"${tk}"`),
101
+ queryDimTableRef: () => sql.raw("\"query_dim\"")
102
+ });
103
+ if ((options.partitionKeyEncoding ?? DEFAULT_PARTITION_KEY_ENCODING) === "int") return adapter;
104
+ return {
105
+ ...adapter,
106
+ siteIdColRef: (tk) => sql`CONCAT(${adapter.siteIdColRef(tk)}, '')`,
107
+ searchTypeColRef: (tk) => sql`CONCAT(${adapter.searchTypeColRef(tk)}, '')`
108
+ };
109
+ }
110
+ export { createIcebergResolverAdapter, createParquetResolverAdapter, createR2SqlResolverAdapter, pgResolverAdapter };