@wovin/core 0.1.16 → 0.1.18

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/applog-helpers.d.ts +5 -4
  2. package/dist/applog/applog-helpers.d.ts.map +1 -1
  3. package/dist/applog.min.js +3 -1
  4. package/dist/{chunk-MPOFY7NX.min.js → chunk-CZTDDXGE.min.js} +5 -1
  5. package/dist/{chunk-MPOFY7NX.min.js.map → chunk-CZTDDXGE.min.js.map} +1 -1
  6. package/dist/{chunk-DUAUQKBV.min.js → chunk-EXT2FEEA.min.js} +2 -2
  7. package/dist/chunk-EXT2FEEA.min.js.map +1 -0
  8. package/dist/{chunk-I73T6OVV.min.js → chunk-FXUGEDX4.min.js} +2 -2
  9. package/dist/{chunk-IFB3AKYA.min.js → chunk-NDHTR5QC.min.js} +2 -2
  10. package/dist/{chunk-C22YMCSL.min.js → chunk-QF7OVQA2.min.js} +3 -3
  11. package/dist/{chunk-AIITTHC6.min.js → chunk-UJMWWDG4.min.js} +2 -2
  12. package/dist/{chunk-TPV3JAXV.min.js → chunk-YAGDT6HQ.min.js} +3 -3
  13. package/dist/index.min.js +9 -7
  14. package/dist/ipfs.min.js +4 -4
  15. package/dist/pubsub/pubsub-types.d.ts +4 -6
  16. package/dist/pubsub/pubsub-types.d.ts.map +1 -1
  17. package/dist/pubsub/ucan-example.d.ts +3 -0
  18. package/dist/pubsub/ucan-example.d.ts.map +1 -0
  19. package/dist/pubsub/ucan.d.ts +16 -0
  20. package/dist/pubsub/ucan.d.ts.map +1 -0
  21. package/dist/pubsub.min.js +4 -4
  22. package/dist/query.min.js +3 -3
  23. package/dist/retrieve.min.js +4 -4
  24. package/dist/thread.min.js +1 -1
  25. package/package.json +6 -2
  26. package/dist/chunk-DUAUQKBV.min.js.map +0 -1
  27. /package/dist/{chunk-I73T6OVV.min.js.map → chunk-FXUGEDX4.min.js.map} +0 -0
  28. /package/dist/{chunk-IFB3AKYA.min.js.map → chunk-NDHTR5QC.min.js.map} +0 -0
  29. /package/dist/{chunk-C22YMCSL.min.js.map → chunk-QF7OVQA2.min.js.map} +0 -0
  30. /package/dist/{chunk-AIITTHC6.min.js.map → chunk-UJMWWDG4.min.js.map} +0 -0
  31. /package/dist/{chunk-TPV3JAXV.min.js.map → chunk-YAGDT6HQ.min.js.map} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  cyrb53hash,
3
3
  ensureTsPvAndFinalizeApplog,
4
4
  g
5
- } from "./chunk-MPOFY7NX.min.js";
5
+ } from "./chunk-CZTDDXGE.min.js";
6
6
 
7
7
  // src/pubsub/pub-pull.ts
8
8
  var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
@@ -37,4 +37,4 @@ export {
37
37
  isSubscription,
38
38
  agentToShortHash
39
39
  };
40
- //# sourceMappingURL=chunk-DUAUQKBV.min.js.map
40
+ //# sourceMappingURL=chunk-EXT2FEEA.min.js.map
@@ -0,0 +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'\nimport { UCANCapMap } from './ucan'\ntype AgentString = Tagged<string, 'AgentString'>\ntype DIDString = Tagged<string, 'DID'>\nexport type { AgentHash, AgentString, DIDString }\n\n\nexport interface AppAgent {\n\tag: AgentHash\n\tagentString: AgentString\n\tdid: DIDString\n\tsign? (data: Uint8Array): Promise<Uint8Array>\n\tucan?: UCANCapMap\n}\nexport interface AppAgentForWorker extends AppAgent {\n\tsignerSecret?: 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\trealtime?: boolean // enable real-time WebSocket updates via IPNS watcher\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;;;AC+CO,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":[]}
@@ -3,7 +3,7 @@ import {
3
3
  areCidsEqual,
4
4
  decode,
5
5
  g
6
- } from "./chunk-MPOFY7NX.min.js";
6
+ } from "./chunk-CZTDDXGE.min.js";
7
7
 
8
8
  // src/ipfs/fetch-snapshot-chain.ts
9
9
  var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
@@ -67,4 +67,4 @@ function createMemoryBlockStore() {
67
67
  export {
68
68
  fetchSnapshotChainUntil
69
69
  };
70
- //# sourceMappingURL=chunk-I73T6OVV.min.js.map
70
+ //# sourceMappingURL=chunk-FXUGEDX4.min.js.map
@@ -4,7 +4,7 @@ import {
4
4
  createDebugName,
5
5
  g,
6
6
  observableArrayMap
7
- } from "./chunk-MPOFY7NX.min.js";
7
+ } from "./chunk-CZTDDXGE.min.js";
8
8
  import {
9
9
  autorun,
10
10
  comparer,
@@ -62,4 +62,4 @@ export {
62
62
  includes,
63
63
  includedIn
64
64
  };
65
- //# sourceMappingURL=chunk-IFB3AKYA.min.js.map
65
+ //# sourceMappingURL=chunk-NDHTR5QC.min.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-QPGEBDMJ.min.js";
4
4
  import {
5
5
  lastWriteWins
6
- } from "./chunk-AIITTHC6.min.js";
6
+ } from "./chunk-UJMWWDG4.min.js";
7
7
  import {
8
8
  CID,
9
9
  areCidsEqual,
@@ -16,7 +16,7 @@ import {
16
16
  rollingFilter,
17
17
  src_exports,
18
18
  wrapper_default
19
- } from "./chunk-MPOFY7NX.min.js";
19
+ } from "./chunk-CZTDDXGE.min.js";
20
20
  import {
21
21
  __commonJS,
22
22
  __toESM
@@ -4119,4 +4119,4 @@ export {
4119
4119
  carFromBlob,
4120
4120
  streamReaderToIterable
4121
4121
  };
4122
- //# sourceMappingURL=chunk-C22YMCSL.min.js.map
4122
+ //# sourceMappingURL=chunk-QF7OVQA2.min.js.map
@@ -16,7 +16,7 @@ import {
16
16
  rollingMapper,
17
17
  sortApplogsByTs,
18
18
  wrapper_default
19
- } from "./chunk-MPOFY7NX.min.js";
19
+ } from "./chunk-CZTDDXGE.min.js";
20
20
  import {
21
21
  action,
22
22
  autorun,
@@ -507,4 +507,4 @@ export {
507
507
  withTimeout,
508
508
  throwOnTimeout
509
509
  };
510
- //# sourceMappingURL=chunk-AIITTHC6.min.js.map
510
+ //# sourceMappingURL=chunk-UJMWWDG4.min.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  unchunkApplogsBlock
3
- } from "./chunk-C22YMCSL.min.js";
3
+ } from "./chunk-QF7OVQA2.min.js";
4
4
  import {
5
5
  CID,
6
6
  areCidsEqual,
7
7
  decode,
8
8
  g,
9
9
  removeDuplicateAppLogs
10
- } from "./chunk-MPOFY7NX.min.js";
10
+ } from "./chunk-CZTDDXGE.min.js";
11
11
 
12
12
  // src/retrieve/update-thread.ts
13
13
  var { WARN, LOG, DEBUG, VERBOSE, ERROR } = g.setup(g.INFO);
@@ -109,4 +109,4 @@ async function updateThreadFromSnapshot(thread, cid, retriever, options) {
109
109
  export {
110
110
  updateThreadFromSnapshot
111
111
  };
112
- //# sourceMappingURL=chunk-TPV3JAXV.min.js.map
112
+ //# sourceMappingURL=chunk-YAGDT6HQ.min.js.map
package/dist/index.min.js CHANGED
@@ -2,21 +2,21 @@ import "./chunk-5MMGBK2U.min.js";
2
2
  import "./chunk-7IDQIMQO.min.js";
3
3
  import {
4
4
  fetchSnapshotChainUntil
5
- } from "./chunk-I73T6OVV.min.js";
5
+ } from "./chunk-FXUGEDX4.min.js";
6
6
  import {
7
7
  agentToShortHash,
8
8
  integratePub,
9
9
  isShare,
10
10
  isSubscription
11
- } from "./chunk-DUAUQKBV.min.js";
11
+ } from "./chunk-EXT2FEEA.min.js";
12
12
  import {
13
13
  includedIn,
14
14
  includes,
15
15
  queryDivergencesByPrev
16
- } from "./chunk-IFB3AKYA.min.js";
16
+ } from "./chunk-NDHTR5QC.min.js";
17
17
  import {
18
18
  updateThreadFromSnapshot
19
- } from "./chunk-TPV3JAXV.min.js";
19
+ } from "./chunk-YAGDT6HQ.min.js";
20
20
  import {
21
21
  carFromBlob,
22
22
  chunkApplogs,
@@ -32,7 +32,7 @@ import {
32
32
  prepareSnapshotForPush,
33
33
  streamReaderToIterable,
34
34
  unchunkApplogsBlock
35
- } from "./chunk-C22YMCSL.min.js";
35
+ } from "./chunk-QF7OVQA2.min.js";
36
36
  import "./chunk-QPGEBDMJ.min.js";
37
37
  import {
38
38
  QueryNode,
@@ -60,7 +60,7 @@ import {
60
60
  throwOnTimeout,
61
61
  withTimeout,
62
62
  withoutDeleted
63
- } from "./chunk-AIITTHC6.min.js";
63
+ } from "./chunk-UJMWWDG4.min.js";
64
64
  import {
65
65
  AppLogNoCidTB,
66
66
  AppLogNoCidTBC,
@@ -158,9 +158,10 @@ import {
158
158
  tsNearlySame,
159
159
  uniqueEnFromAppLogs,
160
160
  variableNameWithoutQuestionmark,
161
+ withAg,
161
162
  withPvFrom,
162
163
  withTs
163
- } from "./chunk-MPOFY7NX.min.js";
164
+ } from "./chunk-CZTDDXGE.min.js";
164
165
  import {
165
166
  BOOL,
166
167
  Bool,
@@ -328,6 +329,7 @@ export {
328
329
  uniqueEnFromAppLogs,
329
330
  updateThreadFromSnapshot,
330
331
  variableNameWithoutQuestionmark,
332
+ withAg,
331
333
  withPvFrom,
332
334
  withTimeout,
333
335
  withTs,
package/dist/ipfs.min.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fetchSnapshotChainUntil
3
- } from "./chunk-I73T6OVV.min.js";
3
+ } from "./chunk-FXUGEDX4.min.js";
4
4
  import {
5
5
  carFromBlob,
6
6
  decodePubFromBlocks,
@@ -10,9 +10,9 @@ import {
10
10
  makeCarBlob,
11
11
  makeCarOut,
12
12
  streamReaderToIterable
13
- } from "./chunk-C22YMCSL.min.js";
13
+ } from "./chunk-QF7OVQA2.min.js";
14
14
  import "./chunk-QPGEBDMJ.min.js";
15
- import "./chunk-AIITTHC6.min.js";
15
+ import "./chunk-UJMWWDG4.min.js";
16
16
  import {
17
17
  MULTICODEC_IPNS_KEY,
18
18
  areCidsEqual,
@@ -28,7 +28,7 @@ import {
28
28
  prepareForPub,
29
29
  toIpnsString,
30
30
  tryParseCID
31
- } from "./chunk-MPOFY7NX.min.js";
31
+ } from "./chunk-CZTDDXGE.min.js";
32
32
  import "./chunk-HYMC7W6S.min.js";
33
33
  import "./chunk-KEHU7HGZ.min.js";
34
34
  import "./chunk-PHITDXZT.min.js";
@@ -1,6 +1,7 @@
1
1
  import { CID } from 'multiformats/cid';
2
2
  import { AgentHash, AgentID } from '../applog/datom-types';
3
3
  import { Tagged } from '../types';
4
+ import { UCANCapMap } from './ucan';
4
5
  type AgentString = Tagged<string, 'AgentString'>;
5
6
  type DIDString = Tagged<string, 'DID'>;
6
7
  export type { AgentHash, AgentString, DIDString };
@@ -8,14 +9,11 @@ export interface AppAgent {
8
9
  ag: AgentHash;
9
10
  agentString: AgentString;
10
11
  did: DIDString;
11
- sign(data: Uint8Array): Promise<Uint8Array>;
12
+ sign?(data: Uint8Array): Promise<Uint8Array>;
13
+ ucan?: UCANCapMap;
12
14
  }
13
- export interface AppAgentForWorker {
14
- ag: AgentHash;
15
- agentString: AgentString;
16
- did: DIDString;
15
+ export interface AppAgentForWorker extends AppAgent {
17
16
  signerSecret?: Uint8Array;
18
- sign?: (data: Uint8Array) => Promise<Uint8Array>;
19
17
  }
20
18
  export interface SnapRootBlock {
21
19
  applogs: CID;
@@ -1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AE,MAAM,GAAG,IAAI,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CACrC;AACD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAE/C;AACD,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,aAAa,CAE7D;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,aAAa,CAAA;AAE9C,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GACV,MAAM,CAC/C"}
@@ -0,0 +1,3 @@
1
+ import { Resolver } from 'iso-signatures/verifiers/resolver.js';
2
+ export declare const verifierResolver: Resolver;
3
+ //# sourceMappingURL=ucan-example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ucan-example.d.ts","sourceRoot":"","sources":["../../src/pubsub/ucan-example.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAE/D,eAAO,MAAM,gBAAgB,UAE3B,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { DelegationOptions, DelegationPayload, StandardSchemaV1 } from 'iso-ucan/types';
2
+ import { Delegation } from 'iso-ucan/delegation';
3
+ import { AgentID } from '../applog/datom-types';
4
+ import { Resolver } from 'iso-signatures/verifiers/resolver.js';
5
+ export declare const verifierResolver: Resolver;
6
+ export declare enum KnownCaps {
7
+ publish = "WovinPublishCap",
8
+ delegate = "cap_delegate"
9
+ }
10
+ type DelegationPayloadSchema = StandardSchemaV1<unknown, DelegationPayload<unknown>>;
11
+ export type DelegationOptionsStandard = DelegationOptions<DelegationPayloadSchema>;
12
+ export type UCANCapMap = Partial<Record<KnownCaps, DelegationOptionsStandard[]>>;
13
+ export type AgentCapMap = Record<AgentID, UCANCapMap>;
14
+ export declare const createDelegation: (delegationPayload: DelegationOptionsStandard) => Promise<Delegation>;
15
+ export {};
16
+ //# sourceMappingURL=ucan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ucan.d.ts","sourceRoot":"","sources":["../../src/pubsub/ucan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAI/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAE/D,eAAO,MAAM,gBAAgB,UAE3B,CAAA;AA+BF,oBAAY,SAAS;IACpB,OAAO,oBAAoB;IAC3B,QAAQ,iBAAiB;CACzB;AAED,KAAK,uBAAuB,GAAG,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAA;AACpF,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,CAAA;AAClF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,yBAAyB,EAAE,CAAC,CAAC,CAAA;AAEhF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;AAErD,eAAO,MAAM,gBAAgB,GAAI,mBAAkB,yBAAyB,wBAG3E,CAAA"}
@@ -3,7 +3,7 @@ import {
3
3
  integratePub,
4
4
  isShare,
5
5
  isSubscription
6
- } from "./chunk-DUAUQKBV.min.js";
6
+ } from "./chunk-EXT2FEEA.min.js";
7
7
  import {
8
8
  chunkApplogs,
9
9
  encodeSnapshotApplogsAsCar,
@@ -11,10 +11,10 @@ import {
11
11
  isSnapBlockChunks,
12
12
  prepareSnapshotForPush,
13
13
  unchunkApplogsBlock
14
- } from "./chunk-C22YMCSL.min.js";
14
+ } from "./chunk-QF7OVQA2.min.js";
15
15
  import "./chunk-QPGEBDMJ.min.js";
16
- import "./chunk-AIITTHC6.min.js";
17
- import "./chunk-MPOFY7NX.min.js";
16
+ import "./chunk-UJMWWDG4.min.js";
17
+ import "./chunk-CZTDDXGE.min.js";
18
18
  import "./chunk-HYMC7W6S.min.js";
19
19
  import "./chunk-KEHU7HGZ.min.js";
20
20
  import "./chunk-PHITDXZT.min.js";
package/dist/query.min.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  includedIn,
3
3
  includes,
4
4
  queryDivergencesByPrev
5
- } from "./chunk-IFB3AKYA.min.js";
5
+ } from "./chunk-NDHTR5QC.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-AIITTHC6.min.js";
32
+ } from "./chunk-UJMWWDG4.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-MPOFY7NX.min.js";
48
+ } from "./chunk-CZTDDXGE.min.js";
49
49
  import "./chunk-HYMC7W6S.min.js";
50
50
  import "./chunk-KEHU7HGZ.min.js";
51
51
  import "./chunk-PHITDXZT.min.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  updateThreadFromSnapshot
3
- } from "./chunk-TPV3JAXV.min.js";
4
- import "./chunk-C22YMCSL.min.js";
3
+ } from "./chunk-YAGDT6HQ.min.js";
4
+ import "./chunk-QF7OVQA2.min.js";
5
5
  import "./chunk-QPGEBDMJ.min.js";
6
- import "./chunk-AIITTHC6.min.js";
7
- import "./chunk-MPOFY7NX.min.js";
6
+ import "./chunk-UJMWWDG4.min.js";
7
+ import "./chunk-CZTDDXGE.min.js";
8
8
  import "./chunk-HYMC7W6S.min.js";
9
9
  import "./chunk-KEHU7HGZ.min.js";
10
10
  import "./chunk-PHITDXZT.min.js";
@@ -23,7 +23,7 @@ import {
23
23
  rollingFilter,
24
24
  rollingMapper,
25
25
  simpleApplogMapper
26
- } from "./chunk-MPOFY7NX.min.js";
26
+ } from "./chunk-CZTDDXGE.min.js";
27
27
  import "./chunk-HYMC7W6S.min.js";
28
28
  import "./chunk-KEHU7HGZ.min.js";
29
29
  import "./chunk-PHITDXZT.min.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wovin/core",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "type": "module",
5
5
  "main": "./dist/index.min.js",
6
6
  "module": "./dist/index.min.js",
@@ -66,11 +66,15 @@
66
66
  "besonders-logger": "1.0.2",
67
67
  "date-fns": "^3.3.1",
68
68
  "hash-wasm": "^4.12.0",
69
+ "iso-kv": "^3.1.1",
70
+ "iso-signatures": "^0.5.1",
71
+ "iso-ucan": "^0.4.2",
69
72
  "lodash-es": "^4.17.21",
70
73
  "mobx": "^6.13.7",
71
74
  "mobx-utils": "^6.1.1",
72
75
  "multiformats": "^13.4.1",
73
- "safe-stable-stringify": "^2.5.0"
76
+ "safe-stable-stringify": "^2.5.0",
77
+ "zod": "^4.3.6"
74
78
  },
75
79
  "devDependencies": {
76
80
  "@types/lodash-es": "^4.17.12",
@@ -1 +0,0 @@
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\trealtime?: boolean // enable real-time WebSocket updates via IPNS watcher\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;;;ACiDO,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":[]}