@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data/applog-utils.ts","../src/mobx/mobx-utils.ts","../src/stream/basic.ts","../src/stream/mapped.ts","../src/stream/filters.ts"],"sourcesContent":["import { Logger } from 'besonders-logger'\nimport { isBefore } from 'date-fns'\nimport { comparer } from 'mobx'\nimport stringify from 'safe-stable-stringify'\nimport type {\n\tApplog,\n\tApplogValue,\n\tDatalogQueryPattern,\n\tDatalogQueryResultEntry,\n\tResultContext,\n\tSearchContext,\n\tValueOrMatcher,\n} from './datom-types'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.DEBUG) // eslint-disable-line no-unused-vars\n\nexport const isoDateStrCompare = (strA: string, strB: string, dir: 'asc' | 'desc' = 'asc') =>\n\tdir === 'asc'\n\t\t? strA.localeCompare(strB, 'en-US')\n\t\t: strB.localeCompare(strA, 'en-US')\n/** Sort by TS (modifies the array, but also returns for ease of use) */\nexport function sortApplogsByTs(appLogArray: Applog[], dir: 'asc' | 'desc' = 'asc') {\n\treturn appLogArray.sort((a, b) => isoDateStrCompare(a.ts, b.ts, dir))\n}\nexport const isTsBefore = (log: Applog, logToCompare: Applog) => isBefore(new Date(log.ts), new Date(logToCompare.ts))\nexport const uniqueEnFromAppLogs = (appLogArray: Applog[]) => [...new Set(appLogArray.map(eachLog => eachLog.en))]\nexport const areApplogsEqual = (logA: Applog, logB: Applog) => comparer.structural(logA, logB)\n\nexport const removeDuplicateAppLogs = (appLogArray: Applog[]) => {\n\tconst logMap = new Map()\n\tfor (const eachLog of appLogArray) {\n\t\tif (!eachLog) {\n\t\t\tERROR(`falsy entry in applogs`, appLogArray)\n\t\t\tthrow new Error(`falsy entry in applogs`)\n\t\t}\n\t\tlogMap.set(stringify(eachLog), eachLog)\n\t}\n\treturn Array.from(logMap.values())\n}\n\n// export const removeDuplicateAndMaybeDeletedAppLogs = (ds: ApplogStream, appLogArray: Applog[], removeDeletedEntities = true) => {\n// \tconst logMap = new Map()\n// \tfor (const eachLog of appLogArray) {\n// \t\tif (!removeDeletedEntities || ds.entityIsDeleted(eachLog.en))\n// \t\t\tlogMap.set(stringify(eachLog), eachLog)\n// \t}\n// \treturn Array.from(logMap.values())\n// }\n\nexport const getHashID = (stringifiable: any, lngth = 8) => cyrb53hash(stringify(stringifiable), 31, lngth) as string\n\nexport function isVariable(x: any): x is string {\n\treturn typeof x === 'string' && x.startsWith('?')\n}\nexport function variableNameWithoutQuestionmark(str: string) {\n\treturn str.slice(1)\n}\n// export function isMatcher(x: any): x is string {\n// \treturn\n// }\nexport function isStaticPattern(x: any): x is ApplogValue {\n\tif (!['string', 'boolean', 'number', 'function'].includes(typeof x)) WARN(`Unhandled pattern value type:`, typeof x, x)\n\treturn !isVariable(x) && ['string', 'boolean', 'number'].includes(typeof x)\n}\n// export function isIgnorePattern(x: any): boolean {\n// \treturn x === '_'\n// }\n\n/*\n * In a pattern from a Query:\n * - variables that don't have a value in the search context:\n * - remove from pattern\n * - add to variableToFill as: { en: 'movieID' } (useful for mapTo)\n * - variables that have a value set:\n * - replace placeholder with actual value\n */\nexport function resolveOrRemoveVariables(pattern: DatalogQueryPattern, candidate: SearchContext) {\n\tlet variablesToFill = {} as Partial<{ [key in keyof Applog]: string }>\n\tconst newPattern = Object.entries(pattern).reduce((acc, [patternKey, patternValue]) => {\n\t\tif (isVariable(patternValue)) {\n\t\t\tconst varName = variableNameWithoutQuestionmark(patternValue)\n\t\t\tconst candidateValue = candidate[varName]\n\t\t\tif (candidateValue) {\n\t\t\t\tacc[patternKey] = candidateValue\n\t\t\t} else {\n\t\t\t\tvariablesToFill[patternKey] = varName\n\t\t\t\t// do nothing to acc = remove field from pattern\n\t\t\t}\n\t\t} else {\n\t\t\tacc[patternKey] = patternValue // keep static value\n\t\t}\n\t\treturn acc\n\t}, {})\n\n\treturn [newPattern, variablesToFill]\n}\n\nfunction matchVariable(variable: string, triplePart: ApplogValue, context: SearchContext): SearchContext {\n\tif (context.hasOwnProperty(variable)) {\n\t\t// TODO: fix lint error with: if (Object.hasOwnProperty.call(context, variable)) {\n\t\tconst bound = context[variable]\n\t\tconst match = matchPart(bound, triplePart, context)\n\t\tVERBOSE('[matchVariable] match?', variable, bound, match)\n\t\treturn match\n\t}\n\tVERBOSE('[matchVariable] initializing variable', variable, 'to', triplePart)\n\treturn { ...context, [variable]: triplePart }\n}\n\nexport function matchPartStatic(field: keyof Applog, patternPart: ValueOrMatcher<ApplogValue>, atomPart: ApplogValue): boolean {\n\tVERBOSE('[matchPartStatic]', field, patternPart, patternPart === atomPart ? '===' : '!==', atomPart)\n\n\tconst result = (() => {\n\t\tif (typeof patternPart === 'function') {\n\t\t\treturn patternPart(atomPart)\n\t\t}\n\t\tif (Array.isArray(patternPart) && !Array.isArray(atomPart) /* ? how to handle array values */) {\n\t\t\treturn patternPart.includes(atomPart)\n\t\t}\n\t\t// if (field === 'at' && typeof patternPart === 'string' && patternPart.endsWith('*')) {\n\t\t// \treturn typeof atomPart === 'string' && atomPart.startsWith(patternPart.slice(0, -1))\n\t\t// }\n\t\treturn patternPart === atomPart\n\t})()\n\n\tVERBOSE('[matchPartStatic] =>', field.startsWith('!') ? '!' : '', result)\n\tif (field.startsWith('!')) {\n\t\treturn !result\n\t} else {\n\t\treturn result\n\t}\n}\nexport function matchPart(patternPart: ValueOrMatcher<ApplogValue>, atomPart: ApplogValue, context: SearchContext): ResultContext {\n\tif (!context) {\n\t\tVERBOSE('[matchPart] no context')\n\t\treturn null\n\t}\n\tif (typeof patternPart === 'string') {\n\t\tif (isVariable(patternPart)) {\n\t\t\treturn matchVariable(patternPart, atomPart, context)\n\t\t} /* TODO: else if (isIgnorePattern(patternPart)) {\n\t\t\treturn matchVariable(patternPart, atomPart, context)\n\t\t} */\n\t}\n\tVERBOSE('[matchPart]', patternPart, patternPart === atomPart ? '===' : '!==', atomPart)\n\tif (typeof patternPart === 'function') {\n\t\treturn patternPart(atomPart) ? context : null\n\t}\n\treturn patternPart === atomPart ? context : null\n}\n\n/**\n * Check if pattern matches triple with context substitutions\n */\nexport function matchPattern(pattern: DatalogQueryPattern, applog: Applog, context: SearchContext): ResultContext {\n\treturn Object.entries(pattern).reduce((context, [field, patternValue]) => {\n\t\tconst applogValue = applog[field]\n\t\t// @ts-expect-error wtf no idea //HACK: ts weird\n\t\tconst patternValT: ValueOrMatcher<ApplogValue> = patternValue\n\t\treturn matchPart(patternValT, applogValue, context)\n\t}, context)\n}\n\nexport function actualize<SELECT extends string>(context: ResultContext, find: readonly SELECT[]): DatalogQueryResultEntry<SELECT> {\n\treturn Object.fromEntries(find.map((findField) => {\n\t\tif (context === null) {\n\t\t\tthrow new Error(`actualize context is null ${find}`)\n\t\t}\n\t\treturn [\n\t\t\tisVariable(findField) ? findField.replace(/^\\?/, '') : findField,\n\t\t\tisVariable(findField) ? context[findField] : findField,\n\t\t]\n\t})) as DatalogQueryResultEntry<SELECT>\n}\nconst sum = function sum(array: number[]) {\n\tvar num = 0\n\tfor (var i = 0, l = array.length; i < l; i++) num += array[i]\n\treturn num\n}\nconst mean = function mean(array: number[]) {\n\treturn sum(array) / array.length\n}\nexport const arrStats = {\n\tmax: function(array: number[]) {\n\t\treturn Math.max.apply(null, array)\n\t},\n\n\tmin: function(array: number[]) {\n\t\treturn Math.min.apply(null, array)\n\t},\n\n\trange: function(array: number[]) {\n\t\treturn arrStats.max(array) - arrStats.min(array)\n\t},\n\n\tmidrange: function(array: number[]) {\n\t\treturn arrStats.range(array) / 2\n\t},\n\n\tsum,\n\n\tmean,\n\n\taverage: mean,\n\n\tmedian: function(array: number[]) {\n\t\tarray.sort(function(a, b) {\n\t\t\treturn a - b\n\t\t})\n\t\tvar mid = array.length / 2\n\t\treturn mid % 1 ? array[mid - 0.5] : (array[mid - 1] + array[mid]) / 2\n\t},\n\n\tmodes: function(array: number[]) {\n\t\tif (!array.length) return []\n\t\tvar modeMap = {},\n\t\t\tmaxCount = 0,\n\t\t\tmodes = []\n\n\t\tarray.forEach(function(val) {\n\t\t\tif (!modeMap[val]) modeMap[val] = 1\n\t\t\telse modeMap[val]++\n\n\t\t\tif (modeMap[val] > maxCount) {\n\t\t\t\tmodes = [val]\n\t\t\t\tmaxCount = modeMap[val]\n\t\t\t} else if (modeMap[val] === maxCount) {\n\t\t\t\tmodes.push(val)\n\t\t\t\tmaxCount = modeMap[val]\n\t\t\t}\n\t\t})\n\t\treturn modes\n\t},\n\n\tvariance: function(array: number[]) {\n\t\tvar mean = arrStats.mean(array)\n\t\treturn arrStats.mean(array.map(function(num) {\n\t\t\treturn Math.pow(num - mean, 2)\n\t\t}))\n\t},\n\n\tstandardDeviation: function(array: number[]) {\n\t\treturn Math.sqrt(arrStats.variance(array))\n\t},\n\n\tmeanAbsoluteDeviation: function(array: number[]) {\n\t\tvar mean = arrStats.mean(array)\n\t\treturn arrStats.mean(array.map(function(num) {\n\t\t\treturn Math.abs(num - mean)\n\t\t}))\n\t},\n\n\tzScores: function(array: number[]) {\n\t\tvar mean = arrStats.mean(array)\n\t\tvar standardDeviation = arrStats.standardDeviation(array)\n\t\treturn array.map(function(num) {\n\t\t\treturn (num - mean) / standardDeviation\n\t\t})\n\t},\n}\n\n// Function aliases:\narrStats.average = arrStats.mean\n\nexport const tsNearlySame = (timeA: string, timeB: string) => timeB.startsWith(timeA.slice(0, timeA.length - 4)) // HACK: to quickly check if same second\n\n/*\n\t\t\t\tcyrb53 (c) 2018 bryc (github.com/bryc)\n\t\t\t\tA fast and simple hash function with decent collision resistance.\n\t\t\t\tLargely inspired by MurmurHash2/3, but with a focus on speed/simplicity.\n\t\t\t\tPublic domain. Attribution appreciated.\n\n\tripped from https://github.com/bryc/code/blob/mast`er/jshash/experimental/cyrb53.js\n*/\nexport const cyrb53hash = function(\n\tstr: string,\n\tseed = 13,\n\tstrLength: number, /* = 0 */\n) {\n\tif (!str?.length) {\n\t\tthrow new Error(`Empty string: ${str}`)\n\t}\n\n\tlet h1 = 0xdeadbeef ^ seed\n\tlet h2 = 0x41c6ce57 ^ seed\n\tfor (let i = 0, ch; i < str.length; i++) {\n\t\tch = str.charCodeAt(i)\n\t\th1 = Math.imul(h1 ^ ch, 2654435761)\n\t\th2 = Math.imul(h2 ^ ch, 1597334677)\n\t}\n\th1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909)\n\th2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909)\n\t// if (strLength) {\n\tconst asHex = (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16)\n\treturn asHex.slice(-strLength).padStart(strLength, '0')\n\t// }\n\t// // if not specified return as 16 digit integer\n\t// return 4294967296 * (2097151 & h2) + (h1 >>> 0)\n}\nexport function arraysContainSameElements(arr1, arr2) {\n\tif (arr1.length !== arr2.length) {\n\t\treturn false\n\t}\n\n\tconst sortedArr1 = [...arr1].sort()\n\tconst sortedArr2 = [...arr2].sort()\n\n\tfor (let i = 0; i < sortedArr1.length; i++) {\n\t\tif (sortedArr1[i] !== sortedArr2[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\nexport function dateNowIso(): string {\n\tconst now = new Date()\n\treturn now.toISOString()\n}\n","import { Logger } from 'besonders-logger'\nimport {\n\t_getGlobalState,\n\t_isComputingDerivation,\n\tcomparer,\n\tcomputed,\n\tconfigure,\n\tgetDependencyTree,\n\tgetObserverTree,\n\tIComputedValue,\n\tIObservableArray,\n\tisAction,\n\tobservable,\n\tonBecomeUnobserved,\n\tReaction,\n\trunInAction,\n\tspy,\n\ttrace,\n\tuntracked,\n} from 'mobx'\nimport { IComputedFnOptions } from 'mobx-utils/lib/computedFn'\nimport stringify from 'safe-stable-stringify'\nimport { DatalogQueryPattern } from '../data/datom-types'\nimport { QueryNodes } from '../queries/basic'\nimport { ApplogStream } from '../stream'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\n// mobx linting - https://mobx.js.org/configuration.html#linting-options\nconfigure({\n\tenforceActions: 'always',\n\t// disableErrorBoundaries: true // (i) this can be useful in case of exceptions to see where they were caused - https://mobx.js.org/configuration.html#disableerrorboundaries-boolean\n\t// computedRequiresReaction: true,\n\t// reactionRequiresObservable: true,\n\t// observableRequiresReaction: true,\n})\n// https://mobx.js.org/installation.html#use-spec-compliant-transpilation-for-class-properties\nif (\n\t!new class {\n\t\txyz\n\t}().hasOwnProperty('xyz')\n) throw new Error('Transpiler is not configured correctly')\n\nif (typeof window === 'object') {\n\t// @ts-expect-error window.\n\twindow.getDependencyTree = getDependencyTree\n\t// @ts-expect-error window.\n\twindow.getObserverTree = getObserverTree\n}\n\nVERBOSE.isDisabled || spy(event => {\n\tVERBOSE(`[mobx]`, event)\n})\n\nexport const createDebugName = ({ caller, stream, pattern: args }: {\n\tcaller?: string\n\tstream?: ApplogStream\n\tpattern?: DatalogQueryPattern | string // ? | any\n}) => {\n\tconst str = `${stream?.name ? stream.name + ' | ' : ''}${caller ?? 'caller?'}${\n\t\targs ? `{${typeof args === 'string' ? args : stringify(args)}}` : ''\n\t}`\n\treturn str\n}\nexport const createDebugNameObj = (args: Parameters<typeof createDebugName>[0]) => {\n\treturn { name: createDebugName(args) } as const\n}\n\nexport function computedStructuralComparer<T>(a: IComputedValue<T>, b: IComputedValue<T>) {\n\treturn untracked(() => comparer.structural(a.get(), b.get()))\n}\nexport function applogStreamComparer(a: ApplogStream, b: ApplogStream) {\n\treturn comparer.shallow(a.applogs, b.applogs)\n}\nexport function queryNodesComparer(a: QueryNodes, b: QueryNodes) {\n\tif (a.size !== b.size) return false\n\tfor (let i = 0; i < a.size; i++) {\n\t\tconst nodeA = a.nodes[i]\n\t\tconst nodeB = b.nodes[i]\n\t\tVERBOSE(`queryNodesComparer`, i, nodeA, nodeB)\n\t\tif (!comparer.structural(nodeA.variables, nodeB.variables)) {\n\t\t\treturn false\n\t\t}\n\t\tif (!applogStreamComparer(nodeA.logsOfThisNode, nodeB.logsOfThisNode)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nlet observableArrayMapID = 0\nexport function observableArrayMap<T>(fn: () => T[], { name, equals }: {\n\tname?: string\n\tequals?: typeof comparer.structural\n} = {}) {\n\t// if (!name) name = `${fn.name}_${fn.pattern}`\n\tVERBOSE(`[observableArrayMap] create`, { fnname: fn.name, fn, name, equals })\n\tconst debugName = `observableArrayMap@${++observableArrayMapID}{${name}}`\n\n\tlet observableArr: IObservableArray<T>\n\tlet items\n\n\tfunction runAndTrack() {\n\t\treaction.track(() => {\n\t\t\tDEBUG(`[${debugName}] runAndTrack:`, { name: name ?? fn.name, fn })\n\t\t\titems = fn()\n\t\t\tVERBOSE(`[${debugName}] runAndTrack =>`, items)\n\t\t})\n\t}\n\n\tconst reaction = new Reaction(debugName, (...args) => {\n\t\tVERBOSE(`[${debugName}] reaction.invalidate`, args)\n\t\trunAndTrack()\n\t\trunInAction(() => {\n\t\t\tif (!(equals ?? comparer.structural)(observableArr, items)) {\n\t\t\t\tobservableArr.replace(items)\n\t\t\t}\n\t\t})\n\t})\n\trunAndTrack() // initial run\n\n\tobservableArr = observable.array(items, /* ['NEVER'] as T[] */ { deep: false, name })\n\tVERBOSE(`[${debugName}] deps of reaction`, getDependencyTree(reaction), 'array:', getDependencyTree(observableArr), {\n\t\treaction,\n\t\tobservableArr,\n\t})\n\n\t// THIS STRATEGIES DON'T WORK BECAUSE:\n\t// - Affected reactions run by default immediately (synchronously) if an observable is changed.\n\t// However, they won't run before the end of the current outermost (trans)action.\n\t// (https://mobx.js.org/reactions.html#rules)\n\n\t// const disposer = reaction(\n\t// () => {\n\t// const items = fn();\n\t// VERBOSE(`[observableArrayMap] reaction.check`, items)\n\t// return items\n\t// }, // This function defines what to track\n\t// (items, reaction) => {\n\t// VERBOSE(`[observableArrayMap] reaction.react`, items, reaction)\n\t// runInAction(() => observableArr.replace(items))\n\t// },\n\t// {\n\t// fireImmediately: true // This ensures the reaction runs immediately upon creation\n\t// }\n\t// );\n\n\t// const disposer = autorun(() => {\n\t// const newItems = fn();\n\t// VERBOSE(`[observableArrayMap] items:`, newItems)\n\t// runInAction(() => observableArr.replace(newItems))\n\t// })\n\n\tconst unobserveUnobserving = onBecomeUnobserved(observableArr, () => {\n\t\tVERBOSE(`[observableArrayMap] dispose`)\n\t\t// disposer()\n\t\treaction.dispose()\n\t\tunobserveUnobserving()\n\t})\n\treturn observableArr\n}\n\n/**\n * ADAPTED from https://github.com/mobxjs/mobx-utils/blob/362cbbfb384820d416f253eddc532ebecba89bcb/src/computedFn.ts#L50 to\n * - deep-compare arguments\n * - allow dynamic/optional args\n * - not be so friggin complicated... DeepMap... closest... why?!\n *\n * // TODO: PR upstream\n *\n * computedFnDeepCompare takes a function with an arbitrary amount of arguments,\n * and memoizes the output of the function based on the arguments passed in.\n *\n * computedFnDeepCompare(fn) returns a function with the very same signature. There is no limit on the amount of arguments\n * that is accepted.\n *\n * By default the output of a function call will only be memoized as long as the\n * output is being observed.\n *\n * The function passes into `computedFnDeepCompare` should be pure, not be an action and only be relying on\n * observables.\n *\n * Setting `keepAlive` to `true` will cause the output to be forcefully cached forever.\n * Note that this might introduce memory leaks!\n *\n * @example\n * const store = observable({\n a: 1,\n b: 2,\n c: 3,\n m: computedFnDeepCompare(function(x) {\n return this.a * this.b * x\n })\n })\n\n const d = autorun(() => {\n // store.m(3) will be cached as long as this autorun is running\n console.log(store.m(3) * store.c)\n })\n *\n * @param fn\n * @param keepAliveOrOptions\n */\nexport function computedFnDeepCompare<T extends (...args: any[]) => any>(\n\tfn: T,\n\tkeepAliveOrOptions: (IComputedFnOptions<T> & { name?: string; argsDebugName?: (...args: Parameters<T>) => string }) | boolean = false,\n): T {\n\tif (isAction(fn)) throw new Error(\"computedFnDeepCompare shouldn't be used on actions\")\n\n\tlet memoWarned = false\n\tlet i = 0\n\tconst opts = typeof keepAliveOrOptions === 'boolean'\n\t\t? { keepAlive: keepAliveOrOptions }\n\t\t: keepAliveOrOptions\n\tconst map = new Map<Parameters<T>, IComputedValue<any>>()\n\n\treturn function(this: any, ...args: Parameters<T>): ReturnType<T> {\n\t\tlet existing\n\t\tconst untrackedArgs = untracked(() => args)\n\t\tconst debugName = `computedFnDeepCompare(${opts.name || fn.name}#${++i})${opts.argsDebugName ? `{${opts.argsDebugName(...args)}}` : ''}`\n\n\t\tfor (let [existingArgs, computation] of map.entries()) {\n\t\t\tif (comparer.structural(existingArgs, untrackedArgs)) {\n\t\t\t\texisting = computation\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// cache hit, return\n\t\tif (existing) {\n\t\t\tconst cachedResult = existing.get()\n\t\t\tVERBOSE(`[${debugName}] cache hit`, { untrackedArgs, cachedResult })\n\t\t\treturn cachedResult\n\t\t}\n\n\t\t// if function is invoked, and its a cache miss without reactive, there is no point in caching...\n\t\tif (!opts.keepAlive && !_isComputingDerivation()) {\n\t\t\tif (!memoWarned && _getGlobalState().computedRequiresReaction) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t\"invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set\",\n\t\t\t\t)\n\t\t\t\tmemoWarned = true\n\t\t\t}\n\t\t\treturn fn.apply(this, args)\n\t\t}\n\n\t\t// create new entry\n\t\tVERBOSE(`[${debugName}] new computation`, { untrackedArgs })\n\t\tlet latestValue: ReturnType<T> | undefined\n\t\tconst computation = computed(\n\t\t\t() => {\n\t\t\t\tVERBOSE(`[${debugName}] update->rerun`, untracked(() => ({ args })), fn)\n\t\t\t\tVERBOSE.isDisabled || trace()\n\t\t\t\treturn (latestValue = fn.apply(this, args))\n\t\t\t},\n\t\t\t{\n\t\t\t\t...opts,\n\t\t\t\tname: debugName,\n\t\t\t},\n\t\t)\n\t\tVERBOSE(`[${debugName}] deps`, getDependencyTree(computation), { untrackedArgs })\n\t\tmap.set(untrackedArgs, computation)\n\n\t\t// clean up if no longer observed\n\t\tif (!opts.keepAlive) {\n\t\t\tconst unobserveUnobserving = onBecomeUnobserved(computation, () => {\n\t\t\t\tVERBOSE(`[${debugName}] dispose`, computation)\n\t\t\t\tmap.delete(untrackedArgs)\n\t\t\t\tif (opts.onCleanup) opts.onCleanup(latestValue, ...args)\n\t\t\t\tlatestValue = undefined\n\t\t\t\tunobserveUnobserving()\n\t\t\t})\n\t\t}\n\t\t// return current val\n\t\treturn computation.get()\n\t} as any\n}\n\nexport function prettifyStreamName(input: string): string {\n\tlet depth = 0\n\tlet result = ''\n\tlet insideCurlyBraces = 0\n\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst char = input[i]\n\n\t\tif (char === '(') {\n\t\t\tresult += char + '\\n' + '\\t'.repeat(++depth)\n\t\t} else if (char === ')') {\n\t\t\tresult += '\\n' + '\\t'.repeat(--depth) + char\n\t\t} else if (char === ',' && insideCurlyBraces === 0) {\n\t\t\tresult += char + '\\n' + '\\t'.repeat(depth)\n\t\t} else if (char === '{' && insideCurlyBraces === 0) {\n\t\t\tinsideCurlyBraces++\n\t\t\tresult += char + '\\n' + '\\t'.repeat(depth + 1)\n\t\t} else if (char === '}' && insideCurlyBraces === 1) {\n\t\t\tinsideCurlyBraces--\n\t\t\tresult += '\\n' + '\\t'.repeat(depth) + char\n\t\t} else if (char === '{' && insideCurlyBraces > 0) {\n\t\t\tinsideCurlyBraces++\n\t\t\tresult += char\n\t\t} else if (char === '}' && insideCurlyBraces > 1) {\n\t\t\tinsideCurlyBraces--\n\t\t\tresult += char\n\t\t} else {\n\t\t\tresult += char\n\t\t}\n\t}\n\n\treturn result\n}\n","import { computed, makeObservable, untracked } from 'mobx'\n\nimport { Logger } from 'besonders-logger'\nimport { arraysContainSameElements } from '../data/applog-utils'\nimport { areApplogsEqual } from '../data/applog-utils'\nimport { type Applog, ApplogForInsert } from '../data/datom-types'\nimport { prettifyStreamName } from '../mobx/mobx-utils'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO, { prefix: '[stream]' })\n\nexport type ApplogStreamEvent = { added: readonly Applog[]; removed: readonly Applog[] | null } | { init: readonly Applog[] }\nexport function isInitEvent(event: ApplogStreamEvent): event is { init: readonly Applog[] } {\n\treturn (event as any).init !== undefined\n}\n\nexport abstract class ApplogStream {\n\treadonly filters: string[]\n\treadonly parents: ApplogStream[] | null\n\tprotected _subscribers: ((event: ApplogStreamEvent) => void)[] = []\n\n\tconstructor(\n\t\tparents: ApplogStream | ApplogStream[] | null,\n\t\tfilters: string[],\n\t\tprotected _applogs: Applog[] = [],\n\t\treadonly name: string, /* = null */\n\t) {\n\t\tthis.parents = parents && !Array.isArray(parents) ? [parents] : (parents as ApplogStream[])\n\t\tthis.filters = filters // ? uniq([...parents?.map(p => p.filters), filters])\n\t\tif (this.parents?.length === 0) {\n\t\t\tthrow new Error(`Unhandled: empty parents`)\n\t\t}\n\t\tmakeObservable(this, {\n\t\t\t// applogs: computed, //observable.shallow,\n\t\t\t// applogsSorted: computed,\n\t\t\tsize: computed,\n\t\t\tisEmpty: computed,\n\t\t\tfirstLog: computed,\n\t\t\tlatestLog: computed,\n\t\t}, { name: `Stream{${name}}` })\n\t}\n\n\tabstract get readOnly(): boolean\n\n\tsubscribe(callback: (event: ApplogStreamEvent) => void) {\n\t\tthis._subscribers.push(callback)\n\t\treturn this.unsubscribe.bind(this, callback)\n\t}\n\n\tunsubscribe(callback: (event: ApplogStreamEvent) => void) {\n\t\tconst index = this._subscribers.indexOf(callback)\n\t\tif (index !== -1) {\n\t\t\tthis._subscribers.splice(index, 1)\n\t\t} else WARN(`unsubscribe called for non-existent`, callback)\n\t}\n\n\tprotected notifySubscribers(event: ApplogStreamEvent) {\n\t\tDEBUG(`[stream: ${this.name}] notifying`, this._subscribers.length, 'subscribers of', { ...event, subs: this._subscribers })\n\t\tfor (const subscriber of this._subscribers) {\n\t\t\tsubscriber(event)\n\t\t}\n\t}\n\n\tget applogs(): readonly Applog[] /* (i) only type hint, not actually immutable */ {\n\t\t// VERBOSE.isDisabled || trace()\n\t\treturn this._applogs\n\t}\n\n\tpublic map<R>(fn: (applog: Applog) => R) {\n\t\tif (!this.applogs.map) ERROR(`applogs arr?!`, this.applogs)\n\t\treturn this.applogs.map(fn)\n\t}\n\n\tget firstLog() {\n\t\treturn this.applogs[0]\n\t}\n\tget latestLog() {\n\t\treturn this.applogs[this.applogs.length - 1]\n\t}\n\tpublic hasApplog(applog: Applog, byRef: boolean) {\n\t\tif (byRef) {\n\t\t\treturn this.applogs.includes(applog)\n\t\t} else {\n\t\t\tconst keySet = Object.keys(applog) // HACK: sanity check to catch bugs\n\t\t\treturn !!this.applogs.find(log => {\n\t\t\t\tif (!arraysContainSameElements(keySet, Object.keys(log))) {\n\t\t\t\t\tthrow ERROR(`[hasApplog] field set mismatch:`, { applog, log })\n\t\t\t\t}\n\t\t\t\treturn areApplogsEqual(log, applog)\n\t\t\t})\n\t\t}\n\t}\n\n\tpublic hasApplogWithDiffTs(applog: ApplogForInsert) {\n\t\t// HACK this is basically as inefficient as it gets\n\t\treturn this.applogs.find(existing => (\n\t\t\texisting.en === applog.en\n\t\t\t&& existing.at === applog.at\n\t\t\t&& existing.vl === applog.vl\n\t\t\t&& existing.ag === applog.ag\n\t\t))\n\t}\n\n\tget isEmpty() {\n\t\treturn this.size === 0\n\t}\n\tget size() {\n\t\treturn this.applogs.length\n\t}\n\tget untrackedSize() {\n\t\treturn untracked(() => this.size)\n\t}\n\tget nameAndSizeUntracked() {\n\t\treturn untracked(() => `${this.name} (${this.size})`)\n\t}\n\tget prettyName() {\n\t\treturn prettifyStreamName(this.name)\n\t}\n}\n","import { Logger } from 'besonders-logger'\nimport { sortedIndexBy } from 'lodash-es'\nimport { action, getDependencyTree, IObservableArray, makeObservable, observable, toJS, untracked } from 'mobx'\nimport { Applog } from '../data/datom-types'\nimport { ApplogStream, ApplogStreamEvent, isInitEvent } from './basic'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport type ApplogEventMapper = (this: MappedApplogStream, event: ApplogStreamEvent, sourceStream: ApplogStream) => ApplogStreamEvent\n\nexport class MappedApplogStream extends ApplogStream {\n\tprivate _parentSubscriptions: Map<ApplogStream, ((event: ApplogStreamEvent) => void)> = new Map()\n\n\tconstructor(\n\t\tparents: ApplogStream | ApplogStream[],\n\t\tfilters: string[],\n\t\treadonly _initialLogs: readonly Applog[],\n\t\tprivate _eventMapper: ApplogEventMapper,\n\t\treadonly name: string,\n\t) {\n\t\t// if (!isObservableArray(_initialLogs)) WARN(`[MappedApplogStream: ${name}] initialized with non-observable array`, _initialLogs)\n\t\tsuper(\n\t\t\tparents,\n\t\t\tfilters,\n\t\t\tobservable.array([..._initialLogs], { deep: false, name: `${name}.array` }), // ? not sure if array clone is totally necessary - but I also don't want to risk weird bugs\n\t\t\tname,\n\t\t)\n\n\t\tmakeObservable(this, {\n\t\t\t// @ts-expect-error bc it's private\n\t\t\tonParentUpdate: action,\n\t\t})\n\n\t\tthis.subscribeToParent()\n\t}\n\n\tget readOnly() {\n\t\tif (this.parents.length !== 1) return true\n\t\treturn this.parents[0].readOnly\n\t}\n\n\tprivate subscribeToParent() {\n\t\tif (!this.parents.length) {\n\t\t\tWARN(`MappedStream has no parents`, this)\n\t\t}\n\t\tif (this._parentSubscriptions.size) {\n\t\t\tthrow ERROR(`parents subs must not be called twice`, this)\n\t\t}\n\t\tVERBOSE(`[MappedStream: ${this.name}] subscribing to parents:`, this.parents.map(p => p.name))\n\t\tthis.parents.forEach(p => {\n\t\t\tconst sub = this.onParentUpdate.bind(this, p)\n\t\t\tp.subscribe(sub)\n\t\t\tthis._parentSubscriptions.set(p, sub)\n\t\t})\n\n\t\t// TODO: how to check when to dispose this?\n\t\t// onBecomeUnobserved(this as unknown as IObservable, '_applogs', () => {\n\t\t// DEBUG(`[MappedStream: ${this.name}] disposed - unsubscribing from parents:`, { parents: this.parents, subs: this._parentSubscriptions })\n\t\t// if (this._subscribers.length) WARN(`[MappedStream: ${this.name}] disposed but got subscriptions:`, this._subscribers)\n\t\t// this.parents.forEach(p => {\n\t\t// const sub = this.onParentUpdate.bind(this, p)\n\t\t// p.unsubscribe(sub)\n\t\t// this._parentSubscriptions.delete(p)\n\t\t// })\n\t\t// })\n\t}\n\n\t/**\n\t * // HACK to trigger remap on pattern change in rollingFilter\n\t * should not be used lightly\n\t */\n\ttriggerRemap() {\n\t\tVERBOSE(`MappedStream{${this.nameAndSizeUntracked}} triggerRemap`)\n\t\tthis.parents.forEach(p => {\n\t\t\tthis.onParentUpdate(p, { init: untracked(() => toJS(p.applogs)) })\n\t\t})\n\t}\n\n\tprotected onParentUpdate(stream: ApplogStream, event: ApplogStreamEvent) {\n\t\tVERBOSE(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate`, event)\n\t\tconst mapResult = this._eventMapper(event, stream)\n\t\tVERBOSE(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate => mapped`, mapResult)\n\t\tif (isInitEvent(mapResult)) {\n\t\t\t;(this._applogs as IObservableArray<Applog>).replace([...mapResult.init])\n\t\t} else {\n\t\t\tfor (const log of mapResult.added) {\n\t\t\t\t// insert at right location to maintain sort order\n\t\t\t\tthis._applogs.splice(sortedIndexBy(this._applogs, log, 'ts'), 0, log)\n\t\t\t}\n\t\t\tif (mapResult.removed) {\n\t\t\t\tfor (const toRemove of mapResult.removed) {\n\t\t\t\t\tif (!(this._applogs as IObservableArray<Applog>).remove(toRemove)) {\n\t\t\t\t\t\tif (!isInitEvent(event) && event.removed?.includes(toRemove)) {\n\t\t\t\t\t\t\tDEBUG(`Ignoring remove event for non-existent because it was part of parent event's removed`, toRemove, event) // ? convenience? - or is this a code smell?\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow ERROR(`MappedStream{${this.name}} toRemove contained log that doesn't exist`, toRemove, {\n\t\t\t\t\t\t\t\tstream: this,\n\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\tmapResult,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tVERBOSE(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate => deps?`, getDependencyTree(this._applogs))\n\t\tthis.notifySubscribers(mapResult)\n\t}\n}\n","import { Logger } from 'besonders-logger'\nimport { action, IObservableArray, observable, ObservableMap, ObservableSet, onBecomeUnobserved, reaction, toJS, untracked } from 'mobx'\nimport stringify from 'safe-stable-stringify'\nimport { matchPartStatic } from '../data/applog-utils'\nimport { Applog, ApplogValue, DatalogQueryPattern, ValueOrMatcher } from '../data/datom-types'\nimport { applogStreamComparer, computedFnDeepCompare } from '../mobx/mobx-utils'\nimport { ApplogStream, ApplogStreamEvent, isInitEvent } from './basic'\nimport { ApplogEventMapper, MappedApplogStream } from './mapped'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport const rollingFilter = computedFnDeepCompare(function rollingFilter(\n\tstream: ApplogStream,\n\tpattern: DatalogQueryPattern,\n\topts: { name?: string; extraFilterName?: string } = {},\n) {\n\tlet untrackedPattern = getUntrackedPattern(pattern) // updated in reaction\n\tlet filter = makeFilter(untrackedPattern) // updated in reaction\n\n\t// we are not tracking the filter results here as we are subscribing explicitly to the stream below\n\tconst observableArr = observable.array(\n\t\tuntracked(() => filter(stream.applogs)),\n\t\t{ deep: false, name: `${stream.name} | ${opts.name || `rollingFilter.array{${stringify(untrackedPattern)}}`}` },\n\t)\n\tconst filterAdded: ApplogEventMapper = (event) => {\n\t\tlet mappedEvent: ApplogStreamEvent\n\t\tif (isInitEvent(event)) {\n\t\t\tmappedEvent = { init: filter(event.init) }\n\t\t} else {\n\t\t\tmappedEvent = {\n\t\t\t\tadded: filter(event.added),\n\t\t\t\tremoved: event.removed, // whatever's removed shall be removed\n\t\t\t}\n\t\t}\n\t\tVERBOSE(\n\t\t\t`rollingFilter{${stream.nameAndSizeUntracked} | ${opts.name ? ` '${opts.name}'}` : ''} parentUpdate`,\n\t\t\tuntrackedPattern,\n\t\t\tevent,\n\t\t\t'=>',\n\t\t\tmappedEvent,\n\t\t)\n\t\t// console.trace('rollingFilter.addFiltered', getObserverTree(observableArr))\n\t\t// trace()\n\t\treturn mappedEvent\n\t}\n\tconst mappedStream = new MappedApplogStream(\n\t\tstream,\n\t\t[...stream.filters, ...(opts.extraFilterName ? [opts.extraFilterName] : [])],\n\t\tobservableArr,\n\t\tfilterAdded,\n\t\t`${stream.name} | ${opts.name || `rollingFilter{${stringify(untrackedPattern)}}`}`,\n\t)\n\n\t// observe pattern manually and invalidate stream in case it changes\n\tconst cancelPatternReaction = reaction(() => JSON.parse(JSON.stringify(pattern)), (pat) => {\n\t\tVERBOSE(\n\t\t\t`rollingFilter<${stream.nameAndSizeUntracked}>${opts.name ? ` '${opts.name}'` : ''} patternUpdate`,\n\t\t\tuntrackedPattern,\n\t\t\t'=>',\n\t\t\tpat, /* , getDependencyTree(pat) */\n\t\t)\n\t\tuntrackedPattern = pat\n\t\tfilter = makeFilter(untrackedPattern)\n\t\tmappedStream.triggerRemap() // HACK\n\t})\n\n\tconst unobserveUnobserving = onBecomeUnobserved(observableArr, () => {\n\t\tVERBOSE(`rollingFilter<${stream.nameAndSizeUntracked}>${opts.name ? ` '${opts.name}'` : ''} unobserve`, untrackedPattern)\n\t\tcancelPatternReaction()\n\t\tunobserveUnobserving()\n\t})\n\n\treturn mappedStream\n}, { equals: applogStreamComparer, argsDebugName: (_, pattern, opts) => `${stringify(pattern)}, ${stringify(opts)}` })\n\nexport const rollingMapper = computedFnDeepCompare(function rollingMapper(\n\tstream: ApplogStream,\n\teventMapper: ApplogEventMapper,\n\topts: { name?: string; extraFilterName?: string } = {},\n) {\n\tconst initialMapResult = untracked(() => eventMapper.call(null, { init: stream.applogs }, stream))\n\tif (!isInitEvent(initialMapResult)) {\n\t\tthrow ERROR('Initial run must return init event')\n\t}\n\tconst initialLogs = initialMapResult.init\n\n\treturn new MappedApplogStream(\n\t\tstream,\n\t\t[...stream.filters, ...(opts.extraFilterName ? [opts.extraFilterName] : [])],\n\t\tinitialLogs,\n\t\teventMapper,\n\t\t`${stream.name} | ${opts.name || `rollingMapper`}`,\n\t)\n}, { equals: applogStreamComparer, argsDebugName: (_, pattern, opts) => `${stringify(pattern)}, ${stringify(opts)}` })\n\nexport const rollingAcc = computedFnDeepCompare(function rollingAcc<ACC extends IObservableArray | ObservableMap | ObservableSet>(\n\tstream: ApplogStream,\n\tacc: ACC,\n\teventMapper: (event: ApplogStreamEvent, acc: ACC) => void,\n) {\n\teventMapper = action(eventMapper)\n\teventMapper({ init: stream.applogs }, acc)\n\tstream.subscribe(event => {\n\t\teventMapper(event, acc)\n\t})\n\n\treturn acc\n}, { argsDebugName: (stream) => `rollingAcc{${stream.nameAndSizeUntracked}}` })\n\n// function rollingFilter(\n// db: ApplogStreamIDB,\n// filter: (logs: Applog[]) => Applog[],\n// name: string,\n// ) {\n// const filtered = observable.array(filter(untracked(() => db.applogs)), { deep: false });\n\n// const observableArr = rollingFilter(filter, db)\n// const addFiltered = /* action( */(added: Applog[]) => {\n// VERBOSE(`rollingFilter<${db.nameAndSize}>.update`, pattern, added)\n// // filter(added).forEach(log => result.push(log)) //? no bulk insert?\n// observableArr.push(...added)\n// }/* ) */;\n\n// db.subscribe(addFiltered);\n// onBecomeUnobserved(filtered, () => {\n// VERBOSE(`rollingFilter<${db.nameAndSize}>.unobserve`, filter)\n// db.unsubscribe(addFiltered);\n// });\n// return new ApplogStream(filtered, `${db.name} | ${name}`)\n// }\n\nexport const getUntrackedPattern = function getUntrackedPattern(\n\tpattern: DatalogQueryPattern,\n) {\n\tconst untrackedPattern = untracked(() => Object.fromEntries(Object.entries(toJS(pattern)).map(([k, v]) => [toJS(k), toJS(v)])))\n\tif (!Object.entries(untrackedPattern).length) {\n\t\tthrow new Error(`Pattern is empty`)\n\t}\n\treturn untrackedPattern\n}\nexport function makeFilter(\n\tpattern: DatalogQueryPattern,\n) {\n\treturn (logs: readonly Applog[]) =>\n\t\tlogs.filter(applog => {\n\t\t\tfor (const [field, patternValue] of Object.entries(pattern)) {\n\t\t\t\tconst applogValue = applog[field.startsWith('!') ? field.slice(1) : field]\n\t\t\t\t// @ts-expect-error wtf no idea //HACK: ts weird\n\t\t\t\tconst patternValT: ValueOrMatcher<ApplogValue> = patternValue\n\t\t\t\tif (!matchPartStatic(field as keyof Applog, patternValT, applogValue)) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t})\n}\n\n/**\n * // ! think twice before using\n */\nexport const getUntrackedFilterResults = function getUntrackedFilterResults(\n\tstream: ApplogStream,\n\tpattern: DatalogQueryPattern,\n\topts: { name?: string } = {},\n) {\n\tconst untrackedPattern = getUntrackedPattern(pattern)\n\tconst filter = makeFilter(untrackedPattern)\n\treturn untracked(() => filter(stream.applogs))\n}\n\n///////////////////////////\n// FILTERED STREAM TYPES //\n///////////////////////////\nexport type ApplogStreamWithFilter<T extends string> = ApplogStream & {\n\tfilters: T[]\n}\nexport function hasFilter<T extends string>(stream: ApplogStream, filter: T): stream is ApplogStreamWithFilter<T> {\n\treturn stream.filters.includes(filter)\n}\nexport function assertRaw(stream: ApplogStream) /* : stream is ApplogStreamWithoutFilters */ {\n\tif (stream.filters.length) {\n\t\tthrow ERROR(`should be unfiltered stream, but is:`, stream.filters)\n\t}\n\treturn stream as ApplogStreamWithoutFilters\n}\nexport function assertOnlyCurrent(stream: ApplogStream) /* : stream is ApplogStreamOnlyCurrent */ {\n\tif (\n\t\t!hasFilter(stream, 'withoutHistory') ||\n\t\t!hasFilter(stream, 'withoutDeleted')\n\t) throw ERROR(`should be filtered stream, but is:`, stream.filters)\n\treturn stream\n}\nexport type ApplogStreamOnlyCurrent = ApplogStreamWithFilter<'withoutHistory' | 'withoutDeleted'>\nexport type ApplogStreamWithoutFilters = ApplogStream & { filters: [] }\n"],"mappings":";;;;;AAAA,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,OAAO,eAAe;AAWtB,IAAM,EAAE,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,OAAO,MAAM,OAAO,KAAK;AAE/D,IAAM,oBAAoB,CAAC,MAAc,MAAc,MAAsB,UACnF,QAAQ,QACL,KAAK,cAAc,MAAM,OAAO,IAChC,KAAK,cAAc,MAAM,OAAO;AAE7B,SAAS,gBAAgB,aAAuB,MAAsB,OAAO;AACnF,SAAO,YAAY,KAAK,CAAC,GAAG,MAAM,kBAAkB,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC;AACrE;AACO,IAAM,aAAa,CAAC,KAAa,iBAAyB,SAAS,IAAI,KAAK,IAAI,EAAE,GAAG,IAAI,KAAK,aAAa,EAAE,CAAC;AAC9G,IAAM,sBAAsB,CAAC,gBAA0B,CAAC,GAAG,IAAI,IAAI,YAAY,IAAI,aAAW,QAAQ,EAAE,CAAC,CAAC;AAC1G,IAAM,kBAAkB,CAAC,MAAc,SAAiB,SAAS,WAAW,MAAM,IAAI;AAEtF,IAAM,yBAAyB,CAAC,gBAA0B;AAChE,QAAM,SAAS,oBAAI,IAAI;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,WAAW,GAAG,IAAI,MAAM,MAAM,CAAC,IAAI,KAAK;AAEzE,YAAM,cAA2C;AACjD,UAAI,CAAC,gBAAgB,OAAuB,aAAa,WAAW,GAAG;AACtE,eAAO;AAAA,MACR;AAAA,IACD;AACA,WAAO;AAAA,EACR,CAAC;AACH;AAKO,IAAM,4BAA4B,SAASC,2BACjD,QACA,SACA,OAA0B,CAAC,GAC1B;AACD,QAAM,mBAAmB,oBAAoB,OAAO;AACpD,QAAM,SAAS,WAAW,gBAAgB;AAC1C,SAAOR,WAAU,MAAM,OAAO,OAAO,OAAO,CAAC;AAC9C;AAQO,SAAS,UAA4B,QAAsB,QAAgD;AACjH,SAAO,OAAO,QAAQ,SAAS,MAAM;AACtC;AACO,SAAS,UAAU,QAAmE;AAC5F,MAAI,OAAO,QAAQ,QAAQ;AAC1B,UAAMJ,OAAM,wCAAwC,OAAO,OAAO;AAAA,EACnE;AACA,SAAO;AACR;AACO,SAAS,kBAAkB,QAAgE;AACjG,MACC,CAAC,UAAU,QAAQ,gBAAgB,KACnC,CAAC,UAAU,QAAQ,gBAAgB;AAClC,UAAMA,OAAM,sCAAsC,OAAO,OAAO;AAClE,SAAO;AACR;","names":["context","sum","mean","Logger","comparer","stringify","WARN","LOG","DEBUG","VERBOSE","ERROR","Logger","stringify","comparer","reaction","computation","computed","untracked","Logger","WARN","LOG","DEBUG","VERBOSE","ERROR","Logger","computed","untracked","Logger","getDependencyTree","makeObservable","observable","untracked","WARN","LOG","DEBUG","VERBOSE","ERROR","Logger","observable","makeObservable","untracked","getDependencyTree","Logger","action","observable","onBecomeUnobserved","toJS","untracked","stringify","WARN","LOG","DEBUG","VERBOSE","ERROR","Logger","rollingFilter","observable","untracked","stringify","onBecomeUnobserved","rollingMapper","rollingAcc","action","getUntrackedPattern","toJS","getUntrackedFilterResults"]}
|
package/dist/chunk-OOC3HK3E.cjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/ipfs/car.ts
|
|
2
|
-
var _car = require('@ipld/car');
|
|
3
|
-
var _dagjson = require('@ipld/dag-json'); var dagJson = _interopRequireWildcard(_dagjson);
|
|
4
|
-
var _besonderslogger = require('besonders-logger');
|
|
5
|
-
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = _besonderslogger.Logger.setup(_besonderslogger.Logger.INFO);
|
|
6
|
-
async function decodeCarToApplogs(car) {
|
|
7
|
-
const { roots, blocks } = await decodeCar(car);
|
|
8
|
-
if (!roots || !blocks) {
|
|
9
|
-
throw ERROR("decodeCar is funky", { roots, blocks });
|
|
10
|
-
}
|
|
11
|
-
if (roots.length !== 1) {
|
|
12
|
-
WARN("Unexpected roots count:", roots);
|
|
13
|
-
}
|
|
14
|
-
const root = blocks.get(roots[0]);
|
|
15
|
-
const applogs = root.applogs.map((cid) => {
|
|
16
|
-
const applog = blocks.get(cid.toV1().toString());
|
|
17
|
-
return {
|
|
18
|
-
...applog,
|
|
19
|
-
cid: cid.toString()
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
DEBUG("Decoded car logs:", root, { roots, blocks, applogs });
|
|
23
|
-
return { applogs };
|
|
24
|
-
}
|
|
25
|
-
async function decodeCar(car) {
|
|
26
|
-
const roots = (await car.getRoots()).map((c) => c.toV1().toString());
|
|
27
|
-
const blocks = /* @__PURE__ */ new Map();
|
|
28
|
-
for await (const { cid, bytes } of car.blocks()) {
|
|
29
|
-
blocks.set(cid.toV1().toString(), dagJson.decode(bytes));
|
|
30
|
-
}
|
|
31
|
-
return { roots, blocks };
|
|
32
|
-
}
|
|
33
|
-
async function makeCarOut(roots, blocks) {
|
|
34
|
-
const { writer, out } = _car.CarWriter.create(Array.isArray(roots) ? roots : [roots]);
|
|
35
|
-
VERBOSE(`Writing ${blocks.length} blocks to CAR`, { roots, blocks });
|
|
36
|
-
blocks.forEach((b) => writer.put(b));
|
|
37
|
-
writer.close();
|
|
38
|
-
return out;
|
|
39
|
-
}
|
|
40
|
-
async function makeCarBlob(roots, blocks) {
|
|
41
|
-
const carOut = await makeCarOut(roots, blocks);
|
|
42
|
-
const chunks = [];
|
|
43
|
-
for await (const chunk of carOut) {
|
|
44
|
-
chunks.push(chunk);
|
|
45
|
-
}
|
|
46
|
-
const blob = new Blob(chunks);
|
|
47
|
-
return blob;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
exports.decodeCarToApplogs = decodeCarToApplogs; exports.decodeCar = decodeCar; exports.makeCarOut = makeCarOut; exports.makeCarBlob = makeCarBlob;
|
|
56
|
-
//# sourceMappingURL=chunk-OOC3HK3E.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ipfs/car.ts"],"names":[],"mappings":";AAAA,SAAoB,iBAAiB;AACrC,YAAY,aAAa;AACzB,SAAS,cAAc;AAIvB,IAAM,EAAE,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,OAAO,MAAM,OAAO,IAAI;AAKrE,eAAsB,mBAAmB,KAAgB;AACxD,QAAM,EAAE,OAAO,OAAO,IAAI,MAAM,UAAU,GAAG;AAC7C,MAAI,CAAC,SAAS,CAAC,QAAQ;AACtB,UAAM,MAAM,sBAAsB,EAAE,OAAO,OAAO,CAAC;AAAA,EACpD;AAEA,MAAI,MAAM,WAAW,GAAG;AACvB,SAAK,2BAA2B,KAAK;AAAA,EACtC;AACA,QAAM,OAAO,OAAO,IAAI,MAAM,CAAC,CAAC;AAChC,QAAM,UAAsC,KAAK,QAAQ,IAAI,CAAC,QAAa;AAC1E,UAAM,SAAS,OAAO,IAAI,IAAI,KAAK,EAAE,SAAS,CAAC;AAC/C,WAAO;AAAA,MACN,GAAG;AAAA,MACH,KAAK,IAAI,SAAS;AAAA,IACnB;AAAA,EACD,CAAC;AACD,QAAM,qBAAqB,MAAM,EAAE,OAAO,QAAQ,QAAQ,CAAC;AAC3D,SAAO,EAAE,QAAQ;AAClB;AAEA,eAAsB,UAAU,KAAgB;AAC/C,QAAM,SAAS,MAAM,IAAI,SAAS,GAAG,IAAI,OAAK,EAAE,KAAK,EAAE,SAAS,CAAc;AAC9E,QAAM,SAAS,oBAAI,IAAoB;AACvC,mBAAiB,EAAE,KAAK,MAAM,KAAK,IAAI,OAAO,GAAG;AAChD,WAAO,IAAI,IAAI,KAAK,EAAE,SAAS,GAAW,eAAO,KAAK,CAAC;AAAA,EACxD;AACA,SAAO,EAAE,OAAO,OAAO;AACxB;AAGA,eAAsB,WAAW,OAAkB,QAAuB;AACzE,QAAM,EAAE,QAAQ,IAAI,IAAI,UAAU,OAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;AAG/E,UAAQ,WAAW,OAAO,MAAM,kBAAkB,EAAE,OAAO,OAAO,CAAC;AACnE,SAAO,QAAQ,OAAK,OAAO,IAAI,CAAC,CAAC;AACjC,SAAO,MAAM;AAEb,SAAO;AACR;AAWA,eAAsB,YAAY,OAAkB,QAAuB;AAC1E,QAAM,SAAS,MAAM,WAAW,OAAO,MAAM;AAC7C,QAAM,SAAS,CAAC;AAChB,mBAAiB,SAAS,QAAQ;AACjC,WAAO,KAAK,KAAK;AAAA,EAClB;AACA,QAAM,OAAO,IAAI,KAAK,MAAM;AAC5B,SAAO;AACR","sourcesContent":["import { CarReader, CarWriter } from '@ipld/car'\nimport * as dagJson from '@ipld/dag-json'\nimport { Logger } from 'besonders-logger'\nimport { CID } from 'multiformats'\nimport { Applog, CidString } from '../data/datom-types'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport type CIDForCar = Exclude<Parameters<(typeof CarWriter)['create']>[0], void>\nexport type BlockForCar = Parameters<CarWriter['put']>[0]\n\nexport async function decodeCarToApplogs(car: CarReader) {\n\tconst { roots, blocks } = await decodeCar(car)\n\tif (!roots || !blocks) {\n\t\tthrow ERROR('decodeCar is funky', { roots, blocks })\n\t}\n\n\tif (roots.length !== 1) {\n\t\tWARN('Unexpected roots count:', roots)\n\t}\n\tconst root = blocks.get(roots[0])\n\tconst applogs: Array<Applog | Uint8Array> = root.applogs.map((cid: CID) => {\n\t\tconst applog = blocks.get(cid.toV1().toString())\n\t\treturn {\n\t\t\t...applog,\n\t\t\tcid: cid.toString(),\n\t\t}\n\t})\n\tDEBUG('Decoded car logs:', root, { roots, blocks, applogs })\n\treturn { applogs }\n}\n\nexport async function decodeCar(car: CarReader) {\n\tconst roots = (await car.getRoots()).map(c => c.toV1().toString() as CidString)\n\tconst blocks = new Map<CidString, any>()\n\tfor await (const { cid, bytes } of car.blocks()) {\n\t\tblocks.set(cid.toV1().toString(), dagJson.decode(bytes)) // HACK: tried using CID as map key, but because it's based on referential equality it's not working\n\t}\n\treturn { roots, blocks }\n}\n\n// make out in the car... been a while but also sounds nice\nexport async function makeCarOut(roots: CIDForCar, blocks: BlockForCar[]) {\n\tconst { writer, out } = CarWriter.create(Array.isArray(roots) ? roots : [roots])\n\n\t// add the blocks to the CAR and close it\n\tVERBOSE(`Writing ${blocks.length} blocks to CAR`, { roots, blocks })\n\tblocks.forEach(b => writer.put(b))\n\twriter.close()\n\t// VERBOSE(`Wrote ${blocks.length} blocks to CAR`, writer)\n\treturn out\n} /** create a new CarWriter, with the encoded block as the root */\n\n// export async function makeCarReader(roots: CIDForCar, blocks: BlockForCar[]) {\n// \tconst out = await makeCarOut(roots, blocks)\n\n// \t// create a new CarReader we can hand to web3.storage.putCar\n// \tconst reader = await CarReader.fromIterable(out)\n// \tVERBOSE(`CAR reader`, reader)\n// \treturn reader\n// } /** create a new CarWriter, with the encoded block as the root */\n\nexport async function makeCarBlob(roots: CIDForCar, blocks: BlockForCar[]) {\n\tconst carOut = await makeCarOut(roots, blocks)\n\tconst chunks = []\n\tfor await (const chunk of carOut) {\n\t\tchunks.push(chunk)\n\t}\n\tconst blob = new Blob(chunks)\n\treturn blob\n}\n"]}
|
package/dist/chunk-QXNFGJ5R.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// src/ipfs/ipfs-utils.ts
|
|
2
|
-
import * as dagJson from "@ipld/dag-json";
|
|
3
|
-
import { sha256 } from "@noble/hashes/sha256";
|
|
4
|
-
import { Logger } from "besonders-logger";
|
|
5
|
-
import { CID, digest as Digest } from "multiformats";
|
|
6
|
-
import { encode as multiformatsEncode } from "multiformats/block";
|
|
7
|
-
import { sha256 as sha265Hasher } from "multiformats/hashes/sha2";
|
|
8
|
-
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO);
|
|
9
|
-
function prepareForPub(log, without = ["cid"]) {
|
|
10
|
-
const logWithout = {};
|
|
11
|
-
for (let [key, val] of Object.entries(log)) {
|
|
12
|
-
if (val === void 0) {
|
|
13
|
-
WARN(`log.${key} is undefined, which is not allowed - encoding as null`, log);
|
|
14
|
-
val = null;
|
|
15
|
-
}
|
|
16
|
-
if (!without.includes(key)) {
|
|
17
|
-
logWithout[key] = val && key === "pv" ? CID.parse(val) : val;
|
|
18
|
-
} else {
|
|
19
|
-
VERBOSE("excluding app log", { key, val });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return logWithout;
|
|
23
|
-
}
|
|
24
|
-
function encodeApplogAndGetCid(log) {
|
|
25
|
-
return getCidSync(encodeApplog(log).bytes);
|
|
26
|
-
}
|
|
27
|
-
function encodeApplog(log) {
|
|
28
|
-
return encodeBlock(prepareForPub(log));
|
|
29
|
-
}
|
|
30
|
-
function getCidSync(bytes) {
|
|
31
|
-
const hash = sha256(bytes);
|
|
32
|
-
const digest = Digest.create(sha265Hasher.code, hash);
|
|
33
|
-
const cid = CID.create(1, dagJson.code, digest);
|
|
34
|
-
VERBOSE(`[getCidSync]`, { bytes, hash, digest, cid });
|
|
35
|
-
return cid;
|
|
36
|
-
}
|
|
37
|
-
function encodeBlock(jsonObject) {
|
|
38
|
-
DEBUG("[encodeBlock]", jsonObject);
|
|
39
|
-
const byteView = dagJson.encode(jsonObject);
|
|
40
|
-
return { bytes: byteView, cid: getCidSync(byteView) };
|
|
41
|
-
}
|
|
42
|
-
async function encodeBlockOriginal(jsonObject) {
|
|
43
|
-
const encoded = await multiformatsEncode({ value: jsonObject, codec: dagJson, hasher: sha265Hasher });
|
|
44
|
-
const syncVariant = encodeBlock(jsonObject);
|
|
45
|
-
if (syncVariant.cid.toString() !== encoded.cid.toString()) {
|
|
46
|
-
ERROR(`[encodeBlockOriginal] sync cid mismatch`, { jsonObject, encoded, syncVariant });
|
|
47
|
-
}
|
|
48
|
-
return encoded;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
prepareForPub,
|
|
53
|
-
encodeApplogAndGetCid,
|
|
54
|
-
encodeApplog,
|
|
55
|
-
getCidSync,
|
|
56
|
-
encodeBlock,
|
|
57
|
-
encodeBlockOriginal
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=chunk-QXNFGJ5R.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ipfs/ipfs-utils.ts"],"sourcesContent":["import * as dagJson from '@ipld/dag-json'\nimport { sha256 } from '@noble/hashes/sha256'\nimport { Logger } from 'besonders-logger'\nimport { CID, digest as Digest } from 'multiformats'\nimport { encode as multiformatsEncode } from 'multiformats/block'\n// import { encode } from 'multiformats/block';\nimport { Applog, ApplogForInsert, ApplogNoCid } from '../data/datom-types'\n\nimport { sha256 as sha265Hasher } from 'multiformats/hashes/sha2'\n\n/* THIS FILE SHOULD NOT DEPEND ON UI STUFF, SO THAT TESTS CAN RUN WITH MINIMAL DEPENDENCIES */\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport function prepareForPub(log: Applog | ApplogForInsert, without: string[] = ['cid']) {\n\tconst logWithout = {}\n\tfor (let [key, val] of Object.entries(log)) {\n\t\tif (val === undefined) {\n\t\t\tWARN(`log.${key} is undefined, which is not allowed - encoding as null`, log)\n\t\t\tval = null\n\t\t}\n\t\tif (!without.includes(key)) {\n\t\t\tlogWithout[key] = val && key === 'pv' ? CID.parse(val) : val\n\t\t} else {\n\t\t\tVERBOSE('excluding app log', { key, val })\n\t\t}\n\t}\n\treturn logWithout as Applog\n}\n\nexport function encodeApplogAndGetCid(log: ApplogNoCid) {\n\treturn getCidSync(encodeApplog(log).bytes)\n}\nexport function encodeApplog(log: ApplogNoCid) {\n\treturn encodeBlock(prepareForPub(log))\n}\n\nexport function getCidSync(bytes: dagJson.ByteView<any>) {\n\t// Hacky way to use a sync sha265 lib to create a CID - code inspired by https://github.com/multiformats/js-multiformats#multihash-hashers\n\tconst hash = sha256(bytes)\n\tconst digest = Digest.create(sha265Hasher.code, hash)\n\tconst cid = CID.create(1, dagJson.code, digest)\n\tVERBOSE(`[getCidSync]`, { bytes, hash, digest, cid })\n\treturn cid\n}\n/** encode the json object into an IPLD block */\nexport function encodeBlock(jsonObject: any) {\n\tDEBUG('[encodeBlock]', jsonObject)\n\tconst byteView = dagJson.encode(jsonObject)\n\treturn { bytes: byteView, cid: getCidSync(byteView) }\n}\n\nexport async function encodeBlockOriginal(jsonObject: any) {\n\t// HACK re-added this to verify the sync variant is sane\n\tconst encoded = await multiformatsEncode({ value: jsonObject, codec: dagJson, hasher: sha265Hasher })\n\tconst syncVariant = encodeBlock(jsonObject)\n\tif (syncVariant.cid.toString() !== encoded.cid.toString()) {\n\t\tERROR(`[encodeBlockOriginal] sync cid mismatch`, { jsonObject, encoded, syncVariant })\n\t}\n\treturn encoded\n}\n"],"mappings":";AAAA,YAAY,aAAa;AACzB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,KAAK,UAAU,cAA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,UAAU;AAC1C,MAAI,YAAY,IAAI,SAAS,MAAM,QAAQ,IAAI,SAAS,GAAG;AAC1D,UAAM,2CAA2C,EAAE,YAAY,SAAS,YAAY,CAAC;AAAA,EACtF;AACA,SAAO;AACR;","names":[]}
|
package/dist/chunk-UOPZAYFM.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.__publicField = __publicField;
|
|
11
|
-
//# sourceMappingURL=chunk-UOPZAYFM.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|