@procedures/client 0.2.0 → 0.2.1
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/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/procedures/invoke.d.ts +6 -1
- package/dist/procedures/invoke.d.ts.map +1 -1
- package/dist/procedures/invoke.js +2 -2
- package/dist/procedures/invoke.js.map +1 -1
- package/dist/server/host-policy.d.ts +3 -3
- package/dist/server/host-policy.d.ts.map +1 -1
- package/dist/server/procedure-server.d.ts +2 -2
- package/dist/server/procedure-server.d.ts.map +1 -1
- package/dist/server/procedure-server.js.map +1 -1
- package/package.json +1 -1
- package/src/browser.ts +1 -0
- package/src/procedures/invoke.ts +10 -4
- package/src/server/host-policy.ts +3 -3
- package/src/server/procedure-server.ts +2 -2
- package/dist/client/middleware/batching.d.ts +0 -102
- package/dist/client/middleware/batching.d.ts.map +0 -1
- package/dist/client/middleware/batching.js +0 -245
- package/dist/client/middleware/batching.js.map +0 -1
- package/dist/collections/async/async-queue.d.ts +0 -144
- package/dist/collections/async/async-queue.d.ts.map +0 -1
- package/dist/collections/async/async-queue.js +0 -347
- package/dist/collections/async/async-queue.js.map +0 -1
- package/dist/collections/async/channels.d.ts +0 -188
- package/dist/collections/async/channels.d.ts.map +0 -1
- package/dist/collections/async/channels.js +0 -312
- package/dist/collections/async/channels.js.map +0 -1
- package/dist/collections/behaviors/bounded.d.ts +0 -79
- package/dist/collections/behaviors/bounded.d.ts.map +0 -1
- package/dist/collections/behaviors/bounded.js +0 -384
- package/dist/collections/behaviors/bounded.js.map +0 -1
- package/dist/collections/behaviors/evented.d.ts +0 -154
- package/dist/collections/behaviors/evented.d.ts.map +0 -1
- package/dist/collections/behaviors/evented.js +0 -299
- package/dist/collections/behaviors/evented.js.map +0 -1
- package/dist/collections/behaviors/lru.d.ts +0 -84
- package/dist/collections/behaviors/lru.d.ts.map +0 -1
- package/dist/collections/behaviors/lru.js +0 -330
- package/dist/collections/behaviors/lru.js.map +0 -1
- package/dist/collections/behaviors/readonly.d.ts +0 -73
- package/dist/collections/behaviors/readonly.d.ts.map +0 -1
- package/dist/collections/behaviors/readonly.js +0 -158
- package/dist/collections/behaviors/readonly.js.map +0 -1
- package/dist/collections/behaviors/safe.d.ts +0 -163
- package/dist/collections/behaviors/safe.d.ts.map +0 -1
- package/dist/collections/behaviors/safe.js +0 -172
- package/dist/collections/behaviors/safe.js.map +0 -1
- package/dist/collections/behaviors/synchronized.d.ts +0 -88
- package/dist/collections/behaviors/synchronized.d.ts.map +0 -1
- package/dist/collections/behaviors/synchronized.js +0 -294
- package/dist/collections/behaviors/synchronized.js.map +0 -1
- package/dist/collections/behaviors/ttl.d.ts +0 -118
- package/dist/collections/behaviors/ttl.d.ts.map +0 -1
- package/dist/collections/behaviors/ttl.js +0 -338
- package/dist/collections/behaviors/ttl.js.map +0 -1
- package/dist/collections/core/effects.d.ts +0 -176
- package/dist/collections/core/effects.d.ts.map +0 -1
- package/dist/collections/core/effects.js +0 -180
- package/dist/collections/core/effects.js.map +0 -1
- package/dist/collections/core/events.d.ts +0 -192
- package/dist/collections/core/events.d.ts.map +0 -1
- package/dist/collections/core/events.js +0 -291
- package/dist/collections/core/events.js.map +0 -1
- package/dist/collections/core/middleware.d.ts +0 -231
- package/dist/collections/core/middleware.d.ts.map +0 -1
- package/dist/collections/core/middleware.js +0 -161
- package/dist/collections/core/middleware.js.map +0 -1
- package/dist/collections/core/policies.d.ts +0 -220
- package/dist/collections/core/policies.d.ts.map +0 -1
- package/dist/collections/core/policies.js +0 -48
- package/dist/collections/core/policies.js.map +0 -1
- package/dist/collections/core/traits.d.ts +0 -142
- package/dist/collections/core/traits.d.ts.map +0 -1
- package/dist/collections/core/traits.js +0 -8
- package/dist/collections/core/traits.js.map +0 -1
- package/dist/collections/examples.d.ts +0 -13
- package/dist/collections/examples.d.ts.map +0 -1
- package/dist/collections/examples.js +0 -302
- package/dist/collections/examples.js.map +0 -1
- package/dist/collections/fx/collectors.d.ts +0 -190
- package/dist/collections/fx/collectors.d.ts.map +0 -1
- package/dist/collections/fx/collectors.js +0 -369
- package/dist/collections/fx/collectors.js.map +0 -1
- package/dist/collections/fx/iter.d.ts +0 -166
- package/dist/collections/fx/iter.d.ts.map +0 -1
- package/dist/collections/fx/iter.js +0 -421
- package/dist/collections/fx/iter.js.map +0 -1
- package/dist/collections/impl/array-deque.d.ts +0 -107
- package/dist/collections/impl/array-deque.d.ts.map +0 -1
- package/dist/collections/impl/array-deque.js +0 -381
- package/dist/collections/impl/array-deque.js.map +0 -1
- package/dist/collections/impl/array-list.d.ts +0 -101
- package/dist/collections/impl/array-list.d.ts.map +0 -1
- package/dist/collections/impl/array-list.js +0 -387
- package/dist/collections/impl/array-list.js.map +0 -1
- package/dist/collections/impl/hash-map.d.ts +0 -141
- package/dist/collections/impl/hash-map.d.ts.map +0 -1
- package/dist/collections/impl/hash-map.js +0 -450
- package/dist/collections/impl/hash-map.js.map +0 -1
- package/dist/collections/impl/hash-set.d.ts +0 -125
- package/dist/collections/impl/hash-set.d.ts.map +0 -1
- package/dist/collections/impl/hash-set.js +0 -264
- package/dist/collections/impl/hash-set.js.map +0 -1
- package/dist/collections/impl/linked-hash-map.d.ts +0 -141
- package/dist/collections/impl/linked-hash-map.d.ts.map +0 -1
- package/dist/collections/impl/linked-hash-map.js +0 -472
- package/dist/collections/impl/linked-hash-map.js.map +0 -1
- package/dist/collections/impl/linked-list.d.ts +0 -109
- package/dist/collections/impl/linked-list.d.ts.map +0 -1
- package/dist/collections/impl/linked-list.js +0 -491
- package/dist/collections/impl/linked-list.js.map +0 -1
- package/dist/collections/impl/priority-queue.d.ts +0 -134
- package/dist/collections/impl/priority-queue.d.ts.map +0 -1
- package/dist/collections/impl/priority-queue.js +0 -336
- package/dist/collections/impl/priority-queue.js.map +0 -1
- package/dist/collections/impl/tree-map.d.ts +0 -146
- package/dist/collections/impl/tree-map.d.ts.map +0 -1
- package/dist/collections/impl/tree-map.js +0 -781
- package/dist/collections/impl/tree-map.js.map +0 -1
- package/dist/collections/impl/tree-set.d.ts +0 -112
- package/dist/collections/impl/tree-set.d.ts.map +0 -1
- package/dist/collections/impl/tree-set.js +0 -374
- package/dist/collections/impl/tree-set.js.map +0 -1
- package/dist/collections/index.d.ts +0 -105
- package/dist/collections/index.d.ts.map +0 -1
- package/dist/collections/index.js +0 -135
- package/dist/collections/index.js.map +0 -1
- package/dist/collections/interfaces/collection.d.ts +0 -119
- package/dist/collections/interfaces/collection.d.ts.map +0 -1
- package/dist/collections/interfaces/collection.js +0 -8
- package/dist/collections/interfaces/collection.js.map +0 -1
- package/dist/collections/interfaces/list.d.ts +0 -247
- package/dist/collections/interfaces/list.d.ts.map +0 -1
- package/dist/collections/interfaces/list.js +0 -8
- package/dist/collections/interfaces/list.js.map +0 -1
- package/dist/collections/interfaces/map.d.ts +0 -344
- package/dist/collections/interfaces/map.d.ts.map +0 -1
- package/dist/collections/interfaces/map.js +0 -8
- package/dist/collections/interfaces/map.js.map +0 -1
- package/dist/collections/interfaces/queue.d.ts +0 -304
- package/dist/collections/interfaces/queue.d.ts.map +0 -1
- package/dist/collections/interfaces/queue.js +0 -8
- package/dist/collections/interfaces/queue.js.map +0 -1
- package/dist/collections/interfaces/set.d.ts +0 -137
- package/dist/collections/interfaces/set.d.ts.map +0 -1
- package/dist/collections/interfaces/set.js +0 -8
- package/dist/collections/interfaces/set.js.map +0 -1
- package/dist/collections/storage/api.d.ts +0 -109
- package/dist/collections/storage/api.d.ts.map +0 -1
- package/dist/collections/storage/api.js +0 -182
- package/dist/collections/storage/api.js.map +0 -1
- package/dist/collections/storage/hybrid.d.ts +0 -164
- package/dist/collections/storage/hybrid.d.ts.map +0 -1
- package/dist/collections/storage/hybrid.js +0 -416
- package/dist/collections/storage/hybrid.js.map +0 -1
- package/dist/collections/storage/index.d.ts +0 -16
- package/dist/collections/storage/index.d.ts.map +0 -1
- package/dist/collections/storage/index.js +0 -13
- package/dist/collections/storage/index.js.map +0 -1
- package/dist/collections/storage/interface.d.ts +0 -141
- package/dist/collections/storage/interface.d.ts.map +0 -1
- package/dist/collections/storage/interface.js +0 -23
- package/dist/collections/storage/interface.js.map +0 -1
- package/dist/collections/storage/memory.d.ts +0 -68
- package/dist/collections/storage/memory.d.ts.map +0 -1
- package/dist/collections/storage/memory.js +0 -154
- package/dist/collections/storage/memory.js.map +0 -1
- package/dist/collections/utils/defaults.d.ts +0 -135
- package/dist/collections/utils/defaults.d.ts.map +0 -1
- package/dist/collections/utils/defaults.js +0 -322
- package/dist/collections/utils/defaults.js.map +0 -1
- package/dist/collections/utils/factories.d.ts +0 -144
- package/dist/collections/utils/factories.d.ts.map +0 -1
- package/dist/collections/utils/factories.js +0 -293
- package/dist/collections/utils/factories.js.map +0 -1
- package/dist/collections/utils/helpers.d.ts +0 -137
- package/dist/collections/utils/helpers.d.ts.map +0 -1
- package/dist/collections/utils/helpers.js +0 -221
- package/dist/collections/utils/helpers.js.map +0 -1
- package/dist/collections.d.ts +0 -12
- package/dist/collections.d.ts.map +0 -1
- package/dist/collections.js +0 -10
- package/dist/collections.js.map +0 -1
- package/dist/components/define.d.ts +0 -134
- package/dist/components/define.d.ts.map +0 -1
- package/dist/components/define.js +0 -486
- package/dist/components/define.js.map +0 -1
- package/dist/components/index.d.ts +0 -39
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -38
- package/dist/components/index.js.map +0 -1
- package/dist/components/types.d.ts +0 -264
- package/dist/components/types.d.ts.map +0 -1
- package/dist/components/types.js +0 -46
- package/dist/components/types.js.map +0 -1
- package/dist/procedures/storage/adapter.d.ts +0 -148
- package/dist/procedures/storage/adapter.d.ts.map +0 -1
- package/dist/procedures/storage/adapter.js +0 -214
- package/dist/procedures/storage/adapter.js.map +0 -1
- package/dist/procedures/storage/api.d.ts +0 -125
- package/dist/procedures/storage/api.d.ts.map +0 -1
- package/dist/procedures/storage/api.js +0 -220
- package/dist/procedures/storage/api.js.map +0 -1
- package/dist/procedures/storage/factory.d.ts +0 -134
- package/dist/procedures/storage/factory.d.ts.map +0 -1
- package/dist/procedures/storage/factory.js +0 -166
- package/dist/procedures/storage/factory.js.map +0 -1
- package/dist/procedures/storage/hybrid.d.ts +0 -193
- package/dist/procedures/storage/hybrid.d.ts.map +0 -1
- package/dist/procedures/storage/hybrid.js +0 -519
- package/dist/procedures/storage/hybrid.js.map +0 -1
- package/dist/procedures/storage/index.d.ts +0 -17
- package/dist/procedures/storage/index.d.ts.map +0 -1
- package/dist/procedures/storage/index.js +0 -17
- package/dist/procedures/storage/index.js.map +0 -1
- package/dist/procedures/storage/procedures.d.ts +0 -39
- package/dist/procedures/storage/procedures.d.ts.map +0 -1
- package/dist/procedures/storage/procedures.js +0 -261
- package/dist/procedures/storage/procedures.js.map +0 -1
- package/dist/procedures/storage/serialization.d.ts +0 -123
- package/dist/procedures/storage/serialization.d.ts.map +0 -1
- package/dist/procedures/storage/serialization.js +0 -216
- package/dist/procedures/storage/serialization.js.map +0 -1
- package/dist/procedures/storage/synced-registry.d.ts +0 -246
- package/dist/procedures/storage/synced-registry.d.ts.map +0 -1
- package/dist/procedures/storage/synced-registry.js +0 -575
- package/dist/procedures/storage/synced-registry.js.map +0 -1
- package/dist/procedures/storage/types.d.ts +0 -130
- package/dist/procedures/storage/types.d.ts.map +0 -1
- package/dist/procedures/storage/types.js +0 -8
- package/dist/procedures/storage/types.js.map +0 -1
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common helper utilities for collections.
|
|
3
|
-
*
|
|
4
|
-
* Provides shared functionality to reduce code duplication across implementations.
|
|
5
|
-
*/
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Bounds checking utilities
|
|
8
|
-
// ============================================================================
|
|
9
|
-
/**
|
|
10
|
-
* Checks if an index is within valid bounds [0, size).
|
|
11
|
-
* Throws RangeError if out of bounds.
|
|
12
|
-
*
|
|
13
|
-
* @param index The index to check
|
|
14
|
-
* @param size The size of the collection
|
|
15
|
-
* @param collectionName Optional name for error message
|
|
16
|
-
* @throws RangeError if index is out of bounds
|
|
17
|
-
*/
|
|
18
|
-
export function checkBounds(index, size, collectionName = "Collection") {
|
|
19
|
-
if (index < 0 || index >= size) {
|
|
20
|
-
throw new RangeError(`${collectionName}: Index ${index} out of bounds [0, ${size})`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Checks if an index is valid for insertion [0, size].
|
|
25
|
-
* Allows index === size for append operations.
|
|
26
|
-
*
|
|
27
|
-
* @param index The index to check
|
|
28
|
-
* @param size The size of the collection
|
|
29
|
-
* @param collectionName Optional name for error message
|
|
30
|
-
* @throws RangeError if index is out of bounds
|
|
31
|
-
*/
|
|
32
|
-
export function checkInsertBounds(index, size, collectionName = "Collection") {
|
|
33
|
-
if (index < 0 || index > size) {
|
|
34
|
-
throw new RangeError(`${collectionName}: Index ${index} out of bounds [0, ${size}]`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Checks if a range [start, end) is valid.
|
|
39
|
-
*
|
|
40
|
-
* @param start Start index (inclusive)
|
|
41
|
-
* @param end End index (exclusive)
|
|
42
|
-
* @param size The size of the collection
|
|
43
|
-
* @param collectionName Optional name for error message
|
|
44
|
-
* @throws RangeError if range is invalid
|
|
45
|
-
*/
|
|
46
|
-
export function checkRangeBounds(start, end, size, collectionName = "Collection") {
|
|
47
|
-
if (start < 0 || end > size || start > end) {
|
|
48
|
-
throw new RangeError(`${collectionName}: Invalid range [${start}, ${end}) for size ${size}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// ============================================================================
|
|
52
|
-
// Equality and search utilities
|
|
53
|
-
// ============================================================================
|
|
54
|
-
/**
|
|
55
|
-
* Finds the index of an element in an array using custom equality.
|
|
56
|
-
*
|
|
57
|
-
* @param array The array to search
|
|
58
|
-
* @param element The element to find
|
|
59
|
-
* @param eq Equality function
|
|
60
|
-
* @returns Index of element, or -1 if not found
|
|
61
|
-
*/
|
|
62
|
-
export function findIndex(array, element, eq) {
|
|
63
|
-
for (let i = 0; i < array.length; i++) {
|
|
64
|
-
if (eq(array[i], element)) {
|
|
65
|
-
return i;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return -1;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Finds the last index of an element in an array using custom equality.
|
|
72
|
-
*
|
|
73
|
-
* @param array The array to search
|
|
74
|
-
* @param element The element to find
|
|
75
|
-
* @param eq Equality function
|
|
76
|
-
* @returns Last index of element, or -1 if not found
|
|
77
|
-
*/
|
|
78
|
-
export function findLastIndex(array, element, eq) {
|
|
79
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
80
|
-
if (eq(array[i], element)) {
|
|
81
|
-
return i;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return -1;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Checks if an array contains an element using custom equality.
|
|
88
|
-
*
|
|
89
|
-
* @param array The array to search
|
|
90
|
-
* @param element The element to find
|
|
91
|
-
* @param eq Equality function
|
|
92
|
-
* @returns true if element is found
|
|
93
|
-
*/
|
|
94
|
-
export function arrayContains(array, element, eq) {
|
|
95
|
-
return findIndex(array, element, eq) !== -1;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Removes the first occurrence of an element from an array.
|
|
99
|
-
*
|
|
100
|
-
* @param array The array to modify
|
|
101
|
-
* @param element The element to remove
|
|
102
|
-
* @param eq Equality function
|
|
103
|
-
* @returns true if element was found and removed
|
|
104
|
-
*/
|
|
105
|
-
export function arrayRemove(array, element, eq) {
|
|
106
|
-
const index = findIndex(array, element, eq);
|
|
107
|
-
if (index === -1)
|
|
108
|
-
return false;
|
|
109
|
-
array.splice(index, 1);
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Removes all occurrences of an element from an array.
|
|
114
|
-
*
|
|
115
|
-
* @param array The array to modify
|
|
116
|
-
* @param element The element to remove
|
|
117
|
-
* @param eq Equality function
|
|
118
|
-
* @returns Number of elements removed
|
|
119
|
-
*/
|
|
120
|
-
export function arrayRemoveAll(array, element, eq) {
|
|
121
|
-
let count = 0;
|
|
122
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
123
|
-
if (eq(array[i], element)) {
|
|
124
|
-
array.splice(i, 1);
|
|
125
|
-
count++;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return count;
|
|
129
|
-
}
|
|
130
|
-
// ============================================================================
|
|
131
|
-
// Iterator utilities
|
|
132
|
-
// ============================================================================
|
|
133
|
-
/**
|
|
134
|
-
* Creates a simple iterator for an array.
|
|
135
|
-
*
|
|
136
|
-
* @param array The array to iterate
|
|
137
|
-
* @returns Iterator over the array
|
|
138
|
-
*/
|
|
139
|
-
export function* arrayIterator(array) {
|
|
140
|
-
yield* array;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Creates a reversed iterator for an array.
|
|
144
|
-
*
|
|
145
|
-
* @param array The array to iterate
|
|
146
|
-
* @returns Reversed iterator over the array
|
|
147
|
-
*/
|
|
148
|
-
export function* reverseArrayIterator(array) {
|
|
149
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
150
|
-
yield array[i];
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Converts an iterable to an array.
|
|
155
|
-
*
|
|
156
|
-
* @param iterable The iterable to convert
|
|
157
|
-
* @returns Array containing all elements
|
|
158
|
-
*/
|
|
159
|
-
export function toArray(iterable) {
|
|
160
|
-
return Array.from(iterable);
|
|
161
|
-
}
|
|
162
|
-
// ============================================================================
|
|
163
|
-
// Validation utilities
|
|
164
|
-
// ============================================================================
|
|
165
|
-
/**
|
|
166
|
-
* Ensures a value is not null or undefined.
|
|
167
|
-
*
|
|
168
|
-
* @param value The value to check
|
|
169
|
-
* @param message Error message
|
|
170
|
-
* @returns The non-null value
|
|
171
|
-
* @throws Error if value is null or undefined
|
|
172
|
-
*/
|
|
173
|
-
export function requireNonNull(value, message = "Value cannot be null or undefined") {
|
|
174
|
-
if (value === null || value === undefined) {
|
|
175
|
-
throw new Error(message);
|
|
176
|
-
}
|
|
177
|
-
return value;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Ensures a collection is not empty.
|
|
181
|
-
*
|
|
182
|
-
* @param size Current size
|
|
183
|
-
* @param collectionName Optional name for error message
|
|
184
|
-
* @throws Error if collection is empty
|
|
185
|
-
*/
|
|
186
|
-
export function requireNonEmpty(size, collectionName = "Collection") {
|
|
187
|
-
if (size === 0) {
|
|
188
|
-
throw new Error(`${collectionName} is empty`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
// ============================================================================
|
|
192
|
-
// Math utilities
|
|
193
|
-
// ============================================================================
|
|
194
|
-
/**
|
|
195
|
-
* Clamps a value between min and max.
|
|
196
|
-
*
|
|
197
|
-
* @param value The value to clamp
|
|
198
|
-
* @param min Minimum value
|
|
199
|
-
* @param max Maximum value
|
|
200
|
-
* @returns Clamped value
|
|
201
|
-
*/
|
|
202
|
-
export function clamp(value, min, max) {
|
|
203
|
-
return Math.max(min, Math.min(max, value));
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Calculates hash code for a string.
|
|
207
|
-
* Uses Java's String.hashCode() algorithm.
|
|
208
|
-
*
|
|
209
|
-
* @param str The string to hash
|
|
210
|
-
* @returns Hash code
|
|
211
|
-
*/
|
|
212
|
-
export function stringHashCode(str) {
|
|
213
|
-
let hash = 0;
|
|
214
|
-
for (let i = 0; i < str.length; i++) {
|
|
215
|
-
const char = str.charCodeAt(i);
|
|
216
|
-
hash = ((hash << 5) - hash) + char;
|
|
217
|
-
hash = hash & hash; // Convert to 32-bit integer
|
|
218
|
-
}
|
|
219
|
-
return hash;
|
|
220
|
-
}
|
|
221
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/collections/utils/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,IAAY,EAAE,iBAAyB,YAAY;IAC5F,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,IAAI,UAAU,CAAC,GAAG,cAAc,WAAW,KAAK,sBAAsB,IAAI,GAAG,CAAC,CAAC;IACvF,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,IAAY,EAAE,iBAAyB,YAAY;IAClG,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QAC9B,MAAM,IAAI,UAAU,CAAC,GAAG,cAAc,WAAW,KAAK,sBAAsB,IAAI,GAAG,CAAC,CAAC;IACvF,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,GAAW,EACX,IAAY,EACZ,iBAAyB,YAAY;IAErC,IAAI,KAAK,GAAG,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QAC3C,MAAM,IAAI,UAAU,CAClB,GAAG,cAAc,oBAAoB,KAAK,KAAK,GAAG,cAAc,IAAI,EAAE,CACvE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,gCAAgC;AAChC,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAI,KAAU,EAAE,OAAU,EAAE,EAAS;IAC5D,KAAK,IAAI,CAAC,GAAG,CAAC,E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AAK,CAAC,GAAG,cAAc,WAAW,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IAC3D,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;QACnC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,4BAA4B;IAClD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/collections.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collections entry point: "@mark1russell7/client/collections"
|
|
3
|
-
*
|
|
4
|
-
* Re-exports @mark1russell7/client-collections, plus the collection storage
|
|
5
|
-
* backends that need a Client and therefore live in this package.
|
|
6
|
-
*/
|
|
7
|
-
export * from "@mark1russell7/client-collections";
|
|
8
|
-
export { ApiStorage } from "./procedures/storage/api.js";
|
|
9
|
-
export type { ApiStorageOptions } from "./procedures/storage/api.js";
|
|
10
|
-
export { HybridStorage } from "./procedures/storage/hybrid.js";
|
|
11
|
-
export type { HybridStorageOptions, ConflictResolution, WriteStrategy } from "./procedures/storage/hybrid.js";
|
|
12
|
-
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,mCAAmC,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/collections.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collections entry point: "@mark1russell7/client/collections"
|
|
3
|
-
*
|
|
4
|
-
* Re-exports @mark1russell7/client-collections, plus the collection storage
|
|
5
|
-
* backends that need a Client and therefore live in this package.
|
|
6
|
-
*/
|
|
7
|
-
export * from "@mark1russell7/client-collections";
|
|
8
|
-
export { ApiStorage } from "./procedures/storage/api.js";
|
|
9
|
-
export { HybridStorage } from "./procedures/storage/hybrid.js";
|
|
10
|
-
//# sourceMappingURL=collections.js.map
|
package/dist/collections.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,mCAAmC,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Component Definition Helpers
|
|
3
|
-
*
|
|
4
|
-
* Utilities for defining components as procedures.
|
|
5
|
-
* Components are procedures with special handling for UI rendering.
|
|
6
|
-
*/
|
|
7
|
-
import type { ZodLike } from "../client/validation/types.js";
|
|
8
|
-
import type { Procedure, ProcedurePath } from "../procedures/types.js";
|
|
9
|
-
import type { ComponentDefinition, ComponentContext, ComponentOutput, ComponentBundle, AnyComponentDefinition, Size } from "./types.js";
|
|
10
|
-
/**
|
|
11
|
-
* Standard component input structure.
|
|
12
|
-
* Components receive data, size, and path for rendering.
|
|
13
|
-
*/
|
|
14
|
-
export interface ComponentInput<TData = unknown> {
|
|
15
|
-
/** Component data */
|
|
16
|
-
data: TData;
|
|
17
|
-
/** Available size for rendering */
|
|
18
|
-
size: Size;
|
|
19
|
-
/** Path in render tree */
|
|
20
|
-
path: string;
|
|
21
|
-
/** Depth in render tree */
|
|
22
|
-
depth?: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Default component input schema.
|
|
26
|
-
* Validates the standard { data, size, path } structure.
|
|
27
|
-
*/
|
|
28
|
-
export declare const componentInputSchema: ZodLike<ComponentInput>;
|
|
29
|
-
/**
|
|
30
|
-
* Component output schema.
|
|
31
|
-
* Validates that output is a serializable ComponentOutput.
|
|
32
|
-
*/
|
|
33
|
-
export declare const componentOutputSchema: ZodLike<ComponentOutput>;
|
|
34
|
-
/**
|
|
35
|
-
* Define a component and convert it to a procedure.
|
|
36
|
-
*
|
|
37
|
-
* Components are registered under ["components", namespace?, type].
|
|
38
|
-
*
|
|
39
|
-
* @param definition - Component definition
|
|
40
|
-
* @returns The component definition (for chaining)
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* // Simple component
|
|
45
|
-
* const userCard = defineComponent({
|
|
46
|
-
* type: "user-card",
|
|
47
|
-
* namespace: "ui",
|
|
48
|
-
* input: userSchema,
|
|
49
|
-
* factory: (ctx) => ({
|
|
50
|
-
* type: "user-card",
|
|
51
|
-
* props: { user: ctx.data },
|
|
52
|
-
* }),
|
|
53
|
-
* });
|
|
54
|
-
*
|
|
55
|
-
* // Streaming component
|
|
56
|
-
* const liveDashboard = defineComponent({
|
|
57
|
-
* type: "live-dashboard",
|
|
58
|
-
* streaming: true,
|
|
59
|
-
* factory: async function* (ctx) {
|
|
60
|
-
* yield { type: "dashboard", props: { loading: true } };
|
|
61
|
-
* for await (const data of ctx.bus.stream("updates")) {
|
|
62
|
-
* yield { type: "dashboard", props: { data } };
|
|
63
|
-
* }
|
|
64
|
-
* },
|
|
65
|
-
* });
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export declare function defineComponent<TData = unknown>(definition: ComponentDefinition<TData>): ComponentDefinition<TData>;
|
|
69
|
-
/**
|
|
70
|
-
* Convert a component definition to a procedure.
|
|
71
|
-
*
|
|
72
|
-
* @param definition - Component definition
|
|
73
|
-
* @param path - Procedure path
|
|
74
|
-
* @returns Procedure that wraps the component
|
|
75
|
-
*/
|
|
76
|
-
export declare function componentToProcedure<TData>(definition: ComponentDefinition<TData>, path: ProcedurePath): Procedure<ComponentInput<TData>, ComponentOutput>;
|
|
77
|
-
/**
|
|
78
|
-
* Register a bundle of components.
|
|
79
|
-
*
|
|
80
|
-
* @param bundle - Component bundle
|
|
81
|
-
* @returns The registered components
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* const registered = registerBundle({
|
|
86
|
-
* namespace: "ui",
|
|
87
|
-
* components: [buttonComponent, cardComponent],
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
export declare function registerBundle(bundle: ComponentBundle): AnyComponentDefinition[];
|
|
92
|
-
/**
|
|
93
|
-
* Create a component bundle.
|
|
94
|
-
*
|
|
95
|
-
* @param namespace - Shared namespace
|
|
96
|
-
* @param components - Component definitions
|
|
97
|
-
* @param metadata - Optional bundle metadata
|
|
98
|
-
* @returns ComponentBundle
|
|
99
|
-
*/
|
|
100
|
-
export declare function createBundle(namespace: string, components: AnyComponentDefinition[], metadata?: ComponentBundle["metadata"]): ComponentBundle;
|
|
101
|
-
/**
|
|
102
|
-
* Define a simple component with minimal boilerplate.
|
|
103
|
-
*
|
|
104
|
-
* @param type - Component type
|
|
105
|
-
* @param factory - Factory function
|
|
106
|
-
* @returns ComponentDefinition
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```typescript
|
|
110
|
-
* const badge = simpleComponent("badge", (ctx) => ({
|
|
111
|
-
* type: "badge",
|
|
112
|
-
* props: { label: ctx.data.label },
|
|
113
|
-
* }));
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
export declare function simpleComponent<TData = unknown>(type: string, factory: (ctx: ComponentContext<TData>) => ComponentOutput): ComponentDefinition<TData>;
|
|
117
|
-
/**
|
|
118
|
-
* Define a namespaced component with minimal boilerplate.
|
|
119
|
-
*
|
|
120
|
-
* @param namespace - Component namespace
|
|
121
|
-
* @param type - Component type
|
|
122
|
-
* @param factory - Factory function
|
|
123
|
-
* @returns ComponentDefinition
|
|
124
|
-
*/
|
|
125
|
-
export declare function namespacedComponent<TData = unknown>(namespace: string, type: string, factory: (ctx: ComponentContext<TData>) => ComponentOutput): ComponentDefinition<TData>;
|
|
126
|
-
/**
|
|
127
|
-
* Define a streaming component.
|
|
128
|
-
*
|
|
129
|
-
* @param type - Component type
|
|
130
|
-
* @param factory - Generator factory function
|
|
131
|
-
* @returns ComponentDefinition
|
|
132
|
-
*/
|
|
133
|
-
export declare function streamingComponent<TData = unknown>(type: string, factory: (ctx: ComponentContext<TData>) => AsyncGenerator<ComponentOutput, void, unknown>): ComponentDefinition<TData>;
|
|
134
|
-
//# sourceMappingURL=define.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../src/components/define.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAoB,MAAM,wBAAwB,CAAC;AAGzF,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,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