@daiso-tech/core 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/async/utilities/abort/abort.d.ts +1 -1
  2. package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +4 -5
  3. package/dist/async/utilities/lazy-promise/lazy-promise.js +3 -3
  4. package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
  5. package/dist/async/utilities/retry/retry.d.ts +1 -1
  6. package/dist/async/utilities/timeout/timeout.d.ts +1 -1
  7. package/dist/cache/contracts/cache-factory.contract.js +1 -1
  8. package/dist/cache/contracts/cache-factory.contract.js.map +1 -1
  9. package/dist/cache/contracts/cache.contract.d.ts +3 -3
  10. package/dist/cache/implementations/derivables/cache/cache.d.ts +14 -14
  11. package/dist/cache/implementations/derivables/cache/cache.js +3 -3
  12. package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
  13. package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js.map +1 -1
  14. package/dist/collection/contracts/_module-exports.d.ts +1 -1
  15. package/dist/collection/contracts/_module-exports.js +1 -1
  16. package/dist/collection/contracts/_module-exports.js.map +1 -1
  17. package/dist/collection/contracts/_shared/_module.d.ts +11 -0
  18. package/dist/collection/contracts/_shared/_module.js +12 -0
  19. package/dist/collection/contracts/_shared/_module.js.map +1 -0
  20. package/dist/collection/contracts/_shared/compartor.type.d.ts +9 -0
  21. package/dist/collection/contracts/_shared/compartor.type.js +5 -0
  22. package/dist/collection/contracts/_shared/compartor.type.js.map +1 -0
  23. package/dist/collection/contracts/_shared/cross-join-result.type.d.ts +11 -0
  24. package/dist/collection/contracts/_shared/cross-join-result.type.js +5 -0
  25. package/dist/collection/contracts/_shared/cross-join-result.type.js.map +1 -0
  26. package/dist/collection/contracts/_shared/ensure-map.type.d.ts +8 -0
  27. package/dist/collection/contracts/_shared/ensure-map.type.js +5 -0
  28. package/dist/collection/contracts/_shared/ensure-map.type.js.map +1 -0
  29. package/dist/collection/contracts/_shared/ensure-record.type.d.ts +8 -0
  30. package/dist/collection/contracts/_shared/ensure-record.type.js +5 -0
  31. package/dist/collection/contracts/_shared/ensure-record.type.js.map +1 -0
  32. package/dist/collection/contracts/_shared/foreach.type.d.ts +22 -0
  33. package/dist/collection/contracts/_shared/foreach.type.js +5 -0
  34. package/dist/collection/contracts/_shared/foreach.type.js.map +1 -0
  35. package/dist/collection/contracts/_shared/map.type.d.ts +22 -0
  36. package/dist/collection/contracts/{_shared.js → _shared/map.type.js} +1 -1
  37. package/dist/collection/contracts/_shared/map.type.js.map +1 -0
  38. package/dist/collection/contracts/_shared/modifier.type.d.ts +18 -0
  39. package/dist/collection/contracts/_shared/modifier.type.js +5 -0
  40. package/dist/collection/contracts/_shared/modifier.type.js.map +1 -0
  41. package/dist/collection/contracts/_shared/predicate.type.d.ts +49 -0
  42. package/dist/collection/contracts/_shared/predicate.type.js +5 -0
  43. package/dist/collection/contracts/_shared/predicate.type.js.map +1 -0
  44. package/dist/collection/contracts/_shared/reduce.type.d.ts +24 -0
  45. package/dist/collection/contracts/_shared/reduce.type.js +5 -0
  46. package/dist/collection/contracts/_shared/reduce.type.js.map +1 -0
  47. package/dist/collection/contracts/_shared/tap.type.d.ts +16 -0
  48. package/dist/collection/contracts/_shared/tap.type.js +5 -0
  49. package/dist/collection/contracts/_shared/tap.type.js.map +1 -0
  50. package/dist/collection/contracts/_shared/transform.type.d.ts +16 -0
  51. package/dist/collection/contracts/_shared/transform.type.js +5 -0
  52. package/dist/collection/contracts/_shared/transform.type.js.map +1 -0
  53. package/dist/collection/contracts/async-collection.contract.d.ts +3 -3
  54. package/dist/collection/contracts/collection.contract.d.ts +31 -31
  55. package/dist/collection/contracts/collection.errors.d.ts +1 -1
  56. package/dist/collection/contracts/collection.errors.js +1 -1
  57. package/dist/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.js +2 -2
  58. package/dist/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -1
  59. package/dist/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.js +2 -1
  60. package/dist/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
  61. package/dist/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.js +2 -1
  62. package/dist/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
  63. package/dist/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.js +2 -1
  64. package/dist/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
  65. package/dist/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.js +2 -2
  66. package/dist/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.js.map +1 -1
  67. package/dist/collection/implementations/async-iterable-collection/_shared/async-insert-after-iterable.js +2 -2
  68. package/dist/collection/implementations/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
  69. package/dist/collection/implementations/async-iterable-collection/_shared/async-insert-before-iterable.js +2 -2
  70. package/dist/collection/implementations/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
  71. package/dist/collection/implementations/async-iterable-collection/_shared/async-map-iterable.js +2 -1
  72. package/dist/collection/implementations/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
  73. package/dist/collection/implementations/async-iterable-collection/_shared/async-partion-iterable.js +2 -2
  74. package/dist/collection/implementations/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
  75. package/dist/collection/implementations/async-iterable-collection/_shared/async-skip-until-iterable.js +2 -1
  76. package/dist/collection/implementations/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
  77. package/dist/collection/implementations/async-iterable-collection/_shared/async-sort-iterable.js +6 -1
  78. package/dist/collection/implementations/async-iterable-collection/_shared/async-sort-iterable.js.map +1 -1
  79. package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-iterable.js +2 -1
  80. package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
  81. package/dist/collection/implementations/async-iterable-collection/_shared/async-tap-iterable.js +2 -1
  82. package/dist/collection/implementations/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
  83. package/dist/collection/implementations/async-iterable-collection/_shared/async-unique-iterable.js +2 -1
  84. package/dist/collection/implementations/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
  85. package/dist/collection/implementations/async-iterable-collection/_shared/async-update-iterable.js +3 -2
  86. package/dist/collection/implementations/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
  87. package/dist/collection/implementations/async-iterable-collection/_shared/async-when-iterable.js +2 -1
  88. package/dist/collection/implementations/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
  89. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +3 -3
  90. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +25 -24
  91. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  92. package/dist/collection/implementations/iterable-collection/_shared/chunk-while-iterable.d.ts +2 -2
  93. package/dist/collection/implementations/iterable-collection/_shared/chunk-while-iterable.js +2 -1
  94. package/dist/collection/implementations/iterable-collection/_shared/chunk-while-iterable.js.map +1 -1
  95. package/dist/collection/implementations/iterable-collection/_shared/count-by-iterable.js +2 -1
  96. package/dist/collection/implementations/iterable-collection/_shared/count-by-iterable.js.map +1 -1
  97. package/dist/collection/implementations/iterable-collection/_shared/filter-iterable.d.ts +2 -2
  98. package/dist/collection/implementations/iterable-collection/_shared/filter-iterable.js +2 -1
  99. package/dist/collection/implementations/iterable-collection/_shared/filter-iterable.js.map +1 -1
  100. package/dist/collection/implementations/iterable-collection/_shared/flat-map-iterable.js +2 -1
  101. package/dist/collection/implementations/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
  102. package/dist/collection/implementations/iterable-collection/_shared/group-by-iterable.js +2 -1
  103. package/dist/collection/implementations/iterable-collection/_shared/group-by-iterable.js.map +1 -1
  104. package/dist/collection/implementations/iterable-collection/_shared/insert-after-iterable.d.ts +2 -2
  105. package/dist/collection/implementations/iterable-collection/_shared/insert-after-iterable.js +3 -1
  106. package/dist/collection/implementations/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
  107. package/dist/collection/implementations/iterable-collection/_shared/insert-before-iterable.d.ts +2 -2
  108. package/dist/collection/implementations/iterable-collection/_shared/insert-before-iterable.js +3 -1
  109. package/dist/collection/implementations/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
  110. package/dist/collection/implementations/iterable-collection/_shared/map-iterable.js +2 -1
  111. package/dist/collection/implementations/iterable-collection/_shared/map-iterable.js.map +1 -1
  112. package/dist/collection/implementations/iterable-collection/_shared/partion-iterable.d.ts +2 -2
  113. package/dist/collection/implementations/iterable-collection/_shared/partion-iterable.js +2 -1
  114. package/dist/collection/implementations/iterable-collection/_shared/partion-iterable.js.map +1 -1
  115. package/dist/collection/implementations/iterable-collection/_shared/skip-until-iterable.d.ts +2 -2
  116. package/dist/collection/implementations/iterable-collection/_shared/skip-until-iterable.js +2 -1
  117. package/dist/collection/implementations/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
  118. package/dist/collection/implementations/iterable-collection/_shared/sort-iterable.js +6 -1
  119. package/dist/collection/implementations/iterable-collection/_shared/sort-iterable.js.map +1 -1
  120. package/dist/collection/implementations/iterable-collection/_shared/take-until-iterable.d.ts +2 -2
  121. package/dist/collection/implementations/iterable-collection/_shared/take-until-iterable.js +2 -1
  122. package/dist/collection/implementations/iterable-collection/_shared/take-until-iterable.js.map +1 -1
  123. package/dist/collection/implementations/iterable-collection/_shared/tap-iterable.js +2 -1
  124. package/dist/collection/implementations/iterable-collection/_shared/tap-iterable.js.map +1 -1
  125. package/dist/collection/implementations/iterable-collection/_shared/unique-iterable.js +2 -1
  126. package/dist/collection/implementations/iterable-collection/_shared/unique-iterable.js.map +1 -1
  127. package/dist/collection/implementations/iterable-collection/_shared/update-iterable.d.ts +2 -2
  128. package/dist/collection/implementations/iterable-collection/_shared/update-iterable.js +3 -2
  129. package/dist/collection/implementations/iterable-collection/_shared/update-iterable.js.map +1 -1
  130. package/dist/collection/implementations/iterable-collection/_shared/when-iterable.js +2 -1
  131. package/dist/collection/implementations/iterable-collection/_shared/when-iterable.js.map +1 -1
  132. package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +31 -31
  133. package/dist/collection/implementations/iterable-collection/iterable-collection.js +23 -22
  134. package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
  135. package/dist/collection/implementations/list-collection/list-collection.d.ts +31 -31
  136. package/dist/collection/implementations/list-collection/list-collection.js +44 -38
  137. package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
  138. package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +10 -4
  139. package/dist/event-bus/contracts/event-bus.contract.d.ts +22 -9
  140. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +3 -4
  141. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +0 -1
  142. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
  143. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +3 -4
  144. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
  145. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +3 -4
  146. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +0 -1
  147. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
  148. package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +11 -11
  149. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +2 -2
  150. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  151. package/dist/event-bus/implementations/derivables/event-bus/listener-store.d.ts +4 -4
  152. package/dist/event-bus/implementations/derivables/event-bus/listener-store.js +1 -1
  153. package/dist/event-bus/implementations/derivables/event-bus/listener-store.js.map +1 -1
  154. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
  155. package/dist/lock/contracts/lock-provider-factory.contract.js +1 -1
  156. package/dist/lock/contracts/lock-provider-factory.contract.js.map +1 -1
  157. package/dist/lock/contracts/lock.contract.d.ts +5 -5
  158. package/dist/lock/contracts/lock.events.d.ts +1 -1
  159. package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +12 -12
  160. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +3 -3
  161. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
  162. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +1 -1
  163. package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +14 -14
  164. package/dist/lock/implementations/derivables/lock-provider/lock.js +5 -17
  165. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  166. package/dist/utilities/_module-exports.d.ts +2 -2
  167. package/dist/utilities/_module-exports.js +2 -2
  168. package/dist/utilities/_module-exports.js.map +1 -1
  169. package/dist/utilities/classes/_module.d.ts +0 -1
  170. package/dist/utilities/classes/_module.js +0 -1
  171. package/dist/utilities/classes/_module.js.map +1 -1
  172. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.d.ts +1 -1
  173. package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +1 -1
  174. package/dist/utilities/classes/key-prefixer/key-prefixer.js +1 -1
  175. package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
  176. package/dist/utilities/functions/_module-exports.d.ts +7 -0
  177. package/dist/utilities/functions/_module-exports.js +8 -0
  178. package/dist/utilities/functions/_module-exports.js.map +1 -0
  179. package/dist/utilities/functions/factory.d.ts +44 -0
  180. package/dist/utilities/functions/factory.js +80 -0
  181. package/dist/utilities/functions/factory.js.map +1 -0
  182. package/dist/utilities/functions/get-constructor-name.d.ts +7 -0
  183. package/dist/utilities/functions/get-constructor-name.js +10 -0
  184. package/dist/utilities/functions/get-constructor-name.js.map +1 -0
  185. package/dist/utilities/functions/invokable.d.ts +20 -0
  186. package/dist/utilities/functions/invokable.js +33 -0
  187. package/dist/utilities/functions/invokable.js.map +1 -0
  188. package/dist/utilities/functions/is-nullable.d.ts +7 -0
  189. package/dist/utilities/functions/is-nullable.js +10 -0
  190. package/dist/utilities/functions/is-nullable.js.map +1 -0
  191. package/dist/utilities/functions/lazy.d.ts +20 -0
  192. package/dist/utilities/functions/lazy.js +39 -0
  193. package/dist/utilities/functions/lazy.js.map +1 -0
  194. package/dist/utilities/functions/object.d.ts +15 -0
  195. package/dist/utilities/functions/object.js +33 -0
  196. package/dist/utilities/functions/object.js.map +1 -0
  197. package/dist/utilities/functions/resolve-one-or-more.d.ts +12 -0
  198. package/dist/utilities/functions/resolve-one-or-more.js +25 -0
  199. package/dist/utilities/functions/resolve-one-or-more.js.map +1 -0
  200. package/dist/utilities/types/_module.d.ts +10 -0
  201. package/dist/utilities/types/_module.js +11 -0
  202. package/dist/utilities/types/_module.js.map +1 -0
  203. package/dist/utilities/types/async-iterable-value.type.d.ts +8 -0
  204. package/dist/utilities/types/async-iterable-value.type.js +5 -0
  205. package/dist/utilities/types/async-iterable-value.type.js.map +1 -0
  206. package/dist/utilities/types/at-least-one.type.d.ts +8 -0
  207. package/dist/utilities/types/at-least-one.type.js +5 -0
  208. package/dist/utilities/types/at-least-one.type.js.map +1 -0
  209. package/dist/utilities/types/factory.type.d.ts +49 -0
  210. package/dist/utilities/types/factory.type.js +5 -0
  211. package/dist/utilities/types/factory.type.js.map +1 -0
  212. package/dist/utilities/types/invokable.type.d.ts +20 -0
  213. package/dist/utilities/types/invokable.type.js +5 -0
  214. package/dist/utilities/types/invokable.type.js.map +1 -0
  215. package/dist/utilities/types/items.type.d.ts +8 -0
  216. package/dist/utilities/types/items.type.js +5 -0
  217. package/dist/utilities/types/items.type.js.map +1 -0
  218. package/dist/utilities/types/lazy.type.d.ts +31 -0
  219. package/dist/utilities/{types.js → types/lazy.type.js} +1 -1
  220. package/dist/utilities/types/lazy.type.js.map +1 -0
  221. package/dist/utilities/types/none-func.type.d.ts +8 -0
  222. package/dist/utilities/types/none-func.type.js +5 -0
  223. package/dist/utilities/types/none-func.type.js.map +1 -0
  224. package/dist/utilities/types/one-or-more.type.d.ts +8 -0
  225. package/dist/utilities/types/one-or-more.type.js +5 -0
  226. package/dist/utilities/types/one-or-more.type.js.map +1 -0
  227. package/dist/utilities/types/promiseable.type.d.ts +8 -0
  228. package/dist/utilities/types/promiseable.type.js +5 -0
  229. package/dist/utilities/types/promiseable.type.js.map +1 -0
  230. package/dist/utilities/types/result.type.d.ts +8 -0
  231. package/dist/utilities/types/result.type.js +5 -0
  232. package/dist/utilities/types/result.type.js.map +1 -0
  233. package/package.json +1 -1
  234. package/dist/collection/contracts/_shared.d.ts +0 -141
  235. package/dist/collection/contracts/_shared.js.map +0 -1
  236. package/dist/utilities/classes/pipeline/_module.d.ts +0 -1
  237. package/dist/utilities/classes/pipeline/_module.js +0 -2
  238. package/dist/utilities/classes/pipeline/_module.js.map +0 -1
  239. package/dist/utilities/classes/pipeline/pipeline.d.ts +0 -46
  240. package/dist/utilities/classes/pipeline/pipeline.js +0 -76
  241. package/dist/utilities/classes/pipeline/pipeline.js.map +0 -1
  242. package/dist/utilities/functions.d.ts +0 -57
  243. package/dist/utilities/functions.js +0 -123
  244. package/dist/utilities/functions.js.map +0 -1
  245. package/dist/utilities/types.d.ts +0 -104
  246. package/dist/utilities/types.js.map +0 -1
@@ -1,2 +0,0 @@
1
- export * from "../../../utilities/classes/pipeline/pipeline.js";
2
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/utilities/classes/pipeline/_module.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC"}
@@ -1,46 +0,0 @@
1
- /**
2
- * @module Utilities
3
- */
4
- import { LazyPromise } from "../../../async/_module-exports.js";
5
- import type { AsyncLazyable, IInvokableObject, Invokable } from "../../../utilities/types.js";
6
- /**
7
- * The <i>Pipeline</i> class provides a convenient way to pipe multiple functions and <i>{@link IInvokableObject}</i>,
8
- * giving each functions and <i>{@link IInvokableObject}</i> the opportunity to inspect or modify the input.
9
- * Pipeline class is immutable meaning you can extend it without causing problems.
10
- *
11
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
12
- * @group Pipeline
13
- */
14
- export declare class Pipeline<TInitial, TPrev = TInitial, TCurrent = TPrev> implements IInvokableObject<AsyncLazyable<TInitial>, TCurrent> {
15
- /**
16
- * @example
17
- * ```ts
18
- * import { Pipeline, type IInvokableObject } from "@daiso-tech/core/utilities";
19
- *
20
- * const isEmpty = Pipeline
21
- * // You must define the initial argument type
22
- * .start<string>()
23
- * // You can extract the function if you want.
24
- * // You can also pass in an object that implements IInvokableObject contract
25
- * .pipe(value => value.length)
26
- * .pipe(value => value === 0);
27
- *
28
- * // You can extend the previous pipeline
29
- * const isNotEmpty = isEmpty.pipe(isEmpty => !isEmpty);
30
- *
31
- * const result1 = await isEmpty.invoke("");
32
- * // true
33
- * console.log(result1);
34
- *
35
- * const result2 = await isNotEmpty.invoke("asdasd");
36
- * // true
37
- * console.log(result2);
38
- * ```
39
- */
40
- static start<TValue>(): Pipeline<TValue>;
41
- private static execute;
42
- private readonly pipes;
43
- private constructor();
44
- pipe<TInput extends TCurrent, TOutput>(pipe: Invokable<TInput, TOutput>): Pipeline<TInitial, TCurrent, TOutput>;
45
- invoke(value: AsyncLazyable<TInitial>): LazyPromise<TCurrent>;
46
- }
@@ -1,76 +0,0 @@
1
- /**
2
- * @module Utilities
3
- */
4
- import { LazyPromise } from "../../../async/_module-exports.js";
5
- import { resolveAsyncLazyable } from "../../../utilities/functions.js";
6
- /**
7
- * The <i>Pipeline</i> class provides a convenient way to pipe multiple functions and <i>{@link IInvokableObject}</i>,
8
- * giving each functions and <i>{@link IInvokableObject}</i> the opportunity to inspect or modify the input.
9
- * Pipeline class is immutable meaning you can extend it without causing problems.
10
- *
11
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
12
- * @group Pipeline
13
- */
14
- export class Pipeline {
15
- /**
16
- * @example
17
- * ```ts
18
- * import { Pipeline, type IInvokableObject } from "@daiso-tech/core/utilities";
19
- *
20
- * const isEmpty = Pipeline
21
- * // You must define the initial argument type
22
- * .start<string>()
23
- * // You can extract the function if you want.
24
- * // You can also pass in an object that implements IInvokableObject contract
25
- * .pipe(value => value.length)
26
- * .pipe(value => value === 0);
27
- *
28
- * // You can extend the previous pipeline
29
- * const isNotEmpty = isEmpty.pipe(isEmpty => !isEmpty);
30
- *
31
- * const result1 = await isEmpty.invoke("");
32
- * // true
33
- * console.log(result1);
34
- *
35
- * const result2 = await isNotEmpty.invoke("asdasd");
36
- * // true
37
- * console.log(result2);
38
- * ```
39
- */
40
- static start() {
41
- return new Pipeline();
42
- }
43
- static async execute(value, pipe) {
44
- if (typeof pipe === "function") {
45
- return await pipe(value);
46
- }
47
- return pipe.invoke(value);
48
- }
49
- pipes = [];
50
- constructor(pipe) {
51
- if (pipe !== undefined) {
52
- this.pipes = [...this.pipes, pipe];
53
- }
54
- }
55
- pipe(pipe) {
56
- return new Pipeline(pipe);
57
- }
58
- invoke(value) {
59
- return new LazyPromise(async () => {
60
- const [pipe, ...pipes] = this.pipes;
61
- const resolvedValue = await resolveAsyncLazyable(value);
62
- if (pipe === undefined) {
63
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
64
- return resolvedValue;
65
- }
66
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
67
- let value_ = await Pipeline.execute(resolvedValue, pipe);
68
- for (const pipe of pipes) {
69
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
70
- value_ = await Pipeline.execute(value, pipe);
71
- }
72
- return value_;
73
- });
74
- }
75
- }
76
- //# sour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,CAAC;YACD,mEAAmE;YACnE,IAAI,MAAM,GAAa,MAAM,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YACnE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACvB,mEAAmE;gBACnE,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACjD,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -1,57 +0,0 @@
1
- /**
2
- * @module Utilities
3
- */
4
- import type { Factory, Factoryable, FactoryFn, IFactoryObject, Invokable, InvokableFn, Lazyable, OneOrMore } from "../utilities/types.js";
5
- import { type AsyncLazyable } from "../utilities/types.js";
6
- /**
7
- * @internal
8
- */
9
- export declare function resolveLazyable<TValue>(lazyable: Lazyable<TValue>): TValue;
10
- /**
11
- * @internal
12
- */
13
- export declare function resolveAsyncLazyable<TValue>(lazyable: AsyncLazyable<TValue>): Promise<TValue>;
14
- /**
15
- * @internal
16
- */
17
- export declare function isObjectEmpty(object: Record<string | number | symbol, any>): boolean;
18
- /**
19
- * @internal
20
- */
21
- export declare function resolveOneOrMore<TType>(value: OneOrMore<TType>): TType[];
22
- /**
23
- * @internal
24
- */
25
- export declare function resolveOneOrMoreStr(name: OneOrMore<string>, joinStr?: string): string;
26
- /**
27
- * @internal
28
- */
29
- export declare function getConstructorName(instance: object): string;
30
- /**
31
- * @internal
32
- */
33
- export declare function isFactoryFn<TInput, TOutput>(factory: Factoryable<TInput, TOutput>): factory is FactoryFn<TInput, TOutput>;
34
- /**
35
- * @internal
36
- */
37
- export declare function isFactoryObject<TInput, TOutput>(factory: Factoryable<TInput, TOutput>): factory is IFactoryObject<TInput, TOutput>;
38
- /**
39
- * @internal
40
- */
41
- export declare function isFactory<TInput, TOutput>(factoryable: Factoryable<TInput, TOutput>): factoryable is Factory<TInput, TOutput>;
42
- /**
43
- * @internal
44
- */
45
- export declare function resolveFactory<TInput, TOutput>(factory: Factory<TInput, TOutput>): FactoryFn<TInput, TOutput>;
46
- /**
47
- * @internal
48
- */
49
- export declare function resolveFactoryable<TInput, TOutput>(factoryable: Factoryable<TInput, TOutput>, input: TInput): Promise<TOutput>;
50
- /**
51
- * @internal
52
- */
53
- export declare function resolveInvokable<TInput, TOutput>(invokable: Invokable<TInput, TOutput>): InvokableFn<TInput, TOutput>;
54
- /**
55
- * @internal
56
- */
57
- export declare function removeUndefinedProperties<TObject extends Partial<Record<string, unknown>>>(object: TObject): TObject;
@@ -1,123 +0,0 @@
1
- /**
2
- * @module Utilities
3
- */
4
- import { LazyPromise } from "../async/_module-exports.js";
5
- import { isIterable } from "../collection/implementations/_shared.js";
6
- import {} from "../utilities/types.js";
7
- /**
8
- * @internal
9
- */
10
- export function resolveLazyable(lazyable) {
11
- if (typeof lazyable === "function") {
12
- const getValue = lazyable;
13
- return getValue();
14
- }
15
- return lazyable;
16
- }
17
- /**
18
- * @internal
19
- */
20
- export async function resolveAsyncLazyable(lazyable) {
21
- if (typeof lazyable === "function") {
22
- const getValue = lazyable;
23
- return getValue();
24
- }
25
- if (lazyable instanceof LazyPromise) {
26
- return await lazyable;
27
- }
28
- return lazyable;
29
- }
30
- /**
31
- * @internal
32
- */
33
- export function isObjectEmpty(
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
- object) {
36
- return (
37
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
38
- [...Object.values(object)].filter((value) => value !== undefined)
39
- .length === 0);
40
- }
41
- /**
42
- * @internal
43
- */
44
- export function resolveOneOrMore(value) {
45
- if (isIterable(value)) {
46
- return [...value];
47
- }
48
- return [value];
49
- }
50
- /**
51
- * @internal
52
- */
53
- export function resolveOneOrMoreStr(name, joinStr = "/") {
54
- if (typeof name === "string") {
55
- return name;
56
- }
57
- return resolveOneOrMore(name)
58
- .filter((str) => str.length > 0)
59
- .join(joinStr);
60
- }
61
- /**
62
- * @internal
63
- */
64
- export function getConstructorName(instance) {
65
- return instance.constructor.name;
66
- }
67
- /**
68
- * @internal
69
- */
70
- export function isFactoryFn(factory) {
71
- return typeof factory === "function";
72
- }
73
- /**
74
- * @internal
75
- */
76
- export function isFactoryObject(factory) {
77
- return (typeof factory === "object" &&
78
- factory !== null &&
79
- typeof factory["use"] === "function");
80
- }
81
- /**
82
- * @internal
83
- */
84
- export function isFactory(factoryable) {
85
- return isFactoryFn(factoryable) || isFactoryObject(factoryable);
86
- }
87
- /**
88
- * @internal
89
- */
90
- export function resolveFactory(factory) {
91
- if (isFactoryObject(factory)) {
92
- return factory.use.bind(factory);
93
- }
94
- return factory;
95
- }
96
- /**
97
- * @internal
98
- */
99
- export async function resolveFactoryable(factoryable, input) {
100
- if (isFactory(factoryable)) {
101
- const factory = resolveFactory(factoryable);
102
- return await factory(input);
103
- }
104
- else {
105
- return factoryable;
106
- }
107
- }
108
- /**
109
- * @internal
110
- */
111
- export function resolveInvokable(invokable) {
112
- if (typeof invokable === "function") {
113
- return invokable;
114
- }
115
- return invokable.invoke.bind(invokable);
116
- }
117
- /**
118
- * @internal
119
- */
120
- export function removeUndefinedProperties(object) {
121
- return Object.fromEntries(Object.entries(object).filter(([_key, value]) => value !== undefined));
122
- }
123
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/utilities/functions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAWrE,OAAO,EAAsB,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,eAAe,CAAS,QAA0B;IAC9D,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,QAAwB,CAAC;QAC1C,OAAO,QAAQ,EAAE,CAAC;IACtB,CAAC;IACD,OA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e;IACb,OAAO,MAAM,CAAC,WAAW,CACrB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAC7D,CAAC;AACjB,CAAC"}
@@ -1,104 +0,0 @@
1
- /**
2
- * @module Utilities
3
- */
4
- import type { LazyPromise } from "../async/_module-exports.js";
5
- export type Items<TArray extends any[]> = TArray[number];
6
- /**
7
- *
8
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
9
- */
10
- export type AtLeastOne<TItem> = [TItem, ...TItem[]];
11
- /**
12
- *
13
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
14
- */
15
- export type OneOrMore<TItem> = TItem | Iterable<TItem>;
16
- /**
17
- *
18
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
19
- */
20
- export type Lazyable<TValue> = TValue | (() => TValue);
21
- /**
22
- *
23
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
24
- */
25
- export type Promisable<TValue> = TValue | PromiseLike<TValue>;
26
- /**
27
- *
28
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
29
- */
30
- export type LazyPromiseable<TValue> = LazyPromise<TValue> | (() => Promisable<TValue>);
31
- /**
32
- *
33
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
34
- */
35
- export type AsyncLazyable<TValue> = TValue | LazyPromiseable<TValue>;
36
- /**
37
- *
38
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
39
- */
40
- export type Result<TValue, TError> = [TValue, null] | [null, TError];
41
- /**
42
- *
43
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
44
- */
45
- export type AsyncIterableValue<TInput> = Iterable<TInput> | AsyncIterable<TInput>;
46
- /**
47
- *
48
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
49
- */
50
- export type Func<TArgs extends unknown[], TReturn> = (...args_: TArgs) => TReturn;
51
- /**
52
- *
53
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
54
- */
55
- export type AnyFunction = Func<any[], any>;
56
- /**
57
- *
58
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
59
- */
60
- export type NoneFunction<TType> = Exclude<TType, AnyFunction>;
61
- /**
62
- *
63
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
64
- */
65
- export type GetOrAddValue<TValue> = Awaited<TValue extends AnyFunction ? ReturnType<TValue> : TValue>;
66
- /**
67
- *
68
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
69
- */
70
- export type InvokableFn<TInput = unknown, TOutput = unknown> = (value: TInput) => Promisable<TOutput>;
71
- /**
72
- *
73
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
74
- */
75
- export type IInvokableObject<TInput = unknown, TOutput = unknown> = {
76
- invoke(value: TInput): Promisable<TOutput>;
77
- };
78
- /**
79
- *
80
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
81
- */
82
- export type Invokable<TInput = unknown, TOutput = unknown> = InvokableFn<TInput, TOutput> | IInvokableObject<TInput, TOutput>;
83
- /**
84
- *
85
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
86
- */
87
- export type FactoryFn<TInput, TOutput> = (value: TInput) => Promisable<NoneFunction<TOutput>>;
88
- /**
89
- *
90
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
91
- */
92
- export type IFactoryObject<TInput, TOutput> = {
93
- use(value: TInput): Promisable<NoneFunction<TOutput>>;
94
- };
95
- /**
96
- *
97
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
98
- */
99
- export type Factory<TInput, TOutput> = FactoryFn<TInput, TOutput> | IFactoryObject<TInput, TOutput>;
100
- /**
101
- *
102
- * IMPORT_PATH: ```"@daiso-tech/core/utilities"```
103
- */
104
- export type Factoryable<TInput, TOutput> = NoneFunction<TOutput> | Factory<TInput, TOutput>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utilities/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}