@peerbit/shared-log 13.2.6 → 13.2.8
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/errors.d.ts +19 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +40 -0
- package/dist/src/errors.js.map +1 -1
- package/dist/src/index.d.ts +72 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3251 -541
- package/dist/src/index.js.map +1 -1
- package/package.json +23 -23
- package/src/errors.ts +62 -0
- package/src/index.ts +4431 -879
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peerbit/shared-log",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.8",
|
|
4
4
|
"description": "Shared log",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
|
-
"author": "
|
|
52
|
+
"author": "Peerbit contributors",
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@dao-xyz/borsh": "^6.0.0",
|
|
@@ -61,36 +61,36 @@
|
|
|
61
61
|
"pidusage": "^4.0.1",
|
|
62
62
|
"pino": "^9.4.0",
|
|
63
63
|
"uint8arrays": "^5.1.0",
|
|
64
|
-
"@peerbit/
|
|
65
|
-
"@peerbit/
|
|
66
|
-
"@peerbit/blocks": "4.2.
|
|
64
|
+
"@peerbit/blocks-interface": "2.1.2",
|
|
65
|
+
"@peerbit/any-store": "2.2.12",
|
|
66
|
+
"@peerbit/blocks": "4.2.4",
|
|
67
67
|
"@peerbit/cache": "3.1.0",
|
|
68
|
-
"@peerbit/crypto": "3.1.
|
|
69
|
-
"@peerbit/
|
|
70
|
-
"@peerbit/
|
|
71
|
-
"@peerbit/
|
|
72
|
-
"@peerbit/log": "6.2.5",
|
|
68
|
+
"@peerbit/crypto": "3.1.4",
|
|
69
|
+
"@peerbit/indexer-interface": "3.0.8",
|
|
70
|
+
"@peerbit/log": "6.2.7",
|
|
71
|
+
"@peerbit/program": "6.0.37",
|
|
73
72
|
"@peerbit/logger": "2.0.1",
|
|
74
|
-
"@peerbit/
|
|
75
|
-
"@peerbit/pubsub-interface": "5.1.
|
|
76
|
-
"@peerbit/pubsub": "5.3.0",
|
|
77
|
-
"@peerbit/rpc": "6.1.3",
|
|
78
|
-
"@peerbit/stream-interface": "6.0.11",
|
|
73
|
+
"@peerbit/pubsub": "5.3.2",
|
|
74
|
+
"@peerbit/pubsub-interface": "5.1.7",
|
|
79
75
|
"@peerbit/riblt": "1.2.0",
|
|
80
|
-
"@peerbit/
|
|
76
|
+
"@peerbit/indexer-sqlite3": "3.0.11",
|
|
77
|
+
"@peerbit/rpc": "6.1.5",
|
|
78
|
+
"@peerbit/diagnostics": "0.0.1",
|
|
79
|
+
"@peerbit/stream-interface": "6.0.13",
|
|
80
|
+
"@peerbit/time": "3.0.1"
|
|
81
81
|
},
|
|
82
82
|
"optionalDependencies": {
|
|
83
|
-
"@peerbit/native-backbone": "0.1
|
|
84
|
-
"@peerbit/shared-log-rust": "0.1.
|
|
83
|
+
"@peerbit/native-backbone": "0.2.1",
|
|
84
|
+
"@peerbit/shared-log-rust": "0.1.3"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
88
88
|
"@types/pidusage": "^2.0.5",
|
|
89
|
-
"uuid": "^
|
|
90
|
-
"@peerbit/
|
|
91
|
-
"@peerbit/
|
|
92
|
-
"peerbit": "
|
|
93
|
-
"
|
|
89
|
+
"uuid": "^11.1.1",
|
|
90
|
+
"@peerbit/indexer-rust": "1.0.6",
|
|
91
|
+
"@peerbit/any-store-rust": "0.1.2",
|
|
92
|
+
"@peerbit/test-utils": "3.1.8",
|
|
93
|
+
"peerbit": "5.3.8"
|
|
94
94
|
},
|
|
95
95
|
"repository": {
|
|
96
96
|
"type": "git",
|
package/src/errors.ts
CHANGED
|
@@ -5,3 +5,65 @@ export class NoPeersError extends Error {
|
|
|
5
5
|
);
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The native transaction committed hot/runtime facts before its entry block
|
|
11
|
+
* could be mirrored to durable storage. Lower-log publication is held behind
|
|
12
|
+
* the mirror barrier, but blindly retrying the user operation is unsafe because
|
|
13
|
+
* native state may already contain the attempted commit.
|
|
14
|
+
*/
|
|
15
|
+
export class NativeDurableCommitError extends Error {
|
|
16
|
+
readonly nativeCommitApplied = true;
|
|
17
|
+
readonly retrySafe = false;
|
|
18
|
+
readonly cause: unknown;
|
|
19
|
+
readonly committedCids: readonly string[];
|
|
20
|
+
readonly failedCids: readonly string[];
|
|
21
|
+
private readonly committedCidList: string[];
|
|
22
|
+
private readonly failedCidList: string[];
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
cause: unknown,
|
|
26
|
+
options?: {
|
|
27
|
+
committedCids?: Iterable<string>;
|
|
28
|
+
failedCids?: Iterable<string>;
|
|
29
|
+
},
|
|
30
|
+
) {
|
|
31
|
+
const committedCids = [...(options?.committedCids ?? [])];
|
|
32
|
+
const failedCids = [...(options?.failedCids ?? committedCids)];
|
|
33
|
+
super(
|
|
34
|
+
`Native commit applied but a durable block mutation failed; automatic retry is unsafe: ${
|
|
35
|
+
cause instanceof Error ? cause.message : String(cause)
|
|
36
|
+
}${failedCids.length > 0 ? ` (failed CIDs: ${failedCids.join(", ")})` : ""}`,
|
|
37
|
+
);
|
|
38
|
+
this.name = "NativeDurableCommitError";
|
|
39
|
+
this.cause = cause;
|
|
40
|
+
this.committedCidList = committedCids;
|
|
41
|
+
this.failedCidList = failedCids;
|
|
42
|
+
this.committedCids = this.committedCidList;
|
|
43
|
+
this.failedCids = this.failedCidList;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @internal Merge facts from other mutations covered by the same poison. */
|
|
47
|
+
addCommitContext(
|
|
48
|
+
options?: {
|
|
49
|
+
committedCids?: Iterable<string>;
|
|
50
|
+
failedCids?: Iterable<string>;
|
|
51
|
+
},
|
|
52
|
+
properties?: { preferIncomingOrder?: boolean },
|
|
53
|
+
): void {
|
|
54
|
+
const merge = (
|
|
55
|
+
target: string[],
|
|
56
|
+
incoming: Iterable<string> | undefined,
|
|
57
|
+
): void => {
|
|
58
|
+
if (!incoming) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const values = properties?.preferIncomingOrder
|
|
62
|
+
? [...incoming, ...target]
|
|
63
|
+
: [...target, ...incoming];
|
|
64
|
+
target.splice(0, target.length, ...new Set(values));
|
|
65
|
+
};
|
|
66
|
+
merge(this.committedCidList, options?.committedCids);
|
|
67
|
+
merge(this.failedCidList, options?.failedCids);
|
|
68
|
+
}
|
|
69
|
+
}
|