@zengrid/shared 1.0.2 → 1.0.3
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/package.json +1 -1
- package/dist/README.md +0 -44
- package/dist/index.cjs.default.js +0 -1
- package/dist/index.cjs.js +0 -6250
- package/dist/index.cjs.mjs +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +0 -6207
- package/dist/package.json +0 -54
- package/dist/src/algorithms/filter/bloom-filter.d.ts +0 -120
- package/dist/src/algorithms/filter/bloom-filter.d.ts.map +0 -1
- package/dist/src/algorithms/filter/index.d.ts +0 -7
- package/dist/src/algorithms/filter/index.d.ts.map +0 -1
- package/dist/src/algorithms/graph/bfs.d.ts +0 -71
- package/dist/src/algorithms/graph/bfs.d.ts.map +0 -1
- package/dist/src/algorithms/graph/dfs.d.ts +0 -62
- package/dist/src/algorithms/graph/dfs.d.ts.map +0 -1
- package/dist/src/algorithms/graph/graph.interface.d.ts +0 -63
- package/dist/src/algorithms/graph/graph.interface.d.ts.map +0 -1
- package/dist/src/algorithms/graph/index.d.ts +0 -9
- package/dist/src/algorithms/graph/index.d.ts.map +0 -1
- package/dist/src/algorithms/index.d.ts +0 -11
- package/dist/src/algorithms/index.d.ts.map +0 -1
- package/dist/src/algorithms/pattern/index.d.ts +0 -8
- package/dist/src/algorithms/pattern/index.d.ts.map +0 -1
- package/dist/src/algorithms/pattern/sequence-detector.d.ts +0 -62
- package/dist/src/algorithms/pattern/sequence-detector.d.ts.map +0 -1
- package/dist/src/algorithms/search/binary-search.d.ts +0 -86
- package/dist/src/algorithms/search/binary-search.d.ts.map +0 -1
- package/dist/src/algorithms/search/index.d.ts +0 -6
- package/dist/src/algorithms/search/index.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/comparators.d.ts +0 -126
- package/dist/src/algorithms/sorting/comparators.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/index.d.ts +0 -9
- package/dist/src/algorithms/sorting/index.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/sorting.interface.d.ts +0 -38
- package/dist/src/algorithms/sorting/sorting.interface.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/timsort.d.ts +0 -55
- package/dist/src/algorithms/sorting/timsort.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/column-store.d.ts +0 -52
- package/dist/src/data-structures/column-store/column-store.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/column-store.interface.d.ts +0 -155
- package/dist/src/data-structures/column-store/column-store.interface.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/index.d.ts +0 -6
- package/dist/src/data-structures/column-store/index.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/command-stack.d.ts +0 -61
- package/dist/src/data-structures/command-stack/command-stack.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/command-stack.interface.d.ts +0 -80
- package/dist/src/data-structures/command-stack/command-stack.interface.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/index.d.ts +0 -3
- package/dist/src/data-structures/command-stack/index.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/dependency-graph.d.ts +0 -147
- package/dist/src/data-structures/dependency-graph/dependency-graph.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/dependency-graph.interface.d.ts +0 -161
- package/dist/src/data-structures/dependency-graph/dependency-graph.interface.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/index.d.ts +0 -8
- package/dist/src/data-structures/dependency-graph/index.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/disjoint-set.d.ts +0 -84
- package/dist/src/data-structures/disjoint-set/disjoint-set.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/disjoint-set.interface.d.ts +0 -185
- package/dist/src/data-structures/disjoint-set/disjoint-set.interface.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/index.d.ts +0 -7
- package/dist/src/data-structures/disjoint-set/index.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index-map.d.ts +0 -150
- package/dist/src/data-structures/index-map/index-map.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index-map.interface.d.ts +0 -186
- package/dist/src/data-structures/index-map/index-map.interface.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index.d.ts +0 -6
- package/dist/src/data-structures/index-map/index.d.ts.map +0 -1
- package/dist/src/data-structures/index.d.ts +0 -36
- package/dist/src/data-structures/index.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/index.d.ts +0 -7
- package/dist/src/data-structures/interval-tree/index.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/interval-tree.d.ts +0 -141
- package/dist/src/data-structures/interval-tree/interval-tree.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/interval-tree.interface.d.ts +0 -212
- package/dist/src/data-structures/interval-tree/interval-tree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/index.d.ts +0 -3
- package/dist/src/data-structures/lru-cache/index.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/lru-cache.d.ts +0 -134
- package/dist/src/data-structures/lru-cache/lru-cache.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/lru-cache.interface.d.ts +0 -173
- package/dist/src/data-structures/lru-cache/lru-cache.interface.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/index.d.ts +0 -6
- package/dist/src/data-structures/prefix-sum-array/index.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.d.ts +0 -63
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.interface.d.ts +0 -80
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.interface.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/index.d.ts +0 -8
- package/dist/src/data-structures/rtree/index.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/rtree.d.ts +0 -81
- package/dist/src/data-structures/rtree/rtree.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/rtree.interface.d.ts +0 -143
- package/dist/src/data-structures/rtree/rtree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/index.d.ts +0 -4
- package/dist/src/data-structures/segment-tree/index.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/segment-tree.d.ts +0 -134
- package/dist/src/data-structures/segment-tree/segment-tree.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/segment-tree.interface.d.ts +0 -202
- package/dist/src/data-structures/segment-tree/segment-tree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/index.d.ts +0 -4
- package/dist/src/data-structures/skip-list/index.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/skip-list.d.ts +0 -137
- package/dist/src/data-structures/skip-list/skip-list.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/skip-list.interface.d.ts +0 -223
- package/dist/src/data-structures/skip-list/skip-list.interface.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/index.d.ts +0 -6
- package/dist/src/data-structures/sparse-matrix/index.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.d.ts +0 -44
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.interface.d.ts +0 -105
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.interface.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/index.d.ts +0 -3
- package/dist/src/data-structures/suffix-array/index.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/suffix-array.d.ts +0 -102
- package/dist/src/data-structures/suffix-array/suffix-array.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/suffix-array.interface.d.ts +0 -117
- package/dist/src/data-structures/suffix-array/suffix-array.interface.d.ts.map +0 -1
- package/dist/src/data-structures/trie/index.d.ts +0 -8
- package/dist/src/data-structures/trie/index.d.ts.map +0 -1
- package/dist/src/data-structures/trie/trie.d.ts +0 -205
- package/dist/src/data-structures/trie/trie.d.ts.map +0 -1
- package/dist/src/data-structures/trie/trie.interface.d.ts +0 -117
- package/dist/src/data-structures/trie/trie.interface.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -47
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/patterns/coordinator.d.ts +0 -90
- package/dist/src/patterns/coordinator.d.ts.map +0 -1
- package/dist/src/patterns/event-emitter.d.ts +0 -106
- package/dist/src/patterns/event-emitter.d.ts.map +0 -1
- package/dist/src/patterns/factory.d.ts +0 -120
- package/dist/src/patterns/factory.d.ts.map +0 -1
- package/dist/src/patterns/index.d.ts +0 -21
- package/dist/src/patterns/index.d.ts.map +0 -1
- package/dist/src/patterns/mediator.d.ts +0 -116
- package/dist/src/patterns/mediator.d.ts.map +0 -1
- package/dist/src/patterns/object-pool.d.ts +0 -178
- package/dist/src/patterns/object-pool.d.ts.map +0 -1
- package/dist/src/patterns/observer.d.ts +0 -89
- package/dist/src/patterns/observer.d.ts.map +0 -1
- package/dist/src/patterns/operation-mode.d.ts +0 -75
- package/dist/src/patterns/operation-mode.d.ts.map +0 -1
- package/dist/src/patterns/state-machine.d.ts +0 -122
- package/dist/src/patterns/state-machine.d.ts.map +0 -1
- package/dist/src/types/common.d.ts +0 -56
- package/dist/src/types/common.d.ts.map +0 -1
- package/dist/src/types/index.d.ts +0 -5
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts +0 -7
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/timing.d.ts +0 -104
- package/dist/src/utils/timing.d.ts.map +0 -1
- package/dist/src/utils/timing.interface.d.ts +0 -96
- package/dist/src/utils/timing.interface.d.ts.map +0 -1
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Suffix Array Interface
|
|
3
|
-
*
|
|
4
|
-
* Used for:
|
|
5
|
-
* - Fast substring search in O(m log n) time where m = pattern length, n = text length
|
|
6
|
-
* - Pattern matching in grid cell values
|
|
7
|
-
* - "Contains" filtering without scanning all rows
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Search result from suffix array
|
|
11
|
-
*/
|
|
12
|
-
export interface SuffixSearchResult {
|
|
13
|
-
/**
|
|
14
|
-
* Starting position of the match in the original text
|
|
15
|
-
*/
|
|
16
|
-
position: number;
|
|
17
|
-
/**
|
|
18
|
-
* The matched substring
|
|
19
|
-
*/
|
|
20
|
-
match: string;
|
|
21
|
-
/**
|
|
22
|
-
* Context around the match (if available)
|
|
23
|
-
*/
|
|
24
|
-
context?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Suffix Array options
|
|
28
|
-
*/
|
|
29
|
-
export interface SuffixArrayOptions {
|
|
30
|
-
/**
|
|
31
|
-
* Case-sensitive search
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
|
-
caseSensitive?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Build LCP (Longest Common Prefix) array for advanced queries
|
|
37
|
-
* @default true
|
|
38
|
-
*/
|
|
39
|
-
buildLCP?: boolean;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Suffix Array statistics
|
|
43
|
-
*/
|
|
44
|
-
export interface SuffixArrayStats {
|
|
45
|
-
/**
|
|
46
|
-
* Length of the original text
|
|
47
|
-
*/
|
|
48
|
-
textLength: number;
|
|
49
|
-
/**
|
|
50
|
-
* Number of suffixes
|
|
51
|
-
*/
|
|
52
|
-
suffixCount: number;
|
|
53
|
-
/**
|
|
54
|
-
* Memory usage in bytes (approximate)
|
|
55
|
-
*/
|
|
56
|
-
memoryBytes: number;
|
|
57
|
-
/**
|
|
58
|
-
* Whether LCP array is built
|
|
59
|
-
*/
|
|
60
|
-
hasLCP: boolean;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Suffix Array interface
|
|
64
|
-
*/
|
|
65
|
-
export interface ISuffixArray {
|
|
66
|
-
/**
|
|
67
|
-
* Search for a pattern in the text
|
|
68
|
-
*
|
|
69
|
-
* @param pattern - Pattern to search for
|
|
70
|
-
* @returns Array of positions where pattern occurs
|
|
71
|
-
*/
|
|
72
|
-
search(pattern: string): number[];
|
|
73
|
-
/**
|
|
74
|
-
* Search for a pattern and return detailed results
|
|
75
|
-
*
|
|
76
|
-
* @param pattern - Pattern to search for
|
|
77
|
-
* @param contextLength - Number of characters to include before/after match
|
|
78
|
-
* @returns Array of search results with context
|
|
79
|
-
*/
|
|
80
|
-
searchWithContext(pattern: string, contextLength?: number): SuffixSearchResult[];
|
|
81
|
-
/**
|
|
82
|
-
* Count occurrences of a pattern
|
|
83
|
-
*
|
|
84
|
-
* @param pattern - Pattern to count
|
|
85
|
-
* @returns Number of occurrences
|
|
86
|
-
*/
|
|
87
|
-
count(pattern: string): number;
|
|
88
|
-
/**
|
|
89
|
-
* Check if pattern exists in the text
|
|
90
|
-
*
|
|
91
|
-
* @param pattern - Pattern to check
|
|
92
|
-
* @returns True if pattern exists
|
|
93
|
-
*/
|
|
94
|
-
contains(pattern: string): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Find the longest repeated substring
|
|
97
|
-
*
|
|
98
|
-
* @returns The longest repeated substring
|
|
99
|
-
*/
|
|
100
|
-
longestRepeatedSubstring(): string;
|
|
101
|
-
/**
|
|
102
|
-
* Get all unique substrings of a given length
|
|
103
|
-
*
|
|
104
|
-
* @param length - Length of substrings
|
|
105
|
-
* @returns Array of unique substrings
|
|
106
|
-
*/
|
|
107
|
-
uniqueSubstrings(length: number): string[];
|
|
108
|
-
/**
|
|
109
|
-
* Get statistics about the suffix array
|
|
110
|
-
*/
|
|
111
|
-
getStats(): SuffixArrayStats;
|
|
112
|
-
/**
|
|
113
|
-
* Clear the suffix array
|
|
114
|
-
*/
|
|
115
|
-
clear(): void;
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=suffix-array.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suffix-array.interface.d.ts","sourceRoot":"","sources":["../../../../../../pack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1
|
-
/**
|
|
2
|
-
* Trie (Prefix Tree) data structure
|
|
3
|
-
*
|
|
4
|
-
* Used for autocomplete, search suggestions, and prefix-based queries.
|
|
5
|
-
*/
|
|
6
|
-
export { Trie } from './trie';
|
|
7
|
-
export type { ITrie, ITrieNode, TrieOptions, TrieSearchResult, } from './trie.interface';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/trie/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EACV,KAAK,EACL,SAAS,EACT,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import type { ITrie, TrieOptions, TrieSearchResult } from './trie.interface';
|
|
2
|
-
/**
|
|
3
|
-
* Trie (Prefix Tree) Data Structure
|
|
4
|
-
*
|
|
5
|
-
* A tree-based data structure for efficient prefix-based searches.
|
|
6
|
-
*
|
|
7
|
-
* **Time Complexity:**
|
|
8
|
-
* - Insert: O(m) where m = word length
|
|
9
|
-
* - Search: O(m)
|
|
10
|
-
* - Autocomplete: O(m + n) where n = number of suggestions
|
|
11
|
-
* - Delete: O(m)
|
|
12
|
-
*
|
|
13
|
-
* **Space Complexity:** O(ALPHABET_SIZE * m * n) where n = number of words
|
|
14
|
-
*
|
|
15
|
-
* **Use Cases:**
|
|
16
|
-
* - Column filter autocomplete: type "ap" → suggests "apple", "application"
|
|
17
|
-
* - Search suggestions: real-time filtering as user types
|
|
18
|
-
* - Dictionary lookups: spell checking
|
|
19
|
-
* - IP routing tables
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const trie = new Trie();
|
|
24
|
-
* trie.insert('apple');
|
|
25
|
-
* trie.insert('application');
|
|
26
|
-
* trie.insert('app');
|
|
27
|
-
*
|
|
28
|
-
* trie.search('apple'); // true
|
|
29
|
-
* trie.search('appl'); // false
|
|
30
|
-
* trie.startsWith('app'); // true
|
|
31
|
-
* trie.autocomplete('app'); // ['app', 'apple', 'application']
|
|
32
|
-
*
|
|
33
|
-
* const result = trie.find('app');
|
|
34
|
-
* // {
|
|
35
|
-
* // term: 'app',
|
|
36
|
-
* // isComplete: true,
|
|
37
|
-
* // suggestions: ['app', 'apple', 'application'],
|
|
38
|
-
* // count: 3
|
|
39
|
-
* // }
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @example Grid Integration
|
|
43
|
-
* ```typescript
|
|
44
|
-
* // Column filter with autocomplete
|
|
45
|
-
* class FilterManager {
|
|
46
|
-
* private valueTrie = new Trie();
|
|
47
|
-
*
|
|
48
|
-
* indexColumn(col: number): void {
|
|
49
|
-
* const values = this.grid.getColumnValues(col);
|
|
50
|
-
* values.forEach(v => this.valueTrie.insert(String(v)));
|
|
51
|
-
* }
|
|
52
|
-
*
|
|
53
|
-
* getSuggestions(prefix: string): string[] {
|
|
54
|
-
* return this.valueTrie.autocomplete(prefix, 10);
|
|
55
|
-
* }
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export declare class Trie implements ITrie {
|
|
60
|
-
private root;
|
|
61
|
-
private options;
|
|
62
|
-
private wordCount;
|
|
63
|
-
constructor(options?: TrieOptions);
|
|
64
|
-
/**
|
|
65
|
-
* Insert a word into the trie
|
|
66
|
-
*
|
|
67
|
-
* @param word - Word to insert
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```typescript
|
|
71
|
-
* trie.insert('hello');
|
|
72
|
-
* trie.insert('world');
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
insert(word: string): void;
|
|
76
|
-
/**
|
|
77
|
-
* Search for an exact word in the trie
|
|
78
|
-
*
|
|
79
|
-
* @param word - Word to search for
|
|
80
|
-
* @returns true if word exists, false otherwise
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```typescript
|
|
84
|
-
* trie.insert('apple');
|
|
85
|
-
* trie.search('apple'); // true
|
|
86
|
-
* trie.search('app'); // false (not a complete word)
|
|
87
|
-
* trie.search('apples'); // false
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
search(word: string): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Check if any word starts with the given prefix
|
|
93
|
-
*
|
|
94
|
-
* @param prefix - Prefix to check
|
|
95
|
-
* @returns true if prefix exists, false otherwise
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```typescript
|
|
99
|
-
* trie.insert('apple');
|
|
100
|
-
* trie.startsWith('app'); // true
|
|
101
|
-
* trie.startsWith('ban'); // false
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
startsWith(prefix: string): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Get autocomplete suggestions for a prefix
|
|
107
|
-
*
|
|
108
|
-
* @param prefix - Prefix to search for
|
|
109
|
-
* @param maxResults - Maximum number of results (default: from options)
|
|
110
|
-
* @returns Array of suggestions
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* trie.insert('apple');
|
|
115
|
-
* trie.insert('application');
|
|
116
|
-
* trie.insert('app');
|
|
117
|
-
*
|
|
118
|
-
* trie.autocomplete('app'); // ['app', 'apple', 'application']
|
|
119
|
-
* trie.autocomplete('app', 2); // ['app', 'apple']
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
autocomplete(prefix: string, maxResults?: number): string[];
|
|
123
|
-
/**
|
|
124
|
-
* Get detailed search result with metadata
|
|
125
|
-
*
|
|
126
|
-
* @param term - Search term
|
|
127
|
-
* @returns Search result with suggestions and metadata
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const result = trie.find('app');
|
|
132
|
-
* // {
|
|
133
|
-
* // term: 'app',
|
|
134
|
-
* // isComplete: true,
|
|
135
|
-
* // suggestions: ['app', 'apple', 'application'],
|
|
136
|
-
* // count: 3
|
|
137
|
-
* // }
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
find(term: string): TrieSearchResult;
|
|
141
|
-
/**
|
|
142
|
-
* Delete a word from the trie
|
|
143
|
-
*
|
|
144
|
-
* @param word - Word to delete
|
|
145
|
-
* @returns true if word was deleted, false if word didn't exist
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```typescript
|
|
149
|
-
* trie.insert('apple');
|
|
150
|
-
* trie.delete('apple'); // true
|
|
151
|
-
* trie.delete('banana'); // false (doesn't exist)
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
delete(word: string): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Clear all words from the trie
|
|
157
|
-
*/
|
|
158
|
-
clear(): void;
|
|
159
|
-
/**
|
|
160
|
-
* Get all words in the trie
|
|
161
|
-
*
|
|
162
|
-
* @returns Array of all words
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ```typescript
|
|
166
|
-
* trie.insert('apple');
|
|
167
|
-
* trie.insert('banana');
|
|
168
|
-
* trie.getAllWords(); // ['apple', 'banana']
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
getAllWords(): string[];
|
|
172
|
-
/**
|
|
173
|
-
* Get the number of unique words in the trie
|
|
174
|
-
*
|
|
175
|
-
* @returns Number of words
|
|
176
|
-
*/
|
|
177
|
-
size(): number;
|
|
178
|
-
/**
|
|
179
|
-
* Check if the trie is empty
|
|
180
|
-
*
|
|
181
|
-
* @returns true if empty, false otherwise
|
|
182
|
-
*/
|
|
183
|
-
isEmpty(): boolean;
|
|
184
|
-
/**
|
|
185
|
-
* Normalize a string based on case sensitivity option
|
|
186
|
-
*/
|
|
187
|
-
private normalize;
|
|
188
|
-
/**
|
|
189
|
-
* Restore original case from prefix to suggestion
|
|
190
|
-
*/
|
|
191
|
-
private restoreCase;
|
|
192
|
-
/**
|
|
193
|
-
* Find a node in the trie by traversing the path
|
|
194
|
-
*/
|
|
195
|
-
private findNode;
|
|
196
|
-
/**
|
|
197
|
-
* Collect all words from a node using DFS
|
|
198
|
-
*/
|
|
199
|
-
private collectWords;
|
|
200
|
-
/**
|
|
201
|
-
* Recursively delete a word from the trie
|
|
202
|
-
*/
|
|
203
|
-
private deleteRecursive;
|
|
204
|
-
}
|
|
205
|
-
//# sourceMappingURL=trie.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trie.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/trie/trie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EAEL,WAAW,EACX,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAgB1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,qBAAa,IAAK,YAAW,KAAK;IAChC,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,SAAS,CAAa;gBAElB,OAAO,GAAE,WAAgB;IASrC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAoB1B;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAO7B;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAOnC;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE;IAkB3D;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAqBpC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAO7B;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;;;;;;;;;;OAWG;IACH,WAAW,IAAI,MAAM,EAAE;IAMvB;;;;OAIG;IACH,IAAI,IAAI,MAAM;IAId;;;;OAIG;IACH,OAAO,IAAI,OAAO;IAMlB;;OAEG;IACH,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACH,OAAO,CAAC,WAAW;IAqBnB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAahB;;OAEG;IACH,OAAO,CAAC,YAAY;IAwBpB;;OAEG;IACH,OAAO,CAAC,eAAe;CAwCxB"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trie (Prefix Tree) Interface
|
|
3
|
-
*
|
|
4
|
-
* Used for:
|
|
5
|
-
* - Autocomplete in column filters
|
|
6
|
-
* - Search suggestions
|
|
7
|
-
* - Dictionary lookups
|
|
8
|
-
* - Prefix-based searches
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Trie search result
|
|
12
|
-
*/
|
|
13
|
-
export interface TrieSearchResult {
|
|
14
|
-
/**
|
|
15
|
-
* The search term
|
|
16
|
-
*/
|
|
17
|
-
term: string;
|
|
18
|
-
/**
|
|
19
|
-
* Whether the term exists as a complete word
|
|
20
|
-
*/
|
|
21
|
-
isComplete: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* All words with this prefix
|
|
24
|
-
*/
|
|
25
|
-
suggestions: string[];
|
|
26
|
-
/**
|
|
27
|
-
* Number of words with this prefix
|
|
28
|
-
*/
|
|
29
|
-
count: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Trie node interface
|
|
33
|
-
*/
|
|
34
|
-
export interface ITrieNode {
|
|
35
|
-
/**
|
|
36
|
-
* Character at this node
|
|
37
|
-
*/
|
|
38
|
-
char: string;
|
|
39
|
-
/**
|
|
40
|
-
* Is this the end of a word?
|
|
41
|
-
*/
|
|
42
|
-
isEndOfWord: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Child nodes
|
|
45
|
-
*/
|
|
46
|
-
children: Map<string, ITrieNode>;
|
|
47
|
-
/**
|
|
48
|
-
* Number of words passing through this node
|
|
49
|
-
*/
|
|
50
|
-
wordCount: number;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Trie options
|
|
54
|
-
*/
|
|
55
|
-
export interface TrieOptions {
|
|
56
|
-
/**
|
|
57
|
-
* Case-sensitive search
|
|
58
|
-
* @default false
|
|
59
|
-
*/
|
|
60
|
-
caseSensitive?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Maximum suggestions to return
|
|
63
|
-
* @default 10
|
|
64
|
-
*/
|
|
65
|
-
maxSuggestions?: number;
|
|
66
|
-
/**
|
|
67
|
-
* Allow partial matches
|
|
68
|
-
* @default true
|
|
69
|
-
*/
|
|
70
|
-
allowPartial?: boolean;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Trie data structure interface
|
|
74
|
-
*/
|
|
75
|
-
export interface ITrie {
|
|
76
|
-
/**
|
|
77
|
-
* Insert a word into the trie
|
|
78
|
-
*/
|
|
79
|
-
insert(word: string): void;
|
|
80
|
-
/**
|
|
81
|
-
* Search for a word in the trie
|
|
82
|
-
*/
|
|
83
|
-
search(word: string): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Check if any word starts with the given prefix
|
|
86
|
-
*/
|
|
87
|
-
startsWith(prefix: string): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Get all words with the given prefix (autocomplete)
|
|
90
|
-
*/
|
|
91
|
-
autocomplete(prefix: string, maxResults?: number): string[];
|
|
92
|
-
/**
|
|
93
|
-
* Get detailed search result
|
|
94
|
-
*/
|
|
95
|
-
find(term: string): TrieSearchResult;
|
|
96
|
-
/**
|
|
97
|
-
* Delete a word from the trie
|
|
98
|
-
*/
|
|
99
|
-
delete(word: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Clear all words from the trie
|
|
102
|
-
*/
|
|
103
|
-
clear(): void;
|
|
104
|
-
/**
|
|
105
|
-
* Get all words in the trie
|
|
106
|
-
*/
|
|
107
|
-
getAllWords(): string[];
|
|
108
|
-
/**
|
|
109
|
-
* Get the number of words in the trie
|
|
110
|
-
*/
|
|
111
|
-
size(): number;
|
|
112
|
-
/**
|
|
113
|
-
* Check if the trie is empty
|
|
114
|
-
*/
|
|
115
|
-
isEmpty(): boolean;
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=trie.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trie.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/trie/trie.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAEjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAE9B;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAEpC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE5D;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAErC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAE9B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE,CAAC;IAExB;;OAEG;IACH,IAAI,IAAI,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;CACpB"}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ZenGrid Shared Package
|
|
3
|
-
* Reusable algorithms and data structures
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
export { SparseMatrix } from './data-structures/sparse-matrix';
|
|
8
|
-
export type { ReadonlySparseMatrix, ISparseMatrix, SparseMatrixOptions, } from './data-structures/sparse-matrix';
|
|
9
|
-
export { PrefixSumArray } from './data-structures/prefix-sum-array';
|
|
10
|
-
export type { IPrefixSumArray, PrefixSumArrayOptions, } from './data-structures/prefix-sum-array';
|
|
11
|
-
export { ColumnStore } from './data-structures/column-store';
|
|
12
|
-
export type { IColumnStore, ColumnStoreOptions, ColumnDefinition, ColumnType, AggregateOperation, AggregationResult, } from './data-structures/column-store';
|
|
13
|
-
export { LRUCache } from './data-structures/lru-cache';
|
|
14
|
-
export type { ILRUCache, LRUCacheOptions, CacheEntry, CacheStats, } from './data-structures/lru-cache';
|
|
15
|
-
export { CommandStack } from './data-structures/command-stack';
|
|
16
|
-
export type { ICommandStack, ICommand, ICommandStackOptions, } from './data-structures/command-stack';
|
|
17
|
-
export { SegmentTree } from './data-structures/segment-tree';
|
|
18
|
-
export type { ISegmentTree, SegmentTreeOptions, AggregateFunction, AggregationType, } from './data-structures/segment-tree';
|
|
19
|
-
export { Aggregations, SegmentTreeUtils } from './data-structures/segment-tree';
|
|
20
|
-
export { SkipList } from './data-structures/skip-list';
|
|
21
|
-
export type { ISkipList, SkipListNode, SkipListOptions, RangeResult as SkipListRangeResult, SkipListStats, } from './data-structures/skip-list';
|
|
22
|
-
export { defaultComparator as skipListDefaultComparator, SkipListUtils } from './data-structures/skip-list';
|
|
23
|
-
export { DisjointSet } from './data-structures/disjoint-set';
|
|
24
|
-
export type { IDisjointSet, DisjointSetOptions, DisjointSetStats, } from './data-structures/disjoint-set';
|
|
25
|
-
export { DisjointSetUtils } from './data-structures/disjoint-set';
|
|
26
|
-
export { IndexMap } from './data-structures/index-map';
|
|
27
|
-
export type { IIndexMap, IndexMapEntry, IndexMapOptions, } from './data-structures/index-map';
|
|
28
|
-
export { IntervalTree } from './data-structures/interval-tree';
|
|
29
|
-
export type { IIntervalTree, Interval, IntervalData, IntervalTreeOptions, } from './data-structures/interval-tree';
|
|
30
|
-
export { IntervalUtils } from './data-structures/interval-tree';
|
|
31
|
-
export { RTree } from './data-structures/rtree';
|
|
32
|
-
export type { IRTree, RTreeData, RTreeOptions, RTreeSearchResult, RTreeStats, } from './data-structures/rtree';
|
|
33
|
-
export { Trie } from './data-structures/trie';
|
|
34
|
-
export type { ITrie, ITrieNode, TrieOptions, TrieSearchResult, } from './data-structures/trie';
|
|
35
|
-
export { DependencyGraph } from './data-structures/dependency-graph';
|
|
36
|
-
export type { IDependencyGraph, NodeId, Dependency, DependencyGraphOptions, TopologicalSortResult, GraphStats, } from './data-structures/dependency-graph';
|
|
37
|
-
export { SuffixArray } from './data-structures/suffix-array';
|
|
38
|
-
export type { ISuffixArray, SuffixArrayOptions, SuffixSearchResult, SuffixArrayStats, } from './data-structures/suffix-array';
|
|
39
|
-
export { binarySearch, binarySearchLeft, binarySearchRight, } from './algorithms/search';
|
|
40
|
-
export type { BinarySearchOptions, BinarySearchResult, } from './algorithms/search';
|
|
41
|
-
export type { Comparator, Predicate, EqualityFn, HashFn, Range, Rectangle, Point, BoundingBox, } from './types';
|
|
42
|
-
export { debounce, throttle, createRAFBatchScheduler, delay, timeout, } from './utils/timing';
|
|
43
|
-
export type { DebounceOptions, DebouncedFunction, ThrottleOptions, ThrottledFunction, RAFBatchScheduler, } from './utils/timing.interface';
|
|
44
|
-
export { EventEmitter, Subject, StateMachine, BaseCoordinator, Factory, SingletonFactory, Mediator, MediatedComponent, EventMediator, ObjectPool, KeyedObjectPool, resolveOperationMode, OperationModeManager, } from './patterns';
|
|
45
|
-
export type { IEventEmitter, IObserver, ISubject, IStateMachine, StateMachineOptions, TransitionHandler, ICoordinator, IFactory, IMediator, IObjectPool, ObjectPoolOptions, ObjectPoolStats, OperationMode, ResolvedOperationMode, OperationModeConfig, } from './patterns';
|
|
46
|
-
export declare const VERSION = "0.1.0";
|
|
47
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/shared/src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,YAAY,EACV,eAAe,EACf,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,YAAY,EACV,YAAY,EACZ,kBAAkB,EA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aAAa,EACb,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,aAAa,EACb,SAAS,EACT,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coordinator Pattern
|
|
3
|
-
*
|
|
4
|
-
* Base class for coordinators that manage lifecycle and integration
|
|
5
|
-
* of components within a larger system.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* class SortCoordinator extends BaseCoordinator {
|
|
10
|
-
* constructor(
|
|
11
|
-
* private grid: Grid,
|
|
12
|
-
* private sortManager: SortManager
|
|
13
|
-
* ) {
|
|
14
|
-
* super();
|
|
15
|
-
* }
|
|
16
|
-
*
|
|
17
|
-
* protected onInitialize(): void {
|
|
18
|
-
* // Setup event listeners
|
|
19
|
-
* this.sortManager.on('sort:change', this.handleSortChange);
|
|
20
|
-
* }
|
|
21
|
-
*
|
|
22
|
-
* protected onCleanup(): void {
|
|
23
|
-
* // Remove event listeners
|
|
24
|
-
* this.sortManager.off('sort:change', this.handleSortChange);
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* private handleSortChange = () => {
|
|
28
|
-
* this.grid.refresh();
|
|
29
|
-
* };
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* const coordinator = new SortCoordinator(grid, sortManager);
|
|
33
|
-
* coordinator.initialize(); // Setup
|
|
34
|
-
* // ... use ...
|
|
35
|
-
* coordinator.cleanup(); // Teardown
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export interface ICoordinator {
|
|
39
|
-
/** Initialize the coordinator */
|
|
40
|
-
initialize(): void;
|
|
41
|
-
/** Cleanup and tear down the coordinator */
|
|
42
|
-
cleanup(): void;
|
|
43
|
-
/** Check if the coordinator is initialized */
|
|
44
|
-
readonly isInitialized: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Base coordinator implementation
|
|
48
|
-
*
|
|
49
|
-
* Provides lifecycle management with initialization and cleanup hooks.
|
|
50
|
-
*/
|
|
51
|
-
export declare abstract class BaseCoordinator implements ICoordinator {
|
|
52
|
-
private _initialized;
|
|
53
|
-
/**
|
|
54
|
-
* Initialize the coordinator
|
|
55
|
-
*
|
|
56
|
-
* This can be called multiple times safely - it will only
|
|
57
|
-
* initialize once until cleanup() is called.
|
|
58
|
-
*/
|
|
59
|
-
initialize(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Cleanup the coordinator
|
|
62
|
-
*
|
|
63
|
-
* This can be called multiple times safely - cleanup will only
|
|
64
|
-
* occur if the coordinator is initialized.
|
|
65
|
-
*/
|
|
66
|
-
cleanup(): void;
|
|
67
|
-
/**
|
|
68
|
-
* Check if the coordinator is initialized
|
|
69
|
-
*/
|
|
70
|
-
get isInitialized(): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Hook called during initialization
|
|
73
|
-
*
|
|
74
|
-
* Subclasses should override this to perform their setup.
|
|
75
|
-
*/
|
|
76
|
-
protected abstract onInitialize(): void;
|
|
77
|
-
/**
|
|
78
|
-
* Hook called during cleanup
|
|
79
|
-
*
|
|
80
|
-
* Subclasses should override this to perform their teardown.
|
|
81
|
-
*/
|
|
82
|
-
protected abstract onCleanup(): void;
|
|
83
|
-
/**
|
|
84
|
-
* Assert that the coordinator is initialized
|
|
85
|
-
*
|
|
86
|
-
* Throws an error if not initialized.
|
|
87
|
-
*/
|
|
88
|
-
protected assertInitialized(): void;
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=coordinator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../../../packages/shared/src/patterns/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,UAAU,IAAI,IAAI,CAAC;IAEnB,4CAA4C;IAC5C,OAAO,IAAI,IAAI,CAAC;IAEhB,8CAA8C;IAC9C,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED;;;;GAIG;AACH,8BAAsB,eAAgB,YAAW,YAAY;IAC3D,OAAO,CAAC,YAAY,CAAS;IAE7B;;;;;OAKG;IACH,UAAU,IAAI,IAAI;IAoBlB;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IAiBf;;OAEG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI;IAEvC;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,IAAI,IAAI;IAEpC;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,IAAI,IAAI;CAOpC"}
|