Browse Source

first commit in testing

testing_orbitdb
Jens Wölpert 2 years ago
parent
commit
e11112b88c
  1. 1
      node_modules/.bin/esbuild
  2. 1
      node_modules/.bin/nanoid
  3. 1
      node_modules/.bin/node-gyp-build
  4. 1
      node_modules/.bin/node-gyp-build-optional
  5. 1
      node_modules/.bin/node-gyp-build-test
  6. 1
      node_modules/.bin/resolve
  7. 1
      node_modules/.bin/rollup
  8. 1
      node_modules/.bin/semver
  9. 1
      node_modules/.bin/vite
  10. 756
      node_modules/.package-lock.json
  11. 74
      node_modules/.vite/deps/_metadata.json
  12. 2100
      node_modules/.vite/deps/chunk-ENZLGVI2.js
  13. 7
      node_modules/.vite/deps/chunk-ENZLGVI2.js.map
  14. 9
      node_modules/.vite/deps/chunk-RSJERJUL.js
  15. 7
      node_modules/.vite/deps/chunk-RSJERJUL.js.map
  16. 150
      node_modules/.vite/deps/chunk-V3UMKGYM.js
  17. 7
      node_modules/.vite/deps/chunk-V3UMKGYM.js.map
  18. 101
      node_modules/.vite/deps/chunk-V5ZN2RMD.js
  19. 7
      node_modules/.vite/deps/chunk-V5ZN2RMD.js.map
  20. 1
      node_modules/.vite/deps/package.json
  21. 1260
      node_modules/.vite/deps/svelte-leafletjs__axios.js
  22. 7
      node_modules/.vite/deps/svelte-leafletjs__axios.js.map
  23. 7850
      node_modules/.vite/deps/svelte-leafletjs__leaflet.js
  24. 7
      node_modules/.vite/deps/svelte-leafletjs__leaflet.js.map
  25. 30
      node_modules/.vite/deps/svelte.js
  26. 7
      node_modules/.vite/deps/svelte.js.map
  27. 33
      node_modules/.vite/deps/svelte_animate.js
  28. 7
      node_modules/.vite/deps/svelte_animate.js.map
  29. 70
      node_modules/.vite/deps/svelte_easing.js
  30. 7
      node_modules/.vite/deps/svelte_easing.js.map
  31. 362
      node_modules/.vite/deps/svelte_internal.js
  32. 7
      node_modules/.vite/deps/svelte_internal.js.map
  33. 208
      node_modules/.vite/deps/svelte_motion.js
  34. 7
      node_modules/.vite/deps/svelte_motion.js.map
  35. 16
      node_modules/.vite/deps/svelte_store.js
  36. 7
      node_modules/.vite/deps/svelte_store.js.map
  37. 185
      node_modules/.vite/deps/svelte_transition.js
  38. 7
      node_modules/.vite/deps/svelte_transition.js.map
  39. 1
      node_modules/.vite/processing/package.json
  40. 29
      node_modules/@ethersphere/bee-js/LICENSE
  41. 148
      node_modules/@ethersphere/bee-js/README.md
  42. 638
      node_modules/@ethersphere/bee-js/dist/cjs/bee-debug.js
  43. 977
      node_modules/@ethersphere/bee-js/dist/cjs/bee.js
  44. 55
      node_modules/@ethersphere/bee-js/dist/cjs/chunk/bmt.js
  45. 56
      node_modules/@ethersphere/bee-js/dist/cjs/chunk/cac.js
  46. 19
      node_modules/@ethersphere/bee-js/dist/cjs/chunk/serialize.js
  47. 137
      node_modules/@ethersphere/bee-js/dist/cjs/chunk/signer.js
  48. 172
      node_modules/@ethersphere/bee-js/dist/cjs/chunk/soc.js
  49. 29
      node_modules/@ethersphere/bee-js/dist/cjs/chunk/span.js
  50. 35
      node_modules/@ethersphere/bee-js/dist/cjs/feed/identifier.js
  51. 128
      node_modules/@ethersphere/bee-js/dist/cjs/feed/index.js
  52. 41
      node_modules/@ethersphere/bee-js/dist/cjs/feed/json.js
  53. 72
      node_modules/@ethersphere/bee-js/dist/cjs/feed/retrievable.js
  54. 25
      node_modules/@ethersphere/bee-js/dist/cjs/feed/topic.js
  55. 15
      node_modules/@ethersphere/bee-js/dist/cjs/feed/type.js
  56. 35
      node_modules/@ethersphere/bee-js/dist/cjs/index.js
  57. 74
      node_modules/@ethersphere/bee-js/dist/cjs/modules/bytes.js
  58. 131
      node_modules/@ethersphere/bee-js/dist/cjs/modules/bzz.js
  59. 58
      node_modules/@ethersphere/bee-js/dist/cjs/modules/chunk.js
  60. 77
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/balance.js
  61. 167
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/chequebook.js
  62. 51
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/chunk.js
  63. 75
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/connectivity.js
  64. 45
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/settlements.js
  65. 89
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/stamps.js
  66. 64
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/states.js
  67. 153
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/status.js
  68. 30
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/tag.js
  69. 81
      node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/transactions.js
  70. 76
      node_modules/@ethersphere/bee-js/dist/cjs/modules/feed.js
  71. 84
      node_modules/@ethersphere/bee-js/dist/cjs/modules/pinning.js
  72. 55
      node_modules/@ethersphere/bee-js/dist/cjs/modules/pss.js
  73. 40
      node_modules/@ethersphere/bee-js/dist/cjs/modules/soc.js
  74. 26
      node_modules/@ethersphere/bee-js/dist/cjs/modules/status.js
  75. 41
      node_modules/@ethersphere/bee-js/dist/cjs/modules/stewardship.js
  76. 96
      node_modules/@ethersphere/bee-js/dist/cjs/modules/tag.js
  77. 8
      node_modules/@ethersphere/bee-js/dist/cjs/package.json
  78. 10
      node_modules/@ethersphere/bee-js/dist/cjs/types/debug.js
  79. 47
      node_modules/@ethersphere/bee-js/dist/cjs/types/index.js
  80. 8
      node_modules/@ethersphere/bee-js/dist/cjs/types/ky-options.js
  81. 8
      node_modules/@ethersphere/bee-js/dist/cjs/types/ky-universal/common.js
  82. 8
      node_modules/@ethersphere/bee-js/dist/cjs/types/ky-universal/hooks.js
  83. 8
      node_modules/@ethersphere/bee-js/dist/cjs/types/ky-universal/retry.js
  84. 121
      node_modules/@ethersphere/bee-js/dist/cjs/utils/bytes.js
  85. 36
      node_modules/@ethersphere/bee-js/dist/cjs/utils/collection.browser.js
  86. 70
      node_modules/@ethersphere/bee-js/dist/cjs/utils/collection.js
  87. 115
      node_modules/@ethersphere/bee-js/dist/cjs/utils/collection.node.js
  88. 74
      node_modules/@ethersphere/bee-js/dist/cjs/utils/data.browser.js
  89. 58
      node_modules/@ethersphere/bee-js/dist/cjs/utils/data.js
  90. 50
      node_modules/@ethersphere/bee-js/dist/cjs/utils/error.js
  91. 211
      node_modules/@ethersphere/bee-js/dist/cjs/utils/eth.js
  92. 44
      node_modules/@ethersphere/bee-js/dist/cjs/utils/expose.js
  93. 49
      node_modules/@ethersphere/bee-js/dist/cjs/utils/file.js
  94. 21
      node_modules/@ethersphere/bee-js/dist/cjs/utils/hash.js
  95. 59
      node_modules/@ethersphere/bee-js/dist/cjs/utils/headers.js
  96. 150
      node_modules/@ethersphere/bee-js/dist/cjs/utils/hex.js
  97. 172
      node_modules/@ethersphere/bee-js/dist/cjs/utils/http.js
  98. 34
      node_modules/@ethersphere/bee-js/dist/cjs/utils/merge.js
  99. 18
      node_modules/@ethersphere/bee-js/dist/cjs/utils/pss.js
  100. 36
      node_modules/@ethersphere/bee-js/dist/cjs/utils/reference.js

1
node_modules/.bin/esbuild

@ -0,0 +1 @@
../esbuild/bin/esbuild

1
node_modules/.bin/nanoid

@ -0,0 +1 @@
../nanoid/bin/nanoid.cjs

1
node_modules/.bin/node-gyp-build

@ -0,0 +1 @@
../node-gyp-build/bin.js

1
node_modules/.bin/node-gyp-build-optional

@ -0,0 +1 @@
../node-gyp-build/optional.js

1
node_modules/.bin/node-gyp-build-test

@ -0,0 +1 @@
../node-gyp-build/build-test.js

1
node_modules/.bin/resolve

@ -0,0 +1 @@
../resolve/bin/resolve

1
node_modules/.bin/rollup

@ -0,0 +1 @@
../rollup/dist/bin/rollup

1
node_modules/.bin/semver

@ -0,0 +1 @@
../semver/bin/semver.js

1
node_modules/.bin/vite

@ -0,0 +1 @@
../vite/bin/vite.js

756
node_modules/.package-lock.json

@ -0,0 +1,756 @@
{
"name": "my-app",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/@ethersphere/bee-js": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-4.1.1.tgz",
"integrity": "sha512-4hbgi7rHnku+2pv352z7txV6IhP+2iipCKaQS4sOFhjieui44LE0Lox8gy5tud9tY2wRN2wY6LTqvo2EaYrVRQ==",
"dependencies": {
"@ethersphere/swarm-cid": "^0.1.0",
"@types/readable-stream": "^2.3.13",
"bufferutil": "^4.0.6",
"elliptic": "^6.5.4",
"fetch-blob": "2.1.2",
"isomorphic-ws": "^4.0.1",
"js-sha3": "^0.8.0",
"ky": "^0.25.1",
"ky-universal": "^0.8.2",
"semver": "^7.3.5",
"tar-js": "^0.3.0",
"utf-8-validate": "^5.0.9",
"web-streams-polyfill": "^4.0.0-beta.1",
"ws": "^8.6.0"
},
"engines": {
"bee": "1.6.0-6ceadd35",
"beeApiVersion": "3.0.1",
"beeDebugApiVersion": "2.0.1",
"node": ">=12.0.0",
"npm": ">=6.0.0"
}
},
"node_modules/@ethersphere/bee-js/node_modules/web-streams-polyfill": {
"version": "4.0.0-beta.3",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz",
"integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==",
"engines": {
"node": ">= 14"
}
},
"node_modules/@ethersphere/swarm-cid": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@ethersphere/swarm-cid/-/swarm-cid-0.1.0.tgz",
"integrity": "sha512-n+n+w5RJBPm7CiPf8TIgNFIRMo4bLh5bYpZxHObgCaxFW8WNZ4UGfqg+qjS/jEr+A3Mmp0lugKDvd8GnfFy7JQ==",
"dependencies": {
"multiformats": "^9.5.4"
},
"engines": {
"node": ">=12.0.0",
"npm": ">=6.0.0"
}
},
"node_modules/@rollup/pluginutils": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz",
"integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==",
"dev": true,
"dependencies": {
"estree-walker": "^2.0.1",
"picomatch": "^2.2.2"
},
"engines": {
"node": ">= 8.0.0"
}
},
"node_modules/@sveltejs/vite-plugin-svelte": {
"version": "1.0.0-next.49",
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.0-next.49.tgz",
"integrity": "sha512-AKh0Ka8EDgidnxWUs8Hh2iZLZovkETkefO99XxZ4sW4WGJ7VFeBx5kH/NIIGlaNHLcrIvK3CK0HkZwC3Cici0A==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "^4.2.1",
"debug": "^4.3.4",
"deepmerge": "^4.2.2",
"kleur": "^4.1.4",
"magic-string": "^0.26.2",
"svelte-hmr": "^0.14.12"
},
"engines": {
"node": "^14.13.1 || >= 16"
},
"peerDependencies": {
"diff-match-patch": "^1.0.5",
"svelte": "^3.44.0",
"vite": "^2.9.0"
},
"peerDependenciesMeta": {
"diff-match-patch": {
"optional": true
}
}
},
"node_modules/@types/node": {
"version": "18.0.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.3.tgz",
"integrity": "sha512-HzNRZtp4eepNitP+BD6k2L6DROIDG4Q0fm4x+dwfsr6LGmROENnok75VGw40628xf+iR24WeMFcHuuBDUAzzsQ=="
},
"node_modules/@types/readable-stream": {
"version": "2.3.13",
"resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-2.3.13.tgz",
"integrity": "sha512-4JSCx8EUzaW9Idevt+9lsRAt1lcSccoQfE+AouM1gk8sFxnnytKNIO3wTl9Dy+4m6jRJ1yXhboLHHT/LXBQiEw==",
"dependencies": {
"@types/node": "*",
"safe-buffer": "*"
}
},
"node_modules/abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"dependencies": {
"event-target-shim": "^5.0.0"
},
"engines": {
"node": ">=6.5"
}
},
"node_modules/axios": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz",
"integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==",
"dependencies": {
"follow-redirects": "^1.14.7"
}
},
"node_modules/bn.js": {
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
"integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
},
"node_modules/brorand": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
"integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w=="
},
"node_modules/bufferutil": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz",
"integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==",
"hasInstallScript": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
},
"engines": {
"node": ">=6.14.2"
}
},
"node_modules/data-uri-to-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz",
"integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==",
"engines": {
"node": ">= 6"
}
},
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/deepmerge": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
"integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/elliptic": {
"version": "6.5.4",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
"integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
"dependencies": {
"bn.js": "^4.11.9",
"brorand": "^1.1.0",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.1",
"inherits": "^2.0.4",
"minimalistic-assert": "^1.0.1",
"minimalistic-crypto-utils": "^1.0.1"
}
},
"node_modules/esbuild": {
"version": "0.14.47",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.47.tgz",
"integrity": "sha512-wI4ZiIfFxpkuxB8ju4MHrGwGLyp1+awEHAHVpx6w7a+1pmYIq8T9FGEVVwFo0iFierDoMj++Xq69GXWYn2EiwA==",
"dev": true,
"hasInstallScript": true,
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=12"
},
"optionalDependencies": {
"esbuild-android-64": "0.14.47",
"esbuild-android-arm64": "0.14.47",
"esbuild-darwin-64": "0.14.47",
"esbuild-darwin-arm64": "0.14.47",
"esbuild-freebsd-64": "0.14.47",
"esbuild-freebsd-arm64": "0.14.47",
"esbuild-linux-32": "0.14.47",
"esbuild-linux-64": "0.14.47",
"esbuild-linux-arm": "0.14.47",
"esbuild-linux-arm64": "0.14.47",
"esbuild-linux-mips64le": "0.14.47",
"esbuild-linux-ppc64le": "0.14.47",
"esbuild-linux-riscv64": "0.14.47",
"esbuild-linux-s390x": "0.14.47",
"esbuild-netbsd-64": "0.14.47",
"esbuild-openbsd-64": "0.14.47",
"esbuild-sunos-64": "0.14.47",
"esbuild-windows-32": "0.14.47",
"esbuild-windows-64": "0.14.47",
"esbuild-windows-arm64": "0.14.47"
}
},
"node_modules/esbuild-linux-64": {
"version": "0.14.47",
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.47.tgz",
"integrity": "sha512-nFNOk9vWVfvWYF9YNYksZptgQAdstnDCMtR6m42l5Wfugbzu11VpMCY9XrD4yFxvPo9zmzcoUL/88y0lfJZJJw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
},
"node_modules/event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
"engines": {
"node": ">=6"
}
},
"node_modules/fetch-blob": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-2.1.2.tgz",
"integrity": "sha512-YKqtUDwqLyfyMnmbw8XD6Q8j9i/HggKtPEI+pZ1+8bvheBu78biSmNaXWusx1TauGqtUUGx/cBb1mKdq2rLYow==",
"engines": {
"node": "^10.17.0 || >=12.3.0"
},
"peerDependenciesMeta": {
"domexception": {
"optional": true
}
}
},
"node_modules/follow-redirects": {
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz",
"integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
},
"node_modules/has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"dependencies": {
"function-bind": "^1.1.1"
},
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/hash.js": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
"integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
"dependencies": {
"inherits": "^2.0.3",
"minimalistic-assert": "^1.0.1"
}
},
"node_modules/hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
"integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==",
"dependencies": {
"hash.js": "^1.0.3",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.1"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/is-core-module": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
"dev": true,
"dependencies": {
"has": "^1.0.3"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/isomorphic-ws": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz",
"integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==",
"peerDependencies": {
"ws": "*"
}
},
"node_modules/js-sha3": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz",
"integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q=="
},
"node_modules/kleur": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz",
"integrity": "sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/ky": {
"version": "0.25.1",
"resolved": "https://registry.npmjs.org/ky/-/ky-0.25.1.tgz",
"integrity": "sha512-PjpCEWlIU7VpiMVrTwssahkYXX1by6NCT0fhTUX34F3DTinARlgMpriuroolugFPcMgpPWrOW4mTb984Qm1RXA==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sindresorhus/ky?sponsor=1"
}
},
"node_modules/ky-universal": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/ky-universal/-/ky-universal-0.8.2.tgz",
"integrity": "sha512-xe0JaOH9QeYxdyGLnzUOVGK4Z6FGvDVzcXFTdrYA1f33MZdEa45sUDaMBy98xQMcsd2XIBrTXRrRYnegcSdgVQ==",
"dependencies": {
"abort-controller": "^3.0.0",
"node-fetch": "3.0.0-beta.9"
},
"engines": {
"node": ">=10.17"
},
"funding": {
"url": "https://github.com/sindresorhus/ky-universal?sponsor=1"
},
"peerDependencies": {
"ky": ">=0.17.0",
"web-streams-polyfill": ">=2.0.0"
},
"peerDependenciesMeta": {
"web-streams-polyfill": {
"optional": true
}
}
},
"node_modules/leaflet": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.8.0.tgz",
"integrity": "sha512-gwhMjFCQiYs3x/Sf+d49f10ERXaEFCPr+nVTryhAW8DWbMGqJqt9G4XuIaHmFW08zYvhgdzqXGr8AlW8v8dQkA=="
},
"node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/magic-string": {
"version": "0.26.2",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.2.tgz",
"integrity": "sha512-NzzlXpclt5zAbmo6h6jNc8zl2gNRGHvmsZW4IvZhTC4W7k4OlLP+S5YLussa/r3ixNT66KOQfNORlXHSOy/X4A==",
"dev": true,
"dependencies": {
"sourcemap-codec": "^1.4.8"
},
"engines": {
"node": ">=12"
}
},
"node_modules/minimalistic-assert": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
"integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
},
"node_modules/minimalistic-crypto-utils": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
"integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg=="
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"node_modules/multiformats": {
"version": "9.7.0",
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.7.0.tgz",
"integrity": "sha512-uv/tcgwk0yN4DStopnBN4GTgvaAlYdy6KnZpuzEPFOYQd71DYFJjs0MN1ERElAflrZaYyGBWXyGxL5GgrxIx0Q=="
},
"node_modules/nanoid": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
"dev": true,
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/node-fetch": {
"version": "3.0.0-beta.9",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0-beta.9.tgz",
"integrity": "sha512-RdbZCEynH2tH46+tj0ua9caUHVWrd/RHnRfvly2EVdqGmI3ndS1Vn/xjm5KuGejDt2RNDQsVRLPNd2QPwcewVg==",
"dependencies": {
"data-uri-to-buffer": "^3.0.1",
"fetch-blob": "^2.1.1"
},
"engines": {
"node": "^10.17 || >=12.3"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-fetch"
}
},
"node_modules/node-gyp-build": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz",
"integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==",
"bin": {
"node-gyp-build": "bin.js",
"node-gyp-build-optional": "optional.js",
"node-gyp-build-test": "build-test.js"
}
},
"node_modules/path-parse": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
"node_modules/picocolors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
"dev": true
},
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/postcss": {
"version": "8.4.14",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz",
"integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss"
}
],
"dependencies": {
"nanoid": "^3.3.4",
"picocolors": "^1.0.0",
"source-map-js": "^1.0.2"
},
"engines": {
"node": "^10 || ^12 || >=14"
}
},
"node_modules/resolve": {
"version": "1.22.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
"dev": true,
"dependencies": {
"is-core-module": "^2.9.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
},
"bin": {
"resolve": "bin/resolve"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/rollup": {
"version": "2.75.7",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.7.tgz",
"integrity": "sha512-VSE1iy0eaAYNCxEXaleThdFXqZJ42qDBatAwrfnPlENEZ8erQ+0LYX4JXOLPceWfZpV1VtZwZ3dFCuOZiSyFtQ==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
},
"engines": {
"node": ">=10.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
},
"node_modules/semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/sourcemap-codec": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
"dev": true
},
"node_modules/supports-preserve-symlinks-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true,
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/svelte": {
"version": "3.48.0",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.48.0.tgz",
"integrity": "sha512-fN2YRm/bGumvjUpu6yI3BpvZnpIm9I6A7HR4oUNYd7ggYyIwSA/BX7DJ+UXXffLp6XNcUijyLvttbPVCYa/3xQ==",
"dev": true,
"engines": {
"node": ">= 8"
}
},
"node_modules/svelte-hmr": {
"version": "0.14.12",
"resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.14.12.tgz",
"integrity": "sha512-4QSW/VvXuqVcFZ+RhxiR8/newmwOCTlbYIezvkeN6302YFRE8cXy0naamHcjz8Y9Ce3ITTZtrHrIL0AGfyo61w==",
"dev": true,
"engines": {
"node": "^12.20 || ^14.13.1 || >= 16"
},
"peerDependencies": {
"svelte": ">=3.19.0"
}
},
"node_modules/svelte-leafletjs": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/svelte-leafletjs/-/svelte-leafletjs-0.9.0.tgz",
"integrity": "sha512-jJm/RTRjBfas9ofQ2906hOtYDDXaLef05t8QU/SIE57DPEvpcYNE2WoHkcw4695DLD5XoLfsR4w+1/EOTItayw==",
"dependencies": {
"axios": "^0.25.0",
"leaflet": "^1.7.1"
}
},
"node_modules/tar-js": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/tar-js/-/tar-js-0.3.0.tgz",
"integrity": "sha512-9uqP2hJUZNKRkwPDe5nXxXdzo6w+BFBPq9x/tyi5/U/DneuSesO/HMb0y5TeWpfcv49YDJTs7SrrZeeu8ZHWDA==",
"engines": {
"node": "*"
}
},
"node_modules/utf-8-validate": {
"version": "5.0.9",
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.9.tgz",
"integrity": "sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q==",
"hasInstallScript": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
},
"engines": {
"node": ">=6.14.2"
}
},
"node_modules/vite": {
"version": "2.9.12",
"resolved": "https://registry.npmjs.org/vite/-/vite-2.9.12.tgz",
"integrity": "sha512-suxC36dQo9Rq1qMB2qiRorNJtJAdxguu5TMvBHOc/F370KvqAe9t48vYp+/TbPKRNrMh/J55tOUmkuIqstZaew==",
"dev": true,
"dependencies": {
"esbuild": "^0.14.27",
"postcss": "^8.4.13",
"resolve": "^1.22.0",
"rollup": "^2.59.0"
},
"bin": {
"vite": "bin/vite.js"
},
"engines": {
"node": ">=12.2.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
},
"peerDependencies": {
"less": "*",
"sass": "*",
"stylus": "*"
},
"peerDependenciesMeta": {
"less": {
"optional": true
},
"sass": {
"optional": true
},
"stylus": {
"optional": true
}
}
},
"node_modules/web-streams-polyfill": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",
"integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==",
"optional": true,
"peer": true,
"engines": {
"node": ">= 8"
}
},
"node_modules/ws": {
"version": "8.8.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz",
"integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
}

74
node_modules/.vite/deps/_metadata.json

@ -0,0 +1,74 @@
{
"hash": "fc086e51",
"browserHash": "f29f54a1",
"optimized": {
"svelte/animate": {
"src": "../../svelte/animate/index.mjs",
"file": "svelte_animate.js",
"fileHash": "39494f16",
"needsInterop": false
},
"svelte/easing": {
"src": "../../svelte/easing/index.mjs",
"file": "svelte_easing.js",
"fileHash": "a80bed56",
"needsInterop": false
},
"svelte/internal": {
"src": "../../svelte/internal/index.mjs",
"file": "svelte_internal.js",
"fileHash": "e65bd5a5",
"needsInterop": false
},
"svelte/motion": {
"src": "../../svelte/motion/index.mjs",
"file": "svelte_motion.js",
"fileHash": "f7dcfd4f",
"needsInterop": false
},
"svelte/store": {
"src": "../../svelte/store/index.mjs",
"file": "svelte_store.js",
"fileHash": "317f401f",
"needsInterop": false
},
"svelte/transition": {
"src": "../../svelte/transition/index.mjs",
"file": "svelte_transition.js",
"fileHash": "98bc4e8d",
"needsInterop": false
},
"svelte": {
"src": "../../svelte/index.mjs",
"file": "svelte.js",
"fileHash": "eb17b5c1",
"needsInterop": false
},
"svelte-leafletjs > axios": {
"src": "../../axios/index.js",
"file": "svelte-leafletjs__axios.js",
"fileHash": "af515673",
"needsInterop": true
},
"svelte-leafletjs > leaflet": {
"src": "../../leaflet/dist/leaflet-src.js",
"file": "svelte-leafletjs__leaflet.js",
"fileHash": "e3c379a0",
"needsInterop": true
}
},
"chunks": {
"chunk-V5ZN2RMD": {
"file": "chunk-V5ZN2RMD.js"
},
"chunk-V3UMKGYM": {
"file": "chunk-V3UMKGYM.js"
},
"chunk-ENZLGVI2": {
"file": "chunk-ENZLGVI2.js"
},
"chunk-RSJERJUL": {
"file": "chunk-RSJERJUL.js"
}
}
}

2100
node_modules/.vite/deps/chunk-ENZLGVI2.js
File diff suppressed because it is too large
View File

7
node_modules/.vite/deps/chunk-ENZLGVI2.js.map
File diff suppressed because one or more lines are too long
View File

9
node_modules/.vite/deps/chunk-RSJERJUL.js

@ -0,0 +1,9 @@
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
export {
__commonJS
};
//# sourceMappingURL=chunk-RSJERJUL.js.map

7
node_modules/.vite/deps/chunk-RSJERJUL.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

150
node_modules/.vite/deps/chunk-V3UMKGYM.js

@ -0,0 +1,150 @@
// node_modules/svelte/easing/index.mjs
function backInOut(t) {
const s = 1.70158 * 1.525;
if ((t *= 2) < 1)
return 0.5 * (t * t * ((s + 1) * t - s));
return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2);
}
function backIn(t) {
const s = 1.70158;
return t * t * ((s + 1) * t - s);
}
function backOut(t) {
const s = 1.70158;
return --t * t * ((s + 1) * t + s) + 1;
}
function bounceOut(t) {
const a = 4 / 11;
const b = 8 / 11;
const c = 9 / 10;
const ca = 4356 / 361;
const cb = 35442 / 1805;
const cc = 16061 / 1805;
const t2 = t * t;
return t < a ? 7.5625 * t2 : t < b ? 9.075 * t2 - 9.9 * t + 3.4 : t < c ? ca * t2 - cb * t + cc : 10.8 * t * t - 20.52 * t + 10.72;
}
function bounceInOut(t) {
return t < 0.5 ? 0.5 * (1 - bounceOut(1 - t * 2)) : 0.5 * bounceOut(t * 2 - 1) + 0.5;
}
function bounceIn(t) {
return 1 - bounceOut(1 - t);
}
function circInOut(t) {
if ((t *= 2) < 1)
return -0.5 * (Math.sqrt(1 - t * t) - 1);
return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
}
function circIn(t) {
return 1 - Math.sqrt(1 - t * t);
}
function circOut(t) {
return Math.sqrt(1 - --t * t);
}
function cubicInOut(t) {
return t < 0.5 ? 4 * t * t * t : 0.5 * Math.pow(2 * t - 2, 3) + 1;
}
function cubicIn(t) {
return t * t * t;
}
function cubicOut(t) {
const f = t - 1;
return f * f * f + 1;
}
function elasticInOut(t) {
return t < 0.5 ? 0.5 * Math.sin(13 * Math.PI / 2 * 2 * t) * Math.pow(2, 10 * (2 * t - 1)) : 0.5 * Math.sin(-13 * Math.PI / 2 * (2 * t - 1 + 1)) * Math.pow(2, -10 * (2 * t - 1)) + 1;
}
function elasticIn(t) {
return Math.sin(13 * t * Math.PI / 2) * Math.pow(2, 10 * (t - 1));
}
function elasticOut(t) {
return Math.sin(-13 * (t + 1) * Math.PI / 2) * Math.pow(2, -10 * t) + 1;
}
function expoInOut(t) {
return t === 0 || t === 1 ? t : t < 0.5 ? 0.5 * Math.pow(2, 20 * t - 10) : -0.5 * Math.pow(2, 10 - t * 20) + 1;
}
function expoIn(t) {
return t === 0 ? t : Math.pow(2, 10 * (t - 1));
}
function expoOut(t) {
return t === 1 ? t : 1 - Math.pow(2, -10 * t);
}
function quadInOut(t) {
t /= 0.5;
if (t < 1)
return 0.5 * t * t;
t--;
return -0.5 * (t * (t - 2) - 1);
}
function quadIn(t) {
return t * t;
}
function quadOut(t) {
return -t * (t - 2);
}
function quartInOut(t) {
return t < 0.5 ? 8 * Math.pow(t, 4) : -8 * Math.pow(t - 1, 4) + 1;
}
function quartIn(t) {
return Math.pow(t, 4);
}
function quartOut(t) {
return Math.pow(t - 1, 3) * (1 - t) + 1;
}
function quintInOut(t) {
if ((t *= 2) < 1)
return 0.5 * t * t * t * t * t;
return 0.5 * ((t -= 2) * t * t * t * t + 2);
}
function quintIn(t) {
return t * t * t * t * t;
}
function quintOut(t) {
return --t * t * t * t * t + 1;
}
function sineInOut(t) {
return -0.5 * (Math.cos(Math.PI * t) - 1);
}
function sineIn(t) {
const v = Math.cos(t * Math.PI * 0.5);
if (Math.abs(v) < 1e-14)
return 1;
else
return 1 - v;
}
function sineOut(t) {
return Math.sin(t * Math.PI / 2);
}
export {
backInOut,
backIn,
backOut,
bounceOut,
bounceInOut,
bounceIn,
circInOut,
circIn,
circOut,
cubicInOut,
cubicIn,
cubicOut,
elasticInOut,
elasticIn,
elasticOut,
expoInOut,
expoIn,
expoOut,
quadInOut,
quadIn,
quadOut,
quartInOut,
quartIn,
quartOut,
quintInOut,
quintIn,
quintOut,
sineInOut,
sineIn,
sineOut
};
//# sourceMappingURL=chunk-V3UMKGYM.js.map

7
node_modules/.vite/deps/chunk-V3UMKGYM.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../svelte/easing/index.mjs"],
"sourcesContent": ["export { identity as linear } from '../internal/index.mjs';\n\n/*\nAdapted from https://github.com/mattdesl\nDistributed under MIT License https://github.com/mattdesl/eases/blob/master/LICENSE.md\n*/\nfunction backInOut(t) {\n const s = 1.70158 * 1.525;\n if ((t *= 2) < 1)\n return 0.5 * (t * t * ((s + 1) * t - s));\n return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2);\n}\nfunction backIn(t) {\n const s = 1.70158;\n return t * t * ((s + 1) * t - s);\n}\nfunction backOut(t) {\n const s = 1.70158;\n return --t * t * ((s + 1) * t + s) + 1;\n}\nfunction bounceOut(t) {\n const a = 4.0 / 11.0;\n const b = 8.0 / 11.0;\n const c = 9.0 / 10.0;\n const ca = 4356.0 / 361.0;\n const cb = 35442.0 / 1805.0;\n const cc = 16061.0 / 1805.0;\n const t2 = t * t;\n return t < a\n ? 7.5625 * t2\n : t < b\n ? 9.075 * t2 - 9.9 * t + 3.4\n : t < c\n ? ca * t2 - cb * t + cc\n : 10.8 * t * t - 20.52 * t + 10.72;\n}\nfunction bounceInOut(t) {\n return t < 0.5\n ? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0))\n : 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5;\n}\nfunction bounceIn(t) {\n return 1.0 - bounceOut(1.0 - t);\n}\nfunction circInOut(t) {\n if ((t *= 2) < 1)\n return -0.5 * (Math.sqrt(1 - t * t) - 1);\n return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);\n}\nfunction circIn(t) {\n return 1.0 - Math.sqrt(1.0 - t * t);\n}\nfunction circOut(t) {\n return Math.sqrt(1 - --t * t);\n}\nfunction cubicInOut(t) {\n return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0;\n}\nfunction cubicIn(t) {\n return t * t * t;\n}\nfunction cubicOut(t) {\n const f = t - 1.0;\n return f * f * f + 1.0;\n}\nfunction elasticInOut(t) {\n return t < 0.5\n ? 0.5 *\n Math.sin(((+13.0 * Math.PI) / 2) * 2.0 * t) *\n Math.pow(2.0, 10.0 * (2.0 * t - 1.0))\n : 0.5 *\n Math.sin(((-13.0 * Math.PI) / 2) * (2.0 * t - 1.0 + 1.0)) *\n Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) +\n 1.0;\n}\nfunction elasticIn(t) {\n return Math.sin((13.0 * t * Math.PI) / 2) * Math.pow(2.0, 10.0 * (t - 1.0));\n}\nfunction elasticOut(t) {\n return (Math.sin((-13.0 * (t + 1.0) * Math.PI) / 2) * Math.pow(2.0, -10.0 * t) + 1.0);\n}\nfunction expoInOut(t) {\n return t === 0.0 || t === 1.0\n ? t\n : t < 0.5\n ? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)\n : -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;\n}\nfunction expoIn(t) {\n return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0));\n}\nfunction expoOut(t) {\n return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t);\n}\nfunction quadInOut(t) {\n t /= 0.5;\n if (t < 1)\n return 0.5 * t * t;\n t--;\n return -0.5 * (t * (t - 2) - 1);\n}\nfunction quadIn(t) {\n return t * t;\n}\nfunction quadOut(t) {\n return -t * (t - 2.0);\n}\nfunction quartInOut(t) {\n return t < 0.5\n ? +8.0 * Math.pow(t, 4.0)\n : -8.0 * Math.pow(t - 1.0, 4.0) + 1.0;\n}\nfunction quartIn(t) {\n return Math.pow(t, 4.0);\n}\nfunction quartOut(t) {\n return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0;\n}\nfunction quintInOut(t) {\n if ((t *= 2) < 1)\n return 0.5 * t * t * t * t * t;\n return 0.5 * ((t -= 2) * t * t * t * t + 2);\n}\nfunction quintIn(t) {\n return t * t * t * t * t;\n}\nfunction quintOut(t) {\n return --t * t * t * t * t + 1;\n}\nfunction sineInOut(t) {\n return -0.5 * (Math.cos(Math.PI * t) - 1);\n}\nfunction sineIn(t) {\n const v = Math.cos(t * Math.PI * 0.5);\n if (Math.abs(v) < 1e-14)\n return 1;\n else\n return 1 - v;\n}\nfunction sineOut(t) {\n return Math.sin((t * Math.PI) / 2);\n}\n\nexport { backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, cubicIn, cubicInOut, cubicOut, elasticIn, elasticInOut, elasticOut, expoIn, expoInOut, expoOut, quadIn, quadInOut, quadOut, quartIn, quartInOut, quartOut, quintIn, quintInOut, quintOut, sineIn, sineInOut, sineOut };\n"],
"mappings": ";AAMA,mBAAmB,GAAG;AAClB,QAAM,IAAI,UAAU;AACpB,MAAK,MAAK,KAAK;AACX,WAAO,MAAO,KAAI,IAAM,MAAI,KAAK,IAAI;AACzC,SAAO,MAAQ,OAAK,KAAK,IAAM,MAAI,KAAK,IAAI,KAAK;AACrD;AACA,gBAAgB,GAAG;AACf,QAAM,IAAI;AACV,SAAO,IAAI,IAAM,MAAI,KAAK,IAAI;AAClC;AACA,iBAAiB,GAAG;AAChB,QAAM,IAAI;AACV,SAAO,EAAE,IAAI,IAAM,MAAI,KAAK,IAAI,KAAK;AACzC;AACA,mBAAmB,GAAG;AAClB,QAAM,IAAI,IAAM;AAChB,QAAM,IAAI,IAAM;AAChB,QAAM,IAAI,IAAM;AAChB,QAAM,KAAK,OAAS;AACpB,QAAM,KAAK,QAAU;AACrB,QAAM,KAAK,QAAU;AACrB,QAAM,KAAK,IAAI;AACf,SAAO,IAAI,IACL,SAAS,KACT,IAAI,IACA,QAAQ,KAAK,MAAM,IAAI,MACvB,IAAI,IACA,KAAK,KAAK,KAAK,IAAI,KACnB,OAAO,IAAI,IAAI,QAAQ,IAAI;AAC7C;AACA,qBAAqB,GAAG;AACpB,SAAO,IAAI,MACL,MAAO,KAAM,UAAU,IAAM,IAAI,CAAG,KACpC,MAAM,UAAU,IAAI,IAAM,CAAG,IAAI;AAC3C;AACA,kBAAkB,GAAG;AACjB,SAAO,IAAM,UAAU,IAAM,CAAC;AAClC;AACA,mBAAmB,GAAG;AAClB,MAAK,MAAK,KAAK;AACX,WAAO,OAAQ,MAAK,KAAK,IAAI,IAAI,CAAC,IAAI;AAC1C,SAAO,MAAO,MAAK,KAAK,IAAK,MAAK,KAAK,CAAC,IAAI;AAChD;AACA,gBAAgB,GAAG;AACf,SAAO,IAAM,KAAK,KAAK,IAAM,IAAI,CAAC;AACtC;AACA,iBAAiB,GAAG;AAChB,SAAO,KAAK,KAAK,IAAI,EAAE,IAAI,CAAC;AAChC;AACA,oBAAoB,GAAG;AACnB,SAAO,IAAI,MAAM,IAAM,IAAI,IAAI,IAAI,MAAM,KAAK,IAAI,IAAM,IAAI,GAAK,CAAG,IAAI;AAC5E;AACA,iBAAiB,GAAG;AAChB,SAAO,IAAI,IAAI;AACnB;AACA,kBAAkB,GAAG;AACjB,QAAM,IAAI,IAAI;AACd,SAAO,IAAI,IAAI,IAAI;AACvB;AACA,sBAAsB,GAAG;AACrB,SAAO,IAAI,MACL,MACE,KAAK,IAAM,KAAQ,KAAK,KAAM,IAAK,IAAM,CAAC,IAC1C,KAAK,IAAI,GAAK,KAAQ,KAAM,IAAI,EAAI,IACtC,MACE,KAAK,IAAM,MAAQ,KAAK,KAAM,IAAM,KAAM,IAAI,IAAM,EAAI,IACxD,KAAK,IAAI,GAAK,MAAS,KAAM,IAAI,EAAI,IACrC;AACZ;AACA,mBAAmB,GAAG;AAClB,SAAO,KAAK,IAAK,KAAO,IAAI,KAAK,KAAM,CAAC,IAAI,KAAK,IAAI,GAAK,KAAQ,KAAI,EAAI;AAC9E;AACA,oBAAoB,GAAG;AACnB,SAAQ,KAAK,IAAK,MAAS,KAAI,KAAO,KAAK,KAAM,CAAC,IAAI,KAAK,IAAI,GAAK,MAAQ,CAAC,IAAI;AACrF;AACA,mBAAmB,GAAG;AAClB,SAAO,MAAM,KAAO,MAAM,IACpB,IACA,IAAI,MACA,MAAO,KAAK,IAAI,GAAK,KAAO,IAAI,EAAI,IACpC,OAAO,KAAK,IAAI,GAAK,KAAO,IAAI,EAAI,IAAI;AACtD;AACA,gBAAgB,GAAG;AACf,SAAO,MAAM,IAAM,IAAI,KAAK,IAAI,GAAK,KAAQ,KAAI,EAAI;AACzD;AACA,iBAAiB,GAAG;AAChB,SAAO,MAAM,IAAM,IAAI,IAAM,KAAK,IAAI,GAAK,MAAQ,CAAC;AACxD;AACA,mBAAmB,GAAG;AAClB,OAAK;AACL,MAAI,IAAI;AACJ,WAAO,MAAM,IAAI;AACrB;AACA,SAAO,OAAQ,KAAK,KAAI,KAAK;AACjC;AACA,gBAAgB,GAAG;AACf,SAAO,IAAI;AACf;AACA,iBAAiB,GAAG;AAChB,SAAO,CAAC,IAAK,KAAI;AACrB;AACA,oBAAoB,GAAG;AACnB,SAAO,IAAI,MACL,IAAO,KAAK,IAAI,GAAG,CAAG,IACtB,KAAO,KAAK,IAAI,IAAI,GAAK,CAAG,IAAI;AAC1C;AACA,iBAAiB,GAAG;AAChB,SAAO,KAAK,IAAI,GAAG,CAAG;AAC1B;AACA,kBAAkB,GAAG;AACjB,SAAO,KAAK,IAAI,IAAI,GAAK,CAAG,IAAK,KAAM,KAAK;AAChD;AACA,oBAAoB,GAAG;AACnB,MAAK,MAAK,KAAK;AACX,WAAO,MAAM,IAAI,IAAI,IAAI,IAAI;AACjC,SAAO,MAAQ,OAAK,KAAK,IAAI,IAAI,IAAI,IAAI;AAC7C;AACA,iBAAiB,GAAG;AAChB,SAAO,IAAI,IAAI,IAAI,IAAI;AAC3B;AACA,kBAAkB,GAAG;AACjB,SAAO,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI;AACjC;AACA,mBAAmB,GAAG;AAClB,SAAO,OAAQ,MAAK,IAAI,KAAK,KAAK,CAAC,IAAI;AAC3C;AACA,gBAAgB,GAAG;AACf,QAAM,IAAI,KAAK,IAAI,IAAI,KAAK,KAAK,GAAG;AACpC,MAAI,KAAK,IAAI,CAAC,IAAI;AACd,WAAO;AAAA;AAEP,WAAO,IAAI;AACnB;AACA,iBAAiB,GAAG;AAChB,SAAO,KAAK,IAAK,IAAI,KAAK,KAAM,CAAC;AACrC;",
"names": []
}

101
node_modules/.vite/deps/chunk-V5ZN2RMD.js

@ -0,0 +1,101 @@
import {
is_function,
noop,
run_all,
safe_not_equal,
subscribe
} from "./chunk-ENZLGVI2.js";
// node_modules/svelte/store/index.mjs
var subscriber_queue = [];
function readable(value, start) {
return {
subscribe: writable(value, start).subscribe
};
}
function writable(value, start = noop) {
let stop;
const subscribers = /* @__PURE__ */ new Set();
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
function update(fn) {
set(fn(value));
}
function subscribe2(run, invalidate = noop) {
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set) || noop;
}
run(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0) {
stop();
stop = null;
}
};
}
return { set, update, subscribe: subscribe2 };
}
function derived(stores, fn, initial_value) {
const single = !Array.isArray(stores);
const stores_array = single ? [stores] : stores;
const auto = fn.length < 2;
return readable(initial_value, (set) => {
let inited = false;
const values = [];
let pending = 0;
let cleanup = noop;
const sync = () => {
if (pending) {
return;
}
cleanup();
const result = fn(single ? values[0] : values, set);
if (auto) {
set(result);
} else {
cleanup = is_function(result) ? result : noop;
}
};
const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {
values[i] = value;
pending &= ~(1 << i);
if (inited) {
sync();
}
}, () => {
pending |= 1 << i;
}));
inited = true;
sync();
return function stop() {
run_all(unsubscribers);
cleanup();
};
});
}
export {
readable,
writable,
derived
};
//# sourceMappingURL=chunk-V5ZN2RMD.js.map

7
node_modules/.vite/deps/chunk-V5ZN2RMD.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../svelte/store/index.mjs"],
"sourcesContent": ["import { noop, safe_not_equal, subscribe, run_all, is_function } from '../internal/index.mjs';\nexport { get_store_value as get } from '../internal/index.mjs';\n\nconst subscriber_queue = [];\n/**\n * Creates a `Readable` store that allows reading by subscription.\n * @param value initial value\n * @param {StartStopNotifier}start start and stop notifications for subscriptions\n */\nfunction readable(value, start) {\n return {\n subscribe: writable(value, start).subscribe\n };\n}\n/**\n * Create a `Writable` store that allows both updating and reading by subscription.\n * @param {*=}value initial value\n * @param {StartStopNotifier=}start start and stop notifications for subscriptions\n */\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) { // store is ready\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe(run, invalidate = noop) {\n const subscriber = [run, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set) || noop;\n }\n run(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe };\n}\nfunction derived(stores, fn, initial_value) {\n const single = !Array.isArray(stores);\n const stores_array = single\n ? [stores]\n : stores;\n const auto = fn.length < 2;\n return readable(initial_value, (set) => {\n let inited = false;\n const values = [];\n let pending = 0;\n let cleanup = noop;\n const sync = () => {\n if (pending) {\n return;\n }\n cleanup();\n const result = fn(single ? values[0] : values, set);\n if (auto) {\n set(result);\n }\n else {\n cleanup = is_function(result) ? result : noop;\n }\n };\n const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {\n values[i] = value;\n pending &= ~(1 << i);\n if (inited) {\n sync();\n }\n }, () => {\n pending |= (1 << i);\n }));\n inited = true;\n sync();\n return function stop() {\n run_all(unsubscribers);\n cleanup();\n };\n });\n}\n\nexport { derived, readable, writable };\n"],
"mappings": ";;;;;;;;;AAGA,IAAM,mBAAmB,CAAC;AAM1B,kBAAkB,OAAO,OAAO;AAC5B,SAAO;AAAA,IACH,WAAW,SAAS,OAAO,KAAK,EAAE;AAAA,EACtC;AACJ;AAMA,kBAAkB,OAAO,QAAQ,MAAM;AACnC,MAAI;AACJ,QAAM,cAAc,oBAAI,IAAI;AAC5B,eAAa,WAAW;AACpB,QAAI,eAAe,OAAO,SAAS,GAAG;AAClC,cAAQ;AACR,UAAI,MAAM;AACN,cAAM,YAAY,CAAC,iBAAiB;AACpC,mBAAW,cAAc,aAAa;AAClC,qBAAW,GAAG;AACd,2BAAiB,KAAK,YAAY,KAAK;AAAA,QAC3C;AACA,YAAI,WAAW;AACX,mBAAS,IAAI,GAAG,IAAI,iBAAiB,QAAQ,KAAK,GAAG;AACjD,6BAAiB,GAAG,GAAG,iBAAiB,IAAI,EAAE;AAAA,UAClD;AACA,2BAAiB,SAAS;AAAA,QAC9B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACA,kBAAgB,IAAI;AAChB,QAAI,GAAG,KAAK,CAAC;AAAA,EACjB;AACA,sBAAmB,KAAK,aAAa,MAAM;AACvC,UAAM,aAAa,CAAC,KAAK,UAAU;AACnC,gBAAY,IAAI,UAAU;AAC1B,QAAI,YAAY,SAAS,GAAG;AACxB,aAAO,MAAM,GAAG,KAAK;AAAA,IACzB;AACA,QAAI,KAAK;AACT,WAAO,MAAM;AACT,kBAAY,OAAO,UAAU;AAC7B,UAAI,YAAY,SAAS,GAAG;AACxB,aAAK;AACL,eAAO;AAAA,MACX;AAAA,IACJ;AAAA,EACJ;AACA,SAAO,EAAE,KAAK,QAAQ,sBAAU;AACpC;AACA,iBAAiB,QAAQ,IAAI,eAAe;AACxC,QAAM,SAAS,CAAC,MAAM,QAAQ,MAAM;AACpC,QAAM,eAAe,SACf,CAAC,MAAM,IACP;AACN,QAAM,OAAO,GAAG,SAAS;AACzB,SAAO,SAAS,eAAe,CAAC,QAAQ;AACpC,QAAI,SAAS;AACb,UAAM,SAAS,CAAC;AAChB,QAAI,UAAU;AACd,QAAI,UAAU;AACd,UAAM,OAAO,MAAM;AACf,UAAI,SAAS;AACT;AAAA,MACJ;AACA,cAAQ;AACR,YAAM,SAAS,GAAG,SAAS,OAAO,KAAK,QAAQ,GAAG;AAClD,UAAI,MAAM;AACN,YAAI,MAAM;AAAA,MACd,OACK;AACD,kBAAU,YAAY,MAAM,IAAI,SAAS;AAAA,MAC7C;AAAA,IACJ;AACA,UAAM,gBAAgB,aAAa,IAAI,CAAC,OAAO,MAAM,UAAU,OAAO,CAAC,UAAU;AAC7E,aAAO,KAAK;AACZ,iBAAW,CAAE,MAAK;AAClB,UAAI,QAAQ;AACR,aAAK;AAAA,MACT;AAAA,IACJ,GAAG,MAAM;AACL,iBAAY,KAAK;AAAA,IACrB,CAAC,CAAC;AACF,aAAS;AACT,SAAK;AACL,WAAO,gBAAgB;AACnB,cAAQ,aAAa;AACrB,cAAQ;AAAA,IACZ;AAAA,EACJ,CAAC;AACL;",
"names": []
}

1
node_modules/.vite/deps/package.json

@ -0,0 +1 @@
{"type":"module"}

1260
node_modules/.vite/deps/svelte-leafletjs__axios.js
File diff suppressed because it is too large
View File

7
node_modules/.vite/deps/svelte-leafletjs__axios.js.map
File diff suppressed because one or more lines are too long
View File

7850
node_modules/.vite/deps/svelte-leafletjs__leaflet.js
File diff suppressed because it is too large
View File

7
node_modules/.vite/deps/svelte-leafletjs__leaflet.js.map
File diff suppressed because one or more lines are too long
View File

30
node_modules/.vite/deps/svelte.js

@ -0,0 +1,30 @@
import {
SvelteComponentDev,
SvelteComponentTyped,
afterUpdate,
beforeUpdate,
createEventDispatcher,
getAllContexts,
getContext,
hasContext,
onDestroy,
onMount,
setContext,
tick
} from "./chunk-ENZLGVI2.js";
import "./chunk-RSJERJUL.js";
export {
SvelteComponentDev as SvelteComponent,
SvelteComponentTyped,
afterUpdate,
beforeUpdate,
createEventDispatcher,
getAllContexts,
getContext,
hasContext,
onDestroy,
onMount,
setContext,
tick
};
//# sourceMappingURL=svelte.js.map

7
node_modules/.vite/deps/svelte.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

33
node_modules/.vite/deps/svelte_animate.js

@ -0,0 +1,33 @@
import {
cubicOut
} from "./chunk-V3UMKGYM.js";
import {
is_function
} from "./chunk-ENZLGVI2.js";
import "./chunk-RSJERJUL.js";
// node_modules/svelte/animate/index.mjs
function flip(node, { from, to }, params = {}) {
const style = getComputedStyle(node);
const transform = style.transform === "none" ? "" : style.transform;
const [ox, oy] = style.transformOrigin.split(" ").map(parseFloat);
const dx = from.left + from.width * ox / to.width - (to.left + ox);
const dy = from.top + from.height * oy / to.height - (to.top + oy);
const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params;
return {
delay,
duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,
easing,
css: (t, u) => {
const x = u * dx;
const y = u * dy;
const sx = t + u * from.width / to.width;
const sy = t + u * from.height / to.height;
return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`;
}
};
}
export {
flip
};
//# sourceMappingURL=svelte_animate.js.map

7
node_modules/.vite/deps/svelte_animate.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../svelte/animate/index.mjs"],
"sourcesContent": ["import { cubicOut } from '../easing/index.mjs';\nimport { is_function } from '../internal/index.mjs';\n\nfunction flip(node, { from, to }, params = {}) {\n const style = getComputedStyle(node);\n const transform = style.transform === 'none' ? '' : style.transform;\n const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat);\n const dx = (from.left + from.width * ox / to.width) - (to.left + ox);\n const dy = (from.top + from.height * oy / to.height) - (to.top + oy);\n const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params;\n return {\n delay,\n duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,\n easing,\n css: (t, u) => {\n const x = u * dx;\n const y = u * dy;\n const sx = t + u * from.width / to.width;\n const sy = t + u * from.height / to.height;\n return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`;\n }\n };\n}\n\nexport { flip };\n"],
"mappings": ";;;;;;;;;AAGA,cAAc,MAAM,EAAE,MAAM,MAAM,SAAS,CAAC,GAAG;AAC3C,QAAM,QAAQ,iBAAiB,IAAI;AACnC,QAAM,YAAY,MAAM,cAAc,SAAS,KAAK,MAAM;AAC1D,QAAM,CAAC,IAAI,MAAM,MAAM,gBAAgB,MAAM,GAAG,EAAE,IAAI,UAAU;AAChE,QAAM,KAAM,KAAK,OAAO,KAAK,QAAQ,KAAK,GAAG,QAAU,IAAG,OAAO;AACjE,QAAM,KAAM,KAAK,MAAM,KAAK,SAAS,KAAK,GAAG,SAAW,IAAG,MAAM;AACjE,QAAM,EAAE,QAAQ,GAAG,WAAW,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,KAAK,SAAS,aAAa;AAC/E,SAAO;AAAA,IACH;AAAA,IACA,UAAU,YAAY,QAAQ,IAAI,SAAS,KAAK,KAAK,KAAK,KAAK,KAAK,EAAE,CAAC,IAAI;AAAA,IAC3E;AAAA,IACA,KAAK,CAAC,GAAG,MAAM;AACX,YAAM,IAAI,IAAI;AACd,YAAM,IAAI,IAAI;AACd,YAAM,KAAK,IAAI,IAAI,KAAK,QAAQ,GAAG;AACnC,YAAM,KAAK,IAAI,IAAI,KAAK,SAAS,GAAG;AACpC,aAAO,cAAc,uBAAuB,QAAQ,cAAc,OAAO;AAAA,IAC7E;AAAA,EACJ;AACJ;",
"names": []
}

70
node_modules/.vite/deps/svelte_easing.js

@ -0,0 +1,70 @@
import {
backIn,
backInOut,
backOut,
bounceIn,
bounceInOut,
bounceOut,
circIn,
circInOut,
circOut,
cubicIn,
cubicInOut,
cubicOut,
elasticIn,
elasticInOut,
elasticOut,
expoIn,
expoInOut,
expoOut,
quadIn,
quadInOut,
quadOut,
quartIn,
quartInOut,
quartOut,
quintIn,
quintInOut,
quintOut,
sineIn,
sineInOut,
sineOut
} from "./chunk-V3UMKGYM.js";
import {
identity
} from "./chunk-ENZLGVI2.js";
import "./chunk-RSJERJUL.js";
export {
backIn,
backInOut,
backOut,
bounceIn,
bounceInOut,
bounceOut,
circIn,
circInOut,
circOut,
cubicIn,
cubicInOut,
cubicOut,
elasticIn,
elasticInOut,
elasticOut,
expoIn,
expoInOut,
expoOut,
identity as linear,
quadIn,
quadInOut,
quadOut,
quartIn,
quartInOut,
quartOut,
quintIn,
quintInOut,
quintOut,
sineIn,
sineInOut,
sineOut
};
//# sourceMappingURL=svelte_easing.js.map

7
node_modules/.vite/deps/svelte_easing.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

362
node_modules/.vite/deps/svelte_internal.js

@ -0,0 +1,362 @@
import {
HtmlTag,
HtmlTagHydration,
SvelteComponent,
SvelteComponentDev,
SvelteComponentTyped,
SvelteElement,
action_destroyer,
add_attribute,
add_classes,
add_flush_callback,
add_location,
add_render_callback,
add_resize_listener,
add_styles,
add_transform,
afterUpdate,
append,
append_dev,
append_empty_stylesheet,
append_hydration,
append_hydration_dev,
append_styles,
assign,
attr,
attr_dev,
attribute_to_object,
beforeUpdate,
bind,
binding_callbacks,
blank_object,
bubble,
check_outros,
children,
claim_component,
claim_element,
claim_html_tag,
claim_space,
claim_svg_element,
claim_text,
clear_loops,
component_subscribe,
compute_rest_props,
compute_slots,
createEventDispatcher,
create_animation,
create_bidirectional_transition,
create_component,
create_in_transition,
create_out_transition,
create_slot,
create_ssr_component,
current_component,
custom_event,
dataset_dev,
debug,
destroy_block,
destroy_component,
destroy_each,
detach,
detach_after_dev,
detach_before_dev,
detach_between_dev,
detach_dev,
dirty_components,
dispatch_dev,
each,
element,
element_is,
empty,
end_hydrating,
escape,
escape_attribute_value,
escape_object,
escaped,
exclude_internal_props,
fix_and_destroy_block,
fix_and_outro_and_destroy_block,
fix_position,
flush,
getAllContexts,
getContext,
get_all_dirty_from_scope,
get_binding_group_value,
get_current_component,
get_custom_elements_slots,
get_root_for_style,
get_slot_changes,
get_spread_object,
get_spread_update,
get_store_value,
globals,
group_outros,
handle_promise,
hasContext,
has_prop,
identity,
init,
insert,
insert_dev,
insert_hydration,
insert_hydration_dev,
intros,
invalid_attribute_name_character,
is_client,
is_crossorigin,
is_empty,
is_function,
is_promise,
is_void,
listen,
listen_dev,
loop,
loop_guard,
merge_ssr_styles,
missing_component,
mount_component,
noop,
not_equal,
now,
null_to_empty,
object_without_properties,
onDestroy,
onMount,
once,
outro_and_destroy_block,
prevent_default,
prop_dev,
query_selector_all,
raf,
run,
run_all,
safe_not_equal,
schedule_update,
select_multiple_value,
select_option,
select_options,
select_value,
self,
setContext,
set_attributes,
set_current_component,
set_custom_element_data,
set_data,
set_data_dev,
set_input_type,
set_input_value,
set_now,
set_raf,
set_store_value,
set_style,
set_svg_attributes,
space,
spread,
src_url_equal,
start_hydrating,
stop_propagation,
subscribe,
svg_element,
text,
tick,
time_ranges_to_array,
to_number,
toggle_class,
transition_in,
transition_out,
trusted,
update_await_block_branch,
update_keyed_each,
update_slot,
update_slot_base,
validate_component,
validate_dynamic_element,
validate_each_argument,
validate_each_keys,
validate_slots,
validate_store,
validate_void_dynamic_element,
xlink_attr
} from "./chunk-ENZLGVI2.js";
import "./chunk-RSJERJUL.js";
export {
HtmlTag,
HtmlTagHydration,
SvelteComponent,
SvelteComponentDev,
SvelteComponentTyped,
SvelteElement,
action_destroyer,
add_attribute,
add_classes,
add_flush_callback,
add_location,
add_render_callback,
add_resize_listener,
add_styles,
add_transform,
afterUpdate,
append,
append_dev,
append_empty_stylesheet,
append_hydration,
append_hydration_dev,
append_styles,
assign,
attr,
attr_dev,
attribute_to_object,
beforeUpdate,
bind,
binding_callbacks,
blank_object,
bubble,
check_outros,
children,
claim_component,
claim_element,
claim_html_tag,
claim_space,
claim_svg_element,
claim_text,
clear_loops,
component_subscribe,
compute_rest_props,
compute_slots,
createEventDispatcher,
create_animation,
create_bidirectional_transition,
create_component,
create_in_transition,
create_out_transition,
create_slot,
create_ssr_component,
current_component,
custom_event,
dataset_dev,
debug,
destroy_block,
destroy_component,
destroy_each,
detach,
detach_after_dev,
detach_before_dev,
detach_between_dev,
detach_dev,
dirty_components,
dispatch_dev,
each,
element,
element_is,
empty,
end_hydrating,
escape,
escape_attribute_value,
escape_object,
escaped,
exclude_internal_props,
fix_and_destroy_block,
fix_and_outro_and_destroy_block,
fix_position,
flush,
getAllContexts,
getContext,
get_all_dirty_from_scope,
get_binding_group_value,
get_current_component,
get_custom_elements_slots,
get_root_for_style,
get_slot_changes,
get_spread_object,
get_spread_update,
get_store_value,
globals,
group_outros,
handle_promise,
hasContext,
has_prop,
identity,
init,
insert,
insert_dev,
insert_hydration,
insert_hydration_dev,
intros,
invalid_attribute_name_character,
is_client,
is_crossorigin,
is_empty,
is_function,
is_promise,
is_void,
listen,
listen_dev,
loop,
loop_guard,
merge_ssr_styles,
missing_component,
mount_component,
noop,
not_equal,
now,
null_to_empty,
object_without_properties,
onDestroy,
onMount,
once,
outro_and_destroy_block,
prevent_default,
prop_dev,
query_selector_all,
raf,
run,
run_all,
safe_not_equal,
schedule_update,
select_multiple_value,
select_option,
select_options,
select_value,
self,
setContext,
set_attributes,
set_current_component,
set_custom_element_data,
set_data,
set_data_dev,
set_input_type,
set_input_value,
set_now,
set_raf,
set_store_value,
set_style,
set_svg_attributes,
space,
spread,
src_url_equal,
start_hydrating,
stop_propagation,
subscribe,
svg_element,
text,
tick,
time_ranges_to_array,
to_number,
toggle_class,
transition_in,
transition_out,
trusted,
update_await_block_branch,
update_keyed_each,
update_slot,
update_slot_base,
validate_component,
validate_dynamic_element,
validate_each_argument,
validate_each_keys,
validate_slots,
validate_store,
validate_void_dynamic_element,
xlink_attr
};
//# sourceMappingURL=svelte_internal.js.map

7
node_modules/.vite/deps/svelte_internal.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

208
node_modules/.vite/deps/svelte_motion.js

@ -0,0 +1,208 @@
import {
writable
} from "./chunk-V5ZN2RMD.js";
import "./chunk-V3UMKGYM.js";
import {
assign,
identity,
loop,
now
} from "./chunk-ENZLGVI2.js";
import "./chunk-RSJERJUL.js";
// node_modules/svelte/motion/index.mjs
function is_date(obj) {
return Object.prototype.toString.call(obj) === "[object Date]";
}
function tick_spring(ctx, last_value, current_value, target_value) {
if (typeof current_value === "number" || is_date(current_value)) {
const delta = target_value - current_value;
const velocity = (current_value - last_value) / (ctx.dt || 1 / 60);
const spring2 = ctx.opts.stiffness * delta;
const damper = ctx.opts.damping * velocity;
const acceleration = (spring2 - damper) * ctx.inv_mass;
const d = (velocity + acceleration) * ctx.dt;
if (Math.abs(d) < ctx.opts.precision && Math.abs(delta) < ctx.opts.precision) {
return target_value;
} else {
ctx.settled = false;
return is_date(current_value) ? new Date(current_value.getTime() + d) : current_value + d;
}
} else if (Array.isArray(current_value)) {
return current_value.map((_, i) => tick_spring(ctx, last_value[i], current_value[i], target_value[i]));
} else if (typeof current_value === "object") {
const next_value = {};
for (const k in current_value) {
next_value[k] = tick_spring(ctx, last_value[k], current_value[k], target_value[k]);
}
return next_value;
} else {
throw new Error(`Cannot spring ${typeof current_value} values`);
}
}
function spring(value, opts = {}) {
const store = writable(value);
const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts;
let last_time;
let task;
let current_token;
let last_value = value;
let target_value = value;
let inv_mass = 1;
let inv_mass_recovery_rate = 0;
let cancel_task = false;
function set(new_value, opts2 = {}) {
target_value = new_value;
const token = current_token = {};
if (value == null || opts2.hard || spring2.stiffness >= 1 && spring2.damping >= 1) {
cancel_task = true;
last_time = now();
last_value = new_value;
store.set(value = target_value);
return Promise.resolve();
} else if (opts2.soft) {
const rate = opts2.soft === true ? 0.5 : +opts2.soft;
inv_mass_recovery_rate = 1 / (rate * 60);
inv_mass = 0;
}
if (!task) {
last_time = now();
cancel_task = false;
task = loop((now2) => {
if (cancel_task) {
cancel_task = false;
task = null;
return false;
}
inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1);
const ctx = {
inv_mass,
opts: spring2,
settled: true,
dt: (now2 - last_time) * 60 / 1e3
};
const next_value = tick_spring(ctx, last_value, value, target_value);
last_time = now2;
last_value = value;
store.set(value = next_value);
if (ctx.settled) {
task = null;
}
return !ctx.settled;
});
}
return new Promise((fulfil) => {
task.promise.then(() => {
if (token === current_token)
fulfil();
});
});
}
const spring2 = {
set,
update: (fn, opts2) => set(fn(target_value, value), opts2),
subscribe: store.subscribe,
stiffness,
damping,
precision
};
return spring2;
}
function get_interpolator(a, b) {
if (a === b || a !== a)
return () => a;
const type = typeof a;
if (type !== typeof b || Array.isArray(a) !== Array.isArray(b)) {
throw new Error("Cannot interpolate values of different type");
}
if (Array.isArray(a)) {
const arr = b.map((bi, i) => {
return get_interpolator(a[i], bi);
});
return (t) => arr.map((fn) => fn(t));
}
if (type === "object") {
if (!a || !b)
throw new Error("Object cannot be null");
if (is_date(a) && is_date(b)) {
a = a.getTime();
b = b.getTime();
const delta = b - a;
return (t) => new Date(a + t * delta);
}
const keys = Object.keys(b);
const interpolators = {};
keys.forEach((key) => {
interpolators[key] = get_interpolator(a[key], b[key]);
});
return (t) => {
const result = {};
keys.forEach((key) => {
result[key] = interpolators[key](t);
});
return result;
};
}
if (type === "number") {
const delta = b - a;
return (t) => a + t * delta;
}
throw new Error(`Cannot interpolate ${type} values`);
}
function tweened(value, defaults = {}) {
const store = writable(value);
let task;
let target_value = value;
function set(new_value, opts) {
if (value == null) {
store.set(value = new_value);
return Promise.resolve();
}
target_value = new_value;
let previous_task = task;
let started = false;
let { delay = 0, duration = 400, easing = identity, interpolate = get_interpolator } = assign(assign({}, defaults), opts);
if (duration === 0) {
if (previous_task) {
previous_task.abort();
previous_task = null;
}
store.set(value = target_value);
return Promise.resolve();
}
const start = now() + delay;
let fn;
task = loop((now2) => {
if (now2 < start)
return true;
if (!started) {
fn = interpolate(value, new_value);
if (typeof duration === "function")
duration = duration(value, new_value);
started = true;
}
if (previous_task) {
previous_task.abort();
previous_task = null;
}
const elapsed = now2 - start;
if (elapsed > duration) {
store.set(value = new_value);
return false;
}
store.set(value = fn(easing(elapsed / duration)));
return true;
});
return task.promise;
}
return {
set,
update: (fn, opts) => set(fn(target_value, value), opts),
subscribe: store.subscribe
};
}
export {
spring,
tweened
};
//# sourceMappingURL=svelte_motion.js.map

7
node_modules/.vite/deps/svelte_motion.js.map
File diff suppressed because one or more lines are too long
View File

16
node_modules/.vite/deps/svelte_store.js

@ -0,0 +1,16 @@
import {
derived,
readable,
writable
} from "./chunk-V5ZN2RMD.js";
import {
get_store_value
} from "./chunk-ENZLGVI2.js";
import "./chunk-RSJERJUL.js";
export {
derived,
get_store_value as get,
readable,
writable
};
//# sourceMappingURL=svelte_store.js.map

7
node_modules/.vite/deps/svelte_store.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

185
node_modules/.vite/deps/svelte_transition.js

@ -0,0 +1,185 @@
import {
cubicInOut,
cubicOut
} from "./chunk-V3UMKGYM.js";
import {
assign,
identity,
is_function
} from "./chunk-ENZLGVI2.js";
import "./chunk-RSJERJUL.js";
// node_modules/svelte/transition/index.mjs
function __rest(s, e) {
var t = {};
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function blur(node, { delay = 0, duration = 400, easing = cubicInOut, amount = 5, opacity = 0 } = {}) {
const style = getComputedStyle(node);
const target_opacity = +style.opacity;
const f = style.filter === "none" ? "" : style.filter;
const od = target_opacity * (1 - opacity);
return {
delay,
duration,
easing,
css: (_t, u) => `opacity: ${target_opacity - od * u}; filter: ${f} blur(${u * amount}px);`
};
}
function fade(node, { delay = 0, duration = 400, easing = identity } = {}) {
const o = +getComputedStyle(node).opacity;
return {
delay,
duration,
easing,
css: (t) => `opacity: ${t * o}`
};
}
function fly(node, { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0 } = {}) {
const style = getComputedStyle(node);
const target_opacity = +style.opacity;
const transform = style.transform === "none" ? "" : style.transform;
const od = target_opacity * (1 - opacity);
return {
delay,
duration,
easing,
css: (t, u) => `
transform: ${transform} translate(${(1 - t) * x}px, ${(1 - t) * y}px);
opacity: ${target_opacity - od * u}`
};
}
function slide(node, { delay = 0, duration = 400, easing = cubicOut } = {}) {
const style = getComputedStyle(node);
const opacity = +style.opacity;
const height = parseFloat(style.height);
const padding_top = parseFloat(style.paddingTop);
const padding_bottom = parseFloat(style.paddingBottom);
const margin_top = parseFloat(style.marginTop);
const margin_bottom = parseFloat(style.marginBottom);
const border_top_width = parseFloat(style.borderTopWidth);
const border_bottom_width = parseFloat(style.borderBottomWidth);
return {
delay,
duration,
easing,
css: (t) => `overflow: hidden;opacity: ${Math.min(t * 20, 1) * opacity};height: ${t * height}px;padding-top: ${t * padding_top}px;padding-bottom: ${t * padding_bottom}px;margin-top: ${t * margin_top}px;margin-bottom: ${t * margin_bottom}px;border-top-width: ${t * border_top_width}px;border-bottom-width: ${t * border_bottom_width}px;`
};
}
function scale(node, { delay = 0, duration = 400, easing = cubicOut, start = 0, opacity = 0 } = {}) {
const style = getComputedStyle(node);
const target_opacity = +style.opacity;
const transform = style.transform === "none" ? "" : style.transform;
const sd = 1 - start;
const od = target_opacity * (1 - opacity);
return {
delay,
duration,
easing,
css: (_t, u) => `
transform: ${transform} scale(${1 - sd * u});
opacity: ${target_opacity - od * u}
`
};
}
function draw(node, { delay = 0, speed, duration, easing = cubicInOut } = {}) {
let len = node.getTotalLength();
const style = getComputedStyle(node);
if (style.strokeLinecap !== "butt") {
len += parseInt(style.strokeWidth);
}
if (duration === void 0) {
if (speed === void 0) {
duration = 800;
} else {
duration = len / speed;
}
} else if (typeof duration === "function") {
duration = duration(len);
}
return {
delay,
duration,
easing,
css: (t, u) => `stroke-dasharray: ${t * len} ${u * len}`
};
}
function crossfade(_a) {
var { fallback } = _a, defaults = __rest(_a, ["fallback"]);
const to_receive = /* @__PURE__ */ new Map();
const to_send = /* @__PURE__ */ new Map();
function crossfade2(from, node, params) {
const { delay = 0, duration = (d2) => Math.sqrt(d2) * 30, easing = cubicOut } = assign(assign({}, defaults), params);
const to = node.getBoundingClientRect();
const dx = from.left - to.left;
const dy = from.top - to.top;
const dw = from.width / to.width;
const dh = from.height / to.height;
const d = Math.sqrt(dx * dx + dy * dy);
const style = getComputedStyle(node);
const transform = style.transform === "none" ? "" : style.transform;
const opacity = +style.opacity;
return {
delay,
duration: is_function(duration) ? duration(d) : duration,
easing,
css: (t, u) => `
opacity: ${t * opacity};
transform-origin: top left;
transform: ${transform} translate(${u * dx}px,${u * dy}px) scale(${t + (1 - t) * dw}, ${t + (1 - t) * dh});
`
};
}
function transition(items, counterparts, intro) {
return (node, params) => {
items.set(params.key, {
rect: node.getBoundingClientRect()
});
return () => {
if (counterparts.has(params.key)) {
const { rect } = counterparts.get(params.key);
counterparts.delete(params.key);
return crossfade2(rect, node, params);
}
items.delete(params.key);
return fallback && fallback(node, params, intro);
};
};
}
return [
transition(to_send, to_receive, false),
transition(to_receive, to_send, true)
];
}
export {
blur,
crossfade,
draw,
fade,
fly,
scale,
slide
};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
//# sourceMappingURL=svelte_transition.js.map

7
node_modules/.vite/deps/svelte_transition.js.map
File diff suppressed because one or more lines are too long
View File

1
node_modules/.vite/processing/package.json

@ -0,0 +1 @@
{"type":"module"}

29
node_modules/@ethersphere/bee-js/LICENSE

@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2022, The Swarm Authors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

148
node_modules/@ethersphere/bee-js/README.md

@ -0,0 +1,148 @@
# Bee-js
[![Tests](https://github.com/ethersphere/bee-js/actions/workflows/tests.yaml/badge.svg)](https://github.com/ethersphere/bee-js/actions/workflows/tests.yaml)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fethersphere%2Fbee-js.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fethersphere%2Fbee-js?ref=badge_shield)
[![](https://img.shields.io/badge/made%20by-Swarm-blue.svg?style=flat-square)](https://swarm.ethereum.org/)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
![](https://img.shields.io/badge/npm-%3E%3D6.9.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D12.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/runs%20in-browser%20%7C%20node%20%7C%20webworker%20%7C%20electron-orange)
> Client library for connecting to Bee decentralised storage
**Warning: This project is in beta state. There might (and most probably will) be changes in the future to its API and working. Also, no guarantees can be made about its stability, efficiency, and security at this stage.**
This project is intended to be used with **Bee version 1.3.0**. Using it with older or newer Bee versions is not recommended and may not work. Stay up to date by joining the [official Discord](https://discord.gg/GU22h2utj6) and by keeping an eye on the [releases tab](https://github.com/ethersphere/bee-js/releases).
## Table of Contents
- [Install](#install)
- [npm](#npm)
- [Use in Node.js](#use-in-nodejs)
- [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)
- [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)
- [Usage](#usage)
- [API](#api)
- [Contribute](#contribute)
- [Setup](#setup)
- [Test](#test)
- [License](#license)
## Install
### npm
```sh
> npm install @ethersphere/bee-js --save
```
### yarn
```sh
> yarn add @ethersphere/bee-js
```
Be aware, if you are running Yarn v1 and are attempting to install this repo using GitHub URL, this won't unfortunately
work as it does not correctly handle execution of `prepare` script.
### Use in Node.js
**We require Node.js's version of at least 12.x**
```js
var BeeJs = require("@ethersphere/bee-js");
```
### Use in a browser with browserify, webpack or any other bundler
```js
var BeeJs = require("@ethersphere/bee-js");
```
### Use in a browser Using a script tag
Loading this module through a script tag will make the `BeeJs` object available in the global namespace.
```html
<script src="https://unpkg.com/@ethersphere/bee-js/dist/index.browser.min.js"></script>
```
## Usage
```js
import { Bee } from "@ethersphere/bee-js"
bee = new Bee("http://localhost:1633")
// Be aware, this creates on-chain transactions that spend Eth and BZZ!
const batchId = await bee.createPostageBatch('100', 17)
const fileHash = await bee.uploadData(batchId, "Bee is awesome!")
const data = await bee.downloadData(fileHash)
console.log(data.text()) // prints 'Bee is awesome!'
```
[**Check out our examples repo for some more ideas on how to use `bee-js`**](https://github.com/ethersphere/examples-js)
## Documentation
You can find the full documentation [here](https://bee-js.ethswarm.org/docs). The API reference documentation can be found [here](https://bee-js.ethswarm.org/docs/api).
## Contribute
There are some ways you can make this module better:
- Consult our [open issues](https://github.com/ethersphere/bee-js/issues) and take on one of them
- Help our tests reach 100% coverage!
- Join us in our [Discord chat](https://discord.gg/wdghaQsGq5) in the #develop-on-swarm channel if you have questions or want to give feedback
### Setup
Install project dependencies with
```sh
npm i
```
### Test
The tests run in both context: node and dom with Jest.
To run the integration tests, you need to spin up local Bee cluster using our [`bee-factory`](https://github.com/ethersphere/bee-factory/) project.
In order to do that you have to have locally Docker running on your machine, but afterwards you can just simply run `npm run bee`, which spins up the
cluster and display Queen's logs. If you want to exit hit `CTRL+C`.
If you want to skip creation of postage stamps every run of integration tests you can create stamps for both nodes and set them under env. variables `BEE_POSTAGE` and `BEE_PEER_POSTAGE`.
By default, for integration tests two bee nodes are expected to run on localhost on addresses `http://localhost:1633` and `http://localhost:11633`. These are the default values for the `bee-factory` script.
If you want to use custom setup, you can change the behavior of tests to different addresses using environment variables `BEE_API_URL`, `BEE_DEBUG_API_URL`, `BEE_PEER_DEBUG_API_URL` and `BEE_PEER_API_URL`.
There are also browser tests by Puppeteer, which also provide integrity testing.
```sh
npm run test:browser
```
The test HTML file which Puppeteer uses is the [test/testpage/testpage.html](test/testpage/testpage.html).
To open and manually test BeeJS with developer console, it is necessary to build the library first with `npm run compile:browser` (running the browser tests `npm run test:browser` also builds the library).
### Compile code
In order to compile NodeJS code run
`npm run compile:node`
or for Browsers
`npm run compile:browser`
## Maintainers
- [auhau](https://github.com/auhau)
- [vojtechsimetka](https://github.com/vojtechsimetka)
## License
[BSD-3-Clause](./LICENSE)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fethersphere%2Fbee-js.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fethersphere%2Fbee-js?ref=badge_large)

638
node_modules/@ethersphere/bee-js/dist/cjs/bee-debug.js

@ -0,0 +1,638 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BeeDebug = void 0;
const connectivity = __importStar(require("./modules/debug/connectivity"));
const balance = __importStar(require("./modules/debug/balance"));
const chequebook = __importStar(require("./modules/debug/chequebook"));
const settlements = __importStar(require("./modules/debug/settlements"));
const status = __importStar(require("./modules/debug/status"));
const transactions = __importStar(require("./modules/debug/transactions"));
const states = __importStar(require("./modules/debug/states"));
const error_1 = require("./utils/error");
const url_1 = require("./utils/url");
const type_1 = require("./utils/type");
const types_1 = require("./types");
const tag = __importStar(require("./modules/debug/tag"));
const stamps = __importStar(require("./modules/debug/stamps"));
const http_1 = require("./utils/http");
const sleep_1 = require("./utils/sleep");
class BeeDebug {
constructor(url, options) {
var _a;
(0, url_1.assertBeeUrl)(url);
// Remove last slash if present, as our endpoint strings starts with `/...`
// which could lead to double slash in URL to which Bee responds with
// unnecessary redirects.
this.url = (0, url_1.stripLastSlash)(url);
const kyOptions = {
prefixUrl: this.url,
timeout: (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : false,
retry: options === null || options === void 0 ? void 0 : options.retry,
fetch: options === null || options === void 0 ? void 0 : options.fetch,
hooks: {
beforeRequest: [],
afterResponse: [],
},
};
if (options === null || options === void 0 ? void 0 : options.defaultHeaders) {
kyOptions.headers = options.defaultHeaders;
}
if (options === null || options === void 0 ? void 0 : options.onRequest) {
kyOptions.hooks.beforeRequest.push((0, http_1.wrapRequestClosure)(options.onRequest));
}
if (options === null || options === void 0 ? void 0 : options.onResponse) {
kyOptions.hooks.afterResponse.push((0, http_1.wrapResponseClosure)(options.onResponse));
}
this.ky = (0, http_1.makeDefaultKy)(kyOptions);
}
getNodeAddresses(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return connectivity.getNodeAddresses(this.getKy(options));
});
}
getBlocklist(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return connectivity.getBlocklist(this.getKy(options));
});
}
/**
* Retrieve tag extended information from Bee node
*
* @param tagUid UID or tag object to be retrieved
* @throws TypeError if tagUid is in not correct format
*
* @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
* @see [Bee API reference - `GET /tags/{uid}`](https://docs.ethswarm.org/debug-api/#tag/Tag)
*
*/
retrieveExtendedTag(tagUid, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
if ((0, type_1.isTag)(tagUid)) {
tagUid = tagUid.uid;
}
else if (typeof tagUid === 'number') {
(0, type_1.assertNonNegativeInteger)(tagUid, 'UID');
}
else {
throw new TypeError('tagUid has to be either Tag or a number (UID)!');
}
return tag.retrieveExtendedTag(this.getKy(options), tagUid);
});
}
/**
* Get list of peers for this node
*/
getPeers(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return connectivity.getPeers(this.getKy(options));
});
}
removePeer(peer, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertAddress)(peer);
return connectivity.removePeer(this.getKy(options), peer);
});
}
getTopology(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return connectivity.getTopology(this.getKy(options));
});
}
pingPeer(peer, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertAddress)(peer);
return connectivity.pingPeer(this.getKy(options), peer);
});
}
/*
* Balance endpoints
*/
/**
* Get the balances with all known peers including prepaid services
*/
getAllBalances(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return balance.getAllBalances(this.getKy(options));
});
}
/**
* Get the balances with a specific peer including prepaid services
*
* @param address Swarm address of peer
*/
getPeerBalance(address, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertAddress)(address);
return balance.getPeerBalance(this.getKy(options), address);
});
}
/**
* Get the past due consumption balances with all known peers
*/
getPastDueConsumptionBalances(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return balance.getPastDueConsumptionBalances(this.getKy(options));
});
}
/**
* Get the past due consumption balance with a specific peer
*
* @param address Swarm address of peer
*/
getPastDueConsumptionPeerBalance(address, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertAddress)(address);
return balance.getPastDueConsumptionPeerBalance(this.getKy(options), address);
});
}
/*
* Chequebook endpoints
*/
/**
* Get the address of the chequebook contract used.
*
* **Warning:** The address is returned with 0x prefix unlike all other calls.
* https://github.com/ethersphere/bee/issues/1443
*/
getChequebookAddress(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return chequebook.getChequebookAddress(this.getKy(options));
});
}
/**
* Get the balance of the chequebook
*/
getChequebookBalance(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return chequebook.getChequebookBalance(this.getKy(options));
});
}
/**
* Get last cheques for all peers
*/
getLastCheques(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return chequebook.getLastCheques(this.getKy(options));
});
}
/**
* Get last cheques for the peer
*
* @param address Swarm address of peer
*/
getLastChequesForPeer(address, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertAddress)(address);
return chequebook.getLastChequesForPeer(this.getKy(options), address);
});
}
/**
* Get last cashout action for the peer
*
* @param address Swarm address of peer
*/
getLastCashoutAction(address, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertAddress)(address);
return chequebook.getLastCashoutAction(this.getKy(options), address);
});
}
/**
* Cashout the last cheque for the peer
*
* @param address Swarm address of peer
* @param options
* @param options.gasPrice Gas price for the cashout transaction in WEI
* @param options.gasLimit Gas limit for the cashout transaction in WEI
*/
cashoutLastCheque(address, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertCashoutOptions)(options);
(0, type_1.assertAddress)(address);
return chequebook.cashoutLastCheque(this.getKy(options), address, options);
});
}
/**
* Deposit tokens from overlay address into chequebook
*
* @param amount Amount of tokens to deposit (must be positive integer)
* @param gasPrice Gas Price in WEI for the transaction call
* @return string Hash of the transaction
*/
depositTokens(amount, gasPrice, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertNonNegativeInteger)(amount);
if (gasPrice) {
(0, type_1.assertNonNegativeInteger)(gasPrice);
}
return chequebook.depositTokens(this.getKy(options), amount, gasPrice);
});
}
/**
* Withdraw tokens from the chequebook to the overlay address
*
* @param amount Amount of tokens to withdraw (must be positive integer)
* @param gasPrice Gas Price in WEI for the transaction call
* @return string Hash of the transaction
*/
withdrawTokens(amount, gasPrice, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertNonNegativeInteger)(amount);
if (gasPrice) {
(0, type_1.assertNonNegativeInteger)(gasPrice);
}
return chequebook.withdrawTokens(this.getKy(options), amount, gasPrice);
});
}
/*
* Settlements endpoint
*/
/**
* Get amount of sent and received from settlements with a peer
*
* @param address Swarm address of peer
*/
getSettlements(address, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertAddress)(address);
return settlements.getSettlements(this.getKy(options), address);
});
}
/**
* Get settlements with all known peers and total amount sent or received
*/
getAllSettlements(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return settlements.getAllSettlements(this.getKy(options));
});
}
/**
* Get health of node
*/
getHealth(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return status.getHealth(this.getKy(options));
});
}
/**
* Get mode information of node
*/
getNodeInfo(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return status.getNodeInfo(this.getKy(options));
});
}
/**
* Connnects to a node and checks if it is a supported Bee version by the bee-js
*
* @returns true if the Bee node version is supported
* @deprecated Use `BeeDebug.isSupportedExactVersion()` instead
*/
isSupportedVersion(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return status.isSupportedVersion(this.getKy(options));
});
}
/**
* Connects to a node and checks if its version matches with the one that bee-js supports.
*
* Be aware that this is the most strict version check and most probably
* you will want to use more relaxed API-versions based checks like
* `BeeDebug.isSupportedApiVersion()`, `BeeDebug.isSupportedMainApiVersion()` or `BeeDebug.isSupportedDebugApiVersion()`
* based on your use-case.
*
* @param options
*/
isSupportedExactVersion(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return status.isSupportedExactVersion(this.getKy(options));
});
}
/**
* Connects to a node and checks if its main's API version matches with the one that bee-js supports.
*
* This is useful if you are not using `BeeDebug` class (for anything else then this check)
* and want to make sure about compatibility.
*
* @param options
*/
isSupportedMainApiVersion(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return status.isSupportedMainApiVersion(this.getKy(options));
});
}
/**
* Connects to a node and checks if its Debug API version matches with the one that bee-js supports.
*
* This is useful if you are not using `Bee` class in your application and want to make sure
* about compatibility.
*
* @param options
*/
isSupportedDebugApiVersion(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return status.isSupportedDebugApiVersion(this.getKy(options));
});
}
/**
*
* Connects to a node and checks if its Main and Debug API versions matches with the one that bee-js supports.
*
* This should be the main way how to check compatibility for your app and Bee node.
*
* @param options
*/
isSupportedApiVersion(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return status.isSupportedDebugApiVersion(this.getKy(options));
});
}
/**
* Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`)
* and versions that bee-js supports (properties prefixed with `supported*`).
*
* @param options
*/
getVersions(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return status.getVersions(this.getKy(options));
});
}
/**
* Get reserve state
*/
getReserveState(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return states.getReserveState(this.getKy(options));
});
}
/**
* Get chain state
*/
getChainState(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return states.getChainState(this.getKy(options));
});
}
/**
* Get wallet balances for xDai and BZZ of the Bee node
*
* @param options
*/
getWalletBalance(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return states.getWalletBalance(this.getKy(options));
});
}
/**
* Creates new postage batch from the funds that the node has available in its Ethereum account.
*
* For better understanding what each parameter means and what are the optimal values please see
* [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive).
*
* **WARNING: THIS CREATES TRANSACTIONS THAT SPENDS MONEY**
*
* @param amount Amount that represents the value per chunk, has to be greater or equal zero.
* @param depth Logarithm of the number of chunks that can be stamped with the batch.
* @param options Options for creation of postage batch
* @throws BeeArgumentError when negative amount or depth is specified
* @throws TypeError if non-integer value is passed to amount or depth
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee Debug API reference - `POST /stamps`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps~1{amount}~1{depth}/post)
*/
createPostageBatch(amount, depth, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertPostageBatchOptions)(options);
(0, type_1.assertPositiveInteger)(amount);
(0, type_1.assertNonNegativeInteger)(depth);
if (depth < types_1.STAMPS_DEPTH_MIN) {
throw new error_1.BeeArgumentError(`Depth has to be at least ${types_1.STAMPS_DEPTH_MIN}`, depth);
}
if (depth > types_1.STAMPS_DEPTH_MAX) {
throw new error_1.BeeArgumentError(`Depth has to be at most ${types_1.STAMPS_DEPTH_MAX}`, depth);
}
const stamp = yield stamps.createPostageBatch(this.getKy(options), amount, depth, options);
if (options === null || options === void 0 ? void 0 : options.waitForUsable) {
yield this.waitForUsablePostageStamp(stamp, options === null || options === void 0 ? void 0 : options.waitForUsableTimeout);
}
return stamp;
});
}
/**
* Topup a fresh amount of BZZ to given Postage Batch.
*
* For better understanding what each parameter means and what are the optimal values please see
* [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive).
*
* **WARNING: THIS CREATES TRANSACTIONS THAT SPENDS MONEY**
*
* @param postageBatchId Batch ID
* @param amount Amount to be added to the batch
* @param options Request options
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee Debug API reference - `PATCH /stamps/topup/${id}/${amount}`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps~1topup~1{id}~1{amount}/patch)
*/
topUpBatch(postageBatchId, amount, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertNonNegativeInteger)(amount, 'Amount');
(0, type_1.assertBatchId)(postageBatchId);
yield stamps.topUpBatch(this.getKy(options), postageBatchId, amount);
});
}
/**
* Dilute given Postage Batch with new depth (that has to be bigger then the original depth), which allows
* the Postage Batch to be used for more chunks.
*
* For better understanding what each parameter means and what are the optimal values please see
* [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive).
*
* **WARNING: THIS CREATES TRANSACTIONS THAT SPENDS MONEY**
*
* @param postageBatchId Batch ID
* @param depth Amount to be added to the batch
* @param options Request options
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee Debug API reference - `PATCH /stamps/topup/${id}/${amount}`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps~1topup~1{id}~1{amount}/patch)
*/
diluteBatch(postageBatchId, depth, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertNonNegativeInteger)(depth, 'Depth');
(0, type_1.assertBatchId)(postageBatchId);
yield stamps.diluteBatch(this.getKy(options), postageBatchId, depth);
});
}
/**
* Return details for specific postage batch.
*
* @param postageBatchId Batch ID
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee Debug API reference - `GET /stamps/${id}`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps~1{id}/get)
*/
getPostageBatch(postageBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertBatchId)(postageBatchId);
return stamps.getPostageBatch(this.getKy(options), postageBatchId);
});
}
/**
* Return detailed information related to buckets for specific postage batch.
*
* @param postageBatchId Batch ID
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee Debug API reference - `GET /stamps/${id}/buckets`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps~1{id}~1buckets/get)
*/
getPostageBatchBuckets(postageBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertBatchId)(postageBatchId);
return stamps.getPostageBatchBuckets(this.getKy(options), postageBatchId);
});
}
/**
* Return all postage batches that has the node available.
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee Debug API reference - `GET /stamps`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps/get)
*/
getAllPostageBatch(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return stamps.getAllPostageBatches(this.getKy(options));
});
}
/**
* Return lists of all current pending transactions that the Bee made
*/
getAllPendingTransactions(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
return transactions.getAllTransactions(this.getKy(options));
});
}
/**
* Return transaction information for specific transaction
* @param transactionHash
*/
getPendingTransaction(transactionHash, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertTransactionHash)(transactionHash);
return transactions.getTransaction(this.getKy(options), transactionHash);
});
}
/**
* Rebroadcast already created transaction.
* This is mainly needed when your transaction fall off mempool from other reason is not incorporated into block.
*
* @param transactionHash
*/
rebroadcastPendingTransaction(transactionHash, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertTransactionHash)(transactionHash);
return transactions.rebroadcastTransaction(this.getKy(options), transactionHash);
});
}
/**
* Cancel currently pending transaction
* @param transactionHash
* @param gasPrice
*/
cancelPendingTransaction(transactionHash, gasPrice, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertRequestOptions)(options);
(0, type_1.assertTransactionHash)(transactionHash);
if (gasPrice) {
(0, type_1.assertNonNegativeInteger)(gasPrice);
}
return transactions.cancelTransaction(this.getKy(options), transactionHash, gasPrice);
});
}
waitForUsablePostageStamp(id, timeout = 120000) {
return __awaiter(this, void 0, void 0, function* () {
const TIME_STEP = 1500;
for (let time = 0; time < timeout; time += TIME_STEP) {
const stamp = yield this.getPostageBatch(id);
if (stamp.usable) {
return;
}
yield (0, sleep_1.sleep)(TIME_STEP);
}
throw new error_1.BeeError('Timeout on waiting for postage stamp to become usable');
});
}
getKy(options) {
if (!options) {
return this.ky;
}
return this.ky.extend(options);
}
}
exports.BeeDebug = BeeDebug;

977
node_modules/@ethersphere/bee-js/dist/cjs/bee.js

@ -0,0 +1,977 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bee = void 0;
const bzz = __importStar(require("./modules/bzz"));
const stewardship = __importStar(require("./modules/stewardship"));
const tag = __importStar(require("./modules/tag"));
const pinning = __importStar(require("./modules/pinning"));
const bytes = __importStar(require("./modules/bytes"));
const chunk = __importStar(require("./modules/chunk"));
const pss = __importStar(require("./modules/pss"));
const status = __importStar(require("./modules/status"));
const error_1 = require("./utils/error");
const data_1 = require("./utils/data");
const file_1 = require("./utils/file");
const feed_1 = require("./feed");
const signer_1 = require("./chunk/signer");
const type_1 = require("./feed/type");
const soc_1 = require("./chunk/soc");
const topic_1 = require("./feed/topic");
const feed_2 = require("./modules/feed");
const url_1 = require("./utils/url");
const eth_1 = require("./utils/eth");
const bytes_1 = require("./utils/bytes");
const type_2 = require("./utils/type");
const json_1 = require("./feed/json");
const collection_1 = require("./utils/collection");
const collection_node_1 = require("./utils/collection.node");
const types_1 = require("./types");
const http_1 = require("./utils/http");
const stream_1 = require("./utils/stream");
const retrievable_1 = require("./feed/retrievable");
const swarm_cid_1 = require("@ethersphere/swarm-cid");
/**
* The main component that abstracts operations available on the main Bee API.
*
* Not all methods are always available as it depends in what mode is Bee node launched in.
* For example gateway mode and light node mode has only limited set of endpoints enabled.
*/
class Bee {
/**
* @param url URL on which is the main API of Bee node exposed
* @param options
*/
constructor(url, options) {
var _a;
(0, url_1.assertBeeUrl)(url);
// Remove last slash if present, as our endpoint strings starts with `/...`
// which could lead to double slash in URL to which Bee responds with
// unnecessary redirects.
this.url = (0, url_1.stripLastSlash)(url);
if (options === null || options === void 0 ? void 0 : options.signer) {
this.signer = (0, signer_1.makeSigner)(options.signer);
}
const kyOptions = {
prefixUrl: this.url,
timeout: (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : false,
retry: options === null || options === void 0 ? void 0 : options.retry,
fetch: options === null || options === void 0 ? void 0 : options.fetch,
hooks: {
beforeRequest: [],
afterResponse: [],
},
};
if (options === null || options === void 0 ? void 0 : options.defaultHeaders) {
kyOptions.headers = options.defaultHeaders;
}
if (options === null || options === void 0 ? void 0 : options.onRequest) {
kyOptions.hooks.beforeRequest.push((0, http_1.wrapRequestClosure)(options.onRequest));
}
if (options === null || options === void 0 ? void 0 : options.onResponse) {
kyOptions.hooks.afterResponse.push((0, http_1.wrapResponseClosure)(options.onResponse));
}
this.ky = (0, http_1.makeDefaultKy)(kyOptions);
}
/**
* Upload data to a Bee node
*
* @param postageBatchId Postage BatchId to be used to upload the data with
* @param data Data to be uploaded
* @param options Additional options like tag, encryption, pinning, content-type and request options
*
* @returns reference is a content hash of the data
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
* @see [Bee API reference - `POST /bytes`](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes/post)
*/
uploadData(postageBatchId, data, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertBatchId)(postageBatchId);
(0, type_2.assertData)(data);
if (options)
(0, type_2.assertUploadOptions)(options);
return bytes.upload(this.getKy(options), data, postageBatchId, options);
});
}
/**
* Download data as a byte array
*
* @param reference Bee data reference in hex string (either 64 or 128 chars long) or ENS domain.
* @param options Options that affects the request behavior
* @throws TypeError if some of the input parameters is not expected type
* @throws BeeArgumentError if there is passed ENS domain with invalid unicode characters
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
* @see [Bee API reference - `GET /bytes`](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1{reference}/get)
*/
downloadData(reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertReferenceOrEns)(reference);
return bytes.download(this.getKy(options), reference);
});
}
/**
* Download data as a Readable stream
*
* @param reference Bee data reference in hex string (either 64 or 128 chars long) or ENS domain.
* @param options Options that affects the request behavior
* @throws TypeError if some of the input parameters is not expected type
* @throws BeeArgumentError if there is passed ENS domain with invalid unicode characters
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
* @see [Bee API reference - `GET /bytes`](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1{reference}/get)
*/
downloadReadableData(reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertReferenceOrEns)(reference);
return bytes.downloadReadable(this.getKy(options), reference);
});
}
/**
* Upload chunk to a Bee node
*
* @param postageBatchId Postage BatchId to be used to upload the chunk with
* @param data Raw chunk to be uploaded
* @param options Additional options like tag, encryption, pinning, content-type and request options
*
* @returns reference is a content hash of the data
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
* @see [Bee API reference - `POST /chunks`](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post)
*/
uploadChunk(postageBatchId, data, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertBatchId)(postageBatchId);
if (!(data instanceof Uint8Array)) {
throw new TypeError('Data has to be Uint8Array instance!');
}
if (data.length < types_1.SPAN_SIZE) {
throw new error_1.BeeArgumentError(`Chunk has to have size of at least ${types_1.SPAN_SIZE}.`, data);
}
if (data.length > types_1.CHUNK_SIZE + types_1.SPAN_SIZE) {
throw new error_1.BeeArgumentError(`Chunk has to have size of at most ${types_1.CHUNK_SIZE}.`, data);
}
if (options)
(0, type_2.assertUploadOptions)(options);
return chunk.upload(this.getKy(options), data, postageBatchId, options);
});
}
/**
* Download chunk as a byte array
*
* @param reference Bee chunk reference in hex string (either 64 or 128 chars long) or ENS domain.
* @param options Options that affects the request behavior
* @throws TypeError if some of the input parameters is not expected type
* @throws BeeArgumentError if there is passed ENS domain with invalid unicode characters
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
* @see [Bee API reference - `GET /chunks`](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1{reference}/get)
*/
downloadChunk(reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertReferenceOrEns)(reference);
return chunk.download(this.getKy(options), reference);
});
}
/**
* Upload single file to a Bee node.
*
* **To make sure that you won't loose critical data it is highly recommended to also
* locally pin the data with `options.pin = true`**
*
* @param postageBatchId Postage BatchId to be used to upload the data with
* @param data Data or file to be uploaded
* @param name Optional name of the uploaded file
* @param options Additional options like tag, encryption, pinning, content-type and request options
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
* @see [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/File/paths/~1bzz/post)
* @returns reference is a content hash of the file
*/
uploadFile(postageBatchId, data, name, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertBatchId)(postageBatchId);
(0, type_2.assertFileData)(data);
if (options)
(0, type_2.assertFileUploadOptions)(options);
if (name && typeof name !== 'string') {
throw new TypeError('name has to be string or undefined!');
}
if ((0, file_1.isFile)(data)) {
const fileData = yield (0, file_1.fileArrayBuffer)(data);
const fileName = name !== null && name !== void 0 ? name : data.name;
const contentType = data.type;
const fileOptions = Object.assign({ contentType }, options);
return (0, type_2.addCidConversionFunction)(yield bzz.uploadFile(this.getKy(options), fileData, postageBatchId, fileName, fileOptions), swarm_cid_1.ReferenceType.MANIFEST);
}
else if ((0, stream_1.isReadable)(data) && (options === null || options === void 0 ? void 0 : options.tag) && !options.size) {
// TODO: Needed until https://github.com/ethersphere/bee/issues/2317 is resolved
const result = yield bzz.uploadFile(this.getKy(options), data, postageBatchId, name, options);
yield this.updateTag(options.tag, result.reference);
return (0, type_2.addCidConversionFunction)(result, swarm_cid_1.ReferenceType.MANIFEST);
}
else {
return (0, type_2.addCidConversionFunction)(yield bzz.uploadFile(this.getKy(options), data, postageBatchId, name, options), swarm_cid_1.ReferenceType.MANIFEST);
}
});
}
/**
* Download single file.
*
* @param reference Bee file reference in hex string (either 64 or 128 chars long), ENS domain or Swarm CID.
* @param path If reference points to manifest, then this parameter defines path to the file
* @param options Options that affects the request behavior
* @throws TypeError if some of the input parameters is not expected type
* @throws BeeArgumentError if there is passed ENS domain with invalid unicode characters
* @see Data
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
* @see [Bee API reference - `GET /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz~1{reference}~1{path}/get)
*/
downloadFile(reference, path = '', options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
reference = (0, type_2.makeReferenceOrEns)(reference, swarm_cid_1.ReferenceType.MANIFEST);
return bzz.downloadFile(this.getKy(options), reference, path);
});
}
/**
* Download single file as a readable stream
*
* @param reference Bee file reference in hex string (either 64 or 128 chars long), ENS domain or Swarm CID.
* @param path If reference points to manifest / collections, then this parameter defines path to the file
* @param options Options that affects the request behavior
* @throws TypeError if some of the input parameters is not expected type
* @throws BeeArgumentError if there is passed ENS domain with invalid unicode characters
*
* @see [Bee docs - Upload and download](https://docs.ethswarm.org/docs/access-the-swarm/upload-and-download)
* @see [Bee API reference - `GET /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz~1{reference}~1{path}/get)
*/
downloadReadableFile(reference, path = '', options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
reference = (0, type_2.makeReferenceOrEns)(reference, swarm_cid_1.ReferenceType.MANIFEST);
return bzz.downloadFileReadable(this.getKy(options), reference, path);
});
}
/**
* Upload collection of files to a Bee node
*
* Uses the FileList API from the browser.
*
* The returned `UploadResult.tag` might be undefined if called in CORS-enabled environment.
* This will be fixed upon next Bee release. https://github.com/ethersphere/bee-js/issues/406
*
* @param postageBatchId Postage BatchId to be used to upload the data with
* @param fileList list of files to be uploaded
* @param options Additional options like tag, encryption, pinning and request options
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee docs - Upload directory](https://docs.ethswarm.org/docs/access-the-swarm/upload-a-directory/)
* @see [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz/post)
*/
uploadFiles(postageBatchId, fileList, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertBatchId)(postageBatchId);
if (options)
(0, type_2.assertCollectionUploadOptions)(options);
const data = yield (0, collection_1.makeCollectionFromFileList)(fileList);
return (0, type_2.addCidConversionFunction)(yield bzz.uploadCollection(this.getKy(options), data, postageBatchId, options), swarm_cid_1.ReferenceType.MANIFEST);
});
}
/**
* Upload Collection that you can assembly yourself.
*
* The returned `UploadResult.tag` might be undefined if called in CORS-enabled environment.
* This will be fixed upon next Bee release. https://github.com/ethersphere/bee-js/issues/406
*
* @param postageBatchId
* @param collection
* @param options Collections and request options
*/
uploadCollection(postageBatchId, collection, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertBatchId)(postageBatchId);
(0, collection_1.assertCollection)(collection);
if (options)
(0, type_2.assertCollectionUploadOptions)(options);
return (0, type_2.addCidConversionFunction)(yield bzz.uploadCollection(this.ky, collection, postageBatchId, options), swarm_cid_1.ReferenceType.MANIFEST);
});
}
/**
* Upload collection of files.
*
* Available only in Node.js as it uses the `fs` module.
*
* The returned `UploadResult.tag` might be undefined if called in CORS-enabled environment.
* This will be fixed upon next Bee release. https://github.com/ethersphere/bee-js/issues/406
*
* @param postageBatchId Postage BatchId to be used to upload the data with
* @param dir the path of the files to be uploaded
* @param options Additional options like tag, encryption, pinning and request options
*
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
* @see [Bee docs - Upload directory](https://docs.ethswarm.org/docs/access-the-swarm/upload-a-directory/)
* @see [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/Collection/paths/~1bzz/post)
*/
uploadFilesFromDirectory(postageBatchId, dir, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertBatchId)(postageBatchId);
if (options)
(0, type_2.assertCollectionUploadOptions)(options);
const data = yield (0, collection_node_1.makeCollectionFromFS)(dir);
return (0, type_2.addCidConversionFunction)(yield bzz.uploadCollection(this.getKy(options), data, postageBatchId, options), swarm_cid_1.ReferenceType.MANIFEST);
});
}
/**
* Create a new Tag which is meant for tracking progres of syncing data across network.
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param options Options that affects the request behavior
* @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
* @see [Bee API reference - `POST /tags`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/post)
*/
createTag(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
return tag.createTag(this.getKy(options));
});
}
/**
* Fetches all tags.
*
* The listing is limited by options.limit. So you have to iterate using options.offset to get all tags.
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param options Options that affects the request behavior
* @throws TypeError if limit or offset are not numbers or undefined
* @throws BeeArgumentError if limit or offset have invalid options
*
* @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
* @see [Bee API reference - `GET /tags`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/get)
*/
getAllTags(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertAllTagsOptions)(options);
return tag.getAllTags(this.getKy(options), options === null || options === void 0 ? void 0 : options.offset, options === null || options === void 0 ? void 0 : options.limit);
});
}
/**
* Retrieve tag information from Bee node
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param tagUid UID or tag object to be retrieved
* @param options Options that affects the request behavior
* @throws TypeError if tagUid is in not correct format
*
* @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
* @see [Bee API reference - `GET /tags/{uid}`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1{uid}/get)
*
*/
retrieveTag(tagUid, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
tagUid = (0, type_2.makeTagUid)(tagUid);
return tag.retrieveTag(this.getKy(options), tagUid);
});
}
/**
* Delete Tag
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param tagUid UID or tag object to be retrieved
* @param options Options that affects the request behavior
* @throws TypeError if tagUid is in not correct format
* @throws BeeResponse error if something went wrong on the Bee node side while deleting the tag.
*
* @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
* @see [Bee API reference - `DELETE /tags/{uid}`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1{uid}/delete)
*/
deleteTag(tagUid, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
tagUid = (0, type_2.makeTagUid)(tagUid);
return tag.deleteTag(this.getKy(options), tagUid);
});
}
/**
* Update tag's total chunks count.
*
* This is important if you are uploading individual chunks with a tag. Then upon finishing the final root chunk,
* you can use this method to update the total chunks count for the tag.
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param tagUid UID or tag object to be retrieved
* @param reference The root reference that contains all the chunks to be counted
* @param options Options that affects the request behavior
* @throws TypeError if tagUid is in not correct format
* @throws BeeResponse error if something went wrong on the Bee node side while deleting the tag.
*
* @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
* @see [Bee API reference - `PATCH /tags/{uid}`](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1{uid}/patch)
*/
updateTag(tagUid, reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertReference)(reference);
(0, type_2.assertRequestOptions)(options);
tagUid = (0, type_2.makeTagUid)(tagUid);
return tag.updateTag(this.getKy(options), tagUid, reference);
});
}
/**
* Pin local data with given reference
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param reference Data reference
* @param options Options that affects the request behavior
* @throws TypeError if reference is in not correct format
*
* @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
*/
pin(reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertReference)(reference);
return pinning.pin(this.getKy(options), reference);
});
}
/**
* Unpin local data with given reference
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param reference Data reference
* @param options Options that affects the request behavior
* @throws TypeError if reference is in not correct format
*
* @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
*/
unpin(reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertReference)(reference);
return pinning.unpin(this.getKy(options), reference);
});
}
/**
* Get list of all locally pinned references
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param options Options that affects the request behavior
* @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
*/
getAllPins(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
return pinning.getAllPins(this.getKy(options));
});
}
/**
* Get pinning status of chunk with given reference
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* @param reference Bee data reference in hex string (either 64 or 128 chars long) or ENS domain.
* @param options Options that affects the request behavior
* @throws TypeError if some of the input parameters is not expected type
* @throws BeeArgumentError if there is passed ENS domain with invalid unicode characters
*
* @see [Bee docs - Pinning](https://docs.ethswarm.org/docs/access-the-swarm/pinning)
*/
getPin(reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertReference)(reference);
return pinning.getPin(this.getKy(options), reference);
});
}
/**
* Instructs the Bee node to reupload a locally pinned data into the network.
*
* @param reference Bee data reference to be re-uploaded in hex string (either 64 or 128 chars long) or ENS domain.
* @param options Options that affects the request behavior
* @throws BeeArgumentError if the reference is not locally pinned
* @throws TypeError if some of the input parameters is not expected type
* @throws BeeArgumentError if there is passed ENS domain with invalid unicode characters
*
* @see [Bee API reference - `PUT /stewardship`](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1{reference}/put)
*/
reuploadPinnedData(reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertReferenceOrEns)(reference);
yield stewardship.reupload(this.getKy(options), reference);
});
}
/**
* Checks if content specified by reference is retrievable from the network.
*
* @param reference Bee data reference to be checked in hex string (either 64 or 128 chars long) or ENS domain.
* @param options Options that affects the request behavior
* @throws TypeError if some of the input parameters is not expected type
* @throws BeeArgumentError if there is passed ENS domain with invalid unicode characters
*
* @see [Bee API reference - `GET /stewardship`](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1{reference}/get)
*/
isReferenceRetrievable(reference, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertReferenceOrEns)(reference);
return stewardship.isRetrievable(this.getKy(options), reference);
});
}
/**
* Functions that validates if feed is retrievable in the network.
*
* If no index is passed then it check for "latest" update, which is a weaker guarantee as nobody can be really
* sure what is the "latest" update.
*
* If index is passed then it validates all previous sequence index chunks if they are available as they are required
* to correctly resolve the feed upto the given index update.
*
* @param type
* @param owner
* @param topic
* @param index
* @param options
*/
isFeedRetrievable(type, owner, topic, index, options) {
return __awaiter(this, void 0, void 0, function* () {
const canonicalOwner = (0, eth_1.makeEthAddress)(owner);
const canonicalTopic = (0, topic_1.makeTopic)(topic);
if (!index) {
try {
yield this.makeFeedReader(type, canonicalTopic, canonicalOwner).download();
return true;
}
catch (e) {
const err = e;
// Only if the error is "not-found" then we return false otherwise we re-throw the error
if ((err === null || err === void 0 ? void 0 : err.status) === 404) {
return false;
}
throw e;
}
}
if (type !== 'sequence') {
throw new error_1.BeeError('Only Sequence type of Feeds is supported at the moment');
}
return (0, retrievable_1.areAllSequentialFeedsUpdateRetrievable)(this, canonicalOwner, canonicalTopic, index, options);
});
}
/**
* Send data to recipient or target with Postal Service for Swarm.
*
* Because sending a PSS message is slow and CPU intensive,
* it is not supposed to be used for general messaging but
* most likely for setting up an encrypted communication
* channel by sending an one-off message.
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* **Warning! If the recipient Bee node is a light node, then he will never receive the message!**
* This is because light nodes does not fully participate in the data exchange in Swarm network and hence the message won't arrive to them.
*
* @param postageBatchId Postage BatchId that will be assigned to sent message
* @param topic Topic name
* @param target Target message address prefix. Has a limit on length. Recommend to use `Utils.Pss.makeMaxTarget()` to get the most specific target that Bee node will accept.
* @param data Message to be sent
* @param recipient Recipient public key
* @param options Options that affects the request behavior
* @throws TypeError if `data`, `batchId`, `target` or `recipient` are in invalid format
*
* @see [Bee docs - PSS](https://docs.ethswarm.org/docs/dapps-on-swarm/pss)
* @see [Bee API reference - `POST /pss`](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1send~1{topic}~1{targets}/post)
*/
pssSend(postageBatchId, topic, target, data, recipient, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_2.assertData)(data);
(0, type_2.assertBatchId)(postageBatchId);
(0, type_2.assertAddressPrefix)(target);
if (typeof topic !== 'string') {
throw new TypeError('topic has to be an string!');
}
if (recipient) {
(0, type_2.assertPublicKey)(recipient);
return pss.send(this.getKy(options), topic, target, data, postageBatchId, recipient);
}
else {
return pss.send(this.getKy(options), topic, target, data, postageBatchId);
}
});
}
/**
* Subscribe to messages for given topic with Postal Service for Swarm
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* **Warning! If connected Bee node is a light node, then he will never receive any message!**
* This is because light nodes does not fully participate in the data exchange in Swarm network and hence the message won't arrive to them.
*
* @param topic Topic name
* @param handler Message handler interface
*
* @returns Subscription to a given topic
*
* @see [Bee docs - PSS](https://docs.ethswarm.org/docs/dapps-on-swarm/pss)
* @see [Bee API reference - `GET /pss`](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1{topic}/get)
*/
pssSubscribe(topic, handler) {
(0, type_2.assertPssMessageHandler)(handler);
if (typeof topic !== 'string') {
throw new TypeError('topic has to be an string!');
}
const ws = pss.subscribe(this.url, topic);
let cancelled = false;
const cancel = () => {
if (cancelled === false) {
cancelled = true;
// although the WebSocket API offers a `close` function, it seems that
// with the library that we are using (isomorphic-ws) it doesn't close
// the websocket properly, whereas `terminate` does
if (ws.terminate)
ws.terminate();
else
ws.close(); // standard Websocket in browser does not have terminate function
}
};
const subscription = {
topic,
cancel,
};
ws.onmessage = (ev) => __awaiter(this, void 0, void 0, function* () {
const data = yield (0, data_1.prepareWebsocketData)(ev.data);
// ignore empty messages
if (data.length > 0) {
handler.onMessage((0, bytes_1.wrapBytesWithHelpers)(data), subscription);
}
});
ws.onerror = ev => {
// ignore errors after subscription was cancelled
if (!cancelled) {
handler.onError(new error_1.BeeError(ev.message), subscription);
}
};
return subscription;
}
/**
* Receive message with Postal Service for Swarm
*
* Because sending a PSS message is slow and CPU intensive,
* it is not supposed to be used for general messaging but
* most likely for setting up an encrypted communication
* channel by sending an one-off message.
*
* This is a helper function to wait for exactly one message to
* arrive and then cancel the subscription. Additionally a
* timeout can be provided for the message to arrive or else
* an error will be thrown.
*
* **Warning! Not allowed when node is in Gateway mode!**
*
* **Warning! If connected Bee node is a light node, then he will never receive any message!**
* This is because light nodes does not fully participate in the data exchange in Swarm network and hence the message won't arrive to them.
*
* @param topic Topic name
* @param timeoutMsec Timeout in milliseconds
*
* @returns Message in byte array
*
* @see [Bee docs - PSS](https://docs.ethswarm.org/docs/dapps-on-swarm/pss)
* @see [Bee API reference - `GET /pss`](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1{topic}/get)
*/
pssReceive(topic, timeoutMsec = 0) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof topic !== 'string') {
throw new TypeError('topic has to be an string!');
}
if (typeof timeoutMsec !== 'number') {
throw new TypeError('timeoutMsc parameter has to be a number!');
}
return new Promise((resolve, reject) => {
let timeout;
const subscription = this.pssSubscribe(topic, {
onError: error => {
clearTimeout(timeout);
subscription.cancel();
reject(error.message);
},
onMessage: message => {
clearTimeout(timeout);
subscription.cancel();
resolve(message);
},
});
if (timeoutMsec > 0) {
// we need to cast the type because Typescript is getting confused with Node.js'
// alternative type definitions
timeout = setTimeout(() => {
subscription.cancel();
reject(new error_1.BeeError('pssReceive timeout'));
}, timeoutMsec);
}
});
});
}
/**
* Create feed manifest chunk and return the reference to it.
*
* Feed manifest chunk allows for a feed to be able to be resolved through `/bzz` endpoint.
*
* @param postageBatchId Postage BatchId to be used to create the Feed Manifest
* @param type The type of the feed, can be 'epoch' or 'sequence'
* @param topic Topic in hex or bytes
* @param owner Owner's ethereum address in hex or bytes
* @param options Options that affects the request behavior
*
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
* @see [Bee API reference - `POST /feeds`](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1{owner}~1{topic}/post)
* TODO: Once breaking add support for Feed CID
*/
createFeedManifest(postageBatchId, type, topic, owner, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options);
(0, type_1.assertFeedType)(type);
(0, type_2.assertBatchId)(postageBatchId);
const canonicalTopic = (0, topic_1.makeTopic)(topic);
const canonicalOwner = (0, eth_1.makeHexEthAddress)(owner);
return (0, feed_2.createFeedManifest)(this.getKy(options), canonicalOwner, canonicalTopic, postageBatchId, { type });
});
}
/**
* Make a new feed reader for downloading feed updates.
*
* @param type The type of the feed, can be 'epoch' or 'sequence'
* @param topic Topic in hex or bytes
* @param owner Owner's ethereum address in hex or bytes
* @param options Options that affects the request behavior
*
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
*/
makeFeedReader(type, topic, owner, options) {
(0, type_2.assertRequestOptions)(options);
(0, type_1.assertFeedType)(type);
const canonicalTopic = (0, topic_1.makeTopic)(topic);
const canonicalOwner = (0, eth_1.makeHexEthAddress)(owner);
return (0, feed_1.makeFeedReader)(this.getKy(options), type, canonicalTopic, canonicalOwner);
}
/**
* Make a new feed writer for updating feeds
*
* @param type The type of the feed, can be 'epoch' or 'sequence'
* @param topic Topic in hex or bytes
* @param signer The signer's private key or a Signer instance that can sign data
* @param options Options that affects the request behavior
*
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
*/
makeFeedWriter(type, topic, signer, options) {
(0, type_2.assertRequestOptions)(options);
(0, type_1.assertFeedType)(type);
const canonicalTopic = (0, topic_1.makeTopic)(topic);
const canonicalSigner = this.resolveSigner(signer);
return (0, feed_1.makeFeedWriter)(this.getKy(options), type, canonicalTopic, canonicalSigner);
}
/**
* High-level function that allows you to easily set JSON data to feed.
* JSON-like data types are supported.
*
* The default Signer of Bee instance is used if `options.signer` is not specified.
* If none of those two is set error is thrown.
*
* @param postageBatchId Postage BatchId to be used to upload the data with
* @param topic Human readable string, that is internally hashed so there are no constrains there.
* @param data JSON compatible data
* @param options
* @param options.signer Custom instance of Signer or string with private key.
* @param options.type Type of Feed
*
* @throws BeeError if `options.signer` is not specified nor the default Signer on Bee's instance is specified.
*
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
*/
setJsonFeed(postageBatchId, topic, data, options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options, 'JsonFeedOptions');
(0, type_2.assertBatchId)(postageBatchId);
const hashedTopic = this.makeFeedTopic(topic);
const feedType = (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : type_1.DEFAULT_FEED_TYPE;
const writer = this.makeFeedWriter(feedType, hashedTopic, options === null || options === void 0 ? void 0 : options.signer, options);
return (0, json_1.setJsonData)(this, writer, postageBatchId, data, options);
});
}
/**
* High-level function that allows you to easily get data from feed.
* Returned data are parsed using JSON.parse().
*
* This method also supports specification of `signer` object passed to constructor. The order of evaluation is:
* - `options.address`
* - `options.signer`
* - `this.signer`
*
* At least one of these has to be specified!
*
* @param topic Human readable string, that is internally hashed so there are no constrains there.
* @param options
* @param options.signer Custom instance of Signer or string with private key. This option is exclusive with `address` option.
* @param options.address Ethereum address of owner of the feed that signed it. This option is exclusive with `signer` option.
* @param options.type Type of Feed
*
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
*/
getJsonFeed(topic, options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options, 'JsonFeedOptions');
const hashedTopic = this.makeFeedTopic(topic);
const feedType = (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : type_1.DEFAULT_FEED_TYPE;
if ((options === null || options === void 0 ? void 0 : options.signer) && (options === null || options === void 0 ? void 0 : options.address)) {
throw new error_1.BeeError('Both options "signer" and "address" can not be specified at one time!');
}
let address;
if (options === null || options === void 0 ? void 0 : options.address) {
address = (0, eth_1.makeEthAddress)(options === null || options === void 0 ? void 0 : options.address);
}
else {
try {
address = this.resolveSigner(options === null || options === void 0 ? void 0 : options.signer).address;
}
catch (e) {
if (e instanceof error_1.BeeError) {
throw new error_1.BeeError('Either address, signer or default signer has to be specified!');
}
else {
throw e;
}
}
}
const reader = this.makeFeedReader(feedType, hashedTopic, address, options);
return (0, json_1.getJsonData)(this, reader);
});
}
/**
* Make a new feed topic from a string
*
* Because the topic has to be 32 bytes long this function
* hashes the input string to create a topic string of arbitrary length.
*
* @param topic The input string
*/
makeFeedTopic(topic) {
return (0, topic_1.makeTopicFromString)(topic);
}
/**
* Returns an object for reading single owner chunks
*
* @param ownerAddress The ethereum address of the owner
* @param options Options that affects the request behavior
* @see [Bee docs - Chunk Types](https://docs.ethswarm.org/docs/dapps-on-swarm/chunk-types#single-owner-chunks)
*/
makeSOCReader(ownerAddress, options) {
(0, type_2.assertRequestOptions)(options);
const canonicalOwner = (0, eth_1.makeEthAddress)(ownerAddress);
return {
owner: (0, eth_1.makeHexEthAddress)(canonicalOwner),
download: soc_1.downloadSingleOwnerChunk.bind(null, this.getKy(options), canonicalOwner),
};
}
/**
* Returns an object for reading and writing single owner chunks
*
* @param signer The signer's private key or a Signer instance that can sign data
* @param options Options that affects the request behavior
* @see [Bee docs - Chunk Types](https://docs.ethswarm.org/docs/dapps-on-swarm/chunk-types#single-owner-chunks)
*/
makeSOCWriter(signer, options) {
(0, type_2.assertRequestOptions)(options);
const canonicalSigner = this.resolveSigner(signer);
return Object.assign(Object.assign({}, this.makeSOCReader(canonicalSigner.address, options)), { upload: soc_1.uploadSingleOwnerChunkData.bind(null, this.getKy(options), canonicalSigner) });
}
/**
* Ping the Bee node to see if there is a live Bee node on the given URL.
*
* @param options Options that affects the request behavior
* @throws If connection was not successful throw error
*/
checkConnection(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options, 'PostageBatchOptions');
return status.checkConnection(this.getKy(options));
});
}
/**
* Ping the Bee node to see if there is a live Bee node on the given URL.
*
* @param options Options that affects the request behavior
* @returns true if successful, false on error
*/
isConnected(options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_2.assertRequestOptions)(options, 'PostageBatchOptions');
try {
yield status.checkConnection(this.getKy(options));
}
catch (e) {
return false;
}
return true;
});
}
/**
* @param signer
* @private
* @throws BeeError if either no Signer was passed or no default Signer was specified for the instance
*/
resolveSigner(signer) {
if (signer) {
return (0, signer_1.makeSigner)(signer);
}
if (this.signer) {
return this.signer;
}
throw new error_1.BeeError('You have to pass Signer as property to either the method call or constructor! Non found.');
}
getKy(options) {
if (!options) {
return this.ky;
}
return this.ky.extend(options);
}
}
exports.Bee = Bee;

55
node_modules/@ethersphere/bee-js/dist/cjs/chunk/bmt.js

@ -0,0 +1,55 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bmtHash = void 0;
// For ESM compatibility
const js_sha3_1 = __importDefault(require("js-sha3"));
const { keccak256 } = js_sha3_1.default;
const error_1 = require("../utils/error");
const hash_1 = require("../utils/hash");
const MAX_CHUNK_PAYLOAD_SIZE = 4096;
const SEGMENT_SIZE = 32;
const SEGMENT_PAIR_SIZE = 2 * SEGMENT_SIZE;
const HASH_SIZE = 32;
/**
* Calculate a Binary Merkle Tree hash for a chunk
*
* The BMT chunk address is the hash of the 8 byte span and the root
* hash of a binary Merkle tree (BMT) built on the 32-byte segments
* of the underlying data.
*
* If the chunk content is less than 4k, the hash is calculated as
* if the chunk was padded with all zeros up to 4096 bytes.
*
* @param chunkContent Chunk data including span and payload as well
*
* @returns the keccak256 hash in a byte array
*/
function bmtHash(chunkContent) {
const span = chunkContent.slice(0, 8);
const payload = chunkContent.slice(8);
const rootHash = bmtRootHash(payload);
const chunkHashInput = new Uint8Array([...span, ...rootHash]);
const chunkHash = (0, hash_1.keccak256Hash)(chunkHashInput);
return chunkHash;
}
exports.bmtHash = bmtHash;
function bmtRootHash(payload) {
if (payload.length > MAX_CHUNK_PAYLOAD_SIZE) {
throw new error_1.BeeArgumentError('invalid data length', payload);
}
// create an input buffer padded with zeros
let input = new Uint8Array([...payload, ...new Uint8Array(MAX_CHUNK_PAYLOAD_SIZE - payload.length)]);
while (input.length !== HASH_SIZE) {
const output = new Uint8Array(input.length / 2);
// in each round we hash the segment pairs together
for (let offset = 0; offset < input.length; offset += SEGMENT_PAIR_SIZE) {
const hashNumbers = keccak256.array(input.slice(offset, offset + SEGMENT_PAIR_SIZE));
output.set(hashNumbers, offset / 2);
}
input = output;
}
return input;
}

56
node_modules/@ethersphere/bee-js/dist/cjs/chunk/cac.js

@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertValidChunkData = exports.isValidChunkData = exports.makeContentAddressedChunk = exports.MAX_PAYLOAD_SIZE = exports.MIN_PAYLOAD_SIZE = void 0;
const error_1 = require("../utils/error");
const bmt_1 = require("./bmt");
const bytes_1 = require("../utils/bytes");
const serialize_1 = require("./serialize");
const span_1 = require("./span");
exports.MIN_PAYLOAD_SIZE = 1;
exports.MAX_PAYLOAD_SIZE = 4096;
const CAC_SPAN_OFFSET = 0;
const CAC_PAYLOAD_OFFSET = CAC_SPAN_OFFSET + span_1.SPAN_SIZE;
/**
* Creates a content addressed chunk and verifies the payload size.
*
* @param payloadBytes the data to be stored in the chunk
*/
function makeContentAddressedChunk(payloadBytes) {
const span = (0, span_1.makeSpan)(payloadBytes.length);
(0, bytes_1.assertFlexBytes)(payloadBytes, exports.MIN_PAYLOAD_SIZE, exports.MAX_PAYLOAD_SIZE);
const data = (0, serialize_1.serializeBytes)(span, payloadBytes);
return {
data,
span: () => span,
payload: () => (0, bytes_1.flexBytesAtOffset)(data, CAC_PAYLOAD_OFFSET, exports.MIN_PAYLOAD_SIZE, exports.MAX_PAYLOAD_SIZE),
address: () => (0, bmt_1.bmtHash)(data),
};
}
exports.makeContentAddressedChunk = makeContentAddressedChunk;
/**
* Type guard for valid content addressed chunk data
*
* @param data The chunk data
* @param chunkAddress The address of the chunk
*/
function isValidChunkData(data, chunkAddress) {
if (!(data instanceof Uint8Array))
return false;
const address = (0, bmt_1.bmtHash)(data);
return (0, bytes_1.bytesEqual)(address, chunkAddress);
}
exports.isValidChunkData = isValidChunkData;
/**
* Asserts if data are representing given address of its chunk.
*
* @param data The chunk data
* @param chunkAddress The address of the chunk
*
* @returns a valid content addressed chunk or throws error
*/
function assertValidChunkData(data, chunkAddress) {
if (!isValidChunkData(data, chunkAddress)) {
throw new error_1.BeeError('Address of content address chunk does not match given data!');
}
}
exports.assertValidChunkData = assertValidChunkData;

19
node_modules/@ethersphere/bee-js/dist/cjs/chunk/serialize.js

@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeBytes = void 0;
/**
* Helper function for serialize byte arrays
*
* @param arrays Any number of byte array arguments
*/
function serializeBytes(...arrays) {
const length = arrays.reduce((prev, curr) => prev + curr.length, 0);
const buffer = new Uint8Array(length);
let offset = 0;
arrays.forEach(arr => {
buffer.set(arr, offset);
offset += arr.length;
});
return buffer;
}
exports.serializeBytes = serializeBytes;

137
node_modules/@ethersphere/bee-js/dist/cjs/chunk/signer.js

@ -0,0 +1,137 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.sign = exports.makeSigner = exports.assertSigner = exports.makePrivateKeySigner = exports.recoverAddress = exports.defaultSign = void 0;
// For ESM compatibility
const elliptic_1 = __importDefault(require("elliptic"));
const { ec } = elliptic_1.default;
const error_1 = require("../utils/error");
const bytes_1 = require("../utils/bytes");
const hash_1 = require("../utils/hash");
const hex_1 = require("../utils/hex");
const types_1 = require("../types");
const type_1 = require("../utils/type");
const UNCOMPRESSED_RECOVERY_ID = 27;
function hashWithEthereumPrefix(data) {
const ethereumSignedMessagePrefix = `\x19Ethereum Signed Message:\n${data.length}`;
const prefixBytes = new TextEncoder().encode(ethereumSignedMessagePrefix);
return (0, hash_1.keccak256Hash)(prefixBytes, data);
}
/**
* The default signer function that can be used for integrating with
* other applications (e.g. wallets).
*
* @param data The data to be signed
* @param privateKey The private key used for signing the data
*/
function defaultSign(data, privateKey) {
const curve = new ec('secp256k1');
const keyPair = curve.keyFromPrivate(privateKey);
const hashedDigest = hashWithEthereumPrefix(data);
const sigRaw = curve.sign(hashedDigest, keyPair, { canonical: true, pers: undefined });
if (sigRaw.recoveryParam === null) {
throw new error_1.BeeError('signDigest recovery param was null');
}
const signature = new Uint8Array([
...sigRaw.r.toArray('be', 32),
...sigRaw.s.toArray('be', 32),
sigRaw.recoveryParam + UNCOMPRESSED_RECOVERY_ID,
]);
return signature;
}
exports.defaultSign = defaultSign;
function publicKeyToAddress(pubKey) {
const pubBytes = pubKey.encode('array', false);
return (0, hash_1.keccak256Hash)(pubBytes.slice(1)).slice(12);
}
/**
* Recovers the ethereum address from a given signature.
*
* Can be used for verifying a piece of data when the public key is
* known.
*
* @param signature The signature
* @param digest The digest of the data
*
* @returns the recovered address
*/
function recoverAddress(signature, digest) {
const curve = new ec('secp256k1');
const sig = {
r: signature.slice(0, 32),
s: signature.slice(32, 64),
};
const recoveryParam = signature[64] - UNCOMPRESSED_RECOVERY_ID;
const hash = hashWithEthereumPrefix(digest);
const recPubKey = curve.recoverPubKey(hash, sig, recoveryParam);
return publicKeyToAddress(recPubKey);
}
exports.recoverAddress = recoverAddress;
/**
* Creates a singer object that can be used when the private key is known.
*
* @param privateKey The private key
*/
function makePrivateKeySigner(privateKey) {
const curve = new ec('secp256k1');
const keyPair = curve.keyFromPrivate(privateKey);
const address = publicKeyToAddress(keyPair.getPublic());
return {
sign: (digest) => defaultSign(digest, privateKey),
address,
};
}
exports.makePrivateKeySigner = makePrivateKeySigner;
function assertSigner(signer) {
if (!(0, type_1.isStrictlyObject)(signer)) {
throw new TypeError('Signer must be an object!');
}
const typedSigner = signer;
if (!(0, bytes_1.isBytes)(typedSigner.address, 20)) {
throw new TypeError("Signer's address must be Uint8Array with 20 bytes!");
}
if (typeof typedSigner.sign !== 'function') {
throw new TypeError('Signer sign property needs to be function!');
}
}
exports.assertSigner = assertSigner;
function makeSigner(signer) {
if (typeof signer === 'string') {
const hexKey = (0, hex_1.makeHexString)(signer, 64);
const keyBytes = (0, hex_1.hexToBytes)(hexKey); // HexString is verified for 64 length => 32 is guaranteed
return makePrivateKeySigner(keyBytes);
}
else if (signer instanceof Uint8Array) {
(0, bytes_1.assertBytes)(signer, 32);
return makePrivateKeySigner(signer);
}
assertSigner(signer);
return signer;
}
exports.makeSigner = makeSigner;
function sign(signer, data) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield signer.sign((0, bytes_1.wrapBytesWithHelpers)(data));
if (typeof result === 'string') {
const hexString = (0, hex_1.makeHexString)(result, types_1.SIGNATURE_HEX_LENGTH);
return (0, hex_1.hexToBytes)(hexString);
}
if (result instanceof Uint8Array) {
(0, bytes_1.assertBytes)(result, types_1.SIGNATURE_BYTES_LENGTH);
return result;
}
throw new TypeError('Invalid output of sign function!');
});
}
exports.sign = sign;

172
node_modules/@ethersphere/bee-js/dist/cjs/chunk/soc.js

@ -0,0 +1,172 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.downloadSingleOwnerChunk = exports.uploadSingleOwnerChunkData = exports.uploadSingleOwnerChunk = exports.makeSingleOwnerChunk = exports.makeSOCAddress = exports.makeSingleOwnerChunkFromData = void 0;
const bytes_1 = require("../utils/bytes");
const bmt_1 = require("./bmt");
const signer_1 = require("./signer");
const hash_1 = require("../utils/hash");
const span_1 = require("./span");
const serialize_1 = require("./serialize");
const error_1 = require("../utils/error");
const cac_1 = require("./cac");
const hex_1 = require("../utils/hex");
const socAPI = __importStar(require("../modules/soc"));
const chunkAPI = __importStar(require("../modules/chunk"));
const type_1 = require("../utils/type");
const IDENTIFIER_SIZE = 32;
const SIGNATURE_SIZE = 65;
const SOC_IDENTIFIER_OFFSET = 0;
const SOC_SIGNATURE_OFFSET = SOC_IDENTIFIER_OFFSET + IDENTIFIER_SIZE;
const SOC_SPAN_OFFSET = SOC_SIGNATURE_OFFSET + SIGNATURE_SIZE;
const SOC_PAYLOAD_OFFSET = SOC_SPAN_OFFSET + span_1.SPAN_SIZE;
function recoverChunkOwner(data) {
const cacData = data.slice(SOC_SPAN_OFFSET);
const chunkAddress = (0, bmt_1.bmtHash)(cacData);
const signature = (0, bytes_1.bytesAtOffset)(data, SOC_SIGNATURE_OFFSET, SIGNATURE_SIZE);
const identifier = (0, bytes_1.bytesAtOffset)(data, SOC_IDENTIFIER_OFFSET, IDENTIFIER_SIZE);
const digest = (0, hash_1.keccak256Hash)(identifier, chunkAddress);
const ownerAddress = (0, signer_1.recoverAddress)(signature, digest);
return ownerAddress;
}
/**
* Verifies if the data is a valid single owner chunk
*
* @param data The chunk data
* @param address The address of the single owner chunk
*
* @returns a single owner chunk or throws error
*/
function makeSingleOwnerChunkFromData(data, address) {
const ownerAddress = recoverChunkOwner(data);
const identifier = (0, bytes_1.bytesAtOffset)(data, SOC_IDENTIFIER_OFFSET, IDENTIFIER_SIZE);
const socAddress = (0, hash_1.keccak256Hash)(identifier, ownerAddress);
if (!(0, bytes_1.bytesEqual)(address, socAddress)) {
throw new error_1.BeeError('SOC Data does not match given address!');
}
const signature = () => (0, bytes_1.bytesAtOffset)(data, SOC_SIGNATURE_OFFSET, SIGNATURE_SIZE);
const span = () => (0, bytes_1.bytesAtOffset)(data, SOC_SPAN_OFFSET, span_1.SPAN_SIZE);
const payload = () => (0, bytes_1.flexBytesAtOffset)(data, SOC_PAYLOAD_OFFSET, cac_1.MIN_PAYLOAD_SIZE, cac_1.MAX_PAYLOAD_SIZE);
return {
data,
identifier: () => identifier,
signature,
span,
payload,
address: () => socAddress,
owner: () => ownerAddress,
};
}
exports.makeSingleOwnerChunkFromData = makeSingleOwnerChunkFromData;
function makeSOCAddress(identifier, address) {
return (0, hash_1.keccak256Hash)(identifier, address);
}
exports.makeSOCAddress = makeSOCAddress;
/**
* Creates a single owner chunk object
*
* @param chunk A chunk object used for the span and payload
* @param identifier The identifier of the chunk
* @param signer The singer interface for signing the chunk
*/
function makeSingleOwnerChunk(chunk, identifier, signer) {
return __awaiter(this, void 0, void 0, function* () {
const chunkAddress = chunk.address();
(0, cac_1.assertValidChunkData)(chunk.data, chunkAddress);
const digest = (0, hash_1.keccak256Hash)(identifier, chunkAddress);
const signature = yield (0, signer_1.sign)(signer, digest);
const data = (0, serialize_1.serializeBytes)(identifier, signature, chunk.span(), chunk.payload());
const address = makeSOCAddress(identifier, signer.address);
return {
data,
identifier: () => identifier,
signature: () => signature,
span: () => chunk.span(),
payload: () => chunk.payload(),
address: () => address,
owner: () => signer.address,
};
});
}
exports.makeSingleOwnerChunk = makeSingleOwnerChunk;
/**
* Helper function to upload a chunk.
*
* It uses the Chunk API and calculates the address before uploading.
*
* @param ky Ky instance
* @param chunk A chunk object
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
* @param options Upload options
*/
function uploadSingleOwnerChunk(ky, chunk, postageBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
const owner = (0, hex_1.bytesToHex)(chunk.owner());
const identifier = (0, hex_1.bytesToHex)(chunk.identifier());
const signature = (0, hex_1.bytesToHex)(chunk.signature());
const data = (0, serialize_1.serializeBytes)(chunk.span(), chunk.payload());
return socAPI.upload(ky, owner, identifier, signature, data, postageBatchId, options);
});
}
exports.uploadSingleOwnerChunk = uploadSingleOwnerChunk;
/**
* Helper function to create and upload SOC.
*
* @param ky Ky instance
* @param signer The singer interface for signing the chunk
* @param postageBatchId
* @param identifier The identifier of the chunk
* @param data The chunk data
* @param options
*/
function uploadSingleOwnerChunkData(ky, signer, postageBatchId, identifier, data, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertAddress)(postageBatchId);
const cac = (0, cac_1.makeContentAddressedChunk)(data);
const soc = yield makeSingleOwnerChunk(cac, identifier, signer);
return uploadSingleOwnerChunk(ky, soc, postageBatchId, options);
});
}
exports.uploadSingleOwnerChunkData = uploadSingleOwnerChunkData;
/**
* Helper function to download SOC.
*
* @param url The url of the Bee service
* @param ownerAddress The singer interface for signing the chunk
* @param identifier The identifier of the chunk
*/
function downloadSingleOwnerChunk(ky, ownerAddress, identifier) {
return __awaiter(this, void 0, void 0, function* () {
const address = makeSOCAddress(identifier, ownerAddress);
const data = yield chunkAPI.download(ky, (0, hex_1.bytesToHex)(address));
return makeSingleOwnerChunkFromData(data, address);
});
}
exports.downloadSingleOwnerChunk = downloadSingleOwnerChunk;

29
node_modules/@ethersphere/bee-js/dist/cjs/chunk/span.js

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeSpan = exports.SPAN_SIZE = void 0;
const error_1 = require("../utils/error");
exports.SPAN_SIZE = 8;
// we limit the maximum span size in 32 bits to avoid BigInt compatibility issues
const MAX_SPAN_LENGTH = Math.pow(2, 32) - 1;
/**
* Create a span for storing the length of the chunk
*
* The length is encoded in 64-bit little endian.
*
* @param length The length of the span
*/
function makeSpan(length) {
if (length <= 0) {
throw new error_1.BeeArgumentError('invalid length for span', length);
}
if (length > MAX_SPAN_LENGTH) {
throw new error_1.BeeArgumentError('invalid length (> MAX_SPAN_LENGTH)', length);
}
const span = new Uint8Array(exports.SPAN_SIZE);
const dataView = new DataView(span.buffer);
const littleEndian = true;
const lengthLower32 = length & 0xffffffff;
dataView.setUint32(0, lengthLower32, littleEndian);
return span;
}
exports.makeSpan = makeSpan;

35
node_modules/@ethersphere/bee-js/dist/cjs/feed/identifier.js

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeFeedIdentifier = void 0;
const types_1 = require("../types");
const hash_1 = require("../utils/hash");
const hex_1 = require("../utils/hex");
const uint64_1 = require("../utils/uint64");
function isEpoch(epoch) {
return typeof epoch === 'object' && epoch !== null && 'time' in epoch && 'level' in epoch;
}
function hashFeedIdentifier(topic, index) {
return (0, hash_1.keccak256Hash)((0, hex_1.hexToBytes)(topic), index);
}
function makeSequentialFeedIdentifier(topic, index) {
const indexBytes = (0, uint64_1.writeUint64BigEndian)(index);
return hashFeedIdentifier(topic, indexBytes);
}
function makeFeedIndexBytes(s) {
const hex = (0, hex_1.makeHexString)(s, types_1.FEED_INDEX_HEX_LENGTH);
return (0, hex_1.hexToBytes)(hex);
}
function makeFeedIdentifier(topic, index) {
if (typeof index === 'number') {
return makeSequentialFeedIdentifier(topic, index);
}
else if (typeof index === 'string') {
const indexBytes = makeFeedIndexBytes(index);
return hashFeedIdentifier(topic, indexBytes);
}
else if (isEpoch(index)) {
throw new TypeError('epoch is not yet implemented');
}
return hashFeedIdentifier(topic, index);
}
exports.makeFeedIdentifier = makeFeedIdentifier;

128
node_modules/@ethersphere/bee-js/dist/cjs/feed/index.js

@ -0,0 +1,128 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeFeedWriter = exports.makeFeedReader = exports.downloadFeedUpdate = exports.getFeedUpdateChunkReference = exports.updateFeed = exports.findNextIndex = void 0;
const hash_1 = require("../utils/hash");
const serialize_1 = require("../chunk/serialize");
const feed_1 = require("../modules/feed");
const soc_1 = require("../chunk/soc");
const types_1 = require("../types");
const bytes_1 = require("../utils/bytes");
const error_1 = require("../utils/error");
const hex_1 = require("../utils/hex");
const uint64_1 = require("../utils/uint64");
const chunkAPI = __importStar(require("../modules/chunk"));
const eth_1 = require("../utils/eth");
const type_1 = require("../utils/type");
const identifier_1 = require("./identifier");
const reference_1 = require("../utils/reference");
const TIMESTAMP_PAYLOAD_OFFSET = 0;
const TIMESTAMP_PAYLOAD_SIZE = 8;
const REFERENCE_PAYLOAD_OFFSET = TIMESTAMP_PAYLOAD_SIZE;
function findNextIndex(ky, owner, topic, options) {
return __awaiter(this, void 0, void 0, function* () {
try {
const feedUpdate = yield (0, feed_1.fetchLatestFeedUpdate)(ky, owner, topic, options);
return (0, hex_1.makeHexString)(feedUpdate.feedIndexNext, types_1.FEED_INDEX_HEX_LENGTH);
}
catch (e) {
if (e instanceof error_1.BeeResponseError && e.status === 404) {
return (0, hex_1.bytesToHex)((0, bytes_1.makeBytes)(8));
}
throw e;
}
});
}
exports.findNextIndex = findNextIndex;
function updateFeed(ky, signer, topic, reference, postageBatchId, options, index = 'latest') {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const ownerHex = (0, eth_1.makeHexEthAddress)(signer.address);
const nextIndex = index === 'latest' ? yield findNextIndex(ky, ownerHex, topic, options) : index;
const identifier = (0, identifier_1.makeFeedIdentifier)(topic, nextIndex);
const at = (_a = options === null || options === void 0 ? void 0 : options.at) !== null && _a !== void 0 ? _a : Date.now() / 1000.0;
const timestamp = (0, uint64_1.writeUint64BigEndian)(at);
const payloadBytes = (0, serialize_1.serializeBytes)(timestamp, reference);
return (0, soc_1.uploadSingleOwnerChunkData)(ky, signer, postageBatchId, identifier, payloadBytes, options);
});
}
exports.updateFeed = updateFeed;
function getFeedUpdateChunkReference(owner, topic, index) {
const identifier = (0, identifier_1.makeFeedIdentifier)(topic, index);
return (0, hash_1.keccak256Hash)(identifier, owner);
}
exports.getFeedUpdateChunkReference = getFeedUpdateChunkReference;
function downloadFeedUpdate(ky, owner, topic, index) {
return __awaiter(this, void 0, void 0, function* () {
const address = getFeedUpdateChunkReference(owner, topic, index);
const addressHex = (0, hex_1.bytesToHex)(address);
const data = yield chunkAPI.download(ky, addressHex);
const soc = (0, soc_1.makeSingleOwnerChunkFromData)(data, address);
const payload = soc.payload();
const timestampBytes = (0, bytes_1.bytesAtOffset)(payload, TIMESTAMP_PAYLOAD_OFFSET, TIMESTAMP_PAYLOAD_SIZE);
const timestamp = (0, uint64_1.readUint64BigEndian)(timestampBytes);
const reference = (0, reference_1.makeBytesReference)(payload, REFERENCE_PAYLOAD_OFFSET);
return {
timestamp,
reference,
};
});
}
exports.downloadFeedUpdate = downloadFeedUpdate;
function makeFeedReader(ky, type, topic, owner) {
return {
type,
owner,
topic,
download(options) {
return __awaiter(this, void 0, void 0, function* () {
if (!(options === null || options === void 0 ? void 0 : options.index)) {
return (0, feed_1.fetchLatestFeedUpdate)(ky, owner, topic, Object.assign(Object.assign({}, options), { type }));
}
const update = yield downloadFeedUpdate(ky, (0, hex_1.hexToBytes)(owner), topic, options.index);
return {
reference: (0, hex_1.bytesToHex)(update.reference),
feedIndex: options.index,
feedIndexNext: '',
};
});
},
};
}
exports.makeFeedReader = makeFeedReader;
function makeFeedWriter(ky, type, topic, signer) {
const upload = (postageBatchId, reference, options) => __awaiter(this, void 0, void 0, function* () {
(0, type_1.assertAddress)(postageBatchId);
const canonicalReference = (0, reference_1.makeBytesReference)(reference);
return updateFeed(ky, signer, topic, canonicalReference, postageBatchId, Object.assign(Object.assign({}, options), { type }));
});
return Object.assign(Object.assign({}, makeFeedReader(ky, type, topic, (0, eth_1.makeHexEthAddress)(signer.address))), { upload });
}
exports.makeFeedWriter = makeFeedWriter;

41
node_modules/@ethersphere/bee-js/dist/cjs/feed/json.js

@ -0,0 +1,41 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setJsonData = exports.getJsonData = void 0;
const type_1 = require("../utils/type");
function serializeJson(data) {
try {
const jsonString = JSON.stringify(data);
return new TextEncoder().encode(jsonString);
}
catch (e) {
if ((0, type_1.isError)(e)) {
e.message = `JsonFeed: ${e.message}`;
}
throw e;
}
}
function getJsonData(bee, reader) {
return __awaiter(this, void 0, void 0, function* () {
const feedUpdate = yield reader.download();
const retrievedData = yield bee.downloadData(feedUpdate.reference);
return retrievedData.json();
});
}
exports.getJsonData = getJsonData;
function setJsonData(bee, writer, postageBatchId, data, options) {
return __awaiter(this, void 0, void 0, function* () {
const serializedData = serializeJson(data);
const { reference } = yield bee.uploadData(postageBatchId, serializedData, options);
return writer.upload(postageBatchId, reference);
});
}
exports.setJsonData = setJsonData;

72
node_modules/@ethersphere/bee-js/dist/cjs/feed/retrievable.js

@ -0,0 +1,72 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.areAllSequentialFeedsUpdateRetrievable = void 0;
const index_1 = require("./index");
const uint64_1 = require("../utils/uint64");
const hex_1 = require("../utils/hex");
function makeNumericIndex(index) {
if (index instanceof Uint8Array) {
return (0, uint64_1.readUint64BigEndian)(index);
}
if (typeof index === 'string') {
return parseInt(index);
}
if (typeof index === 'number') {
return index;
}
throw new TypeError('Unknown type of index!');
}
/**
* Function that checks if a chunk is retrievable by actually downloading it.
* The /stewardship/{reference} endpoint does not support verification of chunks, but only manifest's references.
*
* @param bee
* @param ref
* @param options
*/
function isChunkRetrievable(bee, ref, options) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield bee.downloadChunk(ref, options);
return true;
}
catch (e) {
const err = e;
if (err.status === 404) {
return false;
}
throw e;
}
});
}
/**
* Creates array of references for all sequence updates chunk up to the given index.
*
* @param owner
* @param topic
* @param index
*/
function getAllSequenceUpdateReferences(owner, topic, index) {
const numIndex = makeNumericIndex(index);
const updateReferences = new Array(numIndex + 1);
for (let i = 0; i <= numIndex; i++) {
updateReferences[i] = (0, hex_1.bytesToHex)((0, index_1.getFeedUpdateChunkReference)(owner, topic, i));
}
return updateReferences;
}
function areAllSequentialFeedsUpdateRetrievable(bee, owner, topic, index, options) {
return __awaiter(this, void 0, void 0, function* () {
const chunkRetrievablePromises = getAllSequenceUpdateReferences(owner, topic, index).map((ref) => __awaiter(this, void 0, void 0, function* () { return isChunkRetrievable(bee, ref, options); }));
return (yield Promise.all(chunkRetrievablePromises)).every(result => result);
});
}
exports.areAllSequentialFeedsUpdateRetrievable = areAllSequentialFeedsUpdateRetrievable;

25
node_modules/@ethersphere/bee-js/dist/cjs/feed/topic.js

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeTopicFromString = exports.makeTopic = void 0;
const hash_1 = require("../utils/hash");
const bytes_1 = require("../utils/bytes");
const hex_1 = require("../utils/hex");
const types_1 = require("../types");
function makeTopic(topic) {
if (typeof topic === 'string') {
return (0, hex_1.makeHexString)(topic, types_1.TOPIC_HEX_LENGTH);
}
else if (topic instanceof Uint8Array) {
(0, bytes_1.assertBytes)(topic, types_1.TOPIC_BYTES_LENGTH);
return (0, hex_1.bytesToHex)(topic, types_1.TOPIC_HEX_LENGTH);
}
throw new TypeError('invalid topic');
}
exports.makeTopic = makeTopic;
function makeTopicFromString(s) {
if (typeof s !== 'string') {
throw new TypeError('topic has to be string!');
}
return (0, hex_1.bytesToHex)((0, hash_1.keccak256Hash)(s), types_1.TOPIC_HEX_LENGTH);
}
exports.makeTopicFromString = makeTopicFromString;

15
node_modules/@ethersphere/bee-js/dist/cjs/feed/type.js

@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertFeedType = exports.isFeedType = exports.DEFAULT_FEED_TYPE = void 0;
const feedTypes = ['sequence', 'epoch'];
exports.DEFAULT_FEED_TYPE = 'sequence';
function isFeedType(type) {
return typeof type === 'string' && feedTypes.includes(type);
}
exports.isFeedType = isFeedType;
function assertFeedType(type) {
if (!isFeedType(type)) {
throw new TypeError('invalid feed type');
}
}
exports.assertFeedType = assertFeedType;

35
node_modules/@ethersphere/bee-js/dist/cjs/index.js

@ -0,0 +1,35 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BeeDebug = exports.Bee = exports.SUPPORTED_BEE_VERSION_EXACT = exports.SUPPORTED_BEE_VERSION = exports.Utils = void 0;
const bee_1 = require("./bee");
Object.defineProperty(exports, "Bee", { enumerable: true, get: function () { return bee_1.Bee; } });
const bee_debug_1 = require("./bee-debug");
Object.defineProperty(exports, "BeeDebug", { enumerable: true, get: function () { return bee_debug_1.BeeDebug; } });
exports.Utils = __importStar(require("./utils/expose"));
__exportStar(require("./types"), exports);
__exportStar(require("./utils/error"), exports);
var status_1 = require("./modules/debug/status");
Object.defineProperty(exports, "SUPPORTED_BEE_VERSION", { enumerable: true, get: function () { return status_1.SUPPORTED_BEE_VERSION; } });
Object.defineProperty(exports, "SUPPORTED_BEE_VERSION_EXACT", { enumerable: true, get: function () { return status_1.SUPPORTED_BEE_VERSION_EXACT; } });

74
node_modules/@ethersphere/bee-js/dist/cjs/modules/bytes.js

@ -0,0 +1,74 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.downloadReadable = exports.download = exports.upload = void 0;
const data_1 = require("../utils/data");
const headers_1 = require("../utils/headers");
const http_1 = require("../utils/http");
const bytes_1 = require("../utils/bytes");
const type_1 = require("../utils/type");
const endpoint = 'bytes';
/**
* Upload data to a Bee node
*
* @param ky Ky instance
* @param data Data to be uploaded
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
* @param options Additional options like tag, encryption, pinning
*/
function upload(ky, data, postageBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: endpoint,
method: 'post',
responseType: 'json',
body: yield (0, data_1.prepareData)(data),
headers: Object.assign({ 'content-type': 'application/octet-stream' }, (0, headers_1.extractUploadHeaders)(postageBatchId, options)),
});
return {
reference: response.data.reference,
tagUid: (0, type_1.makeTagUid)(response.headers.get('swarm-tag')),
};
});
}
exports.upload = upload;
/**
* Download data as a byte array
*
* @param ky
* @param hash Bee content reference
*/
function download(ky, hash) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
responseType: 'arraybuffer',
path: `${endpoint}/${hash}`,
});
return (0, bytes_1.wrapBytesWithHelpers)(new Uint8Array(response.data));
});
}
exports.download = download;
/**
* Download data as a readable stream
*
* @param ky
* @param hash Bee content reference
*/
function downloadReadable(ky, hash) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
responseType: 'stream',
path: `${endpoint}/${hash}`,
});
return response.data;
});
}
exports.downloadReadable = downloadReadable;

131
node_modules/@ethersphere/bee-js/dist/cjs/modules/bzz.js

@ -0,0 +1,131 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.uploadCollection = exports.downloadFileReadable = exports.downloadFile = exports.uploadFile = void 0;
const headers_1 = require("../utils/headers");
const http_1 = require("../utils/http");
const data_1 = require("../utils/data");
const tar_1 = require("../utils/tar");
const collection_1 = require("../utils/collection");
const bytes_1 = require("../utils/bytes");
const stream_1 = require("../utils/stream");
const type_1 = require("../utils/type");
const bzzEndpoint = 'bzz';
function extractFileUploadHeaders(postageBatchId, options) {
const headers = (0, headers_1.extractUploadHeaders)(postageBatchId, options);
if (options === null || options === void 0 ? void 0 : options.size)
headers['content-length'] = String(options.size);
if (options === null || options === void 0 ? void 0 : options.contentType)
headers['content-type'] = options.contentType;
return headers;
}
/**
* Upload single file
*
* @param ky
* @param data Files data
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
* @param name Name that will be attached to the uploaded file. Wraps the data into manifest with set index document.
* @param options
*/
function uploadFile(ky, data, postageBatchId, name, options) {
return __awaiter(this, void 0, void 0, function* () {
if ((0, stream_1.isReadable)(data) && !(options === null || options === void 0 ? void 0 : options.contentType)) {
if (!options)
options = {};
options.contentType = 'application/octet-stream';
}
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: bzzEndpoint,
body: yield (0, data_1.prepareData)(data),
headers: Object.assign({}, extractFileUploadHeaders(postageBatchId, options)),
searchParams: { name },
responseType: 'json',
});
return {
reference: response.data.reference,
tagUid: (0, type_1.makeTagUid)(response.headers.get('swarm-tag')),
};
});
}
exports.uploadFile = uploadFile;
/**
* Download single file as a buffer
*
* @param ky Ky instance for given Bee class instance
* @param hash Bee file or collection hash
* @param path If hash is collection then this defines path to a single file in the collection
*/
function downloadFile(ky, hash, path = '') {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'GET',
responseType: 'arraybuffer',
path: `${bzzEndpoint}/${hash}/${path}`,
});
const file = Object.assign(Object.assign({}, (0, headers_1.readFileHeaders)(response.headers)), { data: (0, bytes_1.wrapBytesWithHelpers)(new Uint8Array(response.data)) });
return file;
});
}
exports.downloadFile = downloadFile;
/**
* Download single file as a readable stream
*
* @param ky Ky instance for given Bee class instance
* @param hash Bee file or collection hash
* @param path If hash is collection then this defines path to a single file in the collection
*/
function downloadFileReadable(ky, hash, path = '') {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'GET',
responseType: 'stream',
path: `${bzzEndpoint}/${hash}/${path}`,
});
const file = Object.assign(Object.assign({}, (0, headers_1.readFileHeaders)(response.headers)), { data: response.data });
return file;
});
}
exports.downloadFileReadable = downloadFileReadable;
function extractCollectionUploadHeaders(postageBatchId, options) {
const headers = (0, headers_1.extractUploadHeaders)(postageBatchId, options);
if (options === null || options === void 0 ? void 0 : options.indexDocument)
headers['swarm-index-document'] = options.indexDocument;
if (options === null || options === void 0 ? void 0 : options.errorDocument)
headers['swarm-error-document'] = options.errorDocument;
return headers;
}
/**
* Upload collection
* @param ky Ky instance for given Bee class instance
* @param collection Collection of Uint8Array buffers to upload
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
* @param options
*/
function uploadCollection(ky, collection, postageBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
(0, collection_1.assertCollection)(collection);
const tarData = (0, tar_1.makeTar)(collection);
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: bzzEndpoint,
body: tarData,
responseType: 'json',
headers: Object.assign({ 'content-type': 'application/x-tar', 'swarm-collection': 'true' }, extractCollectionUploadHeaders(postageBatchId, options)),
});
return {
reference: response.data.reference,
tagUid: (0, type_1.makeTagUid)(response.headers.get('swarm-tag')),
};
});
}
exports.uploadCollection = uploadCollection;

58
node_modules/@ethersphere/bee-js/dist/cjs/modules/chunk.js

@ -0,0 +1,58 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.download = exports.upload = void 0;
const headers_1 = require("../utils/headers");
const http_1 = require("../utils/http");
const bytes_1 = require("../utils/bytes");
const endpoint = 'chunks';
/**
* Upload chunk to a Bee node
*
* The chunk data consists of 8 byte span and up to 4096 bytes of payload data.
* The span stores the length of the payload in uint64 little endian encoding.
* Upload expects the chuck data to be set accordingly.
*
* @param ky Ky instance
* @param data Chunk data to be uploaded
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
* @param options Additional options like tag, encryption, pinning
*/
function upload(ky, data, postageBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: `${endpoint}`,
body: data,
headers: Object.assign({ 'content-type': 'application/octet-stream' }, (0, headers_1.extractUploadHeaders)(postageBatchId, options)),
responseType: 'json',
});
return response.data.reference;
});
}
exports.upload = upload;
/**
* Download chunk data as a byte array
*
* @param ky Ky instance for given Bee class instance
* @param hash Bee content reference
*
*/
function download(ky, hash) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
responseType: 'arraybuffer',
path: `${endpoint}/${hash}`,
});
return (0, bytes_1.wrapBytesWithHelpers)(new Uint8Array(response.data));
});
}
exports.download = download;

77
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/balance.js

@ -0,0 +1,77 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPastDueConsumptionPeerBalance = exports.getPastDueConsumptionBalances = exports.getPeerBalance = exports.getAllBalances = void 0;
const http_1 = require("../../utils/http");
const balancesEndpoint = 'balances';
const consumedEndpoint = 'consumed';
/**
* Get the balances with all known peers including prepaid services
*
* @param ky Ky debug instance
*/
function getAllBalances(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: balancesEndpoint,
responseType: 'json',
});
return response.data;
});
}
exports.getAllBalances = getAllBalances;
/**
* Get the balances with a specific peer including prepaid services
*
* @param ky Ky debug instance
* @param address Swarm address of peer
*/
function getPeerBalance(ky, address) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `${balancesEndpoint}/${address}`,
responseType: 'json',
});
return response.data;
});
}
exports.getPeerBalance = getPeerBalance;
/**
* Get the past due consumption balances with all known peers
*
* @param ky Ky debug instance
*/
function getPastDueConsumptionBalances(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: consumedEndpoint,
responseType: 'json',
});
return response.data;
});
}
exports.getPastDueConsumptionBalances = getPastDueConsumptionBalances;
/**
* Get the past due consumption balance with a specific peer
*
* @param ky Ky debug instance
* @param address Swarm address of peer
*/
function getPastDueConsumptionPeerBalance(ky, address) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `${consumedEndpoint}/${address}`,
responseType: 'json',
});
return response.data;
});
}
exports.getPastDueConsumptionPeerBalance = getPastDueConsumptionPeerBalance;

167
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/chequebook.js

@ -0,0 +1,167 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.withdrawTokens = exports.depositTokens = exports.getLastCheques = exports.getLastChequesForPeer = exports.cashoutLastCheque = exports.getLastCashoutAction = exports.getChequebookBalance = exports.getChequebookAddress = void 0;
const http_1 = require("../../utils/http");
const chequebookEndpoint = 'chequebook';
/**
* Get the address of the chequebook contract used
*
* @param ky Ky debug instance
*/
function getChequebookAddress(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: chequebookEndpoint + '/address',
responseType: 'json',
});
return response.data;
});
}
exports.getChequebookAddress = getChequebookAddress;
/**
* Get the balance of the chequebook
*
* @param ky Ky debug instance
*/
function getChequebookBalance(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: chequebookEndpoint + '/balance',
responseType: 'json',
});
return response.data;
});
}
exports.getChequebookBalance = getChequebookBalance;
/**
* Get last cashout action for the peer
*
* @param ky Ky debug instance
* @param peer Swarm address of peer
*/
function getLastCashoutAction(ky, peer) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: chequebookEndpoint + `/cashout/${peer}`,
responseType: 'json',
});
return response.data;
});
}
exports.getLastCashoutAction = getLastCashoutAction;
/**
* Cashout the last cheque for the peer
*
* @param ky Ky debug instance
* @param peer Swarm address of peer
* @param options
*/
function cashoutLastCheque(ky, peer, options) {
return __awaiter(this, void 0, void 0, function* () {
const headers = {};
if (options === null || options === void 0 ? void 0 : options.gasPrice) {
headers['gas-price'] = options.gasPrice.toString();
}
if (options === null || options === void 0 ? void 0 : options.gasLimit) {
headers['gas-limit'] = options.gasLimit.toString();
}
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: chequebookEndpoint + `/cashout/${peer}`,
responseType: 'json',
headers,
});
return response.data.transactionHash;
});
}
exports.cashoutLastCheque = cashoutLastCheque;
/**
* Get last cheques for the peer
*
* @param ky Ky debug instance
* @param peer Swarm address of peer
*/
function getLastChequesForPeer(ky, peer) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: chequebookEndpoint + `/cheque/${peer}`,
responseType: 'json',
});
return response.data;
});
}
exports.getLastChequesForPeer = getLastChequesForPeer;
/**
* Get last cheques for all peers
*
* @param ky Ky debug instance
*/
function getLastCheques(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: chequebookEndpoint + '/cheque',
responseType: 'json',
});
return response.data;
});
}
exports.getLastCheques = getLastCheques;
/**
* Deposit tokens from overlay address into chequebook
*
* @param ky Ky debug instance
* @param amount Amount of tokens to deposit
* @param gasPrice Gas Price in WEI for the transaction call
* @return string Hash of the transaction
*/
function depositTokens(ky, amount, gasPrice) {
return __awaiter(this, void 0, void 0, function* () {
const headers = {};
if (gasPrice) {
headers['gas-price'] = gasPrice.toString();
}
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: chequebookEndpoint + '/deposit',
responseType: 'json',
searchParams: { amount: amount.toString(10) },
headers,
});
return response.data.transactionHash;
});
}
exports.depositTokens = depositTokens;
/**
* Withdraw tokens from the chequebook to the overlay address
*
* @param ky Ky debug instance
* @param amount Amount of tokens to withdraw
* @param gasPrice Gas Price in WEI for the transaction call
* @return string Hash of the transaction
*/
function withdrawTokens(ky, amount, gasPrice) {
return __awaiter(this, void 0, void 0, function* () {
const headers = {};
if (gasPrice) {
headers['gas-price'] = gasPrice.toString();
}
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: chequebookEndpoint + '/withdraw',
responseType: 'json',
searchParams: { amount: amount.toString(10) },
headers,
});
return response.data.transactionHash;
});
}
exports.withdrawTokens = withdrawTokens;

51
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/chunk.js

@ -0,0 +1,51 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteChunkFromLocalStorage = exports.checkIfChunkExistsLocally = void 0;
const http_1 = require("../../utils/http");
const endpoint = 'chunks';
/**
* Check if chunk at address exists locally
*
* @param ky Ky debug instance
* @param address Swarm address of chunk
*
* @returns BeeGenericResponse if chunk is found or throws an exception
*/
function checkIfChunkExistsLocally(ky, address) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: endpoint + `/${address}`,
responseType: 'json',
});
return response.data;
});
}
exports.checkIfChunkExistsLocally = checkIfChunkExistsLocally;
/**
* Delete a chunk from local storage
*
* @param ky Ky debug instance
* @param address Swarm address of chunk
*
* @returns BeeGenericResponse if chunk was deleted or throws an exception
*/
function deleteChunkFromLocalStorage(ky, address) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'delete',
path: endpoint + `/${address}`,
responseType: 'json',
});
return response.data;
});
}
exports.deleteChunkFromLocalStorage = deleteChunkFromLocalStorage;

75
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/connectivity.js

@ -0,0 +1,75 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.pingPeer = exports.getTopology = exports.removePeer = exports.getBlocklist = exports.getPeers = exports.getNodeAddresses = void 0;
const http_1 = require("../../utils/http");
function getNodeAddresses(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: 'addresses',
responseType: 'json',
});
return response.data;
});
}
exports.getNodeAddresses = getNodeAddresses;
function getPeers(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: 'peers',
responseType: 'json',
});
return response.data.peers || [];
});
}
exports.getPeers = getPeers;
function getBlocklist(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: 'blocklist',
responseType: 'json',
});
return response.data.peers || [];
});
}
exports.getBlocklist = getBlocklist;
function removePeer(ky, peer) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `peers/${peer}`,
responseType: 'json',
method: 'DELETE',
});
return response.data;
});
}
exports.removePeer = removePeer;
function getTopology(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `topology`,
responseType: 'json',
});
return response.data;
});
}
exports.getTopology = getTopology;
function pingPeer(ky, peer) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `pingpong/${peer}`,
responseType: 'json',
method: 'POST',
});
return response.data;
});
}
exports.pingPeer = pingPeer;

45
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/settlements.js

@ -0,0 +1,45 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllSettlements = exports.getSettlements = void 0;
const http_1 = require("../../utils/http");
const settlementsEndpoint = 'settlements';
/**
* Get amount of sent and received from settlements with a peer
*
* @param ky Ky debug instance
* @param peer Swarm address of peer
*/
function getSettlements(ky, peer) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `${settlementsEndpoint}/${peer}`,
responseType: 'json',
});
return response.data;
});
}
exports.getSettlements = getSettlements;
/**
* Get settlements with all known peers and total amount sent or received
*
* @param ky Ky debug instance
*/
function getAllSettlements(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: settlementsEndpoint,
responseType: 'json',
});
return response.data;
});
}
exports.getAllSettlements = getAllSettlements;

89
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/stamps.js

@ -0,0 +1,89 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.diluteBatch = exports.topUpBatch = exports.createPostageBatch = exports.getPostageBatchBuckets = exports.getPostageBatch = exports.getAllPostageBatches = void 0;
const http_1 = require("../../utils/http");
const STAMPS_ENDPOINT = 'stamps';
function getAllPostageBatches(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
path: `${STAMPS_ENDPOINT}`,
responseType: 'json',
});
return response.data.stamps || [];
});
}
exports.getAllPostageBatches = getAllPostageBatches;
function getPostageBatch(ky, postageBatchId) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
path: `${STAMPS_ENDPOINT}/${postageBatchId}`,
responseType: 'json',
});
return response.data;
});
}
exports.getPostageBatch = getPostageBatch;
function getPostageBatchBuckets(ky, postageBatchId) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
path: `${STAMPS_ENDPOINT}/${postageBatchId}/buckets`,
responseType: 'json',
});
return response.data;
});
}
exports.getPostageBatchBuckets = getPostageBatchBuckets;
function createPostageBatch(ky, amount, depth, options) {
return __awaiter(this, void 0, void 0, function* () {
const headers = {};
if (options === null || options === void 0 ? void 0 : options.gasPrice) {
headers['gas-price'] = options.gasPrice.toString();
}
if ((options === null || options === void 0 ? void 0 : options.immutableFlag) !== undefined) {
headers.immutable = String(options.immutableFlag);
}
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
responseType: 'json',
searchParams: { label: options === null || options === void 0 ? void 0 : options.label },
headers,
});
return response.data.batchID;
});
}
exports.createPostageBatch = createPostageBatch;
function topUpBatch(ky, id, amount) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'patch',
path: `${STAMPS_ENDPOINT}/topup/${id}/${amount}`,
responseType: 'json',
});
return response.data.batchID;
});
}
exports.topUpBatch = topUpBatch;
function diluteBatch(ky, id, depth) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'patch',
path: `${STAMPS_ENDPOINT}/dilute/${id}/${depth}`,
responseType: 'json',
});
return response.data.batchID;
});
}
exports.diluteBatch = diluteBatch;

64
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/states.js

@ -0,0 +1,64 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWalletBalance = exports.getChainState = exports.getReserveState = void 0;
const http_1 = require("../../utils/http");
const RESERVE_STATE_ENDPOINT = 'reservestate';
const WALLET_ENDPOINT = 'wallet';
const CHAIN_STATE_ENDPOINT = 'chainstate';
/**
* Get state of reserve
*
* @param ky Ky debug instance
*/
function getReserveState(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
path: `${RESERVE_STATE_ENDPOINT}`,
responseType: 'json',
});
return response.data;
});
}
exports.getReserveState = getReserveState;
/**
* Get state of reserve
*
* @param ky Ky debug instance
*/
function getChainState(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
path: `${CHAIN_STATE_ENDPOINT}`,
responseType: 'json',
});
return response.data;
});
}
exports.getChainState = getChainState;
/**
* Get wallet balances for xDai and BZZ of the node
*
* @param ky Ky debug instance
*/
function getWalletBalance(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
path: `${WALLET_ENDPOINT}`,
responseType: 'json',
});
return response.data;
});
}
exports.getWalletBalance = getWalletBalance;

153
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/status.js

@ -0,0 +1,153 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getVersions = exports.isSupportedApiVersion = exports.isSupportedDebugApiVersion = exports.isSupportedMainApiVersion = exports.isSupportedExactVersion = exports.isSupportedVersion = exports.getNodeInfo = exports.getHealth = exports.SUPPORTED_BEE_VERSION = exports.SUPPORTED_DEBUG_API_VERSION = exports.SUPPORTED_API_VERSION = exports.SUPPORTED_BEE_VERSION_EXACT = void 0;
const http_1 = require("../../utils/http");
const major_js_1 = __importDefault(require("semver/functions/major.js"));
// Following lines bellow are automatically updated with GitHub Action when Bee version is updated
// so if you are changing anything about them change the `update_bee` action accordingly!
exports.SUPPORTED_BEE_VERSION_EXACT = '1.6.0-6ceadd35';
exports.SUPPORTED_API_VERSION = '3.0.1';
exports.SUPPORTED_DEBUG_API_VERSION = '2.0.1';
exports.SUPPORTED_BEE_VERSION = exports.SUPPORTED_BEE_VERSION_EXACT.substring(0, exports.SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
const NODE_INFO_URL = 'node';
const HEALTH_URL = 'health';
/**
* Get health of node
*
* @param ky Ky debug instance
*/
function getHealth(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
path: HEALTH_URL,
responseType: 'json',
});
return response.data;
});
}
exports.getHealth = getHealth;
/**
* Get information about Bee node
*
* @param ky Ky debug instance
*/
function getNodeInfo(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
path: NODE_INFO_URL,
responseType: 'json',
});
return response.data;
});
}
exports.getNodeInfo = getNodeInfo;
/**
* Connects to a node and checks if it is a supported Bee version by the bee-js
*
* @param ky Ky debug instance
*
* @returns true if the Bee node version is supported
* @deprecated Use `isSupportedExactVersion` instead
*/
function isSupportedVersion(ky) {
return __awaiter(this, void 0, void 0, function* () {
return isSupportedExactVersion(ky);
});
}
exports.isSupportedVersion = isSupportedVersion;
/**
* Connects to a node and checks if its version matches with the one that bee-js supports.
*
* Be aware that this is the most strict version check and most probably
* you will want to use more relaxed API-versions based checks like
* `isSupportedApiVersion`, `isSupportedMainApiVersion` or `isSupportedDebugApiVersion`
* based on your use-case.
*
* @param ky
*/
function isSupportedExactVersion(ky) {
return __awaiter(this, void 0, void 0, function* () {
const { version } = yield getHealth(ky);
return version === exports.SUPPORTED_BEE_VERSION_EXACT;
});
}
exports.isSupportedExactVersion = isSupportedExactVersion;
/**
* Connects to a node and checks if its main's API version matches with the one that bee-js supports.
*
* This is useful if you are not using `BeeDebug` class (for anything else then this check)
* and want to make sure about compatibility.
*
* @param ky
*/
function isSupportedMainApiVersion(ky) {
return __awaiter(this, void 0, void 0, function* () {
const { apiVersion } = yield getHealth(ky);
return (0, major_js_1.default)(apiVersion) === (0, major_js_1.default)(exports.SUPPORTED_API_VERSION);
});
}
exports.isSupportedMainApiVersion = isSupportedMainApiVersion;
/**
* Connects to a node and checks if its Debug API version matches with the one that bee-js supports.
*
* This is useful if you are not using `Bee` class in your application and want to make sure
* about compatibility.
*
* @param ky
*/
function isSupportedDebugApiVersion(ky) {
return __awaiter(this, void 0, void 0, function* () {
const { debugApiVersion } = yield getHealth(ky);
return (0, major_js_1.default)(debugApiVersion) === (0, major_js_1.default)(exports.SUPPORTED_DEBUG_API_VERSION);
});
}
exports.isSupportedDebugApiVersion = isSupportedDebugApiVersion;
/**
* Connects to a node and checks if its Main and Debug API versions matches with the one that bee-js supports.
*
* This should be the main way how to check compatibility for your app and Bee node.
*
* @param ky
*/
function isSupportedApiVersion(ky) {
return __awaiter(this, void 0, void 0, function* () {
const { apiVersion, debugApiVersion } = yield getHealth(ky);
return ((0, major_js_1.default)(apiVersion) === (0, major_js_1.default)(exports.SUPPORTED_API_VERSION) &&
(0, major_js_1.default)(debugApiVersion) === (0, major_js_1.default)(exports.SUPPORTED_DEBUG_API_VERSION));
});
}
exports.isSupportedApiVersion = isSupportedApiVersion;
/**
* Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`)
* and versions that bee-js supports (properties prefixed with `supported*`).
*
* @param ky
*/
function getVersions(ky) {
return __awaiter(this, void 0, void 0, function* () {
const { version, apiVersion, debugApiVersion } = yield getHealth(ky);
return {
supportedBeeVersion: exports.SUPPORTED_BEE_VERSION_EXACT,
supportedBeeApiVersion: exports.SUPPORTED_API_VERSION,
supportedBeeDebugApiVersion: exports.SUPPORTED_DEBUG_API_VERSION,
beeVersion: version,
beeApiVersion: apiVersion,
beeDebugApiVersion: debugApiVersion,
};
});
}
exports.getVersions = getVersions;

30
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/tag.js

@ -0,0 +1,30 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.retrieveExtendedTag = void 0;
const http_1 = require("../../utils/http");
const endpoint = 'tags';
/**
* Retrieve tag with extended information from Bee node
*
* @param ky Ky debug instance
* @param uid UID of tag to be retrieved
*/
function retrieveExtendedTag(ky, uid) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `${endpoint}/${uid}`,
responseType: 'json',
});
return response.data;
});
}
exports.retrieveExtendedTag = retrieveExtendedTag;

81
node_modules/@ethersphere/bee-js/dist/cjs/modules/debug/transactions.js

@ -0,0 +1,81 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.cancelTransaction = exports.rebroadcastTransaction = exports.getTransaction = exports.getAllTransactions = void 0;
const http_1 = require("../../utils/http");
const transactionsEndpoint = 'transactions';
/**
* Get list of all pending transactions
*
* @param ky Debug Ky instance
*/
function getAllTransactions(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: transactionsEndpoint,
responseType: 'json',
});
return response.data.pendingTransactions;
});
}
exports.getAllTransactions = getAllTransactions;
/**
* Get information for specific pending transactions
*
* @param ky Debug Ky instance
* @param transactionHash Hash of the transaction
*/
function getTransaction(ky, transactionHash) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `${transactionsEndpoint}/${transactionHash}`,
responseType: 'json',
});
return response.data;
});
}
exports.getTransaction = getTransaction;
/**
* Rebroadcast existing transaction
*
* @param ky Debug Ky instance
* @param transactionHash Hash of the transaction
*/
function rebroadcastTransaction(ky, transactionHash) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: `${transactionsEndpoint}/${transactionHash}`,
responseType: 'json',
});
return response.data.transactionHash;
});
}
exports.rebroadcastTransaction = rebroadcastTransaction;
/**
* Cancel existing transaction
*
* @param ky Debug Ky instance
* @param transactionHash Hash of the transaction
* @param gasPrice Optional gas price
*/
function cancelTransaction(ky, transactionHash, gasPrice) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'delete',
headers: { 'gas-price': gasPrice },
path: `${transactionsEndpoint}/${transactionHash}`,
responseType: 'json',
});
return response.data.transactionHash;
});
}
exports.cancelTransaction = cancelTransaction;

76
node_modules/@ethersphere/bee-js/dist/cjs/modules/feed.js

@ -0,0 +1,76 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchLatestFeedUpdate = exports.createFeedManifest = void 0;
const http_1 = require("../utils/http");
const headers_1 = require("../utils/headers");
const error_1 = require("../utils/error");
const feedEndpoint = 'feeds';
/**
* Create an initial feed root manifest
*
* @param ky Ky instance
* @param owner Owner's ethereum address in hex
* @param topic Topic in hex
* @param postageBatchId Postage BatchId to be used to create the Feed Manifest
* @param options Additional options, like type (default: 'sequence')
*/
function createFeedManifest(ky, owner, topic, postageBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'post',
responseType: 'json',
path: `${feedEndpoint}/${owner}/${topic}`,
searchParams: (0, http_1.filterHeaders)(options),
headers: (0, headers_1.extractUploadHeaders)(postageBatchId),
});
return response.data.reference;
});
}
exports.createFeedManifest = createFeedManifest;
function readFeedUpdateHeaders(headers) {
const feedIndex = headers.get('swarm-feed-index');
const feedIndexNext = headers.get('swarm-feed-index-next');
if (!feedIndex) {
throw new error_1.BeeError('Response did not contain expected swarm-feed-index!');
}
if (!feedIndexNext) {
throw new error_1.BeeError('Response did not contain expected swarm-feed-index-next!');
}
return {
feedIndex,
feedIndexNext,
};
}
/**
* Find and retrieve feed update
*
* The feed consists of updates. This endpoint looks up an
* update that matches the provided parameters and returns
* the reference it contains along with its index and the
* index of the subsequent update.
*
* @param ky Ky instance
* @param owner Owner's ethereum address in hex
* @param topic Topic in hex
* @param options Additional options, like index, at, type
*/
function fetchLatestFeedUpdate(ky, owner, topic, options) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
responseType: 'json',
path: `${feedEndpoint}/${owner}/${topic}`,
searchParams: (0, http_1.filterHeaders)(options),
});
return Object.assign(Object.assign({}, response.data), readFeedUpdateHeaders(response.headers));
});
}
exports.fetchLatestFeedUpdate = fetchLatestFeedUpdate;

84
node_modules/@ethersphere/bee-js/dist/cjs/modules/pinning.js

@ -0,0 +1,84 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllPins = exports.getPin = exports.unpin = exports.pin = void 0;
const http_1 = require("../utils/http");
const PINNING_ENDPOINT = 'pins';
/**
* Pin data with given reference
*
* @param ky Ky instance for given Bee class instance
* @param reference Bee data reference
*/
function pin(ky, reference) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, http_1.http)(ky, {
method: 'post',
responseType: 'json',
path: `${PINNING_ENDPOINT}/${reference}`,
});
});
}
exports.pin = pin;
/**
* Unpin data with given reference
*
* @param ky Ky instance for given Bee class instance
* @param reference Bee data reference
*/
function unpin(ky, reference) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, http_1.http)(ky, {
method: 'delete',
responseType: 'json',
path: `${PINNING_ENDPOINT}/${reference}`,
});
});
}
exports.unpin = unpin;
/**
* Get pin status for specific address.
*
* @param ky Ky instance
* @param reference
* @throws Error if given address is not pinned
*/
function getPin(ky, reference) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
responseType: 'json',
path: `${PINNING_ENDPOINT}/${reference}`,
});
return response.data;
});
}
exports.getPin = getPin;
/**
* Get list of all pins
*
* @param ky Ky instance
*/
function getAllPins(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
responseType: 'json',
path: `${PINNING_ENDPOINT}`,
});
const result = response.data.references;
if (result === null) {
return [];
}
return result;
});
}
exports.getAllPins = getAllPins;

55
node_modules/@ethersphere/bee-js/dist/cjs/modules/pss.js

@ -0,0 +1,55 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.subscribe = exports.send = void 0;
const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
const data_1 = require("../utils/data");
const http_1 = require("../utils/http");
const headers_1 = require("../utils/headers");
const endpoint = 'pss';
/**
* Send to recipient or target with Postal Service for Swarm
*
* @param ky Ky instance for given Bee class instance
* @param topic Topic name
* @param target Target message address prefix
* @param data
* @param postageBatchId Postage BatchId that will be assigned to sent message
* @param recipient Recipient public key
*
*/
function send(ky, topic, target, data, postageBatchId, recipient) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, http_1.http)(ky, {
method: 'post',
path: `${endpoint}/send/${topic}/${target}`,
body: yield (0, data_1.prepareData)(data),
responseType: 'json',
searchParams: { recipient },
headers: (0, headers_1.extractUploadHeaders)(postageBatchId),
});
});
}
exports.send = send;
/**
* Subscribe for messages on the given topic
*
* @param url Bee node URL
* @param topic Topic name
*/
function subscribe(url, topic) {
const wsUrl = url.replace(/^http/i, 'ws');
return new isomorphic_ws_1.default(`${wsUrl}/${endpoint}/subscribe/${topic}`);
}
exports.subscribe = subscribe;

40
node_modules/@ethersphere/bee-js/dist/cjs/modules/soc.js

@ -0,0 +1,40 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.upload = void 0;
const headers_1 = require("../utils/headers");
const http_1 = require("../utils/http");
const socEndpoint = 'soc';
/**
* Upload single owner chunk (SOC) to a Bee node
*
* @param ky Ky instance
* @param owner Owner's ethereum address in hex
* @param identifier Arbitrary identifier in hex
* @param signature Signature in hex
* @param data Content addressed chunk data to be uploaded
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
* @param options Additional options like tag, encryption, pinning
*/
function upload(ky, owner, identifier, signature, data, postageBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: `${socEndpoint}/${owner}/${identifier}`,
body: data,
headers: Object.assign({ 'content-type': 'application/octet-stream' }, (0, headers_1.extractUploadHeaders)(postageBatchId, options)),
responseType: 'json',
searchParams: { sig: signature },
});
return response.data.reference;
});
}
exports.upload = upload;

26
node_modules/@ethersphere/bee-js/dist/cjs/modules/status.js

@ -0,0 +1,26 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkConnection = void 0;
const http_1 = require("../utils/http");
/**
* Ping the base bee URL. If connection was not successful throw error
*
* @param ky Ky instance for given Bee class instance
*/
function checkConnection(ky) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, http_1.http)(ky, {
path: '',
});
});
}
exports.checkConnection = checkConnection;

41
node_modules/@ethersphere/bee-js/dist/cjs/modules/stewardship.js

@ -0,0 +1,41 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isRetrievable = exports.reupload = void 0;
const http_1 = require("../utils/http");
const stewardshipEndpoint = 'stewardship';
/**
* Reupload locally pinned data
* @param ky Ky instance
* @param reference
* @param options
* @throws BeeResponseError if not locally pinned or invalid data
*/
function reupload(ky, reference) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, http_1.http)(ky, {
method: 'put',
path: `${stewardshipEndpoint}/${reference}`,
});
});
}
exports.reupload = reupload;
function isRetrievable(ky, reference) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'get',
responseType: 'json',
path: `${stewardshipEndpoint}/${reference}`,
});
return response.data.isRetrievable;
});
}
exports.isRetrievable = isRetrievable;

96
node_modules/@ethersphere/bee-js/dist/cjs/modules/tag.js

@ -0,0 +1,96 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateTag = exports.deleteTag = exports.getAllTags = exports.retrieveTag = exports.createTag = void 0;
const http_1 = require("../utils/http");
const endpoint = 'tags';
/**
* Create new tag on the Bee node
*
* @param url Bee tag URL
*/
function createTag(ky) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
method: 'post',
path: endpoint,
responseType: 'json',
});
return response.data;
});
}
exports.createTag = createTag;
/**
* Retrieve tag information from Bee node
*
* @param url Bee tag URL
* @param uid UID of tag to be retrieved
*/
function retrieveTag(ky, uid) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `${endpoint}/${uid}`,
responseType: 'json',
});
return response.data;
});
}
exports.retrieveTag = retrieveTag;
/**
* Get limited listing of all tags.
*
* @param url
* @param offset
* @param limit
*/
function getAllTags(ky, offset, limit) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, http_1.http)(ky, {
path: `${endpoint}`,
searchParams: { offset, limit },
responseType: 'json',
});
return response.data.tags;
});
}
exports.getAllTags = getAllTags;
/**
* Removes tag from the Bee node.
* @param url
* @param uid
*/
function deleteTag(ky, uid) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, http_1.http)(ky, {
method: 'delete',
path: `${endpoint}/${uid}`,
});
});
}
exports.deleteTag = deleteTag;
/**
* Updates tag
* @param url
* @param uid
* @param reference
*/
function updateTag(ky, uid, reference) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, http_1.http)(ky, {
method: 'patch',
path: `${endpoint}/${uid}`,
json: {
reference,
},
});
});
}
exports.updateTag = updateTag;

8
node_modules/@ethersphere/bee-js/dist/cjs/package.json

@ -0,0 +1,8 @@
{
"type": "commonjs",
"browser": {
"stream": false,
"./utils/data.js": "./utils/data.browser.js",
"./utils/collection.node.js": "./utils/collection.browser.js"
}
}

10
node_modules/@ethersphere/bee-js/dist/cjs/types/debug.js

@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BeeModes = void 0;
var BeeModes;
(function (BeeModes) {
BeeModes["FULL"] = "full";
BeeModes["LIGHT"] = "light";
BeeModes["ULTRA_LIGHT"] = "ultra-light";
BeeModes["DEV"] = "dev";
})(BeeModes = exports.BeeModes || (exports.BeeModes = {}));

47
node_modules/@ethersphere/bee-js/dist/cjs/types/index.js

@ -0,0 +1,47 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SIGNATURE_BYTES_LENGTH = exports.SIGNATURE_HEX_LENGTH = exports.TOPIC_HEX_LENGTH = exports.TOPIC_BYTES_LENGTH = exports.FEED_INDEX_HEX_LENGTH = exports.TAGS_LIMIT_MAX = exports.TAGS_LIMIT_MIN = exports.STAMPS_DEPTH_MAX = exports.STAMPS_DEPTH_MIN = exports.ENCRYPTED_REFERENCE_BYTES_LENGTH = exports.REFERENCE_BYTES_LENGTH = exports.ENCRYPTED_REFERENCE_HEX_LENGTH = exports.REFERENCE_HEX_LENGTH = exports.BATCH_ID_HEX_LENGTH = exports.PUBKEY_HEX_LENGTH = exports.PSS_TARGET_HEX_LENGTH_MAX = exports.ADDRESS_HEX_LENGTH = exports.CHUNK_SIZE = exports.BRANCHES = exports.SECTION_SIZE = exports.SPAN_SIZE = void 0;
__exportStar(require("./debug"), exports);
exports.SPAN_SIZE = 8;
exports.SECTION_SIZE = 32;
exports.BRANCHES = 128;
exports.CHUNK_SIZE = exports.SECTION_SIZE * exports.BRANCHES;
exports.ADDRESS_HEX_LENGTH = 64;
exports.PSS_TARGET_HEX_LENGTH_MAX = 6;
exports.PUBKEY_HEX_LENGTH = 66;
exports.BATCH_ID_HEX_LENGTH = 64;
exports.REFERENCE_HEX_LENGTH = 64;
exports.ENCRYPTED_REFERENCE_HEX_LENGTH = 128;
exports.REFERENCE_BYTES_LENGTH = 32;
exports.ENCRYPTED_REFERENCE_BYTES_LENGTH = 64;
/**
* Minimal depth that can be used for creation of postage batch
*/
exports.STAMPS_DEPTH_MIN = 17;
/**
* Maximal depth that can be used for creation of postage batch
*/
exports.STAMPS_DEPTH_MAX = 255;
exports.TAGS_LIMIT_MIN = 1;
exports.TAGS_LIMIT_MAX = 1000;
exports.FEED_INDEX_HEX_LENGTH = 16;
/*********************************************************
* Writers and Readers interfaces
*/
exports.TOPIC_BYTES_LENGTH = 32;
exports.TOPIC_HEX_LENGTH = 64;
/*********************************************************
* Ethereum compatible signing interfaces and definitions
*/
exports.SIGNATURE_HEX_LENGTH = 130;
exports.SIGNATURE_BYTES_LENGTH = 65;

8
node_modules/@ethersphere/bee-js/dist/cjs/types/ky-options.js

@ -0,0 +1,8 @@
"use strict";
/**
* Types extracted from Ky as a backport for older Ky non-ESM version
*
* @author https://github.com/sindresorhus
* @licence MIT https://github.com/sindresorhus/ky/blob/main/license
*/
Object.defineProperty(exports, "__esModule", { value: true });

8
node_modules/@ethersphere/bee-js/dist/cjs/types/ky-universal/common.js

@ -0,0 +1,8 @@
"use strict";
/**
* Types extracted from Ky as a backport for older Ky non-ESM version
*
* @author https://github.com/sindresorhus
* @licence MIT https://github.com/sindresorhus/ky/blob/main/license
*/
Object.defineProperty(exports, "__esModule", { value: true });

8
node_modules/@ethersphere/bee-js/dist/cjs/types/ky-universal/hooks.js

@ -0,0 +1,8 @@
"use strict";
/**
* Types extracted from Ky as a backport for older Ky non-ESM version
*
* @author https://github.com/sindresorhus
* @licence MIT https://github.com/sindresorhus/ky/blob/main/license
*/
Object.defineProperty(exports, "__esModule", { value: true });

8
node_modules/@ethersphere/bee-js/dist/cjs/types/ky-universal/retry.js

@ -0,0 +1,8 @@
"use strict";
/**
* Types extracted from Ky as a backport for older Ky non-ESM version
*
* @author https://github.com/sindresorhus
* @licence MIT https://github.com/sindresorhus/ky/blob/main/license
*/
Object.defineProperty(exports, "__esModule", { value: true });

121
node_modules/@ethersphere/bee-js/dist/cjs/utils/bytes.js

@ -0,0 +1,121 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapBytesWithHelpers = exports.makeBytes = exports.bytesEqual = exports.flexBytesAtOffset = exports.bytesAtOffset = exports.assertFlexBytes = exports.isFlexBytes = exports.assertBytes = exports.hasBytesAtOffset = exports.isBytes = void 0;
const hex_1 = require("./hex");
/**
* Type guard for `Bytes<T>` type
*
* @param b The byte array
* @param length The length of the byte array
*/
function isBytes(b, length) {
return b instanceof Uint8Array && b.length === length;
}
exports.isBytes = isBytes;
/**
* Function that verifies if passed data are Bytes and if the array has "length" number of bytes under given offset.
* @param data
* @param offset
* @param length
*/
function hasBytesAtOffset(data, offset, length) {
if (!(data instanceof Uint8Array)) {
throw new TypeError('Data has to an Uint8Array!');
}
const offsetBytes = data.slice(offset, offset + length);
return isBytes(offsetBytes, length);
}
exports.hasBytesAtOffset = hasBytesAtOffset;
/**
* Verifies if a byte array has a certain length
*
* @param b The byte array
* @param length The specified length
*/
function assertBytes(b, length) {
if (!isBytes(b, length)) {
throw new TypeError(`Parameter is not valid Bytes of length: ${length} !== ${b.length}`);
}
}
exports.assertBytes = assertBytes;
/**
* Type guard for FlexBytes<Min,Max> type
*
* @param b The byte array
* @param min Minimum size of the array
* @param max Maximum size of the array
*/
function isFlexBytes(b, min, max) {
return b instanceof Uint8Array && b.length >= min && b.length <= max;
}
exports.isFlexBytes = isFlexBytes;
/**
* Verifies if a byte array has a certain length between min and max
*
* @param b The byte array
* @param min Minimum size of the array
* @param max Maximum size of the array
*/
function assertFlexBytes(b, min, max) {
if (!isFlexBytes(b, min, max)) {
throw new TypeError(`Parameter is not valid FlexBytes of min: ${min}, max: ${max}, length: ${b.length}`);
}
}
exports.assertFlexBytes = assertFlexBytes;
/**
* Return `length` bytes starting from `offset`
*
* @param data The original data
* @param offset The offset to start from
* @param length The length of data to be returned
*/
function bytesAtOffset(data, offset, length) {
const offsetBytes = data.slice(offset, offset + length);
// We are returning strongly typed Bytes so we have to verify that length is really what we claim
assertBytes(offsetBytes, length);
return offsetBytes;
}
exports.bytesAtOffset = bytesAtOffset;
/**
* Return flex bytes starting from `offset`
*
* @param data The original data
* @param offset The offset to start from
* @param _min The minimum size of the data
* @param _max The maximum size of the data
*/
function flexBytesAtOffset(data, offset,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_min,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_max) {
return data.slice(offset);
}
exports.flexBytesAtOffset = flexBytesAtOffset;
/**
* Returns true if two byte arrays are equal
*
* @param a Byte array to compare
* @param b Byte array to compare
*/
function bytesEqual(a, b) {
return a.length === b.length && a.every((value, index) => value === b[index]);
}
exports.bytesEqual = bytesEqual;
/**
* Returns a new byte array filled with zeroes with the specified length
*
* @param length The length of data to be returned
*/
function makeBytes(length) {
return new Uint8Array(length);
}
exports.makeBytes = makeBytes;
function wrapBytesWithHelpers(data) {
return Object.assign(data, {
text: () => new TextDecoder('utf-8').decode(data),
json: () => JSON.parse(new TextDecoder('utf-8').decode(data)),
hex: () => (0, hex_1.bytesToHex)(data),
});
}
exports.wrapBytesWithHelpers = wrapBytesWithHelpers;

36
node_modules/@ethersphere/bee-js/dist/cjs/utils/collection.browser.js

@ -0,0 +1,36 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFolderSize = exports.makeCollectionFromFS = void 0;
/**
* Creates array in the format of Collection with data loaded from directory on filesystem.
* The function loads all the data into memory!
*
* @param dir path to the directory
*/
function makeCollectionFromFS(dir) {
return __awaiter(this, void 0, void 0, function* () {
throw new Error('Creating Collection from File System is not supported in browsers!');
});
}
exports.makeCollectionFromFS = makeCollectionFromFS;
/**
* Calculate folder size recursively
*
* @param dir the path to the folder to check
* @returns size in bytes
*/
function getFolderSize(dir) {
return __awaiter(this, void 0, void 0, function* () {
throw new Error('Creating Collection from File System is not supported in browsers!');
});
}
exports.getFolderSize = getFolderSize;

70
node_modules/@ethersphere/bee-js/dist/cjs/utils/collection.js

@ -0,0 +1,70 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCollectionSize = exports.makeCollectionFromFileList = exports.assertCollection = exports.isCollection = void 0;
const error_1 = require("./error");
const file_1 = require("./file");
const type_1 = require("./type");
function isCollection(data) {
if (!Array.isArray(data)) {
return false;
}
return data.every(entry => typeof entry === 'object' && entry.data && entry.path && (0, type_1.isUint8Array)(entry.data));
}
exports.isCollection = isCollection;
function assertCollection(data) {
if (!isCollection(data)) {
throw new error_1.BeeArgumentError('invalid collection', data);
}
}
exports.assertCollection = assertCollection;
function makeFilePath(file) {
if (file.webkitRelativePath && file.webkitRelativePath !== '') {
return file.webkitRelativePath.replace(/.*?\//i, '');
}
if (file.name) {
return file.name;
}
throw new TypeError('file is not valid File object');
}
function makeCollectionFromFileList(fileList) {
return __awaiter(this, void 0, void 0, function* () {
const collection = [];
for (let i = 0; i < fileList.length; i++) {
const file = fileList[i];
if (file) {
collection.push({
path: makeFilePath(file),
data: new Uint8Array(yield (0, file_1.fileArrayBuffer)(file)),
});
}
}
return collection;
});
}
exports.makeCollectionFromFileList = makeCollectionFromFileList;
/**
* Calculate cumulative size of files
*
* @param fileList list of files to check
* @returns size in bytes
*/
function getCollectionSize(fileList) {
let sum = 0;
for (let i = 0; i < fileList.length; i++) {
const file = fileList[i];
if (file) {
sum += file.size;
}
}
return sum;
}
exports.getCollectionSize = getCollectionSize;

115
node_modules/@ethersphere/bee-js/dist/cjs/utils/collection.node.js

@ -0,0 +1,115 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFolderSize = exports.makeCollectionFromFS = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
/**
* Creates array in the format of Collection with data loaded from directory on filesystem.
* The function loads all the data into memory!
*
* @param dir path to the directory
*/
function makeCollectionFromFS(dir) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof dir !== 'string') {
throw new TypeError('dir has to be string!');
}
if (dir === '') {
throw new TypeError('dir must not be empty string!');
}
return buildCollectionRelative(dir, '');
});
}
exports.makeCollectionFromFS = makeCollectionFromFS;
function buildCollectionRelative(dir, relativePath) {
var e_1, _a;
return __awaiter(this, void 0, void 0, function* () {
// Handles case when the dir is not existing or it is a file ==> throws an error
const dirname = path_1.default.join(dir, relativePath);
const entries = yield fs_1.default.promises.opendir(dirname);
let collection = [];
try {
for (var entries_1 = __asyncValues(entries), entries_1_1; entries_1_1 = yield entries_1.next(), !entries_1_1.done;) {
const entry = entries_1_1.value;
const fullPath = path_1.default.join(dir, relativePath, entry.name);
const entryPath = path_1.default.join(relativePath, entry.name);
if (entry.isFile()) {
collection.push({
path: entryPath,
data: new Uint8Array(yield fs_1.default.promises.readFile(fullPath)),
});
}
else if (entry.isDirectory()) {
collection = [...(yield buildCollectionRelative(dir, entryPath)), ...collection];
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) yield _a.call(entries_1);
}
finally { if (e_1) throw e_1.error; }
}
return collection;
});
}
/**
* Calculate folder size recursively
*
* @param dir the path to the folder to check
* @returns size in bytes
*/
function getFolderSize(dir) {
var e_2, _a;
return __awaiter(this, void 0, void 0, function* () {
if (typeof dir !== 'string') {
throw new TypeError('dir has to be string!');
}
if (dir === '') {
throw new TypeError('dir must not be empty string!');
}
const entries = yield fs_1.default.promises.opendir(dir);
let size = 0;
try {
for (var entries_2 = __asyncValues(entries), entries_2_1; entries_2_1 = yield entries_2.next(), !entries_2_1.done;) {
const entry = entries_2_1.value;
if (entry.isFile()) {
const stats = yield fs_1.default.promises.stat(path_1.default.join(dir, entry.name));
size += stats.size;
}
else if (entry.isDirectory()) {
size += yield getFolderSize(path_1.default.join(dir, entry.name));
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (entries_2_1 && !entries_2_1.done && (_a = entries_2.return)) yield _a.call(entries_2);
}
finally { if (e_2) throw e_2.error; }
}
return size;
});
}
exports.getFolderSize = getFolderSize;

74
node_modules/@ethersphere/bee-js/dist/cjs/utils/data.browser.js

@ -0,0 +1,74 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareWebsocketData = exports.prepareData = void 0;
const stream_1 = require("./stream");
/**
* Validates input and converts to Uint8Array
*
* @param data any string, ArrayBuffer or Uint8Array
*/
function prepareData(data) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof data === 'string')
return new Blob([data], { type: 'text/plain' });
if (data instanceof Uint8Array || data instanceof ArrayBuffer) {
return new Blob([data], { type: 'application/octet-stream' });
}
if (data instanceof Blob) {
return data;
}
// Currently it is not possible to stream requests from browsers
// there are already first experiments on this field (Chromium)
// but till it is fully implemented across browsers-land we have to
// buffer the data before sending the requests.
if ((0, stream_1.isNodeReadable)(data)) {
return new Promise(resolve => {
const buffers = [];
data.on('data', d => {
buffers.push(d);
});
data.on('end', () => {
resolve(new Blob(buffers, { type: 'application/octet-stream' }));
});
});
}
if ((0, stream_1.isReadableStream)(data)) {
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
const reader = data.getReader();
const buffers = [];
let done, value;
do {
;
({ done, value } = yield reader.read());
if (!done) {
buffers.push(value);
}
} while (!done);
resolve(new Blob(buffers, { type: 'application/octet-stream' }));
}));
}
throw new TypeError('unknown data type');
});
}
exports.prepareData = prepareData;
function prepareWebsocketData(data) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof data === 'string')
return new TextEncoder().encode(data);
if (data instanceof ArrayBuffer)
return new Uint8Array(data);
if (data instanceof Blob)
return new Uint8Array(yield new Response(data).arrayBuffer());
throw new TypeError('unknown websocket data type');
});
}
exports.prepareWebsocketData = prepareWebsocketData;

58
node_modules/@ethersphere/bee-js/dist/cjs/utils/data.js

@ -0,0 +1,58 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareWebsocketData = exports.prepareData = void 0;
const fetch_blob_1 = __importDefault(require("fetch-blob"));
const stream_1 = require("./stream");
/**
* Prepare data for valid input for node-fetch.
*
* node-fetch is not using WHATWG ReadableStream but NodeJS Readable so we need to convert in case of ReadableStream,
* but the typings are set to use ReadableStream so hence why type conversion here.
*
* @param data any string, ArrayBuffer, Uint8Array or Readable
*/
function prepareData(data) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof data === 'string')
return new fetch_blob_1.default([data], { type: 'text/plain' });
if (data instanceof Uint8Array || data instanceof ArrayBuffer) {
return new fetch_blob_1.default([data], { type: 'application/octet-stream' });
}
if (data instanceof fetch_blob_1.default || (0, stream_1.isNodeReadable)(data))
return data;
if ((0, stream_1.isReadableStream)(data)) {
return (0, stream_1.readableWebToNode)(data);
}
throw new TypeError('unknown data type');
});
}
exports.prepareData = prepareData;
function isBufferArray(buffer) {
return Array.isArray(buffer) && buffer.length > 0 && buffer.every(data => data instanceof Buffer);
}
function prepareWebsocketData(data) {
return __awaiter(this, void 0, void 0, function* () {
if (typeof data === 'string')
return new TextEncoder().encode(data);
if (data instanceof Buffer)
return new Uint8Array(data);
if (data instanceof ArrayBuffer)
return new Uint8Array(data);
if (isBufferArray(data))
return new Uint8Array(Buffer.concat(data));
throw new TypeError('unknown websocket data type');
});
}
exports.prepareWebsocketData = prepareWebsocketData;

50
node_modules/@ethersphere/bee-js/dist/cjs/utils/error.js

@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BeeNotAJsonError = exports.BeeResponseError = exports.BeeRequestError = exports.BeeArgumentError = exports.BeeError = void 0;
class BeeError extends Error {
constructor(message) {
super(message);
}
}
exports.BeeError = BeeError;
class BeeArgumentError extends BeeError {
constructor(message, value) {
super(message);
this.value = value;
}
}
exports.BeeArgumentError = BeeArgumentError;
class BeeRequestError extends BeeError {
/**
* @param message
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
*/
constructor(message, requestOptions) {
super(message);
this.requestOptions = requestOptions;
}
}
exports.BeeRequestError = BeeRequestError;
class BeeResponseError extends BeeError {
/**
* @param status HTTP status code number
* @param response Response returned from the server
* @param responseBody Response body as string which is returned from response.text() call
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
* @param message
*/
constructor(status, response, responseBody, requestOptions, message) {
super(message);
this.status = status;
this.response = response;
this.responseBody = responseBody;
this.requestOptions = requestOptions;
}
}
exports.BeeResponseError = BeeResponseError;
class BeeNotAJsonError extends BeeError {
constructor() {
super(`Received response is not valid JSON.`);
}
}
exports.BeeNotAJsonError = BeeNotAJsonError;

211
node_modules/@ethersphere/bee-js/dist/cjs/utils/eth.js

@ -0,0 +1,211 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeEthereumWalletSigner = exports.ethToSwarmAddress = exports.fromLittleEndian = exports.toLittleEndian = exports.isHexEthAddress = exports.makeHexEthAddress = exports.makeEthAddress = void 0;
// For ESM compatibility
const js_sha3_1 = __importDefault(require("js-sha3"));
const { keccak256, sha3_256 } = js_sha3_1.default;
const hex_1 = require("./hex");
const bytes_1 = require("./bytes");
const ETH_ADDR_BYTES_LENGTH = 20;
const ETH_ADDR_HEX_LENGTH = 40;
function makeEthAddress(address) {
if (typeof address === 'string') {
const hexAddr = (0, hex_1.makeHexString)(address, ETH_ADDR_HEX_LENGTH);
const ownerBytes = (0, hex_1.hexToBytes)(hexAddr);
(0, bytes_1.assertBytes)(ownerBytes, ETH_ADDR_BYTES_LENGTH);
return ownerBytes;
}
else if (address instanceof Uint8Array) {
(0, bytes_1.assertBytes)(address, ETH_ADDR_BYTES_LENGTH);
return address;
}
throw new TypeError('Invalid EthAddress');
}
exports.makeEthAddress = makeEthAddress;
function makeHexEthAddress(address) {
try {
return (0, hex_1.makeHexString)(address, ETH_ADDR_HEX_LENGTH);
}
catch (e) {
if (e instanceof TypeError) {
e.message = `Invalid HexEthAddress: ${e.message}`;
}
throw e;
}
}
exports.makeHexEthAddress = makeHexEthAddress;
/**
* Check if this is all caps or small caps eth address (=address without checksum)
*
* @param address Ethereum address as hex string
*/
function isEthAddrCaseIns(address) {
// Check it's string, all small caps or all all caps hex and 40 chars long without the `0x` prefix
return (typeof address === 'string' && (/^(0x|0X)?[0-9a-f]{40}$/.test(address) || /^(0x|0X)?[0-9A-F]{40}$/.test(address)));
}
/**
* Check if this is checksummed ethereum address
*
* @param address Ethereum address as hex string
*/
function isValidChecksummedEthAddress(address) {
try {
// Check for valid case insensitive hex type string, 40 chars
const addr = (0, hex_1.makeHexString)(address, ETH_ADDR_HEX_LENGTH);
// Check the checksum
const addressHash = keccak256(addr.toLowerCase());
for (let i = 0; i < 40; i += 1) {
// the nth letter should be uppercase if the nth digit of casemap is 1
if ((parseInt(addressHash[i], 16) > 7 && addr[i].toUpperCase() !== addr[i]) ||
(parseInt(addressHash[i], 16) <= 7 && addr[i].toLowerCase() !== addr[i])) {
return false;
}
}
return true;
}
catch (e) {
if (e instanceof TypeError) {
return false;
}
throw e;
}
}
/**
* Check if is valid ethereum address
*
* Pretty much typed version from web3js
* https://github.com/ChainSafe/web3.js/blob/1.x/packages/web3-utils/src/utils.js
*
* @param address Ethereum address as hex string
*
* @return True if is valid eth address
*/
function isHexEthAddress(address) {
return isEthAddrCaseIns(address) || isValidChecksummedEthAddress(address);
}
exports.isHexEthAddress = isHexEthAddress;
/**
* Convert big-endian hex or number to little-endian.
* Note: Before conversion it is automatically padded to even length hexstring
*
* @param bigEndian Big-endian hex string or number to convert
* @param pad Length to which the string should be padded before conversion (defaul: 2)
*
* @return little-endian encoded hexstring
*/
function toLittleEndian(bigEndian, pad = 2) {
var _a;
if (!(Number.isInteger(pad) && pad >= 2 && pad % 2 === 0)) {
throw new TypeError('minimal padding for conversion needs to be positive even integer');
}
let hexRep;
if (typeof bigEndian === 'string')
hexRep = (0, hex_1.makeHexString)(bigEndian);
else if (typeof bigEndian === 'number')
hexRep = (0, hex_1.intToHex)(bigEndian);
else
throw new TypeError('incorrect input type');
hexRep = hexRep.padStart(pad, '0');
// Extend to an even length hexstring
if (hexRep.length % 2 !== 0)
hexRep = hexRep.padStart(hexRep.length + 1, '0');
// Match all two pairs in the hexstring, reverse the pairs and join it again
const littleEndian = (_a = hexRep.match(/../g)) === null || _a === void 0 ? void 0 : _a.reverse().join('');
if (littleEndian)
return littleEndian;
throw new Error('failed to convert');
}
exports.toLittleEndian = toLittleEndian;
/**
* Convert little-endian hex or number to big-endian
* Note: Before conversion it is automatically padded to even length hexstring
*
* @param littleEndian Little-endian hex string or number to convert
* @param pad Length to which the string should be padded before conversion (defaul: 2)
*
* @return big-endian encoded hexstring
*/
function fromLittleEndian(littleEndian, pad = 2) {
// It's a reversible function
return toLittleEndian(littleEndian, pad);
}
exports.fromLittleEndian = fromLittleEndian;
function assertEthAddress(ethAddress) {
if (!isHexEthAddress(ethAddress))
throw new TypeError('invalid ETH address');
}
function assertSwarmNetworkId(networkId) {
if (Number.isInteger(networkId && networkId > 0 && networkId < Number.MAX_SAFE_INTEGER)) {
throw new TypeError('swarm network id must be positive integer');
}
}
/**
* Get swarm overlay address from public ethereum address and swarm network id
*
* @param ethAddress Public ethereum address
* @param networkId Swarm network id
*
* @return Swarm overlay address
*/
function ethToSwarmAddress(ethAddress, networkId = 1) {
assertEthAddress(ethAddress);
assertSwarmNetworkId(networkId);
const hex = `${(0, hex_1.makeHexString)(ethAddress)}${toLittleEndian(networkId, 16)}`;
(0, hex_1.assertHexString)(hex);
const overlayAddress = sha3_256((0, hex_1.hexToBytes)(hex));
return overlayAddress;
}
exports.ethToSwarmAddress = ethToSwarmAddress;
/**
* Function that takes Ethereum EIP-1193 compatible provider and create an Signer instance that
* uses `personal_sign` method to sign requested data.
*
* @param provider Injected web3 provider like window.ethereum or other compatible with EIP-1193
* @param ethAddress Optional address of the account which the data should be signed with. If not specified `eth_requestAccounts` request is used to get the account address.
*/
function makeEthereumWalletSigner(provider, ethAddress) {
return __awaiter(this, void 0, void 0, function* () {
let executorFnc;
if (typeof provider !== 'object' || provider === null) {
throw new TypeError('We need JsonRPC provider object!');
}
if (provider.request) {
executorFnc = provider.request;
}
else if (provider.sendAsync) {
executorFnc = provider.sendAsync;
}
else {
throw new Error('Incompatible interface of given provider!');
}
if (!ethAddress) {
ethAddress = (yield executorFnc({ method: 'eth_requestAccounts' }))[0];
}
const bytesEthAddress = makeEthAddress(ethAddress);
const hexEthAddress = makeHexEthAddress(ethAddress);
return {
address: bytesEthAddress,
sign: (data) => __awaiter(this, void 0, void 0, function* () {
const result = yield executorFnc({
jsonrpc: '2.0',
method: 'personal_sign',
params: ['0x' + data.hex(), '0x' + hexEthAddress],
});
return result;
}),
};
});
}
exports.makeEthereumWalletSigner = makeEthereumWalletSigner;

44
node_modules/@ethersphere/bee-js/dist/cjs/utils/expose.js

@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStampUsage = exports.makeMaxTarget = exports.keccak256Hash = exports.isReadable = exports.normalizeToReadableStream = exports.isNodeReadable = exports.isReadableStream = exports.readableNodeToWeb = exports.readableWebToNode = exports.makeEthereumWalletSigner = exports.fromLittleEndian = exports.toLittleEndian = exports.ethToSwarmAddress = exports.isHexEthAddress = exports.makeHexEthAddress = exports.makeEthAddress = exports.assertPrefixedHexString = exports.assertHexString = exports.isHexString = exports.intToHex = exports.bytesToHex = exports.hexToBytes = exports.makeHexString = exports.bytesEqual = exports.flexBytesAtOffset = exports.bytesAtOffset = exports.assertFlexBytes = exports.isFlexBytes = exports.assertBytes = exports.isBytes = exports.getFolderSize = exports.getCollectionSize = void 0;
var collection_1 = require("./collection");
Object.defineProperty(exports, "getCollectionSize", { enumerable: true, get: function () { return collection_1.getCollectionSize; } });
var collection_node_1 = require("./collection.node");
Object.defineProperty(exports, "getFolderSize", { enumerable: true, get: function () { return collection_node_1.getFolderSize; } });
var bytes_1 = require("./bytes");
Object.defineProperty(exports, "isBytes", { enumerable: true, get: function () { return bytes_1.isBytes; } });
Object.defineProperty(exports, "assertBytes", { enumerable: true, get: function () { return bytes_1.assertBytes; } });
Object.defineProperty(exports, "isFlexBytes", { enumerable: true, get: function () { return bytes_1.isFlexBytes; } });
Object.defineProperty(exports, "assertFlexBytes", { enumerable: true, get: function () { return bytes_1.assertFlexBytes; } });
Object.defineProperty(exports, "bytesAtOffset", { enumerable: true, get: function () { return bytes_1.bytesAtOffset; } });
Object.defineProperty(exports, "flexBytesAtOffset", { enumerable: true, get: function () { return bytes_1.flexBytesAtOffset; } });
Object.defineProperty(exports, "bytesEqual", { enumerable: true, get: function () { return bytes_1.bytesEqual; } });
var hex_1 = require("./hex");
Object.defineProperty(exports, "makeHexString", { enumerable: true, get: function () { return hex_1.makeHexString; } });
Object.defineProperty(exports, "hexToBytes", { enumerable: true, get: function () { return hex_1.hexToBytes; } });
Object.defineProperty(exports, "bytesToHex", { enumerable: true, get: function () { return hex_1.bytesToHex; } });
Object.defineProperty(exports, "intToHex", { enumerable: true, get: function () { return hex_1.intToHex; } });
Object.defineProperty(exports, "isHexString", { enumerable: true, get: function () { return hex_1.isHexString; } });
Object.defineProperty(exports, "assertHexString", { enumerable: true, get: function () { return hex_1.assertHexString; } });
Object.defineProperty(exports, "assertPrefixedHexString", { enumerable: true, get: function () { return hex_1.assertPrefixedHexString; } });
var eth_1 = require("./eth");
Object.defineProperty(exports, "makeEthAddress", { enumerable: true, get: function () { return eth_1.makeEthAddress; } });
Object.defineProperty(exports, "makeHexEthAddress", { enumerable: true, get: function () { return eth_1.makeHexEthAddress; } });
Object.defineProperty(exports, "isHexEthAddress", { enumerable: true, get: function () { return eth_1.isHexEthAddress; } });
Object.defineProperty(exports, "ethToSwarmAddress", { enumerable: true, get: function () { return eth_1.ethToSwarmAddress; } });
Object.defineProperty(exports, "toLittleEndian", { enumerable: true, get: function () { return eth_1.toLittleEndian; } });
Object.defineProperty(exports, "fromLittleEndian", { enumerable: true, get: function () { return eth_1.fromLittleEndian; } });
Object.defineProperty(exports, "makeEthereumWalletSigner", { enumerable: true, get: function () { return eth_1.makeEthereumWalletSigner; } });
var stream_1 = require("./stream");
Object.defineProperty(exports, "readableWebToNode", { enumerable: true, get: function () { return stream_1.readableWebToNode; } });
Object.defineProperty(exports, "readableNodeToWeb", { enumerable: true, get: function () { return stream_1.readableNodeToWeb; } });
Object.defineProperty(exports, "isReadableStream", { enumerable: true, get: function () { return stream_1.isReadableStream; } });
Object.defineProperty(exports, "isNodeReadable", { enumerable: true, get: function () { return stream_1.isNodeReadable; } });
Object.defineProperty(exports, "normalizeToReadableStream", { enumerable: true, get: function () { return stream_1.normalizeToReadableStream; } });
Object.defineProperty(exports, "isReadable", { enumerable: true, get: function () { return stream_1.isReadable; } });
var hash_1 = require("./hash");
Object.defineProperty(exports, "keccak256Hash", { enumerable: true, get: function () { return hash_1.keccak256Hash; } });
var pss_1 = require("./pss");
Object.defineProperty(exports, "makeMaxTarget", { enumerable: true, get: function () { return pss_1.makeMaxTarget; } });
var stamps_1 = require("./stamps");
Object.defineProperty(exports, "getStampUsage", { enumerable: true, get: function () { return stamps_1.getStampUsage; } });

49
node_modules/@ethersphere/bee-js/dist/cjs/utils/file.js

@ -0,0 +1,49 @@
"use strict";
/**
* Compatibility functions for working with File API objects
*
* https://developer.mozilla.org/en-US/docs/Web/API/File
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fileArrayBuffer = exports.isFile = void 0;
function isFile(file) {
// browser
if (typeof File === 'function') {
return file instanceof File;
}
// node.js
const f = file;
return (typeof f === 'object' &&
typeof f.name === 'string' &&
(typeof f.stream === 'function' || typeof f.arrayBuffer === 'function'));
}
exports.isFile = isFile;
/**
* Compatibility helper for browsers where the `arrayBuffer function is
* missing from `File` objects.
*
* @param file A File object
*/
function fileArrayBuffer(file) {
return __awaiter(this, void 0, void 0, function* () {
if (file.arrayBuffer) {
return file.arrayBuffer();
}
// workaround for Safari where arrayBuffer is not supported on Files
return new Promise(resolve => {
const fr = new FileReader();
fr.onload = () => resolve(fr.result);
fr.readAsArrayBuffer(file);
});
});
}
exports.fileArrayBuffer = fileArrayBuffer;

21
node_modules/@ethersphere/bee-js/dist/cjs/utils/hash.js

@ -0,0 +1,21 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.keccak256Hash = void 0;
// For ESM compatibility
const js_sha3_1 = __importDefault(require("js-sha3"));
const { keccak256 } = js_sha3_1.default;
/**
* Helper function for calculating the keccak256 hash with
* correct types.
*
* @param messages Any number of messages (strings, byte arrays etc.)
*/
function keccak256Hash(...messages) {
const hasher = keccak256.create();
messages.forEach(bytes => hasher.update(bytes));
return Uint8Array.from(hasher.digest());
}
exports.keccak256Hash = keccak256Hash;

59
node_modules/@ethersphere/bee-js/dist/cjs/utils/headers.js

@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractUploadHeaders = exports.readFileHeaders = void 0;
const error_1 = require("./error");
/**
* Read the filename from the content-disposition header
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
*
* @param header the content-disposition header value
*
* @returns the filename
*/
function readContentDispositionFilename(header) {
if (!header) {
throw new error_1.BeeError('missing content-disposition header');
}
// Regex was found here
// https://stackoverflow.com/questions/23054475/javascript-regex-for-extracting-filename-from-content-disposition-header
const dispositionMatch = header.match(/filename\*?=['"]?(?:UTF-\d['"]*)?([^;\r\n"']*)['"]?;?/i);
if (dispositionMatch && dispositionMatch.length > 0) {
return dispositionMatch[1];
}
throw new error_1.BeeError('invalid content-disposition header');
}
function readTagUid(header) {
if (!header) {
return undefined;
}
return parseInt(header, 10);
}
function readFileHeaders(headers) {
const name = readContentDispositionFilename(headers.get('content-disposition'));
const tagUid = readTagUid(headers.get('swarm-tag-uid'));
const contentType = headers.get('content-type') || undefined;
return {
name,
tagUid,
contentType,
};
}
exports.readFileHeaders = readFileHeaders;
function extractUploadHeaders(postageBatchId, options) {
if (!postageBatchId) {
throw new error_1.BeeError('Postage BatchID has to be specified!');
}
const headers = {
'swarm-postage-batch-id': postageBatchId,
};
if (options === null || options === void 0 ? void 0 : options.pin)
headers['swarm-pin'] = String(options.pin);
if (options === null || options === void 0 ? void 0 : options.encrypt)
headers['swarm-encrypt'] = String(options.encrypt);
if (options === null || options === void 0 ? void 0 : options.tag)
headers['swarm-tag'] = String(options.tag);
if (typeof (options === null || options === void 0 ? void 0 : options.deferred) === 'boolean')
headers['swarm-deferred-upload'] = options.deferred.toString();
return headers;
}
exports.extractUploadHeaders = extractUploadHeaders;

150
node_modules/@ethersphere/bee-js/dist/cjs/utils/hex.js

@ -0,0 +1,150 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertPrefixedHexString = exports.assertHexString = exports.isPrefixedHexString = exports.isHexString = exports.intToHex = exports.bytesToHex = exports.hexToBytes = exports.makeHexString = void 0;
const bytes_1 = require("./bytes");
/**
* Creates unprefixed hex string from wide range of data.
*
* TODO: Make Length mandatory: https://github.com/ethersphere/bee-js/issues/208
*
* @param input
* @param len of the resulting HexString WITHOUT prefix!
*/
function makeHexString(input, len) {
if (typeof input === 'number') {
return intToHex(input, len);
}
if (input instanceof Uint8Array) {
return bytesToHex(input, len);
}
if (typeof input === 'string') {
if (isPrefixedHexString(input)) {
const hex = input.slice(2);
if (len && hex.length !== len) {
throw new TypeError(`Length mismatch for valid hex string. Expecting length ${len}: ${hex}`);
}
return hex;
}
else {
// We use assertHexString() as there might be more reasons why a string is not valid hex string
// and usage of isHexString() would not give enough information to the user on what is going
// wrong.
assertHexString(input, len);
return input;
}
}
throw new TypeError('Not HexString compatible type!');
}
exports.makeHexString = makeHexString;
/**
* Converts a hex string to Uint8Array
*
* @param hex string input without 0x prefix!
*/
function hexToBytes(hex) {
assertHexString(hex);
const bytes = (0, bytes_1.makeBytes)(hex.length / 2);
for (let i = 0; i < bytes.length; i++) {
const hexByte = hex.substr(i * 2, 2);
bytes[i] = parseInt(hexByte, 16);
}
return bytes;
}
exports.hexToBytes = hexToBytes;
/**
* Converts array of number or Uint8Array to HexString without prefix.
*
* @param bytes The input array
* @param len The length of the non prefixed HexString
*/
function bytesToHex(bytes, len) {
const hexByte = (n) => n.toString(16).padStart(2, '0');
const hex = Array.from(bytes, hexByte).join('');
// TODO: Make Length mandatory: https://github.com/ethersphere/bee-js/issues/208
if (len && hex.length !== len) {
throw new TypeError(`Resulting HexString does not have expected length ${len}: ${hex}`);
}
return hex;
}
exports.bytesToHex = bytesToHex;
/**
* Converts integer number to hex string.
*
* Optionally provides '0x' prefix or padding
*
* @param int The positive integer to be converted
* @param len The length of the non prefixed HexString
*/
function intToHex(int, len) {
if (!Number.isInteger(int))
throw new TypeError('the value provided is not integer');
if (int > Number.MAX_SAFE_INTEGER)
throw new TypeError('the value provided exceeds safe integer');
if (int < 0)
throw new TypeError('the value provided is a negative integer');
const hex = int.toString(16);
// TODO: Make Length mandatory: https://github.com/ethersphere/bee-js/issues/208
if (len && hex.length !== len) {
throw new TypeError(`Resulting HexString does not have expected length ${len}: ${hex}`);
}
return hex;
}
exports.intToHex = intToHex;
/**
* Type guard for HexStrings.
* Requires no 0x prefix!
*
* TODO: Make Length mandatory: https://github.com/ethersphere/bee-js/issues/208
*
* @param s string input
* @param len expected length of the HexString
*/
function isHexString(s, len) {
return typeof s === 'string' && /^[0-9a-f]+$/i.test(s) && (!len || s.length === len);
}
exports.isHexString = isHexString;
/**
* Type guard for PrefixedHexStrings.
* Does enforce presence of 0x prefix!
*
* @param s string input
*/
function isPrefixedHexString(s) {
return typeof s === 'string' && /^0x[0-9a-f]+$/i.test(s);
}
exports.isPrefixedHexString = isPrefixedHexString;
/**
* Verifies if the provided input is a HexString.
*
* TODO: Make Length mandatory: https://github.com/ethersphere/bee-js/issues/208
*
* @param s string input
* @param len expected length of the HexString
* @param name optional name for the asserted value
* @returns HexString or throws error
*/
function assertHexString(s, len, name = 'value') {
if (!isHexString(s, len)) {
if (isPrefixedHexString(s)) {
throw new TypeError(`${name} not valid non prefixed hex string (has 0x prefix): ${s}`);
}
// Don't display length error if no length specified in order not to confuse user
const lengthMsg = len ? ` of length ${len}` : '';
throw new TypeError(`${name} not valid hex string${lengthMsg}: ${s}`);
}
}
exports.assertHexString = assertHexString;
/**
* Verifies if the provided input is a PrefixedHexString.
*
* @param s string input
* @param len expected length of the HexString
* @param name optional name for the asserted value
* @returns HexString or throws error
*/
function assertPrefixedHexString(s, name = 'value') {
if (!isPrefixedHexString(s)) {
throw new TypeError(`${name} not valid prefixed hex string: ${s}`);
}
}
exports.assertPrefixedHexString = assertPrefixedHexString;

172
node_modules/@ethersphere/bee-js/dist/cjs/utils/http.js

@ -0,0 +1,172 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeDefaultKy = exports.http = exports.filterHeaders = exports.wrapResponseClosure = exports.wrapRequestClosure = void 0;
const error_1 = require("./error");
const ky_universal_1 = __importDefault(require("ky-universal"));
const stream_1 = require("./stream");
const merge_1 = require("./merge");
const type_1 = require("./type");
const DEFAULT_KY_CONFIG = {
headers: {
accept: 'application/json, text/plain, */*',
'user-agent': `bee-js`,
},
};
function isHttpError(e) {
return (0, type_1.isObject)(e) && typeof e.response !== 'undefined';
}
function isHttpRequestError(e) {
return (0, type_1.isObject)(e) && typeof e.request !== 'undefined';
}
function headersToObject(header) {
return [...header.entries()].reduce((obj, [key, val]) => {
obj[key] = val;
return obj;
}, {});
}
function wrapRequest(request) {
return {
url: request.url,
method: request.method.toUpperCase(),
headers: headersToObject(request.headers),
};
}
function wrapRequestClosure(cb) {
return (request) => __awaiter(this, void 0, void 0, function* () {
yield cb(wrapRequest(request));
});
}
exports.wrapRequestClosure = wrapRequestClosure;
function wrapResponseClosure(cb) {
return (request, options, response) => __awaiter(this, void 0, void 0, function* () {
yield cb({
headers: headersToObject(response.headers),
status: response.status,
statusText: response.statusText,
request: wrapRequest(request),
});
});
}
exports.wrapResponseClosure = wrapResponseClosure;
/**
* Filters out entries that has undefined value from headers object.
* Modifies the original object!
*
* @param obj
*/
// eslint-disable-next-line @typescript-eslint/ban-types
function filterHeaders(obj) {
if (obj === undefined) {
return undefined;
}
(0, type_1.isStrictlyObject)(obj);
const typedObj = obj;
for (const key in typedObj) {
if (typedObj[key] === undefined) {
delete typedObj[key];
}
}
if (Object.keys(typedObj).length === 0) {
return undefined;
}
return typedObj;
}
exports.filterHeaders = filterHeaders;
/**
* Main utility function to make HTTP requests.
* @param ky
* @param config
*/
function http(ky, config) {
return __awaiter(this, void 0, void 0, function* () {
try {
const { path, responseType } = config, kyConfig = __rest(config, ["path", "responseType"]);
const response = (yield ky(path, Object.assign(Object.assign({}, kyConfig), { searchParams: filterHeaders(kyConfig.searchParams) })));
switch (responseType) {
case 'stream':
if (!response.body) {
throw new error_1.BeeError('Response was expected to get data but did not get any!');
}
response.data = (0, stream_1.normalizeToReadableStream)(response.body);
break;
case 'arraybuffer':
response.data = (yield response.arrayBuffer());
break;
case 'json':
try {
response.data = (yield response.json());
}
catch (e) {
throw new error_1.BeeNotAJsonError();
}
break;
default:
break; // If responseType is not set, then no data are expected
}
return response;
}
catch (e) {
// Passthrough thrown errors
if (e instanceof error_1.BeeNotAJsonError) {
throw e;
}
if (isHttpError(e)) {
let message;
// We store the response body here as it can be read only once in Response's lifecycle so to make it exposed
// to the user in the BeeResponseError, for further analysis.
const body = yield e.response.text();
try {
// The response can be Bee's JSON with structure `{code, message}` lets try to parse it
message = JSON.parse(body).message;
}
catch (e) { }
if (message) {
throw new error_1.BeeResponseError(e.response.status, e.response, body, config, `${e.response.statusText}: ${message}`);
}
else {
throw new error_1.BeeResponseError(e.response.status, e.response, body, config, e.response.statusText);
}
}
else if (isHttpRequestError(e)) {
throw new error_1.BeeRequestError(e.message, config);
}
else {
// Node 18 has native `fetch` implementation called Undici. Errors from this implementation have top level generic
// message "fetch failed" with the more specific error placed into `cause` property. Instead of "fetch failed" we
// expose the underlying problem.
if (e.cause) {
throw new error_1.BeeError(e.cause.message);
}
throw new error_1.BeeError(e.message);
}
}
});
}
exports.http = http;
function makeDefaultKy(kyConfig) {
return ky_universal_1.default.create((0, merge_1.deepMerge)(DEFAULT_KY_CONFIG, kyConfig));
}
exports.makeDefaultKy = makeDefaultKy;

34
node_modules/@ethersphere/bee-js/dist/cjs/utils/merge.js

@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deepMerge = void 0;
const type_1 = require("./type");
/**
* Function that deep merges objects
*
* @copyright https://github.com/sindresorhus/ky/blob/b3c9e88fa49d50150dbb6e6b771b4af56cb40c98/source/utils/merge.ts
* @licence MIT
* @param sources
*/
function deepMerge(...sources) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let returnValue = {};
for (const source of sources) {
if (Array.isArray(source)) {
if (!Array.isArray(returnValue)) {
returnValue = [];
}
returnValue = [...returnValue, ...source];
}
else if ((0, type_1.isObject)(source)) {
// eslint-disable-next-line prefer-const
for (let [key, value] of Object.entries(source)) {
if ((0, type_1.isObject)(value) && key in returnValue) {
value = deepMerge(returnValue[key], value);
}
returnValue = Object.assign(Object.assign({}, returnValue), { [key]: value });
}
}
}
return returnValue;
}
exports.deepMerge = deepMerge;

18
node_modules/@ethersphere/bee-js/dist/cjs/utils/pss.js

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeMaxTarget = void 0;
const types_1 = require("../types");
/**
* Utility function that for given strings/reference takes the most specific
* target that Bee node will except.
*
* @param target is a non-prefixed hex string Bee address
* @see [Bee docs - PSS](https://docs.ethswarm.org/docs/dapps-on-swarm/pss)
*/
function makeMaxTarget(target) {
if (typeof target !== 'string') {
throw new TypeError('target has to be an string!');
}
return target.slice(0, types_1.PSS_TARGET_HEX_LENGTH_MAX);
}
exports.makeMaxTarget = makeMaxTarget;

36
node_modules/@ethersphere/bee-js/dist/cjs/utils/reference.js

@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeBytesReference = void 0;
const types_1 = require("../types");
const bytes_1 = require("./bytes");
const hex_1 = require("./hex");
function makeBytesReference(reference, offset = 0) {
if (typeof reference === 'string') {
if (offset) {
throw new Error('Offset property can be set only for UintArray reference!');
}
try {
// Non-encrypted chunk hex string reference
const hexReference = (0, hex_1.makeHexString)(reference, types_1.REFERENCE_HEX_LENGTH);
return (0, hex_1.hexToBytes)(hexReference);
}
catch (e) {
if (!(e instanceof TypeError)) {
throw e;
}
// Encrypted chunk hex string reference
const hexReference = (0, hex_1.makeHexString)(reference, types_1.ENCRYPTED_REFERENCE_HEX_LENGTH);
return (0, hex_1.hexToBytes)(hexReference);
}
}
else if (reference instanceof Uint8Array) {
if ((0, bytes_1.hasBytesAtOffset)(reference, offset, types_1.ENCRYPTED_REFERENCE_BYTES_LENGTH)) {
return (0, bytes_1.bytesAtOffset)(reference, offset, types_1.ENCRYPTED_REFERENCE_BYTES_LENGTH);
}
else if ((0, bytes_1.hasBytesAtOffset)(reference, offset, types_1.REFERENCE_BYTES_LENGTH)) {
return (0, bytes_1.bytesAtOffset)(reference, offset, types_1.REFERENCE_BYTES_LENGTH);
}
}
throw new TypeError('invalid chunk reference');
}
exports.makeBytesReference = makeBytesReference;

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save