@wovin/core 0.0.9-RC2 → 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.
Files changed (31) hide show
  1. package/dist/applog/datom-types.d.ts +1 -0
  2. package/dist/applog/datom-types.d.ts.map +1 -1
  3. package/dist/applog.min.js +2 -2
  4. package/dist/{chunk-V5ASXYLI.min.js → chunk-CIOF7QHW.min.js} +21 -6
  5. package/dist/chunk-CIOF7QHW.min.js.map +1 -0
  6. package/dist/{chunk-IFQLMJQZ.min.js → chunk-V5T5PE7K.min.js} +56 -79
  7. package/dist/{chunk-IFQLMJQZ.min.js.map → chunk-V5T5PE7K.min.js.map} +1 -1
  8. package/dist/{chunk-ORHJN4G2.min.js → chunk-VM46JSEH.min.js} +3 -2
  9. package/dist/{chunk-ORHJN4G2.min.js.map → chunk-VM46JSEH.min.js.map} +1 -1
  10. package/dist/{chunk-YTXWUET7.min.js → chunk-XXTV6KVM.min.js} +3 -3
  11. package/dist/{chunk-2J7BWXZ3.min.js → chunk-YBXZNIU2.min.js} +46 -2
  12. package/dist/chunk-YBXZNIU2.min.js.map +1 -0
  13. package/dist/index.min.js +16 -6
  14. package/dist/ipfs/car.d.ts.map +1 -1
  15. package/dist/ipfs/ipfs-utils.d.ts +8 -1
  16. package/dist/ipfs/ipfs-utils.d.ts.map +1 -1
  17. package/dist/ipfs.min.js +10 -4
  18. package/dist/mobx/mobx-utils.d.ts +11 -11
  19. package/dist/mobx/mobx-utils.d.ts.map +1 -1
  20. package/dist/pubsub/publication.d.ts +2 -0
  21. package/dist/pubsub/publication.d.ts.map +1 -1
  22. package/dist/pubsub/pubsub-types.d.ts +1 -0
  23. package/dist/pubsub/pubsub-types.d.ts.map +1 -1
  24. package/dist/pubsub.min.js +8 -4
  25. package/dist/query.min.js +3 -3
  26. package/dist/thread/filters.d.ts.map +1 -1
  27. package/dist/thread.min.js +2 -2
  28. package/package.json +1 -1
  29. package/dist/chunk-2J7BWXZ3.min.js.map +0 -1
  30. package/dist/chunk-V5ASXYLI.min.js.map +0 -1
  31. /package/dist/{chunk-YTXWUET7.min.js.map → chunk-XXTV6KVM.min.js.map} +0 -0
@@ -8,6 +8,7 @@ export type EntityID = Static<typeof EntityID>;
8
8
  export type AgentHash = Tagged<string, 'AgentHash'>;
9
9
  export type DatomPart = string;
10
10
  export type CidString = Tagged<string, CID>;
11
+ export type IpnsString = Tagged<CidString, 'IPNS'>;
11
12
  export type AgentID = EntityID;
12
13
  export type Attribute = string;
13
14
  export type ApplogValue = string | boolean | Number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"datom-types.d.ts","sourceRoot":"","sources":["../../src/applog/datom-types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,MAAM,EAAE,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElE,eAAO,MAAM,QAAQ,8GAAsE,CAAA;AAC3F,eAAO,MAAM,eAAe,IAAI,CAAA;AAShC,eAAO,MAAM,QAAQ,qCAAgB,CAAA;AAErC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE9C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AACnD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAC9B,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAC3C,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAA;AAC9B,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAC9B,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAAA;AAG1D,MAAM,WAAW,IAAI;IACpB,EAAE,EAAE,QAAQ,CAAA;I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,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE9C,eAAO,MAAM,SAAS;;;;;;;;GAAiC,CAAA;AACvD,eAAO,MAAM,mBAAmB,QAAS,GAAG,sDAAsC,CAAA;AAClF,eAAO,MAAM,aAAa;;;;;;;;CAAkC,CAAA"}
@@ -42,8 +42,8 @@ import {
42
42
  variableNameWithoutQuestionmark,
43
43
  withPvFrom,
44
44
  withTs
45
- } from "./chunk-IFQLMJQZ.min.js";
46
- import "./chunk-2J7BWXZ3.min.js";
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-ORHJN4G2.min.js";
3
+ } from "./chunk-VM46JSEH.min.js";
4
4
  import {
5
5
  cyrb53hash,
6
6
  getLogsFromThread,
7
7
  lastWriteWins,
8
8
  rollingFilter
9
- } from "./chunk-IFQLMJQZ.min.js";
9
+ } from "./chunk-V5T5PE7K.min.js";
10
10
  import {
11
11
  Logger,
12
12
  encodeBlockOriginal,
13
13
  prepareForPub
14
- } from "./chunk-2J7BWXZ3.min.js";
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
- const logsToPublish = getLogsFromThread(threadToPublish);
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-V5ASXYLI.min.js.map
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;AACpB;AACA,eAAsB,eAAe,aAA2B;AAC/D,MAAI,YAAY;AAAiB,4BAAwB,WAAW;AACpE,SAAO,YAAY;AACpB;AACA,eAAsB,kBACrB,OACA,WACA,iBACA,aACC;AAKD,MAAI,gBAAgB,kB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;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-2J7BWXZ3.min.js";
4
+ } from "./chunk-YBXZNIU2.min.js";
5
5
  import {
6
6
  arrayIfSingle,
7
7
  require_typebox
@@ -4657,8 +4657,8 @@ function checkIfStateModificationsAreAllowed(atom) {
4657
4657
  if (false) {
4658
4658
  return;
4659
4659
  }
4660
- var hasObservers2 = atom.observers_.size > 0;
4661
- if (!globalState.allowStateChanges && (hasObservers2 || globalState.enforceActions === "always")) {
4660
+ var hasObservers = atom.observers_.size > 0;
4661
+ if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) {
4662
4662
  console.warn("[MobX] " + (globalState.enforceActions ? "Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: " : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ") + atom.name_);
4663
4663
  }
4664
4664
  }
@@ -4857,12 +4857,6 @@ function isolateGlobalState() {
4857
4857
  function getGlobalState() {
4858
4858
  return globalState;
4859
4859
  }
4860
- function hasObservers(observable2) {
4861
- return observable2.observers_ && observable2.observers_.size > 0;
4862
- }
4863
- function getObservers(observable2) {
4864
- return observable2.observers_;
4865
- }
4866
4860
  function addObserver(observable2, node) {
4867
4861
  observable2.observers_.add(node);
4868
4862
  if (observable2.lowestObserverState_ > node.dependenciesState_) {
@@ -5278,9 +5272,6 @@ var autoAction = /* @__PURE__ */ createActionFactory(true);
5278
5272
  Object.assign(autoAction, autoActionAnnotation);
5279
5273
  action.bound = /* @__PURE__ */ createDecoratorAnnotation(actionBoundAnnotation);
5280
5274
  autoAction.bound = /* @__PURE__ */ createDecoratorAnnotation(autoActionBoundAnnotation);
5281
- function runInAction(fn) {
5282
- return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, void 0);
5283
- }
5284
5275
  function isAction(thing) {
5285
5276
  return isFunction(thing) && thing.isMobxAction === true;
5286
5277
  }
@@ -5503,18 +5494,6 @@ function nodeToDependencyTree(node) {
5503
5494
  }
5504
5495
  return result;
5505
5496
  }
5506
- function getObserverTree(thing, property2) {
5507
- return nodeToObserverTree(getAtom(thing, property2));
5508
- }
5509
- function nodeToObserverTree(node) {
5510
- var result = {
5511
- name: node.name_
5512
- };
5513
- if (hasObservers(node)) {
5514
- result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
5515
- }
5516
- return result;
5517
- }
5518
5497
  function unique(list) {
5519
5498
  return Array.from(new Set(list));
5520
5499
  }
@@ -7752,18 +7731,6 @@ if (!new class {
7752
7731
  xyz;
7753
7732
  }().hasOwnProperty("xyz"))
7754
7733
  throw new Error("Transpiler is not configured correctly");
7755
- var enableSpy = () => {
7756
- return window.disableSpy = spy((event) => {
7757
- VERBOSE(`[mobx]`, event);
7758
- });
7759
- };
7760
- if (typeof window === "object") {
7761
- window.getDependencyTree = getDependencyTree;
7762
- window.getObserverTree = getObserverTree;
7763
- window.getAtom = getAtom;
7764
- window.getDebugName = getDebugName;
7765
- window.enableSpy = enableSpy;
7766
- }
7767
7734
  var createDebugName = ({ caller, thread, pattern, args }) => {
7768
7735
  args = args || pattern;
7769
7736
  const str = `${untracked(() => thread?.name ? thread.name + " | " : "")}${caller ?? "caller?"}${args ? `{${typeof args === "string" ? args : wrapper_default(args)}}` : ""}`;
@@ -7804,17 +7771,20 @@ function observableArrayMap(fn, { name, equals } = {}) {
7804
7771
  let observableArr;
7805
7772
  const disposeAutorun = autorunButAlsoImmediately(
7806
7773
  fn,
7807
- (initialItems) => observableArr = observable.array(
7808
- initialItems,
7809
- /* ['NEVER'] as T[] */
7810
- { deep: false, name, equals }
7811
- ),
7812
- (updatedItems) => {
7813
- if (!untracked(() => (equals ?? comparer.structural)(observableArr, updatedItems))) {
7814
- observableArr.replace(updatedItems);
7815
- DEBUG(`[${debugName}] updated`, { updatedItems, observableArr });
7816
- } else
7817
- DEBUG(`[${debugName}] update skipped`, { updatedItems, observableArr });
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
+ }
7818
7788
  },
7819
7789
  { name: debugName }
7820
7790
  );
@@ -7832,20 +7802,21 @@ function observableMapMap(fn, { name, equals } = {}) {
7832
7802
  let observableMap;
7833
7803
  const dispose = autorunButAlsoImmediately(
7834
7804
  fn,
7835
- (initialItems) => {
7836
- observableMap = observable.map(
7837
- initialItems,
7838
- /* ['NEVER'] as T[] */
7839
- { deep: false, name }
7840
- );
7841
- DEBUG(`[${debugName}] initial`, { initialItems, observableMap });
7842
- },
7843
- (updatedItems) => {
7844
- if (!untracked(() => (equals ?? comparer.structural)([...observableMap.entries()], updatedItems))) {
7845
- observableMap.replace(updatedItems);
7846
- DEBUG(`[${debugName}] updated`, { updatedItems, observableMap });
7847
- } else
7848
- DEBUG(`[${debugName}] update skipped`, { updatedItems, observableMap });
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
+ }
7849
7820
  },
7850
7821
  { name: debugName }
7851
7822
  );
@@ -7857,16 +7828,13 @@ function observableMapMap(fn, { name, equals } = {}) {
7857
7828
  });
7858
7829
  return observableMap;
7859
7830
  }
7860
- function autorunButAlsoImmediately(fn, init, update, { name } = {}) {
7831
+ function autorunButAlsoImmediately(fn, update, { name } = {}) {
7861
7832
  DEBUG(`[autorunButAlsoImmediately] create`, { fnname: fn.name, fn, name });
7862
7833
  const debugName = `${name}.autorunImm`;
7863
7834
  let result;
7864
7835
  const reaction2 = new Reaction(debugName, (...args) => {
7865
7836
  DEBUG(`[${debugName}] reaction.invalidate`, args);
7866
7837
  runAndTrack();
7867
- runInAction(() => {
7868
- update(result);
7869
- });
7870
7838
  });
7871
7839
  function runAndTrack() {
7872
7840
  reaction2.track(() => {
@@ -7874,13 +7842,13 @@ function autorunButAlsoImmediately(fn, init, update, { name } = {}) {
7874
7842
  DEBUG(`[${debugName}] runAndTrack:`, { name: name ?? fn.name, fn });
7875
7843
  result = fn();
7876
7844
  DEBUG(`[${debugName}] runAndTrack =>`, result);
7845
+ update(result);
7877
7846
  if (PERF_CHECK && performance.now() - start > PERF_CHECK) {
7878
7847
  WARN(`[${debugName}] took ${performance.now() - start}ms`);
7879
7848
  }
7880
7849
  });
7881
7850
  }
7882
7851
  runAndTrack();
7883
- init(result);
7884
7852
  DEBUG.isEnabled && DEBUG(`[${debugName}] deps of reaction`, { reaction: reaction2, result, deps: getDependencyTree(reaction2) });
7885
7853
  const dispose = () => {
7886
7854
  VERBOSE(`[${debugName}] dispose`);
@@ -9776,14 +9744,11 @@ function matchVariable(variable, triplePart, context) {
9776
9744
  if (context.hasOwnProperty(variable)) {
9777
9745
  const bound = context[variable];
9778
9746
  const match = matchPart(bound, triplePart, context);
9779
- VERBOSE3("[matchVariable] match?", variable, bound, match);
9780
9747
  return match;
9781
9748
  }
9782
- VERBOSE3("[matchVariable] initializing variable", variable, "to", triplePart);
9783
9749
  return { ...context, [variable]: triplePart };
9784
9750
  }
9785
9751
  function matchPartStatic(field, patternPart, atomPart) {
9786
- VERBOSE3("[matchPartStatic]", field, patternPart, patternPart === atomPart ? "===" : "!==", atomPart);
9787
9752
  const result = (() => {
9788
9753
  if (typeof patternPart === "function") {
9789
9754
  return patternPart(atomPart);
@@ -9793,7 +9758,6 @@ function matchPartStatic(field, patternPart, atomPart) {
9793
9758
  }
9794
9759
  return patternPart === atomPart;
9795
9760
  })();
9796
- VERBOSE3("[matchPartStatic] =>", field.startsWith("!") ? "!" : "", result);
9797
9761
  if (field.startsWith("!")) {
9798
9762
  return !result;
9799
9763
  } else {
@@ -9802,7 +9766,6 @@ function matchPartStatic(field, patternPart, atomPart) {
9802
9766
  }
9803
9767
  function matchPart(patternPart, atomPart, context) {
9804
9768
  if (!context) {
9805
- VERBOSE3("[matchPart] no context");
9806
9769
  return null;
9807
9770
  }
9808
9771
  if (typeof patternPart === "string") {
@@ -9810,7 +9773,6 @@ function matchPart(patternPart, atomPart, context) {
9810
9773
  return matchVariable(patternPart, atomPart, context);
9811
9774
  }
9812
9775
  }
9813
- VERBOSE3("[matchPart]", patternPart, patternPart === atomPart ? "===" : "!==", atomPart);
9814
9776
  if (typeof patternPart === "function") {
9815
9777
  return patternPart(atomPart) ? context : null;
9816
9778
  }
@@ -10303,12 +10265,27 @@ function assertOnlyCurrent(thread) {
10303
10265
  }
10304
10266
  var simpleApplogMapper = function simpleApplogMapper2(thread, logMapper, opts = {}) {
10305
10267
  const mappedTo = /* @__PURE__ */ new Map();
10306
- const mapLogs = (applogs, thread2) => applogs.map((log) => {
10307
- const mapped = logMapper(log, thread2);
10308
- const finalized = finalizeApplogForInsert(mapped, {});
10309
- mappedTo.set(log.cid, finalized);
10310
- return finalized;
10311
- });
10268
+ const mapLogs = (applogs, thread2) => {
10269
+ const ts = dateNowIso();
10270
+ return applogs.map((log) => {
10271
+ const mapped = logMapper(log, thread2);
10272
+ let mapTo2;
10273
+ if (mapped === log) {
10274
+ mapTo2 = log;
10275
+ } else {
10276
+ if (mapped.cid === log.cid) {
10277
+ delete mapped.cid;
10278
+ }
10279
+ mapTo2 = finalizeApplogForInsert(mapped, {
10280
+ ts,
10281
+ threadForPv: null
10282
+ // ? should not be inferred, right?
10283
+ });
10284
+ }
10285
+ mappedTo.set(log.cid, mapTo2);
10286
+ return mapTo2;
10287
+ });
10288
+ };
10312
10289
  const handleUpdateEvent = (event) => {
10313
10290
  let mappedEvent;
10314
10291
  if (isInitEvent(event)) {
@@ -10893,4 +10870,4 @@ lodash-es/lodash.js:
10893
10870
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
10894
10871
  *)
10895
10872
  */
10896
- //# sourceMappingURL=chunk-IFQLMJQZ.min.js.map
10873
+ //# sourceMappingURL=chunk-V5T5PE7K.min.js.map