@daiso-tech/core 0.3.0 → 0.5.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/_module.js +2 -0
- package/dist/cjs/_module.js.map +1 -1
- package/dist/cjs/async/_module.js +30 -0
- package/dist/cjs/async/_module.js.map +1 -0
- package/dist/cjs/async/_shared.js +34 -0
- package/dist/cjs/async/_shared.js.map +1 -0
- package/dist/cjs/async/abortable/_module.js +18 -0
- package/dist/cjs/async/abortable/_module.js.map +1 -0
- package/dist/cjs/async/abortable/abortable.js +48 -0
- package/dist/cjs/async/abortable/abortable.js.map +1 -0
- package/dist/cjs/async/abortable-iterable/_module.js +18 -0
- package/dist/cjs/async/abortable-iterable/_module.js.map +1 -0
- package/dist/cjs/async/abortable-iterable/abortable-iterable.js +32 -0
- package/dist/cjs/async/abortable-iterable/abortable-iterable.js.map +1 -0
- package/dist/cjs/async/backof-policies/_module.js +21 -0
- package/dist/cjs/async/backof-policies/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/_shared.js +7 -0
- package/dist/cjs/async/backof-policies/_shared.js.map +1 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +19 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +23 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +23 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +23 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/cjs/async/delay/_module.js +18 -0
- package/dist/cjs/async/delay/_module.js.map +1 -0
- package/dist/cjs/async/delay/delay.js +24 -0
- package/dist/cjs/async/delay/delay.js.map +1 -0
- package/dist/cjs/async/delay-iterable/_module.js +18 -0
- package/dist/cjs/async/delay-iterable/_module.js.map +1 -0
- package/dist/cjs/async/delay-iterable/delay-iterable.js +36 -0
- package/dist/cjs/async/delay-iterable/delay-iterable.js.map +1 -0
- package/dist/cjs/async/lazy-promise/_module.js +18 -0
- package/dist/cjs/async/lazy-promise/_module.js.map +1 -0
- package/dist/cjs/async/lazy-promise/lazy-promise.js +22 -0
- package/dist/cjs/async/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/cjs/async/retry/_module.js +18 -0
- package/dist/cjs/async/retry/_module.js.map +1 -0
- package/dist/cjs/async/retry/retry.js +43 -0
- package/dist/cjs/async/retry/retry.js.map +1 -0
- package/dist/cjs/async/retry-iterable/_module.js +18 -0
- package/dist/cjs/async/retry-iterable/_module.js.map +1 -0
- package/dist/cjs/async/retry-iterable/retry-iterable.js +32 -0
- package/dist/cjs/async/retry-iterable/retry-iterable.js.map +1 -0
- package/dist/cjs/async/timeout/_module.js +18 -0
- package/dist/cjs/async/timeout/_module.js.map +1 -0
- package/dist/cjs/async/timeout/timeout.js +28 -0
- package/dist/cjs/async/timeout/timeout.js.map +1 -0
- package/dist/cjs/async/timeout-iterable/_module.js +18 -0
- package/dist/cjs/async/timeout-iterable/_module.js.map +1 -0
- package/dist/cjs/async/timeout-iterable/timeout-iterable.js +11 -0
- package/dist/cjs/async/timeout-iterable/timeout-iterable.js.map +1 -0
- 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/storage.js +25 -15
- package/dist/cjs/storage/storage.js.map +1 -1
- package/dist/cjs/utilities/_module.js +18 -0
- package/dist/cjs/utilities/_module.js.map +1 -0
- package/dist/cjs/utilities/time-span/_module.js +18 -0
- package/dist/cjs/utilities/time-span/_module.js.map +1 -0
- package/dist/cjs/utilities/time-span/time-span.js +103 -0
- package/dist/cjs/utilities/time-span/time-span.js.map +1 -0
- package/dist/esm/_module.js +2 -0
- package/dist/esm/_module.js.map +1 -1
- package/dist/esm/async/_module.js +12 -0
- package/dist/esm/async/_module.js.map +1 -0
- package/dist/esm/async/_shared.js +27 -0
- package/dist/esm/async/_shared.js.map +1 -0
- package/dist/esm/async/abortable/_module.js +2 -0
- package/dist/esm/async/abortable/_module.js.map +1 -0
- package/dist/esm/async/abortable/abortable.js +45 -0
- package/dist/esm/async/abortable/abortable.js.map +1 -0
- package/dist/esm/async/abortable-iterable/_module.js +2 -0
- package/dist/esm/async/abortable-iterable/_module.js.map +1 -0
- package/dist/esm/async/abortable-iterable/abortable-iterable.js +29 -0
- package/dist/esm/async/abortable-iterable/abortable-iterable.js.map +1 -0
- package/dist/esm/async/backof-policies/_module.js +5 -0
- package/dist/esm/async/backof-policies/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/_shared.js +4 -0
- package/dist/esm/async/backof-policies/_shared.js.map +1 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +16 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +20 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +20 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +20 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/esm/async/delay/_module.js +2 -0
- package/dist/esm/async/delay/_module.js.map +1 -0
- package/dist/esm/async/delay/delay.js +21 -0
- package/dist/esm/async/delay/delay.js.map +1 -0
- package/dist/esm/async/delay-iterable/_module.js +2 -0
- package/dist/esm/async/delay-iterable/_module.js.map +1 -0
- package/dist/esm/async/delay-iterable/delay-iterable.js +33 -0
- package/dist/esm/async/delay-iterable/delay-iterable.js.map +1 -0
- package/dist/esm/async/lazy-promise/_module.js +2 -0
- package/dist/esm/async/lazy-promise/_module.js.map +1 -0
- package/dist/esm/async/lazy-promise/lazy-promise.js +17 -0
- package/dist/esm/async/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/esm/async/retry/_module.js +2 -0
- package/dist/esm/async/retry/_module.js.map +1 -0
- package/dist/esm/async/retry/retry.js +40 -0
- package/dist/esm/async/retry/retry.js.map +1 -0
- package/dist/esm/async/retry-iterable/_module.js +2 -0
- package/dist/esm/async/retry-iterable/_module.js.map +1 -0
- package/dist/esm/async/retry-iterable/retry-iterable.js +29 -0
- package/dist/esm/async/retry-iterable/retry-iterable.js.map +1 -0
- package/dist/esm/async/timeout/_module.js +2 -0
- package/dist/esm/async/timeout/_module.js.map +1 -0
- package/dist/esm/async/timeout/timeout.js +25 -0
- package/dist/esm/async/timeout/timeout.js.map +1 -0
- package/dist/esm/async/timeout-iterable/_module.js +2 -0
- package/dist/esm/async/timeout-iterable/_module.js.map +1 -0
- package/dist/esm/async/timeout-iterable/timeout-iterable.js +8 -0
- package/dist/esm/async/timeout-iterable/timeout-iterable.js.map +1 -0
- 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/storage.js +25 -15
- package/dist/esm/storage/storage.js.map +1 -1
- package/dist/esm/utilities/_module.js +2 -0
- package/dist/esm/utilities/_module.js.map +1 -0
- package/dist/esm/utilities/time-span/_module.js +2 -0
- package/dist/esm/utilities/time-span/_module.js.map +1 -0
- package/dist/esm/utilities/time-span/time-span.js +99 -0
- package/dist/esm/utilities/time-span/time-span.js.map +1 -0
- package/dist/types/_module.d.ts +2 -0
- package/dist/types/_shared/types.d.ts +2 -2
- package/dist/types/async/_module.d.ts +11 -0
- package/dist/types/async/_shared.d.ts +35 -0
- package/dist/types/async/abortable/_module.d.ts +1 -0
- package/dist/types/async/abortable/abortable.d.ts +39 -0
- package/dist/types/async/abortable-iterable/_module.d.ts +1 -0
- package/dist/types/async/abortable-iterable/abortable-iterable.d.ts +36 -0
- package/dist/types/async/backof-policies/_module.d.ts +5 -0
- package/dist/types/async/backof-policies/_shared.d.ts +12 -0
- package/dist/types/async/backof-policies/constant-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +28 -0
- package/dist/types/async/backof-policies/exponential-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +36 -0
- package/dist/types/async/backof-policies/linear-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +32 -0
- package/dist/types/async/backof-policies/polynomial-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +36 -0
- package/dist/types/async/delay/_module.d.ts +1 -0
- package/dist/types/async/delay/delay.d.ts +38 -0
- package/dist/types/async/delay-iterable/_module.d.ts +1 -0
- package/dist/types/async/delay-iterable/delay-iterable.d.ts +57 -0
- package/dist/types/async/lazy-promise/_module.d.ts +1 -0
- package/dist/types/async/lazy-promise/lazy-promise.d.ts +28 -0
- package/dist/types/async/retry/_module.d.ts +1 -0
- package/dist/types/async/retry/retry.d.ts +86 -0
- package/dist/types/async/retry-iterable/_module.d.ts +1 -0
- package/dist/types/async/retry-iterable/retry-iterable.d.ts +86 -0
- package/dist/types/async/timeout/_module.d.ts +1 -0
- package/dist/types/async/timeout/timeout.d.ts +40 -0
- package/dist/types/async/timeout-iterable/_module.d.ts +1 -0
- package/dist/types/async/timeout-iterable/timeout-iterable.d.ts +64 -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.contract.d.ts +2 -1
- package/dist/types/storage/storage.d.ts +5 -3
- package/dist/types/utilities/_module.d.ts +1 -0
- package/dist/types/utilities/time-span/_module.d.ts +1 -0
- package/dist/types/utilities/time-span/time-span.d.ts +50 -0
- 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/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/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
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import { type AsyncCollapse, type AsyncPredicate, type AsyncForEach, type AsyncMap, type AsyncModifier, type AsyncTap, type AsyncTransform, type Comparator, type IAsyncCollection, type ChangendItem, type AsyncReduce, type CrossJoinResult } from "../../contracts/collection/_module";
|
|
5
5
|
import { type AsyncIterableValue, type AsyncLazyable, type EnsureType } from "../../_shared/types";
|
|
6
6
|
import { type RecordItem } from "../../_shared/types";
|
|
7
|
+
import type { TimeSpan } from "../../_module";
|
|
8
|
+
import { LazyPromise } from "../../_module";
|
|
7
9
|
/**
|
|
8
10
|
* All methods that return <i>{@link IAsyncCollection}</i> are executed lazly which means they will be executed when the <i>AsyncIterableCollection</i> is iterated with <i>forEach</i> method or "for await of" loop.
|
|
9
11
|
* The rest of the methods are executed eagerly.
|
|
@@ -25,22 +27,22 @@ export declare class AsyncIterableCollection<TInput> implements IAsyncCollection
|
|
|
25
27
|
filter<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TOutput>;
|
|
26
28
|
reject<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<Exclude<TInput, TOutput>>;
|
|
27
29
|
map<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TOutput>;
|
|
28
|
-
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>):
|
|
29
|
-
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>, initialValue: TInput):
|
|
30
|
-
reduce<TOutput>(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TOutput>, initialValue: TOutput):
|
|
31
|
-
join(separator?: string):
|
|
30
|
+
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>): LazyPromise<TInput>;
|
|
31
|
+
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>, initialValue: TInput): LazyPromise<TInput>;
|
|
32
|
+
reduce<TOutput>(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TOutput>, initialValue: TOutput): LazyPromise<TOutput>;
|
|
33
|
+
join(separator?: string): LazyPromise<EnsureType<TInput, string>>;
|
|
32
34
|
collapse(): IAsyncCollection<AsyncCollapse<TInput>>;
|
|
33
35
|
flatMap<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, Iterable<TOutput>>): IAsyncCollection<TOutput>;
|
|
34
36
|
change<TFilterOutput extends TInput, TMapOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TFilterOutput>, mapFn: AsyncMap<TFilterOutput, IAsyncCollection<TInput>, TMapOutput>): IAsyncCollection<ChangendItem<TInput, TFilterOutput, TMapOutput>>;
|
|
35
37
|
page(page: number, pageSize: number): IAsyncCollection<TInput>;
|
|
36
|
-
sum():
|
|
37
|
-
average():
|
|
38
|
-
median():
|
|
39
|
-
min():
|
|
40
|
-
max():
|
|
41
|
-
percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
42
|
-
some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
43
|
-
every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
38
|
+
sum(): LazyPromise<EnsureType<TInput, number>>;
|
|
39
|
+
average(): LazyPromise<EnsureType<TInput, number>>;
|
|
40
|
+
median(): LazyPromise<EnsureType<TInput, number>>;
|
|
41
|
+
min(): LazyPromise<EnsureType<TInput, number>>;
|
|
42
|
+
max(): LazyPromise<EnsureType<TInput, number>>;
|
|
43
|
+
percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
|
|
44
|
+
some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<boolean>;
|
|
45
|
+
every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<boolean>;
|
|
44
46
|
take(limit: number): IAsyncCollection<TInput>;
|
|
45
47
|
takeUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
|
|
46
48
|
takeWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
|
|
@@ -51,7 +53,7 @@ export declare class AsyncIterableCollection<TInput> implements IAsyncCollection
|
|
|
51
53
|
whenEmpty<TExtended = TInput>(callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
|
|
52
54
|
whenNot<TExtended = TInput>(condition: boolean, callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
|
|
53
55
|
whenNotEmpty<TExtended = TInput>(callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
|
|
54
|
-
pipe<TOutput = TInput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>):
|
|
56
|
+
pipe<TOutput = TInput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
|
|
55
57
|
tap(callback: AsyncTap<IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
|
|
56
58
|
chunk(chunkSize: number): IAsyncCollection<IAsyncCollection<TInput>>;
|
|
57
59
|
chunkWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<IAsyncCollection<TInput>>;
|
|
@@ -75,29 +77,29 @@ export declare class AsyncIterableCollection<TInput> implements IAsyncCollection
|
|
|
75
77
|
sort(comparator?: Comparator<TInput>): IAsyncCollection<TInput>;
|
|
76
78
|
reverse(chunkSize?: number): IAsyncCollection<TInput>;
|
|
77
79
|
shuffle(mathRandom?: () => number): IAsyncCollection<TInput>;
|
|
78
|
-
first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
79
|
-
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
80
|
-
firstOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
81
|
-
last<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
82
|
-
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
83
|
-
lastOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
84
|
-
before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
85
|
-
beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
86
|
-
beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
87
|
-
after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
88
|
-
afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
89
|
-
afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
90
|
-
sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
80
|
+
first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | null>;
|
|
81
|
+
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | TExtended>;
|
|
82
|
+
firstOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
|
|
83
|
+
last<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | null>;
|
|
84
|
+
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | TExtended>;
|
|
85
|
+
lastOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
|
|
86
|
+
before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | null>;
|
|
87
|
+
beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | TExtended>;
|
|
88
|
+
beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput>;
|
|
89
|
+
after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | null>;
|
|
90
|
+
afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | TExtended>;
|
|
91
|
+
afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput>;
|
|
92
|
+
sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
|
|
91
93
|
nth(step: number): IAsyncCollection<TInput>;
|
|
92
|
-
delay(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
96
|
-
size():
|
|
97
|
-
isEmpty():
|
|
98
|
-
isNotEmpty():
|
|
99
|
-
searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
100
|
-
searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
101
|
-
forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>):
|
|
102
|
-
toArray():
|
|
94
|
+
delay(time: TimeSpan): IAsyncCollection<TInput>;
|
|
95
|
+
takeUntilAbort(abortSignal: AbortSignal): IAsyncCollection<TInput>;
|
|
96
|
+
takeUntilTimeout(timeInMs: TimeSpan): IAsyncCollection<TInput>;
|
|
97
|
+
count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
|
|
98
|
+
size(): LazyPromise<number>;
|
|
99
|
+
isEmpty(): LazyPromise<boolean>;
|
|
100
|
+
isNotEmpty(): LazyPromise<boolean>;
|
|
101
|
+
searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
|
|
102
|
+
searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
|
|
103
|
+
forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>): LazyPromise<void>;
|
|
104
|
+
toArray(): LazyPromise<TInput[]>;
|
|
103
105
|
}
|
|
@@ -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
|
};
|
|
@@ -9,7 +9,8 @@ export type StorageValue<T> = Exclude<T, AnyFunction | undefined | null>;
|
|
|
9
9
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
10
10
|
* @group Contracts
|
|
11
11
|
*/
|
|
12
|
-
export type IStorage<TType = unknown> =
|
|
12
|
+
export type IStorage<TType = unknown> = {
|
|
13
|
+
namespace<TNamespaceType extends TType>(name: string): IStorage<TNamespaceType>;
|
|
13
14
|
/**
|
|
14
15
|
* Returns true when key is found otherwise false will be returned.
|
|
15
16
|
* @throws {StorageError} {@link StorageError}
|
|
@@ -7,10 +7,12 @@ import { type AsyncLazyable, type GetOrAddValue } from "../_shared/types";
|
|
|
7
7
|
export type StorageSettings = {
|
|
8
8
|
namespace?: string;
|
|
9
9
|
};
|
|
10
|
-
export declare class Storage<TType> implements IStorage<TType> {
|
|
10
|
+
export declare class Storage<TType = unknown> implements IStorage<TType> {
|
|
11
11
|
private readonly storageAdapter;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
private readonly namespaceStorageAdapter;
|
|
13
|
+
private readonly settings;
|
|
14
|
+
constructor(storageAdapter: IStorageAdapter<TType>, settings?: StorageSettings);
|
|
15
|
+
namespace<TNamespaceType extends TType>(name: string): IStorage<TNamespaceType>;
|
|
14
16
|
exists(key: string): Promise<boolean>;
|
|
15
17
|
existsMany<TKeys extends string>(keys: TKeys[]): Promise<Record<TKeys, boolean>>;
|
|
16
18
|
missing(key: string): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../utilities/time-span/_module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../utilities/time-span/time-span";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The <i>TimeSpan</i> class is used for representing time interval that is the difference between two times measured in a number of days, hours, minutes, and seconds.
|
|
6
|
+
* <i>TimeSpan</i> cannot be negative.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TimeSpan {
|
|
9
|
+
private readonly milliseconds;
|
|
10
|
+
private static secondInMilliseconds;
|
|
11
|
+
private static minuteInMilliseconds;
|
|
12
|
+
private static hourInMilliseconds;
|
|
13
|
+
private static dayInMilliseconds;
|
|
14
|
+
private constructor();
|
|
15
|
+
static fromMilliseconds(milliseconds: number): TimeSpan;
|
|
16
|
+
static fromSeconds(seconds: number): TimeSpan;
|
|
17
|
+
static fromMinutes(minutes: number): TimeSpan;
|
|
18
|
+
static fromHours(hours: number): TimeSpan;
|
|
19
|
+
static fromDays(days: number): TimeSpan;
|
|
20
|
+
static fromTimeSpan(timeSpan: TimeSpan): TimeSpan;
|
|
21
|
+
static fromDateRange(from: Date, to: Date): TimeSpan;
|
|
22
|
+
addMilliseconds(milliseconds: number): TimeSpan;
|
|
23
|
+
addSeconds(seconds: number): TimeSpan;
|
|
24
|
+
addMinutes(minutes: number): TimeSpan;
|
|
25
|
+
addHours(hours: number): TimeSpan;
|
|
26
|
+
addDays(days: number): TimeSpan;
|
|
27
|
+
addTimeSpan(timeSpan: TimeSpan): TimeSpan;
|
|
28
|
+
subtractMilliseconds(milliseconds: number): TimeSpan;
|
|
29
|
+
subtractSeconds(seconds: number): TimeSpan;
|
|
30
|
+
subtractMinutes(minutes: number): TimeSpan;
|
|
31
|
+
subtractHours(hours: number): TimeSpan;
|
|
32
|
+
subtractDays(days: number): TimeSpan;
|
|
33
|
+
subtractTimeSpan(timeSpan: TimeSpan): TimeSpan;
|
|
34
|
+
multiply(value: number): TimeSpan;
|
|
35
|
+
divide(value: number): TimeSpan;
|
|
36
|
+
toMilliseconds(): number;
|
|
37
|
+
toSeconds(): number;
|
|
38
|
+
toMinutes(): number;
|
|
39
|
+
toHours(): number;
|
|
40
|
+
toDays(): number;
|
|
41
|
+
toUTCTimestamp(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Will return endDate relative to a given <i>startDate</i> argument.
|
|
44
|
+
*/
|
|
45
|
+
toEndDate(startDate: Date): Date;
|
|
46
|
+
/**
|
|
47
|
+
* Will return startDate relative to a given <i>endDate</i> argument.
|
|
48
|
+
*/
|
|
49
|
+
toStartDate(endDate: Date): Date;
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AsyncAbortIterable = void 0;
|
|
4
|
-
class AsyncAbortIterable {
|
|
5
|
-
collection;
|
|
6
|
-
signal;
|
|
7
|
-
constructor(collection, signal) {
|
|
8
|
-
this.collection = collection;
|
|
9
|
-
this.signal = signal;
|
|
10
|
-
}
|
|
11
|
-
async *[Symbol.asyncIterator]() {
|
|
12
|
-
let hasAborted = false;
|
|
13
|
-
this.signal.addEventListener("abort", () => {
|
|
14
|
-
hasAborted = true;
|
|
15
|
-
});
|
|
16
|
-
for await (const item of this.collection) {
|
|
17
|
-
if (hasAborted) {
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
yield item;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.AsyncAbortIterable = AsyncAbortIterable;
|
|
25
|
-
//# sourceMappingURL=async-abort-iterable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-abort-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/async-iterable-collection/_shared/async-abort-iterable.ts"],"names":[],"mappings":";;;AAKA,MAAa,kBAAkB;IAEf;IACA;IAFZ,YACY,UAAoC,EACpC,MAAmB;QADnB,eAAU,GAAV,UAAU,CAA0B;QACpC,WAAM,GAAN,MAAM,CAAa;IAC5B,CAAC;IAEJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,IAAI,UAAU,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACvC,UAAU,GAAG,IAAI,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAEvC,IAAI,UAAU,EAAE,CAAC;gBACb,MAAM;YACV,CAAC;YACD,MAAM,IAAI,CAAC;QACf,CAAC;IACL,CAAC;CACJ;AAnBD,gDAmBC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AsyncDelayIterable = void 0;
|
|
4
|
-
class AsyncDelayIterable {
|
|
5
|
-
collection;
|
|
6
|
-
timeInMs;
|
|
7
|
-
constructor(collection, timeInMs) {
|
|
8
|
-
this.collection = collection;
|
|
9
|
-
this.timeInMs = timeInMs;
|
|
10
|
-
}
|
|
11
|
-
async *[Symbol.asyncIterator]() {
|
|
12
|
-
let isFirstIteration = true;
|
|
13
|
-
for await (const item of this.collection) {
|
|
14
|
-
if (!isFirstIteration) {
|
|
15
|
-
await new Promise((resolve) => setTimeout(resolve, this.timeInMs));
|
|
16
|
-
}
|
|
17
|
-
if (isFirstIteration) {
|
|
18
|
-
isFirstIteration = false;
|
|
19
|
-
}
|
|
20
|
-
yield item;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.AsyncDelayIterable = AsyncDelayIterable;
|
|
25
|
-
//# sourceMappingURL=async-delay-iterable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-delay-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/async-iterable-collection/_shared/async-delay-iterable.ts"],"names":[],"mappings":";;;AAKA,MAAa,kBAAkB;IAEf;IACA;IAFZ,YACY,UAAoC,EACpC,QAAgB;QADhB,eAAU,GAAV,UAAU,CAA0B;QACpC,aAAQ,GAAR,QAAQ,CAAQ;IACzB,CAAC;IAEJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,IAAI,gBAAgB,GAAG,IAAI,CAAC;QAC5B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACvC,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC1B,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CACrC,CAAC;YACN,CAAC;YACD,IAAI,gBAAgB,EAAE,CAAC;gBACnB,gBAAgB,GAAG,KAAK,CAAC;YAC7B,CAAC;YACD,MAAM,IAAI,CAAC;QACf,CAAC;IACL,CAAC;CACJ;AApBD,gDAoBC"}
|