@daiso-tech/core 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/async/_module.js +1 -0
- package/dist/cjs/async/_module.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/_module.js +1 -3
- package/dist/cjs/collection/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-iterable.js +14 -23
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js +12 -21
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-collapse-iterable.js +5 -14
- package/dist/cjs/collection/async-iterable-collection/_shared/async-collapse-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-count-by-iterable.js +9 -18
- package/dist/cjs/collection/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-cross-join-iterable.js +18 -27
- package/dist/cjs/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-error-handler-iterable.js +31 -0
- package/dist/cjs/collection/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -0
- package/dist/cjs/collection/async-iterable-collection/_shared/async-filter-iterable.js +3 -12
- package/dist/cjs/collection/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-flat-map-iterable.js +2 -11
- package/dist/cjs/collection/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-after-iterable.js +8 -17
- package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-before-iterable.js +8 -17
- package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-map-iterable.js +2 -11
- package/dist/cjs/collection/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-merge-iterable.js +2 -11
- package/dist/cjs/collection/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-partion-iterable.js +9 -18
- package/dist/cjs/collection/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-repeat-iterable.js +4 -13
- package/dist/cjs/collection/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-iterable.js +3 -12
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-until-iterable.js +7 -16
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-sliding-iterable.js +9 -18
- package/dist/cjs/collection/async-iterable-collection/_shared/async-sliding-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-split-iterable.js +17 -26
- package/dist/cjs/collection/async-iterable-collection/_shared/async-split-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-take-iterable.js +3 -12
- package/dist/cjs/collection/async-iterable-collection/_shared/async-take-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-take-until-iterable.js +4 -13
- package/dist/cjs/collection/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-tap-iterable.js +2 -11
- package/dist/cjs/collection/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-unique-iterable.js +6 -15
- package/dist/cjs/collection/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-update-iterable.js +5 -14
- package/dist/cjs/collection/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-when-iterable.js +4 -13
- package/dist/cjs/collection/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js +177 -265
- package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/chunk-iterable.js +14 -23
- package/dist/cjs/collection/iterable-collection/_shared/chunk-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/chunk-while-iterable.js +12 -21
- package/dist/cjs/collection/iterable-collection/_shared/chunk-while-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/collapse-iterable.js +5 -14
- package/dist/cjs/collection/iterable-collection/_shared/collapse-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/count-by-iterable.js +9 -18
- package/dist/cjs/collection/iterable-collection/_shared/count-by-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js +19 -31
- package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/entries-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/entries-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/filter-iterable.js +3 -12
- package/dist/cjs/collection/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/flat-map-iterable.js +2 -11
- package/dist/cjs/collection/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/group-by-iterable.js +9 -18
- package/dist/cjs/collection/iterable-collection/_shared/group-by-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/insert-after-iterable.js +6 -16
- package/dist/cjs/collection/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/insert-before-iterable.js +6 -16
- package/dist/cjs/collection/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/map-iterable.js +2 -11
- package/dist/cjs/collection/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/merge-iterable.js +2 -11
- package/dist/cjs/collection/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/pad-end-iterable.js +11 -20
- package/dist/cjs/collection/iterable-collection/_shared/pad-end-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/pad-start-iterable.js +11 -20
- package/dist/cjs/collection/iterable-collection/_shared/pad-start-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/partion-iterable.js +9 -18
- package/dist/cjs/collection/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/repeat-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/repeat-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/reverse-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/reverse-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/shuffle-iterable.js +9 -18
- package/dist/cjs/collection/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/skip-iterable.js +3 -12
- package/dist/cjs/collection/iterable-collection/_shared/skip-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/skip-until-iterable.js +6 -15
- package/dist/cjs/collection/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/slice-iterable.js +15 -24
- package/dist/cjs/collection/iterable-collection/_shared/slice-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/sliding-iterable.js +9 -18
- package/dist/cjs/collection/iterable-collection/_shared/sliding-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/sort-iterable.js +1 -10
- package/dist/cjs/collection/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/split-iterable.js +17 -26
- package/dist/cjs/collection/iterable-collection/_shared/split-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/take-iterable.js +3 -12
- package/dist/cjs/collection/iterable-collection/_shared/take-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/take-until-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/tap-iterable.js +2 -11
- package/dist/cjs/collection/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/unique-iterable.js +6 -15
- package/dist/cjs/collection/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/update-iterable.js +5 -14
- package/dist/cjs/collection/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/when-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/zip-iterable.js +6 -15
- package/dist/cjs/collection/iterable-collection/_shared/zip-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/iterable-collection.js +154 -346
- package/dist/cjs/collection/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/cjs/collection/list-collection/list-collection.js +348 -931
- package/dist/cjs/collection/list-collection/list-collection.js.map +1 -1
- package/dist/cjs/storage/memory-storage-adapter/memory-storage-adapter.js +23 -0
- package/dist/cjs/storage/memory-storage-adapter/memory-storage-adapter.js.map +1 -1
- package/dist/cjs/storage/mongodb-storage-adapter/mongodb-storage-adapter.js +0 -70
- package/dist/cjs/storage/mongodb-storage-adapter/mongodb-storage-adapter.js.map +1 -1
- package/dist/cjs/storage/namespace-storage-adapter.js +11 -21
- package/dist/cjs/storage/namespace-storage-adapter.js.map +1 -1
- package/dist/cjs/storage/redis-storage-adapter/redis-storage-adapter.js +0 -20
- package/dist/cjs/storage/redis-storage-adapter/redis-storage-adapter.js.map +1 -1
- package/dist/cjs/storage/sqlite/_shared/base-sqlite-storage-adapter.js +0 -34
- package/dist/cjs/storage/sqlite/_shared/base-sqlite-storage-adapter.js.map +1 -1
- package/dist/cjs/storage/storage.js +104 -188
- package/dist/cjs/storage/storage.js.map +1 -1
- package/dist/esm/async/_module.js +1 -0
- package/dist/esm/async/_module.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/_module.js +1 -3
- package/dist/esm/collection/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-iterable.js +14 -23
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js +12 -21
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-collapse-iterable.js +5 -14
- package/dist/esm/collection/async-iterable-collection/_shared/async-collapse-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-count-by-iterable.js +9 -18
- package/dist/esm/collection/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-cross-join-iterable.js +17 -26
- package/dist/esm/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-error-handler-iterable.js +27 -0
- package/dist/esm/collection/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -0
- package/dist/esm/collection/async-iterable-collection/_shared/async-filter-iterable.js +3 -12
- package/dist/esm/collection/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-flat-map-iterable.js +2 -11
- package/dist/esm/collection/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-insert-after-iterable.js +8 -17
- package/dist/esm/collection/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-insert-before-iterable.js +8 -17
- package/dist/esm/collection/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-map-iterable.js +2 -11
- package/dist/esm/collection/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-merge-iterable.js +2 -11
- package/dist/esm/collection/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-partion-iterable.js +9 -18
- package/dist/esm/collection/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-repeat-iterable.js +4 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-iterable.js +3 -12
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-until-iterable.js +7 -16
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-sliding-iterable.js +9 -18
- package/dist/esm/collection/async-iterable-collection/_shared/async-sliding-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-split-iterable.js +17 -26
- package/dist/esm/collection/async-iterable-collection/_shared/async-split-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-take-iterable.js +3 -12
- package/dist/esm/collection/async-iterable-collection/_shared/async-take-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-take-until-iterable.js +4 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-tap-iterable.js +2 -11
- package/dist/esm/collection/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-unique-iterable.js +6 -15
- package/dist/esm/collection/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-update-iterable.js +5 -14
- package/dist/esm/collection/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-when-iterable.js +4 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js +179 -267
- package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/chunk-iterable.js +14 -23
- package/dist/esm/collection/iterable-collection/_shared/chunk-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/chunk-while-iterable.js +12 -21
- package/dist/esm/collection/iterable-collection/_shared/chunk-while-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/collapse-iterable.js +5 -14
- package/dist/esm/collection/iterable-collection/_shared/collapse-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/count-by-iterable.js +9 -18
- package/dist/esm/collection/iterable-collection/_shared/count-by-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js +19 -31
- package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/entries-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/entries-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/filter-iterable.js +3 -12
- package/dist/esm/collection/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/flat-map-iterable.js +2 -11
- package/dist/esm/collection/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/group-by-iterable.js +9 -18
- package/dist/esm/collection/iterable-collection/_shared/group-by-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/insert-after-iterable.js +6 -16
- package/dist/esm/collection/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/insert-before-iterable.js +6 -16
- package/dist/esm/collection/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/map-iterable.js +2 -11
- package/dist/esm/collection/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/merge-iterable.js +2 -11
- package/dist/esm/collection/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/pad-end-iterable.js +11 -20
- package/dist/esm/collection/iterable-collection/_shared/pad-end-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/pad-start-iterable.js +11 -20
- package/dist/esm/collection/iterable-collection/_shared/pad-start-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/partion-iterable.js +9 -18
- package/dist/esm/collection/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/repeat-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/repeat-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/reverse-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/reverse-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/shuffle-iterable.js +9 -18
- package/dist/esm/collection/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/skip-iterable.js +3 -12
- package/dist/esm/collection/iterable-collection/_shared/skip-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/skip-until-iterable.js +6 -15
- package/dist/esm/collection/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/slice-iterable.js +15 -24
- package/dist/esm/collection/iterable-collection/_shared/slice-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/sliding-iterable.js +9 -18
- package/dist/esm/collection/iterable-collection/_shared/sliding-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/sort-iterable.js +1 -10
- package/dist/esm/collection/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/split-iterable.js +17 -26
- package/dist/esm/collection/iterable-collection/_shared/split-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/take-iterable.js +3 -12
- package/dist/esm/collection/iterable-collection/_shared/take-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/take-until-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/tap-iterable.js +2 -11
- package/dist/esm/collection/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/unique-iterable.js +6 -15
- package/dist/esm/collection/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/update-iterable.js +5 -14
- package/dist/esm/collection/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/when-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/zip-iterable.js +6 -15
- package/dist/esm/collection/iterable-collection/_shared/zip-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/iterable-collection.js +155 -347
- package/dist/esm/collection/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/esm/collection/list-collection/list-collection.js +349 -932
- package/dist/esm/collection/list-collection/list-collection.js.map +1 -1
- package/dist/esm/storage/memory-storage-adapter/memory-storage-adapter.js +23 -0
- package/dist/esm/storage/memory-storage-adapter/memory-storage-adapter.js.map +1 -1
- package/dist/esm/storage/mongodb-storage-adapter/mongodb-storage-adapter.js +0 -70
- package/dist/esm/storage/mongodb-storage-adapter/mongodb-storage-adapter.js.map +1 -1
- package/dist/esm/storage/namespace-storage-adapter.js +11 -21
- package/dist/esm/storage/namespace-storage-adapter.js.map +1 -1
- package/dist/esm/storage/redis-storage-adapter/redis-storage-adapter.js +0 -20
- package/dist/esm/storage/redis-storage-adapter/redis-storage-adapter.js.map +1 -1
- package/dist/esm/storage/sqlite/_shared/base-sqlite-storage-adapter.js +0 -34
- package/dist/esm/storage/sqlite/_shared/base-sqlite-storage-adapter.js.map +1 -1
- package/dist/esm/storage/storage.js +105 -189
- package/dist/esm/storage/storage.js.map +1 -1
- package/dist/types/_shared/types.d.ts +2 -6
- package/dist/types/async/_module.d.ts +1 -0
- package/dist/types/collection/async-iterable-collection/_shared/_module.d.ts +1 -3
- package/dist/types/collection/async-iterable-collection/_shared/async-error-handler-iterable.d.ts +6 -0
- package/dist/types/collection/async-iterable-collection/_shared/async-when-iterable.d.ts +1 -1
- package/dist/types/collection/async-iterable-collection/async-iterable-collection.d.ts +39 -37
- package/dist/types/contracts/collection/_shared.d.ts +7 -7
- package/dist/types/contracts/collection/async-collection.contract.d.ts +51 -39
- package/dist/types/contracts/storage/storage-adapter.contract.d.ts +7 -26
- package/dist/types/contracts/storage/storage.contract.d.ts +22 -22
- package/dist/types/storage/memory-storage-adapter/memory-storage-adapter.d.ts +2 -0
- package/dist/types/storage/mongodb-storage-adapter/mongodb-storage-adapter.d.ts +0 -3
- package/dist/types/storage/namespace-storage-adapter.d.ts +2 -7
- package/dist/types/storage/redis-storage-adapter/redis-storage-adapter.d.ts +0 -3
- package/dist/types/storage/sqlite/_shared/base-sqlite-storage-adapter.d.ts +0 -3
- package/dist/types/storage/storage.d.ts +24 -23
- package/package.json +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-abort-iterable.js +0 -25
- package/dist/cjs/collection/async-iterable-collection/_shared/async-abort-iterable.js.map +0 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-delay-iterable.js +0 -25
- package/dist/cjs/collection/async-iterable-collection/_shared/async-delay-iterable.js.map +0 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-timeout-iterable.js +0 -21
- package/dist/cjs/collection/async-iterable-collection/_shared/async-timeout-iterable.js.map +0 -1
- package/dist/cjs/storage/usable-storage-adapter.js +0 -102
- package/dist/cjs/storage/usable-storage-adapter.js.map +0 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-abort-iterable.js +0 -21
- package/dist/esm/collection/async-iterable-collection/_shared/async-abort-iterable.js.map +0 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-delay-iterable.js +0 -21
- package/dist/esm/collection/async-iterable-collection/_shared/async-delay-iterable.js.map +0 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-timeout-iterable.js +0 -17
- package/dist/esm/collection/async-iterable-collection/_shared/async-timeout-iterable.js.map +0 -1
- package/dist/esm/storage/usable-storage-adapter.js +0 -98
- package/dist/esm/storage/usable-storage-adapter.js.map +0 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-abort-iterable.d.ts +0 -10
- package/dist/types/collection/async-iterable-collection/_shared/async-delay-iterable.d.ts +0 -10
- package/dist/types/collection/async-iterable-collection/_shared/async-timeout-iterable.d.ts +0 -10
- package/dist/types/storage/usable-storage-adapter.d.ts +0 -22
|
@@ -48,19 +48,19 @@ export type ForEach<TInput, TCollection> = (item: TInput, index: number, collect
|
|
|
48
48
|
export type Modifier<TInput, TOutput> = (collection: TInput) => TOutput;
|
|
49
49
|
export type Tap<TCollection> = (collection: TCollection) => void;
|
|
50
50
|
export type Transform<TInput, TOutput> = (value: TInput) => TOutput;
|
|
51
|
-
export type AsyncPredicate_<TInput, TCollection> = (item: TInput, index: number, collection: TCollection) =>
|
|
51
|
+
export type AsyncPredicate_<TInput, TCollection> = (item: TInput, index: number, collection: TCollection) => PromiseLike<boolean>;
|
|
52
52
|
export type AsyncPredicate<TInput, TCollection, TOutput extends TInput = TInput> = AsyncPredicate_<TInput, TCollection> | Predicate<TInput, TCollection, TOutput>;
|
|
53
|
-
export type AsyncReduce_<TInput, TCollection, TOutput> = (output: TOutput, item: TInput, index: number, collection: TCollection) =>
|
|
53
|
+
export type AsyncReduce_<TInput, TCollection, TOutput> = (output: TOutput, item: TInput, index: number, collection: TCollection) => PromiseLike<TOutput>;
|
|
54
54
|
export type AsyncReduce<TInput, TCollection, TOutput> = AsyncReduce_<TInput, TCollection, TOutput> | Reduce<TInput, TCollection, TOutput>;
|
|
55
|
-
export type AsyncMap_<TInput, TCollection, TOutput> = (item: TInput, index: number, collection: TCollection) =>
|
|
55
|
+
export type AsyncMap_<TInput, TCollection, TOutput> = (item: TInput, index: number, collection: TCollection) => PromiseLike<TOutput>;
|
|
56
56
|
export type AsyncMap<TInput, TCollection, TOutput> = AsyncMap_<TInput, TCollection, TOutput> | Map<TInput, TCollection, TOutput>;
|
|
57
|
-
export type AsyncForEach_<TInput, TCollection> = (item: TInput, index: number, collection: TCollection) =>
|
|
57
|
+
export type AsyncForEach_<TInput, TCollection> = (item: TInput, index: number, collection: TCollection) => PromiseLike<void>;
|
|
58
58
|
export type AsyncForEach<TInput, TCollection> = ForEach<TInput, TCollection> | AsyncForEach_<TInput, TCollection>;
|
|
59
|
-
export type AsyncModifier_<TInput, TOutput> = (collection: TInput) =>
|
|
59
|
+
export type AsyncModifier_<TInput, TOutput> = (collection: TInput) => PromiseLike<TOutput>;
|
|
60
60
|
export type AsyncModifier<TInput, TOutput> = Modifier<TInput, TOutput> | AsyncModifier_<TInput, TOutput>;
|
|
61
|
-
export type AsyncTap_<TCollection> = (collection: TCollection) =>
|
|
61
|
+
export type AsyncTap_<TCollection> = (collection: TCollection) => PromiseLike<void>;
|
|
62
62
|
export type AsyncTap<TCollection> = Tap<TCollection> | AsyncTap_<TCollection>;
|
|
63
|
-
export type AsyncTransform_<TInput, TOutput> = (value: TInput) =>
|
|
63
|
+
export type AsyncTransform_<TInput, TOutput> = (value: TInput) => PromiseLike<TOutput>;
|
|
64
64
|
export type AsyncTransform<TInput, TOutput> = Transform<TInput, TOutput> | AsyncTransform_<TInput, TOutput>;
|
|
65
65
|
export type CrossJoinResult<TInput, TExtended> = TInput extends [
|
|
66
66
|
infer R,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { AsyncReduce, CrossJoinResult, AsyncPredicate, AsyncForEach, AsyncMap, AsyncModifier, AsyncTap, AsyncTransform, Comparator, ChangendItem } from "../../contracts/collection/_shared";
|
|
5
5
|
import type { RecordItem, AsyncLazyable, EnsureType, AsyncIterableValue } from "../../_shared/types";
|
|
6
|
+
import type { TimeSpan } from "../../_module";
|
|
6
7
|
export type AsyncCollapse<TValue> = TValue extends Array<infer TItem> | Iterable<infer TItem> | IAsyncCollection<infer TItem> ? TItem : TValue;
|
|
7
8
|
/**
|
|
8
9
|
* <i>IAsyncCollection</i> is immutable. The <i>throwOnIndexOverflow</i> parameter in the <i>IAsyncCollection</i> methods is used for preventing the index to overflow by throwing an error.
|
|
@@ -87,9 +88,9 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
87
88
|
* );
|
|
88
89
|
* // { 0: "a", 1: "b", 2: "c" }
|
|
89
90
|
*/
|
|
90
|
-
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>):
|
|
91
|
-
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>, initialValue: TInput):
|
|
92
|
-
reduce<TOutput>(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TOutput>, initialValue: TOutput):
|
|
91
|
+
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>): PromiseLike<TInput>;
|
|
92
|
+
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>, initialValue: TInput): PromiseLike<TInput>;
|
|
93
|
+
reduce<TOutput>(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TOutput>, initialValue: TOutput): PromiseLike<TOutput>;
|
|
93
94
|
/**
|
|
94
95
|
* The <i>join</i> method joins the collection's items with <i> separator </i>. An error will be thrown when if a none string item is encounterd.
|
|
95
96
|
* @throws {TypeCollectionError}
|
|
@@ -106,7 +107,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
106
107
|
* await collection.map(item => item.toString()).join("_");
|
|
107
108
|
* // "1_2_3_4"
|
|
108
109
|
*/
|
|
109
|
-
join(separator?: string):
|
|
110
|
+
join(separator?: string): PromiseLike<EnsureType<TInput, string>>;
|
|
110
111
|
/**
|
|
111
112
|
* The <i>collapse</i> method collapses a collection of iterables into a single, flat collection.
|
|
112
113
|
* @example
|
|
@@ -164,7 +165,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
164
165
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
165
166
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
166
167
|
*/
|
|
167
|
-
sum():
|
|
168
|
+
sum(): PromiseLike<EnsureType<TInput, number>>;
|
|
168
169
|
/**
|
|
169
170
|
* The <i>average</i> method returns the average of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
170
171
|
* @example
|
|
@@ -178,7 +179,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
178
179
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
179
180
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
180
181
|
*/
|
|
181
|
-
average():
|
|
182
|
+
average(): PromiseLike<EnsureType<TInput, number>>;
|
|
182
183
|
/**
|
|
183
184
|
* The <i>median</i> method returns the median of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
184
185
|
* @example
|
|
@@ -192,7 +193,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
192
193
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
193
194
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
194
195
|
*/
|
|
195
|
-
median():
|
|
196
|
+
median(): PromiseLike<EnsureType<TInput, number>>;
|
|
196
197
|
/**
|
|
197
198
|
* The <i>min</i> method returns the min of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
198
199
|
* @example
|
|
@@ -206,7 +207,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
206
207
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
207
208
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
208
209
|
*/
|
|
209
|
-
min():
|
|
210
|
+
min(): PromiseLike<EnsureType<TInput, number>>;
|
|
210
211
|
/**
|
|
211
212
|
* The <i>max</i> method returns the max of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
212
213
|
* @example
|
|
@@ -220,7 +221,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
220
221
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
221
222
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
222
223
|
*/
|
|
223
|
-
max():
|
|
224
|
+
max(): PromiseLike<EnsureType<TInput, number>>;
|
|
224
225
|
/**
|
|
225
226
|
* The <i>percentage</i> method may be used to quickly determine the percentage of items in the collection that pass <i>predicateFn</i>.
|
|
226
227
|
* @example
|
|
@@ -233,7 +234,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
233
234
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
234
235
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
235
236
|
*/
|
|
236
|
-
percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
237
|
+
percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<number>;
|
|
237
238
|
/**
|
|
238
239
|
* The <i>some</i> method determines whether at least one item in the collection matches <i>predicateFn</i>.
|
|
239
240
|
* @example
|
|
@@ -245,7 +246,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
245
246
|
* @throws {CollectionError} {@link CollectionError}
|
|
246
247
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
247
248
|
*/
|
|
248
|
-
some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
249
|
+
some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<boolean>;
|
|
249
250
|
/**
|
|
250
251
|
* The <i>every</i> method determines whether all items in the collection matches <i>predicateFn</i>.
|
|
251
252
|
* @example
|
|
@@ -257,7 +258,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
257
258
|
* @throws {CollectionError} {@link CollectionError}
|
|
258
259
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
259
260
|
*/
|
|
260
|
-
every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
261
|
+
every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<boolean>;
|
|
261
262
|
/**
|
|
262
263
|
* The <i>take</i> method takes the first <i>limit</i> items.
|
|
263
264
|
* @example
|
|
@@ -409,7 +410,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
409
410
|
* console.log(piped);
|
|
410
411
|
* // [ 1, 2, 1, 3 ]
|
|
411
412
|
*/
|
|
412
|
-
pipe<TOutput = TInput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>):
|
|
413
|
+
pipe<TOutput = TInput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>): PromiseLike<TOutput>;
|
|
413
414
|
/**
|
|
414
415
|
* The <i>tap</i> method passes a copy of the original collection to <i>callback</i>, allowing you to do something with the items while not affecting the original collection.
|
|
415
416
|
* @example
|
|
@@ -888,7 +889,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
888
889
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
889
890
|
* // 3
|
|
890
891
|
*/
|
|
891
|
-
first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
892
|
+
first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<TOutput | null>;
|
|
892
893
|
/**
|
|
893
894
|
* The <i>firstOr</i> method returns the first item in the collection that passes <i> predicateFn </i>
|
|
894
895
|
* By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
|
|
@@ -919,7 +920,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
919
920
|
* @throws {CollectionError} {@link CollectionError}
|
|
920
921
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
921
922
|
*/
|
|
922
|
-
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
923
|
+
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<TOutput | TExtended>;
|
|
923
924
|
/**
|
|
924
925
|
* The <i>firstOrFail</i> method returns the first item in the collection that passes <i> predicateFn </i>.
|
|
925
926
|
* By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than error is thrown.
|
|
@@ -945,7 +946,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
945
946
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
946
947
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
947
948
|
*/
|
|
948
|
-
firstOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
949
|
+
firstOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<TOutput>;
|
|
949
950
|
/**
|
|
950
951
|
* The <i>last</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
951
952
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than null i returned.
|
|
@@ -971,7 +972,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
971
972
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
972
973
|
* // 3
|
|
973
974
|
*/
|
|
974
|
-
last<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
975
|
+
last<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<TOutput | null>;
|
|
975
976
|
/**
|
|
976
977
|
* The <i>lastOr</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
977
978
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
|
|
@@ -1002,7 +1003,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1002
1003
|
* @throws {CollectionError} {@link CollectionError}
|
|
1003
1004
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1004
1005
|
*/
|
|
1005
|
-
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1006
|
+
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<TOutput | TExtended>;
|
|
1006
1007
|
/**
|
|
1007
1008
|
* The <i>lastOrFail</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
1008
1009
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than error is thrown.
|
|
@@ -1028,7 +1029,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1028
1029
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1029
1030
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1030
1031
|
*/
|
|
1031
|
-
lastOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1032
|
+
lastOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<TOutput>;
|
|
1032
1033
|
/**
|
|
1033
1034
|
* The <i>before</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1034
1035
|
* If the <i>predicateFn</i> does not match or matches the first item then null is returned.
|
|
@@ -1047,7 +1048,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1047
1048
|
* @throws {CollectionError} {@link CollectionError}
|
|
1048
1049
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1049
1050
|
*/
|
|
1050
|
-
before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1051
|
+
before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<TInput | null>;
|
|
1051
1052
|
/**
|
|
1052
1053
|
* The <i>beforeOr</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1053
1054
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then <i>defaultValue</i> is returned.
|
|
@@ -1072,7 +1073,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1072
1073
|
* @throws {CollectionError} {@link CollectionError}
|
|
1073
1074
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1074
1075
|
*/
|
|
1075
|
-
beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1076
|
+
beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<TInput | TExtended>;
|
|
1076
1077
|
/**
|
|
1077
1078
|
* The <i>beforeOrFail</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1078
1079
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then an error is thrown.
|
|
@@ -1092,7 +1093,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1092
1093
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1093
1094
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1094
1095
|
*/
|
|
1095
|
-
beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1096
|
+
beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<TInput>;
|
|
1096
1097
|
/**
|
|
1097
1098
|
* The <i>after</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1098
1099
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then null is returned.
|
|
@@ -1111,7 +1112,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1111
1112
|
* @throws {CollectionError} {@link CollectionError}
|
|
1112
1113
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1113
1114
|
*/
|
|
1114
|
-
after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1115
|
+
after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<TInput | null>;
|
|
1115
1116
|
/**
|
|
1116
1117
|
* The <i>afterOr</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1117
1118
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then <i>defaultValue</i> is returned.
|
|
@@ -1136,7 +1137,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1136
1137
|
* @throws {CollectionError} {@link CollectionError}
|
|
1137
1138
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1138
1139
|
*/
|
|
1139
|
-
afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1140
|
+
afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<TInput | TExtended>;
|
|
1140
1141
|
/**
|
|
1141
1142
|
* The <i>afterOrFail</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1142
1143
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then an error is thrown.
|
|
@@ -1156,7 +1157,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1156
1157
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1157
1158
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1158
1159
|
*/
|
|
1159
|
-
afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1160
|
+
afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<TInput>;
|
|
1160
1161
|
/**
|
|
1161
1162
|
* The <i>sole</i> method returns the first item in the collection that passes <i>predicateFn</i>, but only if <i>predicateFn</i> matches exactly one item.
|
|
1162
1163
|
* If no items matches or multiple items are found an error will be thrown.
|
|
@@ -1183,7 +1184,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1183
1184
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1184
1185
|
* @throws {MultipleItemsFoundCollectionError} {@link MultipleItemsFoundCollectionError}
|
|
1185
1186
|
*/
|
|
1186
|
-
sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1187
|
+
sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): PromiseLike<TOutput>;
|
|
1187
1188
|
/**
|
|
1188
1189
|
* The <i>nth</i> method creates a new collection consisting of every n-th item.
|
|
1189
1190
|
* @example
|
|
@@ -1205,25 +1206,25 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1205
1206
|
* @throws {CollectionError} {@link CollectionError}
|
|
1206
1207
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1207
1208
|
*/
|
|
1208
|
-
count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1209
|
+
count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<number>;
|
|
1209
1210
|
/**
|
|
1210
1211
|
* The <i>size</i> returns the size of the collection.
|
|
1211
1212
|
* @throws {CollectionError} {@link CollectionError}
|
|
1212
1213
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1213
1214
|
*/
|
|
1214
|
-
size():
|
|
1215
|
+
size(): PromiseLike<number>;
|
|
1215
1216
|
/**
|
|
1216
1217
|
* The <i>isEmpty</i> returns true if the collection is empty.
|
|
1217
1218
|
* @throws {CollectionError} {@link CollectionError}
|
|
1218
1219
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1219
1220
|
*/
|
|
1220
|
-
isEmpty():
|
|
1221
|
+
isEmpty(): PromiseLike<boolean>;
|
|
1221
1222
|
/**
|
|
1222
1223
|
* The <i>isNotEmpty</i> returns true if the collection is not empty.
|
|
1223
1224
|
* @throws {CollectionError} {@link CollectionError}
|
|
1224
1225
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1225
1226
|
*/
|
|
1226
|
-
isNotEmpty():
|
|
1227
|
+
isNotEmpty(): PromiseLike<boolean>;
|
|
1227
1228
|
/**
|
|
1228
1229
|
* The <i>searchFirst</i> return the index of the first item that matches <i>predicateFn</i>.
|
|
1229
1230
|
* @example
|
|
@@ -1235,7 +1236,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1235
1236
|
* @throws {CollectionError} {@link CollectionError}
|
|
1236
1237
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1237
1238
|
*/
|
|
1238
|
-
searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1239
|
+
searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<number>;
|
|
1239
1240
|
/**
|
|
1240
1241
|
* The <i>searchLast</i> return the index of the last item that matches <i>predicateFn</i>.
|
|
1241
1242
|
* @example
|
|
@@ -1247,21 +1248,21 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1247
1248
|
* @throws {CollectionError} {@link CollectionError}
|
|
1248
1249
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1249
1250
|
*/
|
|
1250
|
-
searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1251
|
+
searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): PromiseLike<number>;
|
|
1251
1252
|
/**
|
|
1252
1253
|
* The <i>forEach</i> method iterates through all items in the collection.
|
|
1253
1254
|
* @throws {CollectionError} {@link CollectionError}
|
|
1254
1255
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1255
1256
|
*/
|
|
1256
|
-
forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>):
|
|
1257
|
+
forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>): PromiseLike<void>;
|
|
1257
1258
|
/**
|
|
1258
1259
|
* The <i>toArray</i> method converts the collection to a new array.
|
|
1259
1260
|
* @throws {CollectionError} {@link CollectionError}
|
|
1260
1261
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1261
1262
|
*/
|
|
1262
|
-
toArray():
|
|
1263
|
+
toArray(): PromiseLike<TInput[]>;
|
|
1263
1264
|
/**
|
|
1264
|
-
* The delay method will delay
|
|
1265
|
+
* The <i>delay</i> method will add delay between each iteration.
|
|
1265
1266
|
* This method is especially useful for situations where you may be interacting with external APIs that rate limit incoming requests:
|
|
1266
1267
|
* @example
|
|
1267
1268
|
* import { AsyncIterableCollection } from "@daiso-tech/core";;
|
|
@@ -1272,10 +1273,21 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1272
1273
|
* const collection = new AsyncIterableCollection(apiIterator);
|
|
1273
1274
|
* await collection.delay(1000).forEach(user => console.log(user))
|
|
1274
1275
|
*/
|
|
1275
|
-
delay(
|
|
1276
|
-
abort(signal: AbortSignal): IAsyncCollection<TInput>;
|
|
1276
|
+
delay(time: TimeSpan): IAsyncCollection<TInput>;
|
|
1277
1277
|
/**
|
|
1278
|
-
* The
|
|
1278
|
+
* The <i>abort</i> method will abort iteration of the collection by passing <i>{@link AbortSignal}</i>.
|
|
1279
|
+
* @example
|
|
1280
|
+
* import { AsyncIterableCollection } from "@daiso-tech/core";;
|
|
1281
|
+
*
|
|
1282
|
+
* // An iterator that will fetch all users from a specific api
|
|
1283
|
+
* class ApiIterator implements AsyncIterable<IUser> { ... }
|
|
1284
|
+
* const apiIterator = new ApiIterator();
|
|
1285
|
+
* const collection = new AsyncIterableCollection(apiIterator);
|
|
1286
|
+
* await collection.delay(1000).forEach(user => console.log(user))
|
|
1287
|
+
*/
|
|
1288
|
+
takeUntilAbort(abortSignal: AbortSignal, shouldThrow?: boolean): IAsyncCollection<TInput>;
|
|
1289
|
+
/**
|
|
1290
|
+
* The <I>timeout</i> method returns a new collection that will iterate values until the specified time.
|
|
1279
1291
|
* After that time, the collection will then stop iterating:
|
|
1280
1292
|
* @example
|
|
1281
1293
|
* import { AsyncIterableCollection } from "@daiso-tech/core";;
|
|
@@ -1293,5 +1305,5 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1293
1305
|
* .timeout(1000)
|
|
1294
1306
|
* .forEach(nbr => console.log(nbr))
|
|
1295
1307
|
*/
|
|
1296
|
-
|
|
1308
|
+
takeUntilTimeout(timeInMs: TimeSpan, shouldThrow?: boolean): IAsyncCollection<TInput>;
|
|
1297
1309
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Storage
|
|
3
3
|
*/
|
|
4
|
-
import type { GetOrAddResult } from "../../_shared/types";
|
|
5
4
|
/**
|
|
6
5
|
* @throws {StorageError} {@link StorageError}
|
|
7
6
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
@@ -9,64 +8,46 @@ import type { GetOrAddResult } from "../../_shared/types";
|
|
|
9
8
|
* @group Contracts
|
|
10
9
|
*/
|
|
11
10
|
export type IStorageAdapter<TType> = {
|
|
12
|
-
/**
|
|
13
|
-
* Returns true for the keys that are found otherwise false will be returned.
|
|
14
|
-
* @throws {StorageError} {@link StorageError}
|
|
15
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
16
|
-
*/
|
|
17
|
-
existsMany?<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
18
11
|
/**
|
|
19
12
|
* Returns the value for the keys that are found otherwise null will be returned.
|
|
20
13
|
* @throws {StorageError} {@link StorageError}
|
|
21
14
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
22
15
|
*/
|
|
23
|
-
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]):
|
|
16
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, TValues | null>>;
|
|
24
17
|
/**
|
|
25
18
|
* Adds the keys that doesn't exists. Returns true for the keys that doesn't exists otherwise false will be returned.
|
|
26
19
|
* @throws {StorageError} {@link StorageError}
|
|
27
20
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
28
21
|
*/
|
|
29
|
-
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>):
|
|
22
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): PromiseLike<Record<TKeys, boolean>>;
|
|
30
23
|
/**
|
|
31
24
|
* Updates the keys that exists. Returns true for the keys that exists otherwise false will be returned.
|
|
32
25
|
* @throws {StorageError} {@link StorageError}
|
|
33
26
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
34
27
|
*/
|
|
35
|
-
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>):
|
|
28
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): PromiseLike<Record<TKeys, boolean>>;
|
|
36
29
|
/**
|
|
37
30
|
* Replaces the keys that are found. Adds keys that are not found. Returns true for all the keys that are found otherwise false is returned.
|
|
38
31
|
* @throws {StorageError} {@link StorageError}
|
|
39
32
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
40
33
|
*/
|
|
41
|
-
putMany
|
|
34
|
+
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): PromiseLike<Record<TKeys, boolean>>;
|
|
42
35
|
/**
|
|
43
36
|
* Removes the keys that are found. Returns true for the keys that are found otherwise false is returned.
|
|
44
37
|
* @throws {StorageError} {@link StorageError}
|
|
45
38
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
46
39
|
*/
|
|
47
|
-
removeMany<TKeys extends string>(keys: TKeys[]):
|
|
48
|
-
/**
|
|
49
|
-
* If the key is found the value be returned and key will be removed otherwise null will be returned.
|
|
50
|
-
* @throws {StorageError} {@link StorageError}
|
|
51
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
52
|
-
*/
|
|
53
|
-
getAndRemove?<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
54
|
-
/**
|
|
55
|
-
* If the key is found the value be returned otherwise valueToAdd will be added and returned.
|
|
56
|
-
* @throws {StorageError} {@link StorageError}
|
|
57
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
58
|
-
*/
|
|
59
|
-
getOrAdd?<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: TExtended): Promise<GetOrAddResult<TValue | TExtended>>;
|
|
40
|
+
removeMany<TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, boolean>>;
|
|
60
41
|
/**
|
|
61
42
|
* Will increment the existing key with value if found otherwise nonthing occurs. Returns true if key exists otherwise false will be returned.
|
|
62
43
|
* @throws {StorageError} {@link StorageError}
|
|
63
44
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
64
45
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
65
46
|
*/
|
|
66
|
-
increment
|
|
47
|
+
increment(key: string, value: number): PromiseLike<boolean>;
|
|
67
48
|
/**
|
|
68
49
|
* @throws {StorageError} {@link StorageError}
|
|
69
50
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
70
51
|
*/
|
|
71
|
-
clear(prefix: string):
|
|
52
|
+
clear(prefix: string): PromiseLike<void>;
|
|
72
53
|
};
|
|
@@ -16,133 +16,133 @@ export type IStorage<TType = unknown> = {
|
|
|
16
16
|
* @throws {StorageError} {@link StorageError}
|
|
17
17
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
18
18
|
*/
|
|
19
|
-
exists(key: string):
|
|
19
|
+
exists(key: string): PromiseLike<boolean>;
|
|
20
20
|
/**
|
|
21
21
|
* Returns true for the keys that are found otherwise false will be returned.
|
|
22
22
|
* @throws {StorageError} {@link StorageError}
|
|
23
23
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
24
24
|
*/
|
|
25
|
-
existsMany<TKeys extends string>(keys: TKeys[]):
|
|
25
|
+
existsMany<TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, boolean>>;
|
|
26
26
|
/**
|
|
27
27
|
* Returns true when key is not found otherwise false will be returned.
|
|
28
28
|
* @throws {StorageError} {@link StorageError}
|
|
29
29
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
30
30
|
*/
|
|
31
|
-
missing(key: string):
|
|
31
|
+
missing(key: string): PromiseLike<boolean>;
|
|
32
32
|
/**
|
|
33
33
|
* Returns true for the keys that are not found otherwise false will be returned.
|
|
34
34
|
* @throws {StorageError} {@link StorageError}
|
|
35
35
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
36
36
|
*/
|
|
37
|
-
missingMany<TKeys extends string>(keys: TKeys[]):
|
|
37
|
+
missingMany<TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, boolean>>;
|
|
38
38
|
/**
|
|
39
39
|
* Returns the value when key is found otherwise null will be returned.
|
|
40
40
|
* @throws {StorageError} {@link StorageError}
|
|
41
41
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
42
42
|
*/
|
|
43
|
-
get<TValue extends TType>(key: string):
|
|
43
|
+
get<TValue extends TType>(key: string): PromiseLike<TValue | null>;
|
|
44
44
|
/**
|
|
45
45
|
* Returns the value for the keys that are found otherwise null will be returned.
|
|
46
46
|
* @throws {StorageError} {@link StorageError}
|
|
47
47
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
48
48
|
*/
|
|
49
|
-
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]):
|
|
49
|
+
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, TValues | null>>;
|
|
50
50
|
/**
|
|
51
51
|
* Returns the value when key is found otherwise defaultValue will be returned.
|
|
52
52
|
* @throws {StorageError} {@link StorageError}
|
|
53
53
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
54
54
|
*/
|
|
55
|
-
getOr<TValue extends TType, TExtended extends TType>(key: string, defaultValue: AsyncLazyable<TExtended>):
|
|
55
|
+
getOr<TValue extends TType, TExtended extends TType>(key: string, defaultValue: AsyncLazyable<TExtended>): PromiseLike<TValue | TExtended>;
|
|
56
56
|
/**
|
|
57
57
|
* Returns the value for the keys that are found otherwise defaultValue will be returned.
|
|
58
58
|
* @throws {StorageError} {@link StorageError}
|
|
59
59
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
60
60
|
*/
|
|
61
|
-
getOrMany<TValues extends TType, TExtended extends TType, TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TExtended>>):
|
|
61
|
+
getOrMany<TValues extends TType, TExtended extends TType, TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TExtended>>): PromiseLike<Record<TKeys, TValues | TExtended>>;
|
|
62
62
|
/**
|
|
63
63
|
* Returns the value when key is found otherwise an error will be thrown.
|
|
64
64
|
* @throws {StorageError} {@link StorageError}
|
|
65
65
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
66
66
|
* @throws {KeyNotFoundStorageError} {@link KeyNotFoundStorageError}
|
|
67
67
|
*/
|
|
68
|
-
getOrFail<TValue extends TType>(key: string):
|
|
68
|
+
getOrFail<TValue extends TType>(key: string): PromiseLike<TValue>;
|
|
69
69
|
/**
|
|
70
70
|
* Adds a key when key doesn't exists. Returns true when key doesn't exists otherwise false will be returned.
|
|
71
71
|
* @throws {StorageError} {@link StorageError}
|
|
72
72
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
73
73
|
*/
|
|
74
|
-
add<TValue extends TType>(key: string, value: StorageValue<TValue>):
|
|
74
|
+
add<TValue extends TType>(key: string, value: StorageValue<TValue>): PromiseLike<boolean>;
|
|
75
75
|
/**
|
|
76
76
|
* Adds the keys that doesn't exists. Returns true for the keys that doesn't exists otherwise false will be returned.
|
|
77
77
|
* @throws {StorageError} {@link StorageError}
|
|
78
78
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
79
79
|
*/
|
|
80
|
-
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, StorageValue<TValues>>):
|
|
80
|
+
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, StorageValue<TValues>>): PromiseLike<Record<TKeys, boolean>>;
|
|
81
81
|
/**
|
|
82
82
|
* Updates a keys that exists. Returns true when key otherwise false will be returned.
|
|
83
83
|
* @throws {StorageError} {@link StorageError}
|
|
84
84
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
85
85
|
*/
|
|
86
|
-
update<TValue extends TType>(key: string, value: TValue):
|
|
86
|
+
update<TValue extends TType>(key: string, value: TValue): PromiseLike<boolean>;
|
|
87
87
|
/**
|
|
88
88
|
* Updates the keys that exists. Returns true for the keys that exists otherwise false will be returned.
|
|
89
89
|
* @throws {StorageError} {@link StorageError}
|
|
90
90
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
91
91
|
*/
|
|
92
|
-
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>):
|
|
92
|
+
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): PromiseLike<Record<TKeys, boolean>>;
|
|
93
93
|
/**
|
|
94
94
|
* If the key is found it will replaced. If the key is not found it will just be added. True is returned if the key is found otherwise false will be returned.
|
|
95
95
|
* @throws {StorageError} {@link StorageError}
|
|
96
96
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
97
97
|
*/
|
|
98
|
-
put<TValue extends TType>(key: string, value: StorageValue<TValue>):
|
|
98
|
+
put<TValue extends TType>(key: string, value: StorageValue<TValue>): PromiseLike<boolean>;
|
|
99
99
|
/**
|
|
100
100
|
* Replaces the keys that are found. Adds keys that are not found. Returns true for all the keys that are found otherwise false is returned.
|
|
101
101
|
* @throws {StorageError} {@link StorageError}
|
|
102
102
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
103
103
|
*/
|
|
104
|
-
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, StorageValue<TValues>>):
|
|
104
|
+
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, StorageValue<TValues>>): PromiseLike<Record<TKeys, boolean>>;
|
|
105
105
|
/**
|
|
106
106
|
* Removes the key when found. Returns true if the key is found otherwise false is returned.
|
|
107
107
|
* @throws {StorageError} {@link StorageError}
|
|
108
108
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
109
109
|
*/
|
|
110
|
-
remove(key: string):
|
|
110
|
+
remove(key: string): PromiseLike<boolean>;
|
|
111
111
|
/**
|
|
112
112
|
* Removes the keys that are found. Returns true for the keys that are found otherwise false is returned.
|
|
113
113
|
* @throws {StorageError} {@link StorageError}
|
|
114
114
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
115
115
|
*/
|
|
116
|
-
removeMany<TKeys extends string>(keys: TKeys[]):
|
|
116
|
+
removeMany<TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, boolean>>;
|
|
117
117
|
/**
|
|
118
118
|
* If the key is found the value be returned and key will be removed otherwise null will be returned.
|
|
119
119
|
* @throws {StorageError} {@link StorageError}
|
|
120
120
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
121
121
|
*/
|
|
122
|
-
getAndRemove<TValue extends TType>(key: string):
|
|
122
|
+
getAndRemove<TValue extends TType>(key: string): PromiseLike<TValue | null>;
|
|
123
123
|
/**
|
|
124
124
|
* If the key is found the value be returned otherwise valueToAdd will be added and returned.
|
|
125
125
|
* @throws {StorageError} {@link StorageError}
|
|
126
126
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
127
127
|
*/
|
|
128
|
-
getOrAdd<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: AsyncLazyable<StorageValue<GetOrAddValue<TExtended>>>):
|
|
128
|
+
getOrAdd<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: AsyncLazyable<StorageValue<GetOrAddValue<TExtended>>>): PromiseLike<TValue | TExtended>;
|
|
129
129
|
/**
|
|
130
130
|
* Will increment the existing key with value if found otherwise nonthing will occur. Returns true if key exists otherwise false will be returned.
|
|
131
131
|
* @throws {StorageError} {@link StorageError}
|
|
132
132
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
133
133
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
134
134
|
*/
|
|
135
|
-
increment(key: string, value?: number):
|
|
135
|
+
increment(key: string, value?: number): PromiseLike<boolean>;
|
|
136
136
|
/**
|
|
137
137
|
* Will decrement the existing key with value if found otherwise nonthing will occur. Returns true if key exists otherwise false will be returned.
|
|
138
138
|
* @throws {StorageError} {@link StorageError}
|
|
139
139
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
140
140
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
141
141
|
*/
|
|
142
|
-
decrement(key: string, value?: number):
|
|
142
|
+
decrement(key: string, value?: number): PromiseLike<boolean>;
|
|
143
143
|
/**
|
|
144
144
|
* @throws {StorageError} {@link StorageError}
|
|
145
145
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
146
146
|
*/
|
|
147
|
-
clear():
|
|
147
|
+
clear(): PromiseLike<void>;
|
|
148
148
|
};
|
|
@@ -8,6 +8,8 @@ import { type IStorageAdapter } from "../../contracts/storage/storage-adapter.co
|
|
|
8
8
|
export declare class MemoryStorageAdapter<TType> implements IStorageAdapter<TType> {
|
|
9
9
|
private readonly map;
|
|
10
10
|
constructor(map?: Map<string, TType>);
|
|
11
|
+
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
12
|
+
increment(key: string, value: number): Promise<boolean>;
|
|
11
13
|
getMany<TValues extends TType, TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, TValues | null>>;
|
|
12
14
|
addMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
13
15
|
updateMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @module Storage
|
|
3
3
|
*/
|
|
4
4
|
import { type ISerializer } from "../../contracts/serializer/_module";
|
|
5
|
-
import type { GetOrAddResult } from "../../_shared/types";
|
|
6
5
|
import { type IInitizable } from "../../_shared/types";
|
|
7
6
|
import { type IStorageAdapter } from "../../contracts/storage/_module";
|
|
8
7
|
import { type Collection, ObjectId } from "mongodb";
|
|
@@ -39,8 +38,6 @@ export declare class MongodbStorageAdapter<TType> implements IStorageAdapter<TTy
|
|
|
39
38
|
putMany<TValues extends TType, TKeys extends string>(values: Record<TKeys, TValues>): Promise<Record<TKeys, boolean>>;
|
|
40
39
|
private removeOne;
|
|
41
40
|
removeMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
42
|
-
getAndRemove<TValue extends TType>(key: string): Promise<TValue | null>;
|
|
43
|
-
getOrAdd<TValue extends TType, TExtended extends TType>(key: string, valueToAdd: TExtended): Promise<GetOrAddResult<TValue | TExtended>>;
|
|
44
41
|
increment(key: string, value: number): Promise<boolean>;
|
|
45
42
|
clear(prefix: string): Promise<void>;
|
|
46
43
|
}
|