@wovin/core 0.1.0 → 0.1.2
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/applog-helpers.d.ts.map +1 -1
- package/dist/applog.min.js +1 -1
- package/dist/{chunk-VDYG5VHX.min.js → chunk-3KCQUPCP.min.js} +2 -2
- package/dist/{chunk-IHGAJTEQ.min.js → chunk-MGJYJPOD.min.js} +2 -2
- package/dist/{chunk-UZBCM3UI.min.js → chunk-S4ODHUJZ.min.js} +47 -5
- package/dist/{chunk-UZBCM3UI.min.js.map → chunk-S4ODHUJZ.min.js.map} +1 -1
- package/dist/{chunk-KVPEUWWR.min.js → chunk-VL3EEL3J.min.js} +2 -2
- package/dist/{chunk-SIIQEX77.min.js → chunk-YOTOHQPL.min.js} +3 -3
- package/dist/{chunk-E4BAQ5JJ.min.js → chunk-ZE3FVUCH.min.js} +2 -2
- package/dist/index.min.js +6 -6
- package/dist/ipfs.min.js +4 -4
- package/dist/pubsub.min.js +4 -4
- package/dist/query.min.js +3 -3
- package/dist/thread/writeable.d.ts.map +1 -1
- package/dist/thread.min.js +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-VDYG5VHX.min.js.map → chunk-3KCQUPCP.min.js.map} +0 -0
- /package/dist/{chunk-IHGAJTEQ.min.js.map → chunk-MGJYJPOD.min.js.map} +0 -0
- /package/dist/{chunk-KVPEUWWR.min.js.map → chunk-VL3EEL3J.min.js.map} +0 -0
- /package/dist/{chunk-SIIQEX77.min.js.map → chunk-YOTOHQPL.min.js.map} +0 -0
- /package/dist/{chunk-E4BAQ5JJ.min.js.map → chunk-ZE3FVUCH.min.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applog-helpers.d.ts","sourceRoot":"","sources":["../../src/applog/applog-helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkC,YAAY,EAAiB,MAAM,EAAqB,MAAM,WAAW,CAAA;AAClH,OAAO,EAAE,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AAe,EAAE,EAAE,EAAE,SAAS;QAP8B,SAAS;EAShG;AACD,wBAAgB,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,GAAmB,IAAI,eA8BlG;AACD,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,gBAwCzD"}
|
package/dist/applog.min.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
cyrb53hash,
|
|
3
3
|
ensureTsPvAndFinalizeApplog,
|
|
4
4
|
g
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-S4ODHUJZ.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-3KCQUPCP.min.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
areCidsEqual,
|
|
4
4
|
decode,
|
|
5
5
|
g
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S4ODHUJZ.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-MGJYJPOD.min.js.map
|
|
@@ -10421,25 +10421,38 @@ function dateNowIso() {
|
|
|
10421
10421
|
// src/applog/applog-helpers.ts
|
|
10422
10422
|
var { WARN: WARN5, LOG: LOG5, DEBUG: DEBUG5, VERBOSE: VERBOSE5, ERROR: ERROR5 } = g.setup(g.INFO);
|
|
10423
10423
|
function ensureTsPvAndFinalizeApplogs(appLogsToInsert, threadForPv) {
|
|
10424
|
+
DEBUG5(`[ensureTsPvAndFinalizeApplogs] ENTER - ${appLogsToInsert.length} applogs, thread size=${threadForPv.size}`);
|
|
10424
10425
|
const ts = dateNowIso();
|
|
10425
10426
|
const currentThread = threadForPv;
|
|
10426
|
-
|
|
10427
|
-
|
|
10427
|
+
DEBUG5(`[ensureTsPvAndFinalizeApplogs] About to map over applogs`);
|
|
10428
|
+
const mapped = appLogsToInsert.map((log, idx) => {
|
|
10429
|
+
DEBUG5(`[ensureTsPvAndFinalizeApplogs] Processing applog ${idx + 1}/${appLogsToInsert.length}`);
|
|
10430
|
+
const result = finalizeApplogForInsert(log, { ts, threadForPv: currentThread });
|
|
10431
|
+
DEBUG5(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${idx + 1}/${appLogsToInsert.length}`);
|
|
10432
|
+
return result;
|
|
10428
10433
|
});
|
|
10434
|
+
DEBUG5(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${mapped.length} applogs`);
|
|
10429
10435
|
return mapped;
|
|
10430
10436
|
}
|
|
10431
10437
|
function ensureTsPvAndFinalizeApplog(applogToInsert, threadForPv) {
|
|
10432
10438
|
return ensureTsPvAndFinalizeApplogs([applogToInsert], threadForPv)[0];
|
|
10433
10439
|
}
|
|
10434
10440
|
function finalizeApplogForInsert(log, { ts, threadForPv } = {}) {
|
|
10441
|
+
DEBUG5(`[finalizeApplogForInsert] ENTER - en=${log.en}, at=${log.at}`);
|
|
10442
|
+
DEBUG5(`[finalizeApplogForInsert] About to call withTs`);
|
|
10435
10443
|
const logWithTs = withTs(log, ts ?? dateNowIso());
|
|
10444
|
+
DEBUG5(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${threadForPv?.size ?? "null"})`);
|
|
10436
10445
|
const logWithPv = withPvFrom(logWithTs, threadForPv);
|
|
10446
|
+
DEBUG5(`[finalizeApplogForInsert] About to call encodeApplogAndGetCid`);
|
|
10437
10447
|
const cid = encodeApplogAndGetCid(logWithPv).toString();
|
|
10448
|
+
DEBUG5(`[finalizeApplogForInsert] CID created: ${cid}`);
|
|
10438
10449
|
if (log.cid && log.cid !== cid) WARN5(`[finalizeApplogForInsert] overwriting wrong CID`, { log, cid, logWithPv });
|
|
10439
10450
|
const logWithCid = { ...logWithPv, cid };
|
|
10451
|
+
DEBUG5(`[finalizeApplogForInsert] About to validate applog`);
|
|
10440
10452
|
if (!isValidApplog(logWithCid)) {
|
|
10441
10453
|
throw ERROR5(`Bogus Applog ${JSON.stringify(logWithCid)}`, getApplogTypeErrors(logWithCid));
|
|
10442
10454
|
}
|
|
10455
|
+
DEBUG5(`[finalizeApplogForInsert] EXIT - CID=${cid}`);
|
|
10443
10456
|
return Object.freeze(logWithCid);
|
|
10444
10457
|
}
|
|
10445
10458
|
function hasAg(log) {
|
|
@@ -10455,17 +10468,26 @@ function withTs(log, ts) {
|
|
|
10455
10468
|
return hasTs(log) ? log : { ...log, ts };
|
|
10456
10469
|
}
|
|
10457
10470
|
function withPvFrom(log, thread) {
|
|
10458
|
-
|
|
10471
|
+
DEBUG5(`[withPvFrom] ENTER - en=${log.en}, at=${log.at}, hasPv=${log.pv !== void 0}`);
|
|
10472
|
+
if (log.pv !== void 0) {
|
|
10473
|
+
DEBUG5(`[withPvFrom] EXIT early - pv already set`);
|
|
10474
|
+
return log;
|
|
10475
|
+
}
|
|
10459
10476
|
if (!thread) {
|
|
10460
10477
|
if (!hasPv(log)) throw ERROR5(`[withPvFrom] no thread and no pv:`, log);
|
|
10478
|
+
DEBUG5(`[withPvFrom] EXIT - no thread, returning log with existing pv`);
|
|
10461
10479
|
return log;
|
|
10462
10480
|
} else {
|
|
10463
10481
|
const { en, at } = log;
|
|
10482
|
+
DEBUG5(`[withPvFrom] About to call thread.findLast for en=${en}, at=${at}, thread.size=${thread.size}`);
|
|
10464
10483
|
const prevLog = thread.findLast((l2) => l2.en == en && l2.at == at);
|
|
10484
|
+
DEBUG5(`[withPvFrom] findLast completed, found=${!!prevLog}`);
|
|
10485
|
+
DEBUG5(`[withPvFrom] About to check equality`);
|
|
10465
10486
|
if (objEqualByKeys(["en", "at", "vl", "ts", "ag"], log, prevLog)) {
|
|
10466
10487
|
throw ERROR5(`[withPvFrom] Same as previous:`, { log, pv: prevLog, thread });
|
|
10467
10488
|
}
|
|
10468
10489
|
const prevLogCid = (log.pv !== void 0 ? log.pv : prevLog?.cid) ?? null;
|
|
10490
|
+
DEBUG5(`[withPvFrom] EXIT - prevLogCid=${prevLogCid}`);
|
|
10469
10491
|
return { ...log, pv: prevLogCid };
|
|
10470
10492
|
}
|
|
10471
10493
|
}
|
|
@@ -10846,14 +10868,22 @@ var WriteableThread = class extends Thread {
|
|
|
10846
10868
|
return beforeCount - this.applogs.length;
|
|
10847
10869
|
}
|
|
10848
10870
|
insert(appLogsToInsert) {
|
|
10871
|
+
DEBUG8(`[WriteableThread.insert] ENTER - ${appLogsToInsert.length} applogs for thread "${this.name}"`);
|
|
10872
|
+
DEBUG8(`[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs`);
|
|
10849
10873
|
const mapped = ensureTsPvAndFinalizeApplogs(appLogsToInsert, this);
|
|
10850
|
-
|
|
10874
|
+
DEBUG8(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${mapped.length} applogs`);
|
|
10875
|
+
DEBUG8(`[WriteableThread.insert] About to call insertRaw`);
|
|
10876
|
+
const result = this.insertRaw(mapped);
|
|
10877
|
+
DEBUG8(`[WriteableThread.insert] insertRaw completed`);
|
|
10878
|
+
return result;
|
|
10851
10879
|
}
|
|
10852
10880
|
/**
|
|
10853
10881
|
* @param appLogsToInsert It needs to be mutable because it will be sorted
|
|
10854
10882
|
* (and if you need to clone it, so do it when you need to) - this is weird as TS is slathering type safety onto ducks
|
|
10855
10883
|
*/
|
|
10856
10884
|
insertRaw(appLogsToInsert) {
|
|
10885
|
+
DEBUG8(`[WriteableThread.insertRaw] ENTER - ${appLogsToInsert.length} applogs for thread "${this.name}"`);
|
|
10886
|
+
DEBUG8(`[WriteableThread.insertRaw] About to deduplicate`);
|
|
10857
10887
|
const deduplicated = removeDuplicateAppLogs(appLogsToInsert);
|
|
10858
10888
|
if (deduplicated.length !== appLogsToInsert.length) {
|
|
10859
10889
|
throw ERROR8(`[insertRaw] duplicate applogs passed: ${appLogsToInsert.length - deduplicated.length}`, {
|
|
@@ -10861,14 +10891,19 @@ var WriteableThread = class extends Thread {
|
|
|
10861
10891
|
deduplicated
|
|
10862
10892
|
});
|
|
10863
10893
|
}
|
|
10894
|
+
DEBUG8(`[WriteableThread.insertRaw] Deduplication done`);
|
|
10895
|
+
DEBUG8(`[WriteableThread.insertRaw] About to validate`);
|
|
10864
10896
|
const bogus = appLogsToInsert.filter((log) => !isValidApplog(log));
|
|
10865
10897
|
if (bogus.length) {
|
|
10866
10898
|
throw ERROR8(`[insertRaw] bogus applogs passed: ${bogus.length}`, { bogus });
|
|
10867
10899
|
}
|
|
10900
|
+
DEBUG8(`[WriteableThread.insertRaw] Validation done`);
|
|
10901
|
+
DEBUG8(`[WriteableThread.insertRaw] About to check for existing`);
|
|
10868
10902
|
const existing = appLogsToInsert.filter((log) => this.hasApplog(log, false));
|
|
10869
10903
|
if (existing.length) {
|
|
10870
10904
|
throw ERROR8(`[insertRaw] already existing applogs passed: ${existing.length}`, { existing });
|
|
10871
10905
|
}
|
|
10906
|
+
DEBUG8(`[WriteableThread.insertRaw] Existing check done`);
|
|
10872
10907
|
if (!appLogsToInsert.length) {
|
|
10873
10908
|
WARN8("[insertRaw] skipping empty insert empty logs array");
|
|
10874
10909
|
return;
|
|
@@ -10879,14 +10914,21 @@ var WriteableThread = class extends Thread {
|
|
|
10879
10914
|
appLogsToInsert.length === 1 ? appLogsToInsert[0] : appLogsToInsert,
|
|
10880
10915
|
{ ds: this }
|
|
10881
10916
|
);
|
|
10917
|
+
DEBUG8(`[WriteableThread.insertRaw] About to sort applogs`);
|
|
10882
10918
|
sortApplogsByTs(appLogsToInsert);
|
|
10883
10919
|
const sortNeeded = this._applogs.length && isTsBefore(appLogsToInsert[0], this._applogs[this._applogs.length - 1]);
|
|
10920
|
+
DEBUG8(`[WriteableThread.insertRaw] About to push to _applogs array`);
|
|
10884
10921
|
this._applogs.push(...appLogsToInsert);
|
|
10885
10922
|
if (sortNeeded) {
|
|
10923
|
+
DEBUG8(`[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)`);
|
|
10886
10924
|
sortApplogsByTs(this._applogs);
|
|
10887
10925
|
}
|
|
10926
|
+
DEBUG8(`[WriteableThread.insertRaw] About to notify subscribers`);
|
|
10888
10927
|
this.notifySubscribers({ added: appLogsToInsert, removed: null });
|
|
10928
|
+
DEBUG8(`[WriteableThread.insertRaw] Subscribers notified`);
|
|
10929
|
+
DEBUG8(`[WriteableThread.insertRaw] About to call persist (void - not awaited)`);
|
|
10889
10930
|
void this.persist(appLogsToInsert);
|
|
10931
|
+
DEBUG8(`[WriteableThread.insertRaw] EXIT - returning ${appLogsToInsert.length} applogs`);
|
|
10890
10932
|
return appLogsToInsert;
|
|
10891
10933
|
}
|
|
10892
10934
|
get readOnly() {
|
|
@@ -11134,4 +11176,4 @@ lodash-es/lodash.js:
|
|
|
11134
11176
|
@noble/hashes/utils.js:
|
|
11135
11177
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
11136
11178
|
*/
|
|
11137
|
-
//# sourceMappingURL=chunk-
|
|
11179
|
+
//# sourceMappingURL=chunk-S4ODHUJZ.min.js.map
|