@evolu/common 8.10.0 → 8.12.0
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/Bytes.d.ts +39 -2
- package/dist/src/Bytes.d.ts.map +1 -1
- package/dist/src/Bytes.js +50 -2
- package/dist/src/Config.d.ts +22 -22
- package/dist/src/Config.d.ts.map +1 -1
- package/dist/src/Console.d.ts +62 -7
- package/dist/src/Console.d.ts.map +1 -1
- package/dist/src/Console.js +20 -4
- package/dist/src/Crypto.d.ts +76 -4
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +55 -4
- package/dist/src/Error.d.ts +45 -0
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +69 -0
- package/dist/src/Fs.d.ts +92 -18
- package/dist/src/Fs.d.ts.map +1 -1
- package/dist/src/Fs.js +2 -0
- package/dist/src/Identicon.d.ts +2 -2
- package/dist/src/Identicon.js +2 -2
- package/dist/src/LeakDetector.d.ts +22 -3
- package/dist/src/LeakDetector.d.ts.map +1 -1
- package/dist/src/LeakDetector.js +12 -2
- package/dist/src/LockManager.d.ts +8 -0
- package/dist/src/LockManager.d.ts.map +1 -1
- package/dist/src/LockManager.js +6 -0
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/Object.js +5 -0
- package/dist/src/Platform.d.ts +47 -7
- package/dist/src/Platform.d.ts.map +1 -1
- package/dist/src/Platform.js +24 -5
- package/dist/src/Random.d.ts +25 -2
- package/dist/src/Random.d.ts.map +1 -1
- package/dist/src/Random.js +14 -2
- package/dist/src/Resource.d.ts +156 -1
- package/dist/src/Resource.d.ts.map +1 -1
- package/dist/src/Resource.js +201 -72
- package/dist/src/Schedule.d.ts +11 -10
- package/dist/src/Schedule.d.ts.map +1 -1
- package/dist/src/Schedule.js +1 -1
- package/dist/src/Sqlite.d.ts +132 -16
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +63 -9
- package/dist/src/Task.d.ts +15 -4
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +41 -15
- package/dist/src/Test.d.ts +9 -0
- package/dist/src/Test.d.ts.map +1 -1
- package/dist/src/Test.js +4 -0
- package/dist/src/Time.d.ts +106 -9
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +55 -4
- package/dist/src/Type.d.ts +1455 -1310
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +1274 -517
- package/dist/src/WebSocket.d.ts +164 -13
- package/dist/src/WebSocket.d.ts.map +1 -1
- package/dist/src/WebSocket.js +133 -24
- package/dist/src/Worker.d.ts +90 -8
- package/dist/src/Worker.d.ts.map +1 -1
- package/dist/src/Worker.js +28 -2
- package/dist/src/index.d.ts +6 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -3
- package/dist/src/local-first/Db.d.ts +52 -3
- package/dist/src/local-first/Db.d.ts.map +1 -1
- package/dist/src/local-first/Db.js +412 -137
- package/dist/src/local-first/Evolu.d.ts +412 -213
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +181 -18
- package/dist/src/local-first/Owner.d.ts +13 -30
- package/dist/src/local-first/Owner.d.ts.map +1 -1
- package/dist/src/local-first/Owner.js +13 -30
- package/dist/src/local-first/Protocol.d.ts +106 -19
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +162 -60
- package/dist/src/local-first/Query.d.ts +8 -15
- package/dist/src/local-first/Query.d.ts.map +1 -1
- package/dist/src/local-first/Relay.d.ts.map +1 -1
- package/dist/src/local-first/Relay.js +4 -2
- package/dist/src/local-first/Schema.d.ts +346 -23
- package/dist/src/local-first/Schema.d.ts.map +1 -1
- package/dist/src/local-first/Schema.js +214 -17
- package/dist/src/local-first/Shared.d.ts +537 -22
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +1437 -234
- package/dist/src/local-first/Storage.d.ts +195 -17
- package/dist/src/local-first/Storage.d.ts.map +1 -1
- package/dist/src/local-first/Storage.js +85 -22
- package/dist/src/local-first/Timestamp.d.ts +392 -41
- package/dist/src/local-first/Timestamp.d.ts.map +1 -1
- package/dist/src/local-first/Timestamp.js +403 -81
- package/dist/src/local-first/index.d.ts +0 -1
- package/dist/src/local-first/index.d.ts.map +1 -1
- package/dist/src/local-first/index.js +0 -1
- package/package.json +1 -1
- package/src/Assert.test.ts +2 -5
- package/src/Bytes.test.ts +27 -0
- package/src/Bytes.ts +58 -2
- package/src/Config.test.ts +2 -6
- package/src/Config.ts +133 -133
- package/src/Console.ts +62 -7
- package/src/Crypto.ts +76 -4
- package/src/Eq.test.ts +2 -3
- package/src/Error.test.ts +76 -3
- package/src/Error.ts +71 -0
- package/src/Fs.ts +92 -18
- package/src/Identicon.ts +2 -2
- package/src/LeakDetector.ts +22 -3
- package/src/LockManager.ts +8 -0
- package/src/Object.test.ts +27 -12
- package/src/Object.ts +5 -0
- package/src/Platform.ts +50 -8
- package/src/Random.ts +25 -2
- package/src/Resource.test.ts +837 -0
- package/src/Resource.ts +235 -15
- package/src/Schedule.test.ts +50 -12
- package/src/Schedule.ts +24 -14
- package/src/Sqlite.ts +137 -17
- package/src/Task.test.ts +189 -8
- package/src/Task.ts +56 -17
- package/src/Test.ts +9 -0
- package/src/Time.ts +106 -9
- package/src/Type.test.ts +946 -1028
- package/src/Type.ts +4195 -3136
- package/src/Types.test.ts +4 -14
- package/src/WebSocket.ts +313 -40
- package/src/Worker.ts +90 -8
- package/src/index.ts +20 -6
- package/src/local-first/Db.ts +644 -339
- package/src/local-first/Evolu.test.ts +994 -22
- package/src/local-first/Evolu.ts +625 -232
- package/src/local-first/Owner.ts +13 -30
- package/src/local-first/Protocol.test.ts +634 -10
- package/src/local-first/Protocol.ts +255 -109
- package/src/local-first/Query.ts +8 -15
- package/src/local-first/Relay.ts +4 -2
- package/src/local-first/Schema.test.ts +143 -0
- package/src/local-first/Schema.ts +376 -26
- package/src/local-first/Shared.test.ts +7731 -559
- package/src/local-first/Shared.ts +2036 -267
- package/src/local-first/Storage.ts +224 -36
- package/src/local-first/Timestamp.test.ts +344 -70
- package/src/local-first/Timestamp.ts +434 -118
- package/src/local-first/index.ts +0 -1
- package/dist/src/local-first/Error.d.ts +0 -12
- package/dist/src/local-first/Error.d.ts.map +0 -1
- package/dist/src/local-first/Error.js +0 -6
- package/dist/src/local-first/LocalAuth.d.ts +0 -150
- package/dist/src/local-first/LocalAuth.d.ts.map +0 -1
- package/dist/src/local-first/LocalAuth.js +0 -179
- package/src/local-first/Error.ts +0 -17
- package/src/local-first/LocalAuth.ts +0 -457
package/dist/src/Identicon.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export type IdenticonStyle = "github" | "quadrant" | "gradient" | "sutnar";
|
|
|
32
32
|
* assertTrue,
|
|
33
33
|
* createIdFromString,
|
|
34
34
|
* createIdenticon,
|
|
35
|
+
* testTodoId,
|
|
35
36
|
* } from "@evolu/common";
|
|
36
37
|
*
|
|
37
38
|
* const id = createIdFromString("identicon-example");
|
|
@@ -42,8 +43,7 @@ export type IdenticonStyle = "github" | "quadrant" | "gradient" | "sutnar";
|
|
|
42
43
|
* );
|
|
43
44
|
*
|
|
44
45
|
* // Branded IDs work too.
|
|
45
|
-
* const
|
|
46
|
-
* const todoSvg = createIdenticon(todoId);
|
|
46
|
+
* const todoSvg = createIdenticon(testTodoId);
|
|
47
47
|
*
|
|
48
48
|
* assertTrue(svg.startsWith("<svg"));
|
|
49
49
|
* assertEqual(new Set([svg, ...alternativeSvgs]).size, 4);
|
package/dist/src/Identicon.js
CHANGED
|
@@ -25,6 +25,7 @@ import { Id, idToIdBytes } from "./Type.js";
|
|
|
25
25
|
* assertTrue,
|
|
26
26
|
* createIdFromString,
|
|
27
27
|
* createIdenticon,
|
|
28
|
+
* testTodoId,
|
|
28
29
|
* } from "@evolu/common";
|
|
29
30
|
*
|
|
30
31
|
* const id = createIdFromString("identicon-example");
|
|
@@ -35,8 +36,7 @@ import { Id, idToIdBytes } from "./Type.js";
|
|
|
35
36
|
* );
|
|
36
37
|
*
|
|
37
38
|
* // Branded IDs work too.
|
|
38
|
-
* const
|
|
39
|
-
* const todoSvg = createIdenticon(todoId);
|
|
39
|
+
* const todoSvg = createIdenticon(testTodoId);
|
|
40
40
|
*
|
|
41
41
|
* assertTrue(svg.startsWith("<svg"));
|
|
42
42
|
* assertEqual(new Set([svg, ...alternativeSvgs]).size, 4);
|
|
@@ -19,6 +19,8 @@ import { type ConsoleDep } from "./Console.ts";
|
|
|
19
19
|
* a warning may come late or, in short-lived processes, never. It is a
|
|
20
20
|
* development canary, not a guarantee. Production uses
|
|
21
21
|
* {@link noopLeakDetector}.
|
|
22
|
+
*
|
|
23
|
+
* @group Core
|
|
22
24
|
*/
|
|
23
25
|
export interface LeakDetector {
|
|
24
26
|
/**
|
|
@@ -33,7 +35,11 @@ export interface LeakDetector {
|
|
|
33
35
|
/** Stops tracking the target registered with `unregisterToken`. */
|
|
34
36
|
readonly untrack: (unregisterToken: object) => void;
|
|
35
37
|
}
|
|
36
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Describes a tracked handle for {@link LeakDetector.track}.
|
|
40
|
+
*
|
|
41
|
+
* @group Core
|
|
42
|
+
*/
|
|
37
43
|
export interface Leak {
|
|
38
44
|
/** Handle name used in the warning, for example `"Lease"`. */
|
|
39
45
|
readonly name: string;
|
|
@@ -43,6 +49,7 @@ export interface Leak {
|
|
|
43
49
|
/**
|
|
44
50
|
* Dependency wrapper for {@link LeakDetector}.
|
|
45
51
|
*
|
|
52
|
+
* @group Core
|
|
46
53
|
* @see {@link LeakDetector}
|
|
47
54
|
*/
|
|
48
55
|
export interface LeakDetectorDep {
|
|
@@ -53,13 +60,20 @@ export interface LeakDetectorDep {
|
|
|
53
60
|
*
|
|
54
61
|
* Capturing a stack per track call is too expensive for production; use
|
|
55
62
|
* {@link noopLeakDetector} there.
|
|
63
|
+
*
|
|
64
|
+
* @group Core
|
|
56
65
|
*/
|
|
57
66
|
export declare const createLeakDetector: (deps: ConsoleDep) => LeakDetector;
|
|
58
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* No-op {@link LeakDetector} for production.
|
|
69
|
+
*
|
|
70
|
+
* @group Core
|
|
71
|
+
*/
|
|
59
72
|
export declare const noopLeakDetector: LeakDetector;
|
|
60
73
|
/**
|
|
61
74
|
* Test {@link LeakDetector} with deterministic collection.
|
|
62
75
|
*
|
|
76
|
+
* @group Testing
|
|
63
77
|
* @see {@link testCreateLeakDetector}
|
|
64
78
|
*/
|
|
65
79
|
export interface TestLeakDetector extends LeakDetector {
|
|
@@ -78,11 +92,16 @@ export interface TestLeakDetector extends LeakDetector {
|
|
|
78
92
|
/**
|
|
79
93
|
* Dependency wrapper for {@link TestLeakDetector}.
|
|
80
94
|
*
|
|
95
|
+
* @group Testing
|
|
81
96
|
* @see {@link TestLeakDetector}
|
|
82
97
|
*/
|
|
83
98
|
export interface TestLeakDetectorDep extends LeakDetectorDep {
|
|
84
99
|
readonly leakDetector: TestLeakDetector;
|
|
85
100
|
}
|
|
86
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Creates {@link TestLeakDetector}.
|
|
103
|
+
*
|
|
104
|
+
* @group Testing
|
|
105
|
+
*/
|
|
87
106
|
export declare const testCreateLeakDetector: (deps: ConsoleDep) => TestLeakDetector;
|
|
88
107
|
//# sourceMappingURL=LeakDetector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LeakDetector.d.ts","sourceRoot":"","sources":["../../src/LeakDetector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C
|
|
1
|
+
{"version":3,"file":"LeakDetector.d.ts","sourceRoot":"","sources":["../../src/LeakDetector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,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* Capturing a stack per track call is too expensive for production; use
|
|
12
12
|
* {@link noopLeakDetector} there.
|
|
13
|
+
*
|
|
14
|
+
* @group Core
|
|
13
15
|
*/
|
|
14
16
|
export const createLeakDetector = (deps) => {
|
|
15
17
|
if (typeof globalThis.FinalizationRegistry !== "function")
|
|
@@ -28,7 +30,11 @@ export const createLeakDetector = (deps) => {
|
|
|
28
30
|
},
|
|
29
31
|
};
|
|
30
32
|
};
|
|
31
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* No-op {@link LeakDetector} for production.
|
|
35
|
+
*
|
|
36
|
+
* @group Core
|
|
37
|
+
*/
|
|
32
38
|
export const noopLeakDetector = {
|
|
33
39
|
track: constVoid,
|
|
34
40
|
untrack: constVoid,
|
|
@@ -47,7 +53,11 @@ const reportLeak = (deps) => (leak) => {
|
|
|
47
53
|
deps.console.warn(`${leak.name} was garbage-collected without cleanup. Tracked at:`, leak.stack);
|
|
48
54
|
return true;
|
|
49
55
|
};
|
|
50
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Creates {@link TestLeakDetector}.
|
|
58
|
+
*
|
|
59
|
+
* @group Testing
|
|
60
|
+
*/
|
|
51
61
|
export const testCreateLeakDetector = (deps) => {
|
|
52
62
|
const trackedLeaksByToken = new Map();
|
|
53
63
|
const report = reportLeak(deps);
|
|
@@ -41,6 +41,8 @@ import type { Callback } from "./Types.ts";
|
|
|
41
41
|
* );
|
|
42
42
|
* assertEqual(result, "example");
|
|
43
43
|
* ```
|
|
44
|
+
*
|
|
45
|
+
* @group Core
|
|
44
46
|
*/
|
|
45
47
|
export interface LockManagerDep {
|
|
46
48
|
readonly lockManager: LockManager;
|
|
@@ -57,6 +59,8 @@ export interface LockManagerDep {
|
|
|
57
59
|
* via internal namespacing, so tests can reuse the same lock names without
|
|
58
60
|
* contending through the global Web Locks. Query results are filtered to that
|
|
59
61
|
* private namespace and returned with the original visible names.
|
|
62
|
+
*
|
|
63
|
+
* @group Testing
|
|
60
64
|
*/
|
|
61
65
|
export declare const testCreateLockManager: (nativeLockManager?: LockManager) => LockManager;
|
|
62
66
|
/**
|
|
@@ -68,6 +72,8 @@ export declare const testCreateLockManager: (nativeLockManager?: LockManager) =>
|
|
|
68
72
|
* Leadership is held until the returned handle is disposed. Once released,
|
|
69
73
|
* another waiting caller may become the next leader. Waiting for leadership is
|
|
70
74
|
* abortable via the calling {@link Task}'s signal.
|
|
75
|
+
*
|
|
76
|
+
* @group Leader election
|
|
71
77
|
*/
|
|
72
78
|
export declare const acquireLeaderLock: (name: string) => Task<AsyncDisposable, never, LockManagerDep>;
|
|
73
79
|
/**
|
|
@@ -80,6 +86,8 @@ export declare const acquireLeaderLock: (name: string) => Task<AsyncDisposable,
|
|
|
80
86
|
* Leadership is held until the returned handle is disposed. Once released,
|
|
81
87
|
* another waiting caller may become the next leader. Waiting for leadership is
|
|
82
88
|
* abortable by disposing the returned handle.
|
|
89
|
+
*
|
|
90
|
+
* @group Leader election
|
|
83
91
|
*/
|
|
84
92
|
export declare const acquireLeaderLockCallback: (deps: LockManagerDep) => (name: string, callback: Callback<void>) => Disposable;
|
|
85
93
|
//# sourceMappingURL=LockManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LockManager.d.ts","sourceRoot":"","sources":["../../src/LockManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"LockManager.d.ts","sourceRoot":"","sources":["../../src/LockManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACnC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,uBACb,WAAW,KAC7B,WAwCF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,SACrB,MAAM,KAAG,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,cAAc,CAuB1D,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,SAC7B,cAAc,YACd,MAAM,YAAY,QAAQ,CAAC,IAAI,CAAC,KAAG,UAsBzC,CAAC"}
|
package/dist/src/LockManager.js
CHANGED
|
@@ -19,6 +19,8 @@ import { createId } from "./Type.js";
|
|
|
19
19
|
* via internal namespacing, so tests can reuse the same lock names without
|
|
20
20
|
* contending through the global Web Locks. Query results are filtered to that
|
|
21
21
|
* private namespace and returned with the original visible names.
|
|
22
|
+
*
|
|
23
|
+
* @group Testing
|
|
22
24
|
*/
|
|
23
25
|
export const testCreateLockManager = (nativeLockManager = navigator.locks) => {
|
|
24
26
|
const namespace = createId({ randomBytes: createRandomBytes() });
|
|
@@ -54,6 +56,8 @@ export const testCreateLockManager = (nativeLockManager = navigator.locks) => {
|
|
|
54
56
|
* Leadership is held until the returned handle is disposed. Once released,
|
|
55
57
|
* another waiting caller may become the next leader. Waiting for leadership is
|
|
56
58
|
* abortable via the calling {@link Task}'s signal.
|
|
59
|
+
*
|
|
60
|
+
* @group Leader election
|
|
57
61
|
*/
|
|
58
62
|
export const acquireLeaderLock = (name) => async (run) => {
|
|
59
63
|
const acquisition = Promise.withResolvers();
|
|
@@ -81,6 +85,8 @@ export const acquireLeaderLock = (name) => async (run) => {
|
|
|
81
85
|
* Leadership is held until the returned handle is disposed. Once released,
|
|
82
86
|
* another waiting caller may become the next leader. Waiting for leadership is
|
|
83
87
|
* abortable by disposing the returned handle.
|
|
88
|
+
*
|
|
89
|
+
* @group Leader election
|
|
84
90
|
*/
|
|
85
91
|
export const acquireLeaderLockCallback = (deps) => (name, callback) => {
|
|
86
92
|
const abortController = new AbortController();
|
package/dist/src/Object.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Object.d.ts","sourceRoot":"","sources":["../../src/Object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE5E,oEAAoE;AACpE,MAAM,MAAM,UAAU,GACpB,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,YAAY,GAAG,aAAa,CAAC;AAE7E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,UAgB7C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,aAAa,UACjB,OAAO,KACb,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"Object.d.ts","sourceRoot":"","sources":["../../src/Object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE5E,oEAAoE;AACpE,MAAM,MAAM,UAAU,GACpB,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,YAAY,GAAG,aAAa,CAAC;AAE7E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,UAgB7C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAA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AAC,EAAE,CAAC,CAAC,OACvB,OAAO,CAAC,CAAC,CAAC,KACd,CAAC,GAAG,SAAmE,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C,8DAA8D;IAC9D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,iEAAiE;AACjE,eAAO,MAAM,eAAe,SAAU,IAAI,KAAG,SAQ5C,CAAC"}
|
package/dist/src/Object.js
CHANGED
|
@@ -74,6 +74,11 @@ export const isPlainObject = (value) => {
|
|
|
74
74
|
const prototype = Object.getPrototypeOf(value);
|
|
75
75
|
if (prototype === null)
|
|
76
76
|
return true;
|
|
77
|
+
// This realm's Object.prototype has an immutable null prototype, so `in`
|
|
78
|
+
// checks the same own properties as the structural test below, faster.
|
|
79
|
+
if (prototype === Object.prototype) {
|
|
80
|
+
return "hasOwnProperty" in prototype && "isPrototypeOf" in prototype;
|
|
81
|
+
}
|
|
77
82
|
return (Object.getPrototypeOf(prototype) === null &&
|
|
78
83
|
Object.hasOwn(prototype, "hasOwnProperty") &&
|
|
79
84
|
Object.hasOwn(prototype, "isPrototypeOf"));
|
package/dist/src/Platform.d.ts
CHANGED
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Returns true if running in React Native with Hermes engine.
|
|
8
|
+
*
|
|
9
|
+
* @group Detection
|
|
10
|
+
*/
|
|
7
11
|
export declare const isHermes: boolean;
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Returns true if running in a server environment (no DOM).
|
|
14
|
+
*
|
|
15
|
+
* @group Detection
|
|
16
|
+
*/
|
|
9
17
|
export declare const isServer: boolean;
|
|
10
18
|
/**
|
|
11
19
|
* True outside production builds.
|
|
@@ -17,6 +25,8 @@ export declare const isServer: boolean;
|
|
|
17
25
|
* where no bundler ran, such as un-bundled browser ESM, where it fails closed
|
|
18
26
|
* to production behavior. Node.js reads it natively; React Native polyfills it.
|
|
19
27
|
* A missing `NODE_ENV` counts as development, matching React semantics.
|
|
28
|
+
*
|
|
29
|
+
* @group Detection
|
|
20
30
|
*/
|
|
21
31
|
export declare const isDev: boolean;
|
|
22
32
|
/**
|
|
@@ -28,6 +38,7 @@ export declare const isDev: boolean;
|
|
|
28
38
|
* Returns false in React Native even if Buffer is polyfilled, as we prefer
|
|
29
39
|
* native methods in that environment.
|
|
30
40
|
*
|
|
41
|
+
* @group Detection
|
|
31
42
|
* @see https://github.com/craftzdog/react-native-quick-base64#installation
|
|
32
43
|
*/
|
|
33
44
|
export declare const hasNodeBuffer: boolean;
|
|
@@ -40,24 +51,45 @@ export declare const hasNodeBuffer: boolean;
|
|
|
40
51
|
* if an onComplete callback is used.
|
|
41
52
|
*
|
|
42
53
|
* https://react.dev/reference/react-dom/flushSync
|
|
54
|
+
*
|
|
55
|
+
* @group Integration
|
|
43
56
|
*/
|
|
44
57
|
export type FlushSync = (callback: () => void) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Dependency wrapper for {@link FlushSync}.
|
|
60
|
+
*
|
|
61
|
+
* @group Integration
|
|
62
|
+
*/
|
|
45
63
|
export interface FlushSyncDep {
|
|
46
64
|
readonly flushSync: FlushSync;
|
|
47
65
|
}
|
|
48
66
|
/**
|
|
49
67
|
* Reload the app in a platform-specific way.
|
|
50
68
|
*
|
|
51
|
-
*
|
|
52
|
-
* the
|
|
69
|
+
* On the web, Evolu reloads tabs of a build when another build of the app waits
|
|
70
|
+
* for the local databases, so they load the build the server now serves. It can
|
|
71
|
+
* also clear in-memory state after persistent storage was purged; it does not
|
|
72
|
+
* purge storage itself.
|
|
53
73
|
*
|
|
54
|
-
* - Web:
|
|
74
|
+
* - Web: Reloads the page, or loads the specified URL instead
|
|
55
75
|
* - React Native: Restarts the app (URL ignored)
|
|
76
|
+
*
|
|
77
|
+
* @group Integration
|
|
56
78
|
*/
|
|
57
79
|
export type ReloadApp = (url?: string) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Dependency wrapper for {@link ReloadApp}.
|
|
82
|
+
*
|
|
83
|
+
* @group Integration
|
|
84
|
+
*/
|
|
58
85
|
export interface ReloadAppDep {
|
|
59
86
|
readonly reloadApp: ReloadApp;
|
|
60
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Records platform global errors until disposed.
|
|
90
|
+
*
|
|
91
|
+
* @group Testing
|
|
92
|
+
*/
|
|
61
93
|
export interface TestGlobalErrors extends Disposable {
|
|
62
94
|
readonly errors: ReadonlyArray<unknown>;
|
|
63
95
|
readonly next: () => Promise<unknown>;
|
|
@@ -73,8 +105,16 @@ export interface TestGlobalErrors extends Disposable {
|
|
|
73
105
|
*/
|
|
74
106
|
readonly settle: () => Promise<ReadonlyArray<unknown>>;
|
|
75
107
|
}
|
|
76
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Records platform global uncaught-error reporting until disposed.
|
|
110
|
+
*
|
|
111
|
+
* @group Testing
|
|
112
|
+
*/
|
|
77
113
|
export declare const testGlobalUncaughtErrors: () => TestGlobalErrors;
|
|
78
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Records platform global unhandled-rejection reporting until disposed.
|
|
116
|
+
*
|
|
117
|
+
* @group Testing
|
|
118
|
+
*/
|
|
79
119
|
export declare const testGlobalUnhandledRejections: () => TestGlobalErrors;
|
|
80
120
|
//# sourceMappingURL=Platform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../../src/Platform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../../src/Platform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SAAiC,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SAAkC,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,SAGyB,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,SAC6B,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtC;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAO,gBACF,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,QAAO,gBACH,CAAC"}
|
package/dist/src/Platform.js
CHANGED
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Returns true if running in React Native with Hermes engine.
|
|
8
|
+
*
|
|
9
|
+
* @group Detection
|
|
10
|
+
*/
|
|
7
11
|
export const isHermes = "HermesInternal" in globalThis;
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Returns true if running in a server environment (no DOM).
|
|
14
|
+
*
|
|
15
|
+
* @group Detection
|
|
16
|
+
*/
|
|
9
17
|
export const isServer = typeof document === "undefined";
|
|
10
18
|
/**
|
|
11
19
|
* True outside production builds.
|
|
@@ -17,6 +25,8 @@ export const isServer = typeof document === "undefined";
|
|
|
17
25
|
* where no bundler ran, such as un-bundled browser ESM, where it fails closed
|
|
18
26
|
* to production behavior. Node.js reads it natively; React Native polyfills it.
|
|
19
27
|
* A missing `NODE_ENV` counts as development, matching React semantics.
|
|
28
|
+
*
|
|
29
|
+
* @group Detection
|
|
20
30
|
*/
|
|
21
31
|
export const isDev = typeof process === "undefined"
|
|
22
32
|
? false
|
|
@@ -30,14 +40,23 @@ export const isDev = typeof process === "undefined"
|
|
|
30
40
|
* Returns false in React Native even if Buffer is polyfilled, as we prefer
|
|
31
41
|
* native methods in that environment.
|
|
32
42
|
*
|
|
43
|
+
* @group Detection
|
|
33
44
|
* @see https://github.com/craftzdog/react-native-quick-base64#installation
|
|
34
45
|
*/
|
|
35
46
|
export const hasNodeBuffer = !isHermes && typeof globalThis.Buffer !== "undefined";
|
|
36
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Records platform global uncaught-error reporting until disposed.
|
|
49
|
+
*
|
|
50
|
+
* @group Testing
|
|
51
|
+
*/
|
|
37
52
|
export const testGlobalUncaughtErrors = () => createTestGlobalErrors("uncaughtErrors");
|
|
38
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Records platform global unhandled-rejection reporting until disposed.
|
|
55
|
+
*
|
|
56
|
+
* @group Testing
|
|
57
|
+
*/
|
|
39
58
|
export const testGlobalUnhandledRejections = () => createTestGlobalErrors("unhandledRejection");
|
|
40
|
-
const settleSentinel = new Error("TestGlobalErrors.settle sentinel");
|
|
59
|
+
const settleSentinel = /*#__PURE__*/ new Error("TestGlobalErrors.settle sentinel");
|
|
41
60
|
const createTestGlobalErrors = (kind) => {
|
|
42
61
|
const nodeEvent = kind === "uncaughtErrors" ? "uncaughtException" : "unhandledRejection";
|
|
43
62
|
const webEvent = kind === "uncaughtErrors" ? "error" : "unhandledrejection";
|
package/dist/src/Random.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import type { Brand } from "./Brand.ts";
|
|
|
9
9
|
* A random floating point number in [0, 1).
|
|
10
10
|
*
|
|
11
11
|
* Branded to distinguish random values from arbitrary numbers.
|
|
12
|
+
*
|
|
13
|
+
* @group Core
|
|
12
14
|
*/
|
|
13
15
|
export type RandomNumber = number & Brand<"RandomNumber">;
|
|
14
16
|
/**
|
|
@@ -40,20 +42,33 @@ export type RandomNumber = number & Brand<"RandomNumber">;
|
|
|
40
42
|
* const secondTestRandom = testCreateRandom("test");
|
|
41
43
|
* assertEqual(firstTestRandom.next(), secondTestRandom.next());
|
|
42
44
|
* ```
|
|
45
|
+
*
|
|
46
|
+
* @group Core
|
|
43
47
|
*/
|
|
44
48
|
export interface Random {
|
|
45
49
|
/** Returns a floating point number in [0, 1). Just like Math.random(). */
|
|
46
50
|
readonly next: () => RandomNumber;
|
|
47
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Dependency wrapper for {@link Random}.
|
|
54
|
+
*
|
|
55
|
+
* @group Core
|
|
56
|
+
*/
|
|
48
57
|
export interface RandomDep {
|
|
49
58
|
readonly random: Random;
|
|
50
59
|
}
|
|
51
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Creates a {@link Random} using Math.random().
|
|
62
|
+
*
|
|
63
|
+
* @group Core
|
|
64
|
+
*/
|
|
52
65
|
export declare const createRandom: () => Random;
|
|
53
66
|
/**
|
|
54
67
|
* Creates a seeded {@link Random} for deterministic tests.
|
|
55
68
|
*
|
|
56
69
|
* Default seed "evolu".
|
|
70
|
+
*
|
|
71
|
+
* @group Testing
|
|
57
72
|
*/
|
|
58
73
|
export declare const testCreateRandom: (seed?: string) => Random;
|
|
59
74
|
/**
|
|
@@ -61,17 +76,25 @@ export declare const testCreateRandom: (seed?: string) => Random;
|
|
|
61
76
|
* provided by the NPM `random` package.
|
|
62
77
|
*
|
|
63
78
|
* https://github.com/transitive-bullshit/random
|
|
79
|
+
*
|
|
80
|
+
* @group Core
|
|
64
81
|
*/
|
|
65
82
|
export interface RandomLibDep {
|
|
66
83
|
readonly randomLib: RandomLib;
|
|
67
84
|
}
|
|
68
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Creates a random number generator from the NPM `random` package.
|
|
87
|
+
*
|
|
88
|
+
* @group Core
|
|
89
|
+
*/
|
|
69
90
|
export declare const createRandomLib: () => RandomLib;
|
|
70
91
|
/**
|
|
71
92
|
* Creates a seeded random number generator from the NPM `random` package for
|
|
72
93
|
* deterministic tests.
|
|
73
94
|
*
|
|
74
95
|
* Default seed "evolu".
|
|
96
|
+
*
|
|
97
|
+
* @group Testing
|
|
75
98
|
*/
|
|
76
99
|
export declare const testCreateRandomLib: (seed?: string) => RandomLib;
|
|
77
100
|
//# sourceMappingURL=Random.d.ts.map
|
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;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC
|
|
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;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,YAAY,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAO,MAE9B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,qBAAqB,MAKjD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAO,SAA4B,CAAC;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,qBAAqB,SAChC,CAAC"}
|
package/dist/src/Random.js
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { Random as RandomLib } from "random";
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Creates a {@link Random} using Math.random().
|
|
9
|
+
*
|
|
10
|
+
* @group Core
|
|
11
|
+
*/
|
|
8
12
|
export const createRandom = () => ({
|
|
9
13
|
next: () => Math.random(),
|
|
10
14
|
});
|
|
@@ -12,6 +16,8 @@ export const createRandom = () => ({
|
|
|
12
16
|
* Creates a seeded {@link Random} for deterministic tests.
|
|
13
17
|
*
|
|
14
18
|
* Default seed "evolu".
|
|
19
|
+
*
|
|
20
|
+
* @group Testing
|
|
15
21
|
*/
|
|
16
22
|
export const testCreateRandom = (seed = "evolu") => {
|
|
17
23
|
const random = new RandomLib(seed);
|
|
@@ -19,12 +25,18 @@ export const testCreateRandom = (seed = "evolu") => {
|
|
|
19
25
|
next: () => random.next(),
|
|
20
26
|
};
|
|
21
27
|
};
|
|
22
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Creates a random number generator from the NPM `random` package.
|
|
30
|
+
*
|
|
31
|
+
* @group Core
|
|
32
|
+
*/
|
|
23
33
|
export const createRandomLib = () => new RandomLib();
|
|
24
34
|
/**
|
|
25
35
|
* Creates a seeded random number generator from the NPM `random` package for
|
|
26
36
|
* deterministic tests.
|
|
27
37
|
*
|
|
28
38
|
* Default seed "evolu".
|
|
39
|
+
*
|
|
40
|
+
* @group Testing
|
|
29
41
|
*/
|
|
30
42
|
export const testCreateRandomLib = (seed = "evolu") => new RandomLib(seed);
|