@evolu/common 5.4.7 → 6.0.0-preview.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/README.md +30 -34
- package/dist/src/Array.d.ts +17 -0
- package/dist/src/Array.d.ts.map +1 -0
- package/dist/src/Array.js +12 -0
- package/dist/src/Assert.d.ts +68 -0
- package/dist/src/Assert.d.ts.map +1 -0
- package/dist/src/Assert.js +77 -0
- package/dist/src/BigInt.d.ts +20 -0
- package/dist/src/BigInt.d.ts.map +1 -0
- package/dist/src/BigInt.js +18 -0
- package/dist/src/Buffer.d.ts +92 -0
- package/dist/src/Buffer.d.ts.map +1 -0
- package/dist/src/Buffer.js +62 -0
- package/dist/src/Callbacks.d.ts +20 -0
- package/dist/src/Callbacks.d.ts.map +1 -0
- package/dist/src/Callbacks.js +18 -0
- package/dist/src/Console.d.ts +78 -0
- package/dist/src/Console.d.ts.map +1 -0
- package/dist/src/Console.js +103 -0
- package/dist/src/Crypto.d.ts +72 -39
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +89 -54
- package/dist/src/Eq.d.ts +97 -0
- package/dist/src/Eq.d.ts.map +1 -0
- package/dist/src/Eq.js +167 -0
- package/dist/src/Error.d.ts +14 -10
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +43 -11
- package/dist/src/Evolu/Config.d.ts +69 -0
- package/dist/src/Evolu/Config.d.ts.map +1 -0
- package/dist/src/Evolu/Config.js +9 -0
- package/dist/src/Evolu/Db.d.ts +126 -0
- package/dist/src/Evolu/Db.d.ts.map +1 -0
- package/dist/src/Evolu/Db.js +774 -0
- package/dist/src/Evolu/Diff.d.ts +43 -0
- package/dist/src/Evolu/Diff.d.ts.map +1 -0
- package/dist/src/Evolu/Diff.js +95 -0
- package/dist/src/Evolu/Evolu.d.ts +334 -0
- package/dist/src/Evolu/Evolu.d.ts.map +1 -0
- package/dist/src/Evolu/Evolu.js +434 -0
- package/dist/src/Evolu/Internal.d.ts +26 -0
- package/dist/src/Evolu/Internal.d.ts.map +1 -0
- package/dist/src/Evolu/Internal.js +25 -0
- package/dist/src/Evolu/Kysely.d.ts +6 -0
- package/dist/src/Evolu/Kysely.d.ts.map +1 -0
- package/dist/src/Evolu/Kysely.js +21 -0
- package/dist/src/Evolu/Owner.d.ts +155 -0
- package/dist/src/Evolu/Owner.d.ts.map +1 -0
- package/dist/src/Evolu/Owner.js +126 -0
- package/dist/src/Evolu/Platform.d.ts +23 -0
- package/dist/src/Evolu/Platform.d.ts.map +1 -0
- package/dist/src/Evolu/Platform.js +1 -0
- package/dist/src/Evolu/Protocol.d.ts +401 -0
- package/dist/src/Evolu/Protocol.d.ts.map +1 -0
- package/dist/src/Evolu/Protocol.js +1151 -0
- package/dist/src/Evolu/Public.d.ts +18 -0
- package/dist/src/Evolu/Public.d.ts.map +1 -0
- package/dist/src/Evolu/Public.js +11 -0
- package/dist/src/Evolu/PublicKysely.d.ts +148 -0
- package/dist/src/Evolu/PublicKysely.d.ts.map +1 -0
- package/dist/src/Evolu/PublicKysely.js +185 -0
- package/dist/src/Evolu/Query.d.ts +63 -0
- package/dist/src/Evolu/Query.d.ts.map +1 -0
- package/dist/src/Evolu/Query.js +61 -0
- package/dist/src/Evolu/Relay.d.ts +13 -0
- package/dist/src/Evolu/Relay.d.ts.map +1 -0
- package/dist/src/Evolu/Relay.js +109 -0
- package/dist/src/Evolu/Schema.d.ts +201 -0
- package/dist/src/Evolu/Schema.d.ts.map +1 -0
- package/dist/src/Evolu/Schema.js +150 -0
- package/dist/src/Evolu/Storage.d.ts +49 -0
- package/dist/src/Evolu/Storage.d.ts.map +1 -0
- package/dist/src/Evolu/Storage.js +1111 -0
- package/dist/src/Evolu/Sync.d.ts +59 -0
- package/dist/src/Evolu/Sync.d.ts.map +1 -0
- package/dist/src/Evolu/Sync.js +29 -0
- package/dist/src/Evolu/Timestamp.d.ts +106 -0
- package/dist/src/Evolu/Timestamp.d.ts.map +1 -0
- package/dist/src/Evolu/Timestamp.js +179 -0
- package/dist/src/Function.d.ts +54 -0
- package/dist/src/Function.d.ts.map +1 -0
- package/dist/src/Function.js +38 -0
- package/dist/src/ManyToManyMap.d.ts +26 -0
- package/dist/src/ManyToManyMap.d.ts.map +1 -0
- package/dist/src/ManyToManyMap.js +92 -0
- package/dist/src/NanoId.d.ts +27 -0
- package/dist/src/NanoId.d.ts.map +1 -0
- package/dist/src/NanoId.js +6 -0
- package/dist/src/Number.d.ts +42 -0
- package/dist/src/Number.d.ts.map +1 -0
- package/dist/src/Number.js +55 -0
- package/dist/src/Object.d.ts +35 -0
- package/dist/src/Object.d.ts.map +1 -0
- package/dist/src/Object.js +36 -0
- package/dist/src/Order.d.ts +90 -0
- package/dist/src/Order.d.ts.map +1 -0
- package/dist/src/Order.js +85 -0
- package/dist/src/Promise.d.ts +180 -0
- package/dist/src/Promise.d.ts.map +1 -0
- package/dist/src/Promise.js +176 -0
- package/dist/src/Random.d.ts +52 -0
- package/dist/src/Random.d.ts.map +1 -0
- package/dist/src/Random.js +29 -0
- package/dist/src/Ref.d.ts +40 -0
- package/dist/src/Ref.d.ts.map +1 -0
- package/dist/src/Ref.js +13 -0
- package/dist/src/Result.d.ts +421 -0
- package/dist/src/Result.d.ts.map +1 -0
- package/dist/src/Result.js +357 -0
- package/dist/src/Skiplist.d.ts +23 -0
- package/dist/src/Skiplist.d.ts.map +1 -0
- package/dist/src/Skiplist.js +58 -0
- package/dist/src/Sqlite.d.ts +116 -52
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +183 -67
- package/dist/src/Store.d.ts +45 -8
- package/dist/src/Store.d.ts.map +1 -1
- package/dist/src/Store.js +33 -17
- package/dist/src/String.d.ts +2 -0
- package/dist/src/String.d.ts.map +1 -0
- package/dist/src/String.js +14 -0
- package/dist/src/Time.d.ts +20 -0
- package/dist/src/Time.d.ts.map +1 -0
- package/dist/src/Time.js +25 -0
- package/dist/src/Type.d.ts +1937 -0
- package/dist/src/Type.d.ts.map +1 -0
- package/dist/src/Type.js +2002 -0
- package/dist/src/Types.d.ts +188 -0
- package/dist/src/Types.d.ts.map +1 -0
- package/dist/src/Types.js +6 -0
- package/dist/src/WebSocket.d.ts +112 -0
- package/dist/src/WebSocket.d.ts.map +1 -0
- package/dist/src/WebSocket.js +139 -0
- package/dist/src/Worker.d.ts +44 -0
- package/dist/src/Worker.d.ts.map +1 -0
- package/dist/src/Worker.js +66 -0
- package/dist/src/index.d.ts +24 -11
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +24 -11
- package/package.json +29 -38
- package/src/Array.ts +39 -0
- package/src/Assert.ts +116 -0
- package/src/BigInt.ts +29 -0
- package/src/Buffer.ts +175 -0
- package/src/Callbacks.ts +43 -0
- package/src/Console.ts +159 -0
- package/src/Crypto.ts +169 -115
- package/src/Eq.ts +204 -0
- package/src/Error.ts +57 -20
- package/src/Evolu/Config.ts +83 -0
- package/src/Evolu/Db.ts +1275 -0
- package/src/Evolu/Diff.ts +142 -0
- package/src/Evolu/Evolu.ts +947 -0
- package/src/Evolu/Internal.ts +26 -0
- package/src/Evolu/Kysely.ts +38 -0
- package/src/Evolu/Owner.ts +296 -0
- package/src/Evolu/Platform.ts +27 -0
- package/src/Evolu/Protocol.ts +1857 -0
- package/src/Evolu/Public.ts +43 -0
- package/src/Evolu/PublicKysely.ts +240 -0
- package/src/Evolu/Query.ts +167 -0
- package/src/Evolu/Relay.ts +142 -0
- package/src/Evolu/Schema.ts +417 -0
- package/src/Evolu/Storage.ts +1281 -0
- package/src/Evolu/Sync.ts +105 -0
- package/src/Evolu/Timestamp.ts +311 -0
- package/src/Function.ts +58 -0
- package/src/ManyToManyMap.ts +140 -0
- package/src/NanoId.ts +39 -0
- package/src/Number.ts +90 -0
- package/src/Object.ts +64 -0
- package/src/Order.ts +113 -0
- package/src/Promise.ts +295 -0
- package/src/Random.ts +68 -0
- package/src/Ref.ts +63 -0
- package/src/Result.ts +453 -0
- package/src/Skiplist.ts +102 -0
- package/src/Sqlite.ts +366 -153
- package/src/Store.ts +79 -36
- package/src/String.ts +10 -0
- package/src/Time.ts +36 -0
- package/src/Type.ts +3978 -0
- package/src/Types.ts +209 -0
- package/src/WebSocket.ts +273 -0
- package/src/Worker.ts +129 -0
- package/src/index.ts +24 -11
- package/dist/src/Config.d.ts +0 -56
- package/dist/src/Config.d.ts.map +0 -1
- package/dist/src/Config.js +0 -39
- package/dist/src/Crdt.d.ts +0 -89
- package/dist/src/Crdt.d.ts.map +0 -1
- package/dist/src/Crdt.js +0 -181
- package/dist/src/Db.d.ts +0 -107
- package/dist/src/Db.d.ts.map +0 -1
- package/dist/src/Db.js +0 -443
- package/dist/src/Diff.d.ts +0 -27
- package/dist/src/Diff.d.ts.map +0 -1
- package/dist/src/Diff.js +0 -84
- package/dist/src/Evolu.d.ts +0 -426
- package/dist/src/Evolu.d.ts.map +0 -1
- package/dist/src/Evolu.js +0 -333
- package/dist/src/Model.d.ts +0 -141
- package/dist/src/Model.d.ts.map +0 -1
- package/dist/src/Model.js +0 -125
- package/dist/src/Murmurhash.d.ts +0 -2
- package/dist/src/Murmurhash.d.ts.map +0 -1
- package/dist/src/Murmurhash.js +0 -60
- package/dist/src/Owner.d.ts +0 -33
- package/dist/src/Owner.d.ts.map +0 -1
- package/dist/src/Owner.js +0 -26
- package/dist/src/Platform.d.ts +0 -37
- package/dist/src/Platform.d.ts.map +0 -1
- package/dist/src/Platform.js +0 -11
- package/dist/src/Protobuf.d.ts +0 -81
- package/dist/src/Protobuf.d.ts.map +0 -1
- package/dist/src/Protobuf.js +0 -92
- package/dist/src/Public.d.ts +0 -13
- package/dist/src/Public.d.ts.map +0 -1
- package/dist/src/Public.js +0 -6
- package/dist/src/Socket.d.ts +0 -8
- package/dist/src/Socket.d.ts.map +0 -1
- package/dist/src/Socket.js +0 -51
- package/dist/src/Sql.d.ts +0 -12
- package/dist/src/Sql.d.ts.map +0 -1
- package/dist/src/Sql.js +0 -30
- package/dist/src/Sync.d.ts +0 -70
- package/dist/src/Sync.d.ts.map +0 -1
- package/dist/src/Sync.js +0 -127
- package/src/Config.ts +0 -119
- package/src/Crdt.ts +0 -361
- package/src/Db.ts +0 -955
- package/src/Diff.ts +0 -114
- package/src/Evolu.ts +0 -1016
- package/src/Model.ts +0 -233
- package/src/Murmurhash.ts +0 -70
- package/src/Owner.ts +0 -69
- package/src/Platform.ts +0 -47
- package/src/Protobuf.ts +0 -155
- package/src/Public.ts +0 -12
- package/src/Socket.ts +0 -83
- package/src/Sql.ts +0 -41
- package/src/Sync.ts +0 -315
package/dist/src/Config.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import * as Layer from "effect/Layer";
|
|
3
|
-
import * as LogLevel from "effect/LogLevel";
|
|
4
|
-
import * as Logger from "effect/Logger";
|
|
5
|
-
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
6
|
-
import * as Match from "effect/Match";
|
|
7
|
-
export const Config = Context.GenericTag("Config");
|
|
8
|
-
export const defaultConfig = {
|
|
9
|
-
reloadUrl: "/",
|
|
10
|
-
syncUrl: "https://evolu.world",
|
|
11
|
-
name: "Evolu",
|
|
12
|
-
maxDrift: 5 * 60 * 1000,
|
|
13
|
-
minimumLogLevel: "none",
|
|
14
|
-
};
|
|
15
|
-
/** https://effect.website/docs/guides/runtime */
|
|
16
|
-
export const createRuntime = (partialConfig) => {
|
|
17
|
-
const config = { ...defaultConfig, ...partialConfig };
|
|
18
|
-
const ConfigLive = Layer.succeed(Config, config);
|
|
19
|
-
const minimumLogLevel = Match.value(config.minimumLogLevel).pipe(Match.when("debug", () => LogLevel.Debug), Match.when("none", () => LogLevel.None), Match.when("trace", () => LogLevel.Trace), Match.when("warning", () => LogLevel.Warning), Match.exhaustive);
|
|
20
|
-
const evoluLayer = config.minimumLogLevel === "none"
|
|
21
|
-
? ConfigLive
|
|
22
|
-
: Layer.mergeAll(ConfigLive, Logger.minimumLogLevel(minimumLogLevel), Logger.replace(Logger.defaultLogger, makeEvoluLogger(config.name)));
|
|
23
|
-
return ManagedRuntime.make(evoluLayer);
|
|
24
|
-
};
|
|
25
|
-
// TODO: Spans and Effect native variadic log args.
|
|
26
|
-
const makeEvoluLogger = (name) => Logger.make(({ logLevel, message, date }) => {
|
|
27
|
-
const fn = logLevel._tag === "Warning"
|
|
28
|
-
? "warn"
|
|
29
|
-
: logLevel._tag === "Error"
|
|
30
|
-
? "error"
|
|
31
|
-
: "log";
|
|
32
|
-
const hours = date.getHours().toString().padStart(2, "0");
|
|
33
|
-
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
34
|
-
const seconds = date.getSeconds().toString().padStart(2, "0");
|
|
35
|
-
const milliseconds = date.getMilliseconds().toString().padStart(3, "0");
|
|
36
|
-
const formattedDate = `${hours}:${minutes}:${seconds}:${milliseconds}`;
|
|
37
|
-
const messages = Array.isArray(message) ? message : [message];
|
|
38
|
-
globalThis.console[fn](`${formattedDate} [${name}]`, ...messages);
|
|
39
|
-
});
|
package/dist/src/Crdt.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as S from "@effect/schema/Schema";
|
|
2
|
-
import * as Brand from "effect/Brand";
|
|
3
|
-
import * as Context from "effect/Context";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as Layer from "effect/Layer";
|
|
6
|
-
import * as Option from "effect/Option";
|
|
7
|
-
import { Config } from "./Config.js";
|
|
8
|
-
import { NanoIdGenerator, NodeId } from "./Crypto.js";
|
|
9
|
-
export interface Timestamp {
|
|
10
|
-
readonly node: NodeId;
|
|
11
|
-
readonly millis: Millis;
|
|
12
|
-
readonly counter: Counter;
|
|
13
|
-
}
|
|
14
|
-
export declare const AllowedTimeRange: {
|
|
15
|
-
greaterThan: number;
|
|
16
|
-
lessThan: number;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Millis represents a time that is valid for usage with the Merkle tree. It
|
|
20
|
-
* must be between Apr 13, 1997, and Nov 05, 2051, to ensure MinutesBase3 length
|
|
21
|
-
* equals 16. We can find diff for two Merkle trees only within this range. If
|
|
22
|
-
* the device clock is out of range, Evolu will not store data until it's
|
|
23
|
-
* fixed.
|
|
24
|
-
*/
|
|
25
|
-
export declare const Millis: S.brand<S.filter<S.Schema<number, number, never>>, "Millis">;
|
|
26
|
-
export type Millis = typeof Millis.Type;
|
|
27
|
-
export declare const initialMillis: number & Brand.Brand<"Millis">;
|
|
28
|
-
export declare const Counter: S.brand<S.filter<S.Schema<number, number, never>>, "Counter">;
|
|
29
|
-
export type Counter = typeof Counter.Type;
|
|
30
|
-
export type TimestampHash = number & Brand.Brand<"TimestampHash">;
|
|
31
|
-
export type TimestampString = string & Brand.Brand<"TimestampString">;
|
|
32
|
-
export declare const timestampToString: (t: Timestamp) => TimestampString;
|
|
33
|
-
export declare const unsafeTimestampFromString: (s: TimestampString) => Timestamp;
|
|
34
|
-
export declare const timestampToHash: (t: Timestamp) => TimestampHash;
|
|
35
|
-
export declare const makeSyncTimestamp: (millis?: Millis) => Timestamp;
|
|
36
|
-
export declare const makeInitialTimestamp: Effect.Effect<Timestamp, never, NanoIdGenerator>;
|
|
37
|
-
declare const Time_base: Context.TagClass<Time, "Time", {
|
|
38
|
-
readonly now: Effect.Effect<Millis, TimestampTimeOutOfRangeError>;
|
|
39
|
-
}>;
|
|
40
|
-
export declare class Time extends Time_base {
|
|
41
|
-
static Live: Layer.Layer<Time, never, never>;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The TimestampError type represents all Timestamp-related errors. If such an
|
|
45
|
-
* error happens, the device clock is skewed and should be set to the current
|
|
46
|
-
* time.
|
|
47
|
-
*/
|
|
48
|
-
export type TimestampError = TimestampDriftError | TimestampCounterOverflowError | TimestampDuplicateNodeError | TimestampTimeOutOfRangeError;
|
|
49
|
-
export interface TimestampDriftError {
|
|
50
|
-
readonly _tag: "TimestampDriftError";
|
|
51
|
-
readonly next: Millis;
|
|
52
|
-
readonly now: Millis;
|
|
53
|
-
}
|
|
54
|
-
export interface TimestampCounterOverflowError {
|
|
55
|
-
readonly _tag: "TimestampCounterOverflowError";
|
|
56
|
-
}
|
|
57
|
-
export interface TimestampDuplicateNodeError {
|
|
58
|
-
readonly _tag: "TimestampDuplicateNodeError";
|
|
59
|
-
readonly node: NodeId;
|
|
60
|
-
}
|
|
61
|
-
export interface TimestampTimeOutOfRangeError {
|
|
62
|
-
readonly _tag: "TimestampTimeOutOfRangeError";
|
|
63
|
-
}
|
|
64
|
-
export declare const sendTimestamp: (timestamp: Timestamp) => Effect.Effect<Timestamp, TimestampDriftError | TimestampCounterOverflowError | TimestampTimeOutOfRangeError, Time | Config>;
|
|
65
|
-
export declare const receiveTimestamp: ({ local, remote, }: {
|
|
66
|
-
readonly local: Timestamp;
|
|
67
|
-
readonly remote: Timestamp;
|
|
68
|
-
}) => Effect.Effect<Timestamp, TimestampDriftError | TimestampCounterOverflowError | TimestampDuplicateNodeError | TimestampTimeOutOfRangeError, Time | Config>;
|
|
69
|
-
/**
|
|
70
|
-
* It's actually not Merkle Tree but a Merkleized prefix tree, aka Merkle Trie.
|
|
71
|
-
* https://decomposition.al/blog/2019/05/31/how-i-learned-about-merklix-trees-without-having-to-become-a-cryptocurrency-enthusiast
|
|
72
|
-
*/
|
|
73
|
-
export interface MerkleTree {
|
|
74
|
-
readonly hash?: TimestampHash;
|
|
75
|
-
readonly "0"?: MerkleTree;
|
|
76
|
-
readonly "1"?: MerkleTree;
|
|
77
|
-
readonly "2"?: MerkleTree;
|
|
78
|
-
}
|
|
79
|
-
export type MerkleTreeString = string & Brand.Brand<"MerkleTreeString">;
|
|
80
|
-
export declare const initialMerkleTree: MerkleTree;
|
|
81
|
-
type MerkleTreeKey = keyof Omit<MerkleTree, "hash">;
|
|
82
|
-
type MerkleTreePath = ReadonlyArray<MerkleTreeKey>;
|
|
83
|
-
export declare const millisToMerkleTreePath: (millis: Millis) => MerkleTreePath;
|
|
84
|
-
export declare const insertIntoMerkleTree: (tree: MerkleTree, timestamp: Timestamp) => MerkleTree;
|
|
85
|
-
export declare const diffMerkleTrees: (tree1: MerkleTree, tree2: MerkleTree) => Option.Option<Millis>;
|
|
86
|
-
export declare const merkleTreeToString: (m: MerkleTree) => MerkleTreeString;
|
|
87
|
-
export declare const unsafeMerkleTreeFromString: (m: MerkleTreeString) => MerkleTree;
|
|
88
|
-
export {};
|
|
89
|
-
//# sourceMappingURL=Crdt.d.ts.map
|
package/dist/src/Crdt.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Crdt.d.ts","sourceRoot":"","sources":["../../src/Crdt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQtD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,gBAAgB;;;CAG5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,8DAIlB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC,eAAO,MAAM,aAAa,gCAEzB,CAAC;AAEF,eAAO,MAAM,OAAO,+DAAyD,CAAC;AAC9E,MAAM,MAAM,OAAO,GAAG,OAAO,OA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
-
import * as S from "@effect/schema/Schema";
|
|
2
|
-
import * as Arr from "effect/Array";
|
|
3
|
-
import * as Context from "effect/Context";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as Either from "effect/Either";
|
|
6
|
-
import { pipe } from "effect/Function";
|
|
7
|
-
import * as Layer from "effect/Layer";
|
|
8
|
-
import * as Number from "effect/Number";
|
|
9
|
-
import * as Option from "effect/Option";
|
|
10
|
-
import * as String from "effect/String";
|
|
11
|
-
import { Config } from "./Config.js";
|
|
12
|
-
import { NanoIdGenerator, NodeId } from "./Crypto.js";
|
|
13
|
-
import { murmurhash } from "./Murmurhash.js";
|
|
14
|
-
export const AllowedTimeRange = {
|
|
15
|
-
greaterThan: 860934419999,
|
|
16
|
-
lessThan: 2582803260000,
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Millis represents a time that is valid for usage with the Merkle tree. It
|
|
20
|
-
* must be between Apr 13, 1997, and Nov 05, 2051, to ensure MinutesBase3 length
|
|
21
|
-
* equals 16. We can find diff for two Merkle trees only within this range. If
|
|
22
|
-
* the device clock is out of range, Evolu will not store data until it's
|
|
23
|
-
* fixed.
|
|
24
|
-
*/
|
|
25
|
-
export const Millis = S.Number.pipe(S.greaterThan(AllowedTimeRange.greaterThan), S.lessThan(AllowedTimeRange.lessThan), S.brand("Millis"));
|
|
26
|
-
export const initialMillis = S.decodeSync(Millis)(AllowedTimeRange.greaterThan + 1);
|
|
27
|
-
export const Counter = S.Number.pipe(S.between(0, 65535), S.brand("Counter"));
|
|
28
|
-
const initialCounter = S.decodeSync(Counter)(0);
|
|
29
|
-
export const timestampToString = (t) => [
|
|
30
|
-
new Date(t.millis).toISOString(),
|
|
31
|
-
t.counter.toString(16).toUpperCase().padStart(4, "0"),
|
|
32
|
-
t.node,
|
|
33
|
-
].join("-");
|
|
34
|
-
export const unsafeTimestampFromString = (s) => {
|
|
35
|
-
const a = s.split("-");
|
|
36
|
-
return {
|
|
37
|
-
millis: Date.parse(a.slice(0, 3).join("-")).valueOf(),
|
|
38
|
-
counter: parseInt(a[3], 16),
|
|
39
|
-
node: a[4],
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export const timestampToHash = (t) => murmurhash(timestampToString(t));
|
|
43
|
-
const syncNodeId = S.decodeSync(NodeId)("0000000000000000");
|
|
44
|
-
export const makeSyncTimestamp = (millis = initialMillis) => ({
|
|
45
|
-
millis,
|
|
46
|
-
counter: initialCounter,
|
|
47
|
-
node: syncNodeId,
|
|
48
|
-
});
|
|
49
|
-
export const makeInitialTimestamp = NanoIdGenerator.pipe(Effect.flatMap(({ nodeId }) => nodeId), Effect.map((node) => ({
|
|
50
|
-
millis: initialMillis,
|
|
51
|
-
counter: initialCounter,
|
|
52
|
-
node,
|
|
53
|
-
})));
|
|
54
|
-
export class Time extends Context.Tag("Time")() {
|
|
55
|
-
}
|
|
56
|
-
Time.Live = Layer.succeed(Time, {
|
|
57
|
-
now: Effect.suspend(() => S.decode(Millis)(Date.now())).pipe(Effect.catchTag("ParseError", () => Effect.fail({
|
|
58
|
-
_tag: "TimestampTimeOutOfRangeError",
|
|
59
|
-
}))),
|
|
60
|
-
});
|
|
61
|
-
const getNextMillis = (millis) => Effect.gen(function* () {
|
|
62
|
-
const time = yield* Time;
|
|
63
|
-
const config = yield* Config;
|
|
64
|
-
const now = yield* time.now;
|
|
65
|
-
const next = Math.max(now, ...millis);
|
|
66
|
-
if (next - now > config.maxDrift)
|
|
67
|
-
yield* Effect.fail({
|
|
68
|
-
_tag: "TimestampDriftError",
|
|
69
|
-
now,
|
|
70
|
-
next,
|
|
71
|
-
});
|
|
72
|
-
return next;
|
|
73
|
-
});
|
|
74
|
-
const incrementCounter = (counter) => pipe(Number.increment(counter), S.decodeEither(Counter), Either.mapLeft(() => ({
|
|
75
|
-
_tag: "TimestampCounterOverflowError",
|
|
76
|
-
})));
|
|
77
|
-
const counterMin = S.decodeSync(Counter)(0);
|
|
78
|
-
export const sendTimestamp = (timestamp) => Effect.gen(function* () {
|
|
79
|
-
const millis = yield* getNextMillis([timestamp.millis]);
|
|
80
|
-
const counter = millis === timestamp.millis
|
|
81
|
-
? yield* incrementCounter(timestamp.counter)
|
|
82
|
-
: counterMin;
|
|
83
|
-
return { ...timestamp, millis, counter };
|
|
84
|
-
});
|
|
85
|
-
export const receiveTimestamp = ({ local, remote, }) => Effect.gen(function* (_) {
|
|
86
|
-
if (local.node === remote.node)
|
|
87
|
-
yield* Effect.fail({
|
|
88
|
-
_tag: "TimestampDuplicateNodeError",
|
|
89
|
-
node: local.node,
|
|
90
|
-
});
|
|
91
|
-
const millis = yield* getNextMillis([local.millis, remote.millis]);
|
|
92
|
-
const counter = yield* millis === local.millis && millis === remote.millis
|
|
93
|
-
? incrementCounter(Math.max(local.counter, remote.counter))
|
|
94
|
-
: millis === local.millis
|
|
95
|
-
? incrementCounter(local.counter)
|
|
96
|
-
: millis === remote.millis
|
|
97
|
-
? incrementCounter(remote.counter)
|
|
98
|
-
: Either.right(counterMin);
|
|
99
|
-
return { ...local, millis, counter };
|
|
100
|
-
});
|
|
101
|
-
export const initialMerkleTree = Object.create(null);
|
|
102
|
-
export const millisToMerkleTreePath = (millis) => Math.floor(millis / 1000 / 60)
|
|
103
|
-
.toString(3)
|
|
104
|
-
.split("");
|
|
105
|
-
const merkleTreePathToMillis = (path) => path.length === 0
|
|
106
|
-
? initialMillis
|
|
107
|
-
: // 16 is the length of the base 3 value of the current time in minutes.
|
|
108
|
-
// Ensure it's padded to create the full value.
|
|
109
|
-
(parseInt(path.join("").padEnd(16, "0"), 3) * 1000 * 60);
|
|
110
|
-
const xorTimestampHashes = (a, b) => ((a || 0) ^ b);
|
|
111
|
-
const insertKey = (tree, path, hash) => {
|
|
112
|
-
if (path.length === 0)
|
|
113
|
-
return tree;
|
|
114
|
-
const key = path[0];
|
|
115
|
-
const child = tree[key] || {};
|
|
116
|
-
return {
|
|
117
|
-
...tree,
|
|
118
|
-
[key]: {
|
|
119
|
-
...child,
|
|
120
|
-
...insertKey(child, path.slice(1), hash),
|
|
121
|
-
hash: xorTimestampHashes(child.hash, hash),
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
export const insertIntoMerkleTree = (tree, timestamp) => {
|
|
126
|
-
const path = millisToMerkleTreePath(timestamp.millis);
|
|
127
|
-
const hash = timestampToHash(timestamp);
|
|
128
|
-
return insertKey({ ...tree, hash: xorTimestampHashes(tree.hash, hash) }, path, hash);
|
|
129
|
-
};
|
|
130
|
-
const sortedMerkleTreeKeys = ["0", "1", "2"];
|
|
131
|
-
const getSortedMerkleTreeKeys = (tree) => sortedMerkleTreeKeys.filter((key) => key in tree);
|
|
132
|
-
export const diffMerkleTrees = (tree1, tree2) => {
|
|
133
|
-
if (tree1.hash === tree2.hash)
|
|
134
|
-
return Option.none();
|
|
135
|
-
let node1 = tree1;
|
|
136
|
-
let node2 = tree2;
|
|
137
|
-
let diffPath = [];
|
|
138
|
-
// This loop will eventually stop when it traverses down to find
|
|
139
|
-
// where the hashes differ, or otherwise when there are no leaves
|
|
140
|
-
// left (this shouldn't happen, if that's the case the hash check at
|
|
141
|
-
// the top of this function should pass)
|
|
142
|
-
// eslint-disable-next-line no-constant-condition
|
|
143
|
-
while (1) {
|
|
144
|
-
const keys = Arr.dedupeWith(getSortedMerkleTreeKeys(node1).concat(getSortedMerkleTreeKeys(node2)), String.Equivalence);
|
|
145
|
-
let diffKey = null;
|
|
146
|
-
// Traverse down the trie through keys that are different. We
|
|
147
|
-
// traverse down the keys in order. Stop in two cases: either one
|
|
148
|
-
// of the nodes doesn't have the key or a different key isn't
|
|
149
|
-
// found. For the former case, we have to do that because pruning is
|
|
150
|
-
// lossy. We don't know if we've pruned off a changed key, so we
|
|
151
|
-
// can't traverse down anymore. For the latter case, it means two
|
|
152
|
-
// things: either we've hit the bottom of the tree, or the changed
|
|
153
|
-
// key has been pruned off. In the latter case, we have a "partial"
|
|
154
|
-
// key and will fill the rest with 0s. If multiple older
|
|
155
|
-
// messages were added into one trie, we might likely
|
|
156
|
-
// generate a time that only encompasses *some* of those
|
|
157
|
-
// messages. Pruning is lossy, and we traverse down the left-most
|
|
158
|
-
// changed time that we know of, because of pruning, it might take
|
|
159
|
-
// multiple passes to sync up a trie.
|
|
160
|
-
for (let i = 0; i < keys.length; i++) {
|
|
161
|
-
const key = keys[i];
|
|
162
|
-
const next1 = node1[key];
|
|
163
|
-
const next2 = node2[key];
|
|
164
|
-
if (!next1 || !next2)
|
|
165
|
-
break;
|
|
166
|
-
if (next1.hash !== next2.hash) {
|
|
167
|
-
diffKey = key;
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (!diffKey) {
|
|
172
|
-
return Option.some(merkleTreePathToMillis(diffPath));
|
|
173
|
-
}
|
|
174
|
-
diffPath = [...diffPath, diffKey];
|
|
175
|
-
node1 = node1[diffKey] || initialMerkleTree;
|
|
176
|
-
node2 = node2[diffKey] || initialMerkleTree;
|
|
177
|
-
}
|
|
178
|
-
return Option.none();
|
|
179
|
-
};
|
|
180
|
-
export const merkleTreeToString = (m) => JSON.stringify(m);
|
|
181
|
-
export const unsafeMerkleTreeFromString = (m) => JSON.parse(m);
|
package/dist/src/Db.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import * as S from "@effect/schema/Schema";
|
|
2
|
-
import * as Brand from "effect/Brand";
|
|
3
|
-
import * as Context from "effect/Context";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as Record from "effect/Record";
|
|
6
|
-
import * as Kysely from "kysely";
|
|
7
|
-
import { Config } from "./Config.js";
|
|
8
|
-
import { Millis, Time, TimestampCounterOverflowError, TimestampDriftError, TimestampTimeOutOfRangeError } from "./Crdt.js";
|
|
9
|
-
import { Mnemonic, NanoIdGenerator } from "./Crypto.js";
|
|
10
|
-
import { QueryPatches } from "./Diff.js";
|
|
11
|
-
import { EvoluError } from "./Error.js";
|
|
12
|
-
import { Id } from "./Model.js";
|
|
13
|
-
import { Owner } from "./Owner.js";
|
|
14
|
-
import { SyncLock } from "./Platform.js";
|
|
15
|
-
import { Sqlite, SqliteExecResult, SqliteFactory, SqliteQuery, Value } from "./Sqlite.js";
|
|
16
|
-
import { NewMessage, SyncFactory, SyncState } from "./Sync.js";
|
|
17
|
-
export interface Db {
|
|
18
|
-
readonly init: (schema: DbSchema, initialData: ReadonlyArray<Mutation>, onError: Callbacks["onError"], onSyncStateChange: Callbacks["onSyncStateChange"], onReceive: Callbacks["onReceive"], mnemonic: Mnemonic | undefined) => Effect.Effect<Owner, NotSupportedPlatformError | TimestampTimeOutOfRangeError | TimestampDriftError | TimestampCounterOverflowError, Config>;
|
|
19
|
-
readonly loadQueries: (queries: ReadonlyArray<Query>) => Effect.Effect<ReadonlyArray<QueryPatches>>;
|
|
20
|
-
readonly mutate: (mutations: ReadonlyArray<Mutation>, queriesToRefresh: ReadonlyArray<Query>) => Effect.Effect<ReadonlyArray<QueryPatches>, TimestampTimeOutOfRangeError | TimestampDriftError | TimestampCounterOverflowError, Config>;
|
|
21
|
-
readonly resetOwner: () => Effect.Effect<void>;
|
|
22
|
-
readonly restoreOwner: (schema: DbSchema, mnemonic: Mnemonic) => Effect.Effect<void>;
|
|
23
|
-
readonly ensureSchema: (schema: DbSchema) => Effect.Effect<void>;
|
|
24
|
-
readonly sync: (queriesToRefresh: ReadonlyArray<Query>) => Effect.Effect<ReadonlyArray<QueryPatches>, never, Config>;
|
|
25
|
-
readonly exportDatabase: () => Effect.Effect<Uint8Array>;
|
|
26
|
-
}
|
|
27
|
-
export interface DbSchema {
|
|
28
|
-
readonly tables: ReadonlyArray<Table>;
|
|
29
|
-
readonly indexes: ReadonlyArray<Index>;
|
|
30
|
-
}
|
|
31
|
-
export interface Table {
|
|
32
|
-
readonly name: string;
|
|
33
|
-
readonly columns: ReadonlyArray<string>;
|
|
34
|
-
}
|
|
35
|
-
export declare const Index: S.Struct<{
|
|
36
|
-
name: typeof S.String;
|
|
37
|
-
sql: typeof S.String;
|
|
38
|
-
}>;
|
|
39
|
-
export type Index = typeof Index.Type;
|
|
40
|
-
export interface Mutation {
|
|
41
|
-
readonly table: string;
|
|
42
|
-
readonly id: Id;
|
|
43
|
-
readonly values: Record.ReadonlyRecord<string, Value | Date | boolean | undefined>;
|
|
44
|
-
readonly isInsert: boolean;
|
|
45
|
-
}
|
|
46
|
-
export interface NotSupportedPlatformError {
|
|
47
|
-
readonly _tag: "NotSupportedPlatformError";
|
|
48
|
-
}
|
|
49
|
-
declare const __queryBrand: unique symbol;
|
|
50
|
-
/**
|
|
51
|
-
* Query is SQL query serialized as a string with a branded type representing a
|
|
52
|
-
* row it returns.
|
|
53
|
-
*/
|
|
54
|
-
export type Query<R extends Row = Row> = string & Brand.Brand<"Query"> & {
|
|
55
|
-
readonly [__queryBrand]: R;
|
|
56
|
-
};
|
|
57
|
-
export type Row = {
|
|
58
|
-
[key: string]: Value | Row | ReadonlyArray<Row>;
|
|
59
|
-
};
|
|
60
|
-
declare const DbFactory_base: Context.TagClass<DbFactory, "DbFactory", {
|
|
61
|
-
readonly createDb: Effect.Effect<Db>;
|
|
62
|
-
}>;
|
|
63
|
-
export declare class DbFactory extends DbFactory_base {
|
|
64
|
-
}
|
|
65
|
-
export declare const createDb: Effect.Effect<Db, never, SqliteFactory | NanoIdGenerator | Time | SyncFactory | SyncLock>;
|
|
66
|
-
export interface Callbacks {
|
|
67
|
-
readonly onError: (error: EvoluError) => void;
|
|
68
|
-
readonly onSyncStateChange: (state: SyncState) => void;
|
|
69
|
-
readonly onReceive: () => void;
|
|
70
|
-
}
|
|
71
|
-
export declare const Callbacks: Context.Tag<Callbacks, Callbacks>;
|
|
72
|
-
export type QueryRowsMap = ReadonlyMap<Query, ReadonlyArray<Row>>;
|
|
73
|
-
export declare const upsertValueIntoTableRowColumn: (message: NewMessage, messages: ReadonlyArray<NewMessage>, millis: Millis) => Effect.Effect<SqliteExecResult, never, Sqlite>;
|
|
74
|
-
export declare const serializeQuery: <R extends Row>({ sql, parameters, options, }: SqliteQuery) => Query<R>;
|
|
75
|
-
export declare const deserializeQuery: <R extends Row>(query: Query<R>) => SqliteQuery;
|
|
76
|
-
/**
|
|
77
|
-
* Extract {@link Row} from {@link Query} instance.
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* const allTodos = evolu.createQuery((db) =>
|
|
81
|
-
* db.selectFrom("todo").selectAll(),
|
|
82
|
-
* );
|
|
83
|
-
* type AllTodosRow = ExtractRow<typeof allTodos>;
|
|
84
|
-
*/
|
|
85
|
-
export type ExtractRow<T extends Query> = T extends Query<infer R> ? R : never;
|
|
86
|
-
export declare const emptyRows: <R extends Row>() => ReadonlyArray<R>;
|
|
87
|
-
/** An object with rows and row properties. */
|
|
88
|
-
export interface QueryResult<R extends Row = Row> {
|
|
89
|
-
/** An array containing all the rows returned by the query. */
|
|
90
|
-
readonly rows: ReadonlyArray<Readonly<Kysely.Simplify<R>>>;
|
|
91
|
-
/**
|
|
92
|
-
* The first row returned by the query, or null if no rows were returned. This
|
|
93
|
-
* property is useful for queries that are expected to return a single row.
|
|
94
|
-
*/
|
|
95
|
-
readonly row: Readonly<Kysely.Simplify<R>> | null;
|
|
96
|
-
}
|
|
97
|
-
export type Queries<R extends Row = Row> = ReadonlyArray<Query<R>>;
|
|
98
|
-
export type QueryResultsFromQueries<Q extends Queries> = {
|
|
99
|
-
[P in keyof Q]: Q[P] extends Query<infer R> ? QueryResult<R> : never;
|
|
100
|
-
};
|
|
101
|
-
export type QueryResultsPromisesFromQueries<Q extends Queries> = {
|
|
102
|
-
[P in keyof Q]: Q[P] extends Query<infer R> ? Promise<QueryResult<R>> : never;
|
|
103
|
-
};
|
|
104
|
-
export declare const queryResultFromRows: <R extends Row>(rows: ReadonlyArray<R>) => QueryResult<R>;
|
|
105
|
-
export declare const notSupportedPlatformWorker: Db;
|
|
106
|
-
export {};
|
|
107
|
-
//# sourceMappingURL=Db.d.ts.map
|
package/dist/src/Db.d.ts.map
DELETED
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