tyneq 1.0.0 → 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.
- package/README.md +67 -1
- package/dist/{TyneqCachedTerminalOperator.d.ts → TyneqCachedTerminalOperator-BrW77zIy.d.ts} +328 -173
- package/dist/{TyneqCachedTerminalOperator.d.cts → TyneqCachedTerminalOperator-EaNiNt61.d.cts} +328 -173
- package/dist/chunk-5R4AALC7.js +680 -0
- package/dist/chunk-C5PBY3ZU.cjs +46 -0
- package/dist/chunk-OWKUE3AC.cjs +680 -0
- package/dist/chunk-PCBN5AFG.js +46 -0
- package/dist/chunk-VJAICXA6.cjs +3788 -0
- package/dist/chunk-ZP6WMZCK.js +3788 -0
- package/dist/core-C54TSmgW.d.cts +1390 -0
- package/dist/core-C54TSmgW.d.ts +1390 -0
- package/dist/index.cjs +638 -843
- package/dist/index.d.cts +405 -605
- package/dist/index.d.ts +405 -605
- package/dist/index.js +630 -781
- package/dist/plugin/index.cjs +51 -24
- package/dist/plugin/index.d.cts +35 -38
- package/dist/plugin/index.d.ts +35 -38
- package/dist/plugin/index.js +51 -2
- package/dist/utility/index.cjs +18 -9
- package/dist/utility/index.d.cts +312 -2
- package/dist/utility/index.d.ts +312 -2
- package/dist/utility/index.js +18 -3
- package/package.json +5 -5
- package/dist/Lazy.cjs +0 -762
- package/dist/Lazy.cjs.map +0 -1
- package/dist/Lazy.js +0 -691
- package/dist/Lazy.js.map +0 -1
- package/dist/TyneqCachedTerminalOperator.cjs +0 -4950
- package/dist/TyneqCachedTerminalOperator.cjs.map +0 -1
- package/dist/TyneqCachedTerminalOperator.d.cts.map +0 -1
- package/dist/TyneqCachedTerminalOperator.d.ts.map +0 -1
- package/dist/TyneqCachedTerminalOperator.js +0 -4741
- package/dist/TyneqCachedTerminalOperator.js.map +0 -1
- package/dist/ValidationBuilder.cjs +0 -80
- package/dist/ValidationBuilder.cjs.map +0 -1
- package/dist/ValidationBuilder.d.cts +0 -319
- package/dist/ValidationBuilder.d.cts.map +0 -1
- package/dist/ValidationBuilder.d.ts +0 -319
- package/dist/ValidationBuilder.d.ts.map +0 -1
- package/dist/ValidationBuilder.js +0 -69
- package/dist/ValidationBuilder.js.map +0 -1
- package/dist/core.d.cts +0 -1393
- package/dist/core.d.cts.map +0 -1
- package/dist/core.d.ts +0 -1393
- package/dist/core.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/plugin/index.d.cts.map +0 -1
- package/dist/plugin/index.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { T as TyneqSequence, a as Optional, I as ItemSelector, C as Comparer, M as Maybe, b as OperatorMetadata, Q as QueryPlanVisitor, c as QueryPlanPrinterOptions, d as QueryPlanNode, e as QueryPlanWalkerOptions, N as Nullable } from './core-C54TSmgW.js';
|
|
2
|
+
export { A as Action, f as Assume, B as BoundMethod, g as CacheResult, h as CachedEnumerable, i as Cast, j as Constructor, k as Enumerable, E as Enumerator, l as EnumeratorFactory, m as EqualityComparer, F as Factory, n as FieldKeys, o as Func, G as GenericFunction, H as HasLength, p as InstanceOf, q as ItemAction, r as ItemPredicate, s as IteratorFactory, K as KeyValuePair, t as Method, u as MethodKeys, v as MinMaxResult, w as NoInfer, x as OperatorCategory, y as OperatorEntry, z as OperatorKind, O as OperatorSource, D as OrderedEnumerable, P as Predicate, J as QueryNode, L as QueryPlanTraversalDirection, S as SequenceConstructor, R as SequenceFactory, U as SourceKind, V as TyneqCachedSequence, W as TyneqEnumerableFactory, X as TyneqOrderedSequence, Y as WithProperties, Z as isSourceNode, _ as tyneqQueryNode } from './core-C54TSmgW.js';
|
|
3
|
+
export { AccessorDescriptor, ArgumentUtility, DataDescriptor, Lazy, MemberDescriptor, MethodDescriptor, ReflectOptions, ReflectionContext, TypeGuardUtility, ValidationBuilder, reflect } from './utility/index.js';
|
|
4
|
+
export { O as OperatorRegistry, T as TyneqBaseEnumerator, s as TyneqCachedEnumerable, a as TyneqCachedEnumerator, b as TyneqCachedTerminalOperator, c as TyneqEnumerator, u as TyneqOrderedEnumerable, d as TyneqOrderedEnumerator, e as TyneqOrderedTerminalOperator, f as TyneqTerminalOperator, g as cachedOperator, h as cachedTerminal, i as createCachedOperator, j as createCachedTerminalOperator, k as createGeneratorOperator, l as createOperator, m as createOrderedOperator, n as createOrderedTerminalOperator, o as createTerminalOperator, p as operator, q as orderedOperator, r as orderedTerminal, t as terminal } from './TyneqCachedTerminalOperator-BrW77zIy.js';
|
|
4
5
|
|
|
5
|
-
//#region src/core/tyneq.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Entry point for creating Tyneq sequences.
|
|
8
8
|
*
|
|
@@ -18,108 +18,107 @@ import { S as operator, _ as cachedTerminal, a as TyneqOrderedEnumerator, b as c
|
|
|
18
18
|
* @group Classes
|
|
19
19
|
*/
|
|
20
20
|
declare class Tyneq {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Creates a lazy sequence from any `Iterable<T>` (arrays, sets, generators, etc.).
|
|
23
|
+
*
|
|
24
|
+
* @throws {ArgumentNullError} When `source` is null or undefined.
|
|
25
|
+
* @throws {ArgumentTypeError} When `source` is not iterable.
|
|
26
|
+
*/
|
|
27
|
+
static from<TSource>(source: Iterable<TSource>): TyneqSequence<TSource>;
|
|
28
|
+
private static resolveSourceKind;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a sequence of `count` elements produced by calling `randomizer` once per element.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Returns an empty sequence when `count === 0`.
|
|
34
|
+
*
|
|
35
|
+
* @throws {ArgumentOutOfRangeError} When `count` is negative.
|
|
36
|
+
* @throws {ArgumentNullError} When `randomizer` is null or undefined.
|
|
37
|
+
*/
|
|
38
|
+
static random<TSource>(count: number, randomizer: () => TSource): TyneqSequence<TSource>;
|
|
39
|
+
/**
|
|
40
|
+
* Returns `true` if `source` is `null`, `undefined`, or an iterable whose first element is `null` or `undefined`.
|
|
41
|
+
*/
|
|
42
|
+
static isNullOrEmpty<TSource>(source: Optional<Iterable<TSource>>): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a sequence of `count` integers starting from `start`.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* Returns an empty sequence when `count === 0`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* Tyneq.range(1, 5).toArray(); // -> [1, 2, 3, 4, 5]
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @throws {ArgumentOutOfRangeError} When `count` is negative.
|
|
55
|
+
* @throws {ArgumentError} When `count` is not an integer.
|
|
56
|
+
*/
|
|
57
|
+
static range(start: number, count: number): TyneqSequence<number>;
|
|
58
|
+
/** Returns an empty sequence with zero elements. */
|
|
59
|
+
static empty<TSource>(): TyneqSequence<TSource>;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a sequence that yields `value` exactly `count` times.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* Tyneq.repeat("x", 3).toArray(); // -> ["x", "x", "x"]
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @throws {ArgumentOutOfRangeError} When `count` is negative.
|
|
69
|
+
* @throws {ArgumentError} When `count` is not an integer.
|
|
70
|
+
*/
|
|
71
|
+
static repeat<TSource>(value: TSource, count: number): TyneqSequence<TSource>;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a sequence by repeatedly applying `next` to produce each element from the previous one.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* The selector receives `(currentValue, index)`. Each call's return value becomes the input
|
|
77
|
+
* for the next call. Omit `count` for an infinite sequence; pair with `take` to bound it.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* Tyneq.generate(1, (x) => x * 2, 4).toArray(); // -> [2, 4, 8, 16]
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @throws {ArgumentNullError} When `next` is null or undefined.
|
|
85
|
+
* @throws {ArgumentOutOfRangeError} When `count` is negative.
|
|
86
|
+
* @throws {ArgumentError} When `count` is not an integer.
|
|
87
|
+
*/
|
|
88
|
+
static generate<TSource, TResult extends TSource>(seed: TSource, next: ItemSelector<TSource, TResult>, count?: number): TyneqSequence<TResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a sequence that yields all elements from each source in order.
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* Returns an empty sequence when called with no arguments.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* Tyneq.concat([1, 2], [3, 4], [5]).toArray(); // -> [1, 2, 3, 4, 5]
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @throws {ArgumentNullError} When any `source` is null or undefined.
|
|
101
|
+
* @throws {ArgumentTypeError} When any `source` is not iterable.
|
|
102
|
+
*/
|
|
103
|
+
static concat<TSource>(...sources: Iterable<TSource>[]): TyneqSequence<TSource>;
|
|
104
|
+
/**
|
|
105
|
+
* Pairs each element with its zero-based index.
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* Each iteration produces independent index counters - safe to re-enumerate.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* Tyneq.enumerate(["a", "b", "c"]).toArray();
|
|
113
|
+
* // -> [[0, "a"], [1, "b"], [2, "c"]]
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @throws {ArgumentNullError} When `source` is null or undefined.
|
|
117
|
+
* @throws {ArgumentTypeError} When `source` is not iterable.
|
|
118
|
+
*/
|
|
119
|
+
static enumerate<TSource>(source: Iterable<TSource>): TyneqSequence<[number, TSource]>;
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
//#region src/core/TyneqComparer.d.ts
|
|
121
|
+
|
|
123
122
|
/**
|
|
124
123
|
* Built-in comparers and equality comparers used by ordering and equality operators.
|
|
125
124
|
*
|
|
@@ -129,86 +128,85 @@ declare class Tyneq {
|
|
|
129
128
|
* @group Utilities
|
|
130
129
|
*/
|
|
131
130
|
declare class TyneqComparer {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
131
|
+
private constructor();
|
|
132
|
+
/**
|
|
133
|
+
* Natural-order comparer using `<` and `>`.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* Works correctly for numbers, strings, dates, and any type that supports the relational operators.
|
|
137
|
+
*
|
|
138
|
+
* @returns Negative if `a < b`, positive if `a > b`, `0` if equal.
|
|
139
|
+
*/
|
|
140
|
+
static defaultComparer<T>(a: T, b: T): number;
|
|
141
|
+
/** Strict equality comparer using `===`. */
|
|
142
|
+
static defaultEqualityComparer<T>(a: T, b: T): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Returns a comparer that reverses the order of `comparer`.
|
|
145
|
+
*
|
|
146
|
+
* @remarks
|
|
147
|
+
* Use this to invert any custom comparer - for example, to sort by a locale-aware comparer
|
|
148
|
+
* in descending order without rewriting it.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* const desc = TyneqComparer.reverse(TyneqComparer.createLocaleComparer("en"));
|
|
153
|
+
* seq.orderBy((s) => s, desc);
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
static reverse<T>(comparer: Comparer<T>): Comparer<T>;
|
|
157
|
+
/**
|
|
158
|
+
* Returns a locale-aware string comparer backed by `Intl.Collator`.
|
|
159
|
+
*
|
|
160
|
+
* @remarks
|
|
161
|
+
* Pass a `locale` and optional `options` for deterministic cross-environment ordering.
|
|
162
|
+
* Without arguments the comparer uses the runtime locale, which may vary across environments.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* seq.orderBy((s) => s, TyneqComparer.createLocaleComparer("en"));
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @param locale - BCP 47 language tag(s) passed to `Intl.Collator`.
|
|
170
|
+
* @param options - `Intl.CollatorOptions` passed to `Intl.Collator`.
|
|
171
|
+
*
|
|
172
|
+
* @see {@link caseInsensitiveComparer} for a locale-independent case-insensitive ordering comparer.
|
|
173
|
+
*/
|
|
174
|
+
static createLocaleComparer(locale?: string | string[], options?: Intl.CollatorOptions): Comparer<string>;
|
|
175
|
+
/**
|
|
176
|
+
* Case-insensitive string equality comparer.
|
|
177
|
+
*
|
|
178
|
+
* @remarks
|
|
179
|
+
* Converts both values to lower-case with `toLowerCase()` before comparing with `===`.
|
|
180
|
+
* Locale-independent: results are consistent across environments.
|
|
181
|
+
*
|
|
182
|
+
* Use {@link createLocaleComparer} with `{ sensitivity: "base" }` for locale-aware
|
|
183
|
+
* case-insensitive equality.
|
|
184
|
+
*
|
|
185
|
+
* @see {@link caseInsensitiveComparer} for the ordering (negative/zero/positive) counterpart.
|
|
186
|
+
*/
|
|
187
|
+
static caseInsensitiveEqualityComparer(a: string, b: string): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Case-insensitive ordering comparer.
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* Converts both values to lower-case with `toLowerCase()` and compares with `<` / `>`.
|
|
193
|
+
* Locale-independent: results are consistent across environments and match
|
|
194
|
+
* {@link caseInsensitiveEqualityComparer} - strings that compare equal here return `true`
|
|
195
|
+
* there, and vice versa.
|
|
196
|
+
*
|
|
197
|
+
* Use {@link createLocaleComparer} when you need locale-aware case-insensitive ordering.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* seq.orderBy((s) => s, TyneqComparer.caseInsensitiveComparer)
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @see {@link caseInsensitiveEqualityComparer} for the boolean equality counterpart.
|
|
205
|
+
* @see {@link createLocaleComparer} for locale-aware ordering.
|
|
206
|
+
*/
|
|
207
|
+
static caseInsensitiveComparer(a: string, b: string): number;
|
|
209
208
|
}
|
|
210
|
-
|
|
211
|
-
//#region src/core/errors/TyneqError.d.ts
|
|
209
|
+
|
|
212
210
|
/**
|
|
213
211
|
* Base class for all errors thrown by Tyneq.
|
|
214
212
|
*
|
|
@@ -221,14 +219,13 @@ declare class TyneqComparer {
|
|
|
221
219
|
* @group Errors
|
|
222
220
|
*/
|
|
223
221
|
declare class TyneqError extends Error {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
222
|
+
/** The underlying error that caused this error, if any. */
|
|
223
|
+
inner: Maybe<Error>;
|
|
224
|
+
constructor(message: string, options?: {
|
|
225
|
+
inner?: Error;
|
|
226
|
+
});
|
|
229
227
|
}
|
|
230
|
-
|
|
231
|
-
//#region src/core/errors/InvalidOperationError.d.ts
|
|
228
|
+
|
|
232
229
|
/**
|
|
233
230
|
* Thrown when a method call is invalid for the current state of the object.
|
|
234
231
|
*
|
|
@@ -242,10 +239,9 @@ declare class TyneqError extends Error {
|
|
|
242
239
|
* @group Errors
|
|
243
240
|
*/
|
|
244
241
|
declare class InvalidOperationError extends TyneqError {
|
|
245
|
-
|
|
242
|
+
constructor(message?: string, inner?: Error);
|
|
246
243
|
}
|
|
247
|
-
|
|
248
|
-
//#region src/core/errors/KeyNotFoundError.d.ts
|
|
244
|
+
|
|
249
245
|
/**
|
|
250
246
|
* Thrown when a lookup is performed with a key that does not exist in the collection.
|
|
251
247
|
*
|
|
@@ -259,10 +255,9 @@ declare class InvalidOperationError extends TyneqError {
|
|
|
259
255
|
* @group Errors
|
|
260
256
|
*/
|
|
261
257
|
declare class KeyNotFoundError extends TyneqError {
|
|
262
|
-
|
|
258
|
+
constructor(message?: string, inner?: Error);
|
|
263
259
|
}
|
|
264
|
-
|
|
265
|
-
//#region src/core/errors/NotSupportedError.d.ts
|
|
260
|
+
|
|
266
261
|
/**
|
|
267
262
|
* Thrown when a requested operation is not supported.
|
|
268
263
|
*
|
|
@@ -276,10 +271,9 @@ declare class KeyNotFoundError extends TyneqError {
|
|
|
276
271
|
* @group Errors
|
|
277
272
|
*/
|
|
278
273
|
declare class NotSupportedError extends TyneqError {
|
|
279
|
-
|
|
274
|
+
constructor(message?: string, inner?: Error);
|
|
280
275
|
}
|
|
281
|
-
|
|
282
|
-
//#region src/core/errors/SequenceContainsNoElementsError.d.ts
|
|
276
|
+
|
|
283
277
|
/**
|
|
284
278
|
* Thrown when an element is required from a sequence that contains no elements.
|
|
285
279
|
*
|
|
@@ -293,11 +287,10 @@ declare class NotSupportedError extends TyneqError {
|
|
|
293
287
|
* @group Errors
|
|
294
288
|
*/
|
|
295
289
|
declare class SequenceContainsNoElementsError extends InvalidOperationError {
|
|
296
|
-
|
|
297
|
-
|
|
290
|
+
readonly operatorName: Maybe<string>;
|
|
291
|
+
constructor(operatorName?: string, inner?: Error);
|
|
298
292
|
}
|
|
299
|
-
|
|
300
|
-
//#region src/core/errors/argument/ArgumentError.d.ts
|
|
293
|
+
|
|
301
294
|
/**
|
|
302
295
|
* Thrown when a method argument fails validation.
|
|
303
296
|
*
|
|
@@ -311,12 +304,11 @@ declare class SequenceContainsNoElementsError extends InvalidOperationError {
|
|
|
311
304
|
* @group Errors
|
|
312
305
|
*/
|
|
313
306
|
declare class ArgumentError extends TyneqError {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
307
|
+
/** The name of the parameter that caused the error. */
|
|
308
|
+
readonly paramName?: string;
|
|
309
|
+
constructor(message: string, paramName?: string, inner?: Error);
|
|
317
310
|
}
|
|
318
|
-
|
|
319
|
-
//#region src/core/errors/argument/ArgumentNullError.d.ts
|
|
311
|
+
|
|
320
312
|
/**
|
|
321
313
|
* Thrown when a required argument is `null`.
|
|
322
314
|
*
|
|
@@ -330,10 +322,9 @@ declare class ArgumentError extends TyneqError {
|
|
|
330
322
|
* @group Errors
|
|
331
323
|
*/
|
|
332
324
|
declare class ArgumentNullError extends ArgumentError {
|
|
333
|
-
|
|
325
|
+
constructor(paramName: string, inner?: Error);
|
|
334
326
|
}
|
|
335
|
-
|
|
336
|
-
//#region src/core/errors/argument/ArgumentOutOfRangeError.d.ts
|
|
327
|
+
|
|
337
328
|
/**
|
|
338
329
|
* Thrown when an argument is outside the valid range.
|
|
339
330
|
*
|
|
@@ -347,12 +338,11 @@ declare class ArgumentNullError extends ArgumentError {
|
|
|
347
338
|
* @group Errors
|
|
348
339
|
*/
|
|
349
340
|
declare class ArgumentOutOfRangeError extends ArgumentError {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
341
|
+
/** The actual value that was out of range. */
|
|
342
|
+
readonly actualValue?: unknown;
|
|
343
|
+
constructor(paramName: string, message?: string, actualValue?: unknown, inner?: Error);
|
|
353
344
|
}
|
|
354
|
-
|
|
355
|
-
//#region src/core/errors/argument/ArgumentTypeError.d.ts
|
|
345
|
+
|
|
356
346
|
/**
|
|
357
347
|
* Thrown when an argument has the wrong type.
|
|
358
348
|
*
|
|
@@ -366,14 +356,13 @@ declare class ArgumentOutOfRangeError extends ArgumentError {
|
|
|
366
356
|
* @group Errors
|
|
367
357
|
*/
|
|
368
358
|
declare class ArgumentTypeError extends ArgumentError {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
359
|
+
/** The expected type name. */
|
|
360
|
+
readonly expectedType?: string;
|
|
361
|
+
/** The actual type name received. */
|
|
362
|
+
readonly actualType?: string;
|
|
363
|
+
constructor(paramName: string, expectedType?: string, actualType?: string, message?: string, inner?: Error);
|
|
374
364
|
}
|
|
375
|
-
|
|
376
|
-
//#region src/core/errors/argument/ValidationError.d.ts
|
|
365
|
+
|
|
377
366
|
/**
|
|
378
367
|
* Thrown when multiple argument validations fail simultaneously.
|
|
379
368
|
*
|
|
@@ -391,12 +380,11 @@ declare class ArgumentTypeError extends ArgumentError {
|
|
|
391
380
|
* @group Errors
|
|
392
381
|
*/
|
|
393
382
|
declare class ValidationError extends ArgumentError {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
383
|
+
/** The individual validation failure messages. */
|
|
384
|
+
readonly errors: readonly string[];
|
|
385
|
+
constructor(errors: readonly string[]);
|
|
397
386
|
}
|
|
398
|
-
|
|
399
|
-
//#region src/core/errors/CompilerError.d.ts
|
|
387
|
+
|
|
400
388
|
/**
|
|
401
389
|
* Thrown when the query plan compiler encounters a structural or semantic error
|
|
402
390
|
* while compiling a query plan into an executable sequence.
|
|
@@ -415,19 +403,18 @@ declare class ValidationError extends ArgumentError {
|
|
|
415
403
|
* @group Errors
|
|
416
404
|
*/
|
|
417
405
|
declare class CompilerError extends TyneqError {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
406
|
+
/** The name of the operator being compiled when the error occurred, if known. */
|
|
407
|
+
readonly operatorName: Maybe<string>;
|
|
408
|
+
/**
|
|
409
|
+
* The compilation phase in which the error occurred.
|
|
410
|
+
* - `"transform"` - during query plan transformation (pre-compile)
|
|
411
|
+
* - `"source"` - while compiling a source node
|
|
412
|
+
* - `"operator"` - while applying an operator node
|
|
413
|
+
*/
|
|
414
|
+
readonly phase: "transform" | "source" | "operator";
|
|
415
|
+
constructor(message: string, phase: "transform" | "source" | "operator", operatorName?: string, inner?: Error);
|
|
428
416
|
}
|
|
429
|
-
|
|
430
|
-
//#region src/core/errors/RegistryError.d.ts
|
|
417
|
+
|
|
431
418
|
/**
|
|
432
419
|
* Thrown when the operator registry encounters a conflict or invalid state
|
|
433
420
|
* during operator registration or invocation.
|
|
@@ -446,30 +433,29 @@ declare class CompilerError extends TyneqError {
|
|
|
446
433
|
* @group Errors
|
|
447
434
|
*/
|
|
448
435
|
declare class RegistryError extends TyneqError {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
436
|
+
/** The name of the operator involved in the error. */
|
|
437
|
+
readonly operatorName: string;
|
|
438
|
+
/**
|
|
439
|
+
* The kind of the operator that was being registered or invoked.
|
|
440
|
+
* `undefined` if the kind is not applicable to this error.
|
|
441
|
+
*/
|
|
442
|
+
readonly kind: Maybe<OperatorMetadata["kind"]>;
|
|
443
|
+
/**
|
|
444
|
+
* The kind already present in the registry for this name, when there is a conflict.
|
|
445
|
+
* `undefined` when the error is not a duplicate-registration conflict.
|
|
446
|
+
*/
|
|
447
|
+
readonly conflictingKind: Maybe<OperatorMetadata["kind"]>;
|
|
448
|
+
/**
|
|
449
|
+
* The source that originally registered the conflicting operator.
|
|
450
|
+
* `undefined` when the error is not a duplicate-registration conflict.
|
|
451
|
+
*/
|
|
452
|
+
readonly conflictingSource: Maybe<OperatorMetadata["source"]>;
|
|
453
|
+
constructor(message: string, operatorName: string, kind?: OperatorMetadata["kind"], conflict?: {
|
|
454
|
+
kind: OperatorMetadata["kind"];
|
|
455
|
+
source: OperatorMetadata["source"];
|
|
456
|
+
}, inner?: Error);
|
|
470
457
|
}
|
|
471
|
-
|
|
472
|
-
//#region src/core/errors/PluginError.d.ts
|
|
458
|
+
|
|
473
459
|
/**
|
|
474
460
|
* Thrown when a plugin, decorator (`@operator`, `@terminal`), or factory
|
|
475
461
|
* (`createOperator`, `createTerminalOperator`) is used incorrectly.
|
|
@@ -484,19 +470,18 @@ declare class RegistryError extends TyneqError {
|
|
|
484
470
|
* @group Errors
|
|
485
471
|
*/
|
|
486
472
|
declare class PluginError extends TyneqError {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
473
|
+
/**
|
|
474
|
+
* The name of the decorator or factory that produced the error.
|
|
475
|
+
* e.g. `"operator"`, `"terminal"`, `"createOperator"`.
|
|
476
|
+
*/
|
|
477
|
+
readonly decoratorName: string;
|
|
478
|
+
/**
|
|
479
|
+
* The name of the class or function the decorator was applied to, if available.
|
|
480
|
+
*/
|
|
481
|
+
readonly targetName: Maybe<string>;
|
|
482
|
+
constructor(message: string, decoratorName: string, targetName?: string, inner?: Error);
|
|
497
483
|
}
|
|
498
|
-
|
|
499
|
-
//#region src/core/errors/ReflectionError.d.ts
|
|
484
|
+
|
|
500
485
|
/**
|
|
501
486
|
* Thrown when a prototype reflection operation fails - for example, when a
|
|
502
487
|
* method that is expected to exist on a prototype cannot be found.
|
|
@@ -515,193 +500,13 @@ declare class PluginError extends TyneqError {
|
|
|
515
500
|
* @group Errors
|
|
516
501
|
*/
|
|
517
502
|
declare class ReflectionError extends TyneqError {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
//#endregion
|
|
525
|
-
//#region src/core/registry/TyneqOperatorRegistry.d.ts
|
|
526
|
-
/**
|
|
527
|
-
* Central registry for all Tyneq operators.
|
|
528
|
-
*
|
|
529
|
-
* Every registration path - `@operator`, `@terminal`, `createOperator`,
|
|
530
|
-
* `createGeneratorOperator`, `createTerminalOperator` - flows through this class.
|
|
531
|
-
* It is the single source of truth for which operators exist, their kind, and their
|
|
532
|
-
* prototype-level implementation.
|
|
533
|
-
*
|
|
534
|
-
* Internally the registry maintains two separate namespaces:
|
|
535
|
-
* - Source factories (`Tyneq.from`, `Tyneq.range`, etc.) - keyed by name alone.
|
|
536
|
-
* - Instance operators (`.where`, `.select`, etc.) - keyed by (name, targetClass).
|
|
537
|
-
*
|
|
538
|
-
* This means a source factory and an instance method can share a name without
|
|
539
|
-
* conflict (e.g. `Tyneq.concat` and `seq.concat`), and two instance operators
|
|
540
|
-
* with the same name on different prototype chains (e.g. `ordered.foo` and
|
|
541
|
-
* `cached.foo`) also coexist without conflict.
|
|
542
|
-
*
|
|
543
|
-
* @example
|
|
544
|
-
* ```ts
|
|
545
|
-
* import { OperatorRegistry } from "tyneq/plugin";
|
|
546
|
-
*
|
|
547
|
-
* OperatorRegistry.has("where"); // -> true
|
|
548
|
-
* OperatorRegistry.list(); // -> OperatorMetadata[]
|
|
549
|
-
* ```
|
|
550
|
-
*
|
|
551
|
-
* @group Classes
|
|
552
|
-
*/
|
|
553
|
-
declare class OperatorRegistry {
|
|
554
|
-
private static readonly _sources;
|
|
555
|
-
private static readonly _operators;
|
|
556
|
-
private static readonly _registrationHooks;
|
|
557
|
-
private static readonly _registrationGuards;
|
|
558
|
-
/**
|
|
559
|
-
* Registers an operator entry and patches the method onto `entry.metadata.targetClass.prototype`.
|
|
560
|
-
*
|
|
561
|
-
* @throws {RegistryError} When an operator with the same name is already registered on the same targetClass.
|
|
562
|
-
*/
|
|
563
|
-
static register(input: OperatorEntry): void;
|
|
564
|
-
/**
|
|
565
|
-
* Removes an operator registration and deletes the prototype method for external operators.
|
|
566
|
-
*
|
|
567
|
-
* Checks the instance operator namespace first, then the source namespace.
|
|
568
|
-
*
|
|
569
|
-
* @returns `true` if the operator was found and removed; `false` if no operator with that name existed.
|
|
570
|
-
* @remarks
|
|
571
|
-
* Internal operators (source `"internal"`) are not removed from the prototype - only
|
|
572
|
-
* their registry entry is deleted.
|
|
573
|
-
*
|
|
574
|
-
* For targeted removal use {@link unregisterOperator} or {@link unregisterSource}.
|
|
575
|
-
*/
|
|
576
|
-
static unregister(name: string): boolean;
|
|
577
|
-
/**
|
|
578
|
-
* Removes a specific instance operator registration for a given (name, targetClass) pair
|
|
579
|
-
* and deletes the prototype method for external operators.
|
|
580
|
-
*
|
|
581
|
-
* @returns `true` if the entry was found and removed; `false` otherwise.
|
|
582
|
-
*/
|
|
583
|
-
static unregisterOperator(name: string, targetClass: SequenceConstructor): boolean;
|
|
584
|
-
/**
|
|
585
|
-
* Removes a source factory registration.
|
|
586
|
-
*
|
|
587
|
-
* @returns `true` if the source was found and removed; `false` otherwise.
|
|
588
|
-
*/
|
|
589
|
-
static unregisterSource(name: string): boolean;
|
|
590
|
-
/**
|
|
591
|
-
* Registers a hook called after every successful operator registration (both namespaces).
|
|
592
|
-
*
|
|
593
|
-
* @returns A function that removes the hook when called.
|
|
594
|
-
*/
|
|
595
|
-
static onRegister(hook: (entry: OperatorEntry) => void): () => void;
|
|
596
|
-
/**
|
|
597
|
-
* Registers a guard called before every registration (both namespaces).
|
|
598
|
-
* Throw from the guard to reject the registration.
|
|
599
|
-
*
|
|
600
|
-
* @returns A function that removes the guard when called.
|
|
601
|
-
*/
|
|
602
|
-
static addGuard(guard: (entry: OperatorEntry) => void): () => void;
|
|
603
|
-
/**
|
|
604
|
-
* Returns `true` if a name exists in either the source or instance operator namespace.
|
|
605
|
-
* Use {@link hasSource} or {@link hasOperator} for namespace-specific checks.
|
|
606
|
-
*/
|
|
607
|
-
static has(name: string): boolean;
|
|
608
|
-
/**
|
|
609
|
-
* Returns `true` if a source factory with `name` is registered.
|
|
610
|
-
*/
|
|
611
|
-
static hasSource(name: string): boolean;
|
|
612
|
-
/**
|
|
613
|
-
* Returns `true` if an instance operator with `name` is registered.
|
|
614
|
-
* When `targetClass` is provided, checks only that specific (name, targetClass) pair.
|
|
615
|
-
* When omitted, returns `true` if any target has an operator with that name.
|
|
616
|
-
*/
|
|
617
|
-
static hasOperator(name: string, targetClass?: SequenceConstructor): boolean;
|
|
618
|
-
/**
|
|
619
|
-
* Returns the operator entry for `name` from either namespace, or `undefined` if not found.
|
|
620
|
-
* Checks the instance operator namespace first, then the source namespace.
|
|
621
|
-
* For namespace-specific retrieval use {@link getSource} or {@link getOperator}.
|
|
622
|
-
*/
|
|
623
|
-
static get(name: string): Maybe<OperatorEntry>;
|
|
624
|
-
/**
|
|
625
|
-
* Returns the source factory entry for `name`, or `undefined` if not registered.
|
|
626
|
-
*/
|
|
627
|
-
static getSource(name: string): Maybe<OperatorEntry>;
|
|
628
|
-
/**
|
|
629
|
-
* Returns the instance operator entry for `name` on `targetClass`, or `undefined`.
|
|
630
|
-
* When `targetClass` is omitted, returns the first entry found across all targets.
|
|
631
|
-
*/
|
|
632
|
-
static getOperator(name: string, targetClass?: SequenceConstructor): Maybe<OperatorEntry>;
|
|
633
|
-
/**
|
|
634
|
-
* Returns the metadata for `name` from either namespace, or `undefined` if not found.
|
|
635
|
-
* Checks instance operators first, then sources.
|
|
636
|
-
*/
|
|
637
|
-
static getMetadata(name: string): Maybe<OperatorMetadata>;
|
|
638
|
-
/**
|
|
639
|
-
* Returns metadata for all registered operators and source factories.
|
|
640
|
-
* Use {@link listOperators} or {@link listSources} for namespace-specific lists.
|
|
641
|
-
*/
|
|
642
|
-
static list(): readonly OperatorMetadata[];
|
|
643
|
-
/**
|
|
644
|
-
* Returns metadata for all registered source factories.
|
|
645
|
-
*/
|
|
646
|
-
static listSources(): readonly OperatorMetadata[];
|
|
647
|
-
/**
|
|
648
|
-
* Returns metadata for all registered instance operators.
|
|
649
|
-
* When `targetClass` is provided, returns only entries for that specific target class.
|
|
650
|
-
*/
|
|
651
|
-
static listOperators(targetClass?: SequenceConstructor): readonly OperatorMetadata[];
|
|
652
|
-
/** Returns metadata for all operators of `kind` across both namespaces. */
|
|
653
|
-
static listByKind(kind: OperatorMetadata["kind"]): readonly OperatorMetadata[];
|
|
654
|
-
/** Returns metadata for all operators from `source` across both namespaces. */
|
|
655
|
-
static listBySource(source: OperatorMetadata["source"]): readonly OperatorMetadata[];
|
|
656
|
-
/** Returns the total number of registered operators across both namespaces. */
|
|
657
|
-
static count(): number;
|
|
658
|
-
/**
|
|
659
|
-
* Registers a source operator (a static factory, not a prototype method).
|
|
660
|
-
*
|
|
661
|
-
* @remarks
|
|
662
|
-
* Source operators differ from prototype operators in two ways:
|
|
663
|
-
* - They are called with `null` as `this` - they have no instance.
|
|
664
|
-
* - They are looked up by the compiler via {@link getSource} rather than
|
|
665
|
-
* being patched onto a prototype.
|
|
666
|
-
*
|
|
667
|
-
* The entry is stored in the source namespace and is never patched onto any prototype.
|
|
668
|
-
* Registration guards run for `"external"` sources (same policy as {@link register}).
|
|
669
|
-
* Guards are skipped for `"internal"` sources (same policy used for internal builtins).
|
|
670
|
-
*
|
|
671
|
-
* Third-party source operators registered here are automatically compiled by
|
|
672
|
-
* `QueryPlanCompiler` without any changes to the compiler.
|
|
673
|
-
*
|
|
674
|
-
* @param name - The operator name, matching the `operatorName` on the `QueryPlanNode`.
|
|
675
|
-
* @param factory - The factory function; receives the node args in order, `this` is `null`.
|
|
676
|
-
* @param source - Whether this is a built-in or external source operator. Defaults to `"external"`.
|
|
677
|
-
*
|
|
678
|
-
* @example
|
|
679
|
-
* ```ts
|
|
680
|
-
* import { OperatorRegistry } from "tyneq/plugin";
|
|
681
|
-
* import { Tyneq } from "tyneq";
|
|
682
|
-
*
|
|
683
|
-
* OperatorRegistry.registerSource("fibonacci", (count) => {
|
|
684
|
-
* // return a Tyneq sequence of fibonacci numbers
|
|
685
|
-
* });
|
|
686
|
-
* ```
|
|
687
|
-
*
|
|
688
|
-
* @group Classes
|
|
689
|
-
*/
|
|
690
|
-
static registerSource(name: string, factory: (...args: unknown[]) => unknown, source?: OperatorSource): void;
|
|
691
|
-
/**
|
|
692
|
-
* Records a built-in operator in the instance operator namespace without patching the prototype.
|
|
693
|
-
* Built-in operators already live as direct methods on their target class.
|
|
694
|
-
*
|
|
695
|
-
* @remarks
|
|
696
|
-
* Registration guards are intentionally skipped - builtins are internal and
|
|
697
|
-
* trusted; guards exist to validate external plugin registrations only.
|
|
698
|
-
*
|
|
699
|
-
* @internal
|
|
700
|
-
*/
|
|
701
|
-
static registerBuiltin(name: string, kind: OperatorMetadata["kind"], targetClass: SequenceConstructor): void;
|
|
503
|
+
/** The name of the method that could not be found. */
|
|
504
|
+
readonly methodName: string;
|
|
505
|
+
/** The name of the prototype/class that was searched. */
|
|
506
|
+
readonly prototypeName: Maybe<string>;
|
|
507
|
+
constructor(message: string, methodName: string, prototypeName?: string, inner?: Error);
|
|
702
508
|
}
|
|
703
|
-
|
|
704
|
-
//#region src/queryplan/QueryPlanPrinter.d.ts
|
|
509
|
+
|
|
705
510
|
/**
|
|
706
511
|
* Converts a query plan tree into a human-readable multi-line string.
|
|
707
512
|
*
|
|
@@ -722,29 +527,28 @@ declare class OperatorRegistry {
|
|
|
722
527
|
* @group QueryPlan
|
|
723
528
|
*/
|
|
724
529
|
declare class QueryPlanPrinter implements QueryPlanVisitor<string> {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
530
|
+
protected readonly indent: string;
|
|
531
|
+
protected readonly arrow: string;
|
|
532
|
+
protected readonly maxInlineArrayItems: number;
|
|
533
|
+
constructor(options?: QueryPlanPrinterOptions);
|
|
534
|
+
/** Renders the full query plan rooted at `node` as a multi-line string. */
|
|
535
|
+
visit(node: QueryPlanNode): string;
|
|
536
|
+
/** Convenience static: creates a printer with `options` and calls `visit(node)`. */
|
|
537
|
+
static print(node: QueryPlanNode, options?: QueryPlanPrinterOptions): string;
|
|
538
|
+
/**
|
|
539
|
+
* Formats a single operator argument for display.
|
|
540
|
+
* Override to customise how arguments appear in printed plans.
|
|
541
|
+
*/
|
|
542
|
+
protected formatArg(arg: unknown): string;
|
|
543
|
+
/**
|
|
544
|
+
* Formats one line of the plan output.
|
|
545
|
+
* Override to customise indentation or arrow style beyond what `QueryPlanPrinterOptions` allows.
|
|
546
|
+
*/
|
|
547
|
+
protected formatLine(name: string, argStr: string, isRoot: boolean): string;
|
|
548
|
+
private buildPlan;
|
|
549
|
+
private collectNodes;
|
|
745
550
|
}
|
|
746
|
-
|
|
747
|
-
//#region src/queryplan/QueryPlanWalker.d.ts
|
|
551
|
+
|
|
748
552
|
/**
|
|
749
553
|
* Concrete base class for side-effect query plan visitors.
|
|
750
554
|
*
|
|
@@ -796,32 +600,31 @@ declare class QueryPlanPrinter implements QueryPlanVisitor<string> {
|
|
|
796
600
|
* @group QueryPlan
|
|
797
601
|
*/
|
|
798
602
|
declare class QueryPlanWalker implements QueryPlanVisitor<void> {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
603
|
+
private readonly callback;
|
|
604
|
+
private readonly direction;
|
|
605
|
+
/**
|
|
606
|
+
* @param options - Optional configuration for the walker.
|
|
607
|
+
*/
|
|
608
|
+
constructor(options?: QueryPlanWalkerOptions);
|
|
609
|
+
/**
|
|
610
|
+
* Walks the full chain rooted at `node`, calling {@link visitNode} for each node
|
|
611
|
+
* in the configured direction.
|
|
612
|
+
*/
|
|
613
|
+
visit(node: QueryPlanNode): void;
|
|
614
|
+
/**
|
|
615
|
+
* Called once per node during traversal.
|
|
616
|
+
*
|
|
617
|
+
* @remarks
|
|
618
|
+
* The default implementation fires the callback passed via options (if any).
|
|
619
|
+
* Override this method in a subclass to provide custom behaviour. Subclasses that
|
|
620
|
+
* override this method decide whether to call `super.visitNode(node)` to also fire
|
|
621
|
+
* the options callback.
|
|
622
|
+
*
|
|
623
|
+
* @param node - The current node being visited.
|
|
624
|
+
*/
|
|
625
|
+
protected visitNode(node: QueryPlanNode): void;
|
|
822
626
|
}
|
|
823
|
-
|
|
824
|
-
//#region src/queryplan/QueryPlanTransformer.d.ts
|
|
627
|
+
|
|
825
628
|
/**
|
|
826
629
|
* Base class for immutable query plan rewriting.
|
|
827
630
|
*
|
|
@@ -854,30 +657,29 @@ declare class QueryPlanWalker implements QueryPlanVisitor<void> {
|
|
|
854
657
|
* @group QueryPlan
|
|
855
658
|
*/
|
|
856
659
|
declare class QueryPlanTransformer implements QueryPlanVisitor<QueryPlanNode> {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Transforms the full chain rooted at `node` and returns the new root node.
|
|
662
|
+
*
|
|
663
|
+
* @remarks
|
|
664
|
+
* Processes source-first (bottom-up): the source chain is fully transformed before
|
|
665
|
+
* `transformNode` is called for the current node. This means `source` passed to
|
|
666
|
+
* `transformNode` is always already the transformed predecessor.
|
|
667
|
+
*/
|
|
668
|
+
visit(node: QueryPlanNode): QueryPlanNode;
|
|
669
|
+
/**
|
|
670
|
+
* Transforms a single node. Override to intercept specific operators.
|
|
671
|
+
*
|
|
672
|
+
* @remarks
|
|
673
|
+
* The default implementation reconstructs the node with identical data (identity transform).
|
|
674
|
+
* `source` is the already-transformed predecessor - use it as the `source` of any returned
|
|
675
|
+
* node to preserve chain continuity.
|
|
676
|
+
*
|
|
677
|
+
* @param node - The original node (unmodified).
|
|
678
|
+
* @param source - The transformed predecessor, or `null` for source nodes.
|
|
679
|
+
*/
|
|
680
|
+
protected transformNode(node: QueryPlanNode, source: Nullable<QueryPlanNode>): QueryPlanNode;
|
|
878
681
|
}
|
|
879
|
-
|
|
880
|
-
//#region src/queryplan/QueryPlanOptimizer.d.ts
|
|
682
|
+
|
|
881
683
|
/**
|
|
882
684
|
* A built-in {@link QueryPlanTransformer} that fuses redundant consecutive operators.
|
|
883
685
|
*
|
|
@@ -932,47 +734,46 @@ declare class QueryPlanTransformer implements QueryPlanVisitor<QueryPlanNode> {
|
|
|
932
734
|
* @group QueryPlan
|
|
933
735
|
*/
|
|
934
736
|
declare class QueryPlanOptimizer extends QueryPlanTransformer {
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
737
|
+
protected transformNode(node: QueryPlanNode, source: Nullable<QueryPlanNode>): QueryPlanNode;
|
|
738
|
+
/**
|
|
739
|
+
* @remarks Fusion is only semantics-preserving for pure, side-effect-free predicates.
|
|
740
|
+
*/
|
|
741
|
+
private fuseWhere;
|
|
742
|
+
/**
|
|
743
|
+
* @remarks Fusion is only semantics-preserving for pure, side-effect-free projections.
|
|
744
|
+
*/
|
|
745
|
+
private fuseSelect;
|
|
944
746
|
}
|
|
945
|
-
|
|
946
|
-
//#region src/queryplan/compiler/QueryPlanCompiler.d.ts
|
|
747
|
+
|
|
947
748
|
/**
|
|
948
749
|
* Options for {@link QueryPlanCompiler.compile} and {@link QueryPlanCompiler.compileRaw}.
|
|
949
750
|
*
|
|
950
751
|
* @group QueryPlan
|
|
951
752
|
*/
|
|
952
753
|
interface CompileOptions {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
754
|
+
/**
|
|
755
|
+
* Replaces the source data when compiling.
|
|
756
|
+
*
|
|
757
|
+
* When provided, the compiler passes this value as the first argument to the source
|
|
758
|
+
* operator instead of the value stored in the plan node's `args`. This lets you reuse
|
|
759
|
+
* the same pipeline structure (operators, predicates, projections) against a different
|
|
760
|
+
* data set without rebuilding the sequence.
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```ts
|
|
764
|
+
* const plan = Tyneq.from([1, 2, 3]).where(x => x > 1).select(x => x * 2)[tyneqQueryNode]!;
|
|
765
|
+
* const compiler = new QueryPlanCompiler();
|
|
766
|
+
*
|
|
767
|
+
* compiler.compile(plan).toArray(); // -> [4, 6]
|
|
768
|
+
* compiler.compile(plan, { source: [10, 20, 30] }).toArray(); // -> [40, 60]
|
|
769
|
+
* ```
|
|
770
|
+
*
|
|
771
|
+
* @remarks
|
|
772
|
+
* Only affects source nodes (the root of the plan). All operator nodes are replayed
|
|
773
|
+
* exactly as recorded. If the plan has no source node (e.g. it starts from an operator
|
|
774
|
+
* node with a missing parent), this option has no effect.
|
|
775
|
+
*/
|
|
776
|
+
readonly source?: Iterable<unknown>;
|
|
976
777
|
}
|
|
977
778
|
/**
|
|
978
779
|
* Compiles a query plan tree into an executable `TyneqSequence`.
|
|
@@ -996,43 +797,42 @@ interface CompileOptions {
|
|
|
996
797
|
* @group QueryPlan
|
|
997
798
|
*/
|
|
998
799
|
declare class QueryPlanCompiler {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
800
|
+
private readonly transformers;
|
|
801
|
+
constructor(transformers?: Iterable<QueryPlanTransformer>);
|
|
802
|
+
/**
|
|
803
|
+
* Compile a query plan into an executable sequence.
|
|
804
|
+
*
|
|
805
|
+
* Runs all registered transformers before compiling. Use {@link compileRaw} to skip
|
|
806
|
+
* the transform phase when the plan is already optimised.
|
|
807
|
+
*
|
|
808
|
+
* @param node - The root node of the query plan to compile.
|
|
809
|
+
* @param options - Optional compile-time overrides. Use `options.source` to supply a
|
|
810
|
+
* different data source than the one stored in the plan.
|
|
811
|
+
* @returns The compiled sequence typed as `TyneqSequence<T>` by default.
|
|
812
|
+
* If you know the plan ends in an operator that returns a subtype (e.g. `orderBy` ->
|
|
813
|
+
* `TyneqOrderedSequence`, `memoize` -> `TyneqCachedSequence`), supply `TResult` explicitly:
|
|
814
|
+
* `compiler.compile<number, TyneqOrderedSequence<number>>(node)`.
|
|
815
|
+
*/
|
|
816
|
+
compile<T = unknown, TResult extends TyneqSequence<T> = TyneqSequence<T>>(node: QueryPlanNode, options?: CompileOptions): TResult;
|
|
817
|
+
/**
|
|
818
|
+
* Compile a pre-optimised query plan into an executable sequence, skipping the
|
|
819
|
+
* transform phase.
|
|
820
|
+
*
|
|
821
|
+
* @remarks
|
|
822
|
+
* Use this overload when you have already run transformers externally (or deliberately
|
|
823
|
+
* want to bypass them) and want to compile the node as-is. Equivalent to constructing
|
|
824
|
+
* a `QueryPlanCompiler` with no transformers and calling `compile()`.
|
|
825
|
+
*
|
|
826
|
+
* @param node - The root node of the already-transformed query plan to compile.
|
|
827
|
+
* @param options - Optional compile-time overrides. Use `options.source` to supply a
|
|
828
|
+
* different data source than the one stored in the plan.
|
|
829
|
+
*/
|
|
830
|
+
compileRaw<T = unknown, TResult extends TyneqSequence<T> = TyneqSequence<T>>(node: QueryPlanNode, options?: CompileOptions): TResult;
|
|
831
|
+
private transform;
|
|
832
|
+
private compileNode;
|
|
833
|
+
private compileSource;
|
|
834
|
+
private applyOperator;
|
|
835
|
+
private findOperatorEntry;
|
|
1035
836
|
}
|
|
1036
|
-
|
|
1037
|
-
export {
|
|
1038
|
-
//# sourceMappingURL=index.d.ts.map
|
|
837
|
+
|
|
838
|
+
export { ArgumentError, ArgumentNullError, ArgumentOutOfRangeError, ArgumentTypeError, Comparer, type CompileOptions, CompilerError, QueryPlanNode as IQueryNode, InvalidOperationError, ItemSelector, KeyNotFoundError, Maybe, NotSupportedError, Nullable, OperatorMetadata, Optional, PluginError, QueryPlanCompiler, QueryPlanOptimizer, QueryPlanPrinter, QueryPlanPrinterOptions, QueryPlanTransformer, QueryPlanVisitor, QueryPlanWalker, QueryPlanWalkerOptions, ReflectionError, RegistryError, SequenceContainsNoElementsError, Tyneq, TyneqComparer, TyneqError, TyneqSequence, ValidationError };
|