@gscdump/engine 1.3.2 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/dist/adapters/duckdb-node.d.mts +7 -0
  2. package/dist/adapters/duckdb-node.mjs +94 -0
  3. package/dist/adapters/filesystem.d.mts +1 -1
  4. package/dist/adapters/filesystem.mjs +1 -1
  5. package/dist/adapters/hyparquet.d.mts +4 -3
  6. package/dist/adapters/hyparquet.mjs +7 -3
  7. package/dist/adapters/node-harness.d.mts +38 -0
  8. package/dist/adapters/node-harness.mjs +47 -0
  9. package/dist/adapters/node.d.mts +4 -100
  10. package/dist/adapters/node.mjs +4 -240
  11. package/dist/adapters/parquet-attach.d.mts +23 -0
  12. package/dist/adapters/parquet-attach.mjs +21 -0
  13. package/dist/adapters/r2-manifest.d.mts +82 -0
  14. package/dist/adapters/r2-manifest.mjs +364 -0
  15. package/dist/adapters/r2.d.mts +1 -1
  16. package/dist/adapters/read-optional.mjs +15 -0
  17. package/dist/adapters/snapshot-attach.d.mts +38 -0
  18. package/dist/adapters/snapshot-attach.mjs +85 -0
  19. package/dist/analysis-types.d.mts +56 -1
  20. package/dist/analyzer/define.d.mts +48 -0
  21. package/dist/analyzer/define.mjs +60 -0
  22. package/dist/analyzer/dispatch.d.mts +17 -0
  23. package/dist/analyzer/index.d.mts +4 -14
  24. package/dist/analyzer/index.mjs +4 -112
  25. package/dist/analyzer/registry.d.mts +33 -0
  26. package/dist/analyzer/registry.mjs +49 -0
  27. package/dist/analyzer/types.d.mts +95 -0
  28. package/dist/analyzer/types.mjs +5 -0
  29. package/dist/coerce.d.mts +4 -0
  30. package/dist/compaction.d.mts +14 -0
  31. package/dist/{_chunks/parquet-plan.mjs → compaction.mjs} +2 -138
  32. package/dist/contracts.d.mts +1 -2
  33. package/dist/{_chunks/schema.d.mts → drizzle-schema.d.mts} +22 -54
  34. package/dist/{_chunks/schema.mjs → drizzle-schema.mjs} +2 -78
  35. package/dist/{_chunks/snapshot.d.mts → duckdb.d.mts} +1 -14
  36. package/dist/duckdb.mjs +207 -0
  37. package/dist/engine.d.mts +4 -0
  38. package/dist/engine.mjs +385 -0
  39. package/dist/entities.d.mts +3 -52
  40. package/dist/entities.mjs +867 -2
  41. package/dist/errors.d.mts +114 -1
  42. package/dist/gc.mjs +92 -0
  43. package/dist/iceberg/append-sink.d.mts +14 -0
  44. package/dist/iceberg/append-sink.mjs +142 -0
  45. package/dist/iceberg/catalog.d.mts +71 -0
  46. package/dist/iceberg/catalog.mjs +109 -0
  47. package/dist/iceberg/index.d.mts +4 -13
  48. package/dist/iceberg/index.mjs +3 -244
  49. package/dist/iceberg/overwrite-writer.d.mts +161 -0
  50. package/dist/iceberg/overwrite-writer.mjs +102 -0
  51. package/dist/iceberg/pyiceberg-runtime.mjs +34 -0
  52. package/dist/iceberg/schema.d.mts +69 -0
  53. package/dist/{_chunks/schema2.mjs → iceberg/schema.mjs} +3 -2
  54. package/dist/index.d.mts +14 -190
  55. package/dist/index.mjs +10 -645
  56. package/dist/ingest-accumulator.d.mts +1 -1
  57. package/dist/ingest.d.mts +1 -1
  58. package/dist/layout.d.mts +31 -0
  59. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.bitreader.mjs +88 -0
  60. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.blocks.mjs +120 -0
  61. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.context.mjs +1805 -0
  62. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.contextmap.mjs +49 -0
  63. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.dictionary.mjs +984 -0
  64. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.huffman.mjs +266 -0
  65. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.mjs +340 -0
  66. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.prefix.mjs +109 -0
  67. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.streams.mjs +21 -0
  68. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/brotli.transform.mjs +190 -0
  69. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/compressors.mjs +7 -0
  70. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/gzip.huffman.mjs +121 -0
  71. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/gzip.mjs +176 -0
  72. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/index.mjs +7 -0
  73. package/dist/node_modules/.pnpm/hyparquet-compressors@1.1.1/node_modules/hyparquet-compressors/src/lz4.mjs +52 -0
  74. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/bloom.mjs +93 -0
  75. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/bytewriter.mjs +91 -0
  76. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/column.mjs +186 -0
  77. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/datapage.mjs +113 -0
  78. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/delta.mjs +111 -0
  79. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/dictionary.mjs +99 -0
  80. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/dremel.mjs +116 -0
  81. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/encoding.mjs +51 -0
  82. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/geospatial.mjs +84 -0
  83. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/index.mjs +7 -0
  84. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/indexes.mjs +31 -0
  85. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/metadata.mjs +138 -0
  86. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/node.mjs +8 -0
  87. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/parquet-writer.mjs +139 -0
  88. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/plain.mjs +68 -0
  89. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/schema.mjs +254 -0
  90. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/snappy.mjs +125 -0
  91. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/splitstream.mjs +38 -0
  92. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/thrift.mjs +79 -0
  93. package/dist/{_chunks/libs/hyparquet-writer.d.mts → node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/types.d.mts} +2 -2
  94. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/unconvert.mjs +247 -0
  95. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/variant.mjs +321 -0
  96. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/wkb.mjs +79 -0
  97. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/write-rows.mjs +122 -0
  98. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/src/write.mjs +5 -0
  99. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/bytewriter.d.mts +1 -0
  100. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/index.d.mts +10 -0
  101. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/node.d.mts +3 -0
  102. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/parquet-writer.d.mts +2 -0
  103. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/schema.d.mts +2 -0
  104. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/wkb.d.mts +1 -0
  105. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/write-rows.d.mts +1 -0
  106. package/dist/node_modules/.pnpm/hyparquet-writer@0.16.1_patch_hash_7a5e451ac7634d7546ac56bcc5eadacf7715a6241640c2b5a5bc0cfc9763b8ec/node_modules/hyparquet-writer/types/write.d.mts +1 -0
  107. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/assemble.mjs +3 -0
  108. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/bloom.mjs +69 -0
  109. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/column.mjs +8 -0
  110. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/constants.mjs +80 -0
  111. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/convert.mjs +3 -0
  112. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/datapage.mjs +6 -0
  113. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/delta.mjs +2 -0
  114. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/encoding.mjs +2 -0
  115. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/filter.mjs +3 -0
  116. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/geoparquet.mjs +1 -0
  117. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/index.mjs +7 -0
  118. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/indexes.mjs +5 -0
  119. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/metadata.mjs +7 -0
  120. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/node.mjs +3 -0
  121. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/plain.mjs +1 -0
  122. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/plan.mjs +5 -0
  123. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/query.mjs +3 -0
  124. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/read.mjs +6 -0
  125. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/rowgroup.mjs +7 -0
  126. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/schema.mjs +54 -0
  127. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/snappy.mjs +1 -0
  128. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/thrift.mjs +1 -0
  129. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/types.d.mts +1 -0
  130. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/utils.mjs +19 -0
  131. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/variant.mjs +3 -0
  132. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/wkb.mjs +1 -0
  133. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/src/xxhash.mjs +68 -0
  134. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/index.d.mts +7 -0
  135. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/indexes.d.mts +1 -0
  136. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/metadata.d.mts +1 -0
  137. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/node.d.mts +2 -0
  138. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/query.d.mts +1 -0
  139. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/read.d.mts +1 -0
  140. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/snappy.d.mts +1 -0
  141. package/dist/node_modules/.pnpm/hyparquet@1.26.1/node_modules/hyparquet/types/utils.d.mts +1 -0
  142. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/assemble.mjs +144 -0
  143. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/bloom.mjs +124 -0
  144. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/column.mjs +127 -0
  145. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/constants.mjs +75 -0
  146. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/convert.mjs +118 -0
  147. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/datapage.mjs +144 -0
  148. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/delta.mjs +65 -0
  149. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/encoding.mjs +76 -0
  150. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/filter.mjs +98 -0
  151. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/geoparquet.mjs +24 -0
  152. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/index.mjs +7 -0
  153. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/indexes.mjs +16 -0
  154. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/metadata.mjs +235 -0
  155. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/node.mjs +7 -0
  156. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/plain.mjs +78 -0
  157. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/plan.mjs +147 -0
  158. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/query.mjs +3 -0
  159. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/read.mjs +106 -0
  160. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/rowgroup.mjs +154 -0
  161. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/schema.mjs +75 -0
  162. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/snappy.mjs +70 -0
  163. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/thrift.mjs +86 -0
  164. package/dist/{_chunks/libs/hyparquet.d.mts → node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/types.d.mts} +6 -8
  165. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/utils.mjs +31 -0
  166. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/variant.mjs +225 -0
  167. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/wkb.mjs +94 -0
  168. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/src/xxhash.mjs +68 -0
  169. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/index.d.mts +10 -0
  170. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/indexes.d.mts +1 -0
  171. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/metadata.d.mts +1 -0
  172. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/node.d.mts +3 -0
  173. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/query.d.mts +1 -0
  174. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/read.d.mts +1 -0
  175. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/snappy.d.mts +1 -0
  176. package/dist/node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/utils.d.mts +1 -0
  177. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.metadata.mjs +1 -0
  178. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.read.mjs +4 -0
  179. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/avro/avro.write.mjs +2 -0
  180. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/file.mjs +1 -0
  181. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/loadTable.mjs +3 -0
  182. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/catalog/rest.mjs +73 -0
  183. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/create.mjs +67 -0
  184. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/delete.mjs +2 -0
  185. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/fetch.mjs +8 -0
  186. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/index.mjs +13 -0
  187. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/json.mjs +147 -0
  188. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/manifest.mjs +2 -0
  189. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/metadata.mjs +3 -0
  190. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/prune.mjs +4 -0
  191. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/deletion-vector.mjs +2 -0
  192. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/puffin.mjs +2 -0
  193. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/puffin/roaring.mjs +1 -0
  194. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/read.mjs +9 -0
  195. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/s3.mjs +3 -0
  196. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/schema.mjs +76 -0
  197. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sigv4.mjs +2 -0
  198. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/icebergDataSource.mjs +8 -0
  199. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/icebergQuery.mjs +5 -0
  200. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/sql/whereFilter.mjs +1 -0
  201. package/dist/{_chunks/libs/icebird.d.mts → node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/types.d.mts} +5 -33
  202. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/utils.mjs +8 -0
  203. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/commit.mjs +5 -0
  204. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/conversions.mjs +19 -0
  205. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/delete-file.mjs +3 -0
  206. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/geospatial.mjs +1 -0
  207. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/manifest-list.mjs +2 -0
  208. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/manifest.mjs +3 -0
  209. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/parquet.mjs +5 -0
  210. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/partition.mjs +75 -0
  211. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/rewrite.mjs +10 -0
  212. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/serde.mjs +2 -0
  213. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/snapshot.mjs +5 -0
  214. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/sort.mjs +3 -0
  215. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage-deletion-vector.mjs +11 -0
  216. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage-position-delete.mjs +8 -0
  217. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stage.mjs +10 -0
  218. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/stats.mjs +4 -0
  219. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/transform.mjs +60 -0
  220. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/src/write/write.mjs +45 -0
  221. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/catalog/file.d.mts +1 -0
  222. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/catalog/rest.d.mts +1 -0
  223. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/create.d.mts +1 -0
  224. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/fetch.d.mts +1 -0
  225. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/index.d.mts +13 -0
  226. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/manifest.d.mts +1 -0
  227. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/metadata.d.mts +1 -0
  228. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/read.d.mts +2 -0
  229. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/s3.d.mts +1 -0
  230. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/sql/icebergDataSource.d.mts +2 -0
  231. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/sql/icebergQuery.d.mts +2 -0
  232. package/dist/node_modules/.pnpm/icebird@0.8.15_patch_hash_d1902372376af18885e7c7dce807f1ecab86c2f86a9d1ff65d51e3b63b64b057/node_modules/icebird/types/write/write.d.mts +32 -0
  233. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/ast.d.mts +1 -0
  234. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/backend/dataSource.mjs +1 -0
  235. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/accumulator.mjs +2 -0
  236. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/aggregates.mjs +10 -0
  237. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/execute.mjs +15 -0
  238. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/join.mjs +5 -0
  239. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/scanColumn.mjs +1 -0
  240. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/sort.mjs +5 -0
  241. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/streamingAggregate.mjs +9 -0
  242. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/utils.mjs +1 -0
  243. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/window.mjs +5 -0
  244. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/execute/yield.mjs +17 -0
  245. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/alias.mjs +1 -0
  246. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/binary.mjs +1 -0
  247. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/date.mjs +1 -0
  248. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/evaluate.mjs +15 -0
  249. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/math.mjs +1 -0
  250. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/regexp.mjs +2 -0
  251. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/expression/strings.mjs +3 -0
  252. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/index.d.mts +1 -0
  253. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/index.mjs +9 -0
  254. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/expression.mjs +6 -0
  255. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/extractTables.mjs +1 -0
  256. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/functions.mjs +5 -0
  257. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/joins.mjs +7 -0
  258. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/parse.mjs +10 -0
  259. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/primary.mjs +8 -0
  260. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/state.mjs +2 -0
  261. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/tokenize.mjs +3 -0
  262. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/parse/types.d.mts +1 -0
  263. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/columns.mjs +3 -0
  264. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/plan.mjs +7 -0
  265. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/plan/types.d.mts +1 -0
  266. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/bbox.mjs +2 -0
  267. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/equality.mjs +2 -0
  268. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/operations.mjs +5 -0
  269. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/pointRelations.mjs +2 -0
  270. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/primitives.mjs +2 -0
  271. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/segments.mjs +2 -0
  272. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/spatial.mjs +6 -0
  273. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/spatial/wkt.mjs +1 -0
  274. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/types.d.mts +3 -0
  275. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/aggregates.mjs +3 -0
  276. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/executionErrors.mjs +2 -0
  277. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/functions.mjs +2 -0
  278. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/keywords.mjs +1 -0
  279. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/parseErrors.mjs +2 -0
  280. package/dist/node_modules/.pnpm/squirreling@0.15.0/node_modules/squirreling/src/validation/tables.mjs +2 -0
  281. package/dist/parquet-plan.d.mts +15 -0
  282. package/dist/parquet-plan.mjs +139 -0
  283. package/dist/parquet-pushdown.mjs +58 -0
  284. package/dist/period/index.d.mts +52 -1
  285. package/dist/planner.d.mts +2 -14
  286. package/dist/planner.mjs +2 -1
  287. package/dist/profile.d.mts +21 -0
  288. package/dist/profile.mjs +27 -0
  289. package/dist/query-dim.d.mts +54 -0
  290. package/dist/query-dim.mjs +91 -0
  291. package/dist/report/define.d.mts +8 -0
  292. package/dist/report/define.mjs +15 -0
  293. package/dist/report/hash.d.mts +13 -0
  294. package/dist/report/hash.mjs +29 -0
  295. package/dist/report/index.d.mts +4 -170
  296. package/dist/report/index.mjs +3 -55
  297. package/dist/report/registry.d.mts +18 -0
  298. package/dist/report/registry.mjs +14 -0
  299. package/dist/report/types.d.mts +139 -0
  300. package/dist/resolver/adapter.d.mts +13 -0
  301. package/dist/resolver/adapter.mjs +27 -0
  302. package/dist/resolver/canonical-source.d.mts +5 -0
  303. package/dist/resolver/canonical-source.mjs +14 -0
  304. package/dist/resolver/compile.d.mts +15 -0
  305. package/dist/resolver/compile.mjs +396 -0
  306. package/dist/resolver/datasets.d.mts +16 -0
  307. package/dist/resolver/datasets.mjs +159 -0
  308. package/dist/resolver/extras-overlay.d.mts +37 -0
  309. package/dist/resolver/extras-overlay.mjs +17 -0
  310. package/dist/resolver/filter-utils.d.mts +10 -0
  311. package/dist/resolver/filter-utils.mjs +59 -0
  312. package/dist/resolver/fragments.d.mts +60 -0
  313. package/dist/resolver/fragments.mjs +206 -0
  314. package/dist/resolver/index.d.mts +11 -371
  315. package/dist/resolver/index.mjs +10 -1
  316. package/dist/resolver/pg-adapter.d.mts +56 -0
  317. package/dist/resolver/pg-adapter.mjs +110 -0
  318. package/dist/resolver/run-query.d.mts +172 -0
  319. package/dist/resolver/run-query.mjs +241 -0
  320. package/dist/resolver/schema-drift.d.mts +15 -0
  321. package/dist/resolver/schema-drift.mjs +12 -0
  322. package/dist/rollups.d.mts +4 -4
  323. package/dist/rollups.mjs +3 -2
  324. package/dist/schedule.mjs +100 -0
  325. package/dist/schema.d.mts +34 -1
  326. package/dist/schema.mjs +78 -1
  327. package/dist/sink-node.d.mts +1 -159
  328. package/dist/sink-node.mjs +1 -133
  329. package/dist/sink.d.mts +125 -0
  330. package/dist/sinks/in-memory-sink.d.mts +25 -0
  331. package/dist/sinks/in-memory-sink.mjs +61 -0
  332. package/dist/sinks/index.d.mts +2 -0
  333. package/dist/sinks/index.mjs +2 -0
  334. package/dist/snapshot.d.mts +14 -0
  335. package/dist/source/attached-table.d.mts +45 -0
  336. package/dist/source/attached-table.mjs +55 -0
  337. package/dist/source/create-sql-query-source.d.mts +24 -0
  338. package/dist/source/create-sql-query-source.mjs +28 -0
  339. package/dist/source/index.d.mts +6 -66
  340. package/dist/source/index.mjs +9 -82
  341. package/dist/source/source-types.d.mts +49 -0
  342. package/dist/{_chunks/storage.d.mts → storage.d.mts} +4 -14
  343. package/dist/sync-config.d.mts +36 -0
  344. package/dist/sync-config.mjs +98 -0
  345. package/dist/vendor/hysnappy-purejs.mjs +12 -1
  346. package/package.json +4 -4
  347. package/dist/_chunks/analysis-types.d.mts +0 -57
  348. package/dist/_chunks/contracts.d.mts +0 -1
  349. package/dist/_chunks/engine.mjs +0 -731
  350. package/dist/_chunks/entities.mjs +0 -967
  351. package/dist/_chunks/errors.d.mts +0 -115
  352. package/dist/_chunks/index.d.mts +0 -53
  353. package/dist/_chunks/libs/hyparquet-compressors.mjs +0 -2796
  354. package/dist/_chunks/libs/hyparquet-writer.mjs +0 -2524
  355. package/dist/_chunks/libs/hyparquet.mjs +0 -2596
  356. package/dist/_chunks/libs/icebird.mjs +0 -564
  357. package/dist/_chunks/registry.d.mts +0 -213
  358. package/dist/_chunks/resolver.mjs +0 -1220
  359. package/dist/_chunks/sink.d.mts +0 -257
  360. /package/dist/{_chunks → analyzer}/dispatch.mjs +0 -0
  361. /package/dist/{_chunks/coerce.mjs → coerce.mjs} +0 -0
  362. /package/dist/{_chunks/layout.mjs → layout.mjs} +0 -0
  363. /package/dist/{_chunks/manifest-store-utils.mjs → manifest-store-utils.mjs} +0 -0
  364. /package/dist/{_chunks/libs/fzstd.mjs → node_modules/.pnpm/fzstd@0.1.1/node_modules/fzstd/esm/index.mjs} +0 -0
  365. /package/dist/{_chunks → resolver}/types.d.mts +0 -0
  366. /package/dist/{_chunks/schedule.d.mts → schedule.d.mts} +0 -0
package/dist/entities.mjs CHANGED
@@ -1,4 +1,869 @@
1
1
  import { emptyTypesKey, hashSortedUrlList, hashUrl, hashUrlList, indexingMetadataIndexKey, inspectionBaseKey, inspectionEventKey, inspectionEventsPrefix, inspectionHistoryPrefix, inspectionHistoryShardKey, inspectionIndexKey, inspectionParquetKey, queryDimMetaKey, queryDimParquetKey, sitemapHistoryKey, sitemapIndexKey, sitemapUrlsDeltaKey, sitemapUrlsIndexKey, sitemapUrlsIndexPrefix, sitemapUrlsPrefix } from "./entity-keys.mjs";
2
- import "./adapters/hyparquet.mjs";
3
- import { INSPECTION_HISTORY_MAX_BYTES, buildQueryDimRecords, createEmptyTypesStore, createIndexingMetadataStore, createInspectionStore, createQueryDimStore, createSitemapStore } from "./_chunks/entities.mjs";
2
+ import { decodeParquetToRows, encodeRowsToParquetFlex } from "./adapters/hyparquet.mjs";
3
+ import { readOptional } from "./adapters/read-optional.mjs";
4
+ import { buildQueryDimRecords, createQueryDimStore } from "./query-dim.mjs";
5
+ import { encodeJsonBigintSafe } from "@gscdump/lakehouse/bigint";
6
+ const YEAR_MONTH_RE = /^(\d{4})-(\d{2})-/;
7
+ const ENTITY_IO_CONCURRENCY = 8;
8
+ async function mapEntityIo(items, fn) {
9
+ if (items.length === 0) return [];
10
+ const results = Array.from({ length: items.length }, () => void 0);
11
+ let next = 0;
12
+ async function worker() {
13
+ while (true) {
14
+ const index = next++;
15
+ if (index >= items.length) return;
16
+ results[index] = await fn(items[index], index);
17
+ }
18
+ }
19
+ await Promise.all(Array.from({ length: Math.min(ENTITY_IO_CONCURRENCY, items.length) }, worker));
20
+ return results;
21
+ }
22
+ const INSPECTION_EVENT_KEY_RE = /\/inspections\/events\/\d{4}-\d{2}\/[^/]+\.parquet$/;
23
+ const INSPECTION_HISTORY_MAX_BYTES = 5 * 1024 * 1024;
24
+ const INSPECTION_PARQUET_COLUMNS = [
25
+ {
26
+ name: "urlHash",
27
+ type: "VARCHAR",
28
+ nullable: false
29
+ },
30
+ {
31
+ name: "url",
32
+ type: "VARCHAR",
33
+ nullable: false
34
+ },
35
+ {
36
+ name: "inspectedAt",
37
+ type: "VARCHAR",
38
+ nullable: false
39
+ },
40
+ {
41
+ name: "indexStatus",
42
+ type: "VARCHAR",
43
+ nullable: true
44
+ },
45
+ {
46
+ name: "lastCrawlTime",
47
+ type: "VARCHAR",
48
+ nullable: true
49
+ },
50
+ {
51
+ name: "googleCanonical",
52
+ type: "VARCHAR",
53
+ nullable: true
54
+ },
55
+ {
56
+ name: "userCanonical",
57
+ type: "VARCHAR",
58
+ nullable: true
59
+ },
60
+ {
61
+ name: "coverageState",
62
+ type: "VARCHAR",
63
+ nullable: true
64
+ },
65
+ {
66
+ name: "robotsTxtState",
67
+ type: "VARCHAR",
68
+ nullable: true
69
+ },
70
+ {
71
+ name: "indexingState",
72
+ type: "VARCHAR",
73
+ nullable: true
74
+ },
75
+ {
76
+ name: "pageFetchState",
77
+ type: "VARCHAR",
78
+ nullable: true
79
+ },
80
+ {
81
+ name: "mobileUsabilityVerdict",
82
+ type: "VARCHAR",
83
+ nullable: true
84
+ },
85
+ {
86
+ name: "richResultsVerdict",
87
+ type: "VARCHAR",
88
+ nullable: true
89
+ },
90
+ {
91
+ name: "scheduleNextAt",
92
+ type: "BIGINT",
93
+ nullable: true
94
+ },
95
+ {
96
+ name: "scheduleConsecutiveUnchanged",
97
+ type: "INTEGER",
98
+ nullable: true
99
+ },
100
+ {
101
+ name: "schedulePolicyVersion",
102
+ type: "INTEGER",
103
+ nullable: true
104
+ }
105
+ ];
106
+ const INSPECTION_EVENT_COLUMNS = [
107
+ ...INSPECTION_PARQUET_COLUMNS,
108
+ {
109
+ name: "crawlingUserAgent",
110
+ type: "VARCHAR",
111
+ nullable: true
112
+ },
113
+ {
114
+ name: "richResultsItems",
115
+ type: "VARCHAR",
116
+ nullable: true
117
+ },
118
+ {
119
+ name: "sitemaps",
120
+ type: "VARCHAR",
121
+ nullable: true
122
+ },
123
+ {
124
+ name: "referringUrls",
125
+ type: "VARCHAR",
126
+ nullable: true
127
+ },
128
+ {
129
+ name: "mobileIssues",
130
+ type: "VARCHAR",
131
+ nullable: true
132
+ },
133
+ {
134
+ name: "inspectionResultLink",
135
+ type: "VARCHAR",
136
+ nullable: true
137
+ },
138
+ {
139
+ name: "firstCheckedAt",
140
+ type: "VARCHAR",
141
+ nullable: true
142
+ },
143
+ {
144
+ name: "checkCount",
145
+ type: "INTEGER",
146
+ nullable: true
147
+ },
148
+ {
149
+ name: "nextCheckAfter",
150
+ type: "BIGINT",
151
+ nullable: true
152
+ },
153
+ {
154
+ name: "nextCheckPriority",
155
+ type: "VARCHAR",
156
+ nullable: true
157
+ }
158
+ ];
159
+ function createInspectionStore(opts) {
160
+ const ds = opts.dataSource;
161
+ function shardFor(record) {
162
+ const m = YEAR_MONTH_RE.exec(record.inspectedAt);
163
+ return m ? `${m[1]}-${m[2]}` : "unknown";
164
+ }
165
+ function randomBatchId() {
166
+ return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
167
+ }
168
+ return {
169
+ async appendHistory(ctx, records, options) {
170
+ if (records.length === 0) return;
171
+ const batchId = options?.batchId ?? randomBatchId();
172
+ const byMonth = /* @__PURE__ */ new Map();
173
+ for (const r of records) {
174
+ const month = shardFor(r);
175
+ if (!byMonth.has(month)) byMonth.set(month, []);
176
+ byMonth.get(month).push(r);
177
+ }
178
+ await mapEntityIo([...byMonth].map(([yearMonth, batch]) => {
179
+ const bytes = encodeJsonBigintSafe({
180
+ version: 1,
181
+ records: batch
182
+ });
183
+ if (bytes.byteLength > 5242880) throw new Error(`inspection history shard exceeds ${INSPECTION_HISTORY_MAX_BYTES} bytes (got ${bytes.byteLength}); split the batch`);
184
+ return {
185
+ key: inspectionHistoryShardKey(ctx, yearMonth, batchId),
186
+ bytes
187
+ };
188
+ }), (shard) => ds.write(shard.key, shard.bytes));
189
+ },
190
+ async loadHistory(ctx, yearMonth) {
191
+ const keys = await ds.list(inspectionHistoryPrefix(ctx, yearMonth));
192
+ if (keys.length === 0) return void 0;
193
+ return {
194
+ version: 1,
195
+ records: (await mapEntityIo(keys, async (key) => {
196
+ const bytes = await readOptional(ds, key);
197
+ if (!bytes) return [];
198
+ return (await Promise.resolve().then(() => JSON.parse(new TextDecoder().decode(bytes))).catch((err) => {
199
+ console.warn("[inspection.loadHistory] failed to decode shard", {
200
+ key,
201
+ error: err.message
202
+ });
203
+ }))?.records ?? [];
204
+ })).flat()
205
+ };
206
+ },
207
+ async materialize(ctx, rowIter) {
208
+ const rows = Array.from(rowIter);
209
+ rows.sort((a, b) => a.urlHash < b.urlHash ? -1 : a.urlHash > b.urlHash ? 1 : 0);
210
+ const bytes = encodeRowsToParquetFlex(rows, {
211
+ columns: INSPECTION_PARQUET_COLUMNS,
212
+ sortKey: ["urlHash"]
213
+ });
214
+ const key = inspectionParquetKey(ctx);
215
+ await ds.write(key, bytes);
216
+ return {
217
+ key,
218
+ rowCount: rows.length,
219
+ bytes: bytes.byteLength
220
+ };
221
+ },
222
+ async appendInspectionEvents(ctx, rows, options) {
223
+ if (rows.length === 0) return {
224
+ keys: [],
225
+ rowCount: 0
226
+ };
227
+ const batchId = options?.batchId ?? randomBatchId();
228
+ const byMonth = /* @__PURE__ */ new Map();
229
+ for (const r of rows) {
230
+ const m = YEAR_MONTH_RE.exec(r.inspectedAt);
231
+ const month = m ? `${m[1]}-${m[2]}` : "unknown";
232
+ const bucket = byMonth.get(month) ?? [];
233
+ bucket.push(r);
234
+ byMonth.set(month, bucket);
235
+ }
236
+ const files = [...byMonth].map(([month, batch]) => {
237
+ const bytes = encodeRowsToParquetFlex(batch, {
238
+ columns: INSPECTION_EVENT_COLUMNS,
239
+ sortKey: ["urlHash"]
240
+ });
241
+ return {
242
+ key: inspectionEventKey(ctx, month, batchId),
243
+ bytes
244
+ };
245
+ });
246
+ await mapEntityIo(files, (file) => ds.write(file.key, file.bytes));
247
+ return {
248
+ keys: files.map((file) => file.key),
249
+ rowCount: rows.length
250
+ };
251
+ },
252
+ async compactInspections(ctx) {
253
+ const eventKeys = (await ds.list(`${inspectionEventsPrefix(ctx)}/`)).filter((k) => INSPECTION_EVENT_KEY_RE.test(k));
254
+ if (eventKeys.length === 0) return {
255
+ baseRowCount: 0,
256
+ eventsFolded: 0,
257
+ eventFilesDeleted: 0
258
+ };
259
+ const baseKey = inspectionBaseKey(ctx);
260
+ const baseBytes = await readOptional(ds, baseKey);
261
+ const baseRows = baseBytes ? await decodeParquetToRows(baseBytes) : [];
262
+ const latest = /* @__PURE__ */ new Map();
263
+ const earliestChecked = /* @__PURE__ */ new Map();
264
+ const consider = (row) => {
265
+ const h = String(row.urlHash);
266
+ const prev = latest.get(h);
267
+ if (!prev || String(row.inspectedAt ?? "") > String(prev.inspectedAt ?? "")) latest.set(h, row);
268
+ const fc = row.firstCheckedAt;
269
+ if (fc != null) {
270
+ const fcStr = String(fc);
271
+ const cur = earliestChecked.get(h);
272
+ if (cur === void 0 || fcStr < cur) earliestChecked.set(h, fcStr);
273
+ }
274
+ };
275
+ for (const row of baseRows) consider(row);
276
+ let eventsFolded = 0;
277
+ const consumed = [];
278
+ const eventFiles = await mapEntityIo(eventKeys.sort(), async (key) => {
279
+ const bytes = await readOptional(ds, key);
280
+ if (!bytes) return void 0;
281
+ return {
282
+ key,
283
+ rows: await decodeParquetToRows(bytes)
284
+ };
285
+ });
286
+ for (const file of eventFiles) {
287
+ if (!file) continue;
288
+ const { key, rows } = file;
289
+ consumed.push(key);
290
+ for (const row of rows) {
291
+ consider(row);
292
+ eventsFolded++;
293
+ }
294
+ }
295
+ const merged = [];
296
+ for (const [h, row] of latest) {
297
+ const fc = earliestChecked.get(h);
298
+ if (fc !== void 0) row.firstCheckedAt = fc;
299
+ merged.push(row);
300
+ }
301
+ const bytes = encodeRowsToParquetFlex(merged, {
302
+ columns: INSPECTION_EVENT_COLUMNS,
303
+ sortKey: ["urlHash"]
304
+ });
305
+ await ds.write(baseKey, bytes);
306
+ if (consumed.length > 0) await ds.delete(consumed);
307
+ return {
308
+ baseRowCount: merged.length,
309
+ eventsFolded,
310
+ eventFilesDeleted: consumed.length
311
+ };
312
+ },
313
+ parquetUri(ctx) {
314
+ return ds.uri?.(inspectionParquetKey(ctx));
315
+ }
316
+ };
317
+ }
318
+ const SITEMAP_URLS_DELTA_PREFIX_RE = /\/urls\/deltas\/(\d{4}-\d{2}-\d{2})__([0-9a-f]+)\.parquet$/;
319
+ const URLS_INDEX_COLUMNS = [
320
+ {
321
+ name: "feedpath",
322
+ type: "VARCHAR",
323
+ nullable: false
324
+ },
325
+ {
326
+ name: "feedpath_hash",
327
+ type: "VARCHAR",
328
+ nullable: false
329
+ },
330
+ {
331
+ name: "url_hash",
332
+ type: "VARCHAR",
333
+ nullable: false
334
+ },
335
+ {
336
+ name: "loc",
337
+ type: "VARCHAR",
338
+ nullable: false
339
+ },
340
+ {
341
+ name: "lastmod",
342
+ type: "VARCHAR",
343
+ nullable: true
344
+ },
345
+ {
346
+ name: "first_seen_at",
347
+ type: "BIGINT",
348
+ nullable: false
349
+ },
350
+ {
351
+ name: "last_seen_at",
352
+ type: "BIGINT",
353
+ nullable: false
354
+ },
355
+ {
356
+ name: "removed_at",
357
+ type: "BIGINT",
358
+ nullable: true
359
+ }
360
+ ];
361
+ const URLS_DELTA_COLUMNS = [
362
+ {
363
+ name: "feedpath",
364
+ type: "VARCHAR",
365
+ nullable: false
366
+ },
367
+ {
368
+ name: "feedpath_hash",
369
+ type: "VARCHAR",
370
+ nullable: false
371
+ },
372
+ {
373
+ name: "url_hash",
374
+ type: "VARCHAR",
375
+ nullable: false
376
+ },
377
+ {
378
+ name: "op",
379
+ type: "VARCHAR",
380
+ nullable: false
381
+ },
382
+ {
383
+ name: "loc",
384
+ type: "VARCHAR",
385
+ nullable: false
386
+ },
387
+ {
388
+ name: "lastmod",
389
+ type: "VARCHAR",
390
+ nullable: true
391
+ },
392
+ {
393
+ name: "at",
394
+ type: "BIGINT",
395
+ nullable: false
396
+ }
397
+ ];
398
+ function rowToUrlRecord(row) {
399
+ return {
400
+ feedpath: String(row.feedpath),
401
+ feedpathHash: String(row.feedpath_hash),
402
+ urlHash: String(row.url_hash),
403
+ loc: String(row.loc),
404
+ lastmod: row.lastmod == null ? void 0 : String(row.lastmod),
405
+ firstSeenAt: Number(row.first_seen_at),
406
+ lastSeenAt: Number(row.last_seen_at),
407
+ removedAt: row.removed_at == null ? void 0 : Number(row.removed_at)
408
+ };
409
+ }
410
+ function urlRecordToRow(r) {
411
+ return {
412
+ feedpath: r.feedpath,
413
+ feedpath_hash: r.feedpathHash,
414
+ url_hash: r.urlHash,
415
+ loc: r.loc,
416
+ lastmod: r.lastmod ?? null,
417
+ first_seen_at: r.firstSeenAt,
418
+ last_seen_at: r.lastSeenAt,
419
+ removed_at: r.removedAt ?? null
420
+ };
421
+ }
422
+ function isoDate(ms) {
423
+ return new Date(ms).toISOString().slice(0, 10);
424
+ }
425
+ function createSitemapStore(opts) {
426
+ const ds = opts.dataSource;
427
+ const hash = opts.hash ?? hashUrl;
428
+ const now = opts.now ?? (() => Date.now());
429
+ async function readJson(key) {
430
+ const bytes = await readOptional(ds, key);
431
+ if (bytes === void 0) return void 0;
432
+ return JSON.parse(new TextDecoder().decode(bytes));
433
+ }
434
+ async function writeJson(key, value) {
435
+ await ds.write(key, encodeJsonBigintSafe(value));
436
+ }
437
+ return {
438
+ async writeSnapshot(ctx, records) {
439
+ if (records.length === 0) return;
440
+ const indexKey = sitemapIndexKey(ctx);
441
+ const index = await readJson(indexKey) ?? {
442
+ version: 1,
443
+ records: {}
444
+ };
445
+ const stamp = now();
446
+ const historyDocs = /* @__PURE__ */ new Map();
447
+ for (const r of records) {
448
+ const h = hash(r.path);
449
+ index.records[h] = r;
450
+ historyDocs.set(sitemapHistoryKey(ctx, h, stamp), {
451
+ version: 1,
452
+ path: r.path,
453
+ capturedAt: r.capturedAt,
454
+ record: r
455
+ });
456
+ }
457
+ await mapEntityIo([...historyDocs], ([key, doc]) => writeJson(key, doc));
458
+ await writeJson(indexKey, index);
459
+ },
460
+ async loadIndex(ctx) {
461
+ return await readJson(sitemapIndexKey(ctx)) ?? {
462
+ version: 1,
463
+ records: {}
464
+ };
465
+ },
466
+ async getLatest(ctx, path) {
467
+ return (await readJson(sitemapIndexKey(ctx)))?.records[hash(path)];
468
+ },
469
+ async snapshotUrls(ctx, feedpath, urls) {
470
+ const fpHash = hash(feedpath);
471
+ const contentHash = hashUrlList(urls);
472
+ const at = now();
473
+ const priorByHash = /* @__PURE__ */ new Map();
474
+ for await (const rec of this.loadUrls(ctx, feedpath, { includeRemoved: true })) priorByHash.set(rec.urlHash, rec);
475
+ const livePrior = Array.from(priorByHash.values()).filter((r) => r.removedAt == null);
476
+ if (livePrior.length > 0) {
477
+ if (hashSortedUrlList(livePrior.map((r) => String(r.loc)).sort()) === contentHash) return {
478
+ added: 0,
479
+ removed: 0,
480
+ kept: livePrior.length,
481
+ contentHash,
482
+ unchanged: true
483
+ };
484
+ }
485
+ const incomingByHash = /* @__PURE__ */ new Map();
486
+ for (const u of urls) incomingByHash.set(hash(u.loc), u);
487
+ const deltaRows = [];
488
+ let added = 0;
489
+ let removed = 0;
490
+ let kept = 0;
491
+ const date = isoDate(at);
492
+ for (const [urlHash, u] of incomingByHash) {
493
+ const prev = priorByHash.get(urlHash);
494
+ if (!prev || prev.removedAt != null) {
495
+ added++;
496
+ deltaRows.push({
497
+ feedpath,
498
+ feedpath_hash: fpHash,
499
+ url_hash: urlHash,
500
+ op: "added",
501
+ loc: u.loc,
502
+ lastmod: u.lastmod ?? null,
503
+ at
504
+ });
505
+ } else kept++;
506
+ }
507
+ for (const [urlHash, prev] of priorByHash) {
508
+ if (prev.removedAt != null) continue;
509
+ if (!incomingByHash.has(urlHash)) {
510
+ removed++;
511
+ deltaRows.push({
512
+ feedpath,
513
+ feedpath_hash: fpHash,
514
+ url_hash: urlHash,
515
+ op: "removed",
516
+ loc: prev.loc,
517
+ lastmod: prev.lastmod ?? null,
518
+ at
519
+ });
520
+ }
521
+ }
522
+ if (deltaRows.length > 0) {
523
+ const bytes = encodeRowsToParquetFlex(deltaRows, {
524
+ columns: URLS_DELTA_COLUMNS,
525
+ sortKey: ["url_hash"]
526
+ });
527
+ await ds.write(sitemapUrlsDeltaKey(ctx, fpHash, date), bytes);
528
+ }
529
+ return {
530
+ added,
531
+ removed,
532
+ kept,
533
+ contentHash,
534
+ unchanged: false
535
+ };
536
+ },
537
+ async *loadUrls(ctx, feedpath, opts) {
538
+ const fpHash = hash(feedpath);
539
+ const includeRemoved = opts?.includeRemoved ?? false;
540
+ const [indexRows, listedDeltaKeys] = await Promise.all([readOptional(ds, sitemapUrlsIndexKey(ctx, fpHash)).then((bytes) => bytes ? decodeParquetToRows(bytes) : []), ds.list(`${sitemapUrlsPrefix(ctx)}/deltas/`)]);
541
+ const deltaKeys = listedDeltaKeys.filter((key) => {
542
+ return SITEMAP_URLS_DELTA_PREFIX_RE.exec(key)?.[2] === fpHash;
543
+ }).sort();
544
+ const live = /* @__PURE__ */ new Map();
545
+ const removedMap = /* @__PURE__ */ new Map();
546
+ for (const row of indexRows) {
547
+ const rec = rowToUrlRecord(row);
548
+ if (rec.removedAt != null) removedMap.set(rec.urlHash, rec);
549
+ else live.set(rec.urlHash, rec);
550
+ }
551
+ const deltas = await mapEntityIo(deltaKeys, async (key) => {
552
+ const dBytes = await readOptional(ds, key);
553
+ if (!dBytes) return [];
554
+ return decodeParquetToRows(dBytes);
555
+ });
556
+ for (const dRows of deltas) for (const r of dRows) {
557
+ const op = String(r.op);
558
+ const urlHash = String(r.url_hash);
559
+ const at = Number(r.at);
560
+ if (op === "added") {
561
+ const prev = live.get(urlHash) ?? removedMap.get(urlHash);
562
+ removedMap.delete(urlHash);
563
+ live.set(urlHash, {
564
+ feedpath,
565
+ feedpathHash: fpHash,
566
+ urlHash,
567
+ loc: String(r.loc),
568
+ lastmod: r.lastmod == null ? void 0 : String(r.lastmod),
569
+ firstSeenAt: prev?.firstSeenAt ?? at,
570
+ lastSeenAt: at
571
+ });
572
+ } else if (op === "removed") {
573
+ const prev = live.get(urlHash);
574
+ live.delete(urlHash);
575
+ if (prev) removedMap.set(urlHash, {
576
+ ...prev,
577
+ removedAt: at
578
+ });
579
+ }
580
+ }
581
+ for (const rec of live.values()) yield rec;
582
+ if (includeRemoved) for (const rec of removedMap.values()) yield rec;
583
+ },
584
+ async *loadDeltas(ctx, dateRange) {
585
+ const from = dateRange?.from;
586
+ const to = dateRange?.to;
587
+ const keys = (await ds.list(`${sitemapUrlsPrefix(ctx)}/deltas/`)).sort();
588
+ for (const key of keys) {
589
+ const m = SITEMAP_URLS_DELTA_PREFIX_RE.exec(key);
590
+ if (!m) continue;
591
+ const date = m[1];
592
+ if (!date) continue;
593
+ if (from && date < from) continue;
594
+ if (to && date > to) continue;
595
+ const bytes = await readOptional(ds, key);
596
+ if (!bytes) continue;
597
+ const rows = await decodeParquetToRows(bytes);
598
+ for (const r of rows) {
599
+ const op = String(r.op);
600
+ if (op !== "added" && op !== "removed") continue;
601
+ yield {
602
+ feedpath: String(r.feedpath),
603
+ feedpathHash: String(r.feedpath_hash),
604
+ urlHash: String(r.url_hash),
605
+ op,
606
+ loc: String(r.loc),
607
+ lastmod: r.lastmod == null ? void 0 : String(r.lastmod),
608
+ at: Number(r.at)
609
+ };
610
+ }
611
+ }
612
+ },
613
+ async compactUrls(ctx, opts = {}) {
614
+ const startedAt = now();
615
+ const deadlineMs = opts.deadlineMs ?? Number.POSITIVE_INFINITY;
616
+ const maxFeedpaths = opts.maxFeedpaths ?? Number.POSITIVE_INFINITY;
617
+ const deltaKeys = await ds.list(`${sitemapUrlsPrefix(ctx)}/deltas/`);
618
+ const deltasByFeed = /* @__PURE__ */ new Map();
619
+ for (const key of deltaKeys) {
620
+ const m = SITEMAP_URLS_DELTA_PREFIX_RE.exec(key);
621
+ if (!m) continue;
622
+ const feedpathHash = m[2];
623
+ if (!feedpathHash) continue;
624
+ const list = deltasByFeed.get(feedpathHash) ?? [];
625
+ list.push(key);
626
+ deltasByFeed.set(feedpathHash, list);
627
+ }
628
+ const totalFeedpaths = deltasByFeed.size;
629
+ let compactedFeedpaths = 0;
630
+ for (const [fpHash, feedDeltaKeys] of deltasByFeed) {
631
+ if (compactedFeedpaths > 0 && (compactedFeedpaths >= maxFeedpaths || now() - startedAt >= deadlineMs)) break;
632
+ const indexKey = sitemapUrlsIndexKey(ctx, fpHash);
633
+ const [indexRows, deltaFiles] = await Promise.all([readOptional(ds, indexKey).then((bytes) => bytes ? decodeParquetToRows(bytes) : []), mapEntityIo(feedDeltaKeys.sort(), async (key) => {
634
+ const bytes = await readOptional(ds, key);
635
+ if (!bytes) return void 0;
636
+ return {
637
+ key,
638
+ rows: await decodeParquetToRows(bytes)
639
+ };
640
+ })]);
641
+ const live = /* @__PURE__ */ new Map();
642
+ const removed = /* @__PURE__ */ new Map();
643
+ for (const row of indexRows) {
644
+ const rec = rowToUrlRecord(row);
645
+ if (rec.removedAt != null) removed.set(rec.urlHash, rec);
646
+ else live.set(rec.urlHash, rec);
647
+ }
648
+ const consumed = [];
649
+ for (const file of deltaFiles) {
650
+ if (!file) continue;
651
+ const { key, rows } = file;
652
+ consumed.push(key);
653
+ for (const r of rows) {
654
+ const urlHash = String(r.url_hash);
655
+ const at = Number(r.at);
656
+ const op = String(r.op);
657
+ if (op === "added") {
658
+ const prev = live.get(urlHash) ?? removed.get(urlHash);
659
+ removed.delete(urlHash);
660
+ live.set(urlHash, {
661
+ feedpath: String(r.feedpath),
662
+ feedpathHash: fpHash,
663
+ urlHash,
664
+ loc: String(r.loc),
665
+ lastmod: r.lastmod == null ? void 0 : String(r.lastmod),
666
+ firstSeenAt: prev?.firstSeenAt ?? at,
667
+ lastSeenAt: at
668
+ });
669
+ } else if (op === "removed") {
670
+ const prev = live.get(urlHash);
671
+ live.delete(urlHash);
672
+ if (prev) removed.set(urlHash, {
673
+ ...prev,
674
+ removedAt: at
675
+ });
676
+ }
677
+ }
678
+ }
679
+ const merged = [...live.values(), ...removed.values()];
680
+ merged.sort((a, b) => a.urlHash < b.urlHash ? -1 : a.urlHash > b.urlHash ? 1 : 0);
681
+ const bytes = encodeRowsToParquetFlex(merged.map(urlRecordToRow), {
682
+ columns: URLS_INDEX_COLUMNS,
683
+ sortKey: ["feedpath_hash", "url_hash"]
684
+ });
685
+ await ds.write(indexKey, bytes);
686
+ if (consumed.length > 0) await ds.delete(consumed);
687
+ compactedFeedpaths++;
688
+ }
689
+ return {
690
+ compactedFeedpaths,
691
+ remainingFeedpaths: totalFeedpaths - compactedFeedpaths
692
+ };
693
+ },
694
+ async reconcile(ctx, { liveFeedpaths, at: atOpt }) {
695
+ const at = atOpt ?? now();
696
+ const liveHashes = new Set(liveFeedpaths.map((fp) => hash(fp)));
697
+ const present = /* @__PURE__ */ new Set();
698
+ const [indexKeys, deltaKeys] = await Promise.all([ds.list(`${sitemapUrlsIndexPrefix(ctx)}/`), ds.list(`${sitemapUrlsPrefix(ctx)}/deltas/`)]);
699
+ for (const key of indexKeys) {
700
+ const m = /\/by-feed\/([0-9a-f]+)\/index\.parquet$/.exec(key);
701
+ if (m) present.add(m[1]);
702
+ }
703
+ const deltasByFeed = /* @__PURE__ */ new Map();
704
+ for (const key of deltaKeys) {
705
+ const m = SITEMAP_URLS_DELTA_PREFIX_RE.exec(key);
706
+ if (!m) continue;
707
+ present.add(m[2]);
708
+ const list = deltasByFeed.get(m[2]) ?? [];
709
+ list.push(key);
710
+ deltasByFeed.set(m[2], list);
711
+ }
712
+ let feedpathsPruned = 0;
713
+ let urlsRemoved = 0;
714
+ for (const fpHash of present) {
715
+ if (liveHashes.has(fpHash)) continue;
716
+ const indexKey = sitemapUrlsIndexKey(ctx, fpHash);
717
+ const [indexRows, deltaFiles] = await Promise.all([readOptional(ds, indexKey).then((bytes) => bytes ? decodeParquetToRows(bytes) : []), mapEntityIo((deltasByFeed.get(fpHash) ?? []).sort(), async (key) => {
718
+ const bytes = await readOptional(ds, key);
719
+ if (!bytes) return void 0;
720
+ return {
721
+ key,
722
+ rows: await decodeParquetToRows(bytes)
723
+ };
724
+ })]);
725
+ const live = /* @__PURE__ */ new Map();
726
+ const removed = /* @__PURE__ */ new Map();
727
+ for (const row of indexRows) {
728
+ const r = rowToUrlRecord(row);
729
+ if (r.removedAt != null) removed.set(r.urlHash, r);
730
+ else live.set(r.urlHash, r);
731
+ }
732
+ const consumed = [];
733
+ for (const file of deltaFiles) {
734
+ if (!file) continue;
735
+ const { key, rows } = file;
736
+ consumed.push(key);
737
+ for (const r of rows) {
738
+ const urlHash = String(r.url_hash);
739
+ const dat = Number(r.at);
740
+ if (String(r.op) === "added") {
741
+ const prev = live.get(urlHash) ?? removed.get(urlHash);
742
+ removed.delete(urlHash);
743
+ live.set(urlHash, {
744
+ feedpath: String(r.feedpath),
745
+ feedpathHash: fpHash,
746
+ urlHash,
747
+ loc: String(r.loc),
748
+ lastmod: r.lastmod == null ? void 0 : String(r.lastmod),
749
+ firstSeenAt: prev?.firstSeenAt ?? dat,
750
+ lastSeenAt: dat
751
+ });
752
+ } else if (String(r.op) === "removed") {
753
+ const prev = live.get(urlHash);
754
+ live.delete(urlHash);
755
+ if (prev) removed.set(urlHash, {
756
+ ...prev,
757
+ removedAt: dat
758
+ });
759
+ }
760
+ }
761
+ }
762
+ const hadLive = live.size > 0;
763
+ if (!hadLive && consumed.length === 0) continue;
764
+ for (const [urlHash, r] of live) {
765
+ removed.set(urlHash, {
766
+ ...r,
767
+ removedAt: at
768
+ });
769
+ urlsRemoved++;
770
+ }
771
+ const merged = [...removed.values()];
772
+ merged.sort((a, b) => a.urlHash < b.urlHash ? -1 : a.urlHash > b.urlHash ? 1 : 0);
773
+ const bytes = encodeRowsToParquetFlex(merged.map(urlRecordToRow), {
774
+ columns: URLS_INDEX_COLUMNS,
775
+ sortKey: ["feedpath_hash", "url_hash"]
776
+ });
777
+ await ds.write(indexKey, bytes);
778
+ if (consumed.length > 0) await ds.delete(consumed);
779
+ if (hadLive) feedpathsPruned++;
780
+ }
781
+ return {
782
+ feedpathsPruned,
783
+ urlsRemoved
784
+ };
785
+ }
786
+ };
787
+ }
788
+ function createIndexingMetadataStore(opts) {
789
+ const ds = opts.dataSource;
790
+ const hash = opts.hash ?? hashUrl;
791
+ async function readIndex(key) {
792
+ const bytes = await readOptional(ds, key);
793
+ if (bytes === void 0) return {
794
+ version: 1,
795
+ records: {}
796
+ };
797
+ return JSON.parse(new TextDecoder().decode(bytes));
798
+ }
799
+ return {
800
+ async writeBatch(ctx, records) {
801
+ if (records.length === 0) return;
802
+ const key = indexingMetadataIndexKey(ctx);
803
+ const index = await readIndex(key);
804
+ for (const r of records) index.records[hash(r.url)] = r;
805
+ await ds.write(key, encodeJsonBigintSafe(index));
806
+ },
807
+ async loadIndex(ctx) {
808
+ return readIndex(indexingMetadataIndexKey(ctx));
809
+ },
810
+ async getLatest(ctx, url) {
811
+ return (await readIndex(indexingMetadataIndexKey(ctx))).records[hash(url)];
812
+ }
813
+ };
814
+ }
815
+ function createEmptyTypesStore(opts) {
816
+ const ds = opts.dataSource;
817
+ const now = opts.now ?? (() => Date.now());
818
+ async function readDoc(key) {
819
+ const bytes = await readOptional(ds, key);
820
+ if (bytes === void 0) return {
821
+ version: 1,
822
+ emptyTypes: [],
823
+ markedAt: {}
824
+ };
825
+ return JSON.parse(new TextDecoder().decode(bytes));
826
+ }
827
+ async function writeDoc(key, doc) {
828
+ await ds.write(key, encodeJsonBigintSafe(doc));
829
+ }
830
+ return {
831
+ async load(ctx) {
832
+ return readDoc(emptyTypesKey(ctx));
833
+ },
834
+ async mark(ctx, types, at) {
835
+ if (types.length === 0) return readDoc(emptyTypesKey(ctx));
836
+ const key = emptyTypesKey(ctx);
837
+ const doc = await readDoc(key);
838
+ const stamp = at ?? now();
839
+ let changed = false;
840
+ for (const t of types) {
841
+ if (!doc.emptyTypes.includes(t)) {
842
+ doc.emptyTypes.push(t);
843
+ changed = true;
844
+ }
845
+ if (doc.markedAt[t] === void 0) {
846
+ doc.markedAt[t] = stamp;
847
+ changed = true;
848
+ }
849
+ }
850
+ if (changed) {
851
+ doc.emptyTypes.sort();
852
+ await writeDoc(key, doc);
853
+ }
854
+ return doc;
855
+ },
856
+ async clear(ctx, types) {
857
+ if (types.length === 0) return readDoc(emptyTypesKey(ctx));
858
+ const key = emptyTypesKey(ctx);
859
+ const doc = await readDoc(key);
860
+ const drop = new Set(types);
861
+ const before = doc.emptyTypes.length;
862
+ doc.emptyTypes = doc.emptyTypes.filter((t) => !drop.has(t));
863
+ for (const t of drop) delete doc.markedAt[t];
864
+ if (doc.emptyTypes.length !== before) await writeDoc(key, doc);
865
+ return doc;
866
+ }
867
+ };
868
+ }
4
869
  export { INSPECTION_HISTORY_MAX_BYTES, buildQueryDimRecords, createEmptyTypesStore, createIndexingMetadataStore, createInspectionStore, createQueryDimStore, createSitemapStore, emptyTypesKey, hashSortedUrlList, hashUrl, hashUrlList, indexingMetadataIndexKey, inspectionBaseKey, inspectionEventKey, inspectionEventsPrefix, inspectionHistoryPrefix, inspectionHistoryShardKey, inspectionIndexKey, inspectionParquetKey, queryDimMetaKey, queryDimParquetKey, sitemapHistoryKey, sitemapIndexKey, sitemapUrlsDeltaKey, sitemapUrlsIndexKey, sitemapUrlsIndexPrefix, sitemapUrlsPrefix };