@wovin/core 0.0.1-RC9 → 0.0.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 +23 -0
- package/dist/applog/applog-helpers.d.ts.map +1 -0
- package/dist/applog/applog-utils.d.ts +41 -0
- package/dist/applog/applog-utils.d.ts.map +1 -0
- package/dist/applog/datom-types.d.ts +84 -0
- package/dist/applog/datom-types.d.ts.map +1 -0
- package/dist/applog.d.ts +4 -70
- package/dist/applog.d.ts.map +1 -0
- package/dist/applog.min.js +2 -0
- package/dist/chunk-5R2ELTEJ.min.js +40 -0
- package/dist/chunk-5R2ELTEJ.min.js.map +1 -0
- package/dist/chunk-7IDQIMQO.min.js +1 -0
- package/dist/chunk-F3MRAJXL.min.js +2 -0
- package/dist/{types.js.map → chunk-F3MRAJXL.min.js.map} +1 -1
- package/dist/chunk-HHXZXKNM.min.js +7 -0
- package/dist/chunk-HHXZXKNM.min.js.map +1 -0
- package/dist/chunk-KESATLM4.min.js +8 -0
- package/dist/chunk-KESATLM4.min.js.map +1 -0
- package/dist/chunk-LECZSORU.min.js +2 -0
- package/dist/chunk-LECZSORU.min.js.map +1 -0
- package/dist/chunk-NGPPHX5A.min.js +2 -0
- package/dist/chunk-NGPPHX5A.min.js.map +1 -0
- package/dist/chunk-PL6CNZTW.min.js +2 -0
- package/dist/chunk-PL6CNZTW.min.js.map +1 -0
- package/dist/chunk-RPPZKO5L.min.js +1 -0
- package/dist/index.d.ts +8 -12
- package/dist/index.d.ts.map +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/dist/ipfs/car.d.ts +15 -0
- package/dist/ipfs/car.d.ts.map +1 -0
- package/dist/ipfs/ipfs-utils.d.ts +17 -0
- package/dist/ipfs/ipfs-utils.d.ts.map +1 -0
- package/dist/ipfs.d.ts +3 -36
- package/dist/ipfs.d.ts.map +1 -0
- package/dist/ipfs.min.js +2 -0
- package/dist/mobx/mobx-utils.d.ts +67 -0
- package/dist/mobx/mobx-utils.d.ts.map +1 -0
- package/dist/pubsub/connector.d.ts +7 -0
- package/dist/pubsub/connector.d.ts.map +1 -0
- package/dist/pubsub/publication.d.ts +6 -0
- package/dist/pubsub/publication.d.ts.map +1 -0
- package/dist/{pubsub.d.cts → pubsub/pubsub-types.d.ts} +7 -12
- package/dist/pubsub/pubsub-types.d.ts.map +1 -0
- package/dist/pubsub.d.ts +4 -41
- package/dist/pubsub.d.ts.map +1 -0
- package/dist/pubsub.min.js +2 -0
- package/dist/query/basic.d.ts +65 -0
- package/dist/query/basic.d.ts.map +1 -0
- package/dist/query/divergences.d.ts +12 -0
- package/dist/query/divergences.d.ts.map +1 -0
- package/dist/query/matchers.d.ts +4 -0
- package/dist/query/matchers.d.ts.map +1 -0
- package/dist/query.d.ts +5 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.min.js +2 -0
- package/dist/query.min.js.map +1 -0
- package/dist/stream/basic.d.ts +34 -0
- package/dist/stream/basic.d.ts.map +1 -0
- package/dist/stream/filters.d.ts +38 -0
- package/dist/stream/filters.d.ts.map +1 -0
- package/dist/{mapped-8h8bwRuM.d.ts → stream/mapped.d.ts} +5 -6
- package/dist/stream/mapped.d.ts.map +1 -0
- package/dist/{writeable-0WbsIiQn.d.cts → stream/writeable.d.ts} +7 -6
- package/dist/stream/writeable.d.ts.map +1 -0
- package/dist/stream.d.ts +5 -44
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.min.js +2 -0
- package/dist/stream.min.js.map +1 -0
- package/dist/types/typescript-utils.d.ts +33 -0
- package/dist/types/typescript-utils.d.ts.map +1 -0
- package/dist/types.d.ts +2 -4
- package/dist/types.d.ts.map +1 -0
- package/dist/types.min.js +2 -0
- package/dist/types.min.js.map +1 -0
- package/dist/utils.d.ts +1 -2
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.min.js +1 -0
- package/dist/utils.min.js.map +1 -0
- package/package.json +80 -46
- package/dist/applog.cjs +0 -85
- package/dist/applog.cjs.map +0 -1
- package/dist/applog.d.cts +0 -70
- package/dist/applog.js +0 -85
- package/dist/chunk-F3FYYIAV.js +0 -11
- package/dist/chunk-GT5X2WN4.cjs +0 -59
- package/dist/chunk-GT5X2WN4.cjs.map +0 -1
- package/dist/chunk-JSAJQXI2.cjs +0 -577
- package/dist/chunk-JSAJQXI2.cjs.map +0 -1
- package/dist/chunk-KDR7QXOQ.js +0 -56
- package/dist/chunk-KDR7QXOQ.js.map +0 -1
- package/dist/chunk-KGTU6PJ3.js +0 -577
- package/dist/chunk-KGTU6PJ3.js.map +0 -1
- package/dist/chunk-KHY3SRML.js +0 -768
- package/dist/chunk-KHY3SRML.js.map +0 -1
- package/dist/chunk-OOC3HK3E.cjs +0 -56
- package/dist/chunk-OOC3HK3E.cjs.map +0 -1
- package/dist/chunk-QXNFGJ5R.js +0 -59
- package/dist/chunk-QXNFGJ5R.js.map +0 -1
- package/dist/chunk-UOPZAYFM.cjs +0 -11
- package/dist/chunk-UOPZAYFM.cjs.map +0 -1
- package/dist/chunk-ZPOYKHY6.cjs +0 -768
- package/dist/chunk-ZPOYKHY6.cjs.map +0 -1
- package/dist/index.cjs +0 -87
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -12
- package/dist/index.js +0 -87
- package/dist/index.js.map +0 -1
- package/dist/ipfs.cjs +0 -28
- package/dist/ipfs.cjs.map +0 -1
- package/dist/ipfs.d.cts +0 -36
- package/dist/ipfs.js +0 -28
- package/dist/mapped-mkKwhQgZ.d.cts +0 -20
- package/dist/pubsub.cjs +0 -14
- package/dist/pubsub.cjs.map +0 -1
- package/dist/pubsub.js +0 -14
- package/dist/pubsub.js.map +0 -1
- package/dist/queries.cjs +0 -112
- package/dist/queries.cjs.map +0 -1
- package/dist/queries.d.cts +0 -141
- package/dist/queries.d.ts +0 -141
- package/dist/queries.js +0 -112
- package/dist/queries.js.map +0 -1
- package/dist/stream.cjs +0 -37
- package/dist/stream.cjs.map +0 -1
- package/dist/stream.d.cts +0 -44
- package/dist/stream.js +0 -37
- package/dist/types-A9kYLtyU.d.cts +0 -153
- package/dist/types-A9kYLtyU.d.ts +0 -153
- package/dist/types.cjs +0 -46
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts +0 -4
- package/dist/types.js +0 -46
- package/dist/utils.cjs +0 -1
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.cts +0 -2
- package/dist/utils.js +0 -1
- package/dist/writeable-r_920qCb.d.ts +0 -16
- /package/dist/{applog.js.map → applog.min.js.map} +0 -0
- /package/dist/{chunk-F3FYYIAV.js.map → chunk-7IDQIMQO.min.js.map} +0 -0
- /package/dist/{ipfs.js.map → chunk-RPPZKO5L.min.js.map} +0 -0
- /package/dist/{stream.js.map → ipfs.min.js.map} +0 -0
- /package/dist/{utils.js.map → pubsub.min.js.map} +0 -0
package/dist/queries.cjs
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _chunkJSAJQXI2cjs = require('./chunk-JSAJQXI2.cjs');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var _chunkZPOYKHY6cjs = require('./chunk-ZPOYKHY6.cjs');
|
|
31
|
-
require('./chunk-GT5X2WN4.cjs');
|
|
32
|
-
require('./chunk-UOPZAYFM.cjs');
|
|
33
|
-
|
|
34
|
-
// src/queries/divergences.ts
|
|
35
|
-
var _besonderslogger = require('besonders-logger');
|
|
36
|
-
var _mobx = require('mobx');
|
|
37
|
-
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = _besonderslogger.Logger.setup(_besonderslogger.Logger.INFO);
|
|
38
|
-
var queryDivergencesByPrev = _chunkZPOYKHY6cjs.computedFnDeepCompare.call(void 0, function queryConflictingByPrev(sourceStream) {
|
|
39
|
-
DEBUG(`queryDivergencesByPrev<${sourceStream.nameAndSizeUntracked}>`);
|
|
40
|
-
if (sourceStream.filters.includes("withoutHistory"))
|
|
41
|
-
WARN(`queryDivergencesByPrev on stream withoutHistory`, sourceStream);
|
|
42
|
-
const divergences = _chunkZPOYKHY6cjs.observableArrayMap.call(void 0, () => {
|
|
43
|
-
const logsForNode = /* @__PURE__ */ new Map();
|
|
44
|
-
const leafs = /* @__PURE__ */ new Set();
|
|
45
|
-
VERBOSE("all applogs:", sourceStream.applogs);
|
|
46
|
-
for (const log of sourceStream.applogs) {
|
|
47
|
-
let prevLogs;
|
|
48
|
-
if (log.pv) {
|
|
49
|
-
prevLogs = log.pv && logsForNode.get(log.pv.toString());
|
|
50
|
-
leafs.delete(log.pv.toString());
|
|
51
|
-
}
|
|
52
|
-
VERBOSE("traversing log", { log, prevLogs, leafs: Array.from(leafs) });
|
|
53
|
-
logsForNode.set(log.cid, prevLogs ? [...prevLogs, log] : [log]);
|
|
54
|
-
leafs.add(log.cid);
|
|
55
|
-
}
|
|
56
|
-
return Array.from(leafs).map((leafID) => {
|
|
57
|
-
const stream = new (0, _chunkJSAJQXI2cjs.ApplogStreamInMemory)(
|
|
58
|
-
logsForNode.get(leafID),
|
|
59
|
-
sourceStream.filters,
|
|
60
|
-
_chunkZPOYKHY6cjs.createDebugName.call(void 0, {
|
|
61
|
-
caller: "DivergenceLeaf",
|
|
62
|
-
stream: sourceStream,
|
|
63
|
-
pattern: `leaf: ${leafID}`
|
|
64
|
-
}),
|
|
65
|
-
true,
|
|
66
|
-
sourceStream
|
|
67
|
-
);
|
|
68
|
-
return { log: stream.latestLog, stream };
|
|
69
|
-
});
|
|
70
|
-
}, { name: _chunkZPOYKHY6cjs.createDebugName.call(void 0, { caller: "queryDivergencesByPrev", stream: sourceStream }) });
|
|
71
|
-
VERBOSE.isDisabled || _mobx.autorun.call(void 0, () => VERBOSE(`[queryDivergencesByPrev] result:`, _mobx.toJS.call(void 0, divergences)));
|
|
72
|
-
return divergences;
|
|
73
|
-
}, { equals: _mobx.comparer.structural });
|
|
74
|
-
|
|
75
|
-
// src/queries/matchers.ts
|
|
76
|
-
function includes(str) {
|
|
77
|
-
return (vl) => _optionalChain([vl, 'optionalAccess', _ => _.includes, 'optionalCall', _2 => _2(str)]);
|
|
78
|
-
}
|
|
79
|
-
function includedIn(arr) {
|
|
80
|
-
return (vl) => _optionalChain([arr, 'optionalAccess', _3 => _3.includes, 'optionalCall', _4 => _4(vl)]);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
exports.QueryNode = _chunkJSAJQXI2cjs.QueryNode; exports.QueryNodes = _chunkJSAJQXI2cjs.QueryNodes; exports.agentsOfStream = _chunkJSAJQXI2cjs.agentsOfStream; exports.applogStreamComparer = _chunkZPOYKHY6cjs.applogStreamComparer; exports.computedFnDeepCompare = _chunkZPOYKHY6cjs.computedFnDeepCompare; exports.computedStructuralComparer = _chunkZPOYKHY6cjs.computedStructuralComparer; exports.createDebugName = _chunkZPOYKHY6cjs.createDebugName; exports.createDebugNameObj = _chunkZPOYKHY6cjs.createDebugNameObj; exports.entityOverlap = _chunkJSAJQXI2cjs.entityOverlap; exports.entityOverlapCount = _chunkJSAJQXI2cjs.entityOverlapCount; exports.filterAndMap = _chunkJSAJQXI2cjs.filterAndMap; exports.includedIn = includedIn; exports.includes = includes; exports.mapTo = _chunkJSAJQXI2cjs.mapTo; exports.observableArrayMap = _chunkZPOYKHY6cjs.observableArrayMap; exports.prefixAt = _chunkJSAJQXI2cjs.prefixAt; exports.prefixAttrs = _chunkJSAJQXI2cjs.prefixAttrs; exports.prettifyStreamName = _chunkZPOYKHY6cjs.prettifyStreamName; exports.query = _chunkJSAJQXI2cjs.query; exports.queryAndMap = _chunkJSAJQXI2cjs.queryAndMap; exports.queryDivergencesByPrev = queryDivergencesByPrev; exports.queryEntity = _chunkJSAJQXI2cjs.queryEntity; exports.queryNodesComparer = _chunkZPOYKHY6cjs.queryNodesComparer; exports.queryNot = _chunkJSAJQXI2cjs.queryNot; exports.queryStep = _chunkJSAJQXI2cjs.queryStep; exports.startsWith = _chunkJSAJQXI2cjs.startsWith; exports.withoutDeleted = _chunkJSAJQXI2cjs.withoutDeleted; exports.withoutHistory = _chunkJSAJQXI2cjs.withoutHistory;
|
|
112
|
-
//# sourceMappingURL=queries.cjs.map
|
package/dist/queries.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/queries/divergences.ts","../src/queries/matchers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS,UAAU,YAAY;AAMxC,IAAM,EAAE,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,OAAO,MAAM,OAAO,IAAI;AAO9D,IAAM,yBAAyB,sBAAsB,SAAS,uBACpE,cACC;AACD,QAAM,0BAA0B,aAAa,oBAAoB,GAAG;AACpE,MAAI,aAAa,QAAQ,SAAS,gBAAgB;AAAG,SAAK,mDAAmD,YAAY;AAEzH,QAAM,cAAc,mBAAmB,MAAM;AAC5C,UAAM,cAAc,oBAAI,IAAsB;AAC9C,UAAM,QAAQ,oBAAI,IAAY;AAC9B,YAAQ,gBAAgB,aAAa,OAAO;AAC5C,eAAW,OAAO,aAAa,SAAS;AACvC,UAAI;AACJ,UAAI,IAAI,IAAI;AACX,mBAAW,IAAI,MAAM,YAAY,IAAI,IAAI,GAAG,SAAS,CAAC;AACtD,cAAM,OAAO,IAAI,GAAG,SAAS,CAAC;AAAA,MAC/B;AACA,cAAQ,kBAAkB,EAAE,KAAK,UAAU,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC;AACrE,kBAAY,IAAI,IAAI,KAAK,WAAW,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC;AAC9D,YAAM,IAAI,IAAI,GAAG;AAAA,IAClB;AACA,WAAO,MAAM,KAAK,KAAK,EAAE,IAAI,YAAU;AAEtC,YAAM,SAAS,IAAI;AAAA,QAClB,YAAY,IAAI,MAAM;AAAA,QACtB,aAAa;AAAA,QACb,gBAAgB;AAAA,UACf,QAAQ;AAAA,UACR,QAAQ;AAAA,UACR,SAAS,SAAS,MAAM;AAAA,QACzB,CAAC;AAAA,QACD;AAAA,QACA;AAAA,MACD;AACA,aAAQ,EAAE,KAAK,OAAO,WAAW,OAAO;AAAA,IACzC,CAAC;AAAA,EACF,GAAG,EAAE,MAAM,gBAAgB,EAAE,QAAQ,0BAA0B,QAAQ,aAAa,CAAC,EAAE,CAAC;AACxF,UAAQ,cAAc,QAAQ,MAAM,QAAQ,oCAAoC,KAAK,WAAW,CAAC,CAAC;AAClG,SAAO;AACR,GAAG,EAAE,QAAQ,SAAS,WAAW,CAAC;;;AClD3B,SAAS,SAAS,KAAa;AACrC,SAAO,CAAC,OAAkB,IAAI,WAAW,GAAG;AAC7C;AACO,SAAS,WAAW,KAAe;AACzC,SAAO,CAAC,OAAkB,KAAK,WAAW,EAAE;AAC7C","sourcesContent":["import { Logger } from 'besonders-logger'\nimport { autorun, comparer, toJS } from 'mobx'\nimport { Applog } from '../data/datom-types'\nimport { computedFnDeepCompare, createDebugName, observableArrayMap } from '../mobx/mobx-utils'\nimport { ApplogStream } from '../stream'\nimport { ApplogStreamInMemory } from '../stream/writeable'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport interface DivergenceLeaf {\n\tlog: Applog\n\tstream: ApplogStream\n}\n\nexport const queryDivergencesByPrev = computedFnDeepCompare(function queryConflictingByPrev(\n\tsourceStream: ApplogStream,\n) {\n\tDEBUG(`queryDivergencesByPrev<${sourceStream.nameAndSizeUntracked}>`)\n\tif (sourceStream.filters.includes('withoutHistory')) WARN(`queryDivergencesByPrev on stream withoutHistory`, sourceStream)\n\n\tconst divergences = observableArrayMap(() => {\n\t\tconst logsForNode = new Map<string, Applog[]>()\n\t\tconst leafs = new Set<string>()\n\t\tVERBOSE('all applogs:', sourceStream.applogs)\n\t\tfor (const log of sourceStream.applogs) {\n\t\t\tlet prevLogs\n\t\t\tif (log.pv) {\n\t\t\t\tprevLogs = log.pv && logsForNode.get(log.pv.toString())\n\t\t\t\tleafs.delete(log.pv.toString())\n\t\t\t}\n\t\t\tVERBOSE('traversing log', { log, prevLogs, leafs: Array.from(leafs) })\n\t\t\tlogsForNode.set(log.cid, prevLogs ? [...prevLogs, log] : [log])\n\t\t\tleafs.add(log.cid)\n\t\t}\n\t\treturn Array.from(leafs).map(leafID => {\n\t\t\t// ? use MappedApplogStream?\n\t\t\tconst stream = new ApplogStreamInMemory(\n\t\t\t\tlogsForNode.get(leafID),\n\t\t\t\tsourceStream.filters,\n\t\t\t\tcreateDebugName({\n\t\t\t\t\tcaller: 'DivergenceLeaf',\n\t\t\t\t\tstream: sourceStream,\n\t\t\t\t\tpattern: `leaf: ${leafID}`,\n\t\t\t\t}),\n\t\t\t\ttrue,\n\t\t\t\tsourceStream,\n\t\t\t)\n\t\t\treturn ({ log: stream.latestLog, stream })\n\t\t})\n\t}, { name: createDebugName({ caller: 'queryDivergencesByPrev', stream: sourceStream }) })\n\tVERBOSE.isDisabled || autorun(() => VERBOSE(`[queryDivergencesByPrev] result:`, toJS(divergences)))\n\treturn divergences\n}, { equals: comparer.structural })\n","import { DatomPart } from '../data/datom-types'\n\nexport function includes(str: string) {\n\treturn (vl: DatomPart) => vl?.includes?.(str)\n}\nexport function includedIn(arr: string[]) {\n\treturn (vl: DatomPart) => arr?.includes?.(vl)\n}\n"]}
|
package/dist/queries.d.cts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import * as mobx from 'mobx';
|
|
2
|
-
import { IComputedValue, comparer, IObservableArray } from 'mobx';
|
|
3
|
-
import { IComputedFnOptions } from 'mobx-utils/lib/computedFn';
|
|
4
|
-
import { A as ApplogStream, S as SearchContext, c as Applog, D as DatalogQueryPattern, h as EntityID, b as ApplogValue, j as DatomPart } from './types-A9kYLtyU.cjs';
|
|
5
|
-
import { M as MappedApplogStream } from './mapped-mkKwhQgZ.cjs';
|
|
6
|
-
import { A as ApplogStreamInMemory } from './writeable-0WbsIiQn.cjs';
|
|
7
|
-
import '@sinclair/typebox';
|
|
8
|
-
import '@sinclair/typebox/compiler';
|
|
9
|
-
import 'multiformats/cid';
|
|
10
|
-
|
|
11
|
-
declare class QueryNode {
|
|
12
|
-
logsOfThisNode: ApplogStream;
|
|
13
|
-
variables: SearchContext;
|
|
14
|
-
prev: QueryNode | null;
|
|
15
|
-
constructor(logsOfThisNode: ApplogStream, variables: SearchContext, prev?: QueryNode | null);
|
|
16
|
-
get record(): SearchContext;
|
|
17
|
-
get allApplogs(): ApplogStream;
|
|
18
|
-
}
|
|
19
|
-
declare class QueryNodes {
|
|
20
|
-
nodes: Array<QueryNode>;
|
|
21
|
-
constructor(nodes: Array<QueryNode>);
|
|
22
|
-
get size(): number;
|
|
23
|
-
get isEmpty(): boolean;
|
|
24
|
-
get untrackedSize(): number;
|
|
25
|
-
get records(): SearchContext[];
|
|
26
|
-
get applogSets(): (readonly Applog[])[];
|
|
27
|
-
get applogStreams(): ApplogStream[];
|
|
28
|
-
get allApplogs(): ApplogStream;
|
|
29
|
-
}
|
|
30
|
-
declare const withoutHistory: (stream: ApplogStream, { inverseToOnlyReturnFirstLogs, tolerateAlreadyFiltered }?: {
|
|
31
|
-
inverseToOnlyReturnFirstLogs?: boolean;
|
|
32
|
-
tolerateAlreadyFiltered?: boolean;
|
|
33
|
-
}) => ApplogStream;
|
|
34
|
-
declare const withoutDeleted: (stream: ApplogStream) => MappedApplogStream;
|
|
35
|
-
declare const query: (stream: ApplogStream, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], startVariables?: SearchContext, opts?: {
|
|
36
|
-
debug?: boolean;
|
|
37
|
-
}) => QueryNodes;
|
|
38
|
-
declare const queryStep: (stream: ApplogStream, nodeSet: QueryNodes | null, pattern: DatalogQueryPattern, opts?: {
|
|
39
|
-
debug?: boolean;
|
|
40
|
-
}) => QueryNodes;
|
|
41
|
-
declare const queryNot: (stream: ApplogStream, startNodes: QueryNodes, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], opts?: {
|
|
42
|
-
debug?: boolean;
|
|
43
|
-
}) => QueryNodes;
|
|
44
|
-
declare const filterAndMap: <R>(stream: ApplogStream, pattern: DatalogQueryPattern, mapper: keyof Applog | Partial<{
|
|
45
|
-
cid: string;
|
|
46
|
-
pv?: string;
|
|
47
|
-
ts: string;
|
|
48
|
-
ag: string;
|
|
49
|
-
en: string;
|
|
50
|
-
at: string;
|
|
51
|
-
vl: string;
|
|
52
|
-
}> | ((applog: Applog) => R)) => mobx.IObservableArray<any>;
|
|
53
|
-
declare const queryAndMap: <R>(stream: ApplogStream, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], map: string | ((record: SearchContext) => R), variables?: SearchContext) => mobx.IObservableArray<any>;
|
|
54
|
-
declare const queryEntity: <R>(stream: ApplogStream, name: string, entityID: EntityID, attributes: string[]) => mobx.IComputedValue<{
|
|
55
|
-
[k: string]: ApplogValue;
|
|
56
|
-
}>;
|
|
57
|
-
declare const agentsOfStream: <R>(stream: ApplogStream) => mobx.ObservableMap<string, number>;
|
|
58
|
-
declare const entityOverlap: (streamA: ApplogStream, streamB: ApplogStream) => mobx.IComputedValue<string[]>;
|
|
59
|
-
declare const entityOverlapCount: (streamA: ApplogStream, streamB: ApplogStream) => mobx.IComputedValue<number>;
|
|
60
|
-
declare function mapTo(applogFieldMap: Partial<{
|
|
61
|
-
[key in keyof Applog]: string;
|
|
62
|
-
}>): (applog: any) => SearchContext;
|
|
63
|
-
declare function startsWith(str: string): (value: any) => any;
|
|
64
|
-
declare function prefixAttrs(prefix: string, attrs: string[]): string[];
|
|
65
|
-
declare function prefixAt(prefix: string, attr: string): string;
|
|
66
|
-
|
|
67
|
-
declare const createDebugName: ({ caller, stream, pattern: args }: {
|
|
68
|
-
caller?: string;
|
|
69
|
-
stream?: ApplogStream;
|
|
70
|
-
pattern?: DatalogQueryPattern | string;
|
|
71
|
-
}) => string;
|
|
72
|
-
declare const createDebugNameObj: (args: Parameters<typeof createDebugName>[0]) => {
|
|
73
|
-
readonly name: string;
|
|
74
|
-
};
|
|
75
|
-
declare function computedStructuralComparer<T>(a: IComputedValue<T>, b: IComputedValue<T>): boolean;
|
|
76
|
-
declare function applogStreamComparer(a: ApplogStream, b: ApplogStream): boolean;
|
|
77
|
-
declare function queryNodesComparer(a: QueryNodes, b: QueryNodes): boolean;
|
|
78
|
-
declare function observableArrayMap<T>(fn: () => T[], { name, equals }?: {
|
|
79
|
-
name?: string;
|
|
80
|
-
equals?: typeof comparer.structural;
|
|
81
|
-
}): IObservableArray<T>;
|
|
82
|
-
/**
|
|
83
|
-
* ADAPTED from https://github.com/mobxjs/mobx-utils/blob/362cbbfb384820d416f253eddc532ebecba89bcb/src/computedFn.ts#L50 to
|
|
84
|
-
* - deep-compare arguments
|
|
85
|
-
* - allow dynamic/optional args
|
|
86
|
-
* - not be so friggin complicated... DeepMap... closest... why?!
|
|
87
|
-
*
|
|
88
|
-
* // TODO: PR upstream
|
|
89
|
-
*
|
|
90
|
-
* computedFnDeepCompare takes a function with an arbitrary amount of arguments,
|
|
91
|
-
* and memoizes the output of the function based on the arguments passed in.
|
|
92
|
-
*
|
|
93
|
-
* computedFnDeepCompare(fn) returns a function with the very same signature. There is no limit on the amount of arguments
|
|
94
|
-
* that is accepted.
|
|
95
|
-
*
|
|
96
|
-
* By default the output of a function call will only be memoized as long as the
|
|
97
|
-
* output is being observed.
|
|
98
|
-
*
|
|
99
|
-
* The function passes into `computedFnDeepCompare` should be pure, not be an action and only be relying on
|
|
100
|
-
* observables.
|
|
101
|
-
*
|
|
102
|
-
* Setting `keepAlive` to `true` will cause the output to be forcefully cached forever.
|
|
103
|
-
* Note that this might introduce memory leaks!
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* const store = observable({
|
|
107
|
-
a: 1,
|
|
108
|
-
b: 2,
|
|
109
|
-
c: 3,
|
|
110
|
-
m: computedFnDeepCompare(function(x) {
|
|
111
|
-
return this.a * this.b * x
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
const d = autorun(() => {
|
|
116
|
-
// store.m(3) will be cached as long as this autorun is running
|
|
117
|
-
console.log(store.m(3) * store.c)
|
|
118
|
-
})
|
|
119
|
-
*
|
|
120
|
-
* @param fn
|
|
121
|
-
* @param keepAliveOrOptions
|
|
122
|
-
*/
|
|
123
|
-
declare function computedFnDeepCompare<T extends (...args: any[]) => any>(fn: T, keepAliveOrOptions?: (IComputedFnOptions<T> & {
|
|
124
|
-
name?: string;
|
|
125
|
-
argsDebugName?: (...args: Parameters<T>) => string;
|
|
126
|
-
}) | boolean): T;
|
|
127
|
-
declare function prettifyStreamName(input: string): string;
|
|
128
|
-
|
|
129
|
-
interface DivergenceLeaf {
|
|
130
|
-
log: Applog;
|
|
131
|
-
stream: ApplogStream;
|
|
132
|
-
}
|
|
133
|
-
declare const queryDivergencesByPrev: (sourceStream: ApplogStream) => mobx.IObservableArray<{
|
|
134
|
-
log: Applog;
|
|
135
|
-
stream: ApplogStreamInMemory;
|
|
136
|
-
}>;
|
|
137
|
-
|
|
138
|
-
declare function includes(str: string): (vl: DatomPart) => boolean;
|
|
139
|
-
declare function includedIn(arr: string[]): (vl: DatomPart) => boolean;
|
|
140
|
-
|
|
141
|
-
export { type DivergenceLeaf, QueryNode, QueryNodes, agentsOfStream, applogStreamComparer, computedFnDeepCompare, computedStructuralComparer, createDebugName, createDebugNameObj, entityOverlap, entityOverlapCount, filterAndMap, includedIn, includes, mapTo, observableArrayMap, prefixAt, prefixAttrs, prettifyStreamName, query, queryAndMap, queryDivergencesByPrev, queryEntity, queryNodesComparer, queryNot, queryStep, startsWith, withoutDeleted, withoutHistory };
|
package/dist/queries.d.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import * as mobx from 'mobx';
|
|
2
|
-
import { IComputedValue, comparer, IObservableArray } from 'mobx';
|
|
3
|
-
import { IComputedFnOptions } from 'mobx-utils/lib/computedFn';
|
|
4
|
-
import { A as ApplogStream, S as SearchContext, c as Applog, D as DatalogQueryPattern, h as EntityID, b as ApplogValue, j as DatomPart } from './types-A9kYLtyU.js';
|
|
5
|
-
import { M as MappedApplogStream } from './mapped-8h8bwRuM.js';
|
|
6
|
-
import { A as ApplogStreamInMemory } from './writeable-r_920qCb.js';
|
|
7
|
-
import '@sinclair/typebox';
|
|
8
|
-
import '@sinclair/typebox/compiler';
|
|
9
|
-
import 'multiformats/cid';
|
|
10
|
-
|
|
11
|
-
declare class QueryNode {
|
|
12
|
-
logsOfThisNode: ApplogStream;
|
|
13
|
-
variables: SearchContext;
|
|
14
|
-
prev: QueryNode | null;
|
|
15
|
-
constructor(logsOfThisNode: ApplogStream, variables: SearchContext, prev?: QueryNode | null);
|
|
16
|
-
get record(): SearchContext;
|
|
17
|
-
get allApplogs(): ApplogStream;
|
|
18
|
-
}
|
|
19
|
-
declare class QueryNodes {
|
|
20
|
-
nodes: Array<QueryNode>;
|
|
21
|
-
constructor(nodes: Array<QueryNode>);
|
|
22
|
-
get size(): number;
|
|
23
|
-
get isEmpty(): boolean;
|
|
24
|
-
get untrackedSize(): number;
|
|
25
|
-
get records(): SearchContext[];
|
|
26
|
-
get applogSets(): (readonly Applog[])[];
|
|
27
|
-
get applogStreams(): ApplogStream[];
|
|
28
|
-
get allApplogs(): ApplogStream;
|
|
29
|
-
}
|
|
30
|
-
declare const withoutHistory: (stream: ApplogStream, { inverseToOnlyReturnFirstLogs, tolerateAlreadyFiltered }?: {
|
|
31
|
-
inverseToOnlyReturnFirstLogs?: boolean;
|
|
32
|
-
tolerateAlreadyFiltered?: boolean;
|
|
33
|
-
}) => ApplogStream;
|
|
34
|
-
declare const withoutDeleted: (stream: ApplogStream) => MappedApplogStream;
|
|
35
|
-
declare const query: (stream: ApplogStream, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], startVariables?: SearchContext, opts?: {
|
|
36
|
-
debug?: boolean;
|
|
37
|
-
}) => QueryNodes;
|
|
38
|
-
declare const queryStep: (stream: ApplogStream, nodeSet: QueryNodes | null, pattern: DatalogQueryPattern, opts?: {
|
|
39
|
-
debug?: boolean;
|
|
40
|
-
}) => QueryNodes;
|
|
41
|
-
declare const queryNot: (stream: ApplogStream, startNodes: QueryNodes, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], opts?: {
|
|
42
|
-
debug?: boolean;
|
|
43
|
-
}) => QueryNodes;
|
|
44
|
-
declare const filterAndMap: <R>(stream: ApplogStream, pattern: DatalogQueryPattern, mapper: keyof Applog | Partial<{
|
|
45
|
-
cid: string;
|
|
46
|
-
pv?: string;
|
|
47
|
-
ts: string;
|
|
48
|
-
ag: string;
|
|
49
|
-
en: string;
|
|
50
|
-
at: string;
|
|
51
|
-
vl: string;
|
|
52
|
-
}> | ((applog: Applog) => R)) => mobx.IObservableArray<any>;
|
|
53
|
-
declare const queryAndMap: <R>(stream: ApplogStream, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], map: string | ((record: SearchContext) => R), variables?: SearchContext) => mobx.IObservableArray<any>;
|
|
54
|
-
declare const queryEntity: <R>(stream: ApplogStream, name: string, entityID: EntityID, attributes: string[]) => mobx.IComputedValue<{
|
|
55
|
-
[k: string]: ApplogValue;
|
|
56
|
-
}>;
|
|
57
|
-
declare const agentsOfStream: <R>(stream: ApplogStream) => mobx.ObservableMap<string, number>;
|
|
58
|
-
declare const entityOverlap: (streamA: ApplogStream, streamB: ApplogStream) => mobx.IComputedValue<string[]>;
|
|
59
|
-
declare const entityOverlapCount: (streamA: ApplogStream, streamB: ApplogStream) => mobx.IComputedValue<number>;
|
|
60
|
-
declare function mapTo(applogFieldMap: Partial<{
|
|
61
|
-
[key in keyof Applog]: string;
|
|
62
|
-
}>): (applog: any) => SearchContext;
|
|
63
|
-
declare function startsWith(str: string): (value: any) => any;
|
|
64
|
-
declare function prefixAttrs(prefix: string, attrs: string[]): string[];
|
|
65
|
-
declare function prefixAt(prefix: string, attr: string): string;
|
|
66
|
-
|
|
67
|
-
declare const createDebugName: ({ caller, stream, pattern: args }: {
|
|
68
|
-
caller?: string;
|
|
69
|
-
stream?: ApplogStream;
|
|
70
|
-
pattern?: DatalogQueryPattern | string;
|
|
71
|
-
}) => string;
|
|
72
|
-
declare const createDebugNameObj: (args: Parameters<typeof createDebugName>[0]) => {
|
|
73
|
-
readonly name: string;
|
|
74
|
-
};
|
|
75
|
-
declare function computedStructuralComparer<T>(a: IComputedValue<T>, b: IComputedValue<T>): boolean;
|
|
76
|
-
declare function applogStreamComparer(a: ApplogStream, b: ApplogStream): boolean;
|
|
77
|
-
declare function queryNodesComparer(a: QueryNodes, b: QueryNodes): boolean;
|
|
78
|
-
declare function observableArrayMap<T>(fn: () => T[], { name, equals }?: {
|
|
79
|
-
name?: string;
|
|
80
|
-
equals?: typeof comparer.structural;
|
|
81
|
-
}): IObservableArray<T>;
|
|
82
|
-
/**
|
|
83
|
-
* ADAPTED from https://github.com/mobxjs/mobx-utils/blob/362cbbfb384820d416f253eddc532ebecba89bcb/src/computedFn.ts#L50 to
|
|
84
|
-
* - deep-compare arguments
|
|
85
|
-
* - allow dynamic/optional args
|
|
86
|
-
* - not be so friggin complicated... DeepMap... closest... why?!
|
|
87
|
-
*
|
|
88
|
-
* // TODO: PR upstream
|
|
89
|
-
*
|
|
90
|
-
* computedFnDeepCompare takes a function with an arbitrary amount of arguments,
|
|
91
|
-
* and memoizes the output of the function based on the arguments passed in.
|
|
92
|
-
*
|
|
93
|
-
* computedFnDeepCompare(fn) returns a function with the very same signature. There is no limit on the amount of arguments
|
|
94
|
-
* that is accepted.
|
|
95
|
-
*
|
|
96
|
-
* By default the output of a function call will only be memoized as long as the
|
|
97
|
-
* output is being observed.
|
|
98
|
-
*
|
|
99
|
-
* The function passes into `computedFnDeepCompare` should be pure, not be an action and only be relying on
|
|
100
|
-
* observables.
|
|
101
|
-
*
|
|
102
|
-
* Setting `keepAlive` to `true` will cause the output to be forcefully cached forever.
|
|
103
|
-
* Note that this might introduce memory leaks!
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* const store = observable({
|
|
107
|
-
a: 1,
|
|
108
|
-
b: 2,
|
|
109
|
-
c: 3,
|
|
110
|
-
m: computedFnDeepCompare(function(x) {
|
|
111
|
-
return this.a * this.b * x
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
const d = autorun(() => {
|
|
116
|
-
// store.m(3) will be cached as long as this autorun is running
|
|
117
|
-
console.log(store.m(3) * store.c)
|
|
118
|
-
})
|
|
119
|
-
*
|
|
120
|
-
* @param fn
|
|
121
|
-
* @param keepAliveOrOptions
|
|
122
|
-
*/
|
|
123
|
-
declare function computedFnDeepCompare<T extends (...args: any[]) => any>(fn: T, keepAliveOrOptions?: (IComputedFnOptions<T> & {
|
|
124
|
-
name?: string;
|
|
125
|
-
argsDebugName?: (...args: Parameters<T>) => string;
|
|
126
|
-
}) | boolean): T;
|
|
127
|
-
declare function prettifyStreamName(input: string): string;
|
|
128
|
-
|
|
129
|
-
interface DivergenceLeaf {
|
|
130
|
-
log: Applog;
|
|
131
|
-
stream: ApplogStream;
|
|
132
|
-
}
|
|
133
|
-
declare const queryDivergencesByPrev: (sourceStream: ApplogStream) => mobx.IObservableArray<{
|
|
134
|
-
log: Applog;
|
|
135
|
-
stream: ApplogStreamInMemory;
|
|
136
|
-
}>;
|
|
137
|
-
|
|
138
|
-
declare function includes(str: string): (vl: DatomPart) => boolean;
|
|
139
|
-
declare function includedIn(arr: string[]): (vl: DatomPart) => boolean;
|
|
140
|
-
|
|
141
|
-
export { type DivergenceLeaf, QueryNode, QueryNodes, agentsOfStream, applogStreamComparer, computedFnDeepCompare, computedStructuralComparer, createDebugName, createDebugNameObj, entityOverlap, entityOverlapCount, filterAndMap, includedIn, includes, mapTo, observableArrayMap, prefixAt, prefixAttrs, prettifyStreamName, query, queryAndMap, queryDivergencesByPrev, queryEntity, queryNodesComparer, queryNot, queryStep, startsWith, withoutDeleted, withoutHistory };
|
package/dist/queries.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ApplogStreamInMemory,
|
|
3
|
-
QueryNode,
|
|
4
|
-
QueryNodes,
|
|
5
|
-
agentsOfStream,
|
|
6
|
-
entityOverlap,
|
|
7
|
-
entityOverlapCount,
|
|
8
|
-
filterAndMap,
|
|
9
|
-
mapTo,
|
|
10
|
-
prefixAt,
|
|
11
|
-
prefixAttrs,
|
|
12
|
-
query,
|
|
13
|
-
queryAndMap,
|
|
14
|
-
queryEntity,
|
|
15
|
-
queryNot,
|
|
16
|
-
queryStep,
|
|
17
|
-
startsWith,
|
|
18
|
-
withoutDeleted,
|
|
19
|
-
withoutHistory
|
|
20
|
-
} from "./chunk-KGTU6PJ3.js";
|
|
21
|
-
import {
|
|
22
|
-
applogStreamComparer,
|
|
23
|
-
computedFnDeepCompare,
|
|
24
|
-
computedStructuralComparer,
|
|
25
|
-
createDebugName,
|
|
26
|
-
createDebugNameObj,
|
|
27
|
-
observableArrayMap,
|
|
28
|
-
prettifyStreamName,
|
|
29
|
-
queryNodesComparer
|
|
30
|
-
} from "./chunk-KHY3SRML.js";
|
|
31
|
-
import "./chunk-QXNFGJ5R.js";
|
|
32
|
-
import "./chunk-F3FYYIAV.js";
|
|
33
|
-
|
|
34
|
-
// src/queries/divergences.ts
|
|
35
|
-
import { Logger } from "besonders-logger";
|
|
36
|
-
import { autorun, comparer, toJS } from "mobx";
|
|
37
|
-
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO);
|
|
38
|
-
var queryDivergencesByPrev = computedFnDeepCompare(function queryConflictingByPrev(sourceStream) {
|
|
39
|
-
DEBUG(`queryDivergencesByPrev<${sourceStream.nameAndSizeUntracked}>`);
|
|
40
|
-
if (sourceStream.filters.includes("withoutHistory"))
|
|
41
|
-
WARN(`queryDivergencesByPrev on stream withoutHistory`, sourceStream);
|
|
42
|
-
const divergences = observableArrayMap(() => {
|
|
43
|
-
const logsForNode = /* @__PURE__ */ new Map();
|
|
44
|
-
const leafs = /* @__PURE__ */ new Set();
|
|
45
|
-
VERBOSE("all applogs:", sourceStream.applogs);
|
|
46
|
-
for (const log of sourceStream.applogs) {
|
|
47
|
-
let prevLogs;
|
|
48
|
-
if (log.pv) {
|
|
49
|
-
prevLogs = log.pv && logsForNode.get(log.pv.toString());
|
|
50
|
-
leafs.delete(log.pv.toString());
|
|
51
|
-
}
|
|
52
|
-
VERBOSE("traversing log", { log, prevLogs, leafs: Array.from(leafs) });
|
|
53
|
-
logsForNode.set(log.cid, prevLogs ? [...prevLogs, log] : [log]);
|
|
54
|
-
leafs.add(log.cid);
|
|
55
|
-
}
|
|
56
|
-
return Array.from(leafs).map((leafID) => {
|
|
57
|
-
const stream = new ApplogStreamInMemory(
|
|
58
|
-
logsForNode.get(leafID),
|
|
59
|
-
sourceStream.filters,
|
|
60
|
-
createDebugName({
|
|
61
|
-
caller: "DivergenceLeaf",
|
|
62
|
-
stream: sourceStream,
|
|
63
|
-
pattern: `leaf: ${leafID}`
|
|
64
|
-
}),
|
|
65
|
-
true,
|
|
66
|
-
sourceStream
|
|
67
|
-
);
|
|
68
|
-
return { log: stream.latestLog, stream };
|
|
69
|
-
});
|
|
70
|
-
}, { name: createDebugName({ caller: "queryDivergencesByPrev", stream: sourceStream }) });
|
|
71
|
-
VERBOSE.isDisabled || autorun(() => VERBOSE(`[queryDivergencesByPrev] result:`, toJS(divergences)));
|
|
72
|
-
return divergences;
|
|
73
|
-
}, { equals: comparer.structural });
|
|
74
|
-
|
|
75
|
-
// src/queries/matchers.ts
|
|
76
|
-
function includes(str) {
|
|
77
|
-
return (vl) => vl?.includes?.(str);
|
|
78
|
-
}
|
|
79
|
-
function includedIn(arr) {
|
|
80
|
-
return (vl) => arr?.includes?.(vl);
|
|
81
|
-
}
|
|
82
|
-
export {
|
|
83
|
-
QueryNode,
|
|
84
|
-
QueryNodes,
|
|
85
|
-
agentsOfStream,
|
|
86
|
-
applogStreamComparer,
|
|
87
|
-
computedFnDeepCompare,
|
|
88
|
-
computedStructuralComparer,
|
|
89
|
-
createDebugName,
|
|
90
|
-
createDebugNameObj,
|
|
91
|
-
entityOverlap,
|
|
92
|
-
entityOverlapCount,
|
|
93
|
-
filterAndMap,
|
|
94
|
-
includedIn,
|
|
95
|
-
includes,
|
|
96
|
-
mapTo,
|
|
97
|
-
observableArrayMap,
|
|
98
|
-
prefixAt,
|
|
99
|
-
prefixAttrs,
|
|
100
|
-
prettifyStreamName,
|
|
101
|
-
query,
|
|
102
|
-
queryAndMap,
|
|
103
|
-
queryDivergencesByPrev,
|
|
104
|
-
queryEntity,
|
|
105
|
-
queryNodesComparer,
|
|
106
|
-
queryNot,
|
|
107
|
-
queryStep,
|
|
108
|
-
startsWith,
|
|
109
|
-
withoutDeleted,
|
|
110
|
-
withoutHistory
|
|
111
|
-
};
|
|
112
|
-
//# sourceMappingURL=queries.js.map
|
package/dist/queries.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/queries/divergences.ts","../src/queries/matchers.ts"],"sourcesContent":["import { Logger } from 'besonders-logger'\nimport { autorun, comparer, toJS } from 'mobx'\nimport { Applog } from '../data/datom-types'\nimport { computedFnDeepCompare, createDebugName, observableArrayMap } from '../mobx/mobx-utils'\nimport { ApplogStream } from '../stream'\nimport { ApplogStreamInMemory } from '../stream/writeable'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport interface DivergenceLeaf {\n\tlog: Applog\n\tstream: ApplogStream\n}\n\nexport const queryDivergencesByPrev = computedFnDeepCompare(function queryConflictingByPrev(\n\tsourceStream: ApplogStream,\n) {\n\tDEBUG(`queryDivergencesByPrev<${sourceStream.nameAndSizeUntracked}>`)\n\tif (sourceStream.filters.includes('withoutHistory')) WARN(`queryDivergencesByPrev on stream withoutHistory`, sourceStream)\n\n\tconst divergences = observableArrayMap(() => {\n\t\tconst logsForNode = new Map<string, Applog[]>()\n\t\tconst leafs = new Set<string>()\n\t\tVERBOSE('all applogs:', sourceStream.applogs)\n\t\tfor (const log of sourceStream.applogs) {\n\t\t\tlet prevLogs\n\t\t\tif (log.pv) {\n\t\t\t\tprevLogs = log.pv && logsForNode.get(log.pv.toString())\n\t\t\t\tleafs.delete(log.pv.toString())\n\t\t\t}\n\t\t\tVERBOSE('traversing log', { log, prevLogs, leafs: Array.from(leafs) })\n\t\t\tlogsForNode.set(log.cid, prevLogs ? [...prevLogs, log] : [log])\n\t\t\tleafs.add(log.cid)\n\t\t}\n\t\treturn Array.from(leafs).map(leafID => {\n\t\t\t// ? use MappedApplogStream?\n\t\t\tconst stream = new ApplogStreamInMemory(\n\t\t\t\tlogsForNode.get(leafID),\n\t\t\t\tsourceStream.filters,\n\t\t\t\tcreateDebugName({\n\t\t\t\t\tcaller: 'DivergenceLeaf',\n\t\t\t\t\tstream: sourceStream,\n\t\t\t\t\tpattern: `leaf: ${leafID}`,\n\t\t\t\t}),\n\t\t\t\ttrue,\n\t\t\t\tsourceStream,\n\t\t\t)\n\t\t\treturn ({ log: stream.latestLog, stream })\n\t\t})\n\t}, { name: createDebugName({ caller: 'queryDivergencesByPrev', stream: sourceStream }) })\n\tVERBOSE.isDisabled || autorun(() => VERBOSE(`[queryDivergencesByPrev] result:`, toJS(divergences)))\n\treturn divergences\n}, { equals: comparer.structural })\n","import { DatomPart } from '../data/datom-types'\n\nexport function includes(str: string) {\n\treturn (vl: DatomPart) => vl?.includes?.(str)\n}\nexport function includedIn(arr: string[]) {\n\treturn (vl: DatomPart) => arr?.includes?.(vl)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,SAAS,UAAU,YAAY;AAMxC,IAAM,EAAE,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,OAAO,MAAM,OAAO,IAAI;AAO9D,IAAM,yBAAyB,sBAAsB,SAAS,uBACpE,cACC;AACD,QAAM,0BAA0B,aAAa,oBAAoB,GAAG;AACpE,MAAI,aAAa,QAAQ,SAAS,gBAAgB;AAAG,SAAK,mDAAmD,YAAY;AAEzH,QAAM,cAAc,mBAAmB,MAAM;AAC5C,UAAM,cAAc,oBAAI,IAAsB;AAC9C,UAAM,QAAQ,oBAAI,IAAY;AAC9B,YAAQ,gBAAgB,aAAa,OAAO;AAC5C,eAAW,OAAO,aAAa,SAAS;AACvC,UAAI;AACJ,UAAI,IAAI,IAAI;AACX,mBAAW,IAAI,MAAM,YAAY,IAAI,IAAI,GAAG,SAAS,CAAC;AACtD,cAAM,OAAO,IAAI,GAAG,SAAS,CAAC;AAAA,MAC/B;AACA,cAAQ,kBAAkB,EAAE,KAAK,UAAU,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC;AACrE,kBAAY,IAAI,IAAI,KAAK,WAAW,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC;AAC9D,YAAM,IAAI,IAAI,GAAG;AAAA,IAClB;AACA,WAAO,MAAM,KAAK,KAAK,EAAE,IAAI,YAAU;AAEtC,YAAM,SAAS,IAAI;AAAA,QAClB,YAAY,IAAI,MAAM;AAAA,QACtB,aAAa;AAAA,QACb,gBAAgB;AAAA,UACf,QAAQ;AAAA,UACR,QAAQ;AAAA,UACR,SAAS,SAAS,MAAM;AAAA,QACzB,CAAC;AAAA,QACD;AAAA,QACA;AAAA,MACD;AACA,aAAQ,EAAE,KAAK,OAAO,WAAW,OAAO;AAAA,IACzC,CAAC;AAAA,EACF,GAAG,EAAE,MAAM,gBAAgB,EAAE,QAAQ,0BAA0B,QAAQ,aAAa,CAAC,EAAE,CAAC;AACxF,UAAQ,cAAc,QAAQ,MAAM,QAAQ,oCAAoC,KAAK,WAAW,CAAC,CAAC;AAClG,SAAO;AACR,GAAG,EAAE,QAAQ,SAAS,WAAW,CAAC;;;AClD3B,SAAS,SAAS,KAAa;AACrC,SAAO,CAAC,OAAkB,IAAI,WAAW,GAAG;AAC7C;AACO,SAAS,WAAW,KAAe;AACzC,SAAO,CAAC,OAAkB,KAAK,WAAW,EAAE;AAC7C;","names":[]}
|
package/dist/stream.cjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkJSAJQXI2cjs = require('./chunk-JSAJQXI2.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _chunkZPOYKHY6cjs = require('./chunk-ZPOYKHY6.cjs');
|
|
19
|
-
require('./chunk-GT5X2WN4.cjs');
|
|
20
|
-
require('./chunk-UOPZAYFM.cjs');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
exports.ApplogStream = _chunkZPOYKHY6cjs.ApplogStream; exports.ApplogStreamInMemory = _chunkJSAJQXI2cjs.ApplogStreamInMemory; exports.MappedApplogStream = _chunkZPOYKHY6cjs.MappedApplogStream; exports.WriteableApplogStream = _chunkJSAJQXI2cjs.WriteableApplogStream; exports.assertOnlyCurrent = _chunkZPOYKHY6cjs.assertOnlyCurrent; exports.assertRaw = _chunkZPOYKHY6cjs.assertRaw; exports.getUntrackedFilterResults = _chunkZPOYKHY6cjs.getUntrackedFilterResults; exports.getUntrackedPattern = _chunkZPOYKHY6cjs.getUntrackedPattern; exports.hasFilter = _chunkZPOYKHY6cjs.hasFilter; exports.isInitEvent = _chunkZPOYKHY6cjs.isInitEvent; exports.makeFilter = _chunkZPOYKHY6cjs.makeFilter; exports.rollingAcc = _chunkZPOYKHY6cjs.rollingAcc; exports.rollingFilter = _chunkZPOYKHY6cjs.rollingFilter; exports.rollingMapper = _chunkZPOYKHY6cjs.rollingMapper;
|
|
37
|
-
//# sourceMappingURL=stream.cjs.map
|
package/dist/stream.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/stream.d.cts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { A as ApplogStream, D as DatalogQueryPattern, a as ApplogStreamEvent, C as CidString, b as ApplogValue, c as Applog } from './types-A9kYLtyU.cjs';
|
|
2
|
-
export { i as isInitEvent } from './types-A9kYLtyU.cjs';
|
|
3
|
-
import { IObservableArray, ObservableMap, ObservableSet } from 'mobx';
|
|
4
|
-
import { M as MappedApplogStream, A as ApplogEventMapper } from './mapped-mkKwhQgZ.cjs';
|
|
5
|
-
export { A as ApplogStreamInMemory, W as WriteableApplogStream } from './writeable-0WbsIiQn.cjs';
|
|
6
|
-
import '@sinclair/typebox';
|
|
7
|
-
import '@sinclair/typebox/compiler';
|
|
8
|
-
import 'multiformats/cid';
|
|
9
|
-
|
|
10
|
-
declare const rollingFilter: (stream: ApplogStream, pattern: DatalogQueryPattern, opts?: {
|
|
11
|
-
name?: string;
|
|
12
|
-
extraFilterName?: string;
|
|
13
|
-
}) => MappedApplogStream;
|
|
14
|
-
declare const rollingMapper: (stream: ApplogStream, eventMapper: ApplogEventMapper, opts?: {
|
|
15
|
-
name?: string;
|
|
16
|
-
extraFilterName?: string;
|
|
17
|
-
}) => MappedApplogStream;
|
|
18
|
-
declare const rollingAcc: <ACC extends IObservableArray<any> | ObservableMap<any, any> | ObservableSet<any>>(stream: ApplogStream, acc: ACC, eventMapper: (event: ApplogStreamEvent, acc: ACC) => void) => ACC;
|
|
19
|
-
declare const getUntrackedPattern: (pattern: DatalogQueryPattern) => {
|
|
20
|
-
[k: string]: string | boolean | Number | CidString | readonly CidString[] | ((value: CidString) => boolean) | readonly string[] | ((value: string) => boolean) | readonly ApplogValue[] | ((value: ApplogValue) => boolean);
|
|
21
|
-
};
|
|
22
|
-
declare function makeFilter(pattern: DatalogQueryPattern): (logs: readonly Applog[]) => Applog[];
|
|
23
|
-
/**
|
|
24
|
-
* // ! think twice before using
|
|
25
|
-
*/
|
|
26
|
-
declare const getUntrackedFilterResults: (stream: ApplogStream, pattern: DatalogQueryPattern, opts?: {
|
|
27
|
-
name?: string;
|
|
28
|
-
}) => Applog[];
|
|
29
|
-
type ApplogStreamWithFilter<T extends string> = ApplogStream & {
|
|
30
|
-
filters: T[];
|
|
31
|
-
};
|
|
32
|
-
declare function hasFilter<T extends string>(stream: ApplogStream, filter: T): stream is ApplogStreamWithFilter<T>;
|
|
33
|
-
declare function assertRaw(stream: ApplogStream): ApplogStreamWithoutFilters;
|
|
34
|
-
declare function assertOnlyCurrent(stream: ApplogStream): ApplogStream & {
|
|
35
|
-
filters: "withoutHistory"[];
|
|
36
|
-
} & {
|
|
37
|
-
filters: "withoutDeleted"[];
|
|
38
|
-
};
|
|
39
|
-
type ApplogStreamOnlyCurrent = ApplogStreamWithFilter<'withoutHistory' | 'withoutDeleted'>;
|
|
40
|
-
type ApplogStreamWithoutFilters = ApplogStream & {
|
|
41
|
-
filters: [];
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export { ApplogEventMapper, ApplogStream, ApplogStreamEvent, type ApplogStreamOnlyCurrent, type ApplogStreamWithFilter, type ApplogStreamWithoutFilters, MappedApplogStream, assertOnlyCurrent, assertRaw, getUntrackedFilterResults, getUntrackedPattern, hasFilter, makeFilter, rollingAcc, rollingFilter, rollingMapper };
|
package/dist/stream.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ApplogStreamInMemory,
|
|
3
|
-
WriteableApplogStream
|
|
4
|
-
} from "./chunk-KGTU6PJ3.js";
|
|
5
|
-
import {
|
|
6
|
-
ApplogStream,
|
|
7
|
-
MappedApplogStream,
|
|
8
|
-
assertOnlyCurrent,
|
|
9
|
-
assertRaw,
|
|
10
|
-
getUntrackedFilterResults,
|
|
11
|
-
getUntrackedPattern,
|
|
12
|
-
hasFilter,
|
|
13
|
-
isInitEvent,
|
|
14
|
-
makeFilter,
|
|
15
|
-
rollingAcc,
|
|
16
|
-
rollingFilter,
|
|
17
|
-
rollingMapper
|
|
18
|
-
} from "./chunk-KHY3SRML.js";
|
|
19
|
-
import "./chunk-QXNFGJ5R.js";
|
|
20
|
-
import "./chunk-F3FYYIAV.js";
|
|
21
|
-
export {
|
|
22
|
-
ApplogStream,
|
|
23
|
-
ApplogStreamInMemory,
|
|
24
|
-
MappedApplogStream,
|
|
25
|
-
WriteableApplogStream,
|
|
26
|
-
assertOnlyCurrent,
|
|
27
|
-
assertRaw,
|
|
28
|
-
getUntrackedFilterResults,
|
|
29
|
-
getUntrackedPattern,
|
|
30
|
-
hasFilter,
|
|
31
|
-
isInitEvent,
|
|
32
|
-
makeFilter,
|
|
33
|
-
rollingAcc,
|
|
34
|
-
rollingFilter,
|
|
35
|
-
rollingMapper
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=stream.js.map
|