@ac-kit/data 0.1.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 (599) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +75 -0
  3. package/dist/bit/bit-set.d.ts +84 -0
  4. package/dist/bit/bit-set.d.ts.map +1 -0
  5. package/dist/bit/bit-set.js +206 -0
  6. package/dist/bit/bit-set.js.map +1 -0
  7. package/dist/bit/bit-vector.d.ts +69 -0
  8. package/dist/bit/bit-vector.d.ts.map +1 -0
  9. package/dist/bit/bit-vector.js +172 -0
  10. package/dist/bit/bit-vector.js.map +1 -0
  11. package/dist/cache/_lru-store.d.ts +37 -0
  12. package/dist/cache/_lru-store.d.ts.map +1 -0
  13. package/dist/cache/_lru-store.js +137 -0
  14. package/dist/cache/_lru-store.js.map +1 -0
  15. package/dist/cache/lru-cache.d.ts +90 -0
  16. package/dist/cache/lru-cache.d.ts.map +1 -0
  17. package/dist/cache/lru-cache.js +143 -0
  18. package/dist/cache/lru-cache.js.map +1 -0
  19. package/dist/cache/lru-map.d.ts +72 -0
  20. package/dist/cache/lru-map.d.ts.map +1 -0
  21. package/dist/cache/lru-map.js +100 -0
  22. package/dist/cache/lru-map.js.map +1 -0
  23. package/dist/collection/_bounded.d.ts +27 -0
  24. package/dist/collection/_bounded.d.ts.map +1 -0
  25. package/dist/collection/_bounded.js +48 -0
  26. package/dist/collection/_bounded.js.map +1 -0
  27. package/dist/collection/_capacity-semaphore.d.ts +31 -0
  28. package/dist/collection/_capacity-semaphore.d.ts.map +1 -0
  29. package/dist/collection/_capacity-semaphore.js +94 -0
  30. package/dist/collection/_capacity-semaphore.js.map +1 -0
  31. package/dist/collection/iasync-collection.d.ts +16 -0
  32. package/dist/collection/iasync-collection.d.ts.map +1 -0
  33. package/dist/collection/iasync-collection.js +13 -0
  34. package/dist/collection/iasync-collection.js.map +1 -0
  35. package/dist/collection/iasync-searchable.d.ts +9 -0
  36. package/dist/collection/iasync-searchable.d.ts.map +1 -0
  37. package/dist/collection/iasync-searchable.js +2 -0
  38. package/dist/collection/iasync-searchable.js.map +1 -0
  39. package/dist/collection/ibounded.d.ts +36 -0
  40. package/dist/collection/ibounded.d.ts.map +1 -0
  41. package/dist/collection/ibounded.js +8 -0
  42. package/dist/collection/ibounded.js.map +1 -0
  43. package/dist/collection/icollection.d.ts +24 -0
  44. package/dist/collection/icollection.d.ts.map +1 -0
  45. package/dist/collection/icollection.js +2 -0
  46. package/dist/collection/icollection.js.map +1 -0
  47. package/dist/collection/ilossy.d.ts +20 -0
  48. package/dist/collection/ilossy.d.ts.map +1 -0
  49. package/dist/collection/ilossy.js +2 -0
  50. package/dist/collection/ilossy.js.map +1 -0
  51. package/dist/collection/ireplacing.d.ts +25 -0
  52. package/dist/collection/ireplacing.d.ts.map +1 -0
  53. package/dist/collection/ireplacing.js +2 -0
  54. package/dist/collection/ireplacing.js.map +1 -0
  55. package/dist/collection/isearchable.d.ts +36 -0
  56. package/dist/collection/isearchable.d.ts.map +1 -0
  57. package/dist/collection/isearchable.js +2 -0
  58. package/dist/collection/isearchable.js.map +1 -0
  59. package/dist/cursor/ibidirectional-cursor-sequence.d.ts +30 -0
  60. package/dist/cursor/ibidirectional-cursor-sequence.d.ts.map +1 -0
  61. package/dist/cursor/ibidirectional-cursor-sequence.js +2 -0
  62. package/dist/cursor/ibidirectional-cursor-sequence.js.map +1 -0
  63. package/dist/cursor/ibidirectional-cursor.d.ts +13 -0
  64. package/dist/cursor/ibidirectional-cursor.d.ts.map +1 -0
  65. package/dist/cursor/ibidirectional-cursor.js +2 -0
  66. package/dist/cursor/ibidirectional-cursor.js.map +1 -0
  67. package/dist/cursor/icursor-sequence.d.ts +48 -0
  68. package/dist/cursor/icursor-sequence.d.ts.map +1 -0
  69. package/dist/cursor/icursor-sequence.js +2 -0
  70. package/dist/cursor/icursor-sequence.js.map +1 -0
  71. package/dist/cursor/icursor.d.ts +27 -0
  72. package/dist/cursor/icursor.d.ts.map +1 -0
  73. package/dist/cursor/icursor.js +2 -0
  74. package/dist/cursor/icursor.js.map +1 -0
  75. package/dist/cursor/index-cursor-sequence.d.ts +57 -0
  76. package/dist/cursor/index-cursor-sequence.d.ts.map +1 -0
  77. package/dist/cursor/index-cursor-sequence.js +181 -0
  78. package/dist/cursor/index-cursor-sequence.js.map +1 -0
  79. package/dist/cursor/irandom-access-cursor.d.ts +16 -0
  80. package/dist/cursor/irandom-access-cursor.d.ts.map +1 -0
  81. package/dist/cursor/irandom-access-cursor.js +2 -0
  82. package/dist/cursor/irandom-access-cursor.js.map +1 -0
  83. package/dist/deque/blocking-deque.d.ts +36 -0
  84. package/dist/deque/blocking-deque.d.ts.map +1 -0
  85. package/dist/deque/blocking-deque.js +101 -0
  86. package/dist/deque/blocking-deque.js.map +1 -0
  87. package/dist/deque/bounded-deque.d.ts +58 -0
  88. package/dist/deque/bounded-deque.d.ts.map +1 -0
  89. package/dist/deque/bounded-deque.js +103 -0
  90. package/dist/deque/bounded-deque.js.map +1 -0
  91. package/dist/deque/deque.d.ts +35 -0
  92. package/dist/deque/deque.d.ts.map +1 -0
  93. package/dist/deque/deque.js +62 -0
  94. package/dist/deque/deque.js.map +1 -0
  95. package/dist/deque/iasync-deque.d.ts +19 -0
  96. package/dist/deque/iasync-deque.d.ts.map +1 -0
  97. package/dist/deque/iasync-deque.js +2 -0
  98. package/dist/deque/iasync-deque.js.map +1 -0
  99. package/dist/deque/iasync-lossy-deque.d.ts +11 -0
  100. package/dist/deque/iasync-lossy-deque.d.ts.map +1 -0
  101. package/dist/deque/iasync-lossy-deque.js +2 -0
  102. package/dist/deque/iasync-lossy-deque.js.map +1 -0
  103. package/dist/deque/ideque-storage.d.ts +6 -0
  104. package/dist/deque/ideque-storage.d.ts.map +1 -0
  105. package/dist/deque/ideque-storage.js +2 -0
  106. package/dist/deque/ideque-storage.js.map +1 -0
  107. package/dist/deque/ideque.d.ts +72 -0
  108. package/dist/deque/ideque.d.ts.map +1 -0
  109. package/dist/deque/ideque.js +2 -0
  110. package/dist/deque/ideque.js.map +1 -0
  111. package/dist/deque/ilossy-deque.d.ts +42 -0
  112. package/dist/deque/ilossy-deque.d.ts.map +1 -0
  113. package/dist/deque/ilossy-deque.js +2 -0
  114. package/dist/deque/ilossy-deque.js.map +1 -0
  115. package/dist/deque/iwaitable-deque.d.ts +42 -0
  116. package/dist/deque/iwaitable-deque.d.ts.map +1 -0
  117. package/dist/deque/iwaitable-deque.js +2 -0
  118. package/dist/deque/iwaitable-deque.js.map +1 -0
  119. package/dist/disjoint-set/iasync-disjoint-set.d.ts +11 -0
  120. package/dist/disjoint-set/iasync-disjoint-set.d.ts.map +1 -0
  121. package/dist/disjoint-set/iasync-disjoint-set.js +2 -0
  122. package/dist/disjoint-set/iasync-disjoint-set.js.map +1 -0
  123. package/dist/disjoint-set/idisjoint-set.d.ts +11 -0
  124. package/dist/disjoint-set/idisjoint-set.d.ts.map +1 -0
  125. package/dist/disjoint-set/idisjoint-set.js +2 -0
  126. package/dist/disjoint-set/idisjoint-set.js.map +1 -0
  127. package/dist/disjoint-set/static-disjoint-set.d.ts +67 -0
  128. package/dist/disjoint-set/static-disjoint-set.d.ts.map +1 -0
  129. package/dist/disjoint-set/static-disjoint-set.js +146 -0
  130. package/dist/disjoint-set/static-disjoint-set.js.map +1 -0
  131. package/dist/fuzzy/fuzzy-map.d.ts +62 -0
  132. package/dist/fuzzy/fuzzy-map.d.ts.map +1 -0
  133. package/dist/fuzzy/fuzzy-map.js +91 -0
  134. package/dist/fuzzy/fuzzy-map.js.map +1 -0
  135. package/dist/fuzzy/fuzzy-multi-map.d.ts +62 -0
  136. package/dist/fuzzy/fuzzy-multi-map.d.ts.map +1 -0
  137. package/dist/fuzzy/fuzzy-multi-map.js +143 -0
  138. package/dist/fuzzy/fuzzy-multi-map.js.map +1 -0
  139. package/dist/graph/directed-graph.d.ts +78 -0
  140. package/dist/graph/directed-graph.d.ts.map +1 -0
  141. package/dist/graph/directed-graph.js +165 -0
  142. package/dist/graph/directed-graph.js.map +1 -0
  143. package/dist/graph/graph.d.ts +73 -0
  144. package/dist/graph/graph.d.ts.map +1 -0
  145. package/dist/graph/graph.js +145 -0
  146. package/dist/graph/graph.js.map +1 -0
  147. package/dist/graph/iasync-directed-graph.d.ts +10 -0
  148. package/dist/graph/iasync-directed-graph.d.ts.map +1 -0
  149. package/dist/graph/iasync-directed-graph.js +2 -0
  150. package/dist/graph/iasync-directed-graph.js.map +1 -0
  151. package/dist/graph/iasync-graph.d.ts +19 -0
  152. package/dist/graph/iasync-graph.d.ts.map +1 -0
  153. package/dist/graph/iasync-graph.js +2 -0
  154. package/dist/graph/iasync-graph.js.map +1 -0
  155. package/dist/graph/idirected-graph.d.ts +10 -0
  156. package/dist/graph/idirected-graph.d.ts.map +1 -0
  157. package/dist/graph/idirected-graph.js +2 -0
  158. package/dist/graph/idirected-graph.js.map +1 -0
  159. package/dist/graph/igraph.d.ts +25 -0
  160. package/dist/graph/igraph.d.ts.map +1 -0
  161. package/dist/graph/igraph.js +2 -0
  162. package/dist/graph/igraph.js.map +1 -0
  163. package/dist/heap/_array-heap.d.ts +12 -0
  164. package/dist/heap/_array-heap.d.ts.map +1 -0
  165. package/dist/heap/_array-heap.js +74 -0
  166. package/dist/heap/_array-heap.js.map +1 -0
  167. package/dist/heap/binary-heap.d.ts +29 -0
  168. package/dist/heap/binary-heap.d.ts.map +1 -0
  169. package/dist/heap/binary-heap.js +83 -0
  170. package/dist/heap/binary-heap.js.map +1 -0
  171. package/dist/heap/blocking-binary-heap.d.ts +34 -0
  172. package/dist/heap/blocking-binary-heap.d.ts.map +1 -0
  173. package/dist/heap/blocking-binary-heap.js +84 -0
  174. package/dist/heap/blocking-binary-heap.js.map +1 -0
  175. package/dist/heap/bounded-binary-heap.d.ts +42 -0
  176. package/dist/heap/bounded-binary-heap.d.ts.map +1 -0
  177. package/dist/heap/bounded-binary-heap.js +71 -0
  178. package/dist/heap/bounded-binary-heap.js.map +1 -0
  179. package/dist/heap/iasync-heap.d.ts +19 -0
  180. package/dist/heap/iasync-heap.d.ts.map +1 -0
  181. package/dist/heap/iasync-heap.js +2 -0
  182. package/dist/heap/iasync-heap.js.map +1 -0
  183. package/dist/heap/iasync-lossy-heap.d.ts +9 -0
  184. package/dist/heap/iasync-lossy-heap.d.ts.map +1 -0
  185. package/dist/heap/iasync-lossy-heap.js +2 -0
  186. package/dist/heap/iasync-lossy-heap.js.map +1 -0
  187. package/dist/heap/iheap-storage.d.ts +5 -0
  188. package/dist/heap/iheap-storage.d.ts.map +1 -0
  189. package/dist/heap/iheap-storage.js +2 -0
  190. package/dist/heap/iheap-storage.js.map +1 -0
  191. package/dist/heap/iheap.d.ts +51 -0
  192. package/dist/heap/iheap.d.ts.map +1 -0
  193. package/dist/heap/iheap.js +2 -0
  194. package/dist/heap/iheap.js.map +1 -0
  195. package/dist/heap/ilossy-heap.d.ts +28 -0
  196. package/dist/heap/ilossy-heap.d.ts.map +1 -0
  197. package/dist/heap/ilossy-heap.js +2 -0
  198. package/dist/heap/ilossy-heap.js.map +1 -0
  199. package/dist/heap/iwaitable-heap.d.ts +27 -0
  200. package/dist/heap/iwaitable-heap.d.ts.map +1 -0
  201. package/dist/heap/iwaitable-heap.js +2 -0
  202. package/dist/heap/iwaitable-heap.js.map +1 -0
  203. package/dist/index.d.ts +144 -0
  204. package/dist/index.d.ts.map +1 -0
  205. package/dist/index.js +144 -0
  206. package/dist/index.js.map +1 -0
  207. package/dist/interval/iasync-interval-index.d.ts +8 -0
  208. package/dist/interval/iasync-interval-index.d.ts.map +1 -0
  209. package/dist/interval/iasync-interval-index.js +2 -0
  210. package/dist/interval/iasync-interval-index.js.map +1 -0
  211. package/dist/interval/iinterval-index.d.ts +8 -0
  212. package/dist/interval/iinterval-index.d.ts.map +1 -0
  213. package/dist/interval/iinterval-index.js +2 -0
  214. package/dist/interval/iinterval-index.js.map +1 -0
  215. package/dist/interval/static-interval-tree.d.ts +65 -0
  216. package/dist/interval/static-interval-tree.d.ts.map +1 -0
  217. package/dist/interval/static-interval-tree.js +170 -0
  218. package/dist/interval/static-interval-tree.js.map +1 -0
  219. package/dist/list/_bounded-list.d.ts +14 -0
  220. package/dist/list/_bounded-list.d.ts.map +1 -0
  221. package/dist/list/_bounded-list.js +23 -0
  222. package/dist/list/_bounded-list.js.map +1 -0
  223. package/dist/list/array-list.d.ts +56 -0
  224. package/dist/list/array-list.d.ts.map +1 -0
  225. package/dist/list/array-list.js +198 -0
  226. package/dist/list/array-list.js.map +1 -0
  227. package/dist/list/blocking-array-list.d.ts +55 -0
  228. package/dist/list/blocking-array-list.d.ts.map +1 -0
  229. package/dist/list/blocking-array-list.js +190 -0
  230. package/dist/list/blocking-array-list.js.map +1 -0
  231. package/dist/list/blocking-circular-array-list.d.ts +61 -0
  232. package/dist/list/blocking-circular-array-list.d.ts.map +1 -0
  233. package/dist/list/blocking-circular-array-list.js +211 -0
  234. package/dist/list/blocking-circular-array-list.js.map +1 -0
  235. package/dist/list/blocking-doubly-linked-list.d.ts +59 -0
  236. package/dist/list/blocking-doubly-linked-list.d.ts.map +1 -0
  237. package/dist/list/blocking-doubly-linked-list.js +211 -0
  238. package/dist/list/blocking-doubly-linked-list.js.map +1 -0
  239. package/dist/list/blocking-linked-list.d.ts +50 -0
  240. package/dist/list/blocking-linked-list.d.ts.map +1 -0
  241. package/dist/list/blocking-linked-list.js +172 -0
  242. package/dist/list/blocking-linked-list.js.map +1 -0
  243. package/dist/list/bounded-array-list.d.ts +47 -0
  244. package/dist/list/bounded-array-list.d.ts.map +1 -0
  245. package/dist/list/bounded-array-list.js +108 -0
  246. package/dist/list/bounded-array-list.js.map +1 -0
  247. package/dist/list/bounded-circular-array-list.d.ts +54 -0
  248. package/dist/list/bounded-circular-array-list.d.ts.map +1 -0
  249. package/dist/list/bounded-circular-array-list.js +123 -0
  250. package/dist/list/bounded-circular-array-list.js.map +1 -0
  251. package/dist/list/bounded-doubly-linked-list.d.ts +52 -0
  252. package/dist/list/bounded-doubly-linked-list.d.ts.map +1 -0
  253. package/dist/list/bounded-doubly-linked-list.js +123 -0
  254. package/dist/list/bounded-doubly-linked-list.js.map +1 -0
  255. package/dist/list/bounded-linked-list.d.ts +42 -0
  256. package/dist/list/bounded-linked-list.d.ts.map +1 -0
  257. package/dist/list/bounded-linked-list.js +97 -0
  258. package/dist/list/bounded-linked-list.js.map +1 -0
  259. package/dist/list/circular-array-list.d.ts +77 -0
  260. package/dist/list/circular-array-list.d.ts.map +1 -0
  261. package/dist/list/circular-array-list.js +322 -0
  262. package/dist/list/circular-array-list.js.map +1 -0
  263. package/dist/list/doubly-linked-list.d.ts +113 -0
  264. package/dist/list/doubly-linked-list.d.ts.map +1 -0
  265. package/dist/list/doubly-linked-list.js +453 -0
  266. package/dist/list/doubly-linked-list.js.map +1 -0
  267. package/dist/list/iasync-list.d.ts +17 -0
  268. package/dist/list/iasync-list.d.ts.map +1 -0
  269. package/dist/list/iasync-list.js +2 -0
  270. package/dist/list/iasync-list.js.map +1 -0
  271. package/dist/list/ilist-storage.d.ts +9 -0
  272. package/dist/list/ilist-storage.d.ts.map +1 -0
  273. package/dist/list/ilist-storage.js +2 -0
  274. package/dist/list/ilist-storage.js.map +1 -0
  275. package/dist/list/ilist.d.ts +118 -0
  276. package/dist/list/ilist.d.ts.map +1 -0
  277. package/dist/list/ilist.js +8 -0
  278. package/dist/list/ilist.js.map +1 -0
  279. package/dist/list/iwaitable-list.d.ts +47 -0
  280. package/dist/list/iwaitable-list.d.ts.map +1 -0
  281. package/dist/list/iwaitable-list.js +2 -0
  282. package/dist/list/iwaitable-list.js.map +1 -0
  283. package/dist/list/linked-list.d.ts +102 -0
  284. package/dist/list/linked-list.d.ts.map +1 -0
  285. package/dist/list/linked-list.js +377 -0
  286. package/dist/list/linked-list.js.map +1 -0
  287. package/dist/map/iasync-map.d.ts +13 -0
  288. package/dist/map/iasync-map.d.ts.map +1 -0
  289. package/dist/map/iasync-map.js +2 -0
  290. package/dist/map/iasync-map.js.map +1 -0
  291. package/dist/map/iasync-replacing-map.d.ts +8 -0
  292. package/dist/map/iasync-replacing-map.d.ts.map +1 -0
  293. package/dist/map/iasync-replacing-map.js +2 -0
  294. package/dist/map/iasync-replacing-map.js.map +1 -0
  295. package/dist/map/iasync-sorted-map.d.ts +12 -0
  296. package/dist/map/iasync-sorted-map.d.ts.map +1 -0
  297. package/dist/map/iasync-sorted-map.js +2 -0
  298. package/dist/map/iasync-sorted-map.js.map +1 -0
  299. package/dist/map/imap.d.ts +20 -0
  300. package/dist/map/imap.d.ts.map +1 -0
  301. package/dist/map/imap.js +2 -0
  302. package/dist/map/imap.js.map +1 -0
  303. package/dist/map/ireplacing-map.d.ts +19 -0
  304. package/dist/map/ireplacing-map.d.ts.map +1 -0
  305. package/dist/map/ireplacing-map.js +2 -0
  306. package/dist/map/ireplacing-map.js.map +1 -0
  307. package/dist/map/isorted-map.d.ts +23 -0
  308. package/dist/map/isorted-map.d.ts.map +1 -0
  309. package/dist/map/isorted-map.js +2 -0
  310. package/dist/map/isorted-map.js.map +1 -0
  311. package/dist/multimap/iasync-multimap.d.ts +16 -0
  312. package/dist/multimap/iasync-multimap.d.ts.map +1 -0
  313. package/dist/multimap/iasync-multimap.js +2 -0
  314. package/dist/multimap/iasync-multimap.js.map +1 -0
  315. package/dist/multimap/imultimap.d.ts +28 -0
  316. package/dist/multimap/imultimap.d.ts.map +1 -0
  317. package/dist/multimap/imultimap.js +2 -0
  318. package/dist/multimap/imultimap.js.map +1 -0
  319. package/dist/multimap/inverted-index.d.ts +90 -0
  320. package/dist/multimap/inverted-index.d.ts.map +1 -0
  321. package/dist/multimap/inverted-index.js +234 -0
  322. package/dist/multimap/inverted-index.js.map +1 -0
  323. package/dist/multimap/multi-map.d.ts +63 -0
  324. package/dist/multimap/multi-map.d.ts.map +1 -0
  325. package/dist/multimap/multi-map.js +146 -0
  326. package/dist/multimap/multi-map.js.map +1 -0
  327. package/dist/multiset/iasync-multiset.d.ts +13 -0
  328. package/dist/multiset/iasync-multiset.d.ts.map +1 -0
  329. package/dist/multiset/iasync-multiset.js +2 -0
  330. package/dist/multiset/iasync-multiset.js.map +1 -0
  331. package/dist/multiset/imultiset.d.ts +22 -0
  332. package/dist/multiset/imultiset.d.ts.map +1 -0
  333. package/dist/multiset/imultiset.js +2 -0
  334. package/dist/multiset/imultiset.js.map +1 -0
  335. package/dist/multiset/multi-set.d.ts +66 -0
  336. package/dist/multiset/multi-set.d.ts.map +1 -0
  337. package/dist/multiset/multi-set.js +124 -0
  338. package/dist/multiset/multi-set.js.map +1 -0
  339. package/dist/ordered-range/iasync-ordered-range.d.ts +15 -0
  340. package/dist/ordered-range/iasync-ordered-range.d.ts.map +1 -0
  341. package/dist/ordered-range/iasync-ordered-range.js +2 -0
  342. package/dist/ordered-range/iasync-ordered-range.js.map +1 -0
  343. package/dist/ordered-range/iordered-range.d.ts +28 -0
  344. package/dist/ordered-range/iordered-range.d.ts.map +1 -0
  345. package/dist/ordered-range/iordered-range.js +2 -0
  346. package/dist/ordered-range/iordered-range.js.map +1 -0
  347. package/dist/priority-queue/blocking-priority-queue.d.ts +37 -0
  348. package/dist/priority-queue/blocking-priority-queue.d.ts.map +1 -0
  349. package/dist/priority-queue/blocking-priority-queue.js +87 -0
  350. package/dist/priority-queue/blocking-priority-queue.js.map +1 -0
  351. package/dist/priority-queue/bounded-priority-queue.d.ts +45 -0
  352. package/dist/priority-queue/bounded-priority-queue.d.ts.map +1 -0
  353. package/dist/priority-queue/bounded-priority-queue.js +71 -0
  354. package/dist/priority-queue/bounded-priority-queue.js.map +1 -0
  355. package/dist/priority-queue/iasync-lossy-priority-queue.d.ts +9 -0
  356. package/dist/priority-queue/iasync-lossy-priority-queue.d.ts.map +1 -0
  357. package/dist/priority-queue/iasync-lossy-priority-queue.js +2 -0
  358. package/dist/priority-queue/iasync-lossy-priority-queue.js.map +1 -0
  359. package/dist/priority-queue/iasync-priority-queue.d.ts +21 -0
  360. package/dist/priority-queue/iasync-priority-queue.d.ts.map +1 -0
  361. package/dist/priority-queue/iasync-priority-queue.js +2 -0
  362. package/dist/priority-queue/iasync-priority-queue.js.map +1 -0
  363. package/dist/priority-queue/ilossy-priority-queue.d.ts +29 -0
  364. package/dist/priority-queue/ilossy-priority-queue.d.ts.map +1 -0
  365. package/dist/priority-queue/ilossy-priority-queue.js +2 -0
  366. package/dist/priority-queue/ilossy-priority-queue.js.map +1 -0
  367. package/dist/priority-queue/ipriority-queue.d.ts +71 -0
  368. package/dist/priority-queue/ipriority-queue.d.ts.map +1 -0
  369. package/dist/priority-queue/ipriority-queue.js +2 -0
  370. package/dist/priority-queue/ipriority-queue.js.map +1 -0
  371. package/dist/priority-queue/iwaitable-priority-queue.d.ts +27 -0
  372. package/dist/priority-queue/iwaitable-priority-queue.d.ts.map +1 -0
  373. package/dist/priority-queue/iwaitable-priority-queue.js +2 -0
  374. package/dist/priority-queue/iwaitable-priority-queue.js.map +1 -0
  375. package/dist/priority-queue/priority-queue.d.ts +49 -0
  376. package/dist/priority-queue/priority-queue.d.ts.map +1 -0
  377. package/dist/priority-queue/priority-queue.js +134 -0
  378. package/dist/priority-queue/priority-queue.js.map +1 -0
  379. package/dist/probabilistic/bloom-filter.d.ts +92 -0
  380. package/dist/probabilistic/bloom-filter.d.ts.map +1 -0
  381. package/dist/probabilistic/bloom-filter.js +156 -0
  382. package/dist/probabilistic/bloom-filter.js.map +1 -0
  383. package/dist/probabilistic/count-min-sketch.d.ts +76 -0
  384. package/dist/probabilistic/count-min-sketch.d.ts.map +1 -0
  385. package/dist/probabilistic/count-min-sketch.js +119 -0
  386. package/dist/probabilistic/count-min-sketch.js.map +1 -0
  387. package/dist/probabilistic/cuckoo-filter.d.ts +106 -0
  388. package/dist/probabilistic/cuckoo-filter.d.ts.map +1 -0
  389. package/dist/probabilistic/cuckoo-filter.js +214 -0
  390. package/dist/probabilistic/cuckoo-filter.js.map +1 -0
  391. package/dist/probabilistic/hash32.d.ts +28 -0
  392. package/dist/probabilistic/hash32.d.ts.map +1 -0
  393. package/dist/probabilistic/hash32.js +2 -0
  394. package/dist/probabilistic/hash32.js.map +1 -0
  395. package/dist/probabilistic/hyper-log-log.d.ts +74 -0
  396. package/dist/probabilistic/hyper-log-log.d.ts.map +1 -0
  397. package/dist/probabilistic/hyper-log-log.js +134 -0
  398. package/dist/probabilistic/hyper-log-log.js.map +1 -0
  399. package/dist/probabilistic/top-k.d.ts +62 -0
  400. package/dist/probabilistic/top-k.d.ts.map +1 -0
  401. package/dist/probabilistic/top-k.js +104 -0
  402. package/dist/probabilistic/top-k.js.map +1 -0
  403. package/dist/queue/blocking-queue.d.ts +32 -0
  404. package/dist/queue/blocking-queue.d.ts.map +1 -0
  405. package/dist/queue/blocking-queue.js +70 -0
  406. package/dist/queue/blocking-queue.js.map +1 -0
  407. package/dist/queue/bounded-queue.d.ts +47 -0
  408. package/dist/queue/bounded-queue.d.ts.map +1 -0
  409. package/dist/queue/bounded-queue.js +64 -0
  410. package/dist/queue/bounded-queue.js.map +1 -0
  411. package/dist/queue/iasync-lossy-queue.d.ts +15 -0
  412. package/dist/queue/iasync-lossy-queue.d.ts.map +1 -0
  413. package/dist/queue/iasync-lossy-queue.js +2 -0
  414. package/dist/queue/iasync-lossy-queue.js.map +1 -0
  415. package/dist/queue/iasync-queue.d.ts +17 -0
  416. package/dist/queue/iasync-queue.d.ts.map +1 -0
  417. package/dist/queue/iasync-queue.js +2 -0
  418. package/dist/queue/iasync-queue.js.map +1 -0
  419. package/dist/queue/ilossy-queue.d.ts +28 -0
  420. package/dist/queue/ilossy-queue.d.ts.map +1 -0
  421. package/dist/queue/ilossy-queue.js +2 -0
  422. package/dist/queue/ilossy-queue.js.map +1 -0
  423. package/dist/queue/iqueue-storage.d.ts +5 -0
  424. package/dist/queue/iqueue-storage.d.ts.map +1 -0
  425. package/dist/queue/iqueue-storage.js +2 -0
  426. package/dist/queue/iqueue-storage.js.map +1 -0
  427. package/dist/queue/iqueue.d.ts +41 -0
  428. package/dist/queue/iqueue.d.ts.map +1 -0
  429. package/dist/queue/iqueue.js +2 -0
  430. package/dist/queue/iqueue.js.map +1 -0
  431. package/dist/queue/iwaitable-queue.d.ts +27 -0
  432. package/dist/queue/iwaitable-queue.d.ts.map +1 -0
  433. package/dist/queue/iwaitable-queue.js +2 -0
  434. package/dist/queue/iwaitable-queue.js.map +1 -0
  435. package/dist/queue/lossy-queue.d.ts +33 -0
  436. package/dist/queue/lossy-queue.d.ts.map +1 -0
  437. package/dist/queue/lossy-queue.js +75 -0
  438. package/dist/queue/lossy-queue.js.map +1 -0
  439. package/dist/queue/queue.d.ts +27 -0
  440. package/dist/queue/queue.d.ts.map +1 -0
  441. package/dist/queue/queue.js +43 -0
  442. package/dist/queue/queue.js.map +1 -0
  443. package/dist/set/enhanced-set.d.ts +68 -0
  444. package/dist/set/enhanced-set.d.ts.map +1 -0
  445. package/dist/set/enhanced-set.js +169 -0
  446. package/dist/set/enhanced-set.js.map +1 -0
  447. package/dist/set/iasync-replacing-set.d.ts +8 -0
  448. package/dist/set/iasync-replacing-set.d.ts.map +1 -0
  449. package/dist/set/iasync-replacing-set.js +2 -0
  450. package/dist/set/iasync-replacing-set.js.map +1 -0
  451. package/dist/set/iasync-set.d.ts +16 -0
  452. package/dist/set/iasync-set.d.ts.map +1 -0
  453. package/dist/set/iasync-set.js +2 -0
  454. package/dist/set/iasync-set.js.map +1 -0
  455. package/dist/set/iasync-sorted-set.d.ts +7 -0
  456. package/dist/set/iasync-sorted-set.d.ts.map +1 -0
  457. package/dist/set/iasync-sorted-set.js +2 -0
  458. package/dist/set/iasync-sorted-set.js.map +1 -0
  459. package/dist/set/ireplacing-set.d.ts +24 -0
  460. package/dist/set/ireplacing-set.d.ts.map +1 -0
  461. package/dist/set/ireplacing-set.js +2 -0
  462. package/dist/set/ireplacing-set.js.map +1 -0
  463. package/dist/set/iset.d.ts +30 -0
  464. package/dist/set/iset.d.ts.map +1 -0
  465. package/dist/set/iset.js +2 -0
  466. package/dist/set/iset.js.map +1 -0
  467. package/dist/set/isorted-set.d.ts +7 -0
  468. package/dist/set/isorted-set.d.ts.map +1 -0
  469. package/dist/set/isorted-set.js +2 -0
  470. package/dist/set/isorted-set.js.map +1 -0
  471. package/dist/similarity/iasync-similarity-index.d.ts +8 -0
  472. package/dist/similarity/iasync-similarity-index.d.ts.map +1 -0
  473. package/dist/similarity/iasync-similarity-index.js +2 -0
  474. package/dist/similarity/iasync-similarity-index.js.map +1 -0
  475. package/dist/similarity/isimilarity-index.d.ts +8 -0
  476. package/dist/similarity/isimilarity-index.d.ts.map +1 -0
  477. package/dist/similarity/isimilarity-index.js +2 -0
  478. package/dist/similarity/isimilarity-index.js.map +1 -0
  479. package/dist/similarity/vp-tree.d.ts +71 -0
  480. package/dist/similarity/vp-tree.d.ts.map +1 -0
  481. package/dist/similarity/vp-tree.js +172 -0
  482. package/dist/similarity/vp-tree.js.map +1 -0
  483. package/dist/stack/blocking-stack.d.ts +30 -0
  484. package/dist/stack/blocking-stack.d.ts.map +1 -0
  485. package/dist/stack/blocking-stack.js +68 -0
  486. package/dist/stack/blocking-stack.js.map +1 -0
  487. package/dist/stack/bounded-stack.d.ts +38 -0
  488. package/dist/stack/bounded-stack.d.ts.map +1 -0
  489. package/dist/stack/bounded-stack.js +55 -0
  490. package/dist/stack/bounded-stack.js.map +1 -0
  491. package/dist/stack/iasync-lossy-stack.d.ts +9 -0
  492. package/dist/stack/iasync-lossy-stack.d.ts.map +1 -0
  493. package/dist/stack/iasync-lossy-stack.js +2 -0
  494. package/dist/stack/iasync-lossy-stack.js.map +1 -0
  495. package/dist/stack/iasync-stack.d.ts +15 -0
  496. package/dist/stack/iasync-stack.d.ts.map +1 -0
  497. package/dist/stack/iasync-stack.js +2 -0
  498. package/dist/stack/iasync-stack.js.map +1 -0
  499. package/dist/stack/ilossy-stack.d.ts +28 -0
  500. package/dist/stack/ilossy-stack.d.ts.map +1 -0
  501. package/dist/stack/ilossy-stack.js +2 -0
  502. package/dist/stack/ilossy-stack.js.map +1 -0
  503. package/dist/stack/istack-storage.d.ts +5 -0
  504. package/dist/stack/istack-storage.d.ts.map +1 -0
  505. package/dist/stack/istack-storage.js +2 -0
  506. package/dist/stack/istack-storage.js.map +1 -0
  507. package/dist/stack/istack.d.ts +41 -0
  508. package/dist/stack/istack.d.ts.map +1 -0
  509. package/dist/stack/istack.js +2 -0
  510. package/dist/stack/istack.js.map +1 -0
  511. package/dist/stack/iwaitable-stack.d.ts +26 -0
  512. package/dist/stack/iwaitable-stack.d.ts.map +1 -0
  513. package/dist/stack/iwaitable-stack.js +2 -0
  514. package/dist/stack/iwaitable-stack.js.map +1 -0
  515. package/dist/stack/stack.d.ts +26 -0
  516. package/dist/stack/stack.d.ts.map +1 -0
  517. package/dist/stack/stack.js +42 -0
  518. package/dist/stack/stack.js.map +1 -0
  519. package/dist/storage/iindexed-storage.d.ts +8 -0
  520. package/dist/storage/iindexed-storage.d.ts.map +1 -0
  521. package/dist/storage/iindexed-storage.js +2 -0
  522. package/dist/storage/iindexed-storage.js.map +1 -0
  523. package/dist/storage/ipop-back-storage.d.ts +8 -0
  524. package/dist/storage/ipop-back-storage.d.ts.map +1 -0
  525. package/dist/storage/ipop-back-storage.js +2 -0
  526. package/dist/storage/ipop-back-storage.js.map +1 -0
  527. package/dist/storage/ipop-front-storage.d.ts +8 -0
  528. package/dist/storage/ipop-front-storage.d.ts.map +1 -0
  529. package/dist/storage/ipop-front-storage.js +2 -0
  530. package/dist/storage/ipop-front-storage.js.map +1 -0
  531. package/dist/storage/ipush-back-storage.d.ts +7 -0
  532. package/dist/storage/ipush-back-storage.d.ts.map +1 -0
  533. package/dist/storage/ipush-back-storage.js +2 -0
  534. package/dist/storage/ipush-back-storage.js.map +1 -0
  535. package/dist/storage/ipush-front-storage.d.ts +7 -0
  536. package/dist/storage/ipush-front-storage.d.ts.map +1 -0
  537. package/dist/storage/ipush-front-storage.js +2 -0
  538. package/dist/storage/ipush-front-storage.js.map +1 -0
  539. package/dist/storage/istorage.d.ts +13 -0
  540. package/dist/storage/istorage.d.ts.map +1 -0
  541. package/dist/storage/istorage.js +2 -0
  542. package/dist/storage/istorage.js.map +1 -0
  543. package/dist/storage/ring-vector.d.ts +59 -0
  544. package/dist/storage/ring-vector.d.ts.map +1 -0
  545. package/dist/storage/ring-vector.js +192 -0
  546. package/dist/storage/ring-vector.js.map +1 -0
  547. package/dist/storage/segmented-ring-vector.d.ts +42 -0
  548. package/dist/storage/segmented-ring-vector.d.ts.map +1 -0
  549. package/dist/storage/segmented-ring-vector.js +142 -0
  550. package/dist/storage/segmented-ring-vector.js.map +1 -0
  551. package/dist/storage/typed-vector.d.ts +67 -0
  552. package/dist/storage/typed-vector.d.ts.map +1 -0
  553. package/dist/storage/typed-vector.js +123 -0
  554. package/dist/storage/typed-vector.js.map +1 -0
  555. package/dist/substring/generalized-suffix-array.d.ts +43 -0
  556. package/dist/substring/generalized-suffix-array.d.ts.map +1 -0
  557. package/dist/substring/generalized-suffix-array.js +100 -0
  558. package/dist/substring/generalized-suffix-array.js.map +1 -0
  559. package/dist/substring/iasync-substring-index.d.ts +6 -0
  560. package/dist/substring/iasync-substring-index.d.ts.map +1 -0
  561. package/dist/substring/iasync-substring-index.js +2 -0
  562. package/dist/substring/iasync-substring-index.js.map +1 -0
  563. package/dist/substring/isubstring-index.d.ts +6 -0
  564. package/dist/substring/isubstring-index.d.ts.map +1 -0
  565. package/dist/substring/isubstring-index.js +2 -0
  566. package/dist/substring/isubstring-index.js.map +1 -0
  567. package/dist/substring/suffix-array.d.ts +45 -0
  568. package/dist/substring/suffix-array.d.ts.map +1 -0
  569. package/dist/substring/suffix-array.js +164 -0
  570. package/dist/substring/suffix-array.js.map +1 -0
  571. package/dist/tree/avl-tree.d.ts +43 -0
  572. package/dist/tree/avl-tree.d.ts.map +1 -0
  573. package/dist/tree/avl-tree.js +98 -0
  574. package/dist/tree/avl-tree.js.map +1 -0
  575. package/dist/tree/binary-search-tree.d.ts +94 -0
  576. package/dist/tree/binary-search-tree.d.ts.map +1 -0
  577. package/dist/tree/binary-search-tree.js +303 -0
  578. package/dist/tree/binary-search-tree.js.map +1 -0
  579. package/dist/tree/iavl-tree-node.d.ts +6 -0
  580. package/dist/tree/iavl-tree-node.d.ts.map +1 -0
  581. package/dist/tree/iavl-tree-node.js +2 -0
  582. package/dist/tree/iavl-tree-node.js.map +1 -0
  583. package/dist/tree/isearch-tree.d.ts +14 -0
  584. package/dist/tree/isearch-tree.d.ts.map +1 -0
  585. package/dist/tree/isearch-tree.js +2 -0
  586. package/dist/tree/isearch-tree.js.map +1 -0
  587. package/dist/trie/iasync-trie.d.ts +9 -0
  588. package/dist/trie/iasync-trie.d.ts.map +1 -0
  589. package/dist/trie/iasync-trie.js +2 -0
  590. package/dist/trie/iasync-trie.js.map +1 -0
  591. package/dist/trie/itrie.d.ts +9 -0
  592. package/dist/trie/itrie.d.ts.map +1 -0
  593. package/dist/trie/itrie.js +2 -0
  594. package/dist/trie/itrie.js.map +1 -0
  595. package/dist/trie/trie.d.ts +93 -0
  596. package/dist/trie/trie.d.ts.map +1 -0
  597. package/dist/trie/trie.js +190 -0
  598. package/dist/trie/trie.js.map +1 -0
  599. package/package.json +63 -0
@@ -0,0 +1,32 @@
1
+ import type { DefinedValue } from "@ac-kit/core";
2
+ import { BoundedOptions } from "../collection/ibounded.js";
3
+ import { IQueueStorage } from "../queue/iqueue-storage.js";
4
+ import { IWaitableQueue } from "./iwaitable-queue.js";
5
+ export type BlockingQueueOptions<T extends DefinedValue> = BoundedOptions<IQueueStorage<T>>;
6
+ /**
7
+ * A FIFO queue that holds at most `capacity` items, and whose `waitEnqueue`
8
+ * suspends until room frees up instead of throwing.
9
+ *
10
+ * `enqueue` still throws — this type adds a way to wait, it does not change the
11
+ * way to fail. A `capacity` of `0` is legal and never grants room: every
12
+ * `waitEnqueue` blocks until a consumer is there to take the item, which is the
13
+ * rendezvous semantics `@ac-kit/async`'s `Channel` is built on.
14
+ *
15
+ * @template T The type of elements in the queue.
16
+ */
17
+ export declare class BlockingQueue<T extends DefinedValue> implements IWaitableQueue<T> {
18
+ private readonly inner;
19
+ private readonly semaphore;
20
+ readonly capacity: number;
21
+ constructor(iterable: Iterable<T> | undefined, options: BlockingQueueOptions<T>);
22
+ [Symbol.iterator](): Iterator<T>;
23
+ clear(): void;
24
+ count(): number;
25
+ enqueue(item: T): void;
26
+ enqueueAll(items: readonly T[]): void;
27
+ waitEnqueue(item: T, signal?: AbortSignal | null): Promise<void>;
28
+ waitEnqueueAll(items: Iterable<T>, signal?: AbortSignal | null): Promise<void>;
29
+ dequeue(): T | undefined;
30
+ front(): T | undefined;
31
+ }
32
+ //# sourceMappingURL=blocking-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocking-queue.d.ts","sourceRoot":"","sources":["../../src/queue/blocking-queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,YAAY,IAAI,cAAc,CACxE,aAAa,CAAC,CAAC,CAAC,CAChB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,qBAAa,aAAa,CACzB,CAAC,SAAS,YAAY,CACrB,YAAW,cAAc,CAAC,CAAC,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,YACC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,EACjC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAUhC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAE/B;IAED,KAAK,IAAI,IAAI,CAKZ;IAED,KAAK,IAAI,MAAM,CAEd;IAED,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAGrB;IAED,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAOpC;IAEK,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAGrE;IAEK,cAAc,CACnB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GACzB,OAAO,CAAC,IAAI,CAAC,CASf;IAED,OAAO,IAAI,CAAC,GAAG,SAAS,CAQvB;IAED,KAAK,IAAI,CAAC,GAAG,SAAS,CAErB;CACD"}
@@ -0,0 +1,70 @@
1
+ import { resolveBoundedCapacity } from "../collection/_bounded.js";
2
+ import { CapacitySemaphore } from "../collection/_capacity-semaphore.js";
3
+ import { Queue } from "./queue.js";
4
+ /**
5
+ * A FIFO queue that holds at most `capacity` items, and whose `waitEnqueue`
6
+ * suspends until room frees up instead of throwing.
7
+ *
8
+ * `enqueue` still throws — this type adds a way to wait, it does not change the
9
+ * way to fail. A `capacity` of `0` is legal and never grants room: every
10
+ * `waitEnqueue` blocks until a consumer is there to take the item, which is the
11
+ * rendezvous semantics `@ac-kit/async`'s `Channel` is built on.
12
+ *
13
+ * @template T The type of elements in the queue.
14
+ */
15
+ export class BlockingQueue {
16
+ inner;
17
+ semaphore;
18
+ capacity;
19
+ constructor(iterable, options) {
20
+ const items = iterable ? Array.from(iterable) : [];
21
+ this.capacity = resolveBoundedCapacity(items.length, options);
22
+ this.inner = new Queue(items, { storage: options.storage });
23
+ this.semaphore = new CapacitySemaphore(this.capacity, this.capacity - items.length);
24
+ }
25
+ [Symbol.iterator]() {
26
+ return this.inner[Symbol.iterator]();
27
+ }
28
+ clear() {
29
+ const count = this.inner.count();
30
+ this.inner.clear();
31
+ this.semaphore.release(count);
32
+ }
33
+ count() {
34
+ return this.inner.count();
35
+ }
36
+ enqueue(item) {
37
+ this.semaphore.tryAcquireOrThrow(1);
38
+ this.inner.enqueue(item);
39
+ }
40
+ enqueueAll(items) {
41
+ if (items.length === 0) {
42
+ return;
43
+ }
44
+ this.semaphore.tryAcquireOrThrow(items.length);
45
+ this.inner.enqueueAll(items);
46
+ }
47
+ async waitEnqueue(item, signal) {
48
+ await this.semaphore.acquire(1, signal);
49
+ this.inner.enqueue(item);
50
+ }
51
+ async waitEnqueueAll(items, signal) {
52
+ const itemsArray = Array.from(items);
53
+ if (itemsArray.length === 0) {
54
+ return;
55
+ }
56
+ await this.semaphore.acquire(itemsArray.length, signal);
57
+ this.inner.enqueueAll(itemsArray);
58
+ }
59
+ dequeue() {
60
+ const item = this.inner.dequeue();
61
+ if (item !== undefined) {
62
+ this.semaphore.release(1);
63
+ }
64
+ return item;
65
+ }
66
+ front() {
67
+ return this.inner.front();
68
+ }
69
+ }
70
+ //# sourceMappingURL=blocking-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocking-queue.js","sourceRoot":"","sources":["../../src/queue/blocking-queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAIzE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAMnC;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAa;IAGR,KAAK,CAAW;IAChB,SAAS,CAAoB;IACrC,QAAQ,CAAS;IAE1B,YACC,QAAiC,EACjC,OAAgC;QAEhC,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEnD,IAAI,CAAC,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAI,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,IAAI,CAAC,SAAS,GAAG,IAAI,iBAAiB,CACrC,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAC5B,CAAC;IACH,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtC,CAAC;IAED,KAAK;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAEjC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,CAAC,IAAO;QACd,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,UAAU,CAAC,KAAmB;QAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO;QACR,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAO,EAAE,MAA2B;QACrD,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,cAAc,CACnB,KAAkB,EAClB,MAA2B;QAE3B,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAErC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO;QACR,CAAC;QAED,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACN,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAElC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED,KAAK;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACD"}
@@ -0,0 +1,47 @@
1
+ import type { DefinedValue } from "@ac-kit/core";
2
+ import { BoundedOptions, IBounded } from "../collection/ibounded.js";
3
+ import { IQueueStorage } from "../queue/iqueue-storage.js";
4
+ import { IQueue } from "./iqueue.js";
5
+ export type BoundedQueueOptions<T extends DefinedValue> = BoundedOptions<IQueueStorage<T>>;
6
+ /**
7
+ * A FIFO queue that holds at most `capacity` items and throws once full.
8
+ *
9
+ * A fixed-size queue needs no class of its own — hand it a storage that already
10
+ * knows how big it is and the capacity follows:
11
+ *
12
+ * ```ts
13
+ * new BoundedQueue(undefined, {
14
+ * storage: new RingVector(undefined, { capacity: 1024 }),
15
+ * });
16
+ * ```
17
+ *
18
+ * @template T The type of elements in the queue.
19
+ */
20
+ export declare class BoundedQueue<T extends DefinedValue> implements IQueue<T>, IBounded {
21
+ private readonly inner;
22
+ readonly capacity: number;
23
+ constructor(iterable: Iterable<T> | undefined, options: BoundedQueueOptions<T>);
24
+ [Symbol.iterator](): Iterator<T>;
25
+ clear(): void;
26
+ count(): number;
27
+ /**
28
+ * Same as `IQueue.enqueue`, but throws once the queue is full.
29
+ *
30
+ * @throws {CollectionCapacityExceededError} If the operation would exceed the
31
+ * queue's capacity.
32
+ * @see IQueue.enqueue
33
+ */
34
+ enqueue(item: T): void;
35
+ /**
36
+ * Same as `IQueue.enqueueAll`, but throws once the queue is full. Nothing is
37
+ * added when it throws — the check is made against the whole batch.
38
+ *
39
+ * @throws {CollectionCapacityExceededError} If the operation would exceed the
40
+ * queue's capacity.
41
+ * @see IQueue.enqueueAll
42
+ */
43
+ enqueueAll(items: readonly T[]): void;
44
+ dequeue(): T | undefined;
45
+ front(): T | undefined;
46
+ }
47
+ //# sourceMappingURL=bounded-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounded-queue.d.ts","sourceRoot":"","sources":["../../src/queue/bounded-queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMjD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,YAAY,IAAI,cAAc,CACvE,aAAa,CAAC,CAAC,CAAC,CAChB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAY,CAAC,CAAC,SAAS,YAAY,CAC/C,YAAW,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ;IAE9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,YACC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,EACjC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAM/B;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAE/B;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,KAAK,IAAI,MAAM,CAEd;IAED;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAIrB;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAIpC;IAED,OAAO,IAAI,CAAC,GAAG,SAAS,CAEvB;IAED,KAAK,IAAI,CAAC,GAAG,SAAS,CAErB;CACD"}
@@ -0,0 +1,64 @@
1
+ import { checkCapacity, resolveBoundedCapacity, } from "../collection/_bounded.js";
2
+ import { Queue } from "./queue.js";
3
+ /**
4
+ * A FIFO queue that holds at most `capacity` items and throws once full.
5
+ *
6
+ * A fixed-size queue needs no class of its own — hand it a storage that already
7
+ * knows how big it is and the capacity follows:
8
+ *
9
+ * ```ts
10
+ * new BoundedQueue(undefined, {
11
+ * storage: new RingVector(undefined, { capacity: 1024 }),
12
+ * });
13
+ * ```
14
+ *
15
+ * @template T The type of elements in the queue.
16
+ */
17
+ export class BoundedQueue {
18
+ inner;
19
+ capacity;
20
+ constructor(iterable, options) {
21
+ const items = iterable ? Array.from(iterable) : [];
22
+ this.capacity = resolveBoundedCapacity(items.length, options);
23
+ this.inner = new Queue(items, { storage: options.storage });
24
+ }
25
+ [Symbol.iterator]() {
26
+ return this.inner[Symbol.iterator]();
27
+ }
28
+ clear() {
29
+ this.inner.clear();
30
+ }
31
+ count() {
32
+ return this.inner.count();
33
+ }
34
+ /**
35
+ * Same as `IQueue.enqueue`, but throws once the queue is full.
36
+ *
37
+ * @throws {CollectionCapacityExceededError} If the operation would exceed the
38
+ * queue's capacity.
39
+ * @see IQueue.enqueue
40
+ */
41
+ enqueue(item) {
42
+ checkCapacity(this.inner.count(), 1, this.capacity);
43
+ this.inner.enqueue(item);
44
+ }
45
+ /**
46
+ * Same as `IQueue.enqueueAll`, but throws once the queue is full. Nothing is
47
+ * added when it throws — the check is made against the whole batch.
48
+ *
49
+ * @throws {CollectionCapacityExceededError} If the operation would exceed the
50
+ * queue's capacity.
51
+ * @see IQueue.enqueueAll
52
+ */
53
+ enqueueAll(items) {
54
+ checkCapacity(this.inner.count(), items.length, this.capacity);
55
+ this.inner.enqueueAll(items);
56
+ }
57
+ dequeue() {
58
+ return this.inner.dequeue();
59
+ }
60
+ front() {
61
+ return this.inner.front();
62
+ }
63
+ }
64
+ //# sourceMappingURL=bounded-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounded-queue.js","sourceRoot":"","sources":["../../src/queue/bounded-queue.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,aAAa,EACb,sBAAsB,GACtB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAMnC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,YAAY;IAGP,KAAK,CAAW;IACxB,QAAQ,CAAS;IAE1B,YACC,QAAiC,EACjC,OAA+B;QAE/B,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEnD,IAAI,CAAC,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAI,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtC,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAED,KAAK;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,IAAO;QACd,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEpD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,KAAmB;QAC7B,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE/D,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACD"}
@@ -0,0 +1,15 @@
1
+ import { DefinedValue } from "@ac-kit/core";
2
+ import { ILossy } from "../collection/ilossy.js";
3
+ import { IAsyncQueue } from "./iasync-queue.js";
4
+ /**
5
+ * The async-backed sibling of {@link ILossyQueue}. Unlike blocking, eviction
6
+ * observability survives the collapse to async: `Promise<readonly T[]>` is
7
+ * genuinely different information from bare `Promise<void>` — the evicted items
8
+ * are real data, not just timing — so this sibling is legitimate where
9
+ * `IAsyncBlockingQueue` would not be.
10
+ */
11
+ export interface IAsyncLossyQueue<T extends DefinedValue = DefinedValue> extends Omit<IAsyncQueue<T>, "enqueue" | "enqueueAll">, ILossy {
12
+ enqueue(item: T, signal?: AbortSignal): Promise<readonly T[]>;
13
+ enqueueAll(items: Iterable<T>, signal?: AbortSignal): Promise<readonly T[]>;
14
+ }
15
+ //# sourceMappingURL=iasync-lossy-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iasync-lossy-queue.d.ts","sourceRoot":"","sources":["../../src/queue/iasync-lossy-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CACtE,SAAQ,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC,EAAE,MAAM;IAC9D,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAE9D,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CAC5E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=iasync-lossy-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iasync-lossy-queue.js","sourceRoot":"","sources":["../../src/queue/iasync-lossy-queue.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { DefinedValue } from "@ac-kit/core";
2
+ import { IAsyncCollection } from "../collection/iasync-collection.js";
3
+ /**
4
+ * The async-backed sibling of {@link IQueue}. No `IAsyncBlockingQueue`: the
5
+ * sync `IQueue`/`IWaitableQueue` split exists only because a synchronous
6
+ * function cannot suspend (`enqueue` throws, `waitEnqueue` awaits instead) —
7
+ * but every async-backed method already returns a `Promise`, so "reject fast"
8
+ * and "wait" collapse to the exact same `Promise<void>` shape. A separate
9
+ * `IAsyncBlockingQueue` would be a redundant type identical to this one.
10
+ */
11
+ export interface IAsyncQueue<T extends DefinedValue = DefinedValue> extends IAsyncCollection<T> {
12
+ enqueue(item: T, signal?: AbortSignal): Promise<void>;
13
+ enqueueAll(items: Iterable<T>, signal?: AbortSignal): Promise<void>;
14
+ dequeue(signal?: AbortSignal): Promise<T | undefined>;
15
+ front(signal?: AbortSignal): Promise<T | undefined>;
16
+ }
17
+ //# sourceMappingURL=iasync-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iasync-queue.d.ts","sourceRoot":"","sources":["../../src/queue/iasync-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW,CAC3B,CAAC,SAAS,YAAY,GAAG,YAAY,CACpC,SAAQ,gBAAgB,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAEtD,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CACpD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=iasync-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iasync-queue.js","sourceRoot":"","sources":["../../src/queue/iasync-queue.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ import { DefinedValue } from "@ac-kit/core";
2
+ import { ILossy } from "../collection/ilossy.js";
3
+ import { IQueue } from "./iqueue.js";
4
+ /**
5
+ * The lossy sibling of {@link IQueue}: never throws or waits when a bounded
6
+ * queue is full, evicting or skipping instead (`overflowPolicy`).
7
+ *
8
+ * `"evict"` drops the front (oldest) item to make room — the same victim
9
+ * Python's `deque(maxlen=N)` and Boost's `circular_buffer` pick, and the only
10
+ * meaningful choice for a FIFO structure.
11
+ */
12
+ export interface ILossyQueue<T extends DefinedValue = DefinedValue> extends IQueue<T>, ILossy {
13
+ /**
14
+ * Same as `IQueue.enqueue`, but never throws — returns the items dropped to
15
+ * make room (empty if nothing was dropped).
16
+ *
17
+ * @see IQueue.enqueue
18
+ */
19
+ enqueue(item: T): readonly T[];
20
+ /**
21
+ * Same as `IQueue.enqueueAll`, but never throws — returns the items dropped
22
+ * to make room (empty if nothing was dropped).
23
+ *
24
+ * @see IQueue.enqueueAll
25
+ */
26
+ enqueueAll(items: readonly T[]): readonly T[];
27
+ }
28
+ //# sourceMappingURL=ilossy-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ilossy-queue.d.ts","sourceRoot":"","sources":["../../src/queue/ilossy-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CACjE,SAAQ,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM;IACzB;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;IAE/B;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC;CAC9C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ilossy-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ilossy-queue.js","sourceRoot":"","sources":["../../src/queue/ilossy-queue.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { DefinedValue } from "@ac-kit/core";
2
+ import { IPopFrontStorage } from "../storage/ipop-front-storage.js";
3
+ import { IPushBackStorage } from "../storage/ipush-back-storage.js";
4
+ export type IQueueStorage<T extends DefinedValue> = IPushBackStorage<T> & IPopFrontStorage<T>;
5
+ //# sourceMappingURL=iqueue-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iqueue-storage.d.ts","sourceRoot":"","sources":["../../src/queue/iqueue-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,YAAY,IAAI,gBAAgB,CAAC,CAAC,CAAC,GACtE,gBAAgB,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=iqueue-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iqueue-storage.js","sourceRoot":"","sources":["../../src/queue/iqueue-storage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ import type { DefinedValue } from "@ac-kit/core";
2
+ import { ICollection } from "../collection/icollection.js";
3
+ /**
4
+ * Interface representing a FIFO (First In First Out) queue.
5
+ *
6
+ * A queue is a collection that follows the First In First Out (FIFO) principle,
7
+ * where the first item added to the queue is the first one to be removed.
8
+ *
9
+ * @template T The type of elements in the queue. Anything except `undefined`,
10
+ * which means "no element".
11
+ */
12
+ export interface IQueue<T extends DefinedValue = DefinedValue> extends ICollection<T> {
13
+ /**
14
+ * Adds an item to the rear of the queue.
15
+ *
16
+ * @param item The item to add to the queue.
17
+ */
18
+ enqueue(item: T): void;
19
+ /**
20
+ * Adds every item to the rear of the queue, in array order, so the last one
21
+ * is the last to be dequeued.
22
+ *
23
+ * @param items The items to add to the queue.
24
+ */
25
+ enqueueAll(items: readonly T[]): void;
26
+ /**
27
+ * Removes and returns the item at the front of the queue.
28
+ *
29
+ * @returns The item at the front of the queue, or `undefined` if the queue is
30
+ * empty.
31
+ */
32
+ dequeue(): T | undefined;
33
+ /**
34
+ * Returns the item at the front of the queue without removing it.
35
+ *
36
+ * @returns The item at the front of the queue, or `undefined` if the queue is
37
+ * empty.
38
+ */
39
+ front(): T | undefined;
40
+ }
41
+ //# sourceMappingURL=iqueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iqueue.d.ts","sourceRoot":"","sources":["../../src/queue/iqueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,WAAW,MAAM,CACtB,CAAC,SAAS,YAAY,GAAG,YAAY,CACpC,SAAQ,WAAW,CAAC,CAAC,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAEvB;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;IAEtC;;;;;OAKG;IACH,OAAO,IAAI,CAAC,GAAG,SAAS,CAAC;IAEzB;;;;;OAKG;IACH,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=iqueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iqueue.js","sourceRoot":"","sources":["../../src/queue/iqueue.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import { DefinedValue } from "@ac-kit/core";
2
+ import { IBounded } from "../collection/ibounded.js";
3
+ import { IQueue } from "./iqueue.js";
4
+ /**
5
+ * The blocking sibling of {@link IQueue}: waits for capacity instead of throwing
6
+ * when the queue is full. The inherited `enqueue` throws — this adds a way to
7
+ * wait, it does not change the way to fail.
8
+ */
9
+ export interface IWaitableQueue<T extends DefinedValue = DefinedValue> extends IQueue<T>, IBounded {
10
+ /**
11
+ * Same as `enqueue`, but waits for capacity if the operation would exceed it.
12
+ *
13
+ * @param signal Optional abort signal to cancel the operation.
14
+ * @see IQueue.enqueue
15
+ */
16
+ waitEnqueue(item: T, signal?: AbortSignal | null): Promise<void>;
17
+ /**
18
+ * Same as `enqueueAll`, but waits for capacity if the operation would exceed
19
+ * it. The whole batch lands at once, never interleaved with another
20
+ * waiter's.
21
+ *
22
+ * @param signal Optional abort signal to cancel the operation.
23
+ * @see IQueue.enqueueAll
24
+ */
25
+ waitEnqueueAll(items: Iterable<T>, signal?: AbortSignal | null): Promise<void>;
26
+ }
27
+ //# sourceMappingURL=iwaitable-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iwaitable-queue.d.ts","sourceRoot":"","sources":["../../src/queue/iwaitable-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;GAIG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CACpE,SAAQ,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ;IAC3B;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE;;;;;;;OAOG;IACH,cAAc,CACb,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GACzB,OAAO,CAAC,IAAI,CAAC,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=iwaitable-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iwaitable-queue.js","sourceRoot":"","sources":["../../src/queue/iwaitable-queue.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import { type DefinedValue } from "@ac-kit/core";
2
+ import { OverflowPolicy } from "../collection/ilossy.js";
3
+ import { IQueueStorage } from "../queue/iqueue-storage.js";
4
+ import { ILossyQueue } from "./ilossy-queue.js";
5
+ export type LossyQueueOptions<T extends DefinedValue> = {
6
+ capacity: number;
7
+ overflowPolicy?: OverflowPolicy;
8
+ storage?: IQueueStorage<T>;
9
+ };
10
+ /**
11
+ * A FIFO queue that never throws or waits on an over-capacity `enqueue`,
12
+ * evicting the front (oldest) item — or skipping the incoming one — instead.
13
+ *
14
+ * `capacity` has no default: an unbounded lossy queue can never fill up, so
15
+ * `overflowPolicy` would never apply, defeating the entire point of this type.
16
+ * A caller wanting an unbounded FIFO should use {@link Queue}.
17
+ *
18
+ * @template T The type of elements in the queue.
19
+ */
20
+ export declare class LossyQueue<T extends DefinedValue> implements ILossyQueue<T> {
21
+ private readonly storage;
22
+ readonly capacity: number;
23
+ readonly overflowPolicy: OverflowPolicy;
24
+ constructor(iterable: Iterable<T> | undefined, options: LossyQueueOptions<T>);
25
+ [Symbol.iterator](): Iterator<T>;
26
+ clear(): void;
27
+ count(): number;
28
+ enqueue(item: T): readonly T[];
29
+ enqueueAll(items: readonly T[]): readonly T[];
30
+ dequeue(): T | undefined;
31
+ front(): T | undefined;
32
+ }
33
+ //# sourceMappingURL=lossy-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lossy-queue.d.ts","sourceRoot":"","sources":["../../src/queue/lossy-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,YAAY,IAAI;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;GASG;AACH,qBAAa,UAAU,CAAC,CAAC,SAAS,YAAY,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAExC,YACC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,EACjC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAa7B;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAE/B;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,KAAK,IAAI,MAAM,CAEd;IAED,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAc7B;IAED,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAsB5C;IAED,OAAO,IAAI,CAAC,GAAG,SAAS,CAEvB;IAED,KAAK,IAAI,CAAC,GAAG,SAAS,CAErB;CACD"}
@@ -0,0 +1,75 @@
1
+ import { isFinitePositive } from "@ac-kit/core";
2
+ import { RingVector } from "../storage/ring-vector.js";
3
+ const NOTHING_EVICTED = Object.freeze([]);
4
+ /**
5
+ * A FIFO queue that never throws or waits on an over-capacity `enqueue`,
6
+ * evicting the front (oldest) item — or skipping the incoming one — instead.
7
+ *
8
+ * `capacity` has no default: an unbounded lossy queue can never fill up, so
9
+ * `overflowPolicy` would never apply, defeating the entire point of this type.
10
+ * A caller wanting an unbounded FIFO should use {@link Queue}.
11
+ *
12
+ * @template T The type of elements in the queue.
13
+ */
14
+ export class LossyQueue {
15
+ storage;
16
+ capacity;
17
+ overflowPolicy;
18
+ constructor(iterable, options) {
19
+ if (!isFinitePositive(options.capacity)) {
20
+ throw new RangeError("LossyQueue requires a positive capacity");
21
+ }
22
+ this.capacity = options.capacity;
23
+ this.overflowPolicy = options.overflowPolicy ?? "evict";
24
+ this.storage = options.storage ?? new RingVector();
25
+ if (iterable) {
26
+ this.enqueueAll(Array.from(iterable));
27
+ }
28
+ }
29
+ [Symbol.iterator]() {
30
+ return this.storage[Symbol.iterator]();
31
+ }
32
+ clear() {
33
+ this.storage.clear();
34
+ }
35
+ count() {
36
+ return this.storage.count();
37
+ }
38
+ enqueue(item) {
39
+ if (this.storage.count() < this.capacity) {
40
+ this.storage.pushBack(item);
41
+ return NOTHING_EVICTED;
42
+ }
43
+ if (this.overflowPolicy === "skip") {
44
+ return [item];
45
+ }
46
+ const droppedFront = this.storage.popFront();
47
+ this.storage.pushBack(item);
48
+ return droppedFront === undefined ? NOTHING_EVICTED : [droppedFront];
49
+ }
50
+ enqueueAll(items) {
51
+ let evicted;
52
+ for (let index = 0; index < items.length; index++) {
53
+ const item = items[index];
54
+ if (this.storage.count() >= this.capacity) {
55
+ if (this.overflowPolicy === "skip") {
56
+ (evicted ??= []).push(item);
57
+ continue;
58
+ }
59
+ const droppedFront = this.storage.popFront();
60
+ if (droppedFront !== undefined) {
61
+ (evicted ??= []).push(droppedFront);
62
+ }
63
+ }
64
+ this.storage.pushBack(item);
65
+ }
66
+ return evicted ?? NOTHING_EVICTED;
67
+ }
68
+ dequeue() {
69
+ return this.storage.popFront();
70
+ }
71
+ front() {
72
+ return this.storage.front();
73
+ }
74
+ }
75
+ //# sourceMappingURL=lossy-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lossy-queue.js","sourceRoot":"","sources":["../../src/queue/lossy-queue.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,27 @@
1
+ import type { DefinedValue } from "@ac-kit/core";
2
+ import { IQueueStorage } from "../queue/iqueue-storage.js";
3
+ import { IQueue } from "./iqueue.js";
4
+ export type QueueOptions<T extends DefinedValue> = {
5
+ storage?: IQueueStorage<T>;
6
+ };
7
+ /**
8
+ * An unbounded FIFO queue.
9
+ *
10
+ * For a capacity, use `BoundedQueue` (throws when full), `BlockingQueue`
11
+ * (waits) or `LossyQueue` (evicts) — one class per answer to "what happens when
12
+ * it is full", rather than one class with a flag.
13
+ *
14
+ * @template T The type of elements in the queue.
15
+ */
16
+ export declare class Queue<T extends DefinedValue> implements IQueue<T> {
17
+ private readonly storage;
18
+ constructor(iterable?: Iterable<T>, options?: QueueOptions<T>);
19
+ [Symbol.iterator](): Iterator<T>;
20
+ clear(): void;
21
+ count(): number;
22
+ enqueue(item: T): void;
23
+ enqueueAll(items: readonly T[]): void;
24
+ dequeue(): T | undefined;
25
+ front(): T | undefined;
26
+ }
27
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/queue/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,YAAY,IAAI;IAClD,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAC3B,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,KAAK,CAAC,CAAC,SAAS,YAAY,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;IAC9D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAE3C,YAAY,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAQ5D;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAE/B;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,KAAK,IAAI,MAAM,CAEd;IAED,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAErB;IAED,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAEpC;IAED,OAAO,IAAI,CAAC,GAAG,SAAS,CAEvB;IAED,KAAK,IAAI,CAAC,GAAG,SAAS,CAErB;CACD"}