@enspirit/bmg-js 1.0.1 → 1.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 (302) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +3 -2
  3. package/dist/AsyncRelation/Base.d.ts +47 -0
  4. package/dist/AsyncRelation/index.d.ts +25 -0
  5. package/dist/{src/Relation → Relation}/Memory.d.ts +46 -46
  6. package/dist/Relation/index.d.ts +1 -0
  7. package/dist/async/Relation/Base.d.ts +47 -0
  8. package/dist/async/Relation/index.d.ts +25 -0
  9. package/dist/async/operators/_helpers.d.ts +16 -0
  10. package/dist/async/operators/autowrap.d.ts +7 -0
  11. package/dist/async/operators/constants.d.ts +6 -0
  12. package/dist/async/operators/cross_product.d.ts +9 -0
  13. package/dist/async/operators/extend.d.ts +7 -0
  14. package/dist/async/operators/group.d.ts +7 -0
  15. package/dist/async/operators/image.d.ts +8 -0
  16. package/dist/async/operators/index.d.ts +28 -0
  17. package/dist/async/operators/intersect.d.ts +7 -0
  18. package/dist/async/operators/isEqual.d.ts +7 -0
  19. package/dist/async/operators/join.d.ts +7 -0
  20. package/dist/async/operators/left_join.d.ts +8 -0
  21. package/dist/async/operators/matching.d.ts +7 -0
  22. package/dist/async/operators/minus.d.ts +7 -0
  23. package/dist/async/operators/not_matching.d.ts +7 -0
  24. package/dist/async/operators/one.d.ts +6 -0
  25. package/dist/async/operators/prefix.d.ts +6 -0
  26. package/dist/async/operators/project.d.ts +10 -0
  27. package/dist/async/operators/rename.d.ts +6 -0
  28. package/dist/async/operators/restrict.d.ts +14 -0
  29. package/dist/async/operators/suffix.d.ts +6 -0
  30. package/dist/async/operators/summarize.d.ts +8 -0
  31. package/dist/async/operators/toArray.d.ts +5 -0
  32. package/dist/async/operators/transform.d.ts +9 -0
  33. package/dist/async/operators/ungroup.d.ts +7 -0
  34. package/dist/async/operators/union.d.ts +6 -0
  35. package/dist/async/operators/unwrap.d.ts +6 -0
  36. package/dist/async/operators/wrap.d.ts +6 -0
  37. package/dist/async/operators/yByX.d.ts +7 -0
  38. package/dist/async/types.d.ts +58 -0
  39. package/dist/async-operators/_helpers.d.ts +16 -0
  40. package/dist/async-operators/autowrap.d.ts +7 -0
  41. package/dist/async-operators/constants.d.ts +6 -0
  42. package/dist/async-operators/cross_product.d.ts +9 -0
  43. package/dist/async-operators/extend.d.ts +7 -0
  44. package/dist/async-operators/group.d.ts +7 -0
  45. package/dist/async-operators/image.d.ts +8 -0
  46. package/dist/async-operators/index.d.ts +28 -0
  47. package/dist/async-operators/intersect.d.ts +7 -0
  48. package/dist/async-operators/isEqual.d.ts +7 -0
  49. package/dist/async-operators/join.d.ts +7 -0
  50. package/dist/async-operators/left_join.d.ts +8 -0
  51. package/dist/async-operators/matching.d.ts +7 -0
  52. package/dist/async-operators/minus.d.ts +7 -0
  53. package/dist/async-operators/not_matching.d.ts +7 -0
  54. package/dist/async-operators/one.d.ts +6 -0
  55. package/dist/async-operators/prefix.d.ts +6 -0
  56. package/dist/async-operators/project.d.ts +10 -0
  57. package/dist/async-operators/rename.d.ts +6 -0
  58. package/dist/async-operators/restrict.d.ts +14 -0
  59. package/dist/async-operators/suffix.d.ts +6 -0
  60. package/dist/async-operators/summarize.d.ts +8 -0
  61. package/dist/async-operators/toArray.d.ts +5 -0
  62. package/dist/async-operators/transform.d.ts +9 -0
  63. package/dist/async-operators/ungroup.d.ts +7 -0
  64. package/dist/async-operators/union.d.ts +6 -0
  65. package/dist/async-operators/unwrap.d.ts +6 -0
  66. package/dist/async-operators/wrap.d.ts +6 -0
  67. package/dist/async-operators/yByX.d.ts +7 -0
  68. package/dist/async-types.d.ts +58 -0
  69. package/dist/async.d.ts +4 -0
  70. package/dist/bmg.cjs +1 -1
  71. package/dist/bmg.cjs.map +1 -1
  72. package/dist/bmg.modern.js +1 -1
  73. package/dist/bmg.modern.js.map +1 -1
  74. package/dist/bmg.module.js +1 -1
  75. package/dist/bmg.module.js.map +1 -1
  76. package/dist/bmg.umd.js +1 -1
  77. package/dist/bmg.umd.js.map +1 -1
  78. package/dist/index.d.ts +38 -1
  79. package/dist/lib-definitions.d.ts +1 -0
  80. package/dist/{src/operators → operators}/_helpers.d.ts +142 -142
  81. package/dist/{src/operators → operators}/allbut.d.ts +2 -2
  82. package/dist/{src/operators → operators}/autowrap.d.ts +2 -2
  83. package/dist/{src/operators → operators}/constants.d.ts +2 -2
  84. package/dist/{src/operators → operators}/cross_product.d.ts +3 -3
  85. package/dist/{src/operators → operators}/exclude.d.ts +2 -2
  86. package/dist/{src/operators → operators}/extend.d.ts +2 -2
  87. package/dist/{src/src/operators → operators}/group.d.ts +2 -2
  88. package/dist/{src/operators → operators}/image.d.ts +2 -2
  89. package/dist/operators/index.d.ts +1 -0
  90. package/dist/{src/src/operators → operators}/intersect.d.ts +2 -2
  91. package/dist/operators/isEqual.d.ts +1 -0
  92. package/dist/operators/isRelation.d.ts +2 -0
  93. package/dist/{src/operators → operators}/join.d.ts +2 -2
  94. package/dist/{src/operators → operators}/left_join.d.ts +2 -2
  95. package/dist/{src/src/operators → operators}/matching.d.ts +2 -2
  96. package/dist/{src/src/operators → operators}/minus.d.ts +2 -2
  97. package/dist/{src/src/operators → operators}/not_matching.d.ts +2 -2
  98. package/dist/{src/operators → operators}/one.d.ts +2 -2
  99. package/dist/{src/operators → operators}/prefix.d.ts +2 -2
  100. package/dist/{src/src/operators → operators}/project.d.ts +2 -2
  101. package/dist/{src/operators → operators}/rename.d.ts +2 -2
  102. package/dist/{src/operators → operators}/restrict.d.ts +2 -2
  103. package/dist/{src/operators → operators}/suffix.d.ts +2 -2
  104. package/dist/{src/operators → operators}/summarize.d.ts +2 -2
  105. package/dist/{src/operators → operators}/transform.d.ts +2 -2
  106. package/dist/{src/src/operators → operators}/ungroup.d.ts +2 -2
  107. package/dist/{src/operators → operators}/union.d.ts +2 -2
  108. package/dist/{src/operators → operators}/unwrap.d.ts +2 -2
  109. package/dist/{src/operators → operators}/wrap.d.ts +2 -2
  110. package/dist/{src/operators → operators}/yByX.d.ts +2 -2
  111. package/dist/{src/src/support → support}/toPredicateFunc.d.ts +2 -2
  112. package/dist/{src/src → sync}/Relation/Memory.d.ts +46 -46
  113. package/dist/{src/src → sync}/Relation/index.d.ts +1 -1
  114. package/dist/{src/src → sync}/operators/_helpers.d.ts +142 -142
  115. package/dist/{src/src → sync}/operators/allbut.d.ts +2 -2
  116. package/dist/{src/src → sync}/operators/autowrap.d.ts +2 -2
  117. package/dist/{src/src → sync}/operators/constants.d.ts +2 -2
  118. package/dist/{src/src → sync}/operators/cross_product.d.ts +3 -3
  119. package/dist/{src/src → sync}/operators/exclude.d.ts +2 -2
  120. package/dist/{src/src → sync}/operators/extend.d.ts +2 -2
  121. package/dist/{src → sync}/operators/group.d.ts +2 -2
  122. package/dist/{src/src → sync}/operators/image.d.ts +2 -2
  123. package/dist/{src → sync}/operators/index.d.ts +30 -30
  124. package/dist/{src → sync}/operators/intersect.d.ts +2 -2
  125. package/dist/sync/operators/isEqual.d.ts +1 -0
  126. package/dist/sync/operators/isRelation.d.ts +2 -0
  127. package/dist/{src/src → sync}/operators/join.d.ts +2 -2
  128. package/dist/{src/src → sync}/operators/left_join.d.ts +2 -2
  129. package/dist/{src → sync}/operators/matching.d.ts +2 -2
  130. package/dist/{src → sync}/operators/minus.d.ts +2 -2
  131. package/dist/{src → sync}/operators/not_matching.d.ts +2 -2
  132. package/dist/{src/src → sync}/operators/one.d.ts +2 -2
  133. package/dist/{src/src → sync}/operators/prefix.d.ts +2 -2
  134. package/dist/{src → sync}/operators/project.d.ts +2 -2
  135. package/dist/{src/src → sync}/operators/rename.d.ts +2 -2
  136. package/dist/{src/src → sync}/operators/restrict.d.ts +2 -2
  137. package/dist/{src/src → sync}/operators/suffix.d.ts +2 -2
  138. package/dist/{src/src → sync}/operators/summarize.d.ts +2 -2
  139. package/dist/{src/src → sync}/operators/transform.d.ts +2 -2
  140. package/dist/{src → sync}/operators/ungroup.d.ts +2 -2
  141. package/dist/{src/src → sync}/operators/union.d.ts +2 -2
  142. package/dist/{src/src → sync}/operators/unwrap.d.ts +2 -2
  143. package/dist/{src → sync}/operators/where.d.ts +1 -1
  144. package/dist/{src/src → sync}/operators/wrap.d.ts +2 -2
  145. package/dist/{src/src → sync}/operators/yByX.d.ts +2 -2
  146. package/dist/{src/src/types.d.ts → types.d.ts} +169 -101
  147. package/dist/writer/Text.d.ts +40 -0
  148. package/dist/writer/index.d.ts +1 -0
  149. package/package.json +6 -4
  150. package/src/Relation/index.ts +2 -1
  151. package/src/async/Relation/Base.ts +245 -0
  152. package/src/async/Relation/index.ts +31 -0
  153. package/src/async/operators/_helpers.ts +60 -0
  154. package/src/async/operators/autowrap.ts +31 -0
  155. package/src/async/operators/constants.ts +26 -0
  156. package/src/async/operators/cross_product.ts +39 -0
  157. package/src/async/operators/extend.ts +36 -0
  158. package/src/async/operators/group.ts +61 -0
  159. package/src/async/operators/image.ts +42 -0
  160. package/src/async/operators/index.ts +28 -0
  161. package/src/async/operators/intersect.ts +28 -0
  162. package/src/async/operators/isEqual.ts +39 -0
  163. package/src/async/operators/join.ts +39 -0
  164. package/src/async/operators/left_join.ts +55 -0
  165. package/src/async/operators/matching.ts +39 -0
  166. package/src/async/operators/minus.ts +28 -0
  167. package/src/async/operators/not_matching.ts +39 -0
  168. package/src/async/operators/one.ts +25 -0
  169. package/src/async/operators/prefix.ts +15 -0
  170. package/src/async/operators/project.ts +64 -0
  171. package/src/async/operators/rename.ts +33 -0
  172. package/src/async/operators/restrict.ts +61 -0
  173. package/src/async/operators/suffix.ts +15 -0
  174. package/src/async/operators/summarize.ts +90 -0
  175. package/src/async/operators/toArray.ts +18 -0
  176. package/src/async/operators/transform.ts +43 -0
  177. package/src/async/operators/ungroup.ts +43 -0
  178. package/src/async/operators/union.ts +29 -0
  179. package/src/async/operators/unwrap.ts +31 -0
  180. package/src/async/operators/wrap.ts +32 -0
  181. package/src/async/operators/yByX.ts +19 -0
  182. package/src/async/types.ts +86 -0
  183. package/src/async.ts +4 -0
  184. package/src/index.ts +17 -4
  185. package/src/lib-definitions.ts +292 -0
  186. package/src/operators/index.ts +2 -31
  187. package/src/{Relation → sync/Relation}/Memory.ts +22 -13
  188. package/{dist/src/Relation/index.d.ts → src/sync/Relation/index.ts} +1 -1
  189. package/src/{operators → sync/operators}/_helpers.ts +1 -1
  190. package/src/{operators → sync/operators}/allbut.ts +1 -1
  191. package/src/{operators → sync/operators}/autowrap.ts +1 -1
  192. package/src/{operators → sync/operators}/constants.ts +1 -1
  193. package/src/{operators → sync/operators}/cross_product.ts +1 -1
  194. package/src/{operators → sync/operators}/exclude.ts +2 -2
  195. package/src/{operators → sync/operators}/extend.ts +1 -1
  196. package/src/{operators → sync/operators}/group.ts +2 -2
  197. package/src/{operators → sync/operators}/image.ts +2 -2
  198. package/src/sync/operators/index.ts +31 -0
  199. package/src/{operators → sync/operators}/intersect.ts +1 -1
  200. package/src/{operators → sync/operators}/isEqual.ts +1 -2
  201. package/src/sync/operators/isRelation.ts +6 -0
  202. package/src/{operators → sync/operators}/join.ts +1 -1
  203. package/src/{operators → sync/operators}/left_join.ts +1 -1
  204. package/src/{operators → sync/operators}/matching.ts +1 -1
  205. package/src/{operators → sync/operators}/minus.ts +1 -1
  206. package/src/{operators → sync/operators}/not_matching.ts +1 -1
  207. package/src/{operators → sync/operators}/one.ts +1 -1
  208. package/src/{operators → sync/operators}/prefix.ts +1 -1
  209. package/src/{operators → sync/operators}/project.ts +1 -1
  210. package/src/{operators → sync/operators}/rename.ts +1 -1
  211. package/src/{operators → sync/operators}/restrict.ts +2 -2
  212. package/src/{operators → sync/operators}/suffix.ts +1 -1
  213. package/src/{operators → sync/operators}/summarize.ts +1 -1
  214. package/src/{operators → sync/operators}/transform.ts +1 -1
  215. package/src/{operators → sync/operators}/ungroup.ts +1 -1
  216. package/src/{operators → sync/operators}/union.ts +1 -1
  217. package/src/{operators → sync/operators}/unwrap.ts +1 -1
  218. package/{dist/src/src/operators/where.d.ts → src/sync/operators/where.ts} +1 -1
  219. package/src/{operators → sync/operators}/wrap.ts +1 -1
  220. package/src/{operators → sync/operators}/yByX.ts +1 -1
  221. package/src/types.ts +153 -54
  222. package/src/writer/Text.ts +305 -0
  223. package/src/writer/index.ts +1 -0
  224. package/dist/src/Relation.d.ts +0 -8
  225. package/dist/src/index.d.ts +0 -27
  226. package/dist/src/operators/isEqual.d.ts +0 -2
  227. package/dist/src/operators/isRelation.d.ts +0 -1
  228. package/dist/src/src/index.d.ts +0 -27
  229. package/dist/src/src/operators/index.d.ts +0 -30
  230. package/dist/src/src/operators/isEqual.d.ts +0 -2
  231. package/dist/src/src/operators/isRelation.d.ts +0 -1
  232. package/dist/src/src/utility-types.d.ts +0 -43
  233. package/dist/src/support/toPredicateFunc.d.ts +0 -2
  234. package/dist/src/tests/bmg.test.d.ts +0 -1
  235. package/dist/src/tests/fixtures.d.ts +0 -6
  236. package/dist/src/tests/operators/allbut.test.d.ts +0 -1
  237. package/dist/src/tests/operators/autowrap.test.d.ts +0 -1
  238. package/dist/src/tests/operators/constants.test.d.ts +0 -1
  239. package/dist/src/tests/operators/cross_product.test.d.ts +0 -1
  240. package/dist/src/tests/operators/exclude.test.d.ts +0 -1
  241. package/dist/src/tests/operators/extend.test.d.ts +0 -1
  242. package/dist/src/tests/operators/group.test.d.ts +0 -1
  243. package/dist/src/tests/operators/image.test.d.ts +0 -1
  244. package/dist/src/tests/operators/intersect.test.d.ts +0 -1
  245. package/dist/src/tests/operators/isEqual.test.d.ts +0 -1
  246. package/dist/src/tests/operators/join.test.d.ts +0 -1
  247. package/dist/src/tests/operators/left_join.test.d.ts +0 -1
  248. package/dist/src/tests/operators/matching.test.d.ts +0 -1
  249. package/dist/src/tests/operators/minus.test.d.ts +0 -1
  250. package/dist/src/tests/operators/not_matching.test.d.ts +0 -1
  251. package/dist/src/tests/operators/one.test.d.ts +0 -1
  252. package/dist/src/tests/operators/prefix.test.d.ts +0 -1
  253. package/dist/src/tests/operators/project.test.d.ts +0 -1
  254. package/dist/src/tests/operators/rename.test.d.ts +0 -1
  255. package/dist/src/tests/operators/restrict.test.d.ts +0 -1
  256. package/dist/src/tests/operators/suffix.test.d.ts +0 -1
  257. package/dist/src/tests/operators/summarize.test.d.ts +0 -1
  258. package/dist/src/tests/operators/transform.test.d.ts +0 -1
  259. package/dist/src/tests/operators/ungroup.test.d.ts +0 -1
  260. package/dist/src/tests/operators/union.test.d.ts +0 -1
  261. package/dist/src/tests/operators/unwrap.test.d.ts +0 -1
  262. package/dist/src/tests/operators/where.test.d.ts +0 -1
  263. package/dist/src/tests/operators/wrap.test.d.ts +0 -1
  264. package/dist/src/tests/operators/yByX.test.d.ts +0 -1
  265. package/dist/src/tests/types/relation.test.d.ts +0 -1
  266. package/dist/src/types.d.ts +0 -101
  267. package/dist/src/utility-types.d.ts +0 -43
  268. package/dist/tests/bmg.test.d.ts +0 -1
  269. package/dist/tests/fixtures.d.ts +0 -6
  270. package/dist/tests/operators/allbut.test.d.ts +0 -1
  271. package/dist/tests/operators/autowrap.test.d.ts +0 -1
  272. package/dist/tests/operators/constants.test.d.ts +0 -1
  273. package/dist/tests/operators/cross_product.test.d.ts +0 -1
  274. package/dist/tests/operators/exclude.test.d.ts +0 -1
  275. package/dist/tests/operators/extend.test.d.ts +0 -1
  276. package/dist/tests/operators/group.test.d.ts +0 -1
  277. package/dist/tests/operators/image.test.d.ts +0 -1
  278. package/dist/tests/operators/intersect.test.d.ts +0 -1
  279. package/dist/tests/operators/isEqual.test.d.ts +0 -1
  280. package/dist/tests/operators/join.test.d.ts +0 -1
  281. package/dist/tests/operators/left_join.test.d.ts +0 -1
  282. package/dist/tests/operators/matching.test.d.ts +0 -1
  283. package/dist/tests/operators/minus.test.d.ts +0 -1
  284. package/dist/tests/operators/not_matching.test.d.ts +0 -1
  285. package/dist/tests/operators/one.test.d.ts +0 -1
  286. package/dist/tests/operators/prefix.test.d.ts +0 -1
  287. package/dist/tests/operators/project.test.d.ts +0 -1
  288. package/dist/tests/operators/rename.test.d.ts +0 -1
  289. package/dist/tests/operators/restrict.test.d.ts +0 -1
  290. package/dist/tests/operators/suffix.test.d.ts +0 -1
  291. package/dist/tests/operators/summarize.test.d.ts +0 -1
  292. package/dist/tests/operators/transform.test.d.ts +0 -1
  293. package/dist/tests/operators/ungroup.test.d.ts +0 -1
  294. package/dist/tests/operators/union.test.d.ts +0 -1
  295. package/dist/tests/operators/unwrap.test.d.ts +0 -1
  296. package/dist/tests/operators/where.test.d.ts +0 -1
  297. package/dist/tests/operators/wrap.test.d.ts +0 -1
  298. package/dist/tests/operators/yByX.test.d.ts +0 -1
  299. package/dist/tests/types/relation.test.d.ts +0 -1
  300. package/src/operators/isRelation.ts +0 -5
  301. package/src/utility-types.ts +0 -77
  302. /package/{src/operators/where.ts → dist/operators/where.d.ts} +0 -0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Enspirit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -111,6 +111,7 @@ See the [full type-safe example](./example/index.ts) for more.
111
111
  | | `toArray()` | Convert relation to array |
112
112
  | | `isEqual(other)` | Check set equality |
113
113
  | | `yByX(y, x)` | Create `{ x-value: y-value }` mapping |
114
+ | | `toText(options?)` | Render as ASCII table |
114
115
  | | `Bmg.isRelation(value)` | Check if value is a Relation (static) |
115
116
 
116
117
  Built-in aggregators for `summarize`: `count`, `sum`, `min`, `max`, `avg`, `collect`
@@ -139,9 +140,9 @@ This will be provided by [Elo](https://elo-lang.org).
139
140
 
140
141
  ## Versioning
141
142
 
142
- Bmg.js follows [Semantic Versioning](https://semver.org/) (SemVer):
143
+ Bmg.js follows [Semantic Versioning](https://semver.org/) (SemVer). See [API.md](API.md) for the public API reference.
143
144
 
144
- - **MAJOR** (x.0.0) - Breaking changes to the API (renamed operators, changed signatures, removed features)
145
+ - **MAJOR** (x.0.0) - Breaking changes to the public API
145
146
  - **MINOR** (0.x.0) - New operators or features, fully backward-compatible
146
147
  - **PATCH** (0.0.x) - Bug fixes and performance improvements, no API changes
147
148
 
@@ -0,0 +1,47 @@
1
+ import type { AsyncRelation, AsyncRelationOperand } from '../async-types';
2
+ import type { Tuple, TypedPredicate, TypedExtension, Relation, RenameMap, Renamed, Prefixed, Suffixed, Transformation, JoinKeys, Aggregators, AutowrapOptions, TextOptions } from '../types';
3
+ /**
4
+ * Base implementation of AsyncRelation using lazy evaluation.
5
+ * Each operator returns a new BaseAsyncRelation wrapping the transformed iterable.
6
+ */
7
+ export declare class BaseAsyncRelation<T = Tuple> implements AsyncRelation<T> {
8
+ private source;
9
+ constructor(source: AsyncIterable<T>);
10
+ restrict(p: TypedPredicate<T>): AsyncRelation<T>;
11
+ where(p: TypedPredicate<T>): AsyncRelation<T>;
12
+ exclude(p: TypedPredicate<T>): AsyncRelation<T>;
13
+ project<K extends keyof T>(attrs: K[]): AsyncRelation<Pick<T, K>>;
14
+ allbut<K extends keyof T>(attrs: K[]): AsyncRelation<Omit<T, K>>;
15
+ extend<E extends Record<string, unknown>>(e: TypedExtension<T, E>): AsyncRelation<T & E>;
16
+ constants<C extends Tuple>(consts: C): AsyncRelation<T & C>;
17
+ rename<R extends RenameMap<T>>(r: R): AsyncRelation<Renamed<T, R>>;
18
+ prefix<P extends string, Ex extends keyof T = never>(pfx: P, options?: {
19
+ except?: Ex[];
20
+ }): AsyncRelation<Prefixed<T, P, Ex>>;
21
+ suffix<S extends string, Ex extends keyof T = never>(sfx: S, options?: {
22
+ except?: Ex[];
23
+ }): AsyncRelation<Suffixed<T, S, Ex>>;
24
+ transform(t: Transformation): AsyncRelation<T>;
25
+ union(other: AsyncRelationOperand<T>): AsyncRelation<T>;
26
+ minus(other: AsyncRelationOperand<T>): AsyncRelation<T>;
27
+ intersect(other: AsyncRelationOperand<T>): AsyncRelation<T>;
28
+ matching<U>(other: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncRelation<T>;
29
+ not_matching<U>(other: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncRelation<T>;
30
+ join<U>(other: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncRelation<T & U>;
31
+ left_join<U>(other: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncRelation<T & Partial<U>>;
32
+ cross_product<U>(other: AsyncRelationOperand<U>): AsyncRelation<T & U>;
33
+ cross_join<U>(other: AsyncRelationOperand<U>): AsyncRelation<T & U>;
34
+ group<K extends keyof T>(attrs: K[], as: string): AsyncRelation<Omit<T, K> & Record<string, Relation<Pick<T, K>>>>;
35
+ ungroup(attr: string): AsyncRelation<Tuple>;
36
+ wrap<K extends keyof T>(attrs: K[], as: string): AsyncRelation<Omit<T, K> & Record<string, Pick<T, K>>>;
37
+ unwrap(attr: string): AsyncRelation<Tuple>;
38
+ image<U>(other: AsyncRelationOperand<U>, as: string, keys?: JoinKeys): AsyncRelation<T & Record<string, Relation<U>>>;
39
+ summarize<K extends keyof T>(by: K[], aggs: Aggregators): AsyncRelation<Pick<T, K> & Tuple>;
40
+ autowrap(options?: AutowrapOptions): AsyncRelation<Tuple>;
41
+ one(): Promise<T>;
42
+ toArray(): Promise<T[]>;
43
+ toRelation(): Promise<Relation<T>>;
44
+ yByX(y: string, x: string): Promise<Tuple>;
45
+ toText(options?: TextOptions): Promise<string>;
46
+ [Symbol.asyncIterator](): AsyncIterator<T>;
47
+ }
@@ -0,0 +1,25 @@
1
+ import { BaseAsyncRelation } from './Base';
2
+ import type { AsyncRelation, AsyncRelationOperand } from '../async-types';
3
+ export { BaseAsyncRelation };
4
+ /**
5
+ * Creates a new async relation from an AsyncIterable source.
6
+ *
7
+ * @typeParam T - The tuple type. Inferred from input or explicitly provided.
8
+ *
9
+ * @example
10
+ * // From an async iterable
11
+ * const suppliers = AsyncBmg(fetchSuppliersFromDB());
12
+ *
13
+ * @example
14
+ * // Chained operations (lazy - no execution yet)
15
+ * const query = AsyncBmg(source)
16
+ * .restrict({ city: 'London' })
17
+ * .project(['sid', 'name']);
18
+ *
19
+ * // Terminal operation triggers execution
20
+ * const results = await query.toArray();
21
+ */
22
+ export declare function AsyncBmg<T>(source: AsyncIterable<T>): AsyncRelation<T>;
23
+ export declare namespace AsyncBmg {
24
+ var isEqual: <T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>) => Promise<boolean>;
25
+ }
@@ -1,46 +1,46 @@
1
- import type { AutowrapOptions, JoinKeys, Relation, RelationOperand, Transformation, Tuple, TypedPredicate, TypedExtension, RenameMap, Renamed, Prefixed, Suffixed, Joined, LeftJoined, Wrapped, Unwrapped, Ungrouped } from "../types";
2
- import type { AggregatorResults } from "../utility-types";
3
- /**
4
- * In-memory implementation of the Relation interface.
5
- *
6
- * @typeParam T - The tuple type for this relation. Defaults to `Tuple` (Record<string, unknown>).
7
- */
8
- export declare class MemoryRelation<T = Tuple> implements Relation<T> {
9
- private tuples;
10
- constructor(tuples: T[]);
11
- restrict(p: TypedPredicate<T>): Relation<T>;
12
- where(p: TypedPredicate<T>): Relation<T>;
13
- exclude(p: TypedPredicate<T>): Relation<T>;
14
- project<K extends keyof T>(attrs: K[]): Relation<Pick<T, K>>;
15
- allbut<K extends keyof T>(attrs: K[]): Relation<Omit<T, K>>;
16
- extend<E extends Record<string, unknown>>(e: TypedExtension<T, E>): Relation<T & E>;
17
- constants<C extends Tuple>(consts: C): Relation<T & C>;
18
- rename<R extends RenameMap<T>>(r: R): Relation<Renamed<T, R>>;
19
- prefix<P extends string, Ex extends keyof T = never>(pfx: P, options?: {
20
- except?: Ex[];
21
- }): Relation<Prefixed<T, P, Ex>>;
22
- suffix<S extends string, Ex extends keyof T = never>(sfx: S, options?: {
23
- except?: Ex[];
24
- }): Relation<Suffixed<T, S, Ex>>;
25
- union(right: RelationOperand<T>): Relation<T>;
26
- minus(right: RelationOperand<T>): Relation<T>;
27
- intersect(right: RelationOperand<T>): Relation<T>;
28
- matching<R>(right: RelationOperand<R>, keys?: JoinKeys): Relation<T>;
29
- not_matching<R>(right: RelationOperand<R>, keys?: JoinKeys): Relation<T>;
30
- join<R>(right: RelationOperand<R>, keys?: JoinKeys): Relation<Joined<T, R>>;
31
- left_join<R>(right: RelationOperand<R>, keys?: JoinKeys): Relation<LeftJoined<T, R>>;
32
- cross_product<R>(right: RelationOperand<R>): Relation<T & R>;
33
- cross_join<R>(right: RelationOperand<R>): Relation<T & R>;
34
- image<R, As extends string>(right: RelationOperand<R>, as: As, keys?: JoinKeys): Relation<T & Record<As, Relation<Omit<R, keyof T & keyof R>>>>;
35
- group<K extends keyof T, As extends string>(attrs: K[], as: As): Relation<Omit<T, K> & Record<As, Relation<Pick<T, K>>>>;
36
- ungroup<K extends keyof T>(attr: K): Relation<Ungrouped<T, K>>;
37
- wrap<K extends keyof T, As extends string>(attrs: K[], as: As): Relation<Wrapped<T, K, As>>;
38
- unwrap<K extends keyof T>(attr: K): Relation<Unwrapped<T, K>>;
39
- summarize<By extends keyof T, Aggs extends Record<string, unknown>>(by: By[], aggs: Aggs): Relation<Pick<T, By> & AggregatorResults<Aggs>>;
40
- transform(t: Transformation): Relation<T>;
41
- autowrap(options?: AutowrapOptions): Relation<Tuple>;
42
- one(): T;
43
- toArray(): T[];
44
- yByX<Y extends keyof T, X extends keyof T>(y: Y, x: X): Record<T[X] & PropertyKey, T[Y]>;
45
- isEqual(right: any): boolean;
46
- }
1
+ import type { AutowrapOptions, Relation, RelationOperand, TextOptions, Transformation, Tuple, TypedPredicate, TypedExtension, RenameMap, Renamed, Prefixed, Suffixed, Joined, LeftJoined, Wrapped, Unwrapped, Ungrouped, AggregatorResults, TypedJoinKeysArray, TypedJoinKeysObject } from "../types";
2
+ /**
3
+ * In-memory implementation of the Relation interface.
4
+ *
5
+ * @typeParam T - The tuple type for this relation. Defaults to `Tuple` (Record<string, unknown>).
6
+ */
7
+ export declare class MemoryRelation<T = Tuple> implements Relation<T> {
8
+ private tuples;
9
+ constructor(tuples: T[]);
10
+ restrict(p: TypedPredicate<T>): Relation<T>;
11
+ where(p: TypedPredicate<T>): Relation<T>;
12
+ exclude(p: TypedPredicate<T>): Relation<T>;
13
+ project<K extends keyof T>(attrs: K[]): Relation<Pick<T, K>>;
14
+ allbut<K extends keyof T>(attrs: K[]): Relation<Omit<T, K>>;
15
+ extend<E extends Record<string, unknown>>(e: TypedExtension<T, E>): Relation<T & E>;
16
+ constants<C extends Tuple>(consts: C): Relation<T & C>;
17
+ rename<R extends RenameMap<T>>(r: R): Relation<Renamed<T, R>>;
18
+ prefix<P extends string, Ex extends keyof T = never>(pfx: P, options?: {
19
+ except?: Ex[];
20
+ }): Relation<Prefixed<T, P, Ex>>;
21
+ suffix<S extends string, Ex extends keyof T = never>(sfx: S, options?: {
22
+ except?: Ex[];
23
+ }): Relation<Suffixed<T, S, Ex>>;
24
+ union(right: RelationOperand<T>): Relation<T>;
25
+ minus(right: RelationOperand<T>): Relation<T>;
26
+ intersect(right: RelationOperand<T>): Relation<T>;
27
+ matching<R>(right: RelationOperand<R>, keys?: TypedJoinKeysArray<T, R> | TypedJoinKeysObject<T, R>): Relation<T>;
28
+ not_matching<R>(right: RelationOperand<R>, keys?: TypedJoinKeysArray<T, R> | TypedJoinKeysObject<T, R>): Relation<T>;
29
+ join<R>(right: RelationOperand<R>, keys?: TypedJoinKeysArray<T, R> | TypedJoinKeysObject<T, R>): Relation<Joined<T, R>>;
30
+ left_join<R>(right: RelationOperand<R>, keys?: TypedJoinKeysArray<T, R> | TypedJoinKeysObject<T, R>): Relation<LeftJoined<T, R>>;
31
+ cross_product<R>(right: RelationOperand<R>): Relation<T & R>;
32
+ cross_join<R>(right: RelationOperand<R>): Relation<T & R>;
33
+ image<R, As extends string>(right: RelationOperand<R>, as: As, keys?: TypedJoinKeysArray<T, R> | TypedJoinKeysObject<T, R>): Relation<T & Record<As, Relation<Omit<R, keyof T & keyof R>>>>;
34
+ group<K extends keyof T, As extends string>(attrs: K[], as: As): Relation<Omit<T, K> & Record<As, Relation<Pick<T, K>>>>;
35
+ ungroup<K extends keyof T>(attr: K): Relation<Ungrouped<T, K>>;
36
+ wrap<K extends keyof T, As extends string>(attrs: K[], as: As): Relation<Wrapped<T, K, As>>;
37
+ unwrap<K extends keyof T>(attr: K): Relation<Unwrapped<T, K>>;
38
+ summarize<By extends keyof T, Aggs extends Record<string, unknown>>(by: By[], aggs: Aggs): Relation<Pick<T, By> & AggregatorResults<Aggs>>;
39
+ transform(t: Transformation): Relation<T>;
40
+ autowrap(options?: AutowrapOptions): Relation<Tuple>;
41
+ one(): T;
42
+ toArray(): T[];
43
+ yByX<Y extends keyof T, X extends keyof T>(y: Y, x: X): Record<T[X] & PropertyKey, T[Y]>;
44
+ isEqual(right: any): boolean;
45
+ toText(options?: TextOptions): string;
46
+ }
@@ -0,0 +1 @@
1
+ export * from '../sync/Relation';
@@ -0,0 +1,47 @@
1
+ import type { AsyncRelation, AsyncRelationOperand } from '../types';
2
+ import type { Tuple, TypedPredicate, TypedExtension, Relation, RenameMap, Renamed, Prefixed, Suffixed, Transformation, JoinKeys, Aggregators, AutowrapOptions, TextOptions } from '../../types';
3
+ /**
4
+ * Base implementation of AsyncRelation using lazy evaluation.
5
+ * Each operator returns a new BaseAsyncRelation wrapping the transformed iterable.
6
+ */
7
+ export declare class BaseAsyncRelation<T = Tuple> implements AsyncRelation<T> {
8
+ private source;
9
+ constructor(source: AsyncIterable<T>);
10
+ restrict(p: TypedPredicate<T>): AsyncRelation<T>;
11
+ where(p: TypedPredicate<T>): AsyncRelation<T>;
12
+ exclude(p: TypedPredicate<T>): AsyncRelation<T>;
13
+ project<K extends keyof T>(attrs: K[]): AsyncRelation<Pick<T, K>>;
14
+ allbut<K extends keyof T>(attrs: K[]): AsyncRelation<Omit<T, K>>;
15
+ extend<E extends Record<string, unknown>>(e: TypedExtension<T, E>): AsyncRelation<T & E>;
16
+ constants<C extends Tuple>(consts: C): AsyncRelation<T & C>;
17
+ rename<R extends RenameMap<T>>(r: R): AsyncRelation<Renamed<T, R>>;
18
+ prefix<P extends string, Ex extends keyof T = never>(pfx: P, options?: {
19
+ except?: Ex[];
20
+ }): AsyncRelation<Prefixed<T, P, Ex>>;
21
+ suffix<S extends string, Ex extends keyof T = never>(sfx: S, options?: {
22
+ except?: Ex[];
23
+ }): AsyncRelation<Suffixed<T, S, Ex>>;
24
+ transform(t: Transformation): AsyncRelation<T>;
25
+ union(other: AsyncRelationOperand<T>): AsyncRelation<T>;
26
+ minus(other: AsyncRelationOperand<T>): AsyncRelation<T>;
27
+ intersect(other: AsyncRelationOperand<T>): AsyncRelation<T>;
28
+ matching<U>(other: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncRelation<T>;
29
+ not_matching<U>(other: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncRelation<T>;
30
+ join<U>(other: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncRelation<T & U>;
31
+ left_join<U>(other: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncRelation<T & Partial<U>>;
32
+ cross_product<U>(other: AsyncRelationOperand<U>): AsyncRelation<T & U>;
33
+ cross_join<U>(other: AsyncRelationOperand<U>): AsyncRelation<T & U>;
34
+ group<K extends keyof T>(attrs: K[], as: string): AsyncRelation<Omit<T, K> & Record<string, Relation<Pick<T, K>>>>;
35
+ ungroup(attr: string): AsyncRelation<Tuple>;
36
+ wrap<K extends keyof T>(attrs: K[], as: string): AsyncRelation<Omit<T, K> & Record<string, Pick<T, K>>>;
37
+ unwrap(attr: string): AsyncRelation<Tuple>;
38
+ image<U>(other: AsyncRelationOperand<U>, as: string, keys?: JoinKeys): AsyncRelation<T & Record<string, Relation<U>>>;
39
+ summarize<K extends keyof T>(by: K[], aggs: Aggregators): AsyncRelation<Pick<T, K> & Tuple>;
40
+ autowrap(options?: AutowrapOptions): AsyncRelation<Tuple>;
41
+ one(): Promise<T>;
42
+ toArray(): Promise<T[]>;
43
+ toRelation(): Promise<Relation<T>>;
44
+ yByX(y: string, x: string): Promise<Tuple>;
45
+ toText(options?: TextOptions): Promise<string>;
46
+ [Symbol.asyncIterator](): AsyncIterator<T>;
47
+ }
@@ -0,0 +1,25 @@
1
+ import { BaseAsyncRelation } from './Base';
2
+ import type { AsyncRelation, AsyncRelationOperand } from '../types';
3
+ export { BaseAsyncRelation };
4
+ /**
5
+ * Creates a new async relation from an AsyncIterable source.
6
+ *
7
+ * @typeParam T - The tuple type. Inferred from input or explicitly provided.
8
+ *
9
+ * @example
10
+ * // From an async iterable
11
+ * const suppliers = AsyncBmg(fetchSuppliersFromDB());
12
+ *
13
+ * @example
14
+ * // Chained operations (lazy - no execution yet)
15
+ * const query = AsyncBmg(source)
16
+ * .restrict({ city: 'London' })
17
+ * .project(['sid', 'name']);
18
+ *
19
+ * // Terminal operation triggers execution
20
+ * const results = await query.toArray();
21
+ */
22
+ export declare function AsyncBmg<T>(source: AsyncIterable<T>): AsyncRelation<T>;
23
+ export declare namespace AsyncBmg {
24
+ var isEqual: <T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>) => Promise<boolean>;
25
+ }
@@ -0,0 +1,16 @@
1
+ import type { AsyncRelationOperand, AsyncOperationalOperand, AsyncRelation } from '../types';
2
+ /**
3
+ * Type guard to check if a value implements AsyncRelation.
4
+ */
5
+ export declare const isAsyncRelation: <T>(value: unknown) => value is AsyncRelation<T>;
6
+ /**
7
+ * Converts an AsyncRelationOperand to an AsyncOperationalOperand
8
+ * that provides a uniform interface for async iteration and output.
9
+ */
10
+ export declare const toAsyncOperationalOperand: <T>(operand: AsyncRelationOperand<T>) => AsyncOperationalOperand<T>;
11
+ /**
12
+ * Async generator that removes duplicate tuples.
13
+ * Uses tupleKey() for equality comparison.
14
+ */
15
+ export declare function deduplicateAsync<T>(source: AsyncIterable<T>): AsyncGenerator<T>;
16
+ export declare const error: (msg: string) => never;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { AutowrapOptions, Tuple } from '../../types';
3
+ /**
4
+ * Automatically wraps attributes based on naming convention.
5
+ * Attributes with separator (default '_') are grouped into nested objects.
6
+ */
7
+ export declare function autowrap<T>(operand: AsyncRelationOperand<T>, options?: AutowrapOptions): AsyncIterable<Tuple>;
@@ -0,0 +1,6 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Tuple } from '../../types';
3
+ /**
4
+ * Adds constant attributes to each tuple.
5
+ */
6
+ export declare const constants: <T>(operand: AsyncRelationOperand<T>, consts: Tuple) => AsyncIterable<Tuple>;
@@ -0,0 +1,9 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Tuple } from '../../types';
3
+ /**
4
+ * Cartesian product: combines every left tuple with every right tuple.
5
+ * Left attributes override right on clash. Removes duplicates.
6
+ * Materializes both sides.
7
+ */
8
+ export declare function cross_product<T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>): AsyncIterable<Tuple>;
9
+ export { cross_product as cross_join };
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Extension, Tuple } from '../../types';
3
+ /**
4
+ * Extends each tuple with new attributes.
5
+ * Extension can be functions (computed) or attribute names (copied).
6
+ */
7
+ export declare const extend: <T>(operand: AsyncRelationOperand<T>, extension: Extension) => AsyncIterable<Tuple>;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { AttrName, Tuple } from '../../types';
3
+ /**
4
+ * Groups specified attributes into a nested relation.
5
+ * Materializes all tuples to perform grouping.
6
+ */
7
+ export declare function group<T>(operand: AsyncRelationOperand<T>, attrs: AttrName[], as: AttrName): AsyncIterable<Tuple>;
@@ -0,0 +1,8 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { JoinKeys, Tuple, AttrName } from '../../types';
3
+ /**
4
+ * Adds a relation-valued attribute with matching tuples from right.
5
+ * Each left tuple gets a nested relation of matching right tuples.
6
+ * Materializes both sides.
7
+ */
8
+ export declare function image<T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>, as: AttrName, keys?: JoinKeys): AsyncIterable<Tuple>;
@@ -0,0 +1,28 @@
1
+ export { restrict, where, exclude } from './restrict';
2
+ export { project, allbut } from './project';
3
+ export { extend } from './extend';
4
+ export { constants } from './constants';
5
+ export { rename } from './rename';
6
+ export { prefix } from './prefix';
7
+ export { suffix } from './suffix';
8
+ export { transform } from './transform';
9
+ export { union } from './union';
10
+ export { minus } from './minus';
11
+ export { intersect } from './intersect';
12
+ export { matching } from './matching';
13
+ export { not_matching } from './not_matching';
14
+ export { join } from './join';
15
+ export { left_join } from './left_join';
16
+ export { cross_product, cross_join } from './cross_product';
17
+ export { group } from './group';
18
+ export { ungroup } from './ungroup';
19
+ export { wrap } from './wrap';
20
+ export { unwrap } from './unwrap';
21
+ export { image } from './image';
22
+ export { summarize } from './summarize';
23
+ export { autowrap } from './autowrap';
24
+ export { yByX } from './yByX';
25
+ export { isEqual } from './isEqual';
26
+ export { one } from './one';
27
+ export { toArray } from './toArray';
28
+ export { isAsyncRelation, toAsyncOperationalOperand, deduplicateAsync } from './_helpers';
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Tuple } from '../../types';
3
+ /**
4
+ * Set intersection: returns tuples present in both relations.
5
+ * Materializes right side first, then streams left.
6
+ */
7
+ export declare function intersect<T>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<T>): AsyncIterable<Tuple>;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ /**
3
+ * Compares two async relations for equality.
4
+ * Two relations are equal if they contain the exact same set of tuples.
5
+ * Terminal operation - returns a Promise.
6
+ */
7
+ export declare const isEqual: <T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>) => Promise<boolean>;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { JoinKeys, Tuple } from '../../types';
3
+ /**
4
+ * Natural join: combines tuples from left and right where join keys match.
5
+ * Materializes both sides (needed for key detection and nested loop join).
6
+ */
7
+ export declare function join<T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncIterable<Tuple>;
@@ -0,0 +1,8 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { JoinKeys, Tuple } from '../../types';
3
+ /**
4
+ * Left outer join: combines tuples, keeping all left tuples.
5
+ * Non-matching left tuples have null for right attributes.
6
+ * Materializes both sides.
7
+ */
8
+ export declare function left_join<T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncIterable<Tuple>;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { JoinKeys, Tuple } from '../../types';
3
+ /**
4
+ * Semi-join: returns tuples from left that have a matching tuple in right.
5
+ * Materializes right side first to build key set.
6
+ */
7
+ export declare function matching<T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncIterable<Tuple>;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Tuple } from '../../types';
3
+ /**
4
+ * Set difference: returns tuples in left but not in right.
5
+ * Materializes right side first, then streams left.
6
+ */
7
+ export declare function minus<T>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<T>): AsyncIterable<Tuple>;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { JoinKeys, Tuple } from '../../types';
3
+ /**
4
+ * Anti semi-join: returns tuples from left that have no matching tuple in right.
5
+ * Materializes right side first to build key set.
6
+ */
7
+ export declare function not_matching<T, U>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<U>, keys?: JoinKeys): AsyncIterable<Tuple>;
@@ -0,0 +1,6 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ /**
3
+ * Returns the single tuple from the relation.
4
+ * Throws if the relation is empty or has more than one tuple.
5
+ */
6
+ export declare const one: <T>(operand: AsyncRelationOperand<T>) => Promise<T>;
@@ -0,0 +1,6 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { PrefixOptions, Tuple } from '../../types';
3
+ /**
4
+ * Prefixes all attribute names (except those in options.except).
5
+ */
6
+ export declare const prefix: <T>(operand: AsyncRelationOperand<T>, pfx: string, options?: PrefixOptions) => AsyncIterable<Tuple>;
@@ -0,0 +1,10 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Tuple, AttrName } from '../../types';
3
+ /**
4
+ * Projects tuples to specified attributes with deduplication.
5
+ */
6
+ export declare const project: <T>(operand: AsyncRelationOperand<T>, attrs: AttrName[]) => AsyncIterable<Tuple>;
7
+ /**
8
+ * Projects out (removes) specified attributes with deduplication.
9
+ */
10
+ export declare const allbut: <T>(operand: AsyncRelationOperand<T>, attrs: AttrName[]) => AsyncIterable<Tuple>;
@@ -0,0 +1,6 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Renaming, Tuple } from '../../types';
3
+ /**
4
+ * Renames attributes in each tuple.
5
+ */
6
+ export declare const rename: <T>(operand: AsyncRelationOperand<T>, renaming: Renaming) => AsyncIterable<Tuple>;
@@ -0,0 +1,14 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Predicate } from '../../types';
3
+ /**
4
+ * Filters tuples that match the predicate.
5
+ */
6
+ export declare const restrict: <T>(operand: AsyncRelationOperand<T>, p: Predicate) => AsyncIterable<T>;
7
+ /**
8
+ * Alias for restrict.
9
+ */
10
+ export declare const where: <T>(operand: AsyncRelationOperand<T>, p: Predicate) => AsyncIterable<T>;
11
+ /**
12
+ * Filters tuples that do NOT match the predicate.
13
+ */
14
+ export declare const exclude: <T>(operand: AsyncRelationOperand<T>, p: Predicate) => AsyncIterable<T>;
@@ -0,0 +1,6 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { SuffixOptions, Tuple } from '../../types';
3
+ /**
4
+ * Suffixes all attribute names (except those in options.except).
5
+ */
6
+ export declare const suffix: <T>(operand: AsyncRelationOperand<T>, sfx: string, options?: SuffixOptions) => AsyncIterable<Tuple>;
@@ -0,0 +1,8 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { AttrName, Tuple, Aggregators } from '../../types';
3
+ /**
4
+ * Aggregates tuples by grouping attributes.
5
+ * Supports count, sum, min, max, avg, collect, and custom functions.
6
+ * Materializes all tuples to perform grouping.
7
+ */
8
+ export declare function summarize<T>(operand: AsyncRelationOperand<T>, by: AttrName[], aggs: Aggregators): AsyncIterable<Tuple>;
@@ -0,0 +1,5 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ /**
3
+ * Collects all tuples from the async relation into an array.
4
+ */
5
+ export declare const toArray: <T>(operand: AsyncRelationOperand<T>) => Promise<T[]>;
@@ -0,0 +1,9 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Transformation, Tuple } from '../../types';
3
+ /**
4
+ * Applies transformation functions to attribute values.
5
+ * - Single function: applies to all values
6
+ * - Array of functions: chains them in order
7
+ * - Object with attr keys: applies per-attribute transformers
8
+ */
9
+ export declare function transform<T>(operand: AsyncRelationOperand<T>, transformation: Transformation): AsyncIterable<Tuple>;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { AttrName, Tuple } from '../../types';
3
+ /**
4
+ * Flattens a nested relation attribute back into parent tuples.
5
+ * Materializes all tuples to perform ungrouping.
6
+ */
7
+ export declare function ungroup<T>(operand: AsyncRelationOperand<T>, attr: AttrName): AsyncIterable<Tuple>;
@@ -0,0 +1,6 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { Tuple } from '../../types';
3
+ /**
4
+ * Combines tuples from two relations, removing duplicates.
5
+ */
6
+ export declare function union<T>(left: AsyncRelationOperand<T>, right: AsyncRelationOperand<T>): AsyncIterable<Tuple>;
@@ -0,0 +1,6 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { AttrName, Tuple } from '../../types';
3
+ /**
4
+ * Unwraps a nested object attribute back into the parent tuple.
5
+ */
6
+ export declare function unwrap<T>(operand: AsyncRelationOperand<T>, attr: AttrName): AsyncIterable<Tuple>;
@@ -0,0 +1,6 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { AttrName, Tuple } from '../../types';
3
+ /**
4
+ * Wraps specified attributes into a nested object.
5
+ */
6
+ export declare function wrap<T>(operand: AsyncRelationOperand<T>, attrs: AttrName[], as: AttrName): AsyncIterable<Tuple>;
@@ -0,0 +1,7 @@
1
+ import type { AsyncRelationOperand } from '../types';
2
+ import type { AttrName, Tuple } from '../../types';
3
+ /**
4
+ * Builds a key-value map from two attributes.
5
+ * Terminal operation - returns a Promise.
6
+ */
7
+ export declare const yByX: <T>(operand: AsyncRelationOperand<T>, y: AttrName, x: AttrName) => Promise<Tuple>;