@wovin/core 0.0.9-RC3 → 0.0.9-RC4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/applog.min.js +2 -2
- package/dist/{chunk-WIE7ME3N.min.js → chunk-CIOF7QHW.min.js} +21 -6
- package/dist/chunk-CIOF7QHW.min.js.map +1 -0
- package/dist/{chunk-QXKFFDHN.min.js → chunk-V5T5PE7K.min.js} +33 -41
- package/dist/{chunk-QXKFFDHN.min.js.map → chunk-V5T5PE7K.min.js.map} +1 -1
- package/dist/{chunk-RMPMFLPZ.min.js → chunk-VM46JSEH.min.js} +3 -2
- package/dist/{chunk-RMPMFLPZ.min.js.map → chunk-VM46JSEH.min.js.map} +1 -1
- package/dist/{chunk-GJGWIEIE.min.js → chunk-XXTV6KVM.min.js} +3 -3
- package/dist/{chunk-PG6EJTCU.min.js → chunk-YBXZNIU2.min.js} +8 -2
- package/dist/{chunk-PG6EJTCU.min.js.map → chunk-YBXZNIU2.min.js.map} +1 -1
- package/dist/index.min.js +11 -5
- package/dist/ipfs/car.d.ts.map +1 -1
- package/dist/ipfs/ipfs-utils.d.ts +2 -1
- package/dist/ipfs/ipfs-utils.d.ts.map +1 -1
- package/dist/ipfs.min.js +4 -2
- package/dist/mobx/mobx-utils.d.ts +11 -11
- package/dist/mobx/mobx-utils.d.ts.map +1 -1
- package/dist/pubsub/publication.d.ts +2 -0
- package/dist/pubsub/publication.d.ts.map +1 -1
- package/dist/pubsub/pubsub-types.d.ts +1 -0
- package/dist/pubsub/pubsub-types.d.ts.map +1 -1
- package/dist/pubsub.min.js +8 -4
- package/dist/query.min.js +3 -3
- package/dist/thread.min.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-WIE7ME3N.min.js.map +0 -1
- /package/dist/{chunk-GJGWIEIE.min.js.map → chunk-XXTV6KVM.min.js.map} +0 -0
package/dist/applog.min.js
CHANGED
|
@@ -42,8 +42,8 @@ import {
|
|
|
42
42
|
variableNameWithoutQuestionmark,
|
|
43
43
|
withPvFrom,
|
|
44
44
|
withTs
|
|
45
|
-
} from "./chunk-
|
|
46
|
-
import "./chunk-
|
|
45
|
+
} from "./chunk-V5T5PE7K.min.js";
|
|
46
|
+
import "./chunk-YBXZNIU2.min.js";
|
|
47
47
|
import "./chunk-PTGUFZ3Q.min.js";
|
|
48
48
|
import "./chunk-KRQZ6V4Y.min.js";
|
|
49
49
|
export {
|
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeCarBlob
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VM46JSEH.min.js";
|
|
4
4
|
import {
|
|
5
5
|
cyrb53hash,
|
|
6
6
|
getLogsFromThread,
|
|
7
7
|
lastWriteWins,
|
|
8
8
|
rollingFilter
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-V5T5PE7K.min.js";
|
|
10
10
|
import {
|
|
11
11
|
Logger,
|
|
12
12
|
encodeBlockOriginal,
|
|
13
13
|
prepareForPub
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YBXZNIU2.min.js";
|
|
15
15
|
|
|
16
16
|
// src/pubsub/publication.ts
|
|
17
17
|
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.DEBUG);
|
|
18
|
+
async function crawlPublicationForLogs(publication) {
|
|
19
|
+
if (publication.includedLogCIDs)
|
|
20
|
+
crawlPublicationForLogs(publication);
|
|
21
|
+
return publication.includedLogCIDs;
|
|
22
|
+
}
|
|
23
|
+
async function getLogsFromPub(publication) {
|
|
24
|
+
if (publication.includedLogCIDs)
|
|
25
|
+
crawlPublicationForLogs(publication);
|
|
26
|
+
return publication.includedLogCIDs;
|
|
27
|
+
}
|
|
18
28
|
async function preparePubForPush(agent, appThread, threadToPublish, publication) {
|
|
19
|
-
|
|
29
|
+
let logsToPublish = getLogsFromThread(threadToPublish);
|
|
30
|
+
DEBUG(`[preparePubForPush] Collected ${logsToPublish.length} logs :`, {
|
|
31
|
+
logsToPublish,
|
|
32
|
+
threadOrLogsCount: threadToPublish.nameAndSizeUntracked || `[${threadToPublish.length}]`
|
|
33
|
+
});
|
|
20
34
|
const { sharedAgents, sharedKeyMap, sharedKey } = publication ?? {};
|
|
21
35
|
const agentLogs = rollingFilter(lastWriteWins(appThread), {
|
|
22
36
|
en: agent.ag,
|
|
@@ -29,7 +43,6 @@ async function preparePubForPush(agent, appThread, threadToPublish, publication)
|
|
|
29
43
|
const encryptAndTestDecrypt = async (applog, keyToUse) => {
|
|
30
44
|
throw new Error(`todo: enc`);
|
|
31
45
|
};
|
|
32
|
-
DEBUG("[preparePubForPush] applogs ", logsToPublish);
|
|
33
46
|
let maybeEncryptedApplogs;
|
|
34
47
|
if (sharedAgents) {
|
|
35
48
|
if (!sharedKey || !sharedKeyMap) {
|
|
@@ -110,6 +123,8 @@ function agentToShortHash(agentString) {
|
|
|
110
123
|
}
|
|
111
124
|
|
|
112
125
|
export {
|
|
126
|
+
crawlPublicationForLogs,
|
|
127
|
+
getLogsFromPub,
|
|
113
128
|
preparePubForPush,
|
|
114
129
|
encodePubAsCar,
|
|
115
130
|
encodeApplogsAsCar,
|
|
@@ -117,4 +132,4 @@ export {
|
|
|
117
132
|
isSubscription,
|
|
118
133
|
agentToShortHash
|
|
119
134
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-CIOF7QHW.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/pubsub/publication.ts","../src/pubsub/pubsub-types.ts"],"sourcesContent":["import { Logger } from 'besonders-logger'\nimport { Applog } from '../applog/datom-types'\nimport { makeCarBlob } from '../ipfs/car'\nimport { encodeBlockOriginal, prepareForPub } from '../ipfs/ipfs-utils'\nimport { lastWriteWins } from './../query/basic'\nimport { ApplogsOrThread, getLogsFromThread, Thread } from '../thread'\nimport { rollingFilter } from '../thread/filters'\nimport { AppAgent, IPublication } from './pubsub-types'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.DEBUG) // eslint-disable-line no-unused-vars\n\n// export const neverEncryptAttrs = [\n// \t'agent/jwkd',\n// \t'agent/appAgent',\n// \t'pub/encryptedFor',\n// \t'pub/sharedKey',\n// ]\n\nexport async function crawlPublicationForLogs(publication: IPublication) {\n\tif (publication.includedLogCIDs) crawlPublicationForLogs(publication)\n\treturn publication.includedLogCIDs\n}\nexport async function getLogsFromPub(publication: IPublication) {\n\tif (publication.includedLogCIDs) crawlPublicationForLogs(publication)\n\treturn publication.includedLogCIDs\n}\nexport async function preparePubForPush(\n\tagent: AppAgent,\n\tappThread: Thread,\n\tthreadToPublish: ApplogsOrThread,\n\tpublication: IPublication,\n) {\n\t// await initWasm()\n\t// const car_data = Wasm.make_car(applogs)\n\t// DEBUG('Car data:', car_data)\n\t// TODO prevent publish if there is no new info\n\tlet logsToPublish = getLogsFromThread(threadToPublish)\n\n\t// const logsFromLastPush = await getLogsFromPub(publication)\n\t// logsToPublish = logsToPublish.filter(eachLog => !logsFromLastPush.includes(eachLog.cid)) // TODO deep compare includes\n\t// const prevPushCIDs = [\n\t// \tpublication.lastCID,\n\t// \t//TODO add this one and update the publication data after push\n\t// ]\n\t// const includedLogCIDs = [\n\t// \t'full array of CIDS from all previous pushes'\n\t// ]\n\n\tDEBUG(`[preparePubForPush] Collected ${logsToPublish.length} logs :`, {\n\t\tlogsToPublish,\n\t\tthreadOrLogsCount: (threadToPublish as any).nameAndSizeUntracked || (`[${(threadToPublish as any).length}]`),\n\t})\n\n\tconst { sharedAgents, sharedKeyMap, sharedKey } = publication ?? {}\n\t// TODO: publish all agents' info related to the logs we want to publish\n\tconst agentLogs = rollingFilter(lastWriteWins(appThread), {\n\t\ten: agent.ag,\n\t\tat: ['agent/ecdh', 'agent/jwkd', 'agent/appAgent'],\n\t}).applogs\n\tDEBUG(`[preparePubForPush] agent logs:`, agentLogs)\n\tif (!agentLogs.find(({ at }) => at === 'agent/appAgent')) throw ERROR(`[preparePubForPush] appThread missing agent/appAgent log`)\n\tlet encPayload\n\tconst encryptAndTestDecrypt = async (applog: Applog, keyToUse: CryptoKey): Promise<Uint8Array> => {\n\t\tthrow new Error(`todo: enc`) // TODO: ENC\n\t\t// const eachLog = prepareForPub(applog) // without cid\n\t\t// const enc = new TextEncoder()\n\t\t// const stringified = stringify(eachLog)\n\t\t// const stringifiedEncodedAppLogPayload = enc.encode(stringified) // TODO: consider encodeToDagJson instead\n\t\t// VERBOSE('[odd]', { eachLog, stringified, stringifiedEncodedAppLogPayload })\n\n\t\t// try {\n\t\t// \tencPayload = await agent.crypto?.aes.encrypt(stringifiedEncodedAppLogPayload, keyToUse, SymmAlg.AES_GCM)\n\t\t// } catch (err) {\n\t\t// \tthrow ERROR('FAILED TO ENC payload length:', stringifiedEncodedAppLogPayload.length, { err })\n\t\t// }\n\n\t\t// const decrypted = await decryptWithAesSharedKey(encPayload, keyToUse, 'string')\n\n\t\t// VERBOSE('[odd] encrypted length:', stringifiedEncodedAppLogPayload.length, { encPayload, decrypted })\n\t\t// return encPayload\n\t}\n\n\tlet maybeEncryptedApplogs: Uint8Array[] | readonly Applog[]\n\tif (sharedAgents) { // encrypt all Applogs\n\t\tif (!sharedKey || !sharedKeyMap) {\n\t\t\tthrow ERROR('sharedAgents but no Keys/Map', { sharedAgents, sharedKeyMap, sharedKey })\n\t\t}\n\t\tconst encryptedApplogs = [] as Uint8Array[]\n\t\tconst agentSharedKeyLogs = []\n\t\tfor (const [eachAgent, eachEncKey] of Array.from(sharedKeyMap.entries())) {\n\t\t\tagentSharedKeyLogs.push({\n\t\t\t\tag: agent.ag,\n\t\t\t\ten: eachAgent,\n\t\t\t\tat: 'pub/sharedKey',\n\t\t\t\tvl: eachEncKey, // these are encrypted with the derived key from the local agent private and remote agent public keys\n\t\t\t})\n\t\t}\n\t\t// const encryptedForLogs = await insertApplogsInAppDB(agentSharedKeyLogs)\n\t\t// DEBUG(`[publish] adding agentSharedKeyLogs:`, encryptedForLogs)\n\n\t\t// TODO ensure that all needed keys are in\n\t\tfor (const eachLog of logsToPublish) {\n\t\t\tVERBOSE('[crypto] encrypting ', eachLog)\n\t\t\t// if (neverEncryptAttrs.includes(eachLog.at)) {\n\t\t\t// \tencryptedApplogs.push(/* prepareForPub( */ eachLog /* ) */) // ? this seemed to double the below one - @gotjoshua?\n\t\t\t// \t// continue\n\t\t\t// }\n\t\t\ttry {\n\t\t\t\tencPayload = await encryptAndTestDecrypt(eachLog, sharedKey)\n\t\t\t} catch (err) {\n\t\t\t\t// its already traced in encryptAndTestDecrypt\n\t\t\t\t// continue\n\t\t\t}\n\t\t\tencryptedApplogs.push(encPayload)\n\t\t}\n\t\tmaybeEncryptedApplogs = encryptedApplogs\n\t} else {\n\t\tmaybeEncryptedApplogs = logsToPublish // publish nonEncrypted\n\t}\n\treturn encodePubAsCar(agent, maybeEncryptedApplogs, agentLogs)\n}\n\n/**\n * @param applogs Encrypted or plain applogs\n * @returns Car file\n */\nexport async function encodePubAsCar(\n\tagent: AppAgent,\n\tapplogs: readonly Uint8Array[] | readonly Applog[],\n\tinfoLogs: readonly Applog[],\n) {\n\tDEBUG(`[encodePubAsCar] encoding`, { agent, applogs, infoLogs })\n\tconst { cids: infoLogCids, encodedApplogs: encodedInfoLogs } = await encodeApplogsAsIPLD(infoLogs)\n\tconst { cids: logCids, encodedApplogs } = await encodeApplogsAsIPLD(applogs)\n\t// We need to wrap the array to get a CID\n\tconst infoLogsWrap = await encodeBlockOriginal({ logs: infoLogCids })\n\tconst applogsWrap = await encodeBlockOriginal({ logs: logCids })\n\tconst infoSignature = await agent.sign(infoLogsWrap.bytes)\n\tconst applogsSignature = await agent.sign(applogsWrap.bytes)\n\tconst root = {\n\t\tinfo: infoLogsWrap.cid,\n\t\tapplogs: applogsWrap.cid,\n\t\tinfoSignature,\n\t\tapplogsSignature,\n\t}\n\tDEBUG('[encodePubAsCar] encoding root', { root, logCids, infoLogCids })\n\tconst encodedRoot = await encodeBlockOriginal(root)\n\tDEBUG('[encodePubAsCar] => root', { encodedRoot })\n\n\treturn await makeCarBlob(encodedRoot.cid, [encodedRoot, infoLogsWrap, applogsWrap, ...encodedInfoLogs, ...encodedApplogs]) // TODO: create CarBuilder\n}\n\n/**\n * @param applogs Encrypted or plain applogs\n * @returns Car file\n */\nexport async function encodeApplogsAsCar(\n\tapplogs: readonly Uint8Array[] | readonly Applog[],\n) {\n\tconst { cids, encodedApplogs } = await encodeApplogsAsIPLD(applogs)\n\tconst root = { applogs: cids }\n\tconst encodedRoot = await encodeBlockOriginal(root)\n\tDEBUG('[encodeApplogsAsCar] encoded root', { cids, encodedRoot })\n\n\treturn await makeCarBlob(encodedRoot.cid, [encodedRoot, ...encodedApplogs])\n}\n\nasync function encodeApplogsAsIPLD(applogs: readonly Applog[] | readonly Uint8Array[]) {\n\tconst preppedLogs = applogs.map(log => log instanceof Uint8Array ? log : prepareForPub(log as Applog))\n\tconst encodedApplogs = await Promise.all(preppedLogs.map(encodeBlockOriginal))\n\tDEBUG('[encodeApplogsAsIpld] encoded applogs', { encodedApplogs })\n\n\tconst cids = encodedApplogs.map(b => {\n\t\tif (!b.cid) throw new ERROR(`[publish] no cid for encoded log:`, b)\n\t\treturn b.cid\n\t})\n\treturn { cids, encodedApplogs }\n}\n","import { cyrb53hash } from './../applog/applog-utils'\nimport { AgentHash, AgentID } from '../applog/datom-types'\nimport { Tagged } from '../types'\n\ntype AgentString = Tagged<string, 'AgentString'>\ntype DIDString = Tagged<string, 'DID'>\nexport type { AgentHash, AgentString, DIDString }\n\nexport interface AppAgent {\n\tag: AgentHash\n\tagentString: AgentString\n\tdid: DIDString\n\n\tsign(data: Uint8Array): Promise<Uint8Array>\n}\n\nexport interface IPublication {\n\tid?: string // string hash of pub (used as unique id in IDB) `W3Name.create().toString()` starts with k51qzi5uqu5d\n\tcreatedAt: string // ISO timestamp of creation\n\tname: string // nick name for the pub\n\tisDeleted?: boolean\n\n\tpk: Uint8Array // exported privatekey - needed to create WritableName for publishing //TODO: store as non-extractable / encrypted?\n\n\tautopush: boolean\n\tlastPush: string | null\n\tlastCID?: string\n\tincludedLogCIDs?: string[]\n\tlatestLogTs?: string\n\n\tpublishedBy: string // local user appAgent\n\tselectors?: string[] // to be used as a filter for which applogs to pub\n\tencryptedFor?: string | null // short agentHash\n\tencryptedWith?: CryptoKey | null // AES-GCM derived key from ECDH keys (local private and remote public)\n\n\t// HACK WIP #39 - shared encryption\n\tsharedKey?: CryptoKey | null // AES-GCM derived key from ECDH keys (local private and ipns public)\n\tsharedAgents?: AgentID[] | null // array of string EntityIDs for the chosen agents (we need public jwkd atoms for each of them)\n\tsharedKeyMap?: Map<AgentID, string> | null // uses public key from each agent to derive an aes key that is used to encrypt and btoa the sharedKey that is actually used to encrypt and decrypt the applogs\n}\nexport interface ISubscription {\n\tid: string // string hash of pub (used as unique id in IDB) `W3Name.create().toString()` starts with k51qzi5uqu5d\n\tcreatedAt: string // ISO timestamp of creation\n\tname: string // nick name for the pub\n\tisDeleted: boolean\n\n\tlastPull?: string | null\n\tlastPullAttempt?: string | null\n\tautopull: boolean\n\tlastCID?: string\n\tpublishedBy?: string // remote publisher short agentHash\n\tencryptedFor?: string | undefined // short agentHash\n\tencryptedWith?: CryptoKey | undefined // AES-GCM derived key from ECDH keys (local private and remote public)\n}\nexport function isPublication(obj: any): obj is IPublication {\n\treturn obj?.pk !== undefined && obj?.lastPush !== undefined\n}\nexport function isSubscription(obj: any): obj is ISubscription {\n\treturn obj?.lastPull !== undefined\n}\n\nexport type TSubPub = IPublication | ISubscription\n\nexport function agentToShortHash(agentString: string) {\n\treturn cyrb53hash(agentString, 31, 7) as string\n}\n"],"mappings":";;;;;;;;;;;;;;;;AASA,IAAM,EAAE,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,OAAO,MAAM,OAAO,KAAK;AAStE,eAAsB,wBAAwB,aAA2B;AACxE,MAAI,YAAY;AAAiB,4BAAwB,WAAW;AACpE,SAAO,YAAY;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AAQ,IAAI,SAAO,eAAe,aAAa,MAAM,cAAc,GAAa,CAAC;AACrG,QAAM,iBAAiB,MAAM,QAAQ,IAAI,YAAY,IAAI,mBAAmB,CAAC;AAC7E,QAAM,yCAAyC,EAAE,eAAe,CAAC;AAEjE,QAAM,OAAO,eAAe,IAAI,OAAK;AACpC,QAAI,CAAC,EAAE;AAAK,YAAM,IAAI,MAAM,qCAAqC,CAAC;AAClE,WAAO,EAAE;AAAA,EACV,CAAC;AACD,SAAO,EAAE,MAAM,eAAe;AAC/B;;;AC3HO,SAAS,cAAc,KAA+B;AAC5D,SAAO,KAAK,OAAO,UAAa,KAAK,aAAa;AACnD;AACO,SAAS,eAAe,KAAgC;AAC9D,SAAO,KAAK,aAAa;AAC1B;AAIO,SAAS,iBAAiB,aAAqB;AACrD,SAAO,WAAW,aAAa,IAAI,CAAC;AACrC;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Logger,
|
|
3
3
|
encodeApplogAndGetCid
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YBXZNIU2.min.js";
|
|
5
5
|
import {
|
|
6
6
|
arrayIfSingle,
|
|
7
7
|
require_typebox
|
|
@@ -5272,9 +5272,6 @@ var autoAction = /* @__PURE__ */ createActionFactory(true);
|
|
|
5272
5272
|
Object.assign(autoAction, autoActionAnnotation);
|
|
5273
5273
|
action.bound = /* @__PURE__ */ createDecoratorAnnotation(actionBoundAnnotation);
|
|
5274
5274
|
autoAction.bound = /* @__PURE__ */ createDecoratorAnnotation(autoActionBoundAnnotation);
|
|
5275
|
-
function runInAction(fn) {
|
|
5276
|
-
return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, void 0);
|
|
5277
|
-
}
|
|
5278
5275
|
function isAction(thing) {
|
|
5279
5276
|
return isFunction(thing) && thing.isMobxAction === true;
|
|
5280
5277
|
}
|
|
@@ -7774,17 +7771,20 @@ function observableArrayMap(fn, { name, equals } = {}) {
|
|
|
7774
7771
|
let observableArr;
|
|
7775
7772
|
const disposeAutorun = autorunButAlsoImmediately(
|
|
7776
7773
|
fn,
|
|
7777
|
-
(
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7774
|
+
(items) => {
|
|
7775
|
+
if (!observableArr) {
|
|
7776
|
+
observableArr = observable.array(
|
|
7777
|
+
items,
|
|
7778
|
+
/* ['NEVER'] as T[] */
|
|
7779
|
+
{ deep: false, name, equals }
|
|
7780
|
+
);
|
|
7781
|
+
} else {
|
|
7782
|
+
if (!untracked(() => (equals ?? comparer.structural)(observableArr, items))) {
|
|
7783
|
+
observableArr.replace(items);
|
|
7784
|
+
DEBUG(`[${debugName}] updated`, { updatedItems: items, observableArr });
|
|
7785
|
+
} else
|
|
7786
|
+
DEBUG(`[${debugName}] update skipped`, { updatedItems: items, observableArr });
|
|
7787
|
+
}
|
|
7788
7788
|
},
|
|
7789
7789
|
{ name: debugName }
|
|
7790
7790
|
);
|
|
@@ -7802,20 +7802,21 @@ function observableMapMap(fn, { name, equals } = {}) {
|
|
|
7802
7802
|
let observableMap;
|
|
7803
7803
|
const dispose = autorunButAlsoImmediately(
|
|
7804
7804
|
fn,
|
|
7805
|
-
(
|
|
7806
|
-
observableMap
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7805
|
+
(items) => {
|
|
7806
|
+
if (!observableMap) {
|
|
7807
|
+
observableMap = observable.map(
|
|
7808
|
+
items,
|
|
7809
|
+
/* ['NEVER'] as T[] */
|
|
7810
|
+
{ deep: false, name }
|
|
7811
|
+
);
|
|
7812
|
+
DEBUG(`[${debugName}] initial`, { items, observableMap });
|
|
7813
|
+
} else {
|
|
7814
|
+
if (!untracked(() => (equals ?? comparer.structural)([...observableMap.entries()], items))) {
|
|
7815
|
+
observableMap.replace(items);
|
|
7816
|
+
DEBUG(`[${debugName}] updated`, { items, observableMap });
|
|
7817
|
+
} else
|
|
7818
|
+
DEBUG(`[${debugName}] update skipped`, { items, observableMap });
|
|
7819
|
+
}
|
|
7819
7820
|
},
|
|
7820
7821
|
{ name: debugName }
|
|
7821
7822
|
);
|
|
@@ -7827,16 +7828,13 @@ function observableMapMap(fn, { name, equals } = {}) {
|
|
|
7827
7828
|
});
|
|
7828
7829
|
return observableMap;
|
|
7829
7830
|
}
|
|
7830
|
-
function autorunButAlsoImmediately(fn,
|
|
7831
|
+
function autorunButAlsoImmediately(fn, update, { name } = {}) {
|
|
7831
7832
|
DEBUG(`[autorunButAlsoImmediately] create`, { fnname: fn.name, fn, name });
|
|
7832
7833
|
const debugName = `${name}.autorunImm`;
|
|
7833
7834
|
let result;
|
|
7834
7835
|
const reaction2 = new Reaction(debugName, (...args) => {
|
|
7835
7836
|
DEBUG(`[${debugName}] reaction.invalidate`, args);
|
|
7836
7837
|
runAndTrack();
|
|
7837
|
-
runInAction(() => {
|
|
7838
|
-
update(result);
|
|
7839
|
-
});
|
|
7840
7838
|
});
|
|
7841
7839
|
function runAndTrack() {
|
|
7842
7840
|
reaction2.track(() => {
|
|
@@ -7844,13 +7842,13 @@ function autorunButAlsoImmediately(fn, init, update, { name } = {}) {
|
|
|
7844
7842
|
DEBUG(`[${debugName}] runAndTrack:`, { name: name ?? fn.name, fn });
|
|
7845
7843
|
result = fn();
|
|
7846
7844
|
DEBUG(`[${debugName}] runAndTrack =>`, result);
|
|
7845
|
+
update(result);
|
|
7847
7846
|
if (PERF_CHECK && performance.now() - start > PERF_CHECK) {
|
|
7848
7847
|
WARN(`[${debugName}] took ${performance.now() - start}ms`);
|
|
7849
7848
|
}
|
|
7850
7849
|
});
|
|
7851
7850
|
}
|
|
7852
7851
|
runAndTrack();
|
|
7853
|
-
init(result);
|
|
7854
7852
|
DEBUG.isEnabled && DEBUG(`[${debugName}] deps of reaction`, { reaction: reaction2, result, deps: getDependencyTree(reaction2) });
|
|
7855
7853
|
const dispose = () => {
|
|
7856
7854
|
VERBOSE(`[${debugName}] dispose`);
|
|
@@ -9746,14 +9744,11 @@ function matchVariable(variable, triplePart, context) {
|
|
|
9746
9744
|
if (context.hasOwnProperty(variable)) {
|
|
9747
9745
|
const bound = context[variable];
|
|
9748
9746
|
const match = matchPart(bound, triplePart, context);
|
|
9749
|
-
VERBOSE3("[matchVariable] match?", variable, bound, match);
|
|
9750
9747
|
return match;
|
|
9751
9748
|
}
|
|
9752
|
-
VERBOSE3("[matchVariable] initializing variable", variable, "to", triplePart);
|
|
9753
9749
|
return { ...context, [variable]: triplePart };
|
|
9754
9750
|
}
|
|
9755
9751
|
function matchPartStatic(field, patternPart, atomPart) {
|
|
9756
|
-
VERBOSE3("[matchPartStatic]", field, patternPart, patternPart === atomPart ? "===" : "!==", atomPart);
|
|
9757
9752
|
const result = (() => {
|
|
9758
9753
|
if (typeof patternPart === "function") {
|
|
9759
9754
|
return patternPart(atomPart);
|
|
@@ -9763,7 +9758,6 @@ function matchPartStatic(field, patternPart, atomPart) {
|
|
|
9763
9758
|
}
|
|
9764
9759
|
return patternPart === atomPart;
|
|
9765
9760
|
})();
|
|
9766
|
-
VERBOSE3("[matchPartStatic] =>", field.startsWith("!") ? "!" : "", result);
|
|
9767
9761
|
if (field.startsWith("!")) {
|
|
9768
9762
|
return !result;
|
|
9769
9763
|
} else {
|
|
@@ -9772,7 +9766,6 @@ function matchPartStatic(field, patternPart, atomPart) {
|
|
|
9772
9766
|
}
|
|
9773
9767
|
function matchPart(patternPart, atomPart, context) {
|
|
9774
9768
|
if (!context) {
|
|
9775
|
-
VERBOSE3("[matchPart] no context");
|
|
9776
9769
|
return null;
|
|
9777
9770
|
}
|
|
9778
9771
|
if (typeof patternPart === "string") {
|
|
@@ -9780,7 +9773,6 @@ function matchPart(patternPart, atomPart, context) {
|
|
|
9780
9773
|
return matchVariable(patternPart, atomPart, context);
|
|
9781
9774
|
}
|
|
9782
9775
|
}
|
|
9783
|
-
VERBOSE3("[matchPart]", patternPart, patternPart === atomPart ? "===" : "!==", atomPart);
|
|
9784
9776
|
if (typeof patternPart === "function") {
|
|
9785
9777
|
return patternPart(atomPart) ? context : null;
|
|
9786
9778
|
}
|
|
@@ -10878,4 +10870,4 @@ lodash-es/lodash.js:
|
|
|
10878
10870
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
10879
10871
|
*)
|
|
10880
10872
|
*/
|
|
10881
|
-
//# sourceMappingURL=chunk-
|
|
10873
|
+
//# sourceMappingURL=chunk-V5T5PE7K.min.js.map
|