@enspirit/bmg-js 1.0.1 → 1.0.2

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 (158) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/{src/Relation → Relation}/Memory.d.ts +45 -46
  3. package/dist/{src/src/Relation → Relation}/index.d.ts +1 -1
  4. package/dist/bmg.cjs +1 -1
  5. package/dist/bmg.cjs.map +1 -1
  6. package/dist/bmg.modern.js +1 -1
  7. package/dist/bmg.modern.js.map +1 -1
  8. package/dist/bmg.module.js +1 -1
  9. package/dist/bmg.module.js.map +1 -1
  10. package/dist/bmg.umd.js +1 -1
  11. package/dist/bmg.umd.js.map +1 -1
  12. package/dist/index.d.ts +27 -1
  13. package/dist/lib-definitions.d.ts +1 -0
  14. package/dist/{src/operators → operators}/_helpers.d.ts +142 -142
  15. package/dist/{src/operators → operators}/allbut.d.ts +2 -2
  16. package/dist/{src/operators → operators}/autowrap.d.ts +2 -2
  17. package/dist/{src/operators → operators}/constants.d.ts +2 -2
  18. package/dist/{src/operators → operators}/cross_product.d.ts +3 -3
  19. package/dist/{src/operators → operators}/exclude.d.ts +2 -2
  20. package/dist/{src/operators → operators}/extend.d.ts +2 -2
  21. package/dist/{src/src/operators → operators}/group.d.ts +2 -2
  22. package/dist/{src/operators → operators}/image.d.ts +2 -2
  23. package/dist/{src/operators → operators}/index.d.ts +30 -30
  24. package/dist/{src/src/operators → operators}/intersect.d.ts +2 -2
  25. package/dist/{src/src/operators → operators}/isEqual.d.ts +2 -2
  26. package/dist/{src/operators → operators}/isRelation.d.ts +1 -1
  27. package/dist/{src/operators → operators}/join.d.ts +2 -2
  28. package/dist/{src/operators → operators}/left_join.d.ts +2 -2
  29. package/dist/{src/src/operators → operators}/matching.d.ts +2 -2
  30. package/dist/{src/src/operators → operators}/minus.d.ts +2 -2
  31. package/dist/{src/src/operators → operators}/not_matching.d.ts +2 -2
  32. package/dist/{src/operators → operators}/one.d.ts +2 -2
  33. package/dist/{src/operators → operators}/prefix.d.ts +2 -2
  34. package/dist/{src/src/operators → operators}/project.d.ts +2 -2
  35. package/dist/{src/operators → operators}/rename.d.ts +2 -2
  36. package/dist/{src/operators → operators}/restrict.d.ts +2 -2
  37. package/dist/{src/operators → operators}/suffix.d.ts +2 -2
  38. package/dist/{src/operators → operators}/summarize.d.ts +2 -2
  39. package/dist/{src/operators → operators}/transform.d.ts +2 -2
  40. package/dist/{src/src/operators → operators}/ungroup.d.ts +2 -2
  41. package/dist/{src/operators → operators}/union.d.ts +2 -2
  42. package/dist/{src/operators → operators}/unwrap.d.ts +2 -2
  43. package/dist/{src/operators → operators}/where.d.ts +1 -1
  44. package/dist/{src/operators → operators}/wrap.d.ts +2 -2
  45. package/dist/{src/operators → operators}/yByX.d.ts +2 -2
  46. package/dist/{src/src/support → support}/toPredicateFunc.d.ts +2 -2
  47. package/dist/{src/src/types.d.ts → types.d.ts} +162 -101
  48. package/package.json +6 -4
  49. package/src/Relation/Memory.ts +13 -12
  50. package/src/index.ts +1 -1
  51. package/src/lib-definitions.ts +281 -0
  52. package/src/types.ts +142 -54
  53. package/dist/src/Relation/index.d.ts +0 -1
  54. package/dist/src/Relation.d.ts +0 -8
  55. package/dist/src/index.d.ts +0 -27
  56. package/dist/src/operators/group.d.ts +0 -2
  57. package/dist/src/operators/intersect.d.ts +0 -2
  58. package/dist/src/operators/isEqual.d.ts +0 -2
  59. package/dist/src/operators/matching.d.ts +0 -2
  60. package/dist/src/operators/minus.d.ts +0 -2
  61. package/dist/src/operators/not_matching.d.ts +0 -2
  62. package/dist/src/operators/project.d.ts +0 -2
  63. package/dist/src/operators/ungroup.d.ts +0 -2
  64. package/dist/src/src/Relation/Memory.d.ts +0 -46
  65. package/dist/src/src/index.d.ts +0 -27
  66. package/dist/src/src/operators/_helpers.d.ts +0 -142
  67. package/dist/src/src/operators/allbut.d.ts +0 -2
  68. package/dist/src/src/operators/autowrap.d.ts +0 -2
  69. package/dist/src/src/operators/constants.d.ts +0 -2
  70. package/dist/src/src/operators/cross_product.d.ts +0 -3
  71. package/dist/src/src/operators/exclude.d.ts +0 -2
  72. package/dist/src/src/operators/extend.d.ts +0 -2
  73. package/dist/src/src/operators/image.d.ts +0 -2
  74. package/dist/src/src/operators/index.d.ts +0 -30
  75. package/dist/src/src/operators/isRelation.d.ts +0 -1
  76. package/dist/src/src/operators/join.d.ts +0 -2
  77. package/dist/src/src/operators/left_join.d.ts +0 -2
  78. package/dist/src/src/operators/one.d.ts +0 -2
  79. package/dist/src/src/operators/prefix.d.ts +0 -2
  80. package/dist/src/src/operators/rename.d.ts +0 -2
  81. package/dist/src/src/operators/restrict.d.ts +0 -2
  82. package/dist/src/src/operators/suffix.d.ts +0 -2
  83. package/dist/src/src/operators/summarize.d.ts +0 -2
  84. package/dist/src/src/operators/transform.d.ts +0 -2
  85. package/dist/src/src/operators/union.d.ts +0 -2
  86. package/dist/src/src/operators/unwrap.d.ts +0 -2
  87. package/dist/src/src/operators/where.d.ts +0 -1
  88. package/dist/src/src/operators/wrap.d.ts +0 -2
  89. package/dist/src/src/operators/yByX.d.ts +0 -2
  90. package/dist/src/src/utility-types.d.ts +0 -43
  91. package/dist/src/support/toPredicateFunc.d.ts +0 -2
  92. package/dist/src/tests/bmg.test.d.ts +0 -1
  93. package/dist/src/tests/fixtures.d.ts +0 -6
  94. package/dist/src/tests/operators/allbut.test.d.ts +0 -1
  95. package/dist/src/tests/operators/autowrap.test.d.ts +0 -1
  96. package/dist/src/tests/operators/constants.test.d.ts +0 -1
  97. package/dist/src/tests/operators/cross_product.test.d.ts +0 -1
  98. package/dist/src/tests/operators/exclude.test.d.ts +0 -1
  99. package/dist/src/tests/operators/extend.test.d.ts +0 -1
  100. package/dist/src/tests/operators/group.test.d.ts +0 -1
  101. package/dist/src/tests/operators/image.test.d.ts +0 -1
  102. package/dist/src/tests/operators/intersect.test.d.ts +0 -1
  103. package/dist/src/tests/operators/isEqual.test.d.ts +0 -1
  104. package/dist/src/tests/operators/join.test.d.ts +0 -1
  105. package/dist/src/tests/operators/left_join.test.d.ts +0 -1
  106. package/dist/src/tests/operators/matching.test.d.ts +0 -1
  107. package/dist/src/tests/operators/minus.test.d.ts +0 -1
  108. package/dist/src/tests/operators/not_matching.test.d.ts +0 -1
  109. package/dist/src/tests/operators/one.test.d.ts +0 -1
  110. package/dist/src/tests/operators/prefix.test.d.ts +0 -1
  111. package/dist/src/tests/operators/project.test.d.ts +0 -1
  112. package/dist/src/tests/operators/rename.test.d.ts +0 -1
  113. package/dist/src/tests/operators/restrict.test.d.ts +0 -1
  114. package/dist/src/tests/operators/suffix.test.d.ts +0 -1
  115. package/dist/src/tests/operators/summarize.test.d.ts +0 -1
  116. package/dist/src/tests/operators/transform.test.d.ts +0 -1
  117. package/dist/src/tests/operators/ungroup.test.d.ts +0 -1
  118. package/dist/src/tests/operators/union.test.d.ts +0 -1
  119. package/dist/src/tests/operators/unwrap.test.d.ts +0 -1
  120. package/dist/src/tests/operators/where.test.d.ts +0 -1
  121. package/dist/src/tests/operators/wrap.test.d.ts +0 -1
  122. package/dist/src/tests/operators/yByX.test.d.ts +0 -1
  123. package/dist/src/tests/types/relation.test.d.ts +0 -1
  124. package/dist/src/types.d.ts +0 -101
  125. package/dist/src/utility-types.d.ts +0 -43
  126. package/dist/tests/bmg.test.d.ts +0 -1
  127. package/dist/tests/fixtures.d.ts +0 -6
  128. package/dist/tests/operators/allbut.test.d.ts +0 -1
  129. package/dist/tests/operators/autowrap.test.d.ts +0 -1
  130. package/dist/tests/operators/constants.test.d.ts +0 -1
  131. package/dist/tests/operators/cross_product.test.d.ts +0 -1
  132. package/dist/tests/operators/exclude.test.d.ts +0 -1
  133. package/dist/tests/operators/extend.test.d.ts +0 -1
  134. package/dist/tests/operators/group.test.d.ts +0 -1
  135. package/dist/tests/operators/image.test.d.ts +0 -1
  136. package/dist/tests/operators/intersect.test.d.ts +0 -1
  137. package/dist/tests/operators/isEqual.test.d.ts +0 -1
  138. package/dist/tests/operators/join.test.d.ts +0 -1
  139. package/dist/tests/operators/left_join.test.d.ts +0 -1
  140. package/dist/tests/operators/matching.test.d.ts +0 -1
  141. package/dist/tests/operators/minus.test.d.ts +0 -1
  142. package/dist/tests/operators/not_matching.test.d.ts +0 -1
  143. package/dist/tests/operators/one.test.d.ts +0 -1
  144. package/dist/tests/operators/prefix.test.d.ts +0 -1
  145. package/dist/tests/operators/project.test.d.ts +0 -1
  146. package/dist/tests/operators/rename.test.d.ts +0 -1
  147. package/dist/tests/operators/restrict.test.d.ts +0 -1
  148. package/dist/tests/operators/suffix.test.d.ts +0 -1
  149. package/dist/tests/operators/summarize.test.d.ts +0 -1
  150. package/dist/tests/operators/transform.test.d.ts +0 -1
  151. package/dist/tests/operators/ungroup.test.d.ts +0 -1
  152. package/dist/tests/operators/union.test.d.ts +0 -1
  153. package/dist/tests/operators/unwrap.test.d.ts +0 -1
  154. package/dist/tests/operators/where.test.d.ts +0 -1
  155. package/dist/tests/operators/wrap.test.d.ts +0 -1
  156. package/dist/tests/operators/yByX.test.d.ts +0 -1
  157. package/dist/tests/types/relation.test.d.ts +0 -1
  158. package/src/utility-types.ts +0 -77
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,77 +0,0 @@
1
- /**
2
- * Utility types for type transformations in relational operators.
3
- * These enable compile-time tracking of how operators transform tuple types.
4
- */
5
-
6
- import type { Tuple } from './types';
7
-
8
- // ============================================================================
9
- // Rename Types
10
- // ============================================================================
11
-
12
- /** Map from old attribute names to new attribute names */
13
- export type RenameMap<T> = { [K in keyof T]?: string };
14
-
15
- /** Transform tuple type by renaming keys according to RenameMap */
16
- export type Renamed<T, R extends RenameMap<T>> = {
17
- [K in keyof T as K extends keyof R ? (R[K] extends string ? R[K] : K) : K]: T[K];
18
- };
19
-
20
- // ============================================================================
21
- // Prefix/Suffix Types
22
- // ============================================================================
23
-
24
- /** Prefix all keys except those in Except */
25
- export type Prefixed<T, P extends string, Except extends keyof T = never> = {
26
- [K in keyof T as K extends Except ? K : `${P}${K & string}`]: T[K];
27
- };
28
-
29
- /** Suffix all keys except those in Except */
30
- export type Suffixed<T, S extends string, Except extends keyof T = never> = {
31
- [K in keyof T as K extends Except ? K : `${K & string}${S}`]: T[K];
32
- };
33
-
34
- // ============================================================================
35
- // Join Types
36
- // ============================================================================
37
-
38
- /** Extract common keys between two tuple types */
39
- export type CommonKeys<L, R> = Extract<keyof L, keyof R>;
40
-
41
- /** Result of inner join: L & R with R's common keys removed */
42
- export type Joined<L, R> = L & Omit<R, CommonKeys<L, R>>;
43
-
44
- /** Result of left join: L & optional R attributes (common keys removed) */
45
- export type LeftJoined<L, R> = L & Partial<Omit<R, CommonKeys<L, R>>>;
46
-
47
- // ============================================================================
48
- // Wrap/Unwrap Types
49
- // ============================================================================
50
-
51
- /** Result of wrap: remove wrapped attrs, add nested object */
52
- export type Wrapped<T, K extends keyof T, As extends string> =
53
- Omit<T, K> & Record<As, Pick<T, K>>;
54
-
55
- /** Result of unwrap: remove object attr, spread its properties */
56
- export type Unwrapped<T, K extends keyof T> =
57
- T[K] extends Record<string, unknown> ? Omit<T, K> & T[K] : Omit<T, K>;
58
-
59
- // Note: Ungrouped is defined in types.ts since it references Relation
60
-
61
- // ============================================================================
62
- // Aggregator Result Types
63
- // ============================================================================
64
-
65
- /** Infer result type from aggregator specification */
66
- export type AggregatorResult<A> =
67
- A extends 'count' ? number :
68
- A extends { op: 'count' } ? number :
69
- A extends { op: 'sum' | 'avg' | 'min' | 'max' } ? number | null :
70
- A extends { op: 'collect' } ? unknown[] :
71
- A extends (tuples: Tuple[]) => infer R ? R :
72
- unknown;
73
-
74
- /** Map aggregator definitions to their result types */
75
- export type AggregatorResults<Aggs extends Record<string, unknown>> = {
76
- [K in keyof Aggs]: AggregatorResult<Aggs[K]>;
77
- };