@daiso-tech/core 0.2.1 → 0.4.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 (425) hide show
  1. package/dist/cjs/_module.js +5 -1
  2. package/dist/cjs/_module.js.map +1 -1
  3. package/dist/cjs/_shared/kysely/_module.js +18 -0
  4. package/dist/cjs/_shared/kysely/_module.js.map +1 -0
  5. package/dist/cjs/_shared/kysely/kysely-table-name-transformer-plugin.js +45 -0
  6. package/dist/cjs/_shared/kysely/kysely-table-name-transformer-plugin.js.map +1 -0
  7. package/dist/cjs/_shared/redis/_module.js +20 -0
  8. package/dist/cjs/_shared/redis/_module.js.map +1 -0
  9. package/dist/cjs/_shared/redis/clear-iterable.js +25 -0
  10. package/dist/cjs/_shared/redis/clear-iterable.js.map +1 -0
  11. package/dist/cjs/_shared/redis/escape-redis-chars.js +41 -0
  12. package/dist/cjs/_shared/redis/escape-redis-chars.js.map +1 -0
  13. package/dist/cjs/_shared/redis/is-redis-type-error.js +9 -0
  14. package/dist/cjs/_shared/redis/is-redis-type-error.js.map +1 -0
  15. package/dist/cjs/_shared/utilities.js.map +1 -1
  16. package/dist/cjs/async/_module.js +29 -0
  17. package/dist/cjs/async/_module.js.map +1 -0
  18. package/dist/cjs/async/_shared.js +34 -0
  19. package/dist/cjs/async/_shared.js.map +1 -0
  20. package/dist/cjs/async/abortable/_module.js +18 -0
  21. package/dist/cjs/async/abortable/_module.js.map +1 -0
  22. package/dist/cjs/async/abortable/abortable.js +48 -0
  23. package/dist/cjs/async/abortable/abortable.js.map +1 -0
  24. package/dist/cjs/async/abortable-iterable/_module.js +18 -0
  25. package/dist/cjs/async/abortable-iterable/_module.js.map +1 -0
  26. package/dist/cjs/async/abortable-iterable/abortable-iterable.js +32 -0
  27. package/dist/cjs/async/abortable-iterable/abortable-iterable.js.map +1 -0
  28. package/dist/cjs/async/backof-policies/_module.js +21 -0
  29. package/dist/cjs/async/backof-policies/_module.js.map +1 -0
  30. package/dist/cjs/async/backof-policies/_shared.js +7 -0
  31. package/dist/cjs/async/backof-policies/_shared.js.map +1 -0
  32. package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js +18 -0
  33. package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
  34. package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +19 -0
  35. package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
  36. package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js +18 -0
  37. package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
  38. package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +23 -0
  39. package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
  40. package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js +18 -0
  41. package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
  42. package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +23 -0
  43. package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
  44. package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js +18 -0
  45. package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
  46. package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +23 -0
  47. package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
  48. package/dist/cjs/async/delay/_module.js +18 -0
  49. package/dist/cjs/async/delay/_module.js.map +1 -0
  50. package/dist/cjs/async/delay/delay.js +24 -0
  51. package/dist/cjs/async/delay/delay.js.map +1 -0
  52. package/dist/cjs/async/delay-iterable/_module.js +18 -0
  53. package/dist/cjs/async/delay-iterable/_module.js.map +1 -0
  54. package/dist/cjs/async/delay-iterable/delay-iterable.js +36 -0
  55. package/dist/cjs/async/delay-iterable/delay-iterable.js.map +1 -0
  56. package/dist/cjs/async/lazy-promise/_module.js +18 -0
  57. package/dist/cjs/async/lazy-promise/_module.js.map +1 -0
  58. package/dist/cjs/async/lazy-promise/lazy-promise.js +22 -0
  59. package/dist/cjs/async/lazy-promise/lazy-promise.js.map +1 -0
  60. package/dist/cjs/async/retry/_module.js +18 -0
  61. package/dist/cjs/async/retry/_module.js.map +1 -0
  62. package/dist/cjs/async/retry/retry.js +43 -0
  63. package/dist/cjs/async/retry/retry.js.map +1 -0
  64. package/dist/cjs/async/retry-iterable/_module.js +18 -0
  65. package/dist/cjs/async/retry-iterable/_module.js.map +1 -0
  66. package/dist/cjs/async/retry-iterable/retry-iterable.js +32 -0
  67. package/dist/cjs/async/retry-iterable/retry-iterable.js.map +1 -0
  68. package/dist/cjs/async/timeout/_module.js +18 -0
  69. package/dist/cjs/async/timeout/_module.js.map +1 -0
  70. package/dist/cjs/async/timeout/timeout.js +28 -0
  71. package/dist/cjs/async/timeout/timeout.js.map +1 -0
  72. package/dist/cjs/async/timeout-iterable/_module.js +18 -0
  73. package/dist/cjs/async/timeout-iterable/_module.js.map +1 -0
  74. package/dist/cjs/async/timeout-iterable/timeout-iterable.js +11 -0
  75. package/dist/cjs/async/timeout-iterable/timeout-iterable.js.map +1 -0
  76. package/dist/cjs/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
  77. package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
  78. package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
  79. package/dist/cjs/contracts/_module.js +2 -0
  80. package/dist/cjs/contracts/_module.js.map +1 -1
  81. package/dist/cjs/contracts/collection/_module.js.map +1 -1
  82. package/dist/cjs/contracts/serializer/_module.js +18 -0
  83. package/dist/cjs/contracts/serializer/_module.js.map +1 -0
  84. package/dist/cjs/contracts/serializer/serializer.contract.js +25 -0
  85. package/dist/cjs/contracts/serializer/serializer.contract.js.map +1 -0
  86. package/dist/cjs/contracts/storage/_module.js +20 -0
  87. package/dist/cjs/contracts/storage/_module.js.map +1 -0
  88. package/dist/cjs/contracts/storage/_shared.js +32 -0
  89. package/dist/cjs/contracts/storage/_shared.js.map +1 -0
  90. package/dist/cjs/contracts/storage/storage-adapter.contract.js +3 -0
  91. package/dist/cjs/contracts/storage/storage-adapter.contract.js.map +1 -0
  92. package/dist/cjs/contracts/storage/storage.contract.js +3 -0
  93. package/dist/cjs/contracts/storage/storage.contract.js.map +1 -0
  94. package/dist/cjs/serializer/_module.js +22 -0
  95. package/dist/cjs/serializer/_module.js.map +1 -0
  96. package/dist/cjs/serializer/_shared/test-utilities/_module.js +18 -0
  97. package/dist/cjs/serializer/_shared/test-utilities/_module.js.map +1 -0
  98. package/dist/cjs/serializer/_shared/test-utilities/serializer.test-suite.js +361 -0
  99. package/dist/cjs/serializer/_shared/test-utilities/serializer.test-suite.js.map +1 -0
  100. package/dist/cjs/serializer/mongodb-serializer/_module.js +18 -0
  101. package/dist/cjs/serializer/mongodb-serializer/_module.js.map +1 -0
  102. package/dist/cjs/serializer/mongodb-serializer/mongodb-serializer.js +36 -0
  103. package/dist/cjs/serializer/mongodb-serializer/mongodb-serializer.js.map +1 -0
  104. package/dist/cjs/serializer/redis-serializer/_module.js +18 -0
  105. package/dist/cjs/serializer/redis-serializer/_module.js.map +1 -0
  106. package/dist/cjs/serializer/redis-serializer/redis-serializer.js +37 -0
  107. package/dist/cjs/serializer/redis-serializer/redis-serializer.js.map +1 -0
  108. package/dist/cjs/serializer/sql-serializer/_module.js +18 -0
  109. package/dist/cjs/serializer/sql-serializer/_module.js.map +1 -0
  110. package/dist/cjs/serializer/sql-serializer/sql-serializer.js +37 -0
  111. package/dist/cjs/serializer/sql-serializer/sql-serializer.js.map +1 -0
  112. package/dist/cjs/serializer/super-json-serializer/_module.js +18 -0
  113. package/dist/cjs/serializer/super-json-serializer/_module.js.map +1 -0
  114. package/dist/cjs/serializer/super-json-serializer/super-json-serializer.js +304 -0
  115. package/dist/cjs/serializer/super-json-serializer/super-json-serializer.js.map +1 -0
  116. package/dist/cjs/storage/_module.js +23 -0
  117. package/dist/cjs/storage/_module.js.map +1 -0
  118. package/dist/cjs/storage/_shared/test-utilities/_module.js +18 -0
  119. package/dist/cjs/storage/_shared/test-utilities/_module.js.map +1 -0
  120. package/dist/cjs/storage/_shared/test-utilities/storage-api.test-suite.js +572 -0
  121. package/dist/cjs/storage/_shared/test-utilities/storage-api.test-suite.js.map +1 -0
  122. package/dist/cjs/storage/_shared/test-utilities/storage-namespace.test-suite.js +241 -0
  123. package/dist/cjs/storage/_shared/test-utilities/storage-namespace.test-suite.js.map +1 -0
  124. package/dist/cjs/storage/_shared/test-utilities/storage-value.test-suite.js +4172 -0
  125. package/dist/cjs/storage/_shared/test-utilities/storage-value.test-suite.js.map +1 -0
  126. package/dist/cjs/storage/_shared/test-utilities/storage.test-suite.js +12 -0
  127. package/dist/cjs/storage/_shared/test-utilities/storage.test-suite.js.map +1 -0
  128. package/dist/cjs/storage/memory-storage-adapter/_module.js +18 -0
  129. package/dist/cjs/storage/memory-storage-adapter/_module.js.map +1 -0
  130. package/dist/cjs/storage/memory-storage-adapter/memory-storage-adapter.js +62 -0
  131. package/dist/cjs/storage/memory-storage-adapter/memory-storage-adapter.js.map +1 -0
  132. package/dist/cjs/storage/mongodb-storage-adapter/_module.js +6 -0
  133. package/dist/cjs/storage/mongodb-storage-adapter/_module.js.map +1 -0
  134. package/dist/cjs/storage/mongodb-storage-adapter/mongodb-storage-adapter.js +273 -0
  135. package/dist/cjs/storage/mongodb-storage-adapter/mongodb-storage-adapter.js.map +1 -0
  136. package/dist/cjs/storage/namespace-storage-adapter.js +66 -0
  137. package/dist/cjs/storage/namespace-storage-adapter.js.map +1 -0
  138. package/dist/cjs/storage/redis-storage-adapter/_module.js +18 -0
  139. package/dist/cjs/storage/redis-storage-adapter/_module.js.map +1 -0
  140. package/dist/cjs/storage/redis-storage-adapter/redis-storage-adapter.js +248 -0
  141. package/dist/cjs/storage/redis-storage-adapter/redis-storage-adapter.js.map +1 -0
  142. package/dist/cjs/storage/sqlite/_module.js +19 -0
  143. package/dist/cjs/storage/sqlite/_module.js.map +1 -0
  144. package/dist/cjs/storage/sqlite/_shared/_module.js +18 -0
  145. package/dist/cjs/storage/sqlite/_shared/_module.js.map +1 -0
  146. package/dist/cjs/storage/sqlite/_shared/base-sqlite-storage-adapter.js +224 -0
  147. package/dist/cjs/storage/sqlite/_shared/base-sqlite-storage-adapter.js.map +1 -0
  148. package/dist/cjs/storage/sqlite/libsql-storage-adapter/_module.js +18 -0
  149. package/dist/cjs/storage/sqlite/libsql-storage-adapter/_module.js.map +1 -0
  150. package/dist/cjs/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +53 -0
  151. package/dist/cjs/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +1 -0
  152. package/dist/cjs/storage/sqlite/sqlite-storage-adapter/_module.js +18 -0
  153. package/dist/cjs/storage/sqlite/sqlite-storage-adapter/_module.js.map +1 -0
  154. package/dist/cjs/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +52 -0
  155. package/dist/cjs/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +1 -0
  156. package/dist/cjs/storage/storage.js +301 -0
  157. package/dist/cjs/storage/storage.js.map +1 -0
  158. package/dist/cjs/storage/usable-storage-adapter.js +102 -0
  159. package/dist/cjs/storage/usable-storage-adapter.js.map +1 -0
  160. package/dist/cjs/utilities/_module.js +18 -0
  161. package/dist/cjs/utilities/_module.js.map +1 -0
  162. package/dist/cjs/utilities/time-span/_module.js +18 -0
  163. package/dist/cjs/utilities/time-span/_module.js.map +1 -0
  164. package/dist/cjs/utilities/time-span/time-span.js +103 -0
  165. package/dist/cjs/utilities/time-span/time-span.js.map +1 -0
  166. package/dist/esm/_module.js +5 -1
  167. package/dist/esm/_module.js.map +1 -1
  168. package/dist/esm/_shared/kysely/_module.js +2 -0
  169. package/dist/esm/_shared/kysely/_module.js.map +1 -0
  170. package/dist/esm/_shared/kysely/kysely-table-name-transformer-plugin.js +41 -0
  171. package/dist/esm/_shared/kysely/kysely-table-name-transformer-plugin.js.map +1 -0
  172. package/dist/esm/_shared/redis/_module.js +4 -0
  173. package/dist/esm/_shared/redis/_module.js.map +1 -0
  174. package/dist/esm/_shared/redis/clear-iterable.js +21 -0
  175. package/dist/esm/_shared/redis/clear-iterable.js.map +1 -0
  176. package/dist/esm/_shared/redis/escape-redis-chars.js +38 -0
  177. package/dist/esm/_shared/redis/escape-redis-chars.js.map +1 -0
  178. package/dist/esm/_shared/redis/is-redis-type-error.js +6 -0
  179. package/dist/esm/_shared/redis/is-redis-type-error.js.map +1 -0
  180. package/dist/esm/_shared/utilities.js.map +1 -1
  181. package/dist/esm/async/_module.js +11 -0
  182. package/dist/esm/async/_module.js.map +1 -0
  183. package/dist/esm/async/_shared.js +27 -0
  184. package/dist/esm/async/_shared.js.map +1 -0
  185. package/dist/esm/async/abortable/_module.js +2 -0
  186. package/dist/esm/async/abortable/_module.js.map +1 -0
  187. package/dist/esm/async/abortable/abortable.js +45 -0
  188. package/dist/esm/async/abortable/abortable.js.map +1 -0
  189. package/dist/esm/async/abortable-iterable/_module.js +2 -0
  190. package/dist/esm/async/abortable-iterable/_module.js.map +1 -0
  191. package/dist/esm/async/abortable-iterable/abortable-iterable.js +29 -0
  192. package/dist/esm/async/abortable-iterable/abortable-iterable.js.map +1 -0
  193. package/dist/esm/async/backof-policies/_module.js +5 -0
  194. package/dist/esm/async/backof-policies/_module.js.map +1 -0
  195. package/dist/esm/async/backof-policies/_shared.js +4 -0
  196. package/dist/esm/async/backof-policies/_shared.js.map +1 -0
  197. package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js +2 -0
  198. package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
  199. package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +16 -0
  200. package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
  201. package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js +2 -0
  202. package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
  203. package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +20 -0
  204. package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
  205. package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js +2 -0
  206. package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
  207. package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +20 -0
  208. package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
  209. package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js +2 -0
  210. package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
  211. package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +20 -0
  212. package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
  213. package/dist/esm/async/delay/_module.js +2 -0
  214. package/dist/esm/async/delay/_module.js.map +1 -0
  215. package/dist/esm/async/delay/delay.js +21 -0
  216. package/dist/esm/async/delay/delay.js.map +1 -0
  217. package/dist/esm/async/delay-iterable/_module.js +2 -0
  218. package/dist/esm/async/delay-iterable/_module.js.map +1 -0
  219. package/dist/esm/async/delay-iterable/delay-iterable.js +33 -0
  220. package/dist/esm/async/delay-iterable/delay-iterable.js.map +1 -0
  221. package/dist/esm/async/lazy-promise/_module.js +2 -0
  222. package/dist/esm/async/lazy-promise/_module.js.map +1 -0
  223. package/dist/esm/async/lazy-promise/lazy-promise.js +17 -0
  224. package/dist/esm/async/lazy-promise/lazy-promise.js.map +1 -0
  225. package/dist/esm/async/retry/_module.js +2 -0
  226. package/dist/esm/async/retry/_module.js.map +1 -0
  227. package/dist/esm/async/retry/retry.js +40 -0
  228. package/dist/esm/async/retry/retry.js.map +1 -0
  229. package/dist/esm/async/retry-iterable/_module.js +2 -0
  230. package/dist/esm/async/retry-iterable/_module.js.map +1 -0
  231. package/dist/esm/async/retry-iterable/retry-iterable.js +29 -0
  232. package/dist/esm/async/retry-iterable/retry-iterable.js.map +1 -0
  233. package/dist/esm/async/timeout/_module.js +2 -0
  234. package/dist/esm/async/timeout/_module.js.map +1 -0
  235. package/dist/esm/async/timeout/timeout.js +25 -0
  236. package/dist/esm/async/timeout/timeout.js.map +1 -0
  237. package/dist/esm/async/timeout-iterable/_module.js +2 -0
  238. package/dist/esm/async/timeout-iterable/_module.js.map +1 -0
  239. package/dist/esm/async/timeout-iterable/timeout-iterable.js +8 -0
  240. package/dist/esm/async/timeout-iterable/timeout-iterable.js.map +1 -0
  241. package/dist/esm/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
  242. package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
  243. package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
  244. package/dist/esm/contracts/_module.js +2 -0
  245. package/dist/esm/contracts/_module.js.map +1 -1
  246. package/dist/esm/contracts/collection/_module.js.map +1 -1
  247. package/dist/esm/contracts/serializer/_module.js +2 -0
  248. package/dist/esm/contracts/serializer/_module.js.map +1 -0
  249. package/dist/esm/contracts/serializer/serializer.contract.js +19 -0
  250. package/dist/esm/contracts/serializer/serializer.contract.js.map +1 -0
  251. package/dist/esm/contracts/storage/_module.js +4 -0
  252. package/dist/esm/contracts/storage/_module.js.map +1 -0
  253. package/dist/esm/contracts/storage/_shared.js +25 -0
  254. package/dist/esm/contracts/storage/_shared.js.map +1 -0
  255. package/dist/esm/contracts/storage/storage-adapter.contract.js +1 -0
  256. package/dist/esm/contracts/storage/storage-adapter.contract.js.map +1 -0
  257. package/dist/esm/contracts/storage/storage.contract.js +1 -0
  258. package/dist/esm/contracts/storage/storage.contract.js.map +1 -0
  259. package/dist/esm/serializer/_module.js +6 -0
  260. package/dist/esm/serializer/_module.js.map +1 -0
  261. package/dist/esm/serializer/_shared/test-utilities/_module.js +2 -0
  262. package/dist/esm/serializer/_shared/test-utilities/_module.js.map +1 -0
  263. package/dist/esm/serializer/_shared/test-utilities/serializer.test-suite.js +358 -0
  264. package/dist/esm/serializer/_shared/test-utilities/serializer.test-suite.js.map +1 -0
  265. package/dist/esm/serializer/mongodb-serializer/_module.js +2 -0
  266. package/dist/esm/serializer/mongodb-serializer/_module.js.map +1 -0
  267. package/dist/esm/serializer/mongodb-serializer/mongodb-serializer.js +32 -0
  268. package/dist/esm/serializer/mongodb-serializer/mongodb-serializer.js.map +1 -0
  269. package/dist/esm/serializer/redis-serializer/_module.js +2 -0
  270. package/dist/esm/serializer/redis-serializer/_module.js.map +1 -0
  271. package/dist/esm/serializer/redis-serializer/redis-serializer.js +33 -0
  272. package/dist/esm/serializer/redis-serializer/redis-serializer.js.map +1 -0
  273. package/dist/esm/serializer/sql-serializer/_module.js +2 -0
  274. package/dist/esm/serializer/sql-serializer/_module.js.map +1 -0
  275. package/dist/esm/serializer/sql-serializer/sql-serializer.js +33 -0
  276. package/dist/esm/serializer/sql-serializer/sql-serializer.js.map +1 -0
  277. package/dist/esm/serializer/super-json-serializer/_module.js +2 -0
  278. package/dist/esm/serializer/super-json-serializer/_module.js.map +1 -0
  279. package/dist/esm/serializer/super-json-serializer/super-json-serializer.js +277 -0
  280. package/dist/esm/serializer/super-json-serializer/super-json-serializer.js.map +1 -0
  281. package/dist/esm/storage/_module.js +7 -0
  282. package/dist/esm/storage/_module.js.map +1 -0
  283. package/dist/esm/storage/_shared/test-utilities/_module.js +2 -0
  284. package/dist/esm/storage/_shared/test-utilities/_module.js.map +1 -0
  285. package/dist/esm/storage/_shared/test-utilities/storage-api.test-suite.js +569 -0
  286. package/dist/esm/storage/_shared/test-utilities/storage-api.test-suite.js.map +1 -0
  287. package/dist/esm/storage/_shared/test-utilities/storage-namespace.test-suite.js +238 -0
  288. package/dist/esm/storage/_shared/test-utilities/storage-namespace.test-suite.js.map +1 -0
  289. package/dist/esm/storage/_shared/test-utilities/storage-value.test-suite.js +4169 -0
  290. package/dist/esm/storage/_shared/test-utilities/storage-value.test-suite.js.map +1 -0
  291. package/dist/esm/storage/_shared/test-utilities/storage.test-suite.js +9 -0
  292. package/dist/esm/storage/_shared/test-utilities/storage.test-suite.js.map +1 -0
  293. package/dist/esm/storage/memory-storage-adapter/_module.js +2 -0
  294. package/dist/esm/storage/memory-storage-adapter/_module.js.map +1 -0
  295. package/dist/esm/storage/memory-storage-adapter/memory-storage-adapter.js +58 -0
  296. package/dist/esm/storage/memory-storage-adapter/memory-storage-adapter.js.map +1 -0
  297. package/dist/esm/storage/mongodb-storage-adapter/_module.js +2 -0
  298. package/dist/esm/storage/mongodb-storage-adapter/_module.js.map +1 -0
  299. package/dist/esm/storage/mongodb-storage-adapter/mongodb-storage-adapter.js +266 -0
  300. package/dist/esm/storage/mongodb-storage-adapter/mongodb-storage-adapter.js.map +1 -0
  301. package/dist/esm/storage/namespace-storage-adapter.js +62 -0
  302. package/dist/esm/storage/namespace-storage-adapter.js.map +1 -0
  303. package/dist/esm/storage/redis-storage-adapter/_module.js +2 -0
  304. package/dist/esm/storage/redis-storage-adapter/_module.js.map +1 -0
  305. package/dist/esm/storage/redis-storage-adapter/redis-storage-adapter.js +244 -0
  306. package/dist/esm/storage/redis-storage-adapter/redis-storage-adapter.js.map +1 -0
  307. package/dist/esm/storage/sqlite/_module.js +3 -0
  308. package/dist/esm/storage/sqlite/_module.js.map +1 -0
  309. package/dist/esm/storage/sqlite/_shared/_module.js +2 -0
  310. package/dist/esm/storage/sqlite/_shared/_module.js.map +1 -0
  311. package/dist/esm/storage/sqlite/_shared/base-sqlite-storage-adapter.js +220 -0
  312. package/dist/esm/storage/sqlite/_shared/base-sqlite-storage-adapter.js.map +1 -0
  313. package/dist/esm/storage/sqlite/libsql-storage-adapter/_module.js +2 -0
  314. package/dist/esm/storage/sqlite/libsql-storage-adapter/_module.js.map +1 -0
  315. package/dist/esm/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +49 -0
  316. package/dist/esm/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +1 -0
  317. package/dist/esm/storage/sqlite/sqlite-storage-adapter/_module.js +2 -0
  318. package/dist/esm/storage/sqlite/sqlite-storage-adapter/_module.js.map +1 -0
  319. package/dist/esm/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +48 -0
  320. package/dist/esm/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +1 -0
  321. package/dist/esm/storage/storage.js +297 -0
  322. package/dist/esm/storage/storage.js.map +1 -0
  323. package/dist/esm/storage/usable-storage-adapter.js +98 -0
  324. package/dist/esm/storage/usable-storage-adapter.js.map +1 -0
  325. package/dist/esm/utilities/_module.js +2 -0
  326. package/dist/esm/utilities/_module.js.map +1 -0
  327. package/dist/esm/utilities/time-span/_module.js +2 -0
  328. package/dist/esm/utilities/time-span/_module.js.map +1 -0
  329. package/dist/esm/utilities/time-span/time-span.js +99 -0
  330. package/dist/esm/utilities/time-span/time-span.js.map +1 -0
  331. package/dist/types/_module.d.ts +5 -1
  332. package/dist/types/_shared/kysely/_module.d.ts +1 -0
  333. package/dist/types/_shared/kysely/kysely-table-name-transformer-plugin.d.ts +13 -0
  334. package/dist/types/_shared/redis/_module.d.ts +3 -0
  335. package/dist/types/_shared/redis/clear-iterable.d.ts +13 -0
  336. package/dist/types/_shared/redis/escape-redis-chars.d.ts +7 -0
  337. package/dist/types/_shared/redis/is-redis-type-error.d.ts +7 -0
  338. package/dist/types/_shared/types.d.ts +15 -2
  339. package/dist/types/_shared/utilities.d.ts +5 -1
  340. package/dist/types/async/_module.d.ts +10 -0
  341. package/dist/types/async/_shared.d.ts +35 -0
  342. package/dist/types/async/abortable/_module.d.ts +1 -0
  343. package/dist/types/async/abortable/abortable.d.ts +39 -0
  344. package/dist/types/async/abortable-iterable/_module.d.ts +1 -0
  345. package/dist/types/async/abortable-iterable/abortable-iterable.d.ts +36 -0
  346. package/dist/types/async/backof-policies/_module.d.ts +5 -0
  347. package/dist/types/async/backof-policies/_shared.d.ts +12 -0
  348. package/dist/types/async/backof-policies/constant-backoff-policy/_module.d.ts +1 -0
  349. package/dist/types/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +28 -0
  350. package/dist/types/async/backof-policies/exponential-backoff-policy/_module.d.ts +1 -0
  351. package/dist/types/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +36 -0
  352. package/dist/types/async/backof-policies/linear-backoff-policy/_module.d.ts +1 -0
  353. package/dist/types/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +32 -0
  354. package/dist/types/async/backof-policies/polynomial-backoff-policy/_module.d.ts +1 -0
  355. package/dist/types/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +36 -0
  356. package/dist/types/async/delay/_module.d.ts +1 -0
  357. package/dist/types/async/delay/delay.d.ts +38 -0
  358. package/dist/types/async/delay-iterable/_module.d.ts +1 -0
  359. package/dist/types/async/delay-iterable/delay-iterable.d.ts +57 -0
  360. package/dist/types/async/lazy-promise/_module.d.ts +1 -0
  361. package/dist/types/async/lazy-promise/lazy-promise.d.ts +28 -0
  362. package/dist/types/async/retry/_module.d.ts +1 -0
  363. package/dist/types/async/retry/retry.d.ts +86 -0
  364. package/dist/types/async/retry-iterable/_module.d.ts +1 -0
  365. package/dist/types/async/retry-iterable/retry-iterable.d.ts +86 -0
  366. package/dist/types/async/timeout/_module.d.ts +1 -0
  367. package/dist/types/async/timeout/timeout.d.ts +40 -0
  368. package/dist/types/async/timeout-iterable/_module.d.ts +1 -0
  369. package/dist/types/async/timeout-iterable/timeout-iterable.d.ts +64 -0
  370. package/dist/types/collection/_shared.d.ts +1 -1
  371. package/dist/types/collection/async-iterable-collection/_shared/async-cross-join-iterable.d.ts +2 -1
  372. package/dist/types/collection/async-iterable-collection/_shared/async-group-by-iterable.d.ts +1 -1
  373. package/dist/types/collection/async-iterable-collection/async-iterable-collection.d.ts +2 -2
  374. package/dist/types/collection/iterable-collection/_shared/cross-join-iterable.d.ts +1 -1
  375. package/dist/types/collection/iterable-collection/_shared/group-by-iterable.d.ts +1 -1
  376. package/dist/types/collection/iterable-collection/iterable-collection.d.ts +1 -1
  377. package/dist/types/collection/list-collection/list-collection.d.ts +1 -1
  378. package/dist/types/contracts/_module.d.ts +2 -0
  379. package/dist/types/contracts/collection/_module.d.ts +0 -3
  380. package/dist/types/contracts/collection/_shared.d.ts +1 -1
  381. package/dist/types/contracts/collection/async-collection.contract.d.ts +3 -3
  382. package/dist/types/contracts/collection/collection.contract.d.ts +3 -3
  383. package/dist/types/contracts/serializer/_module.d.ts +1 -0
  384. package/dist/types/contracts/serializer/serializer.contract.d.ts +37 -0
  385. package/dist/types/contracts/storage/_module.d.ts +3 -0
  386. package/dist/types/contracts/storage/_shared.d.ts +27 -0
  387. package/dist/types/contracts/storage/storage-adapter.contract.d.ts +72 -0
  388. package/dist/types/contracts/storage/storage.contract.d.ts +148 -0
  389. package/dist/types/serializer/_module.d.ts +5 -0
  390. package/dist/types/serializer/_shared/test-utilities/_module.d.ts +1 -0
  391. package/dist/types/serializer/_shared/test-utilities/serializer.test-suite.d.ts +18 -0
  392. package/dist/types/serializer/mongodb-serializer/_module.d.ts +1 -0
  393. package/dist/types/serializer/mongodb-serializer/mongodb-serializer.d.ts +13 -0
  394. package/dist/types/serializer/redis-serializer/_module.d.ts +1 -0
  395. package/dist/types/serializer/redis-serializer/redis-serializer.d.ts +13 -0
  396. package/dist/types/serializer/sql-serializer/_module.d.ts +1 -0
  397. package/dist/types/serializer/sql-serializer/sql-serializer.d.ts +13 -0
  398. package/dist/types/serializer/super-json-serializer/_module.d.ts +1 -0
  399. package/dist/types/serializer/super-json-serializer/super-json-serializer.d.ts +37 -0
  400. package/dist/types/storage/_module.d.ts +6 -0
  401. package/dist/types/storage/_shared/test-utilities/_module.d.ts +1 -0
  402. package/dist/types/storage/_shared/test-utilities/storage-api.test-suite.d.ts +20 -0
  403. package/dist/types/storage/_shared/test-utilities/storage-namespace.test-suite.d.ts +20 -0
  404. package/dist/types/storage/_shared/test-utilities/storage-value.test-suite.d.ts +20 -0
  405. package/dist/types/storage/_shared/test-utilities/storage.test-suite.d.ts +20 -0
  406. package/dist/types/storage/memory-storage-adapter/_module.d.ts +1 -0
  407. package/dist/types/storage/memory-storage-adapter/memory-storage-adapter.d.ts +16 -0
  408. package/dist/types/storage/mongodb-storage-adapter/_module.d.ts +1 -0
  409. package/dist/types/storage/mongodb-storage-adapter/mongodb-storage-adapter.d.ts +46 -0
  410. package/dist/types/storage/namespace-storage-adapter.d.ts +30 -0
  411. package/dist/types/storage/redis-storage-adapter/_module.d.ts +1 -0
  412. package/dist/types/storage/redis-storage-adapter/redis-storage-adapter.d.ts +41 -0
  413. package/dist/types/storage/sqlite/_module.d.ts +2 -0
  414. package/dist/types/storage/sqlite/_shared/_module.d.ts +1 -0
  415. package/dist/types/storage/sqlite/_shared/base-sqlite-storage-adapter.d.ts +42 -0
  416. package/dist/types/storage/sqlite/libsql-storage-adapter/_module.d.ts +1 -0
  417. package/dist/types/storage/sqlite/libsql-storage-adapter/libsql-storage-adapter.d.ts +30 -0
  418. package/dist/types/storage/sqlite/sqlite-storage-adapter/_module.d.ts +1 -0
  419. package/dist/types/storage/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.d.ts +30 -0
  420. package/dist/types/storage/storage.d.ts +38 -0
  421. package/dist/types/storage/usable-storage-adapter.d.ts +22 -0
  422. package/dist/types/utilities/_module.d.ts +1 -0
  423. package/dist/types/utilities/time-span/_module.d.ts +1 -0
  424. package/dist/types/utilities/time-span/time-span.d.ts +50 -0
  425. package/package.json +41 -6
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @module Async
3
+ */
4
+ import type { TimeSpan } from "../../utilities/_module";
5
+ import { LazyPromise } from "../../async/lazy-promise/_module";
6
+ /**
7
+ * The <i>delay</i> function creates a promise that will be fulfilled after given <i>time</i> and can be aborted by providing <i>abortSignal</i>.
8
+ * @group Promise utilities
9
+ * @throws {AsyncError} {@link AsyncError}
10
+ * @throws {AbortAsyncError} {@link AbortAsyncError}
11
+ * @example
12
+ * ```ts
13
+ * import { delay, TimeSpan } from "@daiso-tech/core";
14
+ * (async () => {
15
+ * console.log("a");
16
+ * await delay(TimeSpan.fromSeconds(2));
17
+ * console.log("b");
18
+ * })();
19
+ * ```
20
+ * @example with abortSignal
21
+ * ```ts
22
+ * import { delay, TimeSpan } from "@daiso-tech/core";
23
+ *
24
+ * const abortController = new AbortController();
25
+ * setTimeout(() => {
26
+ * abortController.abort("My abort error");
27
+ * }, TimeSpan.fromSeconds(1).toMilliseconds());
28
+ * const promise = delay(TimeSpan.fromSeconds(2), abortController.signal);
29
+ *
30
+ * (async () => {
31
+ * console.log("a");
32
+ * // Will throw AbortAsyncError
33
+ * await promise;
34
+ * console.log("b");
35
+ * })();
36
+ * ```
37
+ */
38
+ export declare function delay(time: TimeSpan, abortSignal?: AbortSignal): LazyPromise<void>;
@@ -0,0 +1 @@
1
+ export * from "../../async/delay-iterable/delay-iterable";
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @module Async
3
+ */
4
+ import type { TimeSpan } from "../../utilities/_module";
5
+ /**
6
+ * The <i>delayIterable</i> function adds delay to each iteration of <i>{@link AsyncIterable}</i> and the delay can be aborted by providing <i>abortSignal</i>.
7
+ * @group AsyncIterable utilities
8
+ * @throws {AsyncError} {@link AsyncError}
9
+ * @throws {AbortAsyncError} {@link AbortAsyncError}
10
+ * @example
11
+ * ```ts
12
+ * import { delayIterable, TimeSpan } from "@daiso-tech/core";
13
+ *
14
+ * const iterable: AsyncIterable<void> = {
15
+ * async *[Symbol.asyncIterator]() {
16
+ * yield 1;
17
+ * yield 2;
18
+ * yield 3;
19
+ * yield 4;
20
+ * yield 5;
21
+ * }
22
+ * }
23
+ *
24
+ * (async () => {
25
+ * for await (const item of delayIterable(iterable, TimeSpan.fromSeconds(1))) {
26
+ * console.log(item);
27
+ * }
28
+ * })();
29
+ * ```
30
+ * @example with abortSignal
31
+ * ```ts
32
+ * import { delayIterable, TimeSpan } from "@daiso-tech/core";
33
+ *
34
+ * const abortController = new AbortController();
35
+ * setTimeout(() => {
36
+ * abortController.abort("My abort error");
37
+ * }, TimeSpan.fromSeconds(3).toMilliseconds());
38
+ *
39
+ * const iterable: AsyncIterable<void> = {
40
+ * async *[Symbol.asyncIterator]() {
41
+ * yield 1;
42
+ * yield 2;
43
+ * yield 3;
44
+ * yield 4;
45
+ * yield 5;
46
+ * }
47
+ * }
48
+ *
49
+ * (async () => {
50
+ * // Will throw AbortAsyncError
51
+ * for await (const item of delayIterable(iterable, TimeSpan.fromSeconds(1), abortController.signal)) {
52
+ * console.log(item);
53
+ * }
54
+ * })();
55
+ * ```
56
+ */
57
+ export declare function delayIterable<TValue>(iterable: AsyncIterable<TValue>, time: TimeSpan, abortSignal?: AbortSignal): AsyncIterable<TValue>;
@@ -0,0 +1 @@
1
+ export * from "../../async/lazy-promise/lazy-promise";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @module Async
3
+ */
4
+ /**
5
+ * The <i>LazyPromise</i> class is used for creating lazy <i>{@link PromiseLike}<i> object that will only execute when awaited or when then method is called.
6
+ * @group Promise utilities
7
+ * @example
8
+ * ```ts
9
+ * (async () => {
10
+ * const promise = new LazyPromise(async () => {
11
+ * console.log("I am lazy");
12
+ * });
13
+ * // "I am lazy" will only logged when awaited or then method i called.
14
+ * await promise;
15
+ * })();
16
+ * ```
17
+ */
18
+ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
19
+ private readonly asyncFn;
20
+ private promise;
21
+ constructor(asyncFn: () => PromiseLike<TValue>);
22
+ then<TResult1 = TValue, TResult2 = never>(onfulfilled?: ((value: TValue) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
23
+ }
24
+ /**
25
+ * The <i>deferLazyPromise</i> function will execute <i>{@link LazyPromise}</i> without awaiting it.
26
+ * @group Promise utilities
27
+ */
28
+ export declare function deferLazyPromise<TValue>(promise: LazyPromise<TValue>): void;
@@ -0,0 +1 @@
1
+ export * from "../../async/retry/retry";
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @module Async
3
+ */
4
+ import type { BackoffPolicy } from "../../async/backof-policies/_module";
5
+ import { LazyPromise } from "../../async/lazy-promise/_module";
6
+ import { TimeSpan } from "../../utilities/_module";
7
+ export type RetryPolicy = (error: unknown) => boolean;
8
+ /**
9
+ * @group Promise utilities
10
+ */
11
+ export type RetrySettings = {
12
+ /**
13
+ * @default {4}
14
+ */
15
+ maxAttempts?: number;
16
+ backoffPolicy?: BackoffPolicy;
17
+ retryPolicy?: RetryPolicy;
18
+ /**
19
+ * @default 60_000 milliseconds
20
+ */
21
+ retryTimeout?: TimeSpan;
22
+ abortSignal?: AbortSignal;
23
+ };
24
+ /**
25
+ * The <i>retry</i> function will retry a async function if it throws an error until given <i>settings.maxAttempts</i>.
26
+ * You can add timeout for each retry by passing <i>settings.retryTimeout</i> and <i>settings.abortSignal</i> for aborting it on your own.
27
+ * You can also customize the retry policy by passing <i>settings.retryPolicy</i> and custom backof policy by passing <i>settings.backoffPolicy</i>.
28
+ * @group Promise utilities
29
+ * @throws {AsyncError} {@link AsyncError}
30
+ * @throws {AbortAsyncError} {@link AbortAsyncError}
31
+ * @throws {TimeoutAsyncError} {@link TimeoutAsyncError}
32
+ * @throws {RetryAsyncError} {@link RetryAsyncError}
33
+ * @example
34
+ * ```ts
35
+ * import { retry, TimeSpan, exponentialBackoffPolicy } from "@daiso-tech/core";
36
+ *
37
+ * (async () => {
38
+ * // Will throw RetryAsyncError after failing 4:th attempt
39
+ * await retry(async () => {
40
+ * throw new Error("My error mesasge");
41
+ * }, {
42
+ * // You can choose the max retry attempts
43
+ * maxAttempts: 4,
44
+ * // You can provide a custom backoff policy
45
+ * backoffPolicy: exponentialBackoffPolicy(),
46
+ * // You can choose what error to retry, this function will retry all errors thrown
47
+ * retryPolicy: () => true,
48
+ * // You can provide a timeout for each retry
49
+ * retryTimeout: TimeSpan.fromMilliseconds(60_000),
50
+ * });
51
+ * })();
52
+ * ```
53
+ * @example with abortSignal
54
+ * ```ts
55
+ * import { retry, TimeSpan } from "@daiso-tech/core";
56
+ *
57
+ * (async () => {
58
+ * const abortController = new AbortController();
59
+ * abortController.abort("My abort message");
60
+ *
61
+ * // Will be aborted by throwing AbortAsyncError
62
+ * await retry(async () => {
63
+ * throw new Error("My error message");
64
+ * }, {
65
+ * abortSignal: abortController.signal
66
+ * });
67
+ * })();
68
+ * ```
69
+ * @example with custom retry policy
70
+ * ```ts
71
+ * import { retry, TimeSpan } from "@daiso-tech/core";
72
+ *
73
+ * class ErrorA extends Error {};
74
+ * class ErrorB extends Error {};
75
+ *
76
+ * (async () => {
77
+ * // Will not retry and ErrorB will be thrown
78
+ * await retry(async () => {
79
+ * throw new ErrorB("My error message");
80
+ * }, {
81
+ * retryPolicy: error => error instanceof ErrorA
82
+ * });
83
+ * })();
84
+ * ```
85
+ */
86
+ export declare function retry<TValue = void>(asyncFn: () => PromiseLike<TValue>, settings?: RetrySettings): LazyPromise<TValue>;
@@ -0,0 +1 @@
1
+ export * from "../../async/retry-iterable/retry-iterable";
@@ -0,0 +1,86 @@
1
+ import type { RetrySettings } from "../../async/retry/_module";
2
+ /**
3
+ * The <i>retryIterable</i> function will retry each iteration of {@link AsyncIterable} if it throws an error until given <i>settings.maxAttempts</i>.
4
+ * You can add timeout for each retry by passing <i>settings.retryTimeout</i> and <i>settings.abortSignal</i> for aborting it on your own.
5
+ * You can also customize the retry policy by passing <i>settings.retryPolicy</i> and custom backof policy by passing <i>settings.backoffPolicy</i>.
6
+ * @group AsyncIterable utilities
7
+ * @throws {AsyncError} {@link AsyncError}
8
+ * @throws {AbortAsyncError} {@link AbortAsyncError}
9
+ * @throws {RetryAsyncError} {@link RetryAsyncError}
10
+ * @throws {TimeoutAsyncError} {@link TimeoutAsyncError}
11
+ * @example
12
+ * ```ts
13
+ * import { retryIterable, TimeSpan, exponentialBackoffPolicy } from "@daiso-tech/core";
14
+ *
15
+ * const iterable: AsyncIterable<void> = {
16
+ * async *[Symbol.asyncIterator]() {
17
+ * yield 1;
18
+ * throw new Error("My error mesasge");
19
+ * }
20
+ * }
21
+ *
22
+ * (async () => {
23
+ * // Will throw RetryAsyncError after failing 4:th attempt
24
+ * for await (const item of retryIterable(iterable, {
25
+ * // You can choose the max retry attempts
26
+ * maxAttempts: 4,
27
+ * // You can provide a custom backoff policy
28
+ * backoffPolicy: exponentialBackoffPolicy(),
29
+ * // You can choose what error to retry, this function will retry all errors thrown
30
+ * retryPolicy: () => true,
31
+ * // You can provide a timeout for each retry
32
+ * retryTimeout: TimeSpan.fromMilliseconds(60_000),
33
+ * })) {
34
+ * console.log(item)
35
+ * }
36
+ * })();
37
+ * ```
38
+ * @example with abortSignal
39
+ * ```ts
40
+ * import { retryIterable, TimeSpan } from "@daiso-tech/core";
41
+ *
42
+ * const iterable: AsyncIterable<void> = {
43
+ * async *[Symbol.asyncIterator]() {
44
+ * yield 1;
45
+ * throw new Error("My error mesasge");
46
+ * }
47
+ * }
48
+ *
49
+ * (async () => {
50
+ * const abortController = new AbortController();
51
+ * abortController.abort("My abort message");
52
+ *
53
+ * // Will be aborted by throwing AbortAsyncError
54
+ * for await (const item of retry(iterable, {
55
+ * abortSignal: abortController.signal
56
+ * })) {
57
+ * console.log(item)
58
+ * }
59
+ * })();
60
+ * ```
61
+ * @example with abortSignal
62
+ * ```ts
63
+ * import { retryIterable, TimeSpan } from "@daiso-tech/core";
64
+ *
65
+ * class ErrorA extends Error {};
66
+ * class ErrorB extends Error {};
67
+ *
68
+ * const iterable: AsyncIterable<void> = {
69
+ * async *[Symbol.asyncIterator]() {
70
+ * yield 1;
71
+ * throw new ErrorB("My error mesasge");
72
+ * }
73
+ * }
74
+ *
75
+ *
76
+ * (async () => {
77
+ * // Will not retry and ErrorB will be thrown
78
+ * for await (const item of retry(iterable, {
79
+ * retryPolicy: error => error instanceof ErrorA
80
+ * })) {
81
+ * console.log(item)
82
+ * }
83
+ * })();
84
+ * ```
85
+ */
86
+ export declare function retryIterable<TValue>(iterable: AsyncIterable<TValue>, settings?: RetrySettings): AsyncIterable<TValue>;
@@ -0,0 +1 @@
1
+ export * from "../../async/timeout/timeout";
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @module Async
3
+ */
4
+ import { LazyPromise } from "../../async/lazy-promise/_module";
5
+ import type { TimeSpan } from "../../utilities/_module";
6
+ /**
7
+ * The <i>timeout</i> function makes a <i>{@link PromiseLike}</i> object abort after a given <i>time</i> and you can also abort it on your own by passing <i>abortSignal</i>.
8
+ * @group Promise utilities
9
+ * @throws {AsyncError} {@link AsyncError}
10
+ * @throws {AbortAsyncError} {@link AbortAsyncError}
11
+ * @throws {TimeoutAsyncError} {@link TimeoutAsyncError}
12
+ * @example
13
+ * ```ts
14
+ * import { timeout, delay, TimeSpan } from "@daiso-tech/core";
15
+ *
16
+ * (async () => {
17
+ * // Will throw an AbortAsyncError
18
+ * await timeout(async () => {
19
+ * await delay(TimeSpan.fromSeconds(10));
20
+ * }, TimeSpan.fromSeconds(5));
21
+ * })();
22
+ * ```
23
+ * @example with abortSignal
24
+ * ```ts
25
+ * import { timeout, delay, TimeSpan } from "@daiso-tech/core";
26
+ *
27
+ * const abortController = new AbortController();
28
+ * setTimeout(() => {
29
+ * abortController.abort("My abort error");
30
+ * }, TimeSpan.fromSeconds(1));
31
+ *
32
+ * (async () => {
33
+ * // Will abort after 1 second by throwing AbortAsyncError
34
+ * await timeout(async () => {
35
+ * await delay(TimeSpan.fromSeconds(10));
36
+ * }, TimeSpan.fromSeconds(5), abortController.signal);
37
+ * })();
38
+ * ```
39
+ */
40
+ export declare function timeout<TValue>(asyncFn: () => PromiseLike<TValue>, time: TimeSpan, abortSignal?: AbortSignal): LazyPromise<TValue>;
@@ -0,0 +1 @@
1
+ export * from "../../async/timeout-iterable/timeout-iterable";
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @module Async
3
+ */
4
+ import type { TimeSpan } from "../../utilities/_module";
5
+ /**
6
+ * The <i>timeoutIterable</i> function makes a <i>{@link AsyncIterable}</i> abort after a given <i>time</i> and you can also abort it on your own by passing <i>abortSignal</i>.
7
+ * @group AsyncIterable utilities
8
+ * @throws {AsyncError} {@link AsyncError}
9
+ * @throws {AbortAsyncError} {@link AbortAsyncError}
10
+ * @example
11
+ * ```ts
12
+ * import { timeoutIterable, delayIterable, TimeSpan } from "@daiso-tech/core";
13
+ *
14
+ * const iterable: AsyncIterable<void> = delayIterable({
15
+ * async *[Symbol.asyncIterator]() {
16
+ * yield 1;
17
+ * yield 2;
18
+ * yield 3;
19
+ * yield 4;
20
+ * yield 5;
21
+ * yield 6;
22
+ * yield 7;
23
+ * yield 8;
24
+ * }
25
+ * }, TimeSpan.fromSeconds(1));
26
+ *
27
+ * (async () => {
28
+ * // Will throw an AbortAsyncError
29
+ * for (const item of timeoutIterable(iterable, TimeSpan.fromSeconds(5))) {
30
+ * console.log(item);
31
+ * }
32
+ * })();
33
+ * ```
34
+ * @example with abortSignal
35
+ * ```ts
36
+ * import { timeoutIterable, delay, TimeSpan } from "@daiso-tech/core";
37
+ *
38
+ * const iterable: AsyncIterable<void> = delayIterable({
39
+ * async *[Symbol.asyncIterator]() {
40
+ * yield 1;
41
+ * yield 2;
42
+ * yield 3;
43
+ * yield 4;
44
+ * yield 5;
45
+ * yield 6;
46
+ * yield 7;
47
+ * yield 8;
48
+ * }
49
+ * }, TimeSpan.fromSeconds(1));
50
+ *
51
+ * const abortController = new AbortController();
52
+ * setTimeout(() => {
53
+ * abortController.abort("My abort message");
54
+ * }, TimeSpan.fromSeconds(3));
55
+ *
56
+ * (async () => {
57
+ * // Will abort after 3 second by throwing AbortAsyncError
58
+ * for (const item of timeoutIterable(iterable, TimeSpan.fromSeconds(5), abortController.signal)) {
59
+ * console.log(item);
60
+ * }
61
+ * })();
62
+ * ```
63
+ */
64
+ export declare function timeoutIterable<TValue>(iterable: AsyncIterable<TValue>, time: TimeSpan, abortSignal?: AbortSignal): AsyncIterable<TValue>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @module Collections
2
+ * @module Collection
3
3
  */
4
4
  /**
5
5
  * The <i>range</i> function return a <i>{@link Iterable}</i> of numbers, starting from <i>from</i>,increments by 1 and stops at <i>to</i>.
@@ -1,4 +1,5 @@
1
- import { CrossJoinResult, type IAsyncCollection } from "../../../contracts/collection/_module";
1
+ import type { CrossJoinResult } from "../../../contracts/collection/_module";
2
+ import { type IAsyncCollection } from "../../../contracts/collection/_module";
2
3
  import { type AsyncIterableValue } from "../../../_shared/types";
3
4
  /**
4
5
  * @internal
@@ -7,6 +7,6 @@ export declare class AsyncGroupByIterable<TInput, TOutput = TInput> implements A
7
7
  private collection;
8
8
  private selectFn;
9
9
  private makeCollection;
10
- constructor(collection: IAsyncCollection<TInput>, selectFn: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>, makeCollection: <TInput>(iterable: AsyncIterableValue<TInput>) => IAsyncCollection<TInput>);
10
+ constructor(collection: IAsyncCollection<TInput>, selectFn: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput> | undefined, makeCollection: <TInput>(iterable: AsyncIterableValue<TInput>) => IAsyncCollection<TInput>);
11
11
  [Symbol.asyncIterator](): AsyncIterator<RecordItem<TOutput, IAsyncCollection<TInput>>>;
12
12
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @module Collections
2
+ * @module Collection
3
3
  */
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";
@@ -72,7 +72,7 @@ export declare class AsyncIterableCollection<TInput> implements IAsyncCollection
72
72
  insertAfter<TExtended = TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
73
73
  crossJoin<TExtended>(iterable: AsyncIterableValue<TExtended>): IAsyncCollection<CrossJoinResult<TInput, TExtended>>;
74
74
  zip<TExtended>(iterable: AsyncIterableValue<TExtended>): IAsyncCollection<RecordItem<TInput, TExtended>>;
75
- sort(comparator?: Comparator<TInput> | undefined): IAsyncCollection<TInput>;
75
+ sort(comparator?: Comparator<TInput>): IAsyncCollection<TInput>;
76
76
  reverse(chunkSize?: number): IAsyncCollection<TInput>;
77
77
  shuffle(mathRandom?: () => number): IAsyncCollection<TInput>;
78
78
  first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | null>;
@@ -1,4 +1,4 @@
1
- import { CrossJoinResult, ICollection } from "../../../contracts/collection/_module";
1
+ import type { CrossJoinResult, ICollection } from "../../../contracts/collection/_module";
2
2
  export declare class CrossJoinIterable<TInput, TExtended = TInput> implements Iterable<CrossJoinResult<TInput, TExtended>> {
3
3
  private collection;
4
4
  private iterable;
@@ -7,6 +7,6 @@ export declare class GroupByIterable<TInput, TOutput = TInput> implements Iterab
7
7
  private collection;
8
8
  private selectFn;
9
9
  private makeCollection;
10
- constructor(collection: ICollection<TInput>, selectFn: Map<TInput, ICollection<TInput>, TOutput>, makeCollection: <TInput>(iterable: Iterable<TInput>) => ICollection<TInput>);
10
+ constructor(collection: ICollection<TInput>, selectFn: Map<TInput, ICollection<TInput>, TOutput> | undefined, makeCollection: <TInput>(iterable: Iterable<TInput>) => ICollection<TInput>);
11
11
  [Symbol.iterator](): Iterator<RecordItem<TOutput, ICollection<TInput>>>;
12
12
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @module Collections
2
+ * @module Collection
3
3
  */
4
4
  import { type Collapse, type Comparator, type Predicate, type ForEach, type ICollection, type Map, type Modifier, type Tap, type Transform, type ChangendItem, type Reduce, type CrossJoinResult } from "../../contracts/collection/_module";
5
5
  import { type Lazyable, type EnsureType } from "../../_shared/types";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @module Collections
2
+ * @module Collection
3
3
  */
4
4
  import { type Collapse, type Comparator, type Predicate, type ICollection, type Map, type Modifier, type Tap, type Transform, type ChangendItem, type Reduce, type ForEach, type CrossJoinResult } from "../../contracts/collection/_module";
5
5
  import { type EnsureType, type Lazyable } from "../../_shared/types";
@@ -1 +1,3 @@
1
1
  export * from "../contracts/collection/_module";
2
+ export * from "../contracts/serializer/_module";
3
+ export * from "../contracts/storage/_module";
@@ -1,6 +1,3 @@
1
- /**
2
- * @module Collections
3
- */
4
1
  export * from "../../contracts/collection/_shared";
5
2
  export * from "../../contracts/collection/collection.contract";
6
3
  export * from "../../contracts/collection/async-collection.contract";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @module Collections
2
+ * @module Collection
3
3
  */
4
4
  /**
5
5
  * @group Errors
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @module Collections
2
+ * @module Collection
3
3
  */
4
- import { type AsyncPredicate, type AsyncForEach, type AsyncMap, type AsyncModifier, type AsyncTap, type AsyncTransform, type Comparator, type ChangendItem, AsyncReduce, CrossJoinResult } from "../../contracts/collection/_shared";
5
- import { type RecordItem, type AsyncLazyable, type EnsureType, type AsyncIterableValue } from "../../_shared/types";
4
+ import type { AsyncReduce, CrossJoinResult, AsyncPredicate, AsyncForEach, AsyncMap, AsyncModifier, AsyncTap, AsyncTransform, Comparator, ChangendItem } from "../../contracts/collection/_shared";
5
+ import type { RecordItem, AsyncLazyable, EnsureType, AsyncIterableValue } from "../../_shared/types";
6
6
  export type AsyncCollapse<TValue> = TValue extends Array<infer TItem> | Iterable<infer TItem> | IAsyncCollection<infer TItem> ? TItem : TValue;
7
7
  /**
8
8
  * <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.
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @module Collections
2
+ * @module Collection
3
3
  */
4
- import { type Comparator, type Predicate, type ForEach, type Map, type Modifier, type Tap, type Transform, type ChangendItem, type Reduce, type CrossJoinResult } from "../../contracts/collection/_shared";
5
- import { type Lazyable, type RecordItem, type EnsureType } from "../../_shared/types";
4
+ import type { Comparator, Predicate, ForEach, Map, Modifier, Tap, Transform, ChangendItem, Reduce, CrossJoinResult } from "../../contracts/collection/_shared";
5
+ import type { Lazyable, RecordItem, EnsureType } from "../../_shared/types";
6
6
  export type Collapse<TValue> = TValue extends Array<infer TItem> | Iterable<infer TItem> | ICollection<infer TItem> ? TItem : TValue;
7
7
  /**
8
8
  * <i>ICollection</i> is immutable.
@@ -0,0 +1 @@
1
+ export * from "../../contracts/serializer/serializer.contract";
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @module Serializer
3
+ */
4
+ /**
5
+ * @group Errors
6
+ */
7
+ export declare class SerializerError extends Error {
8
+ constructor(message: string, cause?: unknown);
9
+ }
10
+ /**
11
+ * @group Errors
12
+ */
13
+ export declare class SerializationError extends SerializerError {
14
+ constructor(message: string, cause?: unknown);
15
+ }
16
+ /**
17
+ * @group Errors
18
+ */
19
+ export declare class DeserializationError extends SerializerError {
20
+ constructor(message: string, cause?: unknown);
21
+ }
22
+ /**
23
+ * @group Contracts
24
+ * @throws {SerializerError} {@link SerializerError}
25
+ * @throws {SerializationError} {@link SerializationError}
26
+ * @throws {DeserializationError} {@link DeserializationError}
27
+ */
28
+ export type ISerializer<TSerialized = unknown> = {
29
+ /**
30
+ * @throws {SerializationError} {@link SerializationError}
31
+ */
32
+ serialize<TValue>(value: TValue): Promise<TSerialized>;
33
+ /**
34
+ * @throws {DeserializationError} {@link DeserializationError}
35
+ */
36
+ deserialize<TValue>(value: TSerialized): Promise<TValue>;
37
+ };
@@ -0,0 +1,3 @@
1
+ export * from "../../contracts/storage/_shared";
2
+ export * from "../../contracts/storage/storage.contract";
3
+ export * from "../../contracts/storage/storage-adapter.contract";
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @module Storage
3
+ */
4
+ /**
5
+ * @group Errors
6
+ */
7
+ export declare class StorageError extends Error {
8
+ constructor(message: string, cause?: unknown);
9
+ }
10
+ /**
11
+ * @group Errors
12
+ */
13
+ export declare class UnexpectedStorageError extends StorageError {
14
+ constructor(message: string, cause?: unknown);
15
+ }
16
+ /**
17
+ * @group Errors
18
+ */
19
+ export declare class TypeStorageError extends StorageError {
20
+ constructor(message: string, cause?: unknown);
21
+ }
22
+ /**
23
+ * @group Errors
24
+ */
25
+ export declare class KeyNotFoundStorageError extends StorageError {
26
+ constructor(message: string, cause?: unknown);
27
+ }