@gscdump/lakehouse 7.6.0 → 7.7.0

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 (82) hide show
  1. package/README.md +68 -0
  2. package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/gzip.mjs +23 -10
  3. package/dist/_virtual/node_modules/.pnpm/icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471/node_modules/icebird/src/avro/avro.budget.mjs +115 -0
  4. package/dist/_virtual/node_modules/.pnpm/icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471/node_modules/icebird/src/avro/avro.metadata.mjs +97 -0
  5. package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/avro/avro.read.mjs +67 -26
  6. package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/fetch.mjs +37 -4
  7. package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/manifest.mjs +49 -27
  8. package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/read.mjs +2 -2
  9. package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/manifest.d.mts +18 -2
  10. package/dist/catalog.d.mts +4 -4
  11. package/dist/catalog.mjs +5 -5
  12. package/dist/dataset-runtime.mjs +2 -2
  13. package/dist/manifest-merge.mjs +6 -6
  14. package/dist/orphan-sweep.mjs +3 -3
  15. package/dist/unsafe-raw.d.mts +6 -6
  16. package/dist/unsafe-raw.mjs +5 -5
  17. package/package.json +1 -1
  18. package/dist/_virtual/node_modules/.pnpm/icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f/node_modules/icebird/src/avro/avro.metadata.mjs +0 -65
  19. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.bitreader.mjs +0 -0
  20. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.blocks.mjs +0 -0
  21. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.context.mjs +0 -0
  22. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.contextmap.mjs +0 -0
  23. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.dictionary.mjs +0 -0
  24. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.huffman.mjs +0 -0
  25. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.mjs +0 -0
  26. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.prefix.mjs +0 -0
  27. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.streams.mjs +0 -0
  28. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/brotli.transform.mjs +0 -0
  29. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/compressors.mjs +0 -0
  30. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/gzip.huffman.mjs +0 -0
  31. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/index.mjs +0 -0
  32. /package/dist/_virtual/node_modules/.pnpm/{hyparquet-compressors@1.1.2 → hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d}/node_modules/hyparquet-compressors/src/lz4.mjs +0 -0
  33. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/avro/avro.write.mjs +0 -0
  34. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/catalog/file.mjs +0 -0
  35. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/catalog/loadTable.mjs +0 -0
  36. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/catalog/rest.mjs +0 -0
  37. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/create.mjs +0 -0
  38. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/delete.mjs +0 -0
  39. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/index.mjs +0 -0
  40. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/json.mjs +0 -0
  41. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/metadata.mjs +0 -0
  42. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/prune.mjs +0 -0
  43. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/puffin/deletion-vector.mjs +0 -0
  44. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/puffin/puffin.mjs +0 -0
  45. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/puffin/roaring.mjs +0 -0
  46. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/s3.mjs +0 -0
  47. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/schema.mjs +0 -0
  48. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/sigv4.mjs +0 -0
  49. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/sql/icebergDataSource.mjs +0 -0
  50. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/sql/icebergQuery.mjs +0 -0
  51. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/sql/whereFilter.mjs +0 -0
  52. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/types.d.mts +0 -0
  53. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/utils.mjs +0 -0
  54. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/commit.mjs +0 -0
  55. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/conversions.mjs +0 -0
  56. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/delete-file.mjs +0 -0
  57. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/geospatial.mjs +0 -0
  58. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/manifest-list.mjs +0 -0
  59. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/manifest.mjs +0 -0
  60. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/parquet.mjs +0 -0
  61. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/partition.mjs +0 -0
  62. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/rewrite.mjs +0 -0
  63. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/serde.mjs +0 -0
  64. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/snapshot.mjs +0 -0
  65. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/sort.mjs +0 -0
  66. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/stage-deletion-vector.mjs +0 -0
  67. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/stage-position-delete.mjs +0 -0
  68. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/stage.mjs +0 -0
  69. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/stats.mjs +0 -0
  70. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/transform.mjs +0 -0
  71. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/src/write/write.mjs +0 -0
  72. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/catalog/file.d.mts +0 -0
  73. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/catalog/rest.d.mts +0 -0
  74. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/create.d.mts +0 -0
  75. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/fetch.d.mts +0 -0
  76. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/index.d.mts +0 -0
  77. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/metadata.d.mts +0 -0
  78. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/read.d.mts +0 -0
  79. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/s3.d.mts +0 -0
  80. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/sql/icebergDataSource.d.mts +0 -0
  81. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/sql/icebergQuery.d.mts +0 -0
  82. /package/dist/_virtual/node_modules/.pnpm/{icebird@0.8.30_patch_hash=a400e343a199b1ca18601f96348011745ac6518fc07ffa71d5adfdd2ccc7d14f → icebird@0.8.30_patch_hash=1359a91da68522a736babe444880ae391f19455fbe47c346f76cec92c5c2e471}/node_modules/icebird/types/write/write.d.mts +0 -0
package/README.md CHANGED
@@ -45,6 +45,74 @@ For retry decisions, import `isCommitRateLimited`, `isCommitServerError`, or
45
45
  Use the dataset registry to define datasets.
46
46
  Raw Icebird table creation and append functions live under `unsafe-raw` for package adapters and diagnostics.
47
47
 
48
+ ## Opt-in manifest read limits
49
+
50
+ `icebergManifests` on `@gscdump/lakehouse/unsafe-raw` accepts an optional
51
+ `readLimits: ManifestReadLimits`. Omission preserves the existing reader and
52
+ caller-owned manifest cache behavior. No higher-level file resolver or host
53
+ automatically enables these limits.
54
+
55
+ ```ts
56
+ import { icebergManifests } from '@gscdump/lakehouse/unsafe-raw'
57
+
58
+ const manifests = await icebergManifests({
59
+ metadata,
60
+ resolver,
61
+ readLimits: {
62
+ maxObjectBytes: 2 * 1024 * 1024,
63
+ maxTotalObjectBytes: 8 * 1024 * 1024,
64
+ maxManifests: 8,
65
+ maxEntries: 128,
66
+ maxInflatedBlockBytes: 2 * 1024 * 1024,
67
+ maxTotalInflatedBytes: 8 * 1024 * 1024,
68
+ maxValueBytes: 1024 * 1024,
69
+ maxDecodedValues: 100_000,
70
+ maxHeaderBytes: 64 * 1024,
71
+ maxSchemaDepth: 32,
72
+ },
73
+ })
74
+ ```
75
+
76
+ These are example admission values, not defaults or a total JavaScript heap
77
+ guarantee. Every field is required and must be a positive safe integer;
78
+ `maxSchemaDepth` must also be at most 128. The reader copies and validates the
79
+ policy before its first asynchronous read. Unknown fields are rejected.
80
+
81
+ The per-object and cumulative source-byte checks happen after `resolver.reader`
82
+ reports `byteLength`, **before** the reader requests `slice(0, byteLength)`.
83
+ Declared manifest lengths and returned slice lengths must match. An injected
84
+ resolver can allocate or fetch inside `reader` itself; those operations are
85
+ outside this boundary and need their own transport limits and immutable-object
86
+ identity checks. No HEAD, catalog JSON, network-request, or freshness bound is
87
+ implied by this option.
88
+
89
+ Manifest-list counts are admitted before record materialization and pruning;
90
+ entry counts accumulate across all fetched manifests and blocks. V1 inline
91
+ manifest counts are admitted before reads, with each file decoded once in a
92
+ private per-call cache. Supplying `manifestCache` with `readLimits` is rejected:
93
+ previously decoded cache entries carry no verifiable budget provenance. Defaults
94
+ retain their existing cache behavior.
95
+
96
+ For Avro `null` and raw `deflate` blocks, decoded block bytes and their cumulative
97
+ total are bounded. The existing pure-JavaScript inflater checks output growth
98
+ before allocating or writing past that limit. Bounded DEFLATE returns an exact-size
99
+ backing buffer so byte views do not retain spare inflater capacity; growth and
100
+ final-copy buffers can temporarily overlap. Header framing is byte-bounded
101
+ before JSON parsing; schema depth/work is checked before recursive compilation.
102
+ Variable and fixed values are checked before views or UTF-8 decoding, and
103
+ `maxDecodedValues` bounds decoding work across header/schema nodes and decoded
104
+ value visits, including arrays of zero-byte nulls. Strict reads also reject
105
+ invalid counts, varints, indexes, truncated values and inconsistent block sizes.
106
+
107
+ These limits do not measure JavaScript object/string overhead, the JSON parser's
108
+ internal allocations, inflater tables, caller-retained output, injected resolver
109
+ caches or total process memory. Output remains an eager array within the chosen
110
+ count/byte/work policy. A refusal rejects the complete call; there is no eager
111
+ fallback or partial success. Already-dispatched resolver reads cannot be
112
+ physically cancelled by the AsyncBuffer interface, but a first failure stops new
113
+ dispatches and prevents late responses from being decoded. Choose compatible
114
+ limits and validate the complete consumer path before enabling them.
115
+
48
116
  ## Append retries
49
117
 
50
118
  Supply a durable `commitRetry.appendId` when a dataset append belongs to a job or receipt.
@@ -39,12 +39,15 @@ function gzipStart(input, i) {
39
39
  for (let zs = (flag >> 3 & 1) + (flag >> 4 & 1); zs > 0; zs -= Number(!input[i++]));
40
40
  return i + (flag & 2);
41
41
  }
42
- function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
43
- let out = output ?? /* @__PURE__ */ new Uint8Array(1024);
42
+ function gunzip(input, output, inputIndex = 0, outputIndex = 0, limits) {
43
+ const maximum = limits?.maxOutputBytes;
44
+ if (limits && (limits.raw !== true || !Number.isSafeInteger(maximum) || maximum < 0 || output || inputIndex !== 0 || outputIndex !== 0)) throw new RangeError("Invalid bounded raw DEFLATE options");
45
+ let out = output ?? new Uint8Array(limits ? Math.min(1024, maximum) : 1024);
46
+ if (limits && !input.length) throw new Error("unexpected EOF");
44
47
  if (!(input.length - inputIndex)) return out;
45
- const payloadStart = gzipStart(input, inputIndex);
46
- if (payloadStart === input.length - 8) return out;
47
- if (payloadStart > input.length - 8) throw new Error("unexpected EOF");
48
+ const payloadStart = limits ? 0 : gzipStart(input, inputIndex);
49
+ if (!limits && payloadStart === input.length - 8) return out;
50
+ if (!limits && payloadStart > input.length - 8) throw new Error("unexpected EOF");
48
51
  let pos = payloadStart * 8;
49
52
  let final = 0;
50
53
  let lengthBits = 0;
@@ -53,9 +56,10 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
53
56
  let distMap;
54
57
  const totalBits = input.length * 8;
55
58
  function ensureSize(length) {
59
+ if (limits && (!Number.isSafeInteger(length) || length > maximum)) throw new RangeError("DEFLATE output byte limit exceeded");
56
60
  if (!output && length > out.length) {
57
61
  const old = out;
58
- out = new Uint8Array(Math.max(old.length * 2, length));
62
+ out = new Uint8Array(limits ? Math.min(maximum, Math.max(old.length * 2, length)) : Math.max(old.length * 2, length));
59
63
  out.set(old);
60
64
  }
61
65
  }
@@ -67,6 +71,7 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
67
71
  if (!type) {
68
72
  const s = shft(pos) + 4;
69
73
  const l = input[s - 4] | input[s - 3] << 8;
74
+ if (limits && (s > input.length || ((input[s - 2] | input[s - 1] << 8) ^ l) !== 65535)) throw new Error("invalid stored block length");
70
75
  const t = s + l;
71
76
  if (t > input.length) throw new Error("unexpected EOF");
72
77
  ensureSize(outputIndex + l);
@@ -93,6 +98,7 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
93
98
  const codeLengthMap = huffMap(codeLengthTree, codeLengthBits, 1);
94
99
  for (let i = 0; i < tl;) {
95
100
  const r = codeLengthMap[bits(input, pos, clbMask)];
101
+ if (limits && !r) throw new Error("invalid code length");
96
102
  pos += r & 15;
97
103
  const symbol = r >> 4;
98
104
  if (symbol < 16) lengthDistanceTree[i++] = symbol;
@@ -100,6 +106,7 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
100
106
  let copy = 0;
101
107
  let n = 0;
102
108
  if (symbol === 16) {
109
+ if (limits && i === 0) throw new Error("invalid code length repeat");
103
110
  n = 3 + bits(input, pos, 3);
104
111
  pos += 2;
105
112
  copy = lengthDistanceTree[i - 1];
@@ -110,6 +117,7 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
110
117
  n = 11 + bits(input, pos, 127);
111
118
  pos += 7;
112
119
  }
120
+ if (limits && i + n > tl) throw new Error("invalid code length repeat");
113
121
  while (n--) lengthDistanceTree[i++] = copy;
114
122
  }
115
123
  }
@@ -122,7 +130,7 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
122
130
  } else throw new Error("invalid block type");
123
131
  if (pos > totalBits) throw new Error("unexpected EOF");
124
132
  }
125
- ensureSize(outputIndex + 131072);
133
+ ensureSize(limits ? Math.min(maximum, outputIndex + 131072) : outputIndex + 131072);
126
134
  const lms = (1 << lengthBits) - 1;
127
135
  const dms = (1 << distBits) - 1;
128
136
  for (;;) {
@@ -131,8 +139,10 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
131
139
  pos += code & 15;
132
140
  if (pos > totalBits) throw new Error("unexpected EOF");
133
141
  if (!code) throw new Error("invalid length/literal");
134
- if (sym < 256) out[outputIndex++] = sym;
135
- else if (sym === 256) {
142
+ if (sym < 256) {
143
+ if (limits) ensureSize(outputIndex + 1);
144
+ out[outputIndex++] = sym;
145
+ } else if (sym === 256) {
136
146
  lengthMap = void 0;
137
147
  break;
138
148
  } else {
@@ -147,6 +157,7 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
147
157
  const d = distMap[bits16(input, pos) & dms];
148
158
  const dsym = d >> 4;
149
159
  if (!d) throw new Error("invalid distance");
160
+ if (limits && dsym > 29) throw new Error("invalid distance symbol");
150
161
  pos += d & 15;
151
162
  let dt = fixedDistance[dsym];
152
163
  if (dsym > 3) {
@@ -163,10 +174,12 @@ function gunzip(input, output, inputIndex = 0, outputIndex = 0) {
163
174
  }
164
175
  if (lengthMap) final = 1;
165
176
  } while (!final);
166
- if (outputIndex < out.length) {
177
+ if (limits && Math.ceil(pos / 8) !== input.length) throw new Error("trailing raw DEFLATE bytes");
178
+ if (!limits && outputIndex < out.length) {
167
179
  const nextBlock = Math.ceil(pos / 8) + 8;
168
180
  gunzip(input, out, nextBlock, outputIndex);
169
181
  }
182
+ if (limits && outputIndex !== out.length) return out.slice(0, outputIndex);
170
183
  if (!output) return out.subarray(0, outputIndex);
171
184
  return out;
172
185
  }
@@ -0,0 +1,115 @@
1
+ const fields = [
2
+ "maxObjectBytes",
3
+ "maxTotalObjectBytes",
4
+ "maxManifests",
5
+ "maxEntries",
6
+ "maxInflatedBlockBytes",
7
+ "maxTotalInflatedBytes",
8
+ "maxValueBytes",
9
+ "maxDecodedValues",
10
+ "maxHeaderBytes",
11
+ "maxSchemaDepth"
12
+ ];
13
+ function createAvroBudget(options) {
14
+ if (options === void 0) return void 0;
15
+ if (!options || typeof options !== "object" || Array.isArray(options)) throw new TypeError("Invalid manifest read limits");
16
+ const limits = {};
17
+ for (const key of Object.keys(options)) if (!fields.includes(key)) throw new TypeError(`Unknown manifest read limit: ${key}`);
18
+ for (const key of fields) {
19
+ const value = options[key];
20
+ if (!Number.isSafeInteger(value) || value <= 0) throw new RangeError(`Invalid manifest read limit: ${key}`);
21
+ limits[key] = value;
22
+ }
23
+ if (limits.maxSchemaDepth > 128) throw new RangeError("Manifest schema depth must not exceed 128");
24
+ Object.freeze(limits);
25
+ const used = {
26
+ objectBytes: 0,
27
+ inflatedBytes: 0,
28
+ manifests: 0,
29
+ entries: 0,
30
+ values: 0
31
+ };
32
+ let failed = false, failure;
33
+ const check = () => {
34
+ if (failed) throw failure;
35
+ };
36
+ const fail = (error) => {
37
+ if (!failed) {
38
+ failed = true;
39
+ failure = error;
40
+ }
41
+ throw failure;
42
+ };
43
+ const bound = (value, max, label) => {
44
+ check();
45
+ if (!Number.isSafeInteger(value) || value < 0 || value > max) fail(/* @__PURE__ */ new RangeError(`Manifest read limit exceeded: ${label}`));
46
+ };
47
+ const charge = (key, value, max) => {
48
+ bound(value, max - used[key], key);
49
+ used[key] += value;
50
+ };
51
+ return Object.freeze({
52
+ limits,
53
+ check,
54
+ fail,
55
+ bound,
56
+ object(bytes) {
57
+ bound(bytes, limits.maxObjectBytes, "objectBytes");
58
+ charge("objectBytes", bytes, limits.maxTotalObjectBytes);
59
+ },
60
+ records(count, kind) {
61
+ charge(kind, count, kind === "manifests" ? limits.maxManifests : limits.maxEntries);
62
+ },
63
+ values(count) {
64
+ charge("values", count, limits.maxDecodedValues);
65
+ },
66
+ availableValues(count) {
67
+ bound(count, limits.maxDecodedValues - used.values, "values");
68
+ },
69
+ inflateLimit() {
70
+ check();
71
+ return Math.min(limits.maxInflatedBlockBytes, limits.maxTotalInflatedBytes - used.inflatedBytes);
72
+ },
73
+ inflated(bytes) {
74
+ bound(bytes, limits.maxInflatedBlockBytes, "inflatedBlockBytes");
75
+ charge("inflatedBytes", bytes, limits.maxTotalInflatedBytes);
76
+ },
77
+ schema(value) {
78
+ const stack = [{
79
+ value,
80
+ depth: 0
81
+ }];
82
+ while (stack.length) {
83
+ const next = stack.pop();
84
+ bound(next.depth, limits.maxSchemaDepth, "schemaDepth");
85
+ charge("values", 1, limits.maxDecodedValues);
86
+ if (next.value && typeof next.value === "object") {
87
+ const keys = Object.keys(next.value);
88
+ bound(stack.length + keys.length, limits.maxDecodedValues - used.values, "schemaValues");
89
+ for (const key of keys) stack.push({
90
+ value: next.value[key],
91
+ depth: next.depth + 1
92
+ });
93
+ }
94
+ }
95
+ }
96
+ });
97
+ }
98
+ function boundedBytes(reader, length, max) {
99
+ const budget = reader.budget;
100
+ budget?.bound(length, max ?? budget.limits.maxValueBytes, "valueBytes");
101
+ budget?.bound(reader.offset + length, reader.headerEnd ?? reader.view.byteLength, "encodedBytes");
102
+ return new Uint8Array(reader.view.buffer, reader.view.byteOffset + reader.offset, length);
103
+ }
104
+ function boundedLong(reader) {
105
+ let value = 0n;
106
+ for (let shift = 0; shift < 70; shift += 7) {
107
+ reader.budget.bound(reader.offset + 1, reader.headerEnd ?? reader.view.byteLength, "varintBytes");
108
+ const byte = reader.view.getUint8(reader.offset++);
109
+ if (shift === 63 && byte > 1) reader.budget.fail(/* @__PURE__ */ new RangeError("Invalid Avro long"));
110
+ value |= BigInt(byte & 127) << BigInt(shift);
111
+ if (!(byte & 128)) return value >> 1n ^ -(value & 1n);
112
+ }
113
+ return reader.budget.fail(/* @__PURE__ */ new RangeError("Invalid Avro long"));
114
+ }
115
+ export { boundedBytes, boundedLong, createAvroBudget };
@@ -0,0 +1,97 @@
1
+ import { boundedBytes, boundedLong } from "./avro.budget.mjs";
2
+ const smallLongs = Array.from({ length: 128 }, (_, i) => BigInt(i >>> 1 ^ -(i & 1)));
3
+ function readZigZag(reader) {
4
+ if (reader.budget) {
5
+ const value = Number(boundedLong(reader));
6
+ if (!Number.isSafeInteger(value)) reader.budget.fail(/* @__PURE__ */ new RangeError("Avro integer exceeds safe range"));
7
+ return value;
8
+ }
9
+ let result = 0;
10
+ let shift = 0;
11
+ while (true) {
12
+ const byte = reader.view.getUint8(reader.offset++);
13
+ result |= (byte & 127) << shift;
14
+ if (!(byte & 128)) return result >>> 1 ^ -(result & 1);
15
+ shift += 7;
16
+ }
17
+ }
18
+ function readZigZagBigInt(reader) {
19
+ if (reader.budget) return boundedLong(reader);
20
+ const first = reader.view.getUint8(reader.offset++);
21
+ if (first < 128) return smallLongs[first];
22
+ let prefix = first & 127;
23
+ for (let shift = 7; shift < 28; shift += 7) {
24
+ const byte = reader.view.getUint8(reader.offset++);
25
+ prefix |= (byte & 127) << shift;
26
+ if (!(byte & 128)) return BigInt(prefix >>> 1 ^ -(prefix & 1));
27
+ }
28
+ let high = 0;
29
+ let factor = 1;
30
+ while (true) {
31
+ const byte = reader.view.getUint8(reader.offset++);
32
+ high += (byte & 127) * factor;
33
+ if (!(byte & 128)) {
34
+ const result = BigInt(high) << 27n | BigInt(prefix >>> 1);
35
+ return prefix & 1 ? ~result : result;
36
+ }
37
+ factor *= 128;
38
+ }
39
+ }
40
+ function readBlockEnd(reader) {
41
+ const size = readZigZag(reader);
42
+ if (!reader.budget) return void 0;
43
+ reader.budget.bound(size, reader.view.byteLength, "containerBlockBytes");
44
+ const end = reader.offset + size;
45
+ reader.budget.bound(end, reader.headerEnd ?? reader.view.byteLength, "containerBlockEnd");
46
+ return end;
47
+ }
48
+ function checkBlockEnd(reader, end) {
49
+ if (end !== void 0 && reader.offset !== end) reader.budget.fail(/* @__PURE__ */ new RangeError("Avro container block length mismatch"));
50
+ }
51
+ function readAvroString(reader) {
52
+ const length = readZigZag(reader);
53
+ const bytes = boundedBytes(reader, length);
54
+ reader.budget?.values(1);
55
+ reader.offset += length;
56
+ return new TextDecoder().decode(bytes);
57
+ }
58
+ function avroMetadata(reader) {
59
+ if (reader.budget) reader.headerEnd = Math.min(reader.view.byteLength, reader.offset + reader.budget.limits.maxHeaderBytes);
60
+ reader.budget?.bound(reader.offset + 4, reader.headerEnd, "headerBytes");
61
+ if (reader.view.getUint32(reader.offset) !== 1331849729) throw new Error("avro invalid magic bytes");
62
+ reader.offset += 4;
63
+ const metadata = {};
64
+ let mapCount = readZigZag(reader);
65
+ while (mapCount !== 0) {
66
+ let end;
67
+ if (mapCount < 0) {
68
+ mapCount = -mapCount;
69
+ end = readBlockEnd(reader);
70
+ }
71
+ reader.budget?.availableValues(mapCount * 2);
72
+ for (let i = 0; i < mapCount; i++) {
73
+ const key = readAvroString(reader);
74
+ metadata[key] = readAvroString(reader);
75
+ }
76
+ checkBlockEnd(reader, end);
77
+ mapCount = readZigZag(reader);
78
+ }
79
+ metadata["avro.schema"] = JSON.parse(metadata["avro.schema"]);
80
+ reader.budget?.schema(metadata["avro.schema"]);
81
+ if (metadata["schema"]) {
82
+ metadata["schema"] = JSON.parse(metadata["schema"]);
83
+ reader.budget?.schema(metadata["schema"]);
84
+ }
85
+ if (metadata["iceberg.schema"]) {
86
+ metadata["iceberg.schema"] = JSON.parse(metadata["iceberg.schema"]);
87
+ reader.budget?.schema(metadata["iceberg.schema"]);
88
+ }
89
+ const syncMarker = boundedBytes(reader, 16, reader.budget?.limits.maxHeaderBytes);
90
+ reader.offset += 16;
91
+ delete reader.headerEnd;
92
+ return {
93
+ metadata,
94
+ syncMarker
95
+ };
96
+ }
97
+ export { avroMetadata, checkBlockEnd, readBlockEnd, readZigZag, readZigZagBigInt };
@@ -1,36 +1,54 @@
1
1
  import { parseDecimal } from "../../../../../hyparquet@1.31.1/node_modules/hyparquet/src/convert.mjs";
2
- import { gunzip } from "../../../../../hyparquet-compressors@1.1.2/node_modules/hyparquet-compressors/src/gzip.mjs";
3
- import "../../../../../hyparquet-compressors@1.1.2/node_modules/hyparquet-compressors/src/index.mjs";
4
- import { readZigZag, readZigZagBigInt } from "./avro.metadata.mjs";
2
+ import { gunzip } from "../../../../../hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d/node_modules/hyparquet-compressors/src/gzip.mjs";
3
+ import "../../../../../hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d/node_modules/hyparquet-compressors/src/index.mjs";
4
+ import { boundedBytes } from "./avro.budget.mjs";
5
+ import { checkBlockEnd, readBlockEnd, readZigZag, readZigZagBigInt } from "./avro.metadata.mjs";
5
6
  const textDecoder = new TextDecoder();
6
- function avroRead({ reader, metadata, syncMarker }) {
7
- const decode = compileType(metadata["avro.schema"]);
7
+ function avroRead({ reader, metadata, syncMarker, recordKind = "entries" }) {
8
+ const budget = reader.budget;
9
+ const decode = compileType(metadata["avro.schema"], budget);
8
10
  const blocks = [];
9
11
  while (reader.offset < reader.view.byteLength) {
10
12
  let recordCount = readZigZag(reader);
13
+ if (budget && recordCount <= 0) budget.fail(/* @__PURE__ */ new RangeError("Invalid Avro record count"));
11
14
  if (recordCount === 0) break;
12
15
  if (recordCount < 0) recordCount = -recordCount;
16
+ budget?.records(recordCount, recordKind);
17
+ budget?.availableValues(recordCount);
13
18
  const blockSize = readZigZag(reader);
14
- let data = new Uint8Array(reader.view.buffer, reader.view.byteOffset + reader.offset, blockSize);
19
+ let data = boundedBytes(reader, blockSize, budget?.limits.maxObjectBytes);
15
20
  reader.offset += blockSize;
16
- const blockSync = new Uint8Array(reader.view.buffer, reader.view.byteOffset + reader.offset, 16);
21
+ const blockSync = boundedBytes(reader, 16, 16);
17
22
  reader.offset += 16;
18
23
  for (let i = 0; i < 16; i++) if (blockSync[i] !== syncMarker[i]) throw new Error("sync marker does not match");
19
24
  const codec = metadata["avro.codec"];
20
- if (codec === "deflate") data = gunzip(data);
25
+ if (codec === "deflate") data = budget ? gunzip(data, void 0, 0, 0, {
26
+ raw: true,
27
+ maxOutputBytes: budget.inflateLimit()
28
+ }) : gunzip(data);
21
29
  else if (codec !== "null") throw new Error(`unsupported codec: ${codec}`);
30
+ budget?.inflated(data.byteLength);
22
31
  const dataReader = {
23
32
  view: new DataView(data.buffer, data.byteOffset, data.byteLength),
24
- offset: 0
33
+ offset: 0,
34
+ ...budget ? { budget } : {}
25
35
  };
26
36
  for (let i = 0; i < recordCount; i++) blocks.push(decode(dataReader));
37
+ if (budget && dataReader.offset !== data.byteLength) budget.fail(/* @__PURE__ */ new RangeError("Avro block length mismatch"));
27
38
  }
28
39
  return blocks;
29
40
  }
30
41
  function readType(reader, type) {
42
+ reader.budget?.values(1);
43
+ return readTypeValue(reader, type);
44
+ }
45
+ function readTypeValue(reader, type) {
31
46
  if (type === "null") return;
32
- else if (Array.isArray(type)) return readType(reader, type[readZigZag(reader)]);
33
- else if (typeof type === "object" && type.type === "record") {
47
+ else if (Array.isArray(type)) {
48
+ const unionIndex = readZigZag(reader);
49
+ reader.budget?.bound(unionIndex, type.length - 1, "unionIndex");
50
+ return readType(reader, type[unionIndex]);
51
+ } else if (typeof type === "object" && type.type === "record") {
34
52
  const obj = {};
35
53
  for (const subField of type.fields) obj[subField.name] = readType(reader, subField.type);
36
54
  return obj;
@@ -39,11 +57,14 @@ function readType(reader, type) {
39
57
  while (true) {
40
58
  let count = readZigZag(reader);
41
59
  if (count === 0) break;
60
+ let end;
42
61
  if (count < 0) {
43
62
  count = -count;
44
- readZigZag(reader);
63
+ end = readBlockEnd(reader);
45
64
  }
65
+ reader.budget?.availableValues(count);
46
66
  for (let i = 0; i < count; i++) arr.push(readType(reader, type.items));
67
+ checkBlockEnd(reader, end);
47
68
  }
48
69
  return arr;
49
70
  } else if (typeof type === "object" && type.type === "map") {
@@ -51,18 +72,24 @@ function readType(reader, type) {
51
72
  while (true) {
52
73
  let count = readZigZag(reader);
53
74
  if (count === 0) break;
75
+ let end;
54
76
  if (count < 0) {
55
77
  count = -count;
56
- readZigZag(reader);
78
+ end = readBlockEnd(reader);
57
79
  }
80
+ reader.budget?.availableValues(count);
58
81
  for (let i = 0; i < count; i++) {
59
82
  const key = readType(reader, "string");
60
83
  map[key] = readType(reader, type.values);
61
84
  }
85
+ checkBlockEnd(reader, end);
62
86
  }
63
87
  return map;
64
- } else if (typeof type === "object" && type.type === "enum") return type.symbols[readZigZag(reader)];
65
- else if (typeof type === "object" && "logicalType" in type && type.logicalType) {
88
+ } else if (typeof type === "object" && type.type === "enum") {
89
+ const index = readZigZag(reader);
90
+ reader.budget?.bound(index, type.symbols.length - 1, "enumIndex");
91
+ return type.symbols[index];
92
+ } else if (typeof type === "object" && "logicalType" in type && type.logicalType) {
66
93
  if (type.logicalType === "date" && type.type === "int") {
67
94
  const value = readZigZag(reader);
68
95
  return /* @__PURE__ */ new Date(value * 864e5);
@@ -103,12 +130,12 @@ function readType(reader, type) {
103
130
  return value;
104
131
  } else if (type === "bytes") {
105
132
  const length = readZigZag(reader);
106
- const bytes = new Uint8Array(reader.view.buffer, reader.view.byteOffset + reader.offset, length);
133
+ const bytes = boundedBytes(reader, length);
107
134
  reader.offset += length;
108
135
  return bytes;
109
136
  } else if (type === "string") {
110
137
  const length = readZigZag(reader);
111
- const bytes = new Uint8Array(reader.view.buffer, reader.view.byteOffset + reader.offset, length);
138
+ const bytes = boundedBytes(reader, length);
112
139
  const text = textDecoder.decode(bytes);
113
140
  reader.offset += length;
114
141
  return text;
@@ -116,7 +143,7 @@ function readType(reader, type) {
116
143
  else throw new Error(`unsupported type: ${JSON.stringify(type)}`);
117
144
  }
118
145
  function readFixed(reader, size) {
119
- const bytes = new Uint8Array(reader.view.buffer, reader.view.byteOffset + reader.offset, size);
146
+ const bytes = boundedBytes(reader, size);
120
147
  reader.offset += size;
121
148
  return bytes;
122
149
  }
@@ -128,39 +155,53 @@ function bytesToUuid(bytes) {
128
155
  }
129
156
  return hex;
130
157
  }
131
- function compileType(type) {
158
+ function compileType(type, budget) {
159
+ const decode = compileTypeValue(type, budget);
160
+ return budget ? (reader) => {
161
+ budget.values(1);
162
+ return decode(reader);
163
+ } : decode;
164
+ }
165
+ function compileTypeValue(type, budget) {
132
166
  if (type === "null") return () => void 0;
133
167
  if (type === "int") return readZigZag;
134
168
  if (type === "long") return readZigZagBigInt;
135
169
  if (type === "string" || type === "bytes") return (reader) => {
136
170
  const length = readZigZag(reader);
137
- const bytes = new Uint8Array(reader.view.buffer, reader.view.byteOffset + reader.offset, length);
171
+ const bytes = boundedBytes(reader, length);
138
172
  reader.offset += length;
139
173
  return type === "string" ? textDecoder.decode(bytes) : bytes;
140
174
  };
141
175
  if (Array.isArray(type)) {
142
- const readers = type.map(compileType);
143
- return (reader) => readers[readZigZag(reader)](reader);
176
+ const readers = type.map((item) => compileType(item, budget));
177
+ return (reader) => {
178
+ const index = readZigZag(reader);
179
+ budget?.bound(index, readers.length - 1, "unionIndex");
180
+ return readers[index](reader);
181
+ };
144
182
  }
145
183
  if (typeof type === "object" && type.type === "array") {
146
- const item = compileType(type.items);
184
+ const item = compileType(type.items, budget);
147
185
  return (reader) => {
148
186
  const arr = [];
149
187
  while (true) {
150
188
  let count = readZigZag(reader);
151
189
  if (count === 0) return arr;
190
+ let end;
152
191
  if (count < 0) {
153
192
  count = -count;
154
- readZigZag(reader);
193
+ end = readBlockEnd(reader);
155
194
  }
195
+ budget?.availableValues(count);
156
196
  for (let i = 0; i < count; i++) arr.push(item(reader));
197
+ checkBlockEnd(reader, end);
157
198
  }
158
199
  };
159
200
  }
160
201
  if (typeof type === "object" && type.type === "record") {
161
202
  const fields = type.fields.map((field) => ({
162
203
  name: field.name,
163
- read: compileType(field.type)
204
+ read: compileType(field.type, budget)
164
205
  }));
165
206
  if (fields.length === 2) {
166
207
  const [{ name: firstName, read: firstRead }, { name: secondName, read: secondRead }] = fields;
@@ -177,6 +218,6 @@ function compileType(type) {
177
218
  return obj;
178
219
  };
179
220
  }
180
- return (reader) => readType(reader, type);
221
+ return (reader) => readTypeValue(reader, type);
181
222
  }
182
223
  export { avroRead };
@@ -2,8 +2,8 @@ import { parquetMetadataAsync } from "../../../../hyparquet@1.31.1/node_modules/
2
2
  import { asyncBufferFromUrl, cachedAsyncBuffer } from "../../../../hyparquet@1.31.1/node_modules/hyparquet/src/utils.mjs";
3
3
  import { parquetReadObjects } from "../../../../hyparquet@1.31.1/node_modules/hyparquet/src/read.mjs";
4
4
  import "../../../../hyparquet@1.31.1/node_modules/hyparquet/src/node.mjs";
5
- import { compressors } from "../../../../hyparquet-compressors@1.1.2/node_modules/hyparquet-compressors/src/compressors.mjs";
6
- import "../../../../hyparquet-compressors@1.1.2/node_modules/hyparquet-compressors/src/index.mjs";
5
+ import { compressors } from "../../../../hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d/node_modules/hyparquet-compressors/src/compressors.mjs";
6
+ import "../../../../hyparquet-compressors@1.1.2_patch_hash=821c89dbb6181f0c34d9abebd844451458a4f16c04e7aa7a19abca0c09c2238d/node_modules/hyparquet-compressors/src/index.mjs";
7
7
  import { ByteWriter } from "../../../../hyparquet-writer@0.16.10_patch_hash=d26d002aede61ad95dd633d6557b56897cdcbc45dfc3a5d93fa0e9075ad5425f/node_modules/hyparquet-writer/src/bytewriter.mjs";
8
8
  import "../../../../hyparquet-writer@0.16.10_patch_hash=d26d002aede61ad95dd633d6557b56897cdcbc45dfc3a5d93fa0e9075ad5425f/node_modules/hyparquet-writer/src/node.mjs";
9
9
  import { avroMetadata } from "./avro/avro.metadata.mjs";
@@ -251,7 +251,8 @@ async function decompressGzip(buf) {
251
251
  const stream = new Blob([buf]).stream().pipeThrough(new DecompressionStream("gzip"));
252
252
  return await new Response(stream).arrayBuffer();
253
253
  }
254
- async function fetchAvroRecords(url, resolver, byteLength) {
254
+ async function fetchAvroRecords(url, resolver, byteLength, budget, recordKind) {
255
+ if (budget) return (await fetchBoundedAvroObject(url, resolver, byteLength, budget, recordKind)).records;
255
256
  const lengthHint = byteLength !== void 0 && Number.isFinite(byteLength) ? byteLength : void 0;
256
257
  const ab = await resolver.reader(url, lengthHint);
257
258
  const buffer = await ab.slice(0, ab.byteLength);
@@ -266,4 +267,36 @@ async function fetchAvroRecords(url, resolver, byteLength) {
266
267
  syncMarker
267
268
  });
268
269
  }
269
- export { cachingResolver, fetchAvroRecords, fetchDeleteMaps, readParquetMetadata, resolveText, s3Lister, s3ParseUrl, translateS3Url, urlResolver };
270
+ async function fetchBoundedAvroObject(url, resolver, byteLength, budget, recordKind = "entries") {
271
+ try {
272
+ budget.check();
273
+ if (byteLength !== void 0) budget.bound(byteLength, budget.limits.maxObjectBytes, "lengthHint");
274
+ const ab = await resolver.reader(url, byteLength);
275
+ budget.check();
276
+ const length = ab.byteLength;
277
+ budget.object(length);
278
+ if (byteLength !== void 0 && byteLength !== length) throw new Error("Manifest object length changed");
279
+ const buffer = await ab.slice(0, length);
280
+ budget.check();
281
+ if (buffer.byteLength !== length) throw new Error("Manifest object range length changed");
282
+ const reader = {
283
+ view: new DataView(buffer),
284
+ offset: 0,
285
+ budget
286
+ };
287
+ const { metadata, syncMarker } = avroMetadata(reader);
288
+ return {
289
+ metadata,
290
+ records: avroRead({
291
+ reader,
292
+ metadata,
293
+ syncMarker,
294
+ recordKind
295
+ }),
296
+ byteLength: length
297
+ };
298
+ } catch (error) {
299
+ return budget.fail(error);
300
+ }
301
+ }
302
+ export { cachingResolver, fetchAvroRecords, fetchBoundedAvroObject, fetchDeleteMaps, readParquetMetadata, resolveText, s3Lister, s3ParseUrl, translateS3Url, urlResolver };