@evolu/common 6.0.1-preview.2 → 6.0.1-preview.21
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/src/Assert.d.ts +6 -3
- package/dist/src/Assert.d.ts.map +1 -1
- package/dist/src/Assert.js +7 -4
- package/dist/src/Brand.d.ts +75 -0
- package/dist/src/Brand.d.ts.map +1 -0
- package/dist/src/Brand.js +1 -0
- package/dist/src/Buffer.d.ts +1 -1
- package/dist/src/Buffer.d.ts.map +1 -1
- package/dist/src/Buffer.js +1 -1
- package/dist/src/CallbackRegistry.d.ts +53 -0
- package/dist/src/CallbackRegistry.d.ts.map +1 -0
- package/dist/src/CallbackRegistry.js +25 -0
- package/dist/src/Console.d.ts +31 -6
- package/dist/src/Console.d.ts.map +1 -1
- package/dist/src/Console.js +72 -9
- package/dist/src/Crypto.d.ts +61 -34
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +29 -42
- package/dist/src/Evolu/Db.d.ts +159 -66
- package/dist/src/Evolu/Db.d.ts.map +1 -1
- package/dist/src/Evolu/Db.js +300 -705
- package/dist/src/Evolu/Diff.d.ts +3 -3
- package/dist/src/Evolu/Diff.d.ts.map +1 -1
- package/dist/src/Evolu/Diff.js +7 -5
- package/dist/src/Evolu/Evolu.d.ts +200 -115
- package/dist/src/Evolu/Evolu.d.ts.map +1 -1
- package/dist/src/Evolu/Evolu.js +287 -157
- package/dist/src/Evolu/Internal.d.ts +0 -2
- package/dist/src/Evolu/Internal.d.ts.map +1 -1
- package/dist/src/Evolu/Internal.js +0 -2
- package/dist/src/Evolu/LocalAuth.d.ts +144 -0
- package/dist/src/Evolu/LocalAuth.d.ts.map +1 -0
- package/dist/src/Evolu/LocalAuth.js +171 -0
- package/dist/src/Evolu/Owner.d.ts +209 -124
- package/dist/src/Evolu/Owner.d.ts.map +1 -1
- package/dist/src/Evolu/Owner.js +118 -104
- package/dist/src/Evolu/Platform.d.ts +9 -7
- package/dist/src/Evolu/Platform.d.ts.map +1 -1
- package/dist/src/Evolu/Protocol.d.ts +256 -211
- package/dist/src/Evolu/Protocol.d.ts.map +1 -1
- package/dist/src/Evolu/Protocol.js +558 -359
- package/dist/src/Evolu/Public.d.ts +6 -8
- package/dist/src/Evolu/Public.d.ts.map +1 -1
- package/dist/src/Evolu/Public.js +2 -3
- package/dist/src/Evolu/PublicKysely.js +3 -3
- package/dist/src/Evolu/Query.d.ts +2 -1
- package/dist/src/Evolu/Query.d.ts.map +1 -1
- package/dist/src/Evolu/Relay.d.ts +72 -4
- package/dist/src/Evolu/Relay.d.ts.map +1 -1
- package/dist/src/Evolu/Relay.js +124 -13
- package/dist/src/Evolu/Schema.d.ts +129 -73
- package/dist/src/Evolu/Schema.d.ts.map +1 -1
- package/dist/src/Evolu/Schema.js +169 -89
- package/dist/src/Evolu/Storage.d.ts +159 -14
- package/dist/src/Evolu/Storage.d.ts.map +1 -1
- package/dist/src/Evolu/Storage.js +42 -32
- package/dist/src/Evolu/Sync.d.ts +68 -13
- package/dist/src/Evolu/Sync.d.ts.map +1 -1
- package/dist/src/Evolu/Sync.js +414 -20
- package/dist/src/Evolu/Timestamp.d.ts +35 -27
- package/dist/src/Evolu/Timestamp.d.ts.map +1 -1
- package/dist/src/Evolu/Timestamp.js +27 -18
- package/dist/src/ManyToManyMap.d.ts +74 -10
- package/dist/src/ManyToManyMap.d.ts.map +1 -1
- package/dist/src/ManyToManyMap.js +41 -6
- package/dist/src/Number.d.ts +2 -1
- package/dist/src/Number.d.ts.map +1 -1
- package/dist/src/Random.d.ts +3 -2
- package/dist/src/Random.d.ts.map +1 -1
- package/dist/src/RefCountedResourceManager.d.ts +119 -0
- package/dist/src/RefCountedResourceManager.d.ts.map +1 -0
- package/dist/src/RefCountedResourceManager.js +197 -0
- package/dist/src/Result.d.ts +176 -51
- package/dist/src/Result.d.ts.map +1 -1
- package/dist/src/Result.js +30 -241
- package/dist/src/Sqlite.d.ts +21 -4
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +50 -8
- package/dist/src/Task.d.ts +511 -0
- package/dist/src/Task.d.ts.map +1 -0
- package/dist/src/Task.js +410 -0
- package/dist/src/Time.d.ts +59 -0
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +87 -4
- package/dist/src/Type.d.ts +474 -327
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +502 -436
- package/dist/src/Types.d.ts +0 -74
- package/dist/src/Types.d.ts.map +1 -1
- package/dist/src/WebSocket.d.ts +5 -2
- package/dist/src/WebSocket.d.ts.map +1 -1
- package/dist/src/WebSocket.js +12 -13
- package/dist/src/Worker.d.ts +39 -11
- package/dist/src/Worker.d.ts.map +1 -1
- package/dist/src/Worker.js +22 -4
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/package.json +14 -13
- package/src/Assert.ts +8 -7
- package/src/Brand.ts +75 -0
- package/src/Buffer.ts +1 -1
- package/src/CallbackRegistry.ts +84 -0
- package/src/Console.ts +91 -11
- package/src/Crypto.ts +94 -79
- package/src/Evolu/Db.ts +528 -1027
- package/src/Evolu/Diff.ts +7 -5
- package/src/Evolu/Evolu.ts +682 -329
- package/src/Evolu/Internal.ts +0 -2
- package/src/Evolu/LocalAuth.ts +422 -0
- package/src/Evolu/Owner.ts +282 -227
- package/src/Evolu/Platform.ts +9 -9
- package/src/Evolu/Protocol.ts +788 -640
- package/src/Evolu/Public.ts +7 -14
- package/src/Evolu/PublicKysely.ts +3 -3
- package/src/Evolu/Query.ts +2 -1
- package/src/Evolu/Relay.ts +238 -18
- package/src/Evolu/Schema.ts +391 -191
- package/src/Evolu/Storage.ts +275 -55
- package/src/Evolu/Sync.ts +708 -37
- package/src/Evolu/Timestamp.ts +38 -35
- package/src/ManyToManyMap.ts +127 -24
- package/src/Number.ts +2 -6
- package/src/Random.ts +3 -2
- package/src/RefCountedResourceManager.ts +368 -0
- package/src/Result.ts +183 -53
- package/src/Sqlite.ts +59 -23
- package/src/Task.ts +779 -0
- package/src/Time.ts +168 -4
- package/src/Type.ts +708 -660
- package/src/Types.ts +0 -76
- package/src/WebSocket.ts +23 -17
- package/src/Worker.ts +72 -23
- package/src/index.ts +3 -3
- package/dist/src/Callbacks.d.ts +0 -20
- package/dist/src/Callbacks.d.ts.map +0 -1
- package/dist/src/Callbacks.js +0 -18
- package/dist/src/Evolu/Config.d.ts +0 -69
- package/dist/src/Evolu/Config.d.ts.map +0 -1
- package/dist/src/Evolu/Config.js +0 -9
- package/dist/src/Evolu/Kysely.d.ts +0 -6
- package/dist/src/Evolu/Kysely.d.ts.map +0 -1
- package/dist/src/Evolu/Kysely.js +0 -21
- package/dist/src/NanoId.d.ts +0 -27
- package/dist/src/NanoId.d.ts.map +0 -1
- package/dist/src/NanoId.js +0 -6
- package/dist/src/Promise.d.ts +0 -180
- package/dist/src/Promise.d.ts.map +0 -1
- package/dist/src/Promise.js +0 -176
- package/src/Callbacks.ts +0 -43
- package/src/Evolu/Config.ts +0 -83
- package/src/Evolu/Kysely.ts +0 -38
- package/src/NanoId.ts +0 -39
- package/src/Promise.ts +0 -295
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { assert } from "../Assert.js";
|
|
2
|
+
import { bytesToHex } from "../Buffer.js";
|
|
3
|
+
import { createEqObject, eqNumber, eqString } from "../Eq.js";
|
|
2
4
|
import { increment } from "../Number.js";
|
|
3
5
|
import { orderUint8Array } from "../Order.js";
|
|
4
|
-
import { err,
|
|
5
|
-
import { brand, lessThanOrEqualTo, NonNegativeInt, object, regex, String, } from "../Type.js";
|
|
6
|
+
import { err, ok } from "../Result.js";
|
|
7
|
+
import { brand, lessThanOrEqualTo, NonNegativeInt, object, regex, String, Uint8Array, } from "../Type.js";
|
|
6
8
|
/**
|
|
7
9
|
* Millis is a timestamp in milliseconds, like `Date.now()`, but limited to the
|
|
8
10
|
* maximum value representable in 6 bytes (281474976710655) minus 1 (reserved
|
|
@@ -34,14 +36,17 @@ export const maxCounter = 65535;
|
|
|
34
36
|
*
|
|
35
37
|
* https://lemire.me/blog/2019/12/12/are-64-bit-random-identifiers-free-from-collision
|
|
36
38
|
*
|
|
37
|
-
* What
|
|
39
|
+
* What happens if different devices generate the same NodeId?
|
|
38
40
|
*
|
|
39
|
-
* If the
|
|
40
|
-
* different owner have different owner IDs. Timestamps are partitioned by
|
|
41
|
-
* OwnerId.
|
|
41
|
+
* If devices with the same NodeId use different owners, no issues occur.
|
|
42
42
|
*
|
|
43
|
-
* If the
|
|
44
|
-
*
|
|
43
|
+
* If devices with the same NodeId use the same owner, problems only arise when
|
|
44
|
+
* they generate CRDT messages with identical timestamps (same millis, counter,
|
|
45
|
+
* and NodeId). In this case, the protocol sync algorithm treats them as the
|
|
46
|
+
* same message: the first will be synced with the relay, while the affected
|
|
47
|
+
* message will not be delivered. The affected devices will see different data
|
|
48
|
+
* yet they will think they are synced. This is extremely rare and can be
|
|
49
|
+
* resolved by resetting one device to generate a new NodeId.
|
|
45
50
|
*/
|
|
46
51
|
export const NodeId = regex("NodeId", /^[a-f0-9]{16}$/)(String);
|
|
47
52
|
export const minNodeId = "0000000000000000";
|
|
@@ -58,10 +63,15 @@ export const Timestamp = object({
|
|
|
58
63
|
counter: Counter,
|
|
59
64
|
nodeId: NodeId,
|
|
60
65
|
});
|
|
66
|
+
/** Equality function for comparing {@link Timestamp}. */
|
|
67
|
+
export const eqTimestamp = createEqObject({
|
|
68
|
+
millis: eqNumber,
|
|
69
|
+
counter: eqNumber,
|
|
70
|
+
nodeId: eqString,
|
|
71
|
+
});
|
|
61
72
|
export const createTimestamp = ({ millis = minMillis, counter = minCounter, nodeId = minNodeId, } = {}) => ({ millis, counter, nodeId });
|
|
62
|
-
const hexAlphabet = "0123456789abcdef";
|
|
63
73
|
export const createInitialTimestamp = (deps) => {
|
|
64
|
-
const nodeId = deps.
|
|
74
|
+
const nodeId = bytesToHex(deps.randomBytes.create(8));
|
|
65
75
|
return createTimestamp({ nodeId });
|
|
66
76
|
};
|
|
67
77
|
export const timestampToTimestampString = (t) => [
|
|
@@ -115,9 +125,6 @@ export const sendTimestamp = (deps) => (timestamp) => {
|
|
|
115
125
|
});
|
|
116
126
|
};
|
|
117
127
|
export const receiveTimestamp = (deps) => (local, remote) => {
|
|
118
|
-
if (local.nodeId === remote.nodeId) {
|
|
119
|
-
return err({ type: "TimestampDuplicateNodeError", nodeId: local.nodeId });
|
|
120
|
-
}
|
|
121
128
|
const millis = getNextMillis(deps)([local.millis, remote.millis]);
|
|
122
129
|
if (!millis.ok)
|
|
123
130
|
return millis;
|
|
@@ -136,11 +143,13 @@ export const receiveTimestamp = (deps) => (local, remote) => {
|
|
|
136
143
|
nodeId: local.nodeId,
|
|
137
144
|
});
|
|
138
145
|
};
|
|
139
|
-
|
|
140
|
-
export const
|
|
146
|
+
/** Sortable bytes representation of {@link Timestamp}. */
|
|
147
|
+
export const TimestampBytes = brand("TimestampBytes", Uint8Array);
|
|
148
|
+
export const timestampBytesLength = NonNegativeInt.orThrow(16);
|
|
149
|
+
export const timestampToTimestampBytes = (timestamp) => {
|
|
141
150
|
const { millis, counter, nodeId } = timestamp;
|
|
142
151
|
// 6 bytes for millis, 2 bytes for counter, 8 bytes for nodeId.
|
|
143
|
-
const value = new Uint8Array(16);
|
|
152
|
+
const value = new globalThis.Uint8Array(16);
|
|
144
153
|
// Encode `millis` into the first 6 bytes.
|
|
145
154
|
const millisBigInt = BigInt(millis);
|
|
146
155
|
value[0] = Number((millisBigInt >> 40n) & 0xffn);
|
|
@@ -159,7 +168,7 @@ export const timestampToBinaryTimestamp = (timestamp) => {
|
|
|
159
168
|
}
|
|
160
169
|
return value;
|
|
161
170
|
};
|
|
162
|
-
export const
|
|
171
|
+
export const timestampBytesToTimestamp = (timestamp) => {
|
|
163
172
|
// Decode `millis` from the first 6 bytes.
|
|
164
173
|
const millis = (BigInt(timestamp[0]) << 40n) |
|
|
165
174
|
(BigInt(timestamp[1]) << 32n) |
|
|
@@ -176,4 +185,4 @@ export const binaryTimestampToTimestamp = (timestamp) => {
|
|
|
176
185
|
}
|
|
177
186
|
return { millis: Number(millis), counter, nodeId };
|
|
178
187
|
};
|
|
179
|
-
export const
|
|
188
|
+
export const orderTimestampBytes = orderUint8Array;
|
|
@@ -1,17 +1,75 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Bidirectional many-to-many map between keys and values.
|
|
3
|
+
*
|
|
4
|
+
* Why useful:
|
|
5
|
+
*
|
|
6
|
+
* - Provides O(1) (amortized) forward lookup (key -> values) and reverse lookup
|
|
7
|
+
* (value -> keys) without maintaining two maps manually and risking them
|
|
8
|
+
* diverging.
|
|
9
|
+
* - Natural fit for pub/sub style relations such as ownerId ↔ WebSocket, tag ↔
|
|
10
|
+
* item, user ↔ role, entity ↔ subscription where both directions are
|
|
11
|
+
* frequently queried.
|
|
12
|
+
* - Supports fast membership tests via `hasPair`, `hasKey`, and `hasValue`.
|
|
13
|
+
* - Iteration helpers (`forEach`, iterator) allow treating the structure as an
|
|
14
|
+
* edge list when needed.
|
|
15
|
+
*
|
|
16
|
+
* Complexity:
|
|
17
|
+
*
|
|
18
|
+
* - `add` / `remove` / `has*` / `get*` each perform a constant number of Map/Set
|
|
19
|
+
* operations (O(1) expected).
|
|
20
|
+
* - `deleteKey` and `deleteValue` are O(d) where d is the number of associated
|
|
21
|
+
* values / keys (the degree). This is optimal because every associated pair
|
|
22
|
+
* must be touched once.
|
|
23
|
+
* - In the Relay use case a socket (value) typically has only dozens of owners
|
|
24
|
+
* (degree small), and connection closes (triggering deleteValue) are
|
|
25
|
+
* relatively infrequent, so O(d) is acceptable.
|
|
26
|
+
*
|
|
27
|
+
* Object identity:
|
|
28
|
+
*
|
|
29
|
+
* - Keys and values are compared by reference (standard Map / Set semantics).
|
|
30
|
+
* Structural hashing of objects in JavaScript is non-trivial, can be
|
|
31
|
+
* expensive, and collision-prone if done naively. Prefer using stable
|
|
32
|
+
* primitive identifiers (ids, strings) instead of attempting to hash full
|
|
33
|
+
* object structures.
|
|
34
|
+
* - If structural equivalence is truly required, wrap objects in an adapter that
|
|
35
|
+
* supplies a canonical hash/id and stores/retrieves the original objects
|
|
36
|
+
* separately. This is a rare need; avoid unless you have clear requirements.
|
|
37
|
+
*/
|
|
2
38
|
export interface ManyToManyMap<K, V> {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Adds a key-value association to the map. Returns true if the pair was newly
|
|
41
|
+
* added, false if it already existed.
|
|
42
|
+
*/
|
|
43
|
+
add: (key: K, value: V) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Removes a specific key-value association. Returns true if the pair existed
|
|
46
|
+
* and was removed, false if it was not present.
|
|
47
|
+
*/
|
|
6
48
|
remove: (key: K, value: V) => boolean;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Gets all values associated with a key. Returned set is the internal Set
|
|
51
|
+
* instance typed as ReadonlySet. Do not mutate.
|
|
52
|
+
*/
|
|
53
|
+
getValues: (key: K) => ReadonlySet<V> | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Gets all keys associated with a value. Returned set is the internal Set
|
|
56
|
+
* instance typed as ReadonlySet. Do not mutate.
|
|
57
|
+
*/
|
|
58
|
+
getKeys: (value: V) => ReadonlySet<K> | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Iterates over each key-value pair (in insertion order of keys, then values
|
|
61
|
+
* per key).
|
|
62
|
+
*/
|
|
63
|
+
forEach: (callback: (key: K, value: V) => void) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Iterator over all key-value pairs enabling for..of and spread. Yields
|
|
66
|
+
* readonly [key, value] tuples.
|
|
67
|
+
*/
|
|
68
|
+
readonly [Symbol.iterator]: () => IterableIterator<readonly [K, V]>;
|
|
11
69
|
/** Checks if a specific key-value pair exists. */
|
|
12
70
|
hasPair: (key: K, value: V) => boolean;
|
|
13
71
|
/** Checks if a key exists in the map. */
|
|
14
|
-
hasKey(key: K)
|
|
72
|
+
hasKey: (key: K) => boolean;
|
|
15
73
|
/** Checks if a value exists in the map. */
|
|
16
74
|
hasValue: (value: V) => boolean;
|
|
17
75
|
/** Deletes all associations for a key. */
|
|
@@ -19,7 +77,13 @@ export interface ManyToManyMap<K, V> {
|
|
|
19
77
|
/** Deletes all associations for a value. */
|
|
20
78
|
deleteValue: (value: V) => boolean;
|
|
21
79
|
/** Clears all associations in the map. */
|
|
22
|
-
clear()
|
|
80
|
+
clear: () => void;
|
|
81
|
+
/** Number of distinct keys currently present. */
|
|
82
|
+
keyCount: () => number;
|
|
83
|
+
/** Number of distinct values currently present. */
|
|
84
|
+
valueCount: () => number;
|
|
85
|
+
/** Number of key-value pairs (associations) currently stored. */
|
|
86
|
+
pairCount: () => number;
|
|
23
87
|
}
|
|
24
88
|
/** Creates a {@link ManyToManyMap}. */
|
|
25
89
|
export declare const createManyToManyMap: <K, V>() => ManyToManyMap<K, V>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManyToManyMap.d.ts","sourceRoot":"","sources":["../../src/ManyToManyMap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ManyToManyMap.d.ts","sourceRoot":"","sources":["../../src/ManyToManyMap.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC;IACjC;;;OAGG;IACH,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IAEnC;;;OAGG;IACH,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IAEtC;;;OAGG;IACH,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,WAAW,CAAC,CAA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2
3
|
export const createManyToManyMap = () => {
|
|
3
4
|
const forwardMap = new Map();
|
|
4
5
|
const reverseMap = new Map();
|
|
6
|
+
let pairCountInternal = 0;
|
|
5
7
|
const map = {
|
|
6
8
|
add(key, value) {
|
|
7
9
|
let values = forwardMap.get(key);
|
|
10
|
+
if (values?.has(value))
|
|
11
|
+
return false;
|
|
8
12
|
if (!values) {
|
|
9
13
|
values = new Set();
|
|
10
14
|
forwardMap.set(key, values);
|
|
@@ -16,7 +20,8 @@ export const createManyToManyMap = () => {
|
|
|
16
20
|
reverseMap.set(value, keys);
|
|
17
21
|
}
|
|
18
22
|
keys.add(key);
|
|
19
|
-
|
|
23
|
+
pairCountInternal++;
|
|
24
|
+
return true;
|
|
20
25
|
},
|
|
21
26
|
remove(key, value) {
|
|
22
27
|
const values = forwardMap.get(key);
|
|
@@ -27,12 +32,12 @@ export const createManyToManyMap = () => {
|
|
|
27
32
|
forwardMap.delete(key);
|
|
28
33
|
}
|
|
29
34
|
const keys = reverseMap.get(value);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
+
assert(keys, "Key-value mapping inconsistency");
|
|
36
|
+
keys.delete(key);
|
|
37
|
+
if (keys.size === 0) {
|
|
38
|
+
reverseMap.delete(value);
|
|
35
39
|
}
|
|
40
|
+
pairCountInternal--;
|
|
36
41
|
return true;
|
|
37
42
|
},
|
|
38
43
|
getValues(key) {
|
|
@@ -41,6 +46,22 @@ export const createManyToManyMap = () => {
|
|
|
41
46
|
getKeys(value) {
|
|
42
47
|
return reverseMap.get(value);
|
|
43
48
|
},
|
|
49
|
+
forEach(callback) {
|
|
50
|
+
for (const [key, values] of forwardMap) {
|
|
51
|
+
for (const value of values)
|
|
52
|
+
callback(key, value);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[Symbol.iterator]() {
|
|
56
|
+
const iterator = function* () {
|
|
57
|
+
for (const [key, values] of forwardMap) {
|
|
58
|
+
for (const value of values) {
|
|
59
|
+
yield [key, value];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return iterator();
|
|
64
|
+
},
|
|
44
65
|
hasPair(key, value) {
|
|
45
66
|
const values = forwardMap.get(key);
|
|
46
67
|
return values?.has(value) ?? false;
|
|
@@ -55,6 +76,7 @@ export const createManyToManyMap = () => {
|
|
|
55
76
|
const values = forwardMap.get(key);
|
|
56
77
|
if (!values)
|
|
57
78
|
return false;
|
|
79
|
+
const removed = values.size;
|
|
58
80
|
for (const value of values) {
|
|
59
81
|
const keys = reverseMap.get(value);
|
|
60
82
|
if (keys) {
|
|
@@ -65,12 +87,14 @@ export const createManyToManyMap = () => {
|
|
|
65
87
|
}
|
|
66
88
|
}
|
|
67
89
|
forwardMap.delete(key);
|
|
90
|
+
pairCountInternal -= removed;
|
|
68
91
|
return true;
|
|
69
92
|
},
|
|
70
93
|
deleteValue(value) {
|
|
71
94
|
const keys = reverseMap.get(value);
|
|
72
95
|
if (!keys)
|
|
73
96
|
return false;
|
|
97
|
+
const removed = keys.size;
|
|
74
98
|
for (const key of keys) {
|
|
75
99
|
const values = forwardMap.get(key);
|
|
76
100
|
if (values) {
|
|
@@ -81,11 +105,22 @@ export const createManyToManyMap = () => {
|
|
|
81
105
|
}
|
|
82
106
|
}
|
|
83
107
|
reverseMap.delete(value);
|
|
108
|
+
pairCountInternal -= removed;
|
|
84
109
|
return true;
|
|
85
110
|
},
|
|
86
111
|
clear() {
|
|
87
112
|
forwardMap.clear();
|
|
88
113
|
reverseMap.clear();
|
|
114
|
+
pairCountInternal = 0;
|
|
115
|
+
},
|
|
116
|
+
keyCount() {
|
|
117
|
+
return forwardMap.size;
|
|
118
|
+
},
|
|
119
|
+
valueCount() {
|
|
120
|
+
return reverseMap.size;
|
|
121
|
+
},
|
|
122
|
+
pairCount() {
|
|
123
|
+
return pairCountInternal;
|
|
89
124
|
},
|
|
90
125
|
};
|
|
91
126
|
return map;
|
package/dist/src/Number.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NonEmptyReadonlyArray } from "./Array.js";
|
|
2
2
|
import { Result } from "./Result.js";
|
|
3
3
|
import { NonNegativeInt, PositiveInt } from "./Type.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Predicate, WidenLiteral } from "./Types.js";
|
|
5
|
+
import { IsBranded } from "./Brand.js";
|
|
5
6
|
export declare const increment: (n: number) => number;
|
|
6
7
|
export declare const decrement: (n: number) => number;
|
|
7
8
|
/** Clamps a number within a given range. */
|
package/dist/src/Number.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Number.d.ts","sourceRoot":"","sources":["../../src/Number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAW,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"Number.d.ts","sourceRoot":"","sources":["../../src/Number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAW,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAoB,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,KAAG,MAAe,CAAC;AAEtD,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,KAAG,MAAe,CAAC;AAEtD,4CAA4C;AAC5C,eAAO,MAAM,KAAK,GACf,KAAK,MAAM,EAAE,KAAK,MAAM,MACxB,GAAG,MAAM,KAAG,MACoB,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GACnB,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,SAAS,CAAC,MAAM,CAEd,CAAC;AAEjC,wEAAwE;AACxE,eAAO,MAAM,GAAG,GAAI,CAAC,SAAS,MAAM,EAClC,GAAG,QAAQ,CAAC,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,KAClC,SAAS,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,CACa,CAAC;AAE/D,wEAAwE;AACxE,eAAO,MAAM,GAAG,GAAI,CAAC,SAAS,MAAM,EAClC,GAAG,QAAQ,CAAC,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,KAClC,SAAS,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,CACa,CAAC;AAE/D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,GACjC,eAAe,cAAc;AAE7B,kBAAkB;AAClB,kBAAwB,WAAW;AAEnC,iBAAiB;AACjB,4BAAiC,WAAW,KAC3C,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,WAAW,CAoBxD,CAAC"}
|
package/dist/src/Random.d.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Random as RandomLib } from "random";
|
|
7
7
|
/**
|
|
8
|
-
* A simple wrapper around Math.random().
|
|
9
|
-
*
|
|
8
|
+
* A simple wrapper around Math.random().
|
|
9
|
+
*
|
|
10
|
+
* For more complex needs check {@link RandomLibDep}.
|
|
10
11
|
*
|
|
11
12
|
* ### Example
|
|
12
13
|
*
|
package/dist/src/Random.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Random.d.ts","sourceRoot":"","sources":["../../src/Random.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"Random.d.ts","sourceRoot":"","sources":["../../src/Random.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oDAAoD;AACpD,eAAO,MAAM,YAAY,QAAO,MAE9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,MAKnD,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,4DAA4D;AAC5D,eAAO,MAAM,eAAe,QAAO,SAA4B,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,KAAG,YAErD,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Result } from "./Result.js";
|
|
2
|
+
/**
|
|
3
|
+
* A generic resource manager that handles reference counting and delayed
|
|
4
|
+
* disposal of shared resources. Useful for managing expensive resources like
|
|
5
|
+
* WebSocket connections, database connections, or file handles that need to be
|
|
6
|
+
* shared among multiple consumers.
|
|
7
|
+
*/
|
|
8
|
+
export interface RefCountedResourceManager<TResource extends Disposable, TResourceKey extends string, TResourceConfig, TConsumer, TConsumerId extends string> extends Disposable {
|
|
9
|
+
/**
|
|
10
|
+
* Adds a consumer to resources, creating them if necessary. Increments
|
|
11
|
+
* reference counts for existing consumer-resource pairs.
|
|
12
|
+
*/
|
|
13
|
+
readonly addConsumer: (consumer: TConsumer, resourceConfigs: ReadonlyArray<TResourceConfig>) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Removes a consumer from resources. Decrements reference counts and
|
|
16
|
+
* schedules disposal when no consumers remain.
|
|
17
|
+
*
|
|
18
|
+
* Returns an error if the resource doesn't exist or if the consumer wasn't
|
|
19
|
+
* added to the resource.
|
|
20
|
+
*/
|
|
21
|
+
readonly removeConsumer: (consumer: TConsumer, resourceConfigs: ReadonlyArray<TResourceConfig>) => Result<void, ResourceNotFoundError<TResourceKey> | ConsumerNotFoundError<TConsumerId, TResourceKey>>;
|
|
22
|
+
/** Gets the resource for the specified key, or null if it doesn't exist. */
|
|
23
|
+
readonly getResource: (key: TResourceKey) => TResource | null;
|
|
24
|
+
/** Gets all consumer IDs currently using the specified resource key. */
|
|
25
|
+
readonly getConsumersForResource: (key: TResourceKey) => ReadonlyArray<TConsumerId>;
|
|
26
|
+
/** Checks if a consumer is currently using any resources. */
|
|
27
|
+
readonly hasConsumerAnyResource: (consumer: TConsumer) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the consumer for the specified consumer ID, or null if not found or
|
|
30
|
+
* not using any resources.
|
|
31
|
+
*/
|
|
32
|
+
readonly getConsumer: (consumerId: TConsumerId) => TConsumer | null;
|
|
33
|
+
}
|
|
34
|
+
/** Error when trying to remove a consumer from a resource that doesn't exist. */
|
|
35
|
+
export interface ResourceNotFoundError<TResourceKey extends string = string> {
|
|
36
|
+
readonly type: "ResourceNotFoundError";
|
|
37
|
+
readonly resourceKey: TResourceKey;
|
|
38
|
+
}
|
|
39
|
+
/** Error when trying to remove a consumer that wasn't added to a resource. */
|
|
40
|
+
export interface ConsumerNotFoundError<TConsumerId extends string = string, TResourceKey extends string = string> {
|
|
41
|
+
readonly type: "ConsumerNotFoundError";
|
|
42
|
+
readonly consumerId: TConsumerId;
|
|
43
|
+
readonly resourceKey: TResourceKey;
|
|
44
|
+
}
|
|
45
|
+
export interface ResourceManagerConfig<TResource extends Disposable, TResourceKey extends string, TResourceConfig, TConsumer, TConsumerId extends string> {
|
|
46
|
+
/** Creates a new resource for the given config. */
|
|
47
|
+
readonly createResource: (config: TResourceConfig) => TResource;
|
|
48
|
+
/** Extracts a unique key from a resource config for deduplication. */
|
|
49
|
+
readonly getResourceKey: (config: TResourceConfig) => TResourceKey;
|
|
50
|
+
/** Extracts a unique identifier from a consumer for reference counting. */
|
|
51
|
+
readonly getConsumerId: (consumer: TConsumer) => TConsumerId;
|
|
52
|
+
/**
|
|
53
|
+
* Delay in milliseconds before disposing unused resources. Helps avoid
|
|
54
|
+
* resource churn during rapid add/remove cycles. Defaults to 100ms.
|
|
55
|
+
*/
|
|
56
|
+
readonly disposalDelay?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Called when a consumer is added to a resource for the first time. This
|
|
59
|
+
* happens when the consumer's reference count goes from 0 to 1 for this
|
|
60
|
+
* resource.
|
|
61
|
+
*/
|
|
62
|
+
readonly onConsumerAdded?: (consumer: TConsumer, resource: TResource, resourceKey: TResourceKey) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Called when a consumer is completely removed from a resource. This happens
|
|
65
|
+
* when the consumer's reference count goes from 1 to 0 for this resource.
|
|
66
|
+
*/
|
|
67
|
+
readonly onConsumerRemoved?: (consumer: TConsumer, resource: TResource, resourceKey: TResourceKey) => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Creates a reference-counted resource manager.
|
|
71
|
+
*
|
|
72
|
+
* This manager tracks which consumers are using which resources and maintains
|
|
73
|
+
* reference counts to know when it's safe to dispose resources. Resources are
|
|
74
|
+
* created on-demand and disposed with a configurable delay to avoid churn.
|
|
75
|
+
*
|
|
76
|
+
* ### Example Usage
|
|
77
|
+
*
|
|
78
|
+
* ```ts
|
|
79
|
+
* // WebSocket connections manager
|
|
80
|
+
* interface WebSocketConfig {
|
|
81
|
+
* readonly url: WebSocketUrl;
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
* type WebSocketUrl = string & Brand<"WebSocketUrl">;
|
|
85
|
+
* type UserId = string & Brand<"UserId">;
|
|
86
|
+
*
|
|
87
|
+
* const wsManager = createRefCountedResourceManager<
|
|
88
|
+
* WebSocket,
|
|
89
|
+
* WebSocketUrl,
|
|
90
|
+
* WebSocketConfig,
|
|
91
|
+
* User,
|
|
92
|
+
* UserId
|
|
93
|
+
* >({
|
|
94
|
+
* createResource: (config) => new WebSocket(config.url),
|
|
95
|
+
* getResourceKey: (config) => config.url,
|
|
96
|
+
* getConsumerId: (user) => user.id,
|
|
97
|
+
* disposalDelay: 1000,
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* // Add users to WebSocket connections
|
|
101
|
+
* wsManager.addConsumer(user1, [
|
|
102
|
+
* { url: "ws://server1.com" as WebSocketUrl },
|
|
103
|
+
* { url: "ws://server2.com" as WebSocketUrl },
|
|
104
|
+
* ]);
|
|
105
|
+
* wsManager.addConsumer(user2, [
|
|
106
|
+
* { url: "ws://server1.com" as WebSocketUrl },
|
|
107
|
+
* ]);
|
|
108
|
+
*
|
|
109
|
+
* // Remove users - server1 stays alive (user2 still using it)
|
|
110
|
+
* wsManager.removeConsumer(user1, [
|
|
111
|
+
* { url: "ws://server1.com" as WebSocketUrl },
|
|
112
|
+
* { url: "ws://server2.com" as WebSocketUrl },
|
|
113
|
+
* ]);
|
|
114
|
+
*
|
|
115
|
+
* // server2 gets disposed after delay, server1 stays alive
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export declare const createRefCountedResourceManager: <TResource extends Disposable, TResourceKey extends string, TResourceConfig, TConsumer, TConsumerId extends string>(config: ResourceManagerConfig<TResource, TResourceKey, TResourceConfig, TConsumer, TConsumerId>) => RefCountedResourceManager<TResource, TResourceKey, TResourceConfig, TConsumer, TConsumerId>;
|
|
119
|
+
//# sourceMappingURL=RefCountedResourceManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefCountedResourceManager.d.ts","sourceRoot":"","sources":["../../src/RefCountedResourceManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAA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