@wovin/core 0.0.17 → 0.0.19

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 (38) hide show
  1. package/dist/applog.min.js +1 -1
  2. package/dist/{chunk-TEQ4SIKN.min.js → chunk-E4BAQ5JJ.min.js} +2 -2
  3. package/dist/chunk-IHGAJTEQ.min.js +70 -0
  4. package/dist/chunk-IHGAJTEQ.min.js.map +1 -0
  5. package/dist/{chunk-OBMVNVJR.min.js → chunk-KVPEUWWR.min.js} +2 -2
  6. package/dist/chunk-SIIQEX77.min.js +4122 -0
  7. package/dist/chunk-SIIQEX77.min.js.map +1 -0
  8. package/dist/{chunk-NPCVLBCM.min.js → chunk-UZBCM3UI.min.js} +5 -75
  9. package/dist/{chunk-NPCVLBCM.min.js.map → chunk-UZBCM3UI.min.js.map} +1 -1
  10. package/dist/{chunk-FIOA3FZW.min.js → chunk-VDYG5VHX.min.js} +4 -4
  11. package/dist/{chunk-FIOA3FZW.min.js.map → chunk-VDYG5VHX.min.js.map} +1 -1
  12. package/dist/index.min.js +19 -16
  13. package/dist/ipfs/car.d.ts +2 -1
  14. package/dist/ipfs/car.d.ts.map +1 -1
  15. package/dist/ipfs/fetch-snapshot-chain.d.ts +27 -0
  16. package/dist/ipfs/fetch-snapshot-chain.d.ts.map +1 -0
  17. package/dist/ipfs.d.ts +1 -0
  18. package/dist/ipfs.d.ts.map +1 -1
  19. package/dist/ipfs.min.js +7 -4
  20. package/dist/pubsub/pubsub-types.d.ts +7 -7
  21. package/dist/pubsub/pubsub-types.d.ts.map +1 -1
  22. package/dist/pubsub/{pub-push.d.ts → snap-push.d.ts} +7 -7
  23. package/dist/pubsub/snap-push.d.ts.map +1 -0
  24. package/dist/pubsub.d.ts +1 -1
  25. package/dist/pubsub.d.ts.map +1 -1
  26. package/dist/pubsub.min.js +14 -14
  27. package/dist/query/situations.d.ts +77 -0
  28. package/dist/query/situations.d.ts.map +1 -1
  29. package/dist/query.min.js +3 -3
  30. package/dist/thread.min.js +1 -1
  31. package/package.json +1 -1
  32. package/dist/chunk-JEOQUHTK.min.js +0 -1515
  33. package/dist/chunk-JEOQUHTK.min.js.map +0 -1
  34. package/dist/chunk-RPPZKO5L.min.js +0 -1
  35. package/dist/chunk-RPPZKO5L.min.js.map +0 -1
  36. package/dist/pubsub/pub-push.d.ts.map +0 -1
  37. /package/dist/{chunk-TEQ4SIKN.min.js.map → chunk-E4BAQ5JJ.min.js.map} +0 -0
  38. /package/dist/{chunk-OBMVNVJR.min.js.map → chunk-KVPEUWWR.min.js.map} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  cyrb53hash,
3
3
  ensureTsPvAndFinalizeApplog,
4
4
  g
5
- } from "./chunk-NPCVLBCM.min.js";
5
+ } from "./chunk-UZBCM3UI.min.js";
6
6
 
7
7
  // src/pubsub/pub-pull.ts
8
8
  var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
@@ -21,7 +21,7 @@ function integratePub({ targetThread, agentHash, subID, pubData }) {
21
21
  }
22
22
 
23
23
  // src/pubsub/pubsub-types.ts
24
- function isPublication(obj) {
24
+ function isShare(obj) {
25
25
  return obj?.pk !== void 0 && obj?.lastPush !== void 0;
26
26
  }
27
27
  function isSubscription(obj) {
@@ -33,8 +33,8 @@ function agentToShortHash(agentString) {
33
33
 
34
34
  export {
35
35
  integratePub,
36
- isPublication,
36
+ isShare,
37
37
  isSubscription,
38
38
  agentToShortHash
39
39
  };
40
- //# sourceMappingURL=chunk-FIOA3FZW.min.js.map
40
+ //# sourceMappingURL=chunk-VDYG5VHX.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/pubsub/pub-pull.ts","../src/pubsub/pubsub-types.ts"],"sourcesContent":["import { Logger } from 'besonders-logger'\nimport { CID } from 'multiformats'\nimport { ensureTsPvAndFinalizeApplog } from '../applog/applog-helpers'\nimport { EntityID } from '../applog/datom-types'\nimport { Thread } from '../thread'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport type PubPullData = {\n\tcid: CID\n\tthread: Thread\n}\n\nexport function integratePub({ targetThread, agentHash, subID, pubData }: {\n\ttargetThread: Thread\n\tagentHash: EntityID\n\tpubData: PubPullData\n\tsubID?: EntityID\n}) {\n\tconst newLogs = pubData.thread.applogs.filter(log => !targetThread.hasApplog(log, false))\n\tDEBUG(`[integratePub] integrating ${newLogs.length} logs`, { targetThread, subID, pubData })\n\tlet toInsert = newLogs\n\tif (subID) {\n\t\ttoInsert = toInsert.concat(ensureTsPvAndFinalizeApplog(\n\t\t\t{ en: subID, at: 'subscription/cid', vl: pubData.cid.toString(), ag: agentHash },\n\t\t\ttargetThread,\n\t\t))\n\t}\n\ttargetThread.insertRaw(toInsert)\n\treturn newLogs\n}\n","import { CID } from 'multiformats/cid'\nimport { cyrb53hash } from './../applog/applog-utils'\nimport { AgentHash, AgentID, CidString } 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\tsign(data: Uint8Array): Promise<Uint8Array>\n}\nexport interface AppAgentForWorker {\n\tag: AgentHash\n\tagentString: AgentString\n\tdid: DIDString\n\tsignerSecret?: Uint8Array\n\tsign?: (data: Uint8Array)=> Promise<Uint8Array>\n}\nexport interface PubBlockRoot {\n\tapplogs: CID\n\tapplogsSignature: Uint8Array\n\tinfo: CID\n\tinfoSignature: Uint8Array\n\tprev?: CID\n}\nexport interface PubBlockLogs {\n\tlogs: CID[]\n}\nexport interface PubBlockChunks {\n\tchunks: CID[]\n}\nexport type PubBlockLogsOrChunks = PubBlockLogs | PubBlockChunks\n\n// HACK: this is actually note3 types, not wovin\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\tpurgeBeforePush?: 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\tlatestLogTs?: string\n\tpubCounter?: number\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 // ? why not CidString\n\tlastApplogCID?: 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":";;;;;;;AAMA,IAAM,EAAE,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,EAAO,MAAM,EAAO,IAAI;AAO9D,SAAS,aAAa,EAAE,cAAc,WAAW,OAAO,QAAQ,GAKpE;AACF,QAAM,UAAU,QAAQ,OAAO,QAAQ,OAAO,SAAO,CAAC,aAAa,UAAU,KAAK,KAAK,CAAC;AACxF,QAAM,8BAA8B,QAAQ,MAAM,SAAS,EAAE,cAAc,OAAO,QAAQ,CAAC;AAC3F,MAAI,WAAW;AACf,MAAI,OAAO;AACV,eAAW,SAAS,OAAO;AAAA,MAC1B,EAAE,IAAI,OAAO,IAAI,oBAAoB,IAAI,QAAQ,IAAI,SAAS,GAAG,IAAI,UAAU;AAAA,MAC/E;AAAA,IACD,CAAC;AAAA,EACF;AACA,eAAa,UAAU,QAAQ;AAC/B,SAAO;AACR;;;ACgDO,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
+ {"version":3,"sources":["../src/pubsub/pub-pull.ts","../src/pubsub/pubsub-types.ts"],"sourcesContent":["import { Logger } from 'besonders-logger'\nimport { CID } from 'multiformats'\nimport { ensureTsPvAndFinalizeApplog } from '../applog/applog-helpers'\nimport { EntityID } from '../applog/datom-types'\nimport { Thread } from '../thread'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport type PubPullData = {\n\tcid: CID\n\tthread: Thread\n}\n\nexport function integratePub({ targetThread, agentHash, subID, pubData }: {\n\ttargetThread: Thread\n\tagentHash: EntityID\n\tpubData: PubPullData\n\tsubID?: EntityID\n}) {\n\tconst newLogs = pubData.thread.applogs.filter(log => !targetThread.hasApplog(log, false))\n\tDEBUG(`[integratePub] integrating ${newLogs.length} logs`, { targetThread, subID, pubData })\n\tlet toInsert = newLogs\n\tif (subID) {\n\t\ttoInsert = toInsert.concat(ensureTsPvAndFinalizeApplog(\n\t\t\t{ en: subID, at: 'subscription/cid', vl: pubData.cid.toString(), ag: agentHash },\n\t\t\ttargetThread,\n\t\t))\n\t}\n\ttargetThread.insertRaw(toInsert)\n\treturn newLogs\n}\n","import { CID } from 'multiformats/cid'\nimport { cyrb53hash } from './../applog/applog-utils'\nimport { AgentHash, AgentID, CidString } 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\tsign(data: Uint8Array): Promise<Uint8Array>\n}\nexport interface AppAgentForWorker {\n\tag: AgentHash\n\tagentString: AgentString\n\tdid: DIDString\n\tsignerSecret?: Uint8Array\n\tsign?: (data: Uint8Array)=> Promise<Uint8Array>\n}\nexport interface SnapRootBlock {\n\tapplogs: CID\n\tapplogsSignature: Uint8Array\n\tinfo: CID\n\tinfoSignature: Uint8Array\n\tprev?: CID\n}\nexport interface SnapBlockLogs {\n\tlogs: CID[]\n}\nexport interface SnapBlockChunks {\n\tchunks: CID[]\n}\nexport type SnapBlockLogsOrChunks = SnapBlockLogs | SnapBlockChunks\n\n// HACK: this is actually note3 types, not wovin\nexport interface IShare {\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\tpurgeBeforePush?: 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\tlatestLogTs?: string\n\tpubCounter?: number\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 // ? why not CidString\n\tlastApplogCID?: 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 isShare(obj: any): obj is IShare {\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 TShareSub = IShare | ISubscription\n\nexport function agentToShortHash(agentString: string) {\n\treturn cyrb53hash(agentString, 31, 7) as string\n}\n"],"mappings":";;;;;;;AAMA,IAAM,EAAE,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,EAAO,MAAM,EAAO,IAAI;AAO9D,SAAS,aAAa,EAAE,cAAc,WAAW,OAAO,QAAQ,GAKpE;AACF,QAAM,UAAU,QAAQ,OAAO,QAAQ,OAAO,SAAO,CAAC,aAAa,UAAU,KAAK,KAAK,CAAC;AACxF,QAAM,8BAA8B,QAAQ,MAAM,SAAS,EAAE,cAAc,OAAO,QAAQ,CAAC;AAC3F,MAAI,WAAW;AACf,MAAI,OAAO;AACV,eAAW,SAAS,OAAO;AAAA,MAC1B,EAAE,IAAI,OAAO,IAAI,oBAAoB,IAAI,QAAQ,IAAI,SAAS,GAAG,IAAI,UAAU;AAAA,MAC/E;AAAA,IACD,CAAC;AAAA,EACF;AACA,eAAa,UAAU,QAAQ;AAC/B,SAAO;AACR;;;ACgDO,SAAS,QAAQ,KAAyB;AAChD,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":[]}
package/dist/index.min.js CHANGED
@@ -1,33 +1,35 @@
1
1
  import "./chunk-7IDQIMQO.min.js";
2
- import "./chunk-RPPZKO5L.min.js";
2
+ import {
3
+ fetchSnapshotChainUntil
4
+ } from "./chunk-IHGAJTEQ.min.js";
3
5
  import {
4
6
  agentToShortHash,
5
7
  integratePub,
6
- isPublication,
8
+ isShare,
7
9
  isSubscription
8
- } from "./chunk-FIOA3FZW.min.js";
10
+ } from "./chunk-VDYG5VHX.min.js";
9
11
  import {
10
12
  carFromBlob,
11
13
  chunkApplogs,
12
14
  decodePubFromBlocks,
13
15
  decodePubFromCar,
14
- encodeApplogsAsCar,
15
- encodePubAsCar,
16
+ encodeSnapshotApplogsAsCar,
17
+ encodeSnapshotAsCar,
16
18
  getBlocksOfCar,
17
19
  getDecodedBlock,
18
- isPubBlockChunks,
20
+ isSnapBlockChunks,
19
21
  makeCarBlob,
20
22
  makeCarOut,
21
- preparePubForPush,
23
+ prepareSnapshotForPush,
22
24
  streamReaderToIterable,
23
25
  unchunkApplogsBlock
24
- } from "./chunk-JEOQUHTK.min.js";
26
+ } from "./chunk-SIIQEX77.min.js";
25
27
  import "./chunk-QPGEBDMJ.min.js";
26
28
  import {
27
29
  includedIn,
28
30
  includes,
29
31
  queryDivergencesByPrev
30
- } from "./chunk-TEQ4SIKN.min.js";
32
+ } from "./chunk-E4BAQ5JJ.min.js";
31
33
  import {
32
34
  QueryNode,
33
35
  QueryResult,
@@ -54,7 +56,7 @@ import {
54
56
  throwOnTimeout,
55
57
  withTimeout,
56
58
  withoutDeleted
57
- } from "./chunk-OBMVNVJR.min.js";
59
+ } from "./chunk-KVPEUWWR.min.js";
58
60
  import {
59
61
  AppLogNoCidTB,
60
62
  AppLogNoCidTBC,
@@ -152,7 +154,7 @@ import {
152
154
  variableNameWithoutQuestionmark,
153
155
  withPvFrom,
154
156
  withTs
155
- } from "./chunk-NPCVLBCM.min.js";
157
+ } from "./chunk-UZBCM3UI.min.js";
156
158
  import "./chunk-KEHU7HGZ.min.js";
157
159
  import "./chunk-5MMGBK2U.min.js";
158
160
  import {
@@ -227,10 +229,10 @@ export {
227
229
  decodePubFromCar,
228
230
  encodeApplog,
229
231
  encodeApplogAndGetCid,
230
- encodeApplogsAsCar,
231
232
  encodeBlock,
232
233
  encodeBlockOriginal,
233
- encodePubAsCar,
234
+ encodeSnapshotApplogsAsCar,
235
+ encodeSnapshotAsCar,
234
236
  ensureTsPvAndFinalizeApplog,
235
237
  ensureTsPvAndFinalizeApplogs,
236
238
  ensureValidCIDinstance,
@@ -238,6 +240,7 @@ export {
238
240
  entityOverlap,
239
241
  entityOverlapCount,
240
242
  entityOverlapMap,
243
+ fetchSnapshotChainUntil,
241
244
  filterAndMap,
242
245
  finalizeApplogForInsert,
243
246
  getAgents,
@@ -261,8 +264,8 @@ export {
261
264
  isEncryptedApplog,
262
265
  isInitEvent,
263
266
  isIpnsKeyCid,
264
- isPubBlockChunks,
265
- isPublication,
267
+ isShare,
268
+ isSnapBlockChunks,
266
269
  isStaticPattern,
267
270
  isSubscription,
268
271
  isTsBefore,
@@ -288,7 +291,7 @@ export {
288
291
  prefixAt,
289
292
  prefixAttrs,
290
293
  prepareForPub,
291
- preparePubForPush,
294
+ prepareSnapshotForPush,
292
295
  prettifyThreadName,
293
296
  query,
294
297
  queryAndMap,
@@ -27,7 +27,8 @@ export declare function decodePubFromCar(car: CarReader): Promise<{
27
27
  applogsCID: CID<unknown, number, number, import("multiformats").Version>;
28
28
  applogs: ApplogArrayMaybeEncrypted;
29
29
  }>;
30
- export declare function decodePubFromBlocks({ rootCID, blockStore }: DecodedCar, recursionTrace?: CID[]): Promise<{
30
+ export declare function decodePubFromBlocks({ rootCID, blockStore }: DecodedCar, _recursionTrace?: CID[], // DEPRECATED: kept for API compat, unused in iterative version
31
+ stopAtCID?: CID): Promise<{
31
32
  cid: CID<unknown, number, number, import("multiformats").Version>;
32
33
  info: {
33
34
  logs: {
@@ -1 +1 @@
1
- {"version":3,"file":"car.d.ts","sourceRoot":"","sources":["../../src/ipfs/car.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGhD,OAAO,EAAa,GAAG,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAAU,yBAAyB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAOpF,MAAM,MAAM,SAAS,GAAG,GAAG,CAAA;AAC3B,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEzD,MAAM,WAAW,aAAa;IAC7B,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAAC,UAAU,CAAC,CAAA;CACtC;AAED,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,GAAG,CAAA;IAEZ,UAAU,EAAE,aAAa,CAAA;CACzB;AAED,0CAA0C;AAC1C,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,SAAS;;;;;;;;;;;;;;;GAGpD;AAED,wBAAsB,mBAAmB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,cAAc,GAAE,GAAG,EAAO;;;;;;;;;;;;;;;GA6DxG;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,SAAS;;;;;GAmBlD;AACD,wBAAs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7F,SAAS,CAAC,EAAE,GAAG;;;;;;;;;;;;;;;GAgHf;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,SAAS;;;;;GAmBlD;AACD,wBAAsB,eAAe,CAAC,UAAU,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,oBAYxE;AAGD,wBAAsB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,uDASvE,CAAC,iEAAiE;AAWnE,wBAAsB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,iBAQxE;AACD,wBAAsB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAEvE;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,2BAA2B,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CAWrH"}
@@ -0,0 +1,27 @@
1
+ import { CarReader } from '@ipld/car';
2
+ import { CID } from 'multiformats/cid';
3
+ export interface BlockStoreForFetch {
4
+ get(cid: CID): Promise<Uint8Array | undefined>;
5
+ put(cid: CID, bytes: Uint8Array): Promise<void>;
6
+ }
7
+ export interface FetchChainOptions {
8
+ rootCID: CID;
9
+ stopAtCID?: CID;
10
+ fetchBlock: (cid: CID) => Promise<CarReader>;
11
+ fetchAll: (cid: CID) => Promise<CarReader>;
12
+ maxDepth?: number;
13
+ }
14
+ export interface FetchChainResult {
15
+ rootCID: CID;
16
+ blockStore: BlockStoreForFetch;
17
+ /** Serializable blocks array for worker boundary crossing */
18
+ blocks: [string, Uint8Array][];
19
+ snapshotCount: number;
20
+ }
21
+ /**
22
+ * Fetches a snapshot chain iteratively, stopping at stopAtCID.
23
+ * Uses 3 requests per snapshot: root(block), applogs(all), info(all).
24
+ * This avoids the gateway's dag-scope=all following prev links recursively.
25
+ */
26
+ export declare function fetchSnapshotChainUntil(options: FetchChainOptions): Promise<FetchChainResult>;
27
+ //# sourceMappingURL=fetch-snapshot-chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-snapshot-chain.d.ts","sourceRoot":"","sources":["../../src/ipfs/fetch-snapshot-chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGrC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAMtC,MAAM,WAAW,kBAAkB;IAC/B,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAC9C,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAClD;AAED,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,GAAG,CAAA;IACZ,SAAS,CAAC,EAAE,GAAG,CAAA;IACf,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;IAC5C,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,GAAG,CAAA;IACZ,UAAU,EAAE,kBAAkB,CAAA;IAC9B,6DAA6D;IAC7D,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAA;IAC9B,aAAa,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkDnG"}
package/dist/ipfs.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './ipfs/car';
2
2
  export * from './ipfs/ipfs-utils';
3
+ export * from './ipfs/fetch-snapshot-chain';
3
4
  //# sourceMappingURL=ipfs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ipfs.d.ts","sourceRoot":"","sources":["../src/ipfs.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"ipfs.d.ts","sourceRoot":"","sources":["../src/ipfs.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,6BAA6B,CAAA"}
package/dist/ipfs.min.js CHANGED
@@ -1,4 +1,6 @@
1
- import "./chunk-RPPZKO5L.min.js";
1
+ import {
2
+ fetchSnapshotChainUntil
3
+ } from "./chunk-IHGAJTEQ.min.js";
2
4
  import {
3
5
  carFromBlob,
4
6
  decodePubFromBlocks,
@@ -8,9 +10,9 @@ import {
8
10
  makeCarBlob,
9
11
  makeCarOut,
10
12
  streamReaderToIterable
11
- } from "./chunk-JEOQUHTK.min.js";
13
+ } from "./chunk-SIIQEX77.min.js";
12
14
  import "./chunk-QPGEBDMJ.min.js";
13
- import "./chunk-OBMVNVJR.min.js";
15
+ import "./chunk-KVPEUWWR.min.js";
14
16
  import {
15
17
  MULTICODEC_IPNS_KEY,
16
18
  areCidsEqual,
@@ -26,7 +28,7 @@ import {
26
28
  prepareForPub,
27
29
  toIpnsString,
28
30
  tryParseCID
29
- } from "./chunk-NPCVLBCM.min.js";
31
+ } from "./chunk-UZBCM3UI.min.js";
30
32
  import "./chunk-KEHU7HGZ.min.js";
31
33
  import "./chunk-HYMC7W6S.min.js";
32
34
  import "./chunk-PHITDXZT.min.js";
@@ -43,6 +45,7 @@ export {
43
45
  encodeBlock,
44
46
  encodeBlockOriginal,
45
47
  ensureValidCIDinstance,
48
+ fetchSnapshotChainUntil,
46
49
  getBlocksOfCar,
47
50
  getCidSync,
48
51
  getDecodedBlock,
@@ -17,21 +17,21 @@ export interface AppAgentForWorker {
17
17
  signerSecret?: Uint8Array;
18
18
  sign?: (data: Uint8Array) => Promise<Uint8Array>;
19
19
  }
20
- export interface PubBlockRoot {
20
+ export interface SnapRootBlock {
21
21
  applogs: CID;
22
22
  applogsSignature: Uint8Array;
23
23
  info: CID;
24
24
  infoSignature: Uint8Array;
25
25
  prev?: CID;
26
26
  }
27
- export interface PubBlockLogs {
27
+ export interface SnapBlockLogs {
28
28
  logs: CID[];
29
29
  }
30
- export interface PubBlockChunks {
30
+ export interface SnapBlockChunks {
31
31
  chunks: CID[];
32
32
  }
33
- export type PubBlockLogsOrChunks = PubBlockLogs | PubBlockChunks;
34
- export interface IPublication {
33
+ export type SnapBlockLogsOrChunks = SnapBlockLogs | SnapBlockChunks;
34
+ export interface IShare {
35
35
  id?: string;
36
36
  createdAt: string;
37
37
  name: string;
@@ -65,8 +65,8 @@ export interface ISubscription {
65
65
  encryptedFor?: string | undefined;
66
66
  encryptedWith?: CryptoKey | undefined;
67
67
  }
68
- export declare function isPublication(obj: any): obj is IPublication;
68
+ export declare function isShare(obj: any): obj is IShare;
69
69
  export declare function isSubscription(obj: any): obj is ISubscription;
70
- export type TSubPub = IPublication | ISubscription;
70
+ export type TShareSub = IShare | ISubscription;
71
71
  export declare function agentToShortHash(agentString: string): string;
72
72
  //# sourceMappingURL=pubsub-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pubsub-types.d.ts","sourceRoot":"","sources":["../../src/pubsub/pubsub-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAa,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;AAChD,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AACtC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;AAEjD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAA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a,CAE7D;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,aAAa,CAAA;AAE9C,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GACV,MAAM,CAC/C"}
@@ -2,8 +2,8 @@ import { CID } from 'multiformats/cid';
2
2
  import type { Applog, ApplogArrayMaybeEncryptedRO, ApplogArrayNoCIDMaybeEncryptedRO } from '../applog/datom-types';
3
3
  import { BlockStoreish } from '../ipfs/car';
4
4
  import { ApplogsOrThread, Thread } from '../thread';
5
- import type { AppAgent, IPublication, PubBlockChunks, PubBlockLogsOrChunks } from './pubsub-types';
6
- export declare function preparePubForPush(agent: AppAgent, appThread: Thread, threadToPublish: ApplogsOrThread, publication: IPublication, prevPubCID: CID | null): Promise<{
5
+ import type { AppAgent, IShare, SnapBlockChunks, SnapBlockLogsOrChunks } from './pubsub-types';
6
+ export declare function prepareSnapshotForPush(agent: AppAgent, appThread: Thread, threadToPublish: ApplogsOrThread, share: IShare, prevSnapCID: CID | null): Promise<{
7
7
  cid: CID<any, 297, 18, 1>;
8
8
  blob: Blob;
9
9
  blocks: import("multiformats").BlockView<any, 297, 18, 1>[];
@@ -14,7 +14,7 @@ export declare function preparePubForPush(agent: AppAgent, appThread: Thread, th
14
14
  * @param applogs Encrypted or plain applogs
15
15
  * @returns Car file
16
16
  */
17
- export declare function encodePubAsCar(agent: AppAgent, applogs: ApplogArrayNoCIDMaybeEncryptedRO, infoLogs: readonly Applog[], prevPubCID: CID | null): Promise<{
17
+ export declare function encodeSnapshotAsCar(agent: AppAgent, applogs: ApplogArrayNoCIDMaybeEncryptedRO, infoLogs: readonly Applog[], prevSnapCID: CID | null): Promise<{
18
18
  cid: CID<any, 297, 18, 1>;
19
19
  blob: Blob;
20
20
  blocks: import("multiformats").BlockView<any, 297, 18, 1>[];
@@ -31,11 +31,11 @@ export declare function chunkApplogs(applogCids: CID<unknown, 297, 18, 1>[], siz
31
31
  blocks: any[];
32
32
  chunks: any[];
33
33
  }>;
34
- export declare function unchunkApplogsBlock(block: PubBlockLogsOrChunks, blockStore: BlockStoreish): Promise<CID[]>;
35
- export declare function isPubBlockChunks(block: PubBlockLogsOrChunks): block is PubBlockChunks;
34
+ export declare function unchunkApplogsBlock(block: SnapBlockLogsOrChunks, blockStore: BlockStoreish): Promise<CID[]>;
35
+ export declare function isSnapBlockChunks(block: SnapBlockLogsOrChunks): block is SnapBlockChunks;
36
36
  /**
37
37
  * @param applogs Encrypted or plain applogs
38
38
  * @returns Car file
39
39
  */
40
- export declare function encodeApplogsAsCar(applogs: ApplogArrayMaybeEncryptedRO): Promise<Blob>;
41
- //# sourceMappingURL=pub-push.d.ts.map
40
+ export declare function encodeSnapshotApplogsAsCar(applogs: ApplogArrayMaybeEncryptedRO): Promise<Blob>;
41
+ //# sourceMappingURL=snap-push.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snap-push.d.ts","sourceRoot":"","sources":["../../src/pubsub/snap-push.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAGtC,OAAO,KAAK,EACX,MAAM,EAEN,2BAA2B,EAC3B,gCAAgC,EAIhC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,aAAa,EAA4C,MAAM,aAAa,CAAA;AAGrF,OAAO,EAAE,eAAe,EAAqB,MAAM,EAAE,MAAM,WAAW,CAAA;AAGtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAiB,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAe7G,wBAAsB,sBAAsB,CAC3C,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,GAAG,GAAG,IAAI;;;;;;GA+HvB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,gCAAgC,EACzC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,WAAW,EAAE,GAAG,GAAG,IAAI;;;;;;GAgCvB;AAED,uEAAuE;AACvE,wBAAsB,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,SAAQ;;;;;;;;GAatF;AACD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAYjH;AACD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,KAAK,IAAI,eAAe,CAExF;AACD;;;GAGG;AACH,wBAAsB,0BAA0B,CAC/C,OAAO,EAAE,2BAA2B,iBAUpC"}
package/dist/pubsub.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './pubsub/connector';
2
2
  export * from './pubsub/pub-pull';
3
- export * from './pubsub/pub-push';
3
+ export * from './pubsub/snap-push';
4
4
  export * from './pubsub/pubsub-types';
5
5
  //# sourceMappingURL=pubsub.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../src/pubsub.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../src/pubsub.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA"}
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  agentToShortHash,
3
3
  integratePub,
4
- isPublication,
4
+ isShare,
5
5
  isSubscription
6
- } from "./chunk-FIOA3FZW.min.js";
6
+ } from "./chunk-VDYG5VHX.min.js";
7
7
  import {
8
8
  chunkApplogs,
9
- encodeApplogsAsCar,
10
- encodePubAsCar,
11
- isPubBlockChunks,
12
- preparePubForPush,
9
+ encodeSnapshotApplogsAsCar,
10
+ encodeSnapshotAsCar,
11
+ isSnapBlockChunks,
12
+ prepareSnapshotForPush,
13
13
  unchunkApplogsBlock
14
- } from "./chunk-JEOQUHTK.min.js";
14
+ } from "./chunk-SIIQEX77.min.js";
15
15
  import "./chunk-QPGEBDMJ.min.js";
16
- import "./chunk-OBMVNVJR.min.js";
17
- import "./chunk-NPCVLBCM.min.js";
16
+ import "./chunk-KVPEUWWR.min.js";
17
+ import "./chunk-UZBCM3UI.min.js";
18
18
  import "./chunk-KEHU7HGZ.min.js";
19
19
  import "./chunk-HYMC7W6S.min.js";
20
20
  import "./chunk-PHITDXZT.min.js";
21
21
  export {
22
22
  agentToShortHash,
23
23
  chunkApplogs,
24
- encodeApplogsAsCar,
25
- encodePubAsCar,
24
+ encodeSnapshotApplogsAsCar,
25
+ encodeSnapshotAsCar,
26
26
  integratePub,
27
- isPubBlockChunks,
28
- isPublication,
27
+ isShare,
28
+ isSnapBlockChunks,
29
29
  isSubscription,
30
- preparePubForPush,
30
+ prepareSnapshotForPush,
31
31
  unchunkApplogsBlock
32
32
  };
33
33
  //# sourceMappingURL=pubsub.min.js.map
@@ -1,2 +1,79 @@
1
+ import { Applog, query } from '@wovin/core';
2
+ /**
3
+ * Situations are meant to flag and possibly autocorrect or autosuggest solutions
4
+ *
5
+ * Types of Situations:
6
+ * Divergences = leaf nodes that are based on different previous versions/contexts
7
+ * Conflicts/Disagreement = different agents setting the same attribute (based on same previous)
8
+ * Overwrite = one agent's action implicitly overrides another's without explicit confirmation
9
+ * Conscious Disagreement = agents explicitly acknowledge and accept conflicting changes
10
+ * Suggestions = recommendations for improvements or alternatives
11
+ */
12
+ interface Situation {
13
+ name: string;
14
+ desc: string;
15
+ intensity: number;
16
+ type: typeof SituationTypes[keyof typeof SituationTypes];
17
+ query: typeof query;
18
+ resolutionOptions: Resolution[];
19
+ metadata?: {
20
+ agentId?: string;
21
+ timestamp?: number;
22
+ context?: Record<string, any>;
23
+ };
24
+ }
25
+ interface QueryResultWithSituations {
26
+ result: any;
27
+ situations: Situation[];
28
+ threadView?: ThreadView;
29
+ }
30
+ interface ThreadView {
31
+ id: string;
32
+ situations: SituatedMessage[];
33
+ resolutionState: ResolutionState;
34
+ }
35
+ interface SituatedMessage {
36
+ id: string;
37
+ situation: Situation;
38
+ message: string;
39
+ resolutions: ResolutionAction[];
40
+ timestamp: number;
41
+ agentId?: string;
42
+ }
43
+ interface ResolutionState {
44
+ pending: string[];
45
+ resolved: string[];
46
+ ignored: string[];
47
+ }
48
+ interface ResolutionAction {
49
+ name: string;
50
+ applied: boolean;
51
+ appliedAt?: number;
52
+ appliedBy?: string;
53
+ }
54
+ declare const SituationTypes: {
55
+ readonly divergence: "divergence";
56
+ readonly disagreement: "disagreement";
57
+ readonly overwrite: "overwrite";
58
+ readonly consciousDisagreement: "consciousDisagreement";
59
+ readonly suggestion: "suggestion";
60
+ };
61
+ interface Resolution {
62
+ name: string;
63
+ desc: string;
64
+ assertion: () => Applog[];
65
+ }
66
+ /**
67
+ * Creates a thread view for situations detected in query results
68
+ */
69
+ export declare function createThreadForSituations(result: any, situations: Situation[], options?: {
70
+ threadId?: string;
71
+ groupByType?: boolean;
72
+ sortByIntensity?: boolean;
73
+ }): QueryResultWithSituations;
74
+ /**
75
+ * Applies a resolution action to a situation in a thread
76
+ */
77
+ export declare function applyResolution(threadView: ThreadView, messageId: string, resolutionName: string, appliedBy: string): ThreadView;
1
78
  export {};
2
79
  //# sourceMappingURL=situations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"situations.d.ts","sourceRoot":"","sources":["../../src/query/situations.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"situations.d.ts","sourceRoot":"","sources":["../../src/query/situations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAa,MAAM,aAAa,CAAA;AAKtD;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AAA;AACV,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,MAAM,EAAE,CAAA;CACzB;AA2ED;;GAEG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,GAAG,EACX,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,GAAE;IACR,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;CACpB,GACJ,yBAAyB,CAqC3B;AAkBD;;GAEG;AACH,wBAAgB,eAAe,CAC9B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,GACf,UAAU,CAmCZ"}
package/dist/query.min.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  includedIn,
3
3
  includes,
4
4
  queryDivergencesByPrev
5
- } from "./chunk-TEQ4SIKN.min.js";
5
+ } from "./chunk-E4BAQ5JJ.min.js";
6
6
  import {
7
7
  QueryNode,
8
8
  QueryResult,
@@ -29,7 +29,7 @@ import {
29
29
  throwOnTimeout,
30
30
  withTimeout,
31
31
  withoutDeleted
32
- } from "./chunk-OBMVNVJR.min.js";
32
+ } from "./chunk-KVPEUWWR.min.js";
33
33
  import {
34
34
  applogThreadComparer,
35
35
  autorunButAlsoImmediately,
@@ -45,7 +45,7 @@ import {
45
45
  prettifyThreadName,
46
46
  queryNodesComparer,
47
47
  rootsQueries
48
- } from "./chunk-NPCVLBCM.min.js";
48
+ } from "./chunk-UZBCM3UI.min.js";
49
49
  import "./chunk-KEHU7HGZ.min.js";
50
50
  import "./chunk-HYMC7W6S.min.js";
51
51
  import "./chunk-PHITDXZT.min.js";
@@ -21,7 +21,7 @@ import {
21
21
  rollingFilter,
22
22
  rollingMapper,
23
23
  simpleApplogMapper
24
- } from "./chunk-NPCVLBCM.min.js";
24
+ } from "./chunk-UZBCM3UI.min.js";
25
25
  import "./chunk-KEHU7HGZ.min.js";
26
26
  import "./chunk-HYMC7W6S.min.js";
27
27
  import "./chunk-PHITDXZT.min.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wovin/core",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "type": "module",
5
5
  "main": "./dist/index.min.js",
6
6
  "module": "./dist/index.min.js",