@gscdump/engine 1.4.0 → 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} +2 -34
  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,967 +0,0 @@
1
- import { emptyTypesKey, hashSortedUrlList, hashUrl, hashUrlList, indexingMetadataIndexKey, inspectionBaseKey, inspectionEventKey, inspectionEventsPrefix, inspectionHistoryPrefix, inspectionHistoryShardKey, inspectionParquetKey, queryDimMetaKey, queryDimParquetKey, sitemapHistoryKey, sitemapIndexKey, sitemapUrlsDeltaKey, sitemapUrlsIndexKey, sitemapUrlsIndexPrefix, sitemapUrlsPrefix } from "../entity-keys.mjs";
2
- import { decodeParquetToRows, encodeRowsToParquetFlex } from "../adapters/hyparquet.mjs";
3
- import { encodeJsonBigintSafe } from "@gscdump/lakehouse/bigint";
4
- function isMissingKeyError(e) {
5
- if (typeof e !== "object" || e === null) return false;
6
- if (e.code === "ENOENT") return true;
7
- if (e.name === "NotFoundError") return true;
8
- const message = e.message;
9
- if (typeof message !== "string") return false;
10
- return /\bnot found\b|\bENOENT\b|\bmissing key\b/i.test(message);
11
- }
12
- async function readOptional(ds, key, signal) {
13
- return await ds.read(key, void 0, signal).catch((e) => {
14
- if (isMissingKeyError(e)) return void 0;
15
- throw e;
16
- });
17
- }
18
- const QUERY_DIM_COLUMNS = [
19
- {
20
- name: "query",
21
- type: "VARCHAR",
22
- nullable: false
23
- },
24
- {
25
- name: "query_canonical",
26
- type: "VARCHAR",
27
- nullable: false
28
- },
29
- {
30
- name: "intent_code",
31
- type: "INTEGER",
32
- nullable: false
33
- },
34
- {
35
- name: "normalizer_version",
36
- type: "INTEGER",
37
- nullable: false
38
- },
39
- {
40
- name: "intent_version",
41
- type: "INTEGER",
42
- nullable: false
43
- }
44
- ];
45
- function buildQueryDimRecords(queries, deps) {
46
- const seen = /* @__PURE__ */ new Set();
47
- const out = [];
48
- for (const raw of queries) {
49
- const query = String(raw);
50
- if (query.trim() === "" || seen.has(query)) continue;
51
- seen.add(query);
52
- const canonical = deps.normalizeQuery(query);
53
- out.push({
54
- query,
55
- query_canonical: canonical === "" ? query : canonical,
56
- intent_code: deps.classifyIntentCode(query),
57
- normalizer_version: deps.normalizerVersion,
58
- intent_version: deps.intentVersion
59
- });
60
- }
61
- return out;
62
- }
63
- function createQueryDimStore({ dataSource }) {
64
- return {
65
- parquetKey: queryDimParquetKey,
66
- async write(ctx, records, builtAt) {
67
- const parquetKey = queryDimParquetKey(ctx);
68
- const bytes = encodeRowsToParquetFlex(records, {
69
- columns: QUERY_DIM_COLUMNS,
70
- sortKey: ["query"]
71
- });
72
- await dataSource.write(parquetKey, bytes);
73
- const meta = {
74
- version: 1,
75
- builtAt,
76
- rowCount: records.length,
77
- normalizerVersion: records[0]?.normalizer_version ?? 0,
78
- intentVersion: records[0]?.intent_version ?? 0
79
- };
80
- await dataSource.write(queryDimMetaKey(ctx), encodeJsonBigintSafe(meta));
81
- return {
82
- parquetKey,
83
- rowCount: records.length
84
- };
85
- },
86
- async loadMeta(ctx) {
87
- const bytes = await readOptional(dataSource, queryDimMetaKey(ctx));
88
- if (!bytes) return null;
89
- return JSON.parse(new TextDecoder().decode(bytes));
90
- },
91
- async loadRecords(ctx) {
92
- const bytes = await readOptional(dataSource, queryDimParquetKey(ctx));
93
- if (!bytes) return [];
94
- return (await decodeParquetToRows(bytes)).map((r) => ({
95
- query: String(r.query),
96
- query_canonical: String(r.query_canonical),
97
- intent_code: Number(r.intent_code),
98
- normalizer_version: Number(r.normalizer_version),
99
- intent_version: Number(r.intent_version)
100
- }));
101
- }
102
- };
103
- }
104
- const YEAR_MONTH_RE = /^(\d{4})-(\d{2})-/;
105
- const ENTITY_IO_CONCURRENCY = 8;
106
- async function mapEntityIo(items, fn) {
107
- if (items.length === 0) return [];
108
- const results = Array.from({ length: items.length }, () => void 0);
109
- let next = 0;
110
- async function worker() {
111
- while (true) {
112
- const index = next++;
113
- if (index >= items.length) return;
114
- results[index] = await fn(items[index], index);
115
- }
116
- }
117
- await Promise.all(Array.from({ length: Math.min(ENTITY_IO_CONCURRENCY, items.length) }, worker));
118
- return results;
119
- }
120
- const INSPECTION_EVENT_KEY_RE = /\/inspections\/events\/\d{4}-\d{2}\/[^/]+\.parquet$/;
121
- const INSPECTION_HISTORY_MAX_BYTES = 5 * 1024 * 1024;
122
- const INSPECTION_PARQUET_COLUMNS = [
123
- {
124
- name: "urlHash",
125
- type: "VARCHAR",
126
- nullable: false
127
- },
128
- {
129
- name: "url",
130
- type: "VARCHAR",
131
- nullable: false
132
- },
133
- {
134
- name: "inspectedAt",
135
- type: "VARCHAR",
136
- nullable: false
137
- },
138
- {
139
- name: "indexStatus",
140
- type: "VARCHAR",
141
- nullable: true
142
- },
143
- {
144
- name: "lastCrawlTime",
145
- type: "VARCHAR",
146
- nullable: true
147
- },
148
- {
149
- name: "googleCanonical",
150
- type: "VARCHAR",
151
- nullable: true
152
- },
153
- {
154
- name: "userCanonical",
155
- type: "VARCHAR",
156
- nullable: true
157
- },
158
- {
159
- name: "coverageState",
160
- type: "VARCHAR",
161
- nullable: true
162
- },
163
- {
164
- name: "robotsTxtState",
165
- type: "VARCHAR",
166
- nullable: true
167
- },
168
- {
169
- name: "indexingState",
170
- type: "VARCHAR",
171
- nullable: true
172
- },
173
- {
174
- name: "pageFetchState",
175
- type: "VARCHAR",
176
- nullable: true
177
- },
178
- {
179
- name: "mobileUsabilityVerdict",
180
- type: "VARCHAR",
181
- nullable: true
182
- },
183
- {
184
- name: "richResultsVerdict",
185
- type: "VARCHAR",
186
- nullable: true
187
- },
188
- {
189
- name: "scheduleNextAt",
190
- type: "BIGINT",
191
- nullable: true
192
- },
193
- {
194
- name: "scheduleConsecutiveUnchanged",
195
- type: "INTEGER",
196
- nullable: true
197
- },
198
- {
199
- name: "schedulePolicyVersion",
200
- type: "INTEGER",
201
- nullable: true
202
- }
203
- ];
204
- const INSPECTION_EVENT_COLUMNS = [
205
- ...INSPECTION_PARQUET_COLUMNS,
206
- {
207
- name: "crawlingUserAgent",
208
- type: "VARCHAR",
209
- nullable: true
210
- },
211
- {
212
- name: "richResultsItems",
213
- type: "VARCHAR",
214
- nullable: true
215
- },
216
- {
217
- name: "sitemaps",
218
- type: "VARCHAR",
219
- nullable: true
220
- },
221
- {
222
- name: "referringUrls",
223
- type: "VARCHAR",
224
- nullable: true
225
- },
226
- {
227
- name: "mobileIssues",
228
- type: "VARCHAR",
229
- nullable: true
230
- },
231
- {
232
- name: "inspectionResultLink",
233
- type: "VARCHAR",
234
- nullable: true
235
- },
236
- {
237
- name: "firstCheckedAt",
238
- type: "VARCHAR",
239
- nullable: true
240
- },
241
- {
242
- name: "checkCount",
243
- type: "INTEGER",
244
- nullable: true
245
- },
246
- {
247
- name: "nextCheckAfter",
248
- type: "BIGINT",
249
- nullable: true
250
- },
251
- {
252
- name: "nextCheckPriority",
253
- type: "VARCHAR",
254
- nullable: true
255
- }
256
- ];
257
- function createInspectionStore(opts) {
258
- const ds = opts.dataSource;
259
- function shardFor(record) {
260
- const m = YEAR_MONTH_RE.exec(record.inspectedAt);
261
- return m ? `${m[1]}-${m[2]}` : "unknown";
262
- }
263
- function randomBatchId() {
264
- return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
265
- }
266
- return {
267
- async appendHistory(ctx, records, options) {
268
- if (records.length === 0) return;
269
- const batchId = options?.batchId ?? randomBatchId();
270
- const byMonth = /* @__PURE__ */ new Map();
271
- for (const r of records) {
272
- const month = shardFor(r);
273
- if (!byMonth.has(month)) byMonth.set(month, []);
274
- byMonth.get(month).push(r);
275
- }
276
- await mapEntityIo([...byMonth].map(([yearMonth, batch]) => {
277
- const bytes = encodeJsonBigintSafe({
278
- version: 1,
279
- records: batch
280
- });
281
- if (bytes.byteLength > 5242880) throw new Error(`inspection history shard exceeds ${INSPECTION_HISTORY_MAX_BYTES} bytes (got ${bytes.byteLength}); split the batch`);
282
- return {
283
- key: inspectionHistoryShardKey(ctx, yearMonth, batchId),
284
- bytes
285
- };
286
- }), (shard) => ds.write(shard.key, shard.bytes));
287
- },
288
- async loadHistory(ctx, yearMonth) {
289
- const keys = await ds.list(inspectionHistoryPrefix(ctx, yearMonth));
290
- if (keys.length === 0) return void 0;
291
- return {
292
- version: 1,
293
- records: (await mapEntityIo(keys, async (key) => {
294
- const bytes = await readOptional(ds, key);
295
- if (!bytes) return [];
296
- return (await Promise.resolve().then(() => JSON.parse(new TextDecoder().decode(bytes))).catch((err) => {
297
- console.warn("[inspection.loadHistory] failed to decode shard", {
298
- key,
299
- error: err.message
300
- });
301
- }))?.records ?? [];
302
- })).flat()
303
- };
304
- },
305
- async materialize(ctx, rowIter) {
306
- const rows = Array.from(rowIter);
307
- rows.sort((a, b) => a.urlHash < b.urlHash ? -1 : a.urlHash > b.urlHash ? 1 : 0);
308
- const bytes = encodeRowsToParquetFlex(rows, {
309
- columns: INSPECTION_PARQUET_COLUMNS,
310
- sortKey: ["urlHash"]
311
- });
312
- const key = inspectionParquetKey(ctx);
313
- await ds.write(key, bytes);
314
- return {
315
- key,
316
- rowCount: rows.length,
317
- bytes: bytes.byteLength
318
- };
319
- },
320
- async appendInspectionEvents(ctx, rows, options) {
321
- if (rows.length === 0) return {
322
- keys: [],
323
- rowCount: 0
324
- };
325
- const batchId = options?.batchId ?? randomBatchId();
326
- const byMonth = /* @__PURE__ */ new Map();
327
- for (const r of rows) {
328
- const m = YEAR_MONTH_RE.exec(r.inspectedAt);
329
- const month = m ? `${m[1]}-${m[2]}` : "unknown";
330
- const bucket = byMonth.get(month) ?? [];
331
- bucket.push(r);
332
- byMonth.set(month, bucket);
333
- }
334
- const files = [...byMonth].map(([month, batch]) => {
335
- const bytes = encodeRowsToParquetFlex(batch, {
336
- columns: INSPECTION_EVENT_COLUMNS,
337
- sortKey: ["urlHash"]
338
- });
339
- return {
340
- key: inspectionEventKey(ctx, month, batchId),
341
- bytes
342
- };
343
- });
344
- await mapEntityIo(files, (file) => ds.write(file.key, file.bytes));
345
- return {
346
- keys: files.map((file) => file.key),
347
- rowCount: rows.length
348
- };
349
- },
350
- async compactInspections(ctx) {
351
- const eventKeys = (await ds.list(`${inspectionEventsPrefix(ctx)}/`)).filter((k) => INSPECTION_EVENT_KEY_RE.test(k));
352
- if (eventKeys.length === 0) return {
353
- baseRowCount: 0,
354
- eventsFolded: 0,
355
- eventFilesDeleted: 0
356
- };
357
- const baseKey = inspectionBaseKey(ctx);
358
- const baseBytes = await readOptional(ds, baseKey);
359
- const baseRows = baseBytes ? await decodeParquetToRows(baseBytes) : [];
360
- const latest = /* @__PURE__ */ new Map();
361
- const earliestChecked = /* @__PURE__ */ new Map();
362
- const consider = (row) => {
363
- const h = String(row.urlHash);
364
- const prev = latest.get(h);
365
- if (!prev || String(row.inspectedAt ?? "") > String(prev.inspectedAt ?? "")) latest.set(h, row);
366
- const fc = row.firstCheckedAt;
367
- if (fc != null) {
368
- const fcStr = String(fc);
369
- const cur = earliestChecked.get(h);
370
- if (cur === void 0 || fcStr < cur) earliestChecked.set(h, fcStr);
371
- }
372
- };
373
- for (const row of baseRows) consider(row);
374
- let eventsFolded = 0;
375
- const consumed = [];
376
- const eventFiles = await mapEntityIo(eventKeys.sort(), async (key) => {
377
- const bytes = await readOptional(ds, key);
378
- if (!bytes) return void 0;
379
- return {
380
- key,
381
- rows: await decodeParquetToRows(bytes)
382
- };
383
- });
384
- for (const file of eventFiles) {
385
- if (!file) continue;
386
- const { key, rows } = file;
387
- consumed.push(key);
388
- for (const row of rows) {
389
- consider(row);
390
- eventsFolded++;
391
- }
392
- }
393
- const merged = [];
394
- for (const [h, row] of latest) {
395
- const fc = earliestChecked.get(h);
396
- if (fc !== void 0) row.firstCheckedAt = fc;
397
- merged.push(row);
398
- }
399
- const bytes = encodeRowsToParquetFlex(merged, {
400
- columns: INSPECTION_EVENT_COLUMNS,
401
- sortKey: ["urlHash"]
402
- });
403
- await ds.write(baseKey, bytes);
404
- if (consumed.length > 0) await ds.delete(consumed);
405
- return {
406
- baseRowCount: merged.length,
407
- eventsFolded,
408
- eventFilesDeleted: consumed.length
409
- };
410
- },
411
- parquetUri(ctx) {
412
- return ds.uri?.(inspectionParquetKey(ctx));
413
- }
414
- };
415
- }
416
- const SITEMAP_URLS_DELTA_PREFIX_RE = /\/urls\/deltas\/(\d{4}-\d{2}-\d{2})__([0-9a-f]+)\.parquet$/;
417
- const URLS_INDEX_COLUMNS = [
418
- {
419
- name: "feedpath",
420
- type: "VARCHAR",
421
- nullable: false
422
- },
423
- {
424
- name: "feedpath_hash",
425
- type: "VARCHAR",
426
- nullable: false
427
- },
428
- {
429
- name: "url_hash",
430
- type: "VARCHAR",
431
- nullable: false
432
- },
433
- {
434
- name: "loc",
435
- type: "VARCHAR",
436
- nullable: false
437
- },
438
- {
439
- name: "lastmod",
440
- type: "VARCHAR",
441
- nullable: true
442
- },
443
- {
444
- name: "first_seen_at",
445
- type: "BIGINT",
446
- nullable: false
447
- },
448
- {
449
- name: "last_seen_at",
450
- type: "BIGINT",
451
- nullable: false
452
- },
453
- {
454
- name: "removed_at",
455
- type: "BIGINT",
456
- nullable: true
457
- }
458
- ];
459
- const URLS_DELTA_COLUMNS = [
460
- {
461
- name: "feedpath",
462
- type: "VARCHAR",
463
- nullable: false
464
- },
465
- {
466
- name: "feedpath_hash",
467
- type: "VARCHAR",
468
- nullable: false
469
- },
470
- {
471
- name: "url_hash",
472
- type: "VARCHAR",
473
- nullable: false
474
- },
475
- {
476
- name: "op",
477
- type: "VARCHAR",
478
- nullable: false
479
- },
480
- {
481
- name: "loc",
482
- type: "VARCHAR",
483
- nullable: false
484
- },
485
- {
486
- name: "lastmod",
487
- type: "VARCHAR",
488
- nullable: true
489
- },
490
- {
491
- name: "at",
492
- type: "BIGINT",
493
- nullable: false
494
- }
495
- ];
496
- function rowToUrlRecord(row) {
497
- return {
498
- feedpath: String(row.feedpath),
499
- feedpathHash: String(row.feedpath_hash),
500
- urlHash: String(row.url_hash),
501
- loc: String(row.loc),
502
- lastmod: row.lastmod == null ? void 0 : String(row.lastmod),
503
- firstSeenAt: Number(row.first_seen_at),
504
- lastSeenAt: Number(row.last_seen_at),
505
- removedAt: row.removed_at == null ? void 0 : Number(row.removed_at)
506
- };
507
- }
508
- function urlRecordToRow(r) {
509
- return {
510
- feedpath: r.feedpath,
511
- feedpath_hash: r.feedpathHash,
512
- url_hash: r.urlHash,
513
- loc: r.loc,
514
- lastmod: r.lastmod ?? null,
515
- first_seen_at: r.firstSeenAt,
516
- last_seen_at: r.lastSeenAt,
517
- removed_at: r.removedAt ?? null
518
- };
519
- }
520
- function isoDate(ms) {
521
- return new Date(ms).toISOString().slice(0, 10);
522
- }
523
- function createSitemapStore(opts) {
524
- const ds = opts.dataSource;
525
- const hash = opts.hash ?? hashUrl;
526
- const now = opts.now ?? (() => Date.now());
527
- async function readJson(key) {
528
- const bytes = await readOptional(ds, key);
529
- if (bytes === void 0) return void 0;
530
- return JSON.parse(new TextDecoder().decode(bytes));
531
- }
532
- async function writeJson(key, value) {
533
- await ds.write(key, encodeJsonBigintSafe(value));
534
- }
535
- return {
536
- async writeSnapshot(ctx, records) {
537
- if (records.length === 0) return;
538
- const indexKey = sitemapIndexKey(ctx);
539
- const index = await readJson(indexKey) ?? {
540
- version: 1,
541
- records: {}
542
- };
543
- const stamp = now();
544
- const historyDocs = /* @__PURE__ */ new Map();
545
- for (const r of records) {
546
- const h = hash(r.path);
547
- index.records[h] = r;
548
- historyDocs.set(sitemapHistoryKey(ctx, h, stamp), {
549
- version: 1,
550
- path: r.path,
551
- capturedAt: r.capturedAt,
552
- record: r
553
- });
554
- }
555
- await mapEntityIo([...historyDocs], ([key, doc]) => writeJson(key, doc));
556
- await writeJson(indexKey, index);
557
- },
558
- async loadIndex(ctx) {
559
- return await readJson(sitemapIndexKey(ctx)) ?? {
560
- version: 1,
561
- records: {}
562
- };
563
- },
564
- async getLatest(ctx, path) {
565
- return (await readJson(sitemapIndexKey(ctx)))?.records[hash(path)];
566
- },
567
- async snapshotUrls(ctx, feedpath, urls) {
568
- const fpHash = hash(feedpath);
569
- const contentHash = hashUrlList(urls);
570
- const at = now();
571
- const priorByHash = /* @__PURE__ */ new Map();
572
- for await (const rec of this.loadUrls(ctx, feedpath, { includeRemoved: true })) priorByHash.set(rec.urlHash, rec);
573
- const livePrior = Array.from(priorByHash.values()).filter((r) => r.removedAt == null);
574
- if (livePrior.length > 0) {
575
- if (hashSortedUrlList(livePrior.map((r) => String(r.loc)).sort()) === contentHash) return {
576
- added: 0,
577
- removed: 0,
578
- kept: livePrior.length,
579
- contentHash,
580
- unchanged: true
581
- };
582
- }
583
- const incomingByHash = /* @__PURE__ */ new Map();
584
- for (const u of urls) incomingByHash.set(hash(u.loc), u);
585
- const deltaRows = [];
586
- let added = 0;
587
- let removed = 0;
588
- let kept = 0;
589
- const date = isoDate(at);
590
- for (const [urlHash, u] of incomingByHash) {
591
- const prev = priorByHash.get(urlHash);
592
- if (!prev || prev.removedAt != null) {
593
- added++;
594
- deltaRows.push({
595
- feedpath,
596
- feedpath_hash: fpHash,
597
- url_hash: urlHash,
598
- op: "added",
599
- loc: u.loc,
600
- lastmod: u.lastmod ?? null,
601
- at
602
- });
603
- } else kept++;
604
- }
605
- for (const [urlHash, prev] of priorByHash) {
606
- if (prev.removedAt != null) continue;
607
- if (!incomingByHash.has(urlHash)) {
608
- removed++;
609
- deltaRows.push({
610
- feedpath,
611
- feedpath_hash: fpHash,
612
- url_hash: urlHash,
613
- op: "removed",
614
- loc: prev.loc,
615
- lastmod: prev.lastmod ?? null,
616
- at
617
- });
618
- }
619
- }
620
- if (deltaRows.length > 0) {
621
- const bytes = encodeRowsToParquetFlex(deltaRows, {
622
- columns: URLS_DELTA_COLUMNS,
623
- sortKey: ["url_hash"]
624
- });
625
- await ds.write(sitemapUrlsDeltaKey(ctx, fpHash, date), bytes);
626
- }
627
- return {
628
- added,
629
- removed,
630
- kept,
631
- contentHash,
632
- unchanged: false
633
- };
634
- },
635
- async *loadUrls(ctx, feedpath, opts) {
636
- const fpHash = hash(feedpath);
637
- const includeRemoved = opts?.includeRemoved ?? false;
638
- const [indexRows, listedDeltaKeys] = await Promise.all([readOptional(ds, sitemapUrlsIndexKey(ctx, fpHash)).then((bytes) => bytes ? decodeParquetToRows(bytes) : []), ds.list(`${sitemapUrlsPrefix(ctx)}/deltas/`)]);
639
- const deltaKeys = listedDeltaKeys.filter((key) => {
640
- return SITEMAP_URLS_DELTA_PREFIX_RE.exec(key)?.[2] === fpHash;
641
- }).sort();
642
- const live = /* @__PURE__ */ new Map();
643
- const removedMap = /* @__PURE__ */ new Map();
644
- for (const row of indexRows) {
645
- const rec = rowToUrlRecord(row);
646
- if (rec.removedAt != null) removedMap.set(rec.urlHash, rec);
647
- else live.set(rec.urlHash, rec);
648
- }
649
- const deltas = await mapEntityIo(deltaKeys, async (key) => {
650
- const dBytes = await readOptional(ds, key);
651
- if (!dBytes) return [];
652
- return decodeParquetToRows(dBytes);
653
- });
654
- for (const dRows of deltas) for (const r of dRows) {
655
- const op = String(r.op);
656
- const urlHash = String(r.url_hash);
657
- const at = Number(r.at);
658
- if (op === "added") {
659
- const prev = live.get(urlHash) ?? removedMap.get(urlHash);
660
- removedMap.delete(urlHash);
661
- live.set(urlHash, {
662
- feedpath,
663
- feedpathHash: fpHash,
664
- urlHash,
665
- loc: String(r.loc),
666
- lastmod: r.lastmod == null ? void 0 : String(r.lastmod),
667
- firstSeenAt: prev?.firstSeenAt ?? at,
668
- lastSeenAt: at
669
- });
670
- } else if (op === "removed") {
671
- const prev = live.get(urlHash);
672
- live.delete(urlHash);
673
- if (prev) removedMap.set(urlHash, {
674
- ...prev,
675
- removedAt: at
676
- });
677
- }
678
- }
679
- for (const rec of live.values()) yield rec;
680
- if (includeRemoved) for (const rec of removedMap.values()) yield rec;
681
- },
682
- async *loadDeltas(ctx, dateRange) {
683
- const from = dateRange?.from;
684
- const to = dateRange?.to;
685
- const keys = (await ds.list(`${sitemapUrlsPrefix(ctx)}/deltas/`)).sort();
686
- for (const key of keys) {
687
- const m = SITEMAP_URLS_DELTA_PREFIX_RE.exec(key);
688
- if (!m) continue;
689
- const date = m[1];
690
- if (!date) continue;
691
- if (from && date < from) continue;
692
- if (to && date > to) continue;
693
- const bytes = await readOptional(ds, key);
694
- if (!bytes) continue;
695
- const rows = await decodeParquetToRows(bytes);
696
- for (const r of rows) {
697
- const op = String(r.op);
698
- if (op !== "added" && op !== "removed") continue;
699
- yield {
700
- feedpath: String(r.feedpath),
701
- feedpathHash: String(r.feedpath_hash),
702
- urlHash: String(r.url_hash),
703
- op,
704
- loc: String(r.loc),
705
- lastmod: r.lastmod == null ? void 0 : String(r.lastmod),
706
- at: Number(r.at)
707
- };
708
- }
709
- }
710
- },
711
- async compactUrls(ctx, opts = {}) {
712
- const startedAt = now();
713
- const deadlineMs = opts.deadlineMs ?? Number.POSITIVE_INFINITY;
714
- const maxFeedpaths = opts.maxFeedpaths ?? Number.POSITIVE_INFINITY;
715
- const deltaKeys = await ds.list(`${sitemapUrlsPrefix(ctx)}/deltas/`);
716
- const deltasByFeed = /* @__PURE__ */ new Map();
717
- for (const key of deltaKeys) {
718
- const m = SITEMAP_URLS_DELTA_PREFIX_RE.exec(key);
719
- if (!m) continue;
720
- const feedpathHash = m[2];
721
- if (!feedpathHash) continue;
722
- const list = deltasByFeed.get(feedpathHash) ?? [];
723
- list.push(key);
724
- deltasByFeed.set(feedpathHash, list);
725
- }
726
- const totalFeedpaths = deltasByFeed.size;
727
- let compactedFeedpaths = 0;
728
- for (const [fpHash, feedDeltaKeys] of deltasByFeed) {
729
- if (compactedFeedpaths > 0 && (compactedFeedpaths >= maxFeedpaths || now() - startedAt >= deadlineMs)) break;
730
- const indexKey = sitemapUrlsIndexKey(ctx, fpHash);
731
- const [indexRows, deltaFiles] = await Promise.all([readOptional(ds, indexKey).then((bytes) => bytes ? decodeParquetToRows(bytes) : []), mapEntityIo(feedDeltaKeys.sort(), async (key) => {
732
- const bytes = await readOptional(ds, key);
733
- if (!bytes) return void 0;
734
- return {
735
- key,
736
- rows: await decodeParquetToRows(bytes)
737
- };
738
- })]);
739
- const live = /* @__PURE__ */ new Map();
740
- const removed = /* @__PURE__ */ new Map();
741
- for (const row of indexRows) {
742
- const rec = rowToUrlRecord(row);
743
- if (rec.removedAt != null) removed.set(rec.urlHash, rec);
744
- else live.set(rec.urlHash, rec);
745
- }
746
- const consumed = [];
747
- for (const file of deltaFiles) {
748
- if (!file) continue;
749
- const { key, rows } = file;
750
- consumed.push(key);
751
- for (const r of rows) {
752
- const urlHash = String(r.url_hash);
753
- const at = Number(r.at);
754
- const op = String(r.op);
755
- if (op === "added") {
756
- const prev = live.get(urlHash) ?? removed.get(urlHash);
757
- removed.delete(urlHash);
758
- live.set(urlHash, {
759
- feedpath: String(r.feedpath),
760
- feedpathHash: fpHash,
761
- urlHash,
762
- loc: String(r.loc),
763
- lastmod: r.lastmod == null ? void 0 : String(r.lastmod),
764
- firstSeenAt: prev?.firstSeenAt ?? at,
765
- lastSeenAt: at
766
- });
767
- } else if (op === "removed") {
768
- const prev = live.get(urlHash);
769
- live.delete(urlHash);
770
- if (prev) removed.set(urlHash, {
771
- ...prev,
772
- removedAt: at
773
- });
774
- }
775
- }
776
- }
777
- const merged = [...live.values(), ...removed.values()];
778
- merged.sort((a, b) => a.urlHash < b.urlHash ? -1 : a.urlHash > b.urlHash ? 1 : 0);
779
- const bytes = encodeRowsToParquetFlex(merged.map(urlRecordToRow), {
780
- columns: URLS_INDEX_COLUMNS,
781
- sortKey: ["feedpath_hash", "url_hash"]
782
- });
783
- await ds.write(indexKey, bytes);
784
- if (consumed.length > 0) await ds.delete(consumed);
785
- compactedFeedpaths++;
786
- }
787
- return {
788
- compactedFeedpaths,
789
- remainingFeedpaths: totalFeedpaths - compactedFeedpaths
790
- };
791
- },
792
- async reconcile(ctx, { liveFeedpaths, at: atOpt }) {
793
- const at = atOpt ?? now();
794
- const liveHashes = new Set(liveFeedpaths.map((fp) => hash(fp)));
795
- const present = /* @__PURE__ */ new Set();
796
- const [indexKeys, deltaKeys] = await Promise.all([ds.list(`${sitemapUrlsIndexPrefix(ctx)}/`), ds.list(`${sitemapUrlsPrefix(ctx)}/deltas/`)]);
797
- for (const key of indexKeys) {
798
- const m = /\/by-feed\/([0-9a-f]+)\/index\.parquet$/.exec(key);
799
- if (m) present.add(m[1]);
800
- }
801
- const deltasByFeed = /* @__PURE__ */ new Map();
802
- for (const key of deltaKeys) {
803
- const m = SITEMAP_URLS_DELTA_PREFIX_RE.exec(key);
804
- if (!m) continue;
805
- present.add(m[2]);
806
- const list = deltasByFeed.get(m[2]) ?? [];
807
- list.push(key);
808
- deltasByFeed.set(m[2], list);
809
- }
810
- let feedpathsPruned = 0;
811
- let urlsRemoved = 0;
812
- for (const fpHash of present) {
813
- if (liveHashes.has(fpHash)) continue;
814
- const indexKey = sitemapUrlsIndexKey(ctx, fpHash);
815
- const [indexRows, deltaFiles] = await Promise.all([readOptional(ds, indexKey).then((bytes) => bytes ? decodeParquetToRows(bytes) : []), mapEntityIo((deltasByFeed.get(fpHash) ?? []).sort(), async (key) => {
816
- const bytes = await readOptional(ds, key);
817
- if (!bytes) return void 0;
818
- return {
819
- key,
820
- rows: await decodeParquetToRows(bytes)
821
- };
822
- })]);
823
- const live = /* @__PURE__ */ new Map();
824
- const removed = /* @__PURE__ */ new Map();
825
- for (const row of indexRows) {
826
- const r = rowToUrlRecord(row);
827
- if (r.removedAt != null) removed.set(r.urlHash, r);
828
- else live.set(r.urlHash, r);
829
- }
830
- const consumed = [];
831
- for (const file of deltaFiles) {
832
- if (!file) continue;
833
- const { key, rows } = file;
834
- consumed.push(key);
835
- for (const r of rows) {
836
- const urlHash = String(r.url_hash);
837
- const dat = Number(r.at);
838
- if (String(r.op) === "added") {
839
- const prev = live.get(urlHash) ?? removed.get(urlHash);
840
- removed.delete(urlHash);
841
- live.set(urlHash, {
842
- feedpath: String(r.feedpath),
843
- feedpathHash: fpHash,
844
- urlHash,
845
- loc: String(r.loc),
846
- lastmod: r.lastmod == null ? void 0 : String(r.lastmod),
847
- firstSeenAt: prev?.firstSeenAt ?? dat,
848
- lastSeenAt: dat
849
- });
850
- } else if (String(r.op) === "removed") {
851
- const prev = live.get(urlHash);
852
- live.delete(urlHash);
853
- if (prev) removed.set(urlHash, {
854
- ...prev,
855
- removedAt: dat
856
- });
857
- }
858
- }
859
- }
860
- const hadLive = live.size > 0;
861
- if (!hadLive && consumed.length === 0) continue;
862
- for (const [urlHash, r] of live) {
863
- removed.set(urlHash, {
864
- ...r,
865
- removedAt: at
866
- });
867
- urlsRemoved++;
868
- }
869
- const merged = [...removed.values()];
870
- merged.sort((a, b) => a.urlHash < b.urlHash ? -1 : a.urlHash > b.urlHash ? 1 : 0);
871
- const bytes = encodeRowsToParquetFlex(merged.map(urlRecordToRow), {
872
- columns: URLS_INDEX_COLUMNS,
873
- sortKey: ["feedpath_hash", "url_hash"]
874
- });
875
- await ds.write(indexKey, bytes);
876
- if (consumed.length > 0) await ds.delete(consumed);
877
- if (hadLive) feedpathsPruned++;
878
- }
879
- return {
880
- feedpathsPruned,
881
- urlsRemoved
882
- };
883
- }
884
- };
885
- }
886
- function createIndexingMetadataStore(opts) {
887
- const ds = opts.dataSource;
888
- const hash = opts.hash ?? hashUrl;
889
- async function readIndex(key) {
890
- const bytes = await readOptional(ds, key);
891
- if (bytes === void 0) return {
892
- version: 1,
893
- records: {}
894
- };
895
- return JSON.parse(new TextDecoder().decode(bytes));
896
- }
897
- return {
898
- async writeBatch(ctx, records) {
899
- if (records.length === 0) return;
900
- const key = indexingMetadataIndexKey(ctx);
901
- const index = await readIndex(key);
902
- for (const r of records) index.records[hash(r.url)] = r;
903
- await ds.write(key, encodeJsonBigintSafe(index));
904
- },
905
- async loadIndex(ctx) {
906
- return readIndex(indexingMetadataIndexKey(ctx));
907
- },
908
- async getLatest(ctx, url) {
909
- return (await readIndex(indexingMetadataIndexKey(ctx))).records[hash(url)];
910
- }
911
- };
912
- }
913
- function createEmptyTypesStore(opts) {
914
- const ds = opts.dataSource;
915
- const now = opts.now ?? (() => Date.now());
916
- async function readDoc(key) {
917
- const bytes = await readOptional(ds, key);
918
- if (bytes === void 0) return {
919
- version: 1,
920
- emptyTypes: [],
921
- markedAt: {}
922
- };
923
- return JSON.parse(new TextDecoder().decode(bytes));
924
- }
925
- async function writeDoc(key, doc) {
926
- await ds.write(key, encodeJsonBigintSafe(doc));
927
- }
928
- return {
929
- async load(ctx) {
930
- return readDoc(emptyTypesKey(ctx));
931
- },
932
- async mark(ctx, types, at) {
933
- if (types.length === 0) return readDoc(emptyTypesKey(ctx));
934
- const key = emptyTypesKey(ctx);
935
- const doc = await readDoc(key);
936
- const stamp = at ?? now();
937
- let changed = false;
938
- for (const t of types) {
939
- if (!doc.emptyTypes.includes(t)) {
940
- doc.emptyTypes.push(t);
941
- changed = true;
942
- }
943
- if (doc.markedAt[t] === void 0) {
944
- doc.markedAt[t] = stamp;
945
- changed = true;
946
- }
947
- }
948
- if (changed) {
949
- doc.emptyTypes.sort();
950
- await writeDoc(key, doc);
951
- }
952
- return doc;
953
- },
954
- async clear(ctx, types) {
955
- if (types.length === 0) return readDoc(emptyTypesKey(ctx));
956
- const key = emptyTypesKey(ctx);
957
- const doc = await readDoc(key);
958
- const drop = new Set(types);
959
- const before = doc.emptyTypes.length;
960
- doc.emptyTypes = doc.emptyTypes.filter((t) => !drop.has(t));
961
- for (const t of drop) delete doc.markedAt[t];
962
- if (doc.emptyTypes.length !== before) await writeDoc(key, doc);
963
- return doc;
964
- }
965
- };
966
- }
967
- export { INSPECTION_HISTORY_MAX_BYTES, buildQueryDimRecords, createEmptyTypesStore, createIndexingMetadataStore, createInspectionStore, createQueryDimStore, createSitemapStore };