@wovin/core 0.1.11 → 0.1.15
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/applog.min.js +2 -2
- package/dist/chunk-3EVHRFPN.min.js +112 -0
- package/dist/chunk-3EVHRFPN.min.js.map +1 -0
- package/dist/{chunk-CMYPWG2N.min.js → chunk-3Y5KUHV5.min.js} +5 -5
- package/dist/{chunk-5LVRXH2F.min.js → chunk-6KONUEQB.min.js} +2 -2
- package/dist/{chunk-MSRY6NTA.min.js → chunk-6XE4TT2P.min.js} +2 -2
- package/dist/{chunk-ULDVYEPF.min.js → chunk-GH2FXZ3U.min.js} +3 -3
- package/dist/{chunk-5T5HSBRE.min.js → chunk-SFDNH2ID.min.js} +2 -2
- package/dist/{chunk-L5ONTLHW.min.js → chunk-XR2SGDQV.min.js} +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.min.js +16 -12
- package/dist/ipfs.min.js +5 -5
- package/dist/pubsub.min.js +5 -5
- package/dist/query.min.js +4 -4
- package/dist/retrieve/index.d.ts +2 -0
- package/dist/retrieve/index.d.ts.map +1 -0
- package/dist/retrieve/update-thread.d.ts +50 -0
- package/dist/retrieve/update-thread.d.ts.map +1 -0
- package/dist/retrieve.d.ts +2 -0
- package/dist/retrieve.d.ts.map +1 -0
- package/dist/retrieve.min.js +14 -0
- package/dist/retrieve.min.js.map +1 -0
- package/dist/thread.min.js +2 -2
- package/package.json +5 -1
- /package/dist/{chunk-CMYPWG2N.min.js.map → chunk-3Y5KUHV5.min.js.map} +0 -0
- /package/dist/{chunk-5LVRXH2F.min.js.map → chunk-6KONUEQB.min.js.map} +0 -0
- /package/dist/{chunk-MSRY6NTA.min.js.map → chunk-6XE4TT2P.min.js.map} +0 -0
- /package/dist/{chunk-ULDVYEPF.min.js.map → chunk-GH2FXZ3U.min.js.map} +0 -0
- /package/dist/{chunk-5T5HSBRE.min.js.map → chunk-SFDNH2ID.min.js.map} +0 -0
- /package/dist/{chunk-L5ONTLHW.min.js.map → chunk-XR2SGDQV.min.js.map} +0 -0
package/dist/applog.min.js
CHANGED
|
@@ -46,9 +46,9 @@ import {
|
|
|
46
46
|
variableNameWithoutQuestionmark,
|
|
47
47
|
withPvFrom,
|
|
48
48
|
withTs
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import "./chunk-KEHU7HGZ.min.js";
|
|
49
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
51
50
|
import "./chunk-HYMC7W6S.min.js";
|
|
51
|
+
import "./chunk-KEHU7HGZ.min.js";
|
|
52
52
|
import "./chunk-PHITDXZT.min.js";
|
|
53
53
|
export {
|
|
54
54
|
AppLogNoCidTB,
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unchunkApplogsBlock
|
|
3
|
+
} from "./chunk-GH2FXZ3U.min.js";
|
|
4
|
+
import {
|
|
5
|
+
CID,
|
|
6
|
+
areCidsEqual,
|
|
7
|
+
decode,
|
|
8
|
+
g,
|
|
9
|
+
removeDuplicateAppLogs
|
|
10
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
11
|
+
|
|
12
|
+
// src/retrieve/update-thread.ts
|
|
13
|
+
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
|
|
14
|
+
function createMemoryBlockStore() {
|
|
15
|
+
const blocks = /* @__PURE__ */ new Map();
|
|
16
|
+
return {
|
|
17
|
+
get(cid) {
|
|
18
|
+
return blocks.get(cid.toV1().toString());
|
|
19
|
+
},
|
|
20
|
+
put(cid, bytes) {
|
|
21
|
+
blocks.set(cid.toV1().toString(), bytes);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async function getDecodedBlock(blockStore, cid) {
|
|
26
|
+
const bytes = blockStore.get(cid);
|
|
27
|
+
if (!bytes) return null;
|
|
28
|
+
return decode(bytes);
|
|
29
|
+
}
|
|
30
|
+
async function updateThreadFromSnapshot(thread, cid, retriever, options) {
|
|
31
|
+
const { excludeSnapshotCID, maxDepth = 100 } = options ?? {};
|
|
32
|
+
DEBUG("[updateThreadFromSnapshot] starting from", cid.toString(), {
|
|
33
|
+
excludeSnapshotCID: excludeSnapshotCID?.toString(),
|
|
34
|
+
maxDepth
|
|
35
|
+
});
|
|
36
|
+
const blockStore = createMemoryBlockStore();
|
|
37
|
+
const visited = /* @__PURE__ */ new Set();
|
|
38
|
+
let currentCID = cid;
|
|
39
|
+
let snapshotCount = 0;
|
|
40
|
+
const allApplogs = [];
|
|
41
|
+
while (currentCID && snapshotCount < maxDepth) {
|
|
42
|
+
const cidStr = currentCID.toString();
|
|
43
|
+
if (visited.has(cidStr)) {
|
|
44
|
+
throw ERROR("[updateThreadFromSnapshot] snapshot chain has a loop", {
|
|
45
|
+
currentCID: cidStr,
|
|
46
|
+
visited: [...visited]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
visited.add(cidStr);
|
|
50
|
+
if (excludeSnapshotCID && areCidsEqual(currentCID, excludeSnapshotCID)) {
|
|
51
|
+
DEBUG("[updateThreadFromSnapshot] reached excludeSnapshotCID, stopping", excludeSnapshotCID.toString());
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
DEBUG("[updateThreadFromSnapshot] fetching root block", cidStr);
|
|
55
|
+
const rootBytes = await retriever.getBlock(currentCID);
|
|
56
|
+
blockStore.put(currentCID, rootBytes);
|
|
57
|
+
const root = decode(rootBytes);
|
|
58
|
+
DEBUG("[updateThreadFromSnapshot] fetching applogs", root.applogs.toString());
|
|
59
|
+
for await (const { cid: blockCid, bytes } of retriever.getDag(root.applogs)) {
|
|
60
|
+
blockStore.put(blockCid, bytes);
|
|
61
|
+
}
|
|
62
|
+
DEBUG("[updateThreadFromSnapshot] fetching info", root.info.toString());
|
|
63
|
+
for await (const { cid: blockCid, bytes } of retriever.getDag(root.info)) {
|
|
64
|
+
blockStore.put(blockCid, bytes);
|
|
65
|
+
}
|
|
66
|
+
const applogsBlock = await getDecodedBlock(blockStore, root.applogs);
|
|
67
|
+
if (!applogsBlock) {
|
|
68
|
+
throw ERROR("[updateThreadFromSnapshot] applogs block not found", { cid: root.applogs.toString() });
|
|
69
|
+
}
|
|
70
|
+
const applogCIDs = await unchunkApplogsBlock(applogsBlock, {
|
|
71
|
+
get: async (cid2) => blockStore.get(cid2)
|
|
72
|
+
});
|
|
73
|
+
for (const applogCID of applogCIDs) {
|
|
74
|
+
const applog = await getDecodedBlock(blockStore, applogCID);
|
|
75
|
+
if (!applog) {
|
|
76
|
+
WARN("[updateThreadFromSnapshot] applog not found:", applogCID.toString());
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (applog.pv instanceof CID) {
|
|
80
|
+
applog.pv = applog.pv.toV1().toString();
|
|
81
|
+
}
|
|
82
|
+
allApplogs.push({
|
|
83
|
+
...applog,
|
|
84
|
+
cid: applogCID.toV1().toString()
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
snapshotCount++;
|
|
88
|
+
currentCID = root.prev;
|
|
89
|
+
}
|
|
90
|
+
DEBUG("[updateThreadFromSnapshot] fetched", {
|
|
91
|
+
snapshotCount,
|
|
92
|
+
applogCount: allApplogs.length,
|
|
93
|
+
rootCID: cid.toString()
|
|
94
|
+
});
|
|
95
|
+
const deduplicated = removeDuplicateAppLogs(allApplogs, "cleanup");
|
|
96
|
+
const inserted = thread.insertMissing(deduplicated, false);
|
|
97
|
+
DEBUG("[updateThreadFromSnapshot] inserted", {
|
|
98
|
+
insertedCount: inserted.length,
|
|
99
|
+
duplicateCount: deduplicated.length - inserted.length
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
cid,
|
|
103
|
+
applogs: deduplicated,
|
|
104
|
+
insertedCount: inserted.length,
|
|
105
|
+
snapshotCount
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
updateThreadFromSnapshot
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=chunk-3EVHRFPN.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/retrieve/update-thread.ts"],"sourcesContent":["import { CarReader } from '@ipld/car'\nimport * as dagJson from '@ipld/dag-json'\nimport { Logger } from 'besonders-logger'\nimport { CID } from 'multiformats/cid'\nimport type { Applog } from '../applog/datom-types'\nimport { removeDuplicateAppLogs } from '../applog/applog-utils'\nimport type { SnapRootBlock, SnapBlockLogsOrChunks } from '../pubsub/pubsub-types'\nimport { unchunkApplogsBlock } from '../pubsub/snap-push'\nimport { areCidsEqual } from '../ipfs/ipfs-utils'\nimport type { WriteableThread } from '../thread/writeable'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\n/**\n * Block retrieval abstraction - fetch or get blocks.\n * Implemented by gateway retriever or local blockstore.\n */\nexport interface BlockRetriever {\n\t/** Get single block by CID */\n\tgetBlock(cid: CID): Promise<Uint8Array>\n\t/** Get all blocks in DAG rooted at CID (for applogs/info sub-DAGs) */\n\tgetDag(cid: CID): AsyncIterable<{ cid: CID; bytes: Uint8Array }>\n}\n\n/**\n * Options for updateThreadFromSnapshot\n */\nexport interface UpdateOptions {\n\t/** CID of last included snapshot - exclude this and older snapshots */\n\texcludeSnapshotCID?: CID\n\t/** Maximum number of snapshots to traverse (default: 100) */\n\tmaxDepth?: number\n}\n\n/**\n * Result from updateThreadFromSnapshot\n */\nexport interface UpdateResult {\n\t/** Root CID that was fetched */\n\tcid: CID\n\t/** All applogs decoded from the chain */\n\tapplogs: Applog[]\n\t/** Count of applogs actually inserted (not duplicates) */\n\tinsertedCount: number\n\t/** Number of snapshots traversed */\n\tsnapshotCount: number\n}\n\n/**\n * Simple in-memory block store used during snapshot chain fetch.\n */\ninterface MemoryBlockStore {\n\tget(cid: CID): Uint8Array | undefined\n\tput(cid: CID, bytes: Uint8Array): void\n}\n\nfunction createMemoryBlockStore(): MemoryBlockStore {\n\tconst blocks = new Map<string, Uint8Array>()\n\treturn {\n\t\tget(cid: CID) {\n\t\t\treturn blocks.get(cid.toV1().toString())\n\t\t},\n\t\tput(cid: CID, bytes: Uint8Array) {\n\t\t\tblocks.set(cid.toV1().toString(), bytes)\n\t\t},\n\t}\n}\n\nasync function getDecodedBlock<T>(blockStore: MemoryBlockStore, cid: CID): Promise<T | null> {\n\tconst bytes = blockStore.get(cid)\n\tif (!bytes) return null\n\treturn dagJson.decode(bytes) as T\n}\n\n/**\n * Fetch snapshot chain from CID using a BlockRetriever, decode applogs, insert into thread.\n * Stops before excludeSnapshotCID if provided (incremental update).\n *\n * @param thread - WriteableThread to insert applogs into\n * @param cid - Root CID of the snapshot to start from\n * @param retriever - BlockRetriever for fetching blocks\n * @param options - Optional configuration\n * @returns UpdateResult with applogs and counts\n */\nexport async function updateThreadFromSnapshot(\n\tthread: WriteableThread,\n\tcid: CID,\n\tretriever: BlockRetriever,\n\toptions?: UpdateOptions\n): Promise<UpdateResult> {\n\tconst { excludeSnapshotCID, maxDepth = 100 } = options ?? {}\n\n\tDEBUG('[updateThreadFromSnapshot] starting from', cid.toString(), {\n\t\texcludeSnapshotCID: excludeSnapshotCID?.toString(),\n\t\tmaxDepth,\n\t})\n\n\tconst blockStore = createMemoryBlockStore()\n\tconst visited = new Set<string>()\n\tlet currentCID: CID | undefined = cid\n\tlet snapshotCount = 0\n\tconst allApplogs: Applog[] = []\n\n\twhile (currentCID && snapshotCount < maxDepth) {\n\t\tconst cidStr = currentCID.toString()\n\n\t\t// Loop detection\n\t\tif (visited.has(cidStr)) {\n\t\t\tthrow ERROR('[updateThreadFromSnapshot] snapshot chain has a loop', {\n\t\t\t\tcurrentCID: cidStr,\n\t\t\t\tvisited: [...visited],\n\t\t\t})\n\t\t}\n\t\tvisited.add(cidStr)\n\n\t\t// Check stop condition BEFORE fetching content\n\t\tif (excludeSnapshotCID && areCidsEqual(currentCID, excludeSnapshotCID)) {\n\t\t\tDEBUG('[updateThreadFromSnapshot] reached excludeSnapshotCID, stopping', excludeSnapshotCID.toString())\n\t\t\tbreak\n\t\t}\n\n\t\t// 1. Fetch root block\n\t\tDEBUG('[updateThreadFromSnapshot] fetching root block', cidStr)\n\t\tconst rootBytes = await retriever.getBlock(currentCID)\n\t\tblockStore.put(currentCID, rootBytes)\n\n\t\t// Parse root to get applogs, info, prev CIDs\n\t\tconst root = dagJson.decode(rootBytes) as SnapRootBlock\n\n\t\t// 2. Fetch applogs DAG\n\t\tDEBUG('[updateThreadFromSnapshot] fetching applogs', root.applogs.toString())\n\t\tfor await (const { cid: blockCid, bytes } of retriever.getDag(root.applogs)) {\n\t\t\tblockStore.put(blockCid, bytes)\n\t\t}\n\n\t\t// 3. Fetch info DAG\n\t\tDEBUG('[updateThreadFromSnapshot] fetching info', root.info.toString())\n\t\tfor await (const { cid: blockCid, bytes } of retriever.getDag(root.info)) {\n\t\t\tblockStore.put(blockCid, bytes)\n\t\t}\n\n\t\t// Decode applogs from this snapshot\n\t\tconst applogsBlock = await getDecodedBlock<SnapBlockLogsOrChunks>(blockStore, root.applogs)\n\t\tif (!applogsBlock) {\n\t\t\tthrow ERROR('[updateThreadFromSnapshot] applogs block not found', { cid: root.applogs.toString() })\n\t\t}\n\n\t\t// Use the unchunk helper which handles both chunked and non-chunked formats\n\t\tconst applogCIDs = await unchunkApplogsBlock(applogsBlock, {\n\t\t\tget: async (cid: CID) => blockStore.get(cid)!,\n\t\t})\n\n\t\t// Resolve each applog CID to actual applog data\n\t\tfor (const applogCID of applogCIDs) {\n\t\t\tconst applog = await getDecodedBlock<Applog>(blockStore, applogCID)\n\t\t\tif (!applog) {\n\t\t\t\tWARN('[updateThreadFromSnapshot] applog not found:', applogCID.toString())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Normalize pv field if it's a CID instance\n\t\t\tif ((applog.pv as any) instanceof CID) {\n\t\t\t\tapplog.pv = (applog.pv as any as CID).toV1().toString()\n\t\t\t}\n\t\t\tallApplogs.push({\n\t\t\t\t...applog,\n\t\t\t\tcid: applogCID.toV1().toString(),\n\t\t\t})\n\t\t}\n\n\t\tsnapshotCount++\n\t\tcurrentCID = root.prev // Move to previous snapshot\n\t}\n\n\tDEBUG('[updateThreadFromSnapshot] fetched', {\n\t\tsnapshotCount,\n\t\tapplogCount: allApplogs.length,\n\t\trootCID: cid.toString(),\n\t})\n\n\t// Deduplicate applogs (in case of overlapping snapshots)\n\tconst deduplicated = removeDuplicateAppLogs(allApplogs, 'cleanup')\n\n\t// Insert into thread\n\tconst inserted = thread.insertMissing(deduplicated, false)\n\n\tDEBUG('[updateThreadFromSnapshot] inserted', {\n\t\tinsertedCount: inserted.length,\n\t\tduplicateCount: deduplicated.length - inserted.length,\n\t})\n\n\treturn {\n\t\tcid,\n\t\tapplogs: deduplicated,\n\t\tinsertedCount: inserted.length,\n\t\tsnapshotCount,\n\t}\n}\n"],"mappings":"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","names":["cid"]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
arrayIfSingle,
|
|
3
|
+
require_typebox
|
|
4
|
+
} from "./chunk-HYMC7W6S.min.js";
|
|
1
5
|
import {
|
|
2
6
|
Reaction,
|
|
3
7
|
action,
|
|
@@ -21,10 +25,6 @@ import {
|
|
|
21
25
|
trace,
|
|
22
26
|
untracked
|
|
23
27
|
} from "./chunk-KEHU7HGZ.min.js";
|
|
24
|
-
import {
|
|
25
|
-
arrayIfSingle,
|
|
26
|
-
require_typebox
|
|
27
|
-
} from "./chunk-HYMC7W6S.min.js";
|
|
28
28
|
import {
|
|
29
29
|
__commonJS,
|
|
30
30
|
__export,
|
|
@@ -11253,4 +11253,4 @@ lodash-es/lodash.js:
|
|
|
11253
11253
|
@noble/hashes/utils.js:
|
|
11254
11254
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
11255
11255
|
*/
|
|
11256
|
-
//# sourceMappingURL=chunk-
|
|
11256
|
+
//# sourceMappingURL=chunk-3Y5KUHV5.min.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
cyrb53hash,
|
|
3
3
|
ensureTsPvAndFinalizeApplog,
|
|
4
4
|
g
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
6
6
|
|
|
7
7
|
// src/pubsub/pub-pull.ts
|
|
8
8
|
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
|
|
@@ -37,4 +37,4 @@ export {
|
|
|
37
37
|
isSubscription,
|
|
38
38
|
agentToShortHash
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-6KONUEQB.min.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
createDebugName,
|
|
5
5
|
g,
|
|
6
6
|
observableArrayMap
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
8
8
|
import {
|
|
9
9
|
autorun,
|
|
10
10
|
comparer,
|
|
@@ -62,4 +62,4 @@ export {
|
|
|
62
62
|
includes,
|
|
63
63
|
includedIn
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-6XE4TT2P.min.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-QPGEBDMJ.min.js";
|
|
4
4
|
import {
|
|
5
5
|
lastWriteWins
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SFDNH2ID.min.js";
|
|
7
7
|
import {
|
|
8
8
|
CID,
|
|
9
9
|
areCidsEqual,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
rollingFilter,
|
|
17
17
|
src_exports,
|
|
18
18
|
wrapper_default
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
20
20
|
import {
|
|
21
21
|
__commonJS,
|
|
22
22
|
__toESM
|
|
@@ -4119,4 +4119,4 @@ export {
|
|
|
4119
4119
|
carFromBlob,
|
|
4120
4120
|
streamReaderToIterable
|
|
4121
4121
|
};
|
|
4122
|
-
//# sourceMappingURL=chunk-
|
|
4122
|
+
//# sourceMappingURL=chunk-GH2FXZ3U.min.js.map
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
rollingMapper,
|
|
17
17
|
sortApplogsByTs,
|
|
18
18
|
wrapper_default
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
20
20
|
import {
|
|
21
21
|
action,
|
|
22
22
|
autorun,
|
|
@@ -507,4 +507,4 @@ export {
|
|
|
507
507
|
withTimeout,
|
|
508
508
|
throwOnTimeout
|
|
509
509
|
};
|
|
510
|
-
//# sourceMappingURL=chunk-
|
|
510
|
+
//# sourceMappingURL=chunk-SFDNH2ID.min.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
areCidsEqual,
|
|
4
4
|
decode,
|
|
5
5
|
g
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
7
7
|
|
|
8
8
|
// src/ipfs/fetch-snapshot-chain.ts
|
|
9
9
|
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
|
|
@@ -67,4 +67,4 @@ function createMemoryBlockStore() {
|
|
|
67
67
|
export {
|
|
68
68
|
fetchSnapshotChainUntil
|
|
69
69
|
};
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-XR2SGDQV.min.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
|
package/dist/index.min.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
import "./chunk-5MMGBK2U.min.js";
|
|
1
2
|
import "./chunk-7IDQIMQO.min.js";
|
|
2
3
|
import {
|
|
3
4
|
fetchSnapshotChainUntil
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-XR2SGDQV.min.js";
|
|
5
6
|
import {
|
|
6
7
|
agentToShortHash,
|
|
7
8
|
integratePub,
|
|
8
9
|
isShare,
|
|
9
10
|
isSubscription
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6KONUEQB.min.js";
|
|
12
|
+
import {
|
|
13
|
+
includedIn,
|
|
14
|
+
includes,
|
|
15
|
+
queryDivergencesByPrev
|
|
16
|
+
} from "./chunk-6XE4TT2P.min.js";
|
|
17
|
+
import {
|
|
18
|
+
updateThreadFromSnapshot
|
|
19
|
+
} from "./chunk-3EVHRFPN.min.js";
|
|
11
20
|
import {
|
|
12
21
|
carFromBlob,
|
|
13
22
|
chunkApplogs,
|
|
@@ -23,13 +32,8 @@ import {
|
|
|
23
32
|
prepareSnapshotForPush,
|
|
24
33
|
streamReaderToIterable,
|
|
25
34
|
unchunkApplogsBlock
|
|
26
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-GH2FXZ3U.min.js";
|
|
27
36
|
import "./chunk-QPGEBDMJ.min.js";
|
|
28
|
-
import {
|
|
29
|
-
includedIn,
|
|
30
|
-
includes,
|
|
31
|
-
queryDivergencesByPrev
|
|
32
|
-
} from "./chunk-MSRY6NTA.min.js";
|
|
33
37
|
import {
|
|
34
38
|
QueryNode,
|
|
35
39
|
QueryResult,
|
|
@@ -56,7 +60,7 @@ import {
|
|
|
56
60
|
throwOnTimeout,
|
|
57
61
|
withTimeout,
|
|
58
62
|
withoutDeleted
|
|
59
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-SFDNH2ID.min.js";
|
|
60
64
|
import {
|
|
61
65
|
AppLogNoCidTB,
|
|
62
66
|
AppLogNoCidTBC,
|
|
@@ -155,9 +159,7 @@ import {
|
|
|
155
159
|
variableNameWithoutQuestionmark,
|
|
156
160
|
withPvFrom,
|
|
157
161
|
withTs
|
|
158
|
-
} from "./chunk-
|
|
159
|
-
import "./chunk-KEHU7HGZ.min.js";
|
|
160
|
-
import "./chunk-5MMGBK2U.min.js";
|
|
162
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
161
163
|
import {
|
|
162
164
|
BOOL,
|
|
163
165
|
Bool,
|
|
@@ -170,6 +172,7 @@ import {
|
|
|
170
172
|
arrayIfSingle,
|
|
171
173
|
checkParityTB
|
|
172
174
|
} from "./chunk-HYMC7W6S.min.js";
|
|
175
|
+
import "./chunk-KEHU7HGZ.min.js";
|
|
173
176
|
import "./chunk-PHITDXZT.min.js";
|
|
174
177
|
export {
|
|
175
178
|
AppLogNoCidTB,
|
|
@@ -321,6 +324,7 @@ export {
|
|
|
321
324
|
tsNearlySame,
|
|
322
325
|
unchunkApplogsBlock,
|
|
323
326
|
uniqueEnFromAppLogs,
|
|
327
|
+
updateThreadFromSnapshot,
|
|
324
328
|
variableNameWithoutQuestionmark,
|
|
325
329
|
withPvFrom,
|
|
326
330
|
withTimeout,
|
package/dist/ipfs.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchSnapshotChainUntil
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XR2SGDQV.min.js";
|
|
4
4
|
import {
|
|
5
5
|
carFromBlob,
|
|
6
6
|
decodePubFromBlocks,
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
makeCarBlob,
|
|
11
11
|
makeCarOut,
|
|
12
12
|
streamReaderToIterable
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GH2FXZ3U.min.js";
|
|
14
14
|
import "./chunk-QPGEBDMJ.min.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-SFDNH2ID.min.js";
|
|
16
16
|
import {
|
|
17
17
|
MULTICODEC_IPNS_KEY,
|
|
18
18
|
areCidsEqual,
|
|
@@ -28,9 +28,9 @@ import {
|
|
|
28
28
|
prepareForPub,
|
|
29
29
|
toIpnsString,
|
|
30
30
|
tryParseCID
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-KEHU7HGZ.min.js";
|
|
31
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
33
32
|
import "./chunk-HYMC7W6S.min.js";
|
|
33
|
+
import "./chunk-KEHU7HGZ.min.js";
|
|
34
34
|
import "./chunk-PHITDXZT.min.js";
|
|
35
35
|
export {
|
|
36
36
|
MULTICODEC_IPNS_KEY,
|
package/dist/pubsub.min.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
integratePub,
|
|
4
4
|
isShare,
|
|
5
5
|
isSubscription
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6KONUEQB.min.js";
|
|
7
7
|
import {
|
|
8
8
|
chunkApplogs,
|
|
9
9
|
encodeSnapshotApplogsAsCar,
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
isSnapBlockChunks,
|
|
12
12
|
prepareSnapshotForPush,
|
|
13
13
|
unchunkApplogsBlock
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GH2FXZ3U.min.js";
|
|
15
15
|
import "./chunk-QPGEBDMJ.min.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-KEHU7HGZ.min.js";
|
|
16
|
+
import "./chunk-SFDNH2ID.min.js";
|
|
17
|
+
import "./chunk-3Y5KUHV5.min.js";
|
|
19
18
|
import "./chunk-HYMC7W6S.min.js";
|
|
19
|
+
import "./chunk-KEHU7HGZ.min.js";
|
|
20
20
|
import "./chunk-PHITDXZT.min.js";
|
|
21
21
|
export {
|
|
22
22
|
agentToShortHash,
|
package/dist/query.min.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
includedIn,
|
|
3
3
|
includes,
|
|
4
4
|
queryDivergencesByPrev
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6XE4TT2P.min.js";
|
|
6
6
|
import {
|
|
7
7
|
QueryNode,
|
|
8
8
|
QueryResult,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
throwOnTimeout,
|
|
30
30
|
withTimeout,
|
|
31
31
|
withoutDeleted
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-SFDNH2ID.min.js";
|
|
33
33
|
import {
|
|
34
34
|
applogThreadComparer,
|
|
35
35
|
autorunButAlsoImmediately,
|
|
@@ -45,9 +45,9 @@ import {
|
|
|
45
45
|
prettifyThreadName,
|
|
46
46
|
queryNodesComparer,
|
|
47
47
|
rootsQueries
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-KEHU7HGZ.min.js";
|
|
48
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
50
49
|
import "./chunk-HYMC7W6S.min.js";
|
|
50
|
+
import "./chunk-KEHU7HGZ.min.js";
|
|
51
51
|
import "./chunk-PHITDXZT.min.js";
|
|
52
52
|
export {
|
|
53
53
|
QueryNode,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/retrieve/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CID } from 'multiformats/cid';
|
|
2
|
+
import type { Applog } from '../applog/datom-types';
|
|
3
|
+
import type { WriteableThread } from '../thread/writeable';
|
|
4
|
+
/**
|
|
5
|
+
* Block retrieval abstraction - fetch or get blocks.
|
|
6
|
+
* Implemented by gateway retriever or local blockstore.
|
|
7
|
+
*/
|
|
8
|
+
export interface BlockRetriever {
|
|
9
|
+
/** Get single block by CID */
|
|
10
|
+
getBlock(cid: CID): Promise<Uint8Array>;
|
|
11
|
+
/** Get all blocks in DAG rooted at CID (for applogs/info sub-DAGs) */
|
|
12
|
+
getDag(cid: CID): AsyncIterable<{
|
|
13
|
+
cid: CID;
|
|
14
|
+
bytes: Uint8Array;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Options for updateThreadFromSnapshot
|
|
19
|
+
*/
|
|
20
|
+
export interface UpdateOptions {
|
|
21
|
+
/** CID of last included snapshot - exclude this and older snapshots */
|
|
22
|
+
excludeSnapshotCID?: CID;
|
|
23
|
+
/** Maximum number of snapshots to traverse (default: 100) */
|
|
24
|
+
maxDepth?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Result from updateThreadFromSnapshot
|
|
28
|
+
*/
|
|
29
|
+
export interface UpdateResult {
|
|
30
|
+
/** Root CID that was fetched */
|
|
31
|
+
cid: CID;
|
|
32
|
+
/** All applogs decoded from the chain */
|
|
33
|
+
applogs: Applog[];
|
|
34
|
+
/** Count of applogs actually inserted (not duplicates) */
|
|
35
|
+
insertedCount: number;
|
|
36
|
+
/** Number of snapshots traversed */
|
|
37
|
+
snapshotCount: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Fetch snapshot chain from CID using a BlockRetriever, decode applogs, insert into thread.
|
|
41
|
+
* Stops before excludeSnapshotCID if provided (incremental update).
|
|
42
|
+
*
|
|
43
|
+
* @param thread - WriteableThread to insert applogs into
|
|
44
|
+
* @param cid - Root CID of the snapshot to start from
|
|
45
|
+
* @param retriever - BlockRetriever for fetching blocks
|
|
46
|
+
* @param options - Optional configuration
|
|
47
|
+
* @returns UpdateResult with applogs and counts
|
|
48
|
+
*/
|
|
49
|
+
export declare function updateThreadFromSnapshot(thread: WriteableThread, cid: CID, retriever: BlockRetriever, options?: UpdateOptions): Promise<UpdateResult>;
|
|
50
|
+
//# sourceMappingURL=update-thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-thread.d.ts","sourceRoot":"","sources":["../../src/retrieve/update-thread.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAKnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAI1D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IACvC,sEAAsE;IACtE,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAAC;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC,CAAA;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,GAAG,CAAA;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,gCAAgC;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,yCAAyC;IACzC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAA;IACrB,oCAAoC;IACpC,aAAa,EAAE,MAAM,CAAA;CACrB;AA4BD;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAC7C,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,cAAc,EACzB,OAAO,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CA2GvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve.d.ts","sourceRoot":"","sources":["../src/retrieve.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
updateThreadFromSnapshot
|
|
3
|
+
} from "./chunk-3EVHRFPN.min.js";
|
|
4
|
+
import "./chunk-GH2FXZ3U.min.js";
|
|
5
|
+
import "./chunk-QPGEBDMJ.min.js";
|
|
6
|
+
import "./chunk-SFDNH2ID.min.js";
|
|
7
|
+
import "./chunk-3Y5KUHV5.min.js";
|
|
8
|
+
import "./chunk-HYMC7W6S.min.js";
|
|
9
|
+
import "./chunk-KEHU7HGZ.min.js";
|
|
10
|
+
import "./chunk-PHITDXZT.min.js";
|
|
11
|
+
export {
|
|
12
|
+
updateThreadFromSnapshot
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=retrieve.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/thread.min.js
CHANGED
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
rollingFilter,
|
|
23
23
|
rollingMapper,
|
|
24
24
|
simpleApplogMapper
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-KEHU7HGZ.min.js";
|
|
25
|
+
} from "./chunk-3Y5KUHV5.min.js";
|
|
27
26
|
import "./chunk-HYMC7W6S.min.js";
|
|
27
|
+
import "./chunk-KEHU7HGZ.min.js";
|
|
28
28
|
import "./chunk-PHITDXZT.min.js";
|
|
29
29
|
export {
|
|
30
30
|
MappedThread,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wovin/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.min.js",
|
|
6
6
|
"module": "./dist/index.min.js",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"import": "./dist/query.min.js",
|
|
28
28
|
"types": "./dist/query.d.ts"
|
|
29
29
|
},
|
|
30
|
+
"./retrieve": {
|
|
31
|
+
"import": "./dist/retrieve.min.js",
|
|
32
|
+
"types": "./dist/retrieve.d.ts"
|
|
33
|
+
},
|
|
30
34
|
"./thread": {
|
|
31
35
|
"import": "./dist/thread.min.js",
|
|
32
36
|
"types": "./dist/thread.d.ts"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|