tyneq 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.
- package/dist/{TyneqCachedTerminalOperator-DTVuBGMn.d.ts → TyneqCachedTerminalOperator-BrW77zIy.d.ts} +180 -2
- package/dist/{TyneqCachedTerminalOperator-QzqAHJSE.d.cts → TyneqCachedTerminalOperator-EaNiNt61.d.cts} +180 -2
- package/dist/{chunk-KT2G2VJZ.js → chunk-5R4AALC7.js} +0 -1
- package/dist/{chunk-D2KVCXTF.cjs → chunk-C5PBY3ZU.cjs} +2 -3
- package/dist/{chunk-6QXGRDRO.cjs → chunk-OWKUE3AC.cjs} +0 -1
- package/dist/{chunk-DVHUFMNJ.js → chunk-PCBN5AFG.js} +1 -2
- package/dist/{chunk-TOFO2EMH.cjs → chunk-VJAICXA6.cjs} +232 -230
- package/dist/{chunk-BKSTSJTW.js → chunk-ZP6WMZCK.js} +5 -3
- package/dist/{core-DR17XN89.d.cts → core-C54TSmgW.d.cts} +1 -1
- package/dist/{core-DR17XN89.d.ts → core-C54TSmgW.d.ts} +1 -1
- package/dist/index.cjs +60 -61
- package/dist/index.d.cts +4 -182
- package/dist/index.d.ts +4 -182
- package/dist/index.js +3 -4
- package/dist/plugin/index.cjs +5 -4
- package/dist/plugin/index.d.cts +2 -2
- package/dist/plugin/index.d.ts +2 -2
- package/dist/plugin/index.js +4 -3
- package/dist/utility/index.cjs +3 -4
- package/dist/utility/index.d.cts +1 -1
- package/dist/utility/index.d.ts +1 -1
- package/dist/utility/index.js +2 -3
- package/package.json +1 -1
- package/dist/chunk-6QXGRDRO.cjs.map +0 -1
- package/dist/chunk-BKSTSJTW.js.map +0 -1
- package/dist/chunk-D2KVCXTF.cjs.map +0 -1
- package/dist/chunk-DVHUFMNJ.js.map +0 -1
- package/dist/chunk-KT2G2VJZ.js.map +0 -1
- package/dist/chunk-TOFO2EMH.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/plugin/index.cjs.map +0 -1
- package/dist/plugin/index.js.map +0 -1
- package/dist/utility/index.cjs.map +0 -1
- package/dist/utility/index.js.map +0 -1
package/dist/{TyneqCachedTerminalOperator-DTVuBGMn.d.ts → TyneqCachedTerminalOperator-BrW77zIy.d.ts}
RENAMED
|
@@ -1,4 +1,182 @@
|
|
|
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.js';
|
|
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
181
|
/**
|
|
4
182
|
* Class decorator that registers a `TyneqEnumerator` subclass as an operator on every sequence.
|
|
@@ -698,4 +876,4 @@ declare abstract class TyneqCachedTerminalOperator<TSource, TResult = TSource> {
|
|
|
698
876
|
abstract process(): TResult;
|
|
699
877
|
}
|
|
700
878
|
|
|
701
|
-
export { 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 };
|
|
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 };
|
|
@@ -1,4 +1,182 @@
|
|
|
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
181
|
/**
|
|
4
182
|
* Class decorator that registers a `TyneqEnumerator` subclass as an operator on every sequence.
|
|
@@ -698,4 +876,4 @@ declare abstract class TyneqCachedTerminalOperator<TSource, TResult = TSource> {
|
|
|
698
876
|
abstract process(): TResult;
|
|
699
877
|
}
|
|
700
878
|
|
|
701
|
-
export { 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 };
|
|
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 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkOWKUE3ACcjs = require('./chunk-OWKUE3AC.cjs');
|
|
4
4
|
|
|
5
5
|
// src/core/errors/argument/ValidationError.ts
|
|
6
|
-
var ValidationError = class extends
|
|
6
|
+
var ValidationError = class extends _chunkOWKUE3ACcjs.ArgumentError {
|
|
7
7
|
constructor(errors) {
|
|
8
8
|
super(
|
|
9
9
|
`${errors.length} validation error(s):
|
|
@@ -44,4 +44,3 @@ var ValidationBuilder = class {
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
exports.ValidationError = ValidationError; exports.ValidationBuilder = ValidationBuilder;
|
|
47
|
-
//# sourceMappingURL=chunk-D2KVCXTF.cjs.map
|
|
@@ -678,4 +678,3 @@ var Lazy = class {
|
|
|
678
678
|
|
|
679
679
|
|
|
680
680
|
exports.__decoratorStart = __decoratorStart; exports.__decoratorMetadata = __decoratorMetadata; exports.__runInitializers = __runInitializers; exports.__decorateElement = __decorateElement; exports.__asyncGenerator = __asyncGenerator; exports.nameof = nameof; exports.TyneqError = TyneqError; exports.ArgumentError = ArgumentError; exports.ArgumentNullError = ArgumentNullError; exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError; exports.ArgumentTypeError = ArgumentTypeError; exports.TypeGuardUtility = TypeGuardUtility; exports.ArgumentUtility = ArgumentUtility; exports.ReflectionError = ReflectionError; exports.ReflectionContext = ReflectionContext; exports.reflect = reflect; exports.Lazy = Lazy;
|
|
681
|
-
//# sourceMappingURL=chunk-6QXGRDRO.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ArgumentError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5R4AALC7.js";
|
|
4
4
|
|
|
5
5
|
// src/core/errors/argument/ValidationError.ts
|
|
6
6
|
var ValidationError = class extends ArgumentError {
|
|
@@ -44,4 +44,3 @@ export {
|
|
|
44
44
|
ValidationError,
|
|
45
45
|
ValidationBuilder
|
|
46
46
|
};
|
|
47
|
-
//# sourceMappingURL=chunk-DVHUFMNJ.js.map
|