@wovin/core 0.1.15 → 0.1.17
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 +1 -1
- package/dist/{chunk-SFDNH2ID.min.js → chunk-AIITTHC6.min.js} +2 -2
- package/dist/{chunk-GH2FXZ3U.min.js → chunk-C22YMCSL.min.js} +3 -3
- package/dist/{chunk-XR2SGDQV.min.js → chunk-I73T6OVV.min.js} +2 -2
- package/dist/{chunk-6XE4TT2P.min.js → chunk-IFB3AKYA.min.js} +2 -2
- package/dist/{chunk-6KONUEQB.min.js → chunk-IIZCL4FQ.min.js} +2 -2
- package/dist/chunk-IIZCL4FQ.min.js.map +1 -0
- package/dist/{chunk-3Y5KUHV5.min.js → chunk-MPOFY7NX.min.js} +22 -3
- package/dist/{chunk-3Y5KUHV5.min.js.map → chunk-MPOFY7NX.min.js.map} +1 -1
- package/dist/{chunk-3EVHRFPN.min.js → chunk-TPV3JAXV.min.js} +3 -3
- package/dist/index.min.js +9 -7
- package/dist/ipfs.min.js +4 -4
- package/dist/pubsub/pubsub-types.d.ts +4 -6
- package/dist/pubsub/pubsub-types.d.ts.map +1 -1
- package/dist/pubsub/ucan-example.d.ts +3 -0
- package/dist/pubsub/ucan-example.d.ts.map +1 -0
- package/dist/pubsub/ucan.d.ts +16 -0
- package/dist/pubsub/ucan.d.ts.map +1 -0
- package/dist/pubsub.min.js +4 -4
- package/dist/query.min.js +3 -3
- package/dist/retrieve.min.js +4 -4
- package/dist/thread/filters.d.ts +2 -0
- package/dist/thread/filters.d.ts.map +1 -1
- package/dist/thread/mapped.d.ts +3 -1
- package/dist/thread/mapped.d.ts.map +1 -1
- package/dist/thread.min.js +3 -1
- package/package.json +6 -2
- package/dist/chunk-6KONUEQB.min.js.map +0 -1
- /package/dist/{chunk-SFDNH2ID.min.js.map → chunk-AIITTHC6.min.js.map} +0 -0
- /package/dist/{chunk-GH2FXZ3U.min.js.map → chunk-C22YMCSL.min.js.map} +0 -0
- /package/dist/{chunk-XR2SGDQV.min.js.map → chunk-I73T6OVV.min.js.map} +0 -0
- /package/dist/{chunk-6XE4TT2P.min.js.map → chunk-IFB3AKYA.min.js.map} +0 -0
- /package/dist/{chunk-3EVHRFPN.min.js.map → chunk-TPV3JAXV.min.js.map} +0 -0
package/dist/applog.min.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
rollingMapper,
|
|
17
17
|
sortApplogsByTs,
|
|
18
18
|
wrapper_default
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MPOFY7NX.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-
|
|
510
|
+
//# sourceMappingURL=chunk-AIITTHC6.min.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-QPGEBDMJ.min.js";
|
|
4
4
|
import {
|
|
5
5
|
lastWriteWins
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AIITTHC6.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-
|
|
19
|
+
} from "./chunk-MPOFY7NX.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-
|
|
4122
|
+
//# sourceMappingURL=chunk-C22YMCSL.min.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
areCidsEqual,
|
|
4
4
|
decode,
|
|
5
5
|
g
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MPOFY7NX.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-
|
|
70
|
+
//# sourceMappingURL=chunk-I73T6OVV.min.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
createDebugName,
|
|
5
5
|
g,
|
|
6
6
|
observableArrayMap
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MPOFY7NX.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-
|
|
65
|
+
//# sourceMappingURL=chunk-IFB3AKYA.min.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
cyrb53hash,
|
|
3
3
|
ensureTsPvAndFinalizeApplog,
|
|
4
4
|
g
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MPOFY7NX.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-
|
|
40
|
+
//# sourceMappingURL=chunk-IIZCL4FQ.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":[]}
|
|
@@ -10579,7 +10579,7 @@ function joinThreads(threads) {
|
|
|
10579
10579
|
var { WARN: WARN6, LOG: LOG6, DEBUG: DEBUG6, VERBOSE: VERBOSE6, ERROR: ERROR6 } = g.setup(g.INFO);
|
|
10580
10580
|
var MappedThread = class _MappedThread extends Thread {
|
|
10581
10581
|
// mapped to unsubscribe function
|
|
10582
|
-
constructor(name2, parents, filters, _initialLogs, _eventMapper, _writeMapper = null) {
|
|
10582
|
+
constructor(name2, parents, filters, _initialLogs, _eventMapper, _writeMapper = null, _readOnly) {
|
|
10583
10583
|
super(
|
|
10584
10584
|
name2,
|
|
10585
10585
|
parents,
|
|
@@ -10591,6 +10591,7 @@ var MappedThread = class _MappedThread extends Thread {
|
|
|
10591
10591
|
this._initialLogs = _initialLogs;
|
|
10592
10592
|
this._eventMapper = _eventMapper;
|
|
10593
10593
|
this._writeMapper = _writeMapper;
|
|
10594
|
+
this._readOnly = _readOnly;
|
|
10594
10595
|
makeObservable(this, {
|
|
10595
10596
|
// @ts-expect-error bc it's private
|
|
10596
10597
|
onParentUpdate: action
|
|
@@ -10610,13 +10611,29 @@ var MappedThread = class _MappedThread extends Thread {
|
|
|
10610
10611
|
mapper
|
|
10611
10612
|
);
|
|
10612
10613
|
}
|
|
10614
|
+
static asReadOnly(parent) {
|
|
10615
|
+
if (parent.readOnly) return parent;
|
|
10616
|
+
return new _MappedThread(
|
|
10617
|
+
`readOnly(${parent.name})`,
|
|
10618
|
+
parent,
|
|
10619
|
+
parent.filters,
|
|
10620
|
+
// @ts-expect-error ? what's the proper way
|
|
10621
|
+
parent._applogs,
|
|
10622
|
+
null,
|
|
10623
|
+
null,
|
|
10624
|
+
true
|
|
10625
|
+
// readOnly
|
|
10626
|
+
);
|
|
10627
|
+
}
|
|
10613
10628
|
_parentSubscriptions = null;
|
|
10614
10629
|
insert(appLogsToInsert) {
|
|
10630
|
+
if (this.readOnly) throw ERROR6(`[MappedThread] insert() called on read-only thread:`, this.nameAndSizeUntracked);
|
|
10615
10631
|
const mapped = this._writeMapper ? this._writeMapper(appLogsToInsert) : appLogsToInsert;
|
|
10616
10632
|
if (this._writeMapper && !mapped) return;
|
|
10617
10633
|
return this.parents.forEach((parent) => parent.insert(mapped));
|
|
10618
10634
|
}
|
|
10619
10635
|
insertRaw(appLogsToInsert) {
|
|
10636
|
+
if (this.readOnly) throw ERROR6(`[MappedThread] insertRaw() called on read-only thread:`, this.nameAndSizeUntracked);
|
|
10620
10637
|
const mapped = this._writeMapper ? this._writeMapper(appLogsToInsert) : appLogsToInsert;
|
|
10621
10638
|
if (this._writeMapper && !mapped) return;
|
|
10622
10639
|
return this.parents.forEach((parent) => parent.insertRaw(mapped));
|
|
@@ -10699,7 +10716,7 @@ var MappedThread = class _MappedThread extends Thread {
|
|
|
10699
10716
|
this.notifySubscribers(mapResult);
|
|
10700
10717
|
}
|
|
10701
10718
|
get readOnly() {
|
|
10702
|
-
return false;
|
|
10719
|
+
return this._readOnly ?? false;
|
|
10703
10720
|
}
|
|
10704
10721
|
};
|
|
10705
10722
|
|
|
@@ -10840,6 +10857,7 @@ function assertOnlyCurrent(thread) {
|
|
|
10840
10857
|
if (!hasFilter(thread, "lastWriteWins") || !hasFilter(thread, "withoutDeleted")) throw ERROR7(`should be filtered thread, but is:`, thread.filters);
|
|
10841
10858
|
return thread;
|
|
10842
10859
|
}
|
|
10860
|
+
var asReadOnly = MappedThread.asReadOnly;
|
|
10843
10861
|
var simpleApplogMapper = function simpleApplogMapper2(thread, logMapper, opts = {}) {
|
|
10844
10862
|
const mappedTo = /* @__PURE__ */ new Map();
|
|
10845
10863
|
const mapLogs = (applogs, thread2) => {
|
|
@@ -11218,6 +11236,7 @@ export {
|
|
|
11218
11236
|
hasFilter,
|
|
11219
11237
|
assertRaw,
|
|
11220
11238
|
assertOnlyCurrent,
|
|
11239
|
+
asReadOnly,
|
|
11221
11240
|
simpleApplogMapper,
|
|
11222
11241
|
WriteableThread,
|
|
11223
11242
|
ThreadInMemory,
|
|
@@ -11253,4 +11272,4 @@ lodash-es/lodash.js:
|
|
|
11253
11272
|
@noble/hashes/utils.js:
|
|
11254
11273
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
11255
11274
|
*/
|
|
11256
|
-
//# sourceMappingURL=chunk-
|
|
11275
|
+
//# sourceMappingURL=chunk-MPOFY7NX.min.js.map
|