@gscdump/engine 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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} +152 -184
  34. package/dist/{_chunks/schema.mjs → drizzle-schema.mjs} +6 -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 +112 -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 +9 -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
package/dist/schema.mjs CHANGED
@@ -1,2 +1,79 @@
1
- import { SCHEMAS, TABLE_METADATA, allTables, countries, currentSchemaVersion, dateColumnsFor, dates, dedupeByNaturalKey, dimensionToColumn, drizzleSchema, hourly_pages, inferTable, naturalKeyColumns, page_queries, pages, queries, search_appearance, search_appearance_page_queries, search_appearance_pages, search_appearance_queries } from "./_chunks/schema.mjs";
1
+ import { TABLE_METADATA, countries, dates, drizzleSchema, hourly_pages, page_queries, pages, queries, search_appearance, search_appearance_page_queries, search_appearance_pages, search_appearance_queries } from "./drizzle-schema.mjs";
2
+ import { getTableConfig } from "drizzle-orm/pg-core/utils";
3
+ function pgSqlTypeToColumnType(sqlType) {
4
+ const t = sqlType.toLowerCase();
5
+ if (t.startsWith("varchar") || t === "text" || t.startsWith("char")) return "VARCHAR";
6
+ if (t === "date" || t.startsWith("timestamp")) return "DATE";
7
+ if (t.startsWith("double") || t === "real" || t.startsWith("numeric") || t.startsWith("decimal")) return "DOUBLE";
8
+ if (t === "bigint" || t === "int8") return "BIGINT";
9
+ if (t === "integer" || t === "int" || t === "int4" || t === "smallint" || t === "int2") return "INTEGER";
10
+ throw new Error(`unmapped pg type '${sqlType}' — extend pgSqlTypeToColumnType in @gscdump/engine/schema`);
11
+ }
12
+ function tableSchemaFrom(tableName) {
13
+ const columns = getTableConfig(drizzleSchema[tableName]).columns.map((col) => ({
14
+ name: col.name,
15
+ type: pgSqlTypeToColumnType(col.getSQLType()),
16
+ nullable: !col.notNull
17
+ }));
18
+ const meta = TABLE_METADATA[tableName];
19
+ return {
20
+ name: tableName,
21
+ columns,
22
+ sortKey: meta.sortKey,
23
+ version: meta.version
24
+ };
25
+ }
26
+ const METRIC_TABLES = [
27
+ "pages",
28
+ "queries",
29
+ "countries",
30
+ "page_queries",
31
+ "dates",
32
+ "search_appearance",
33
+ "search_appearance_pages",
34
+ "search_appearance_queries",
35
+ "search_appearance_page_queries",
36
+ "hourly_pages"
37
+ ];
38
+ const SCHEMAS = Object.fromEntries(METRIC_TABLES.map((t) => [t, tableSchemaFrom(t)]));
39
+ function currentSchemaVersion(table) {
40
+ return SCHEMAS[table].version;
41
+ }
42
+ function dateColumnsFor(table) {
43
+ return SCHEMAS[table].columns.filter((c) => c.type === "DATE").map((c) => c.name);
44
+ }
45
+ function allTables() {
46
+ return METRIC_TABLES;
47
+ }
48
+ function inferTable(dimensions) {
49
+ const dims = new Set(dimensions);
50
+ const hasPage = dims.has("page");
51
+ const hasQuery = dims.has("query");
52
+ if (dims.has("searchAppearance")) return hasPage && hasQuery ? "search_appearance_page_queries" : hasPage ? "search_appearance_pages" : hasQuery ? "search_appearance_queries" : "search_appearance";
53
+ if (hasPage && hasQuery) return "page_queries";
54
+ if (hasQuery) return "queries";
55
+ if (hasPage) return "pages";
56
+ if (dims.has("country")) return "countries";
57
+ if (dims.has("device")) return "dates";
58
+ return "dates";
59
+ }
60
+ function naturalKeyColumns(table) {
61
+ return TABLE_METADATA[table].sortKey;
62
+ }
63
+ function dedupeByNaturalKey(table, rows) {
64
+ const key = TABLE_METADATA[table].sortKey;
65
+ if (key.length === 0) return rows.slice();
66
+ const seen = /* @__PURE__ */ new Map();
67
+ for (const row of rows) {
68
+ const r = row;
69
+ const k = key.map((col) => `${r[col] ?? ""}`).join("\0");
70
+ seen.set(k, row);
71
+ }
72
+ return [...seen.values()];
73
+ }
74
+ function dimensionToColumn(dim, _table) {
75
+ if (dim === "page") return "url";
76
+ if (dim === "queryCanonical") return "query_canonical";
77
+ return dim;
78
+ }
2
79
  export { SCHEMAS, TABLE_METADATA, allTables, countries, currentSchemaVersion, dateColumnsFor, dates, dedupeByNaturalKey, dimensionToColumn, drizzleSchema, hourly_pages, inferTable, naturalKeyColumns, page_queries, pages, queries, search_appearance, search_appearance_page_queries, search_appearance_pages, search_appearance_queries };
@@ -1,160 +1,2 @@
1
- import { Row } from "./_chunks/storage.mjs";
2
- import { IcebergS3Config, Sink, SinkCloseResult, SliceOverwriteWriter } from "./_chunks/sink.mjs";
3
- /** Connection details for the Iceberg REST catalog the writer targets. */
4
- interface OverwriteWriterCatalogConfig {
5
- /**
6
- * Iceberg REST catalog endpoint, e.g. `http://localhost:8181` (POC) or the
7
- * R2 Data Catalog endpoint (prod).
8
- */
9
- catalogUri: string;
10
- /** Catalog namespace the 5 fact tables live under, e.g. `gsc`. */
11
- namespace: string;
12
- /** Warehouse identifier the catalog resolves table locations under. */
13
- warehouse: string;
14
- /** S3-compatible object store backing the catalog. */
15
- s3: IcebergS3Config;
16
- /** Bearer token for a token-authed REST catalog (R2 Data Catalog). */
17
- catalogToken?: string;
18
- }
19
- /**
20
- * The JSON job wire-format shared with `scripts/iceberg-writer.py`.
21
- * `op` is always `overwrite` here.
22
- */
23
- interface OverwriteJob {
24
- op: 'overwrite';
25
- catalogUri: string;
26
- namespace: string;
27
- warehouse: string;
28
- s3: IcebergS3Config;
29
- table: string;
30
- spec: unknown;
31
- siteId: string;
32
- searchType: string;
33
- date: string;
34
- /** Data columns only — the script injects `site_id` / `search_type`. */
35
- rows: readonly Row[];
36
- }
37
- /**
38
- * Per-site delete job — removes EVERY row for one `siteId` across a whole
39
- * table (all dates / search types). Recovery op for clearing a corrupt site
40
- * (e.g. a cross-run append double) from a shared per-team shard before a clean
41
- * re-backfill, without touching sibling sites. Carries no rows. `siteId` is a
42
- * `number` for an INT-encoded shard, a `string` for STRING encoding.
43
- */
44
- interface DeleteJob {
45
- op: 'delete';
46
- catalogUri: string;
47
- namespace: string;
48
- warehouse: string;
49
- s3: IcebergS3Config;
50
- /** Bearer token for a token-authed REST catalog (R2 Data Catalog). */
51
- catalogToken?: string;
52
- table: string;
53
- siteId: string | number;
54
- }
55
- /** Any job the shared PyIceberg backend can execute. */
56
- type PyIcebergJob = OverwriteJob | DeleteJob;
57
- /** Result wire-format from the PyIceberg backend. */
58
- interface OverwriteJobResult {
59
- /** Rows written (emit/overwrite) or removed (delete). */
60
- rowCount?: number;
61
- error?: string;
62
- }
63
- /**
64
- * A transport that executes one PyIceberg job and returns its result.
65
- * `subprocessBackend` and `httpBackend` are the two shipped implementations;
66
- * tests inject a fake. The param is the `OverwriteJob | DeleteJob` union, so a
67
- * backend value is still assignable where the narrower `OverwriteBackend` is
68
- * expected (a wider-param function accepts the narrower call).
69
- */
70
- type OverwriteBackend = (job: PyIcebergJob) => Promise<OverwriteJobResult>;
71
- interface IcebergOverwriteWriterOptions {
72
- catalog: OverwriteWriterCatalogConfig;
73
- /** The transport that runs the PyIceberg job. */
74
- backend: OverwriteBackend;
75
- }
76
- /**
77
- * The trailing-window Iceberg overwrite writer. Conforms to the frozen
78
- * `SliceOverwriteWriter` contract; `overwriteSlice` builds one PyIceberg
79
- * overwrite job per call and runs it through the configured backend.
80
- */
81
- interface IcebergOverwriteWriter extends SliceOverwriteWriter {
82
- /** Release any backend resources. Idempotent. */
83
- close: () => Promise<SinkCloseResult>;
84
- }
85
- /**
86
- * Build a trailing-window Iceberg overwrite writer over the given backend.
87
- * Pure — all I/O is the backend's; the writer only shapes the job.
88
- */
89
- declare function createIcebergOverwriteWriter(opts: IcebergOverwriteWriterOptions): IcebergOverwriteWriter;
90
- /** Options for the PyIceberg subprocess backend. */
91
- interface SubprocessBackendOptions {
92
- /** Python interpreter. Defaults to `$GSCDUMP_ICEBERG_PYTHON` then `python3`. */
93
- python?: string;
94
- /**
95
- * Path to the PyIceberg writer script. Defaults to
96
- * `<engine>/scripts/iceberg-writer.py`.
97
- */
98
- writerScript?: string;
99
- }
100
- /**
101
- * Backend that runs the PyIceberg overwrite by spawning the shared writer
102
- * script (`scripts/iceberg-writer.py`). Node-only — used by local integration
103
- * tests and a Node-side scheduled job box. The script reads the job JSON on
104
- * stdin and writes `{rowCount}` / `{error}` on stdout.
105
- */
106
- declare function subprocessBackend(opts?: SubprocessBackendOptions): OverwriteBackend;
107
- /** Options for the PyIceberg HTTP backend (the Cloudflare Container in prod). */
108
- interface HttpBackendOptions {
109
- /**
110
- * URL of the PyIceberg overwrite service — a POST endpoint accepting the
111
- * `OverwriteJob` JSON and returning `OverwriteJobResult`.
112
- */
113
- endpoint: string;
114
- /** Optional bearer token for the service. */
115
- token?: string;
116
- /** Injectable fetch — defaults to the global. */
117
- fetch?: typeof fetch;
118
- }
119
- /**
120
- * Backend that POSTs the overwrite job to a PyIceberg HTTP service — the
121
- * Cloudflare Container running `iceberg-writer.py` behind an HTTP shim. This
122
- * is the prod transport: the request-path Worker holds no Python and never
123
- * does an Iceberg metadata commit itself.
124
- */
125
- declare function httpBackend(opts: HttpBackendOptions): OverwriteBackend;
126
- /**
127
- * Adapt an `IcebergOverwriteWriter` into a full `Sink` whose `emit` is also a
128
- * partition-overwrite — convenient for tests so a single Iceberg writer backs
129
- * both append and revision paths against the local stack. Prod keeps `emit`
130
- * on the Pipeline; only `overwriteSlice` delegates here.
131
- */
132
- declare function overwriteWriterAsSink(writer: IcebergOverwriteWriter): Sink & SliceOverwriteWriter;
133
- /** Per-table outcome of a {@link deleteSiteFromShard} run. */
134
- interface DeleteSiteResult {
135
- table: string;
136
- /** Rows removed, when the backend reported a count. */
137
- rowCount?: number;
138
- /** Present when this table's delete failed; the sweep continues regardless. */
139
- error?: string;
140
- }
141
- /**
142
- * Remove every row for one `siteId` from a per-team Iceberg shard, across the
143
- * given tables. Recovery op: clear a corrupt site (e.g. a cross-run append
144
- * double) before a clean re-backfill, leaving sibling sites in the shared shard
145
- * untouched. `site_id` is an identity partition column, so PyIceberg prunes
146
- * whole data files (no row-level delete files).
147
- *
148
- * Runs SEQUENTIALLY (one commit per table at a time) so the per-table catalog
149
- * commit-rate ceiling is never tripped. A table failure is captured in its
150
- * result row, not thrown — the sweep always attempts every table so a partial
151
- * failure is visible and re-runnable (delete is idempotent: re-deleting an
152
- * already-empty site is a no-op).
153
- */
154
- declare function deleteSiteFromShard(args: {
155
- catalog: OverwriteWriterCatalogConfig;
156
- backend: OverwriteBackend;
157
- siteId: string | number;
158
- tables: readonly string[];
159
- }): Promise<DeleteSiteResult[]>;
1
+ import { DeleteJob, DeleteSiteResult, IcebergOverwriteWriter, IcebergOverwriteWriterOptions, OverwriteBackend, OverwriteJob, OverwriteJobResult, OverwriteWriterCatalogConfig, PyIcebergJob, createIcebergOverwriteWriter, deleteSiteFromShard, httpBackend, overwriteWriterAsSink, subprocessBackend } from "./iceberg/overwrite-writer.mjs";
160
2
  export { type DeleteJob, type DeleteSiteResult, type IcebergOverwriteWriter, type IcebergOverwriteWriterOptions, type OverwriteBackend, type OverwriteJob, type OverwriteJobResult, type OverwriteWriterCatalogConfig, type PyIcebergJob, createIcebergOverwriteWriter, deleteSiteFromShard, httpBackend, overwriteWriterAsSink, subprocessBackend };
@@ -1,134 +1,2 @@
1
- import { ICEBERG_SCHEMAS, assertIcebergTable } from "./_chunks/schema2.mjs";
2
- import process from "node:process";
3
- const PYICEBERG_PYTHON_ENV = "GSCDUMP_ICEBERG_PYTHON";
4
- const DEFAULT_PYICEBERG_PYTHON = "python3";
5
- function resolvePyIcebergPython(override) {
6
- return override ?? process.env[PYICEBERG_PYTHON_ENV] ?? DEFAULT_PYICEBERG_PYTHON;
7
- }
8
- async function runPyIcebergWriter(options) {
9
- const { execFile } = await import("node:child_process");
10
- return new Promise((resolve, reject) => {
11
- execFile(options.python, [options.script], { maxBuffer: 64 * 1024 * 1024 }, (err, stdout, stderr) => {
12
- let parsed;
13
- let parseError;
14
- if (stdout.trim()) try {
15
- parsed = JSON.parse(stdout);
16
- } catch (error) {
17
- parseError = error;
18
- }
19
- if (parsed && !(err && options.rejectOnProcessError)) {
20
- resolve(parsed);
21
- return;
22
- }
23
- if (err) {
24
- if (options.processErrorAsParseFailure) {
25
- reject(/* @__PURE__ */ new Error(`${options.label} produced no parseable output (${err.message})${stderr ? `: ${stderr}` : ""}`));
26
- return;
27
- }
28
- reject(/* @__PURE__ */ new Error(`${options.label} process failed (${err.message})${stderr ? `: ${stderr}` : ""}`));
29
- return;
30
- }
31
- reject(new Error(`${options.label} produced no parseable output: ${stdout || stderr}`, { cause: parseError }));
32
- }).stdin?.end(JSON.stringify(options.job));
33
- });
34
- }
35
- function createIcebergOverwriteWriter(opts) {
36
- const { catalog, backend } = opts;
37
- async function overwriteSlice(slice, rows) {
38
- const siteId = slice.ctx.siteId;
39
- if (!siteId) throw new Error("overwriteSlice: slice.ctx.siteId is required for the Iceberg partition key");
40
- const table = assertIcebergTable(slice.table);
41
- const job = {
42
- op: "overwrite",
43
- catalogUri: catalog.catalogUri,
44
- namespace: catalog.namespace,
45
- warehouse: catalog.warehouse,
46
- s3: catalog.s3,
47
- table,
48
- spec: ICEBERG_SCHEMAS[table],
49
- siteId,
50
- searchType: slice.searchType,
51
- date: slice.date,
52
- rows
53
- };
54
- const res = await backend(job);
55
- if (res.error) throw new Error(`overwriteSlice: PyIceberg backend failed: ${res.error}`);
56
- return { rowCount: res.rowCount ?? rows.length };
57
- }
58
- return {
59
- overwriteSlice,
60
- async close() {
61
- return {
62
- flushed: [],
63
- failed: []
64
- };
65
- }
66
- };
67
- }
68
- function subprocessBackend(opts = {}) {
69
- return async (job) => {
70
- const { dirname, join } = await import("node:path");
71
- const { fileURLToPath } = await import("node:url");
72
- return runPyIcebergWriter({
73
- python: resolvePyIcebergPython(opts.python),
74
- script: opts.writerScript ?? join(dirname(fileURLToPath(import.meta.url)), "..", "scripts", "iceberg-writer.py"),
75
- job,
76
- label: "iceberg overwrite subprocess",
77
- processErrorAsParseFailure: true
78
- });
79
- };
80
- }
81
- function httpBackend(opts) {
82
- const doFetch = opts.fetch ?? fetch;
83
- return async (job) => {
84
- const res = await doFetch(opts.endpoint, {
85
- method: "POST",
86
- headers: {
87
- "content-type": "application/json",
88
- ...opts.token ? { authorization: `Bearer ${opts.token}` } : {}
89
- },
90
- body: JSON.stringify(job)
91
- });
92
- if (!res.ok) {
93
- const body = await res.text().catch(() => "");
94
- return { error: `HTTP ${res.status}${body ? `: ${body}` : ""}` };
95
- }
96
- return await res.json();
97
- };
98
- }
99
- function overwriteWriterAsSink(writer) {
100
- return {
101
- capabilities: {
102
- canOverwrite: true,
103
- appendOnly: false
104
- },
105
- emit: (slice, rows) => writer.overwriteSlice(slice, rows),
106
- overwriteSlice: (slice, rows) => writer.overwriteSlice(slice, rows),
107
- close: () => writer.close()
108
- };
109
- }
110
- async function deleteSiteFromShard(args) {
111
- const { catalog, backend, siteId, tables } = args;
112
- const results = [];
113
- for (const table of tables) {
114
- const res = await backend({
115
- op: "delete",
116
- catalogUri: catalog.catalogUri,
117
- namespace: catalog.namespace,
118
- warehouse: catalog.warehouse,
119
- s3: catalog.s3,
120
- ...catalog.catalogToken ? { catalogToken: catalog.catalogToken } : {},
121
- table,
122
- siteId
123
- }).catch((err) => ({ error: err instanceof Error ? err.message : String(err) }));
124
- results.push(res.error ? {
125
- table,
126
- error: res.error
127
- } : {
128
- table,
129
- rowCount: res.rowCount
130
- });
131
- }
132
- return results;
133
- }
1
+ import { createIcebergOverwriteWriter, deleteSiteFromShard, httpBackend, overwriteWriterAsSink, subprocessBackend } from "./iceberg/overwrite-writer.mjs";
134
2
  export { createIcebergOverwriteWriter, deleteSiteFromShard, httpBackend, overwriteWriterAsSink, subprocessBackend };
@@ -0,0 +1,125 @@
1
+ import { Row, SearchType, TenantCtx } from "./storage.mjs";
2
+ import { EngineError } from "./errors.mjs";
3
+ import { IcebergTableName, PartitionKeyEncoding } from "./iceberg/schema.mjs";
4
+ import { CommitRetryOptions, ConnectIcebergOptions, IcebergCatalogConfig } from "./iceberg/catalog.mjs";
5
+ /**
6
+ * Identifies one fact slice — the atomic unit a sink emits.
7
+ * `(table, site, searchType, date)`. `userId` rides along on `ctx` for
8
+ * tenant-scoped sinks (local/in-memory); the prod Iceberg table is global
9
+ * and keys only on `siteId`.
10
+ */
11
+ interface SinkSlice {
12
+ ctx: TenantCtx;
13
+ table: IcebergTableName;
14
+ /** GSC search-type partition. */
15
+ searchType: SearchType;
16
+ /** Calendar day (PT), `YYYY-MM-DD`. The slice's `month(date)` partition. */
17
+ date: string;
18
+ }
19
+ /**
20
+ * Outcome of a sink write. `rowCount` is the number of rows accepted;
21
+ * `bytes` is best-effort — `IcebergAppendSink` does not report it (undefined there).
22
+ */
23
+ interface SinkWriteResult {
24
+ rowCount: number;
25
+ bytes?: number;
26
+ }
27
+ /**
28
+ * Static description of a sink. Production ingestion is append-only under the
29
+ * v5 stability-cutoff model. Test and revision-path adapters may expose an
30
+ * overwrite capability explicitly.
31
+ */
32
+ interface SinkCapabilities {
33
+ /** When true, re-emitting a slice accumulates duplicate rows. */
34
+ appendOnly: boolean;
35
+ /** Whether the sink exposes partition overwrite semantics. */
36
+ canOverwrite?: boolean;
37
+ }
38
+ /** Partition-overwrite writer for revision paths. */
39
+ interface SliceOverwriteWriter {
40
+ overwriteSlice: (slice: SinkSlice, rows: readonly Row[]) => Promise<SinkWriteResult>;
41
+ }
42
+ /**
43
+ * Outcome of `Sink.close()` — which tables' buffered rows reached durable
44
+ * storage and which failed.
45
+ *
46
+ * `IcebergAppendSink.emit` only BUFFERS; the durable Iceberg commit happens
47
+ * in `close()`, one `icebergAppend()` per table. The ingest ledger
48
+ * (`sinkAsIngestEngine`) records a `(site, table, searchType, date)` slice
49
+ * ONLY after the table holding it appears in `flushed` — a table in `failed`
50
+ * leaves its slices un-recorded so the next sync re-emits them. This is what
51
+ * keeps the D1 ledger from ever running ahead of Iceberg.
52
+ */
53
+ interface SinkCloseResult {
54
+ /** Tables whose buffered rows committed durably. */
55
+ flushed: IcebergTableName[];
56
+ /**
57
+ * Tables whose flush failed — their slices must NOT be ledger-recorded. Each
58
+ * carries a typed `sink-table-flush-failed` `EngineError`; the human-readable
59
+ * cause is on `error.message`.
60
+ */
61
+ failed: {
62
+ table: IcebergTableName;
63
+ error: EngineError;
64
+ }[];
65
+ }
66
+ interface Sink {
67
+ readonly capabilities: SinkCapabilities;
68
+ /**
69
+ * Emit the fact rows for one slice. Append semantics — for `IcebergAppendSink`
70
+ * this commits one Iceberg snapshot. Re-emitting the same slice produces
71
+ * DUPLICATE rows; exactly-once is enforced upstream by the D1 ingested-days
72
+ * ledger, which only calls `emit` for a slice once.
73
+ *
74
+ * `rows` carry the table's data columns; the sink injects the partition
75
+ * identity columns (`site_id`, `search_type`) from `slice` — callers MUST
76
+ * NOT pre-populate them.
77
+ */
78
+ emit: (slice: SinkSlice, rows: readonly Row[]) => Promise<SinkWriteResult>;
79
+ /**
80
+ * Flush any buffered rows and release resources, returning which tables
81
+ * reached durable storage. Idempotent — a second `close()` after a flush
82
+ * reports empty `flushed`/`failed` (nothing left buffered).
83
+ *
84
+ * `IcebergAppendSink` buffers in `emit` and commits one `icebergAppend()`
85
+ * per table HERE; `flushed`/`failed` reflect those per-table commits.
86
+ * In-memory / local sinks write durably in `emit`, so they report every
87
+ * table they received rows for as `flushed`.
88
+ */
89
+ close: () => Promise<SinkCloseResult>;
90
+ }
91
+ /** Construction options shared by all sink implementations. */
92
+ interface SinkOptions {
93
+ now?: () => number;
94
+ }
95
+ /**
96
+ * `IcebergAppendSink`-specific options — the R2 Data Catalog coordinates the
97
+ * sink appends to via `icebird`. The catalog config shape (`IcebergCatalogConfig`)
98
+ * is type-only here so this contract file stays implementation-free.
99
+ */
100
+ interface IcebergAppendSinkOptions extends SinkOptions {
101
+ /** R2 Data Catalog connection config (catalog URI, warehouse, namespace, token, S3 creds). */
102
+ catalog: IcebergCatalogConfig;
103
+ /**
104
+ * Options forwarded to the lazy catalog connection. Supply a shared
105
+ * `CatalogCache` here to serve the REST `/v1/config` probe from durable cache
106
+ * across short-lived Worker isolates.
107
+ */
108
+ connect?: ConnectIcebergOptions;
109
+ /**
110
+ * Retry policy for the per-table `icebergAppend()` commit, applied on R2
111
+ * Data Catalog 429 ("too many commits") rate-limits. Optional — production
112
+ * uses the defaults; tests inject a synchronous `sleep`.
113
+ */
114
+ commitRetry?: CommitRetryOptions;
115
+ /**
116
+ * Partition-key encoding (default `'int'` for new catalogs). `'int'` writes
117
+ * BOTH `site_id` and `search_type` as INT — the caller MUST pass the numeric
118
+ * `site_id` (a numeric string is fine; it's `Number()`-coerced) in
119
+ * `slice.ctx.siteId`. Pass `'string'` explicitly for legacy catalogs. A small
120
+ * INT is ample (≪ 2.1B sites), so no LONG/BigInt is involved. See
121
+ * {@link import('./iceberg/schema').PartitionKeyEncoding}.
122
+ */
123
+ encoding?: PartitionKeyEncoding;
124
+ }
125
+ export { IcebergAppendSinkOptions, Sink, SinkCapabilities, SinkCloseResult, SinkOptions, SinkSlice, SinkWriteResult, SliceOverwriteWriter };
@@ -0,0 +1,25 @@
1
+ import { Row } from "../storage.mjs";
2
+ import { IcebergTableName } from "../iceberg/schema.mjs";
3
+ import { Sink, SinkSlice } from "../sink.mjs";
4
+ /** A row as stored by the fake — data columns plus the injected identity columns. */
5
+ type StoredRow = Row & {
6
+ site_id: string;
7
+ search_type: string;
8
+ };
9
+ interface InMemorySink extends Sink {
10
+ /** All rows accepted, in partition order. */
11
+ readonly rows: readonly StoredRow[];
12
+ /** Rows for one table. */
13
+ rowsFor: (table: IcebergTableName) => StoredRow[];
14
+ /** Rows for one exact slice partition. */
15
+ rowsForSlice: (slice: SinkSlice) => StoredRow[];
16
+ /** `true` once `close()` has run. */
17
+ readonly closed: boolean;
18
+ /** Drop everything — handy between test cases. */
19
+ reset: () => void;
20
+ }
21
+ /**
22
+ * Create an in-memory append-only `Sink`.
23
+ */
24
+ declare function createInMemorySink(): InMemorySink;
25
+ export { InMemorySink, StoredRow, createInMemorySink };
@@ -0,0 +1,61 @@
1
+ const KEY_SEP = "\0";
2
+ function partitionKey(slice) {
3
+ return [
4
+ slice.table,
5
+ slice.ctx.siteId ?? "",
6
+ slice.searchType,
7
+ slice.date
8
+ ].join(KEY_SEP);
9
+ }
10
+ function tableOfKey(key) {
11
+ return key.slice(0, key.indexOf(KEY_SEP));
12
+ }
13
+ function withIdentity(slice, rows) {
14
+ return rows.map((r) => ({
15
+ ...r,
16
+ site_id: slice.ctx.siteId ?? "",
17
+ search_type: slice.searchType
18
+ }));
19
+ }
20
+ function createInMemorySink() {
21
+ const partitions = /* @__PURE__ */ new Map();
22
+ let closed = false;
23
+ function allRows() {
24
+ return [...partitions.values()].flat();
25
+ }
26
+ return {
27
+ capabilities: { appendOnly: true },
28
+ async emit(slice, rows) {
29
+ const key = partitionKey(slice);
30
+ const stored = withIdentity(slice, rows);
31
+ const existing = partitions.get(key);
32
+ if (existing) existing.push(...stored);
33
+ else partitions.set(key, stored);
34
+ return { rowCount: stored.length };
35
+ },
36
+ async close() {
37
+ closed = true;
38
+ return {
39
+ flushed: [...new Set([...partitions.keys()].map((k) => tableOfKey(k)))],
40
+ failed: []
41
+ };
42
+ },
43
+ get rows() {
44
+ return allRows();
45
+ },
46
+ get closed() {
47
+ return closed;
48
+ },
49
+ rowsFor(table) {
50
+ return [...partitions.entries()].filter(([k]) => tableOfKey(k) === table).flatMap(([, v]) => v);
51
+ },
52
+ rowsForSlice(slice) {
53
+ return [...partitions.get(partitionKey(slice)) ?? []];
54
+ },
55
+ reset() {
56
+ partitions.clear();
57
+ closed = false;
58
+ }
59
+ };
60
+ }
61
+ export { createInMemorySink };
@@ -0,0 +1,2 @@
1
+ import { InMemorySink, StoredRow, createInMemorySink } from "./in-memory-sink.mjs";
2
+ export { type InMemorySink, type StoredRow, createInMemorySink };
@@ -0,0 +1,2 @@
1
+ import { createInMemorySink } from "./in-memory-sink.mjs";
2
+ export { createInMemorySink };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Describes a hot/cold snapshot set. Produced by the snapshot builder,
3
+ * consumed by `attachSnapshotIndex`. Filenames are derived from `cold`
4
+ * via `cold-${yearMonth}.duckdb`; hot is always `hot.duckdb` when
5
+ * `hot: true`.
6
+ */
7
+ interface SnapshotIndex {
8
+ version: 1;
9
+ builtAt: string;
10
+ cold: string[];
11
+ hot: boolean;
12
+ hotDays: number;
13
+ }
14
+ export { SnapshotIndex };
@@ -0,0 +1,45 @@
1
+ import { Row } from "../storage.mjs";
2
+ import { ResolverAdapter } from "../resolver/types.mjs";
3
+ import { AnalysisQuerySource } from "./source-types.mjs";
4
+ import { EngineError } from "../errors.mjs";
5
+ import "../contracts.mjs";
6
+ interface AttachedTableRunner {
7
+ /**
8
+ * Run a query with positional (`?`) bound parameters. Return objects keyed
9
+ * by column name. BIGINT → number coercion is applied by the source factory
10
+ * (see `coerceRows`); runners only need to handle DATE → ISO string (or
11
+ * let the analyzer reducer normalize via `num(v)`/`str(v)`).
12
+ */
13
+ query: (sql: string, params?: unknown[], signal?: AbortSignal) => Promise<Row[]>;
14
+ }
15
+ interface AttachedTableSourceOptions {
16
+ /** Schema name the exported DuckDB file was attached under — e.g. `gsc`. */
17
+ schema: string;
18
+ /**
19
+ * Abort in-flight queries when the caller no longer cares about the
20
+ * result. Every `runner.query` call receives the same signal.
21
+ */
22
+ signal?: AbortSignal;
23
+ /**
24
+ * List of table names actually attached to this connection. When provided,
25
+ * `executeSql` short-circuits with a specific "table not attached" error
26
+ * if the SQL plan references a table that isn't in this list — letting
27
+ * callers (e.g. the analytics layer) route to cloud fallback without
28
+ * paying the SQL execution cost. Omit to disable the check.
29
+ */
30
+ attachedTables?: readonly string[];
31
+ /**
32
+ * Dialect adapter surfaced on the source for analyzers that compose SQL
33
+ * from a `BuilderState` at plan-build time (e.g. `data-query`,
34
+ * `data-detail`). Attached-table sources execute pg-flavored DuckDB SQL,
35
+ * so callers should pass `pgResolverAdapter` here.
36
+ */
37
+ adapter?: ResolverAdapter<any>;
38
+ }
39
+ declare class AttachedTableMissingError extends Error {
40
+ readonly missing: readonly string[];
41
+ readonly engineError: EngineError;
42
+ constructor(missing: readonly string[]);
43
+ }
44
+ declare function createAttachedTableSource(runner: AttachedTableRunner, options: AttachedTableSourceOptions): AnalysisQuerySource;
45
+ export { AttachedTableMissingError, AttachedTableRunner, AttachedTableSourceOptions, createAttachedTableSource };