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/{TyneqCachedTerminalOperator.d.cts → TyneqCachedTerminalOperator-EaNiNt61.d.cts}
RENAMED
|
@@ -1,6 +1,183 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as OperatorEntry, S as SequenceConstructor, M as Maybe, b as OperatorMetadata, O as OperatorSource, j as Constructor, k as Enumerable, l as EnumeratorFactory, $ as TyneqEnumerableBase, X as TyneqOrderedSequence, T as TyneqSequence, N as Nullable, D as OrderedEnumerable, _ as tyneqQueryNode, d as QueryPlanNode, C as Comparer, E as Enumerator, a0 as BaseEnumerableSorter, V as TyneqCachedSequence, h as CachedEnumerable, g as CacheResult } from './core-C54TSmgW.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Central registry for all Tyneq operators.
|
|
5
|
+
*
|
|
6
|
+
* Every registration path - `@operator`, `@terminal`, `createOperator`,
|
|
7
|
+
* `createGeneratorOperator`, `createTerminalOperator` - flows through this class.
|
|
8
|
+
* It is the single source of truth for which operators exist, their kind, and their
|
|
9
|
+
* prototype-level implementation.
|
|
10
|
+
*
|
|
11
|
+
* Internally the registry maintains two separate namespaces:
|
|
12
|
+
* - Source factories (`Tyneq.from`, `Tyneq.range`, etc.) - keyed by name alone.
|
|
13
|
+
* - Instance operators (`.where`, `.select`, etc.) - keyed by (name, targetClass).
|
|
14
|
+
*
|
|
15
|
+
* This means a source factory and an instance method can share a name without
|
|
16
|
+
* conflict (e.g. `Tyneq.concat` and `seq.concat`), and two instance operators
|
|
17
|
+
* with the same name on different prototype chains (e.g. `ordered.foo` and
|
|
18
|
+
* `cached.foo`) also coexist without conflict.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { OperatorRegistry } from "tyneq/plugin";
|
|
23
|
+
*
|
|
24
|
+
* OperatorRegistry.has("where"); // -> true
|
|
25
|
+
* OperatorRegistry.list(); // -> OperatorMetadata[]
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @group Classes
|
|
29
|
+
*/
|
|
30
|
+
declare class OperatorRegistry {
|
|
31
|
+
private static readonly _sources;
|
|
32
|
+
private static readonly _operators;
|
|
33
|
+
private static readonly _registrationHooks;
|
|
34
|
+
private static readonly _registrationGuards;
|
|
35
|
+
/**
|
|
36
|
+
* Registers an operator entry and patches the method onto `entry.metadata.targetClass.prototype`.
|
|
37
|
+
*
|
|
38
|
+
* @throws {RegistryError} When an operator with the same name is already registered on the same targetClass.
|
|
39
|
+
*/
|
|
40
|
+
static register(input: OperatorEntry): void;
|
|
41
|
+
/**
|
|
42
|
+
* Removes an operator registration and deletes the prototype method for external operators.
|
|
43
|
+
*
|
|
44
|
+
* Checks the instance operator namespace first, then the source namespace.
|
|
45
|
+
*
|
|
46
|
+
* @returns `true` if the operator was found and removed; `false` if no operator with that name existed.
|
|
47
|
+
* @remarks
|
|
48
|
+
* Internal operators (source `"internal"`) are not removed from the prototype - only
|
|
49
|
+
* their registry entry is deleted.
|
|
50
|
+
*
|
|
51
|
+
* For targeted removal use {@link unregisterOperator} or {@link unregisterSource}.
|
|
52
|
+
*/
|
|
53
|
+
static unregister(name: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Removes a specific instance operator registration for a given (name, targetClass) pair
|
|
56
|
+
* and deletes the prototype method for external operators.
|
|
57
|
+
*
|
|
58
|
+
* @returns `true` if the entry was found and removed; `false` otherwise.
|
|
59
|
+
*/
|
|
60
|
+
static unregisterOperator(name: string, targetClass: SequenceConstructor): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Removes a source factory registration.
|
|
63
|
+
*
|
|
64
|
+
* @returns `true` if the source was found and removed; `false` otherwise.
|
|
65
|
+
*/
|
|
66
|
+
static unregisterSource(name: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Registers a hook called after every successful operator registration (both namespaces).
|
|
69
|
+
*
|
|
70
|
+
* @returns A function that removes the hook when called.
|
|
71
|
+
*/
|
|
72
|
+
static onRegister(hook: (entry: OperatorEntry) => void): () => void;
|
|
73
|
+
/**
|
|
74
|
+
* Registers a guard called before every registration (both namespaces).
|
|
75
|
+
* Throw from the guard to reject the registration.
|
|
76
|
+
*
|
|
77
|
+
* @returns A function that removes the guard when called.
|
|
78
|
+
*/
|
|
79
|
+
static addGuard(guard: (entry: OperatorEntry) => void): () => void;
|
|
80
|
+
/**
|
|
81
|
+
* Returns `true` if a name exists in either the source or instance operator namespace.
|
|
82
|
+
* Use {@link hasSource} or {@link hasOperator} for namespace-specific checks.
|
|
83
|
+
*/
|
|
84
|
+
static has(name: string): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Returns `true` if a source factory with `name` is registered.
|
|
87
|
+
*/
|
|
88
|
+
static hasSource(name: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Returns `true` if an instance operator with `name` is registered.
|
|
91
|
+
* When `targetClass` is provided, checks only that specific (name, targetClass) pair.
|
|
92
|
+
* When omitted, returns `true` if any target has an operator with that name.
|
|
93
|
+
*/
|
|
94
|
+
static hasOperator(name: string, targetClass?: SequenceConstructor): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the operator entry for `name` from either namespace, or `undefined` if not found.
|
|
97
|
+
* Checks the instance operator namespace first, then the source namespace.
|
|
98
|
+
* For namespace-specific retrieval use {@link getSource} or {@link getOperator}.
|
|
99
|
+
*/
|
|
100
|
+
static get(name: string): Maybe<OperatorEntry>;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the source factory entry for `name`, or `undefined` if not registered.
|
|
103
|
+
*/
|
|
104
|
+
static getSource(name: string): Maybe<OperatorEntry>;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the instance operator entry for `name` on `targetClass`, or `undefined`.
|
|
107
|
+
* When `targetClass` is omitted, returns the first entry found across all targets.
|
|
108
|
+
*/
|
|
109
|
+
static getOperator(name: string, targetClass?: SequenceConstructor): Maybe<OperatorEntry>;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the metadata for `name` from either namespace, or `undefined` if not found.
|
|
112
|
+
* Checks instance operators first, then sources.
|
|
113
|
+
*/
|
|
114
|
+
static getMetadata(name: string): Maybe<OperatorMetadata>;
|
|
115
|
+
/**
|
|
116
|
+
* Returns metadata for all registered operators and source factories.
|
|
117
|
+
* Use {@link listOperators} or {@link listSources} for namespace-specific lists.
|
|
118
|
+
*/
|
|
119
|
+
static list(): readonly OperatorMetadata[];
|
|
120
|
+
/**
|
|
121
|
+
* Returns metadata for all registered source factories.
|
|
122
|
+
*/
|
|
123
|
+
static listSources(): readonly OperatorMetadata[];
|
|
124
|
+
/**
|
|
125
|
+
* Returns metadata for all registered instance operators.
|
|
126
|
+
* When `targetClass` is provided, returns only entries for that specific target class.
|
|
127
|
+
*/
|
|
128
|
+
static listOperators(targetClass?: SequenceConstructor): readonly OperatorMetadata[];
|
|
129
|
+
/** Returns metadata for all operators of `kind` across both namespaces. */
|
|
130
|
+
static listByKind(kind: OperatorMetadata["kind"]): readonly OperatorMetadata[];
|
|
131
|
+
/** Returns metadata for all operators from `source` across both namespaces. */
|
|
132
|
+
static listBySource(source: OperatorMetadata["source"]): readonly OperatorMetadata[];
|
|
133
|
+
/** Returns the total number of registered operators across both namespaces. */
|
|
134
|
+
static count(): number;
|
|
135
|
+
/**
|
|
136
|
+
* Registers a source operator (a static factory, not a prototype method).
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* Source operators differ from prototype operators in two ways:
|
|
140
|
+
* - They are called with `null` as `this` - they have no instance.
|
|
141
|
+
* - They are looked up by the compiler via {@link getSource} rather than
|
|
142
|
+
* being patched onto a prototype.
|
|
143
|
+
*
|
|
144
|
+
* The entry is stored in the source namespace and is never patched onto any prototype.
|
|
145
|
+
* Registration guards run for `"external"` sources (same policy as {@link register}).
|
|
146
|
+
* Guards are skipped for `"internal"` sources (same policy used for internal builtins).
|
|
147
|
+
*
|
|
148
|
+
* Third-party source operators registered here are automatically compiled by
|
|
149
|
+
* `QueryPlanCompiler` without any changes to the compiler.
|
|
150
|
+
*
|
|
151
|
+
* @param name - The operator name, matching the `operatorName` on the `QueryPlanNode`.
|
|
152
|
+
* @param factory - The factory function; receives the node args in order, `this` is `null`.
|
|
153
|
+
* @param source - Whether this is a built-in or external source operator. Defaults to `"external"`.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* import { OperatorRegistry } from "tyneq/plugin";
|
|
158
|
+
* import { Tyneq } from "tyneq";
|
|
159
|
+
*
|
|
160
|
+
* OperatorRegistry.registerSource("fibonacci", (count) => {
|
|
161
|
+
* // return a Tyneq sequence of fibonacci numbers
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* @group Classes
|
|
166
|
+
*/
|
|
167
|
+
static registerSource(name: string, factory: (...args: unknown[]) => unknown, source?: OperatorSource): void;
|
|
168
|
+
/**
|
|
169
|
+
* Records a built-in operator in the instance operator namespace without patching the prototype.
|
|
170
|
+
* Built-in operators already live as direct methods on their target class.
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* Registration guards are intentionally skipped - builtins are internal and
|
|
174
|
+
* trusted; guards exist to validate external plugin registrations only.
|
|
175
|
+
*
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
static registerBuiltin(name: string, kind: OperatorMetadata["kind"], targetClass: SequenceConstructor): void;
|
|
179
|
+
}
|
|
2
180
|
|
|
3
|
-
//#region src/plugin/decorators/operator.d.ts
|
|
4
181
|
/**
|
|
5
182
|
* Class decorator that registers a `TyneqEnumerator` subclass as an operator on every sequence.
|
|
6
183
|
*
|
|
@@ -34,8 +211,7 @@ import { L as Constructor, M as tyneqQueryNode, S as TyneqEnumerableBase, T as Q
|
|
|
34
211
|
* @group Decorators
|
|
35
212
|
*/
|
|
36
213
|
declare function operator<TArgs extends unknown[] = never>(name: string, category: "streaming" | "buffer", validate?: (...args: TArgs) => void): <TClass extends new (...args: any[]) => any>(target: TClass, _context: ClassDecoratorContext) => TClass;
|
|
37
|
-
|
|
38
|
-
//#region src/plugin/decorators/orderedOperator.d.ts
|
|
214
|
+
|
|
39
215
|
/**
|
|
40
216
|
* Class decorator that registers a `TyneqOrderedEnumerator` subclass as an operator
|
|
41
217
|
* available only on ordered sequences.
|
|
@@ -70,8 +246,7 @@ declare function operator<TArgs extends unknown[] = never>(name: string, categor
|
|
|
70
246
|
* @group Decorators
|
|
71
247
|
*/
|
|
72
248
|
declare function orderedOperator<TArgs extends unknown[] = never>(name: string, category: "streaming" | "buffer", validate?: (...args: TArgs) => void): <TClass extends Constructor<any>>(target: TClass, _context: ClassDecoratorContext<TClass>) => TClass;
|
|
73
|
-
|
|
74
|
-
//#region src/plugin/decorators/cachedOperator.d.ts
|
|
249
|
+
|
|
75
250
|
/**
|
|
76
251
|
* Class decorator that registers a `TyneqCachedEnumerator` subclass as an operator
|
|
77
252
|
* available only on cached sequences.
|
|
@@ -104,8 +279,7 @@ declare function orderedOperator<TArgs extends unknown[] = never>(name: string,
|
|
|
104
279
|
* @group Decorators
|
|
105
280
|
*/
|
|
106
281
|
declare function cachedOperator<TArgs extends unknown[] = never>(name: string, category: "streaming" | "buffer", validate?: (...args: TArgs) => void): <TClass extends Constructor<any>>(target: TClass, _context: ClassDecoratorContext<TClass>) => TClass;
|
|
107
|
-
|
|
108
|
-
//#region src/plugin/decorators/terminal.d.ts
|
|
282
|
+
|
|
109
283
|
/**
|
|
110
284
|
* Class decorator that registers a class as a terminal operator.
|
|
111
285
|
*
|
|
@@ -134,10 +308,9 @@ declare function cachedOperator<TArgs extends unknown[] = never>(name: string, c
|
|
|
134
308
|
* @group Decorators
|
|
135
309
|
*/
|
|
136
310
|
declare function terminal<TArgs extends unknown[] = never>(name: string, validate?: (...args: TArgs) => void): <TClass extends new (...args: any[]) => {
|
|
137
|
-
|
|
311
|
+
process(): unknown;
|
|
138
312
|
}>(target: TClass, _context: ClassDecoratorContext) => TClass;
|
|
139
|
-
|
|
140
|
-
//#region src/plugin/decorators/orderedTerminal.d.ts
|
|
313
|
+
|
|
141
314
|
/**
|
|
142
315
|
* Class decorator that registers a `TyneqOrderedTerminalOperator` subclass as a terminal
|
|
143
316
|
* operator available only on ordered sequences.
|
|
@@ -165,10 +338,9 @@ declare function terminal<TArgs extends unknown[] = never>(name: string, validat
|
|
|
165
338
|
* @group Decorators
|
|
166
339
|
*/
|
|
167
340
|
declare function orderedTerminal<TArgs extends unknown[] = never>(name: string, validate?: (...args: TArgs) => void): <TClass extends Constructor<{
|
|
168
|
-
|
|
341
|
+
process(): unknown;
|
|
169
342
|
}>>(target: TClass, _context: ClassDecoratorContext<TClass>) => TClass;
|
|
170
|
-
|
|
171
|
-
//#region src/plugin/decorators/cachedTerminal.d.ts
|
|
343
|
+
|
|
172
344
|
/**
|
|
173
345
|
* Class decorator that registers a `TyneqCachedTerminalOperator` subclass as a terminal
|
|
174
346
|
* operator available only on cached sequences.
|
|
@@ -192,10 +364,9 @@ declare function orderedTerminal<TArgs extends unknown[] = never>(name: string,
|
|
|
192
364
|
* @group Decorators
|
|
193
365
|
*/
|
|
194
366
|
declare function cachedTerminal<TArgs extends unknown[] = never>(name: string, validate?: (...args: TArgs) => void): <TClass extends Constructor<{
|
|
195
|
-
|
|
367
|
+
process(): unknown;
|
|
196
368
|
}>>(target: TClass, _context: ClassDecoratorContext<TClass>) => TClass;
|
|
197
|
-
|
|
198
|
-
//#region src/plugin/registration/createOperator.d.ts
|
|
369
|
+
|
|
199
370
|
/**
|
|
200
371
|
* Registers a streaming or buffering operator using a factory function.
|
|
201
372
|
*
|
|
@@ -238,14 +409,13 @@ declare function cachedTerminal<TArgs extends unknown[] = never>(name: string, v
|
|
|
238
409
|
* @group Factory Functions
|
|
239
410
|
*/
|
|
240
411
|
declare function createOperator<TSource, TArgs extends unknown[], TResult>(config: {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
412
|
+
name: string;
|
|
413
|
+
category: "streaming" | "buffer";
|
|
414
|
+
factory: (source: Enumerable<TSource>, ...args: TArgs) => EnumeratorFactory<TResult>;
|
|
415
|
+
validate?: (...args: NoInfer<TArgs>) => void;
|
|
416
|
+
source?: OperatorSource;
|
|
246
417
|
}): void;
|
|
247
|
-
|
|
248
|
-
//#region src/plugin/registration/createGeneratorOperator.d.ts
|
|
418
|
+
|
|
249
419
|
/**
|
|
250
420
|
* Registers an operator using a generator function.
|
|
251
421
|
*
|
|
@@ -299,14 +469,13 @@ declare function createOperator<TSource, TArgs extends unknown[], TResult>(confi
|
|
|
299
469
|
* @group Factory Functions
|
|
300
470
|
*/
|
|
301
471
|
declare function createGeneratorOperator<TSource, TArgs extends unknown[], TResult>(config: {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
472
|
+
name: string;
|
|
473
|
+
category?: "streaming" | "buffer";
|
|
474
|
+
generator: (source: Iterable<TSource>, ...args: TArgs) => IterableIterator<TResult>;
|
|
475
|
+
validate?: (...args: NoInfer<TArgs>) => void;
|
|
476
|
+
source?: OperatorSource;
|
|
307
477
|
}): void;
|
|
308
|
-
|
|
309
|
-
//#region src/core/ordering/TyneqOrderedEnumerable.d.ts
|
|
478
|
+
|
|
310
479
|
/**
|
|
311
480
|
* Concrete implementation of {@link TyneqOrderedSequence}.
|
|
312
481
|
*
|
|
@@ -317,25 +486,24 @@ declare function createGeneratorOperator<TSource, TArgs extends unknown[], TResu
|
|
|
317
486
|
* @internal
|
|
318
487
|
*/
|
|
319
488
|
declare class TyneqOrderedEnumerable<TSource, TKey> extends TyneqEnumerableBase<TSource> implements TyneqOrderedSequence<TSource> {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
489
|
+
private readonly keySelector;
|
|
490
|
+
private readonly comparer;
|
|
491
|
+
private readonly descending;
|
|
492
|
+
readonly source: TyneqSequence<TSource>;
|
|
493
|
+
readonly parent: Nullable<OrderedEnumerable<TSource>>;
|
|
494
|
+
readonly [tyneqQueryNode]: Nullable<QueryPlanNode>;
|
|
495
|
+
constructor(source: TyneqSequence<TSource>, keySelector: (item: TSource) => TKey, comparer: Comparer<TKey>, descending: boolean, parent?: OrderedEnumerable<TSource>, node?: Nullable<QueryPlanNode>);
|
|
496
|
+
asc(): TyneqOrderedSequence<TSource>;
|
|
497
|
+
desc(): TyneqOrderedSequence<TSource>;
|
|
498
|
+
getEnumerator(): Enumerator<TSource>;
|
|
499
|
+
getSorter(next: Nullable<BaseEnumerableSorter<TSource>>): BaseEnumerableSorter<TSource>;
|
|
500
|
+
thenBy<UKey>(keySelector: (item: TSource) => UKey, comparer?: Comparer<UKey>): TyneqOrderedSequence<TSource>;
|
|
501
|
+
thenByDescending<UKey>(keySelector: (item: TSource) => UKey, comparer?: Comparer<UKey>): TyneqOrderedSequence<TSource>;
|
|
502
|
+
protected createEnumerable<TResult>(factory: EnumeratorFactory<TResult>, node: Nullable<QueryPlanNode>): TyneqSequence<TResult>;
|
|
503
|
+
protected createOrderedEnumerable<TKey>(keySelector: (x: TSource) => TKey, comparer: Comparer<TKey>, descending: boolean, node: Nullable<QueryPlanNode>): TyneqOrderedSequence<TSource>;
|
|
504
|
+
protected createCachedEnumerable(source: TyneqSequence<TSource>, node: Nullable<QueryPlanNode>): TyneqCachedSequence<TSource>;
|
|
336
505
|
}
|
|
337
|
-
|
|
338
|
-
//#region src/plugin/registration/createOrderedOperator.d.ts
|
|
506
|
+
|
|
339
507
|
/**
|
|
340
508
|
* Registers a factory function as an operator available only on ordered sequences,
|
|
341
509
|
* where the factory fully controls the return type.
|
|
@@ -376,14 +544,13 @@ declare class TyneqOrderedEnumerable<TSource, TKey> extends TyneqEnumerableBase<
|
|
|
376
544
|
* @group Factory Functions
|
|
377
545
|
*/
|
|
378
546
|
declare function createOrderedOperator<TSource, TArgs extends unknown[]>(config: {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
547
|
+
name: string;
|
|
548
|
+
category: "streaming" | "buffer";
|
|
549
|
+
factory: (source: TyneqOrderedEnumerable<TSource, unknown>, node: QueryPlanNode, ...args: TArgs) => TyneqOrderedSequence<TSource>;
|
|
550
|
+
validate?: (...args: NoInfer<TArgs>) => void;
|
|
551
|
+
source?: OperatorSource;
|
|
384
552
|
}): void;
|
|
385
|
-
|
|
386
|
-
//#region src/core/TyneqCachedEnumerable.d.ts
|
|
553
|
+
|
|
387
554
|
/**
|
|
388
555
|
* Concrete implementation of {@link TyneqCachedSequence} - caches elements incrementally.
|
|
389
556
|
*
|
|
@@ -395,21 +562,20 @@ declare function createOrderedOperator<TSource, TArgs extends unknown[]>(config:
|
|
|
395
562
|
* @internal
|
|
396
563
|
*/
|
|
397
564
|
declare class TyneqCachedEnumerable<TSource> extends TyneqEnumerableBase<TSource> implements TyneqCachedSequence<TSource>, CachedEnumerable<TSource> {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
565
|
+
private source;
|
|
566
|
+
private cache;
|
|
567
|
+
private done;
|
|
568
|
+
private sourceEnumerator;
|
|
569
|
+
readonly [tyneqQueryNode]: Nullable<QueryPlanNode>;
|
|
570
|
+
constructor(source: TyneqSequence<TSource>, node?: Nullable<QueryPlanNode>);
|
|
571
|
+
getEnumerator(): Enumerator<TSource>;
|
|
572
|
+
refresh(): TyneqCachedSequence<TSource>;
|
|
573
|
+
tryGetAtFromCache(index: number): CacheResult<TSource>;
|
|
574
|
+
protected createEnumerable<TResult>(factory: EnumeratorFactory<TResult>, node: Nullable<QueryPlanNode>): TyneqSequence<TResult>;
|
|
575
|
+
protected createOrderedEnumerable<TKey>(keySelector: (x: TSource) => TKey, comparer: Comparer<TKey>, descending: boolean, node: Nullable<QueryPlanNode>): TyneqOrderedSequence<TSource>;
|
|
576
|
+
protected createCachedEnumerable(source: TyneqSequence<TSource>, node: Nullable<QueryPlanNode>): TyneqCachedSequence<TSource>;
|
|
410
577
|
}
|
|
411
|
-
|
|
412
|
-
//#region src/plugin/registration/createCachedOperator.d.ts
|
|
578
|
+
|
|
413
579
|
/**
|
|
414
580
|
* Registers a factory function as an operator available only on cached sequences,
|
|
415
581
|
* where the factory fully controls the return type.
|
|
@@ -443,14 +609,13 @@ declare class TyneqCachedEnumerable<TSource> extends TyneqEnumerableBase<TSource
|
|
|
443
609
|
* @group Factory Functions
|
|
444
610
|
*/
|
|
445
611
|
declare function createCachedOperator<TSource, TArgs extends unknown[]>(config: {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
612
|
+
name: string;
|
|
613
|
+
category: "streaming" | "buffer";
|
|
614
|
+
factory: (source: TyneqCachedEnumerable<TSource>, node: QueryPlanNode, ...args: TArgs) => TyneqCachedSequence<TSource>;
|
|
615
|
+
validate?: (...args: NoInfer<TArgs>) => void;
|
|
616
|
+
source?: OperatorSource;
|
|
451
617
|
}): void;
|
|
452
|
-
|
|
453
|
-
//#region src/plugin/registration/createTerminalOperator.d.ts
|
|
618
|
+
|
|
454
619
|
/**
|
|
455
620
|
* Registers a terminal operator using a plain function.
|
|
456
621
|
*
|
|
@@ -478,13 +643,12 @@ declare function createCachedOperator<TSource, TArgs extends unknown[]>(config:
|
|
|
478
643
|
* @group Factory Functions
|
|
479
644
|
*/
|
|
480
645
|
declare function createTerminalOperator<TSource, TArgs extends unknown[], TResult>(config: {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
646
|
+
name: string;
|
|
647
|
+
execute: (source: Enumerable<TSource>, ...args: TArgs) => TResult;
|
|
648
|
+
validate?: (...args: NoInfer<TArgs>) => void;
|
|
649
|
+
source?: OperatorSource;
|
|
485
650
|
}): void;
|
|
486
|
-
|
|
487
|
-
//#region src/plugin/registration/createOrderedTerminalOperator.d.ts
|
|
651
|
+
|
|
488
652
|
/**
|
|
489
653
|
* Registers a terminal operator available only on ordered sequences.
|
|
490
654
|
*
|
|
@@ -512,13 +676,12 @@ declare function createTerminalOperator<TSource, TArgs extends unknown[], TResul
|
|
|
512
676
|
* @group Factory Functions
|
|
513
677
|
*/
|
|
514
678
|
declare function createOrderedTerminalOperator<TSource, TArgs extends unknown[], TResult>(config: {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
679
|
+
name: string;
|
|
680
|
+
execute: (source: OrderedEnumerable<TSource>, ...args: TArgs) => TResult;
|
|
681
|
+
validate?: (...args: NoInfer<TArgs>) => void;
|
|
682
|
+
source?: OperatorSource;
|
|
519
683
|
}): void;
|
|
520
|
-
|
|
521
|
-
//#region src/plugin/registration/createCachedTerminalOperator.d.ts
|
|
684
|
+
|
|
522
685
|
/**
|
|
523
686
|
* Registers a terminal operator available only on cached sequences.
|
|
524
687
|
*
|
|
@@ -542,13 +705,12 @@ declare function createOrderedTerminalOperator<TSource, TArgs extends unknown[],
|
|
|
542
705
|
* @group Factory Functions
|
|
543
706
|
*/
|
|
544
707
|
declare function createCachedTerminalOperator<TSource, TArgs extends unknown[], TResult>(config: {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
708
|
+
name: string;
|
|
709
|
+
execute: (source: CachedEnumerable<TSource>, ...args: TArgs) => TResult;
|
|
710
|
+
validate?: (...args: NoInfer<TArgs>) => void;
|
|
711
|
+
source?: OperatorSource;
|
|
549
712
|
}): void;
|
|
550
|
-
|
|
551
|
-
//#region src/core/enumerators/TyneqBaseEnumerator.d.ts
|
|
713
|
+
|
|
552
714
|
/**
|
|
553
715
|
* Abstract base class implementing the pull-iterator lifecycle for all Tyneq enumerators.
|
|
554
716
|
*
|
|
@@ -569,50 +731,49 @@ declare function createCachedTerminalOperator<TSource, TArgs extends unknown[],
|
|
|
569
731
|
* @group Plugin
|
|
570
732
|
*/
|
|
571
733
|
declare abstract class TyneqBaseEnumerator<TInput, TOutput = TInput> implements Enumerator<TOutput> {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
734
|
+
private _initialized;
|
|
735
|
+
private _completed;
|
|
736
|
+
constructor();
|
|
737
|
+
/** Advances the iterator, calling `initialize()` on first call. Idempotent after completion. */
|
|
738
|
+
next(): IteratorResult<TOutput>;
|
|
739
|
+
/** Terminates iteration early, disposes resources, and marks completed. Idempotent. */
|
|
740
|
+
return(value?: unknown): IteratorResult<TOutput>;
|
|
741
|
+
/** Called once before the first `handleNext()` invocation. Override to set up state. */
|
|
742
|
+
protected initialize(): void;
|
|
743
|
+
/** Wraps `value` in a non-done `IteratorResult`. */
|
|
744
|
+
protected yield(value: TOutput): IteratorResult<TOutput>;
|
|
745
|
+
/** Returns a done `IteratorResult`. */
|
|
746
|
+
protected done(): IteratorResult<TOutput>;
|
|
747
|
+
/**
|
|
748
|
+
* Marks the enumerator completed and yields `value` as the final element.
|
|
749
|
+
*
|
|
750
|
+
* @remarks
|
|
751
|
+
* Use when the last element must be emitted together with completion in one step.
|
|
752
|
+
*/
|
|
753
|
+
protected doneWithYield(value: TOutput): IteratorResult<TOutput>;
|
|
754
|
+
/**
|
|
755
|
+
* Disposes resources, marks completed, and returns a done result.
|
|
756
|
+
*
|
|
757
|
+
* @remarks
|
|
758
|
+
* Use inside `handleNext()` to terminate iteration before the source is exhausted.
|
|
759
|
+
*/
|
|
760
|
+
protected earlyComplete(reason?: unknown): IteratorResult<TOutput>;
|
|
761
|
+
/** Calls `disposeSource()` then `disposeAdditional()`. */
|
|
762
|
+
protected dispose(value?: unknown): void;
|
|
763
|
+
/** Override to dispose the upstream source enumerator. */
|
|
764
|
+
protected disposeSource(): void;
|
|
765
|
+
/**
|
|
766
|
+
* Override to release any additional resources.
|
|
767
|
+
*
|
|
768
|
+
* @remarks
|
|
769
|
+
* Called after `disposeSource()`. `value` is the return value passed to `return()`.
|
|
770
|
+
* Must be idempotent and must not throw.
|
|
771
|
+
*/
|
|
772
|
+
protected disposeAdditional(_value?: unknown): void;
|
|
773
|
+
/** Produces the next element. Return `{ done: true }` to signal exhaustion. */
|
|
774
|
+
protected abstract handleNext(): IteratorResult<TOutput>;
|
|
613
775
|
}
|
|
614
|
-
|
|
615
|
-
//#region src/core/enumerators/TyneqEnumerator.d.ts
|
|
776
|
+
|
|
616
777
|
/**
|
|
617
778
|
* Base class for all pipeline operator enumerators (streaming and buffering).
|
|
618
779
|
*
|
|
@@ -626,13 +787,12 @@ declare abstract class TyneqBaseEnumerator<TInput, TOutput = TInput> implements
|
|
|
626
787
|
* @group Plugin
|
|
627
788
|
*/
|
|
628
789
|
declare abstract class TyneqEnumerator<TInput, TOutput = TInput> extends TyneqBaseEnumerator<TInput, TOutput> {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
790
|
+
protected readonly sourceEnumerator: Enumerator<TInput>;
|
|
791
|
+
private sourceDisposed;
|
|
792
|
+
constructor(sourceEnumerator: Enumerator<TInput>);
|
|
793
|
+
protected disposeSource(): void;
|
|
633
794
|
}
|
|
634
|
-
|
|
635
|
-
//#region src/core/enumerators/TyneqOrderedEnumerator.d.ts
|
|
795
|
+
|
|
636
796
|
/**
|
|
637
797
|
* Base class for enumerators that need the full ordered sequence (not just an Enumerator<T>).
|
|
638
798
|
* Lifecycle of the source is owned by the sequence, not the enumerator.
|
|
@@ -641,12 +801,11 @@ declare abstract class TyneqEnumerator<TInput, TOutput = TInput> extends TyneqBa
|
|
|
641
801
|
* @internal
|
|
642
802
|
*/
|
|
643
803
|
declare abstract class TyneqOrderedEnumerator<TSource> extends TyneqBaseEnumerator<TSource> {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
804
|
+
protected readonly orderedSource: OrderedEnumerable<TSource>;
|
|
805
|
+
constructor(orderedSource: OrderedEnumerable<TSource>);
|
|
806
|
+
protected disposeSource(): void;
|
|
647
807
|
}
|
|
648
|
-
|
|
649
|
-
//#region src/core/enumerators/TyneqCachedEnumerator.d.ts
|
|
808
|
+
|
|
650
809
|
/**
|
|
651
810
|
* Base class for enumerators that need the full cached sequence (not just an Enumerator<T>).
|
|
652
811
|
* Lifecycle of the source is owned by the sequence, not the enumerator.
|
|
@@ -655,12 +814,11 @@ declare abstract class TyneqOrderedEnumerator<TSource> extends TyneqBaseEnumerat
|
|
|
655
814
|
* @internal
|
|
656
815
|
*/
|
|
657
816
|
declare abstract class TyneqCachedEnumerator<TSource> extends TyneqBaseEnumerator<TSource> {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
817
|
+
protected readonly cachedSource: CachedEnumerable<TSource>;
|
|
818
|
+
constructor(cachedSource: CachedEnumerable<TSource>);
|
|
819
|
+
protected disposeSource(): void;
|
|
661
820
|
}
|
|
662
|
-
|
|
663
|
-
//#region src/core/terminal/TyneqTerminalOperator.d.ts
|
|
821
|
+
|
|
664
822
|
/**
|
|
665
823
|
* Abstract base for all terminal operators.
|
|
666
824
|
*
|
|
@@ -674,13 +832,12 @@ declare abstract class TyneqCachedEnumerator<TSource> extends TyneqBaseEnumerato
|
|
|
674
832
|
* @group Plugin
|
|
675
833
|
*/
|
|
676
834
|
declare abstract class TyneqTerminalOperator<TSource, TResult = TSource> {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
835
|
+
protected readonly source: Enumerable<TSource>;
|
|
836
|
+
constructor(source: Enumerable<TSource>);
|
|
837
|
+
/** Executes the terminal operation and returns the result. */
|
|
838
|
+
abstract process(): TResult;
|
|
681
839
|
}
|
|
682
|
-
|
|
683
|
-
//#region src/core/terminal/TyneqOrderedTerminalOperator.d.ts
|
|
840
|
+
|
|
684
841
|
/**
|
|
685
842
|
* Abstract base for terminal operators that require a fully ordered sequence.
|
|
686
843
|
*
|
|
@@ -694,13 +851,12 @@ declare abstract class TyneqTerminalOperator<TSource, TResult = TSource> {
|
|
|
694
851
|
* @group Plugin
|
|
695
852
|
*/
|
|
696
853
|
declare abstract class TyneqOrderedTerminalOperator<TSource, TResult = TSource> {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
854
|
+
protected readonly source: OrderedEnumerable<TSource>;
|
|
855
|
+
constructor(source: OrderedEnumerable<TSource>);
|
|
856
|
+
/** Executes the terminal operation and returns the result. */
|
|
857
|
+
abstract process(): TResult;
|
|
701
858
|
}
|
|
702
|
-
|
|
703
|
-
//#region src/core/terminal/TyneqCachedTerminalOperator.d.ts
|
|
859
|
+
|
|
704
860
|
/**
|
|
705
861
|
* Abstract base for terminal operators that require a fully cached sequence.
|
|
706
862
|
*
|
|
@@ -714,11 +870,10 @@ declare abstract class TyneqOrderedTerminalOperator<TSource, TResult = TSource>
|
|
|
714
870
|
* @group Plugin
|
|
715
871
|
*/
|
|
716
872
|
declare abstract class TyneqCachedTerminalOperator<TSource, TResult = TSource> {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
873
|
+
protected readonly source: CachedEnumerable<TSource>;
|
|
874
|
+
constructor(source: CachedEnumerable<TSource>);
|
|
875
|
+
/** Executes the terminal operation and returns the result. */
|
|
876
|
+
abstract process(): TResult;
|
|
721
877
|
}
|
|
722
|
-
|
|
723
|
-
export {
|
|
724
|
-
//# sourceMappingURL=TyneqCachedTerminalOperator.d.cts.map
|
|
878
|
+
|
|
879
|
+
export { OperatorRegistry as O, TyneqBaseEnumerator as T, TyneqCachedEnumerator as a, TyneqCachedTerminalOperator as b, TyneqEnumerator as c, TyneqOrderedEnumerator as d, TyneqOrderedTerminalOperator as e, TyneqTerminalOperator as f, cachedOperator as g, cachedTerminal as h, createCachedOperator as i, createCachedTerminalOperator as j, createGeneratorOperator as k, createOperator as l, createOrderedOperator as m, createOrderedTerminalOperator as n, createTerminalOperator as o, operator as p, orderedOperator as q, orderedTerminal as r, TyneqCachedEnumerable as s, terminal as t, TyneqOrderedEnumerable as u };
|