@wovin/core 0.1.8 → 0.1.11
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-utils.d.ts +7 -1
- package/dist/applog/applog-utils.d.ts.map +1 -1
- package/dist/applog.min.js +1 -1
- package/dist/{chunk-MDWDKXLU.min.js → chunk-5LVRXH2F.min.js} +2 -2
- package/dist/{chunk-BEFJYVDW.min.js → chunk-5T5HSBRE.min.js} +2 -2
- package/dist/{chunk-AOM4CWTC.min.js → chunk-CMYPWG2N.min.js} +60 -7
- package/dist/{chunk-AOM4CWTC.min.js.map → chunk-CMYPWG2N.min.js.map} +1 -1
- package/dist/{chunk-4APURYN7.min.js → chunk-L5ONTLHW.min.js} +2 -2
- package/dist/{chunk-PANN7XTE.min.js → chunk-MSRY6NTA.min.js} +2 -2
- package/dist/{chunk-B6GB52LJ.min.js → chunk-ULDVYEPF.min.js} +3 -3
- 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 +12 -1
- package/dist/thread/writeable.d.ts.map +1 -1
- package/dist/thread.min.js +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-MDWDKXLU.min.js.map → chunk-5LVRXH2F.min.js.map} +0 -0
- /package/dist/{chunk-BEFJYVDW.min.js.map → chunk-5T5HSBRE.min.js.map} +0 -0
- /package/dist/{chunk-4APURYN7.min.js.map → chunk-L5ONTLHW.min.js.map} +0 -0
- /package/dist/{chunk-PANN7XTE.min.js.map → chunk-MSRY6NTA.min.js.map} +0 -0
- /package/dist/{chunk-B6GB52LJ.min.js.map → chunk-ULDVYEPF.min.js.map} +0 -0
|
@@ -8,7 +8,13 @@ export declare function sortApplogsByTs(appLogArray: Applog[], dir?: 'asc' | 'de
|
|
|
8
8
|
export declare const isTsBefore: (log: Applog, logToCompare: Applog) => boolean;
|
|
9
9
|
export declare const uniqueEnFromAppLogs: (appLogArray: Applog[]) => string[];
|
|
10
10
|
export declare const areApplogsEqual: (logA: Applog, logB: Applog) => boolean;
|
|
11
|
-
export
|
|
11
|
+
export type RemoveDuplicateAppLogsMode = 'safety' | 'cleanup';
|
|
12
|
+
/**
|
|
13
|
+
* Deduplicate applogs by CID.
|
|
14
|
+
* - safety: fast duplicate check; returns original array if no duplicates found.
|
|
15
|
+
* - cleanup: optimized for merged arrays with likely duplicates.
|
|
16
|
+
*/
|
|
17
|
+
export declare const removeDuplicateAppLogs: (appLogArray: Applog[], mode?: RemoveDuplicateAppLogsMode) => Applog[];
|
|
12
18
|
export declare const getHashID: (stringifiable: any, lngth?: number) => string;
|
|
13
19
|
export declare function isVariable(x: any): x is string;
|
|
14
20
|
export declare function variableNameWithoutQuestionmark(str: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applog-utils.d.ts","sourceRoot":"","sources":["../../src/applog/applog-utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACX,MAAM,EAEN,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,cAAc,EACd,MAAM,eAAe,CAAA;AAItB,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,MAAK,KAAK,GAAG,MAAc,WAGpD,CAAA;AACrC,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,EAAE,MAAM,MAAM,EAAE,MAAM,MAAM,YAExE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,MAAK,KAAK,GAAG,MAAc,WAA6C,CAAA;AACvI,eAAO,MAAM,oBAAoB,yCAAwC,CAAA;AAEzE,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,KAAK,GAAG,MAAc,YAEjF;AACD,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,E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AAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,YAAuD,CAAA;AAUhH,eAAO,MAAM,UAAU,GACtB,KAAK,MAAM,EACX,YAAS,EACT,WAAW,MAAM,WAqBjB,CAAA;AACD,wBAAgB,yBAAyB,CAAC,IAAI,KAAA,EAAE,IAAI,KAAA,WAenD;AACD,wBAAgB,UAAU,IAAI,MAAM,CAGnC"}
|
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-CMYPWG2N.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-5LVRXH2F.min.js.map
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
rollingMapper,
|
|
17
17
|
sortApplogsByTs,
|
|
18
18
|
wrapper_default
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CMYPWG2N.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-5T5HSBRE.min.js.map
|
|
@@ -10199,8 +10199,12 @@ function sortApplogsByTs(appLogArray, dir = "asc") {
|
|
|
10199
10199
|
var isTsBefore = (log, logToCompare) => isBefore(new Date(log.ts), new Date(logToCompare.ts));
|
|
10200
10200
|
var uniqueEnFromAppLogs = (appLogArray) => [...new Set(appLogArray.map((eachLog) => eachLog.en))];
|
|
10201
10201
|
var areApplogsEqual = (logA, logB) => comparer.structural(logA, logB);
|
|
10202
|
-
var
|
|
10202
|
+
var warnMissingRemoveDuplicateMode = () => {
|
|
10203
|
+
WARN4(`[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior`);
|
|
10204
|
+
};
|
|
10205
|
+
var removeDuplicateAppLogsCleanup = (appLogArray) => {
|
|
10203
10206
|
const logMap = /* @__PURE__ */ new Map();
|
|
10207
|
+
const verboseEnabled = VERBOSE4.isEnabled;
|
|
10204
10208
|
for (const eachLog of appLogArray) {
|
|
10205
10209
|
if (!eachLog) {
|
|
10206
10210
|
ERROR4(`falsy entry in applogs`, appLogArray);
|
|
@@ -10211,14 +10215,52 @@ var removeDuplicateAppLogs = (appLogArray) => {
|
|
|
10211
10215
|
throw new Error(`applog with missing CID`);
|
|
10212
10216
|
}
|
|
10213
10217
|
const key = eachLog.cid;
|
|
10214
|
-
|
|
10215
|
-
|
|
10218
|
+
const existing = logMap.get(key);
|
|
10219
|
+
if (existing) {
|
|
10220
|
+
if (verboseEnabled) VERBOSE4(`Skipping duplicate applog:`, [existing, eachLog]);
|
|
10216
10221
|
} else {
|
|
10217
10222
|
logMap.set(key, eachLog);
|
|
10218
10223
|
}
|
|
10219
10224
|
}
|
|
10220
10225
|
return Array.from(logMap.values());
|
|
10221
10226
|
};
|
|
10227
|
+
var removeDuplicateAppLogsSafety = (appLogArray) => {
|
|
10228
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10229
|
+
const verboseEnabled = VERBOSE4.isEnabled;
|
|
10230
|
+
const existingByCid = verboseEnabled ? /* @__PURE__ */ new Map() : null;
|
|
10231
|
+
let result = null;
|
|
10232
|
+
let index = 0;
|
|
10233
|
+
for (const eachLog of appLogArray) {
|
|
10234
|
+
if (!eachLog) {
|
|
10235
|
+
ERROR4(`falsy entry in applogs`, appLogArray);
|
|
10236
|
+
throw new Error(`falsy entry in applogs`);
|
|
10237
|
+
}
|
|
10238
|
+
if (!eachLog.cid) {
|
|
10239
|
+
ERROR4(`applog with missing CID`, eachLog);
|
|
10240
|
+
throw new Error(`applog with missing CID`);
|
|
10241
|
+
}
|
|
10242
|
+
const key = eachLog.cid;
|
|
10243
|
+
if (seen.has(key)) {
|
|
10244
|
+
if (!result) {
|
|
10245
|
+
result = appLogArray.slice(0, index);
|
|
10246
|
+
}
|
|
10247
|
+
if (verboseEnabled) VERBOSE4(`Skipping duplicate applog:`, [existingByCid?.get(key), eachLog]);
|
|
10248
|
+
} else {
|
|
10249
|
+
seen.add(key);
|
|
10250
|
+
if (existingByCid) existingByCid.set(key, eachLog);
|
|
10251
|
+
if (result) result.push(eachLog);
|
|
10252
|
+
}
|
|
10253
|
+
index++;
|
|
10254
|
+
}
|
|
10255
|
+
return result ?? appLogArray;
|
|
10256
|
+
};
|
|
10257
|
+
var removeDuplicateAppLogs = (appLogArray, mode) => {
|
|
10258
|
+
if (!mode) {
|
|
10259
|
+
warnMissingRemoveDuplicateMode();
|
|
10260
|
+
return removeDuplicateAppLogsCleanup(appLogArray);
|
|
10261
|
+
}
|
|
10262
|
+
return mode === "safety" ? removeDuplicateAppLogsSafety(appLogArray) : removeDuplicateAppLogsCleanup(appLogArray);
|
|
10263
|
+
};
|
|
10222
10264
|
var getHashID = (stringifiable, lngth = 8) => cyrb53hash(wrapper_default(stringifiable), 31, lngth);
|
|
10223
10265
|
function isVariable(x2) {
|
|
10224
10266
|
return typeof x2 === "string" && x2.startsWith("?");
|
|
@@ -10502,7 +10544,7 @@ function joinThreads(threads) {
|
|
|
10502
10544
|
throw new Error(`falsy applogs of thread`);
|
|
10503
10545
|
}
|
|
10504
10546
|
return logs;
|
|
10505
|
-
}))
|
|
10547
|
+
}), "cleanup")
|
|
10506
10548
|
);
|
|
10507
10549
|
};
|
|
10508
10550
|
let initialMergeResult = untracked(() => fullJoin());
|
|
@@ -10891,13 +10933,24 @@ var WriteableThread = class extends Thread {
|
|
|
10891
10933
|
return this.insertRaw(missing) ?? [];
|
|
10892
10934
|
}
|
|
10893
10935
|
/**
|
|
10894
|
-
*
|
|
10936
|
+
* Insert raw applogs directly into the thread.
|
|
10937
|
+
*
|
|
10938
|
+
* STRICT VALIDATION: This method throws errors for:
|
|
10939
|
+
* - Duplicate applogs in input array (programming error)
|
|
10940
|
+
* - Invalid applogs (missing required fields)
|
|
10941
|
+
* - Applogs already in thread (programming error)
|
|
10942
|
+
*
|
|
10943
|
+
* For external imports where duplicates are expected, use removeDuplicateAppLogs(..., 'cleanup')
|
|
10944
|
+
* before calling this method.
|
|
10945
|
+
*
|
|
10946
|
+
* @param appLogsToInsert Must be deduplicated and validated. Needs to be mutable because it will be sorted
|
|
10895
10947
|
* (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
|
|
10948
|
+
* @throws Error if validation fails
|
|
10896
10949
|
*/
|
|
10897
10950
|
insertRaw(appLogsToInsert) {
|
|
10898
10951
|
DEBUG8(`[WriteableThread.insertRaw] ENTER - ${appLogsToInsert.length} applogs for thread "${this.name}"`);
|
|
10899
10952
|
DEBUG8(`[WriteableThread.insertRaw] About to deduplicate`);
|
|
10900
|
-
const deduplicated = removeDuplicateAppLogs(appLogsToInsert);
|
|
10953
|
+
const deduplicated = removeDuplicateAppLogs(appLogsToInsert, "safety");
|
|
10901
10954
|
if (deduplicated.length !== appLogsToInsert.length) {
|
|
10902
10955
|
throw ERROR8(`[insertRaw] duplicate applogs passed: ${appLogsToInsert.length - deduplicated.length}`, {
|
|
10903
10956
|
appLogsToInsert,
|
|
@@ -11200,4 +11253,4 @@ lodash-es/lodash.js:
|
|
|
11200
11253
|
@noble/hashes/utils.js:
|
|
11201
11254
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
11202
11255
|
*/
|
|
11203
|
-
//# sourceMappingURL=chunk-
|
|
11256
|
+
//# sourceMappingURL=chunk-CMYPWG2N.min.js.map
|