@welshman/app 0.0.16 → 0.0.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.
- package/build/src/commands.d.ts +29 -4
- package/build/src/context.cjs +0 -1
- package/build/src/context.cjs.map +1 -1
- package/build/src/context.d.ts +1 -1
- package/build/src/context.mjs +2 -3
- package/build/src/context.mjs.map +1 -1
- package/build/src/thunk.cjs +100 -47
- package/build/src/thunk.cjs.map +1 -1
- package/build/src/thunk.d.ts +41 -15
- package/build/src/thunk.mjs +98 -47
- package/build/src/thunk.mjs.map +1 -1
- package/package.json +6 -6
package/build/src/commands.d.ts
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
export declare const unfollow: (value: string) => Promise<{
|
|
3
|
+
event: import("@welshman/util").TrustedEvent;
|
|
4
|
+
request: import("./thunk").ThunkRequest;
|
|
5
|
+
controller: AbortController;
|
|
6
|
+
result: import("@welshman/lib").Deferred<import("./thunk").ThunkStatusByUrl>;
|
|
7
|
+
status: import("svelte/store").Writable<import("./thunk").ThunkStatusByUrl>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const follow: (tag: string[]) => Promise<{
|
|
10
|
+
event: import("@welshman/util").TrustedEvent;
|
|
11
|
+
request: import("./thunk").ThunkRequest;
|
|
12
|
+
controller: AbortController;
|
|
13
|
+
result: import("@welshman/lib").Deferred<import("./thunk").ThunkStatusByUrl>;
|
|
14
|
+
status: import("svelte/store").Writable<import("./thunk").ThunkStatusByUrl>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const unmute: (value: string) => Promise<{
|
|
17
|
+
event: import("@welshman/util").TrustedEvent;
|
|
18
|
+
request: import("./thunk").ThunkRequest;
|
|
19
|
+
controller: AbortController;
|
|
20
|
+
result: import("@welshman/lib").Deferred<import("./thunk").ThunkStatusByUrl>;
|
|
21
|
+
status: import("svelte/store").Writable<import("./thunk").ThunkStatusByUrl>;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const mute: (tag: string[]) => Promise<{
|
|
24
|
+
event: import("@welshman/util").TrustedEvent;
|
|
25
|
+
request: import("./thunk").ThunkRequest;
|
|
26
|
+
controller: AbortController;
|
|
27
|
+
result: import("@welshman/lib").Deferred<import("./thunk").ThunkStatusByUrl>;
|
|
28
|
+
status: import("svelte/store").Writable<import("./thunk").ThunkStatusByUrl>;
|
|
29
|
+
}>;
|
package/build/src/context.cjs
CHANGED
|
@@ -20,7 +20,6 @@ const getDefaultNetContext = (overrides = {}) => ({
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
isDeleted: (url, event) => core_1.repository.isDeleted(event),
|
|
23
|
-
isValid: (url, event) => (0, session_1.getSession)(event.pubkey) || ((0, util_1.isSignedEvent)(event) && (0, util_1.hasValidSignature)(event)),
|
|
24
23
|
optimizeSubscriptions: (subs) => {
|
|
25
24
|
const [withRelays, withoutRelays] = (0, lib_1.partition)(sub => sub.request.relays.length > 0, subs);
|
|
26
25
|
const filters = (0, util_1.unionFilters)(withoutRelays.flatMap(sub => sub.request.filters));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.cjs","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,uCAAgH;AAEhH,
|
|
1
|
+
{"version":3,"file":"context.cjs","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,uCAAgH;AAEhH,yCAAiD;AAEjD,qCAA0C;AAC1C,yCAAwD;AACxD,2CAAgC;AAEhC,6CAAsC;AAW/B,MAAM,oBAAoB,GAAG,CAAC,YAAiC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5E,GAAG,IAAA,0BAA4B,GAAE;IACjC,SAAS,EAAE,CAAC,KAAmB,EAAE,EAAE,WAAC,OAAA,MAAA,gBAAM,CAAC,GAAG,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C;IAC5E,MAAM,EAAE,IAAA,mBAAU,GAAE;IACpB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,GAAG;IAChB,cAAc,EAAE,IAAI;IACpB,GAAG,SAAS;CACb,CAAC,CAAA;AANW,QAAA,oBAAoB,wBAM/B"}
|
package/build/src/context.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const getDefaultNetContext: (overrides?: Partial<NetContext>) =>
|
|
|
16
16
|
signEvent: (event: StampedEvent) => Promise<any> | undefined;
|
|
17
17
|
getExecutor: (relays: string[]) => import("@welshman/net").Executor;
|
|
18
18
|
isDeleted: (url: string, event: TrustedEvent) => boolean;
|
|
19
|
-
isValid: (
|
|
19
|
+
isValid: (url: string, event: TrustedEvent) => boolean;
|
|
20
20
|
matchFilters: (url: string, filters: import("@welshman/util").Filter[], event: TrustedEvent) => boolean;
|
|
21
21
|
optimizeSubscriptions: (subs: Subscription[]) => RelaysAndFilters[];
|
|
22
22
|
};
|
package/build/src/context.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { partition } from "@welshman/lib";
|
|
2
2
|
import { defaultOptimizeSubscriptions, getDefaultNetContext as originalGetDefaultNetContext } from "@welshman/net";
|
|
3
|
-
import { WRAP, unionFilters
|
|
3
|
+
import { WRAP, unionFilters } from "@welshman/util";
|
|
4
4
|
import { tracker, repository } from "./core.mjs";
|
|
5
5
|
import { makeRouter, getFilterSelections } from "./router.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { signer } from "./session.mjs";
|
|
7
7
|
import { loadProfile } from "./profiles.mjs";
|
|
8
8
|
export const getDefaultNetContext = (overrides = {}) => ({
|
|
9
9
|
...originalGetDefaultNetContext(),
|
|
@@ -17,7 +17,6 @@ export const getDefaultNetContext = (overrides = {}) => ({
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
isDeleted: (url, event) => repository.isDeleted(event),
|
|
20
|
-
isValid: (url, event) => getSession(event.pubkey) || (isSignedEvent(event) && hasValidSignature(event)),
|
|
21
20
|
optimizeSubscriptions: (subs) => {
|
|
22
21
|
const [withRelays, withoutRelays] = partition(sub => sub.request.relays.length > 0, subs);
|
|
23
22
|
const filters = unionFilters(withoutRelays.flatMap(sub => sub.request.filters));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.mjs","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"OAAO,EAAC,SAAS,EAAC,MAAM,eAAe;OAChC,EAAC,4BAA4B,EAAE,oBAAoB,IAAI,4BAA4B,EAAC,MAAM,eAAe;OAEzG,EAAC,IAAI,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"context.mjs","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"OAAO,EAAC,SAAS,EAAC,MAAM,eAAe;OAChC,EAAC,4BAA4B,EAAE,oBAAoB,IAAI,4BAA4B,EAAC,MAAM,eAAe;OAEzG,EAAC,IAAI,EAAE,YAAY,EAAC,MAAM,gBAAgB;OAE1C,EAAC,OAAO,EAAE,UAAU,EAAC;OACrB,EAAC,UAAU,EAAE,mBAAmB,EAAC;OACjC,EAAC,MAAM,EAAC;OAER,EAAC,WAAW,EAAC;AAWpB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAiC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5E,GAAG,4BAA4B,EAAE;IACjC,SAAS,EAAE,CAAC,KAAmB,EAAE,EAAE,WAAC,OAAA,MAAA,MAAM,CAAC,GAAG,EAAE,0CAAE,IAAI,CAAC,KAAK,CAAC,CAAA,EAAA;IAC7D,OAAO,EAAE,CAAC,GAAW,EAAE,KAAmB,EAAE,EAAE;QAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;QAC5B,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAEzB,qDAAqD;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;YACvB,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;SAC1B;IACH,CAAC;IACD,SAAS,EAAE,CAAC,GAAW,EAAE,KAAmB,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;IAC5E,qBAAqB,EAAE,CAAC,IAAoB,EAAE,EAAE;QAC9C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,CAAA;QACzF,MAAM,OAAO,GAAG,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;QAC/E,MAAM,UAAU,GAAuB,4BAA4B,CAAC,UAAU,CAAC,CAAA;QAE/E,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACtB,KAAK,MAAM,SAAS,IAAK,mBAAmB,CAAC,OAAO,CAAC,EAAE;gBACrD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;aAC3B;SACF;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;IACD,GAAG,SAAS;CACb,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAiC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5E,MAAM,EAAE,UAAU,EAAE;IACpB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,GAAG;IAChB,cAAc,EAAE,IAAI;IACpB,GAAG,SAAS;CACb,CAAC,CAAA"}
|
package/build/src/thunk.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.publishThunk = exports.
|
|
3
|
+
exports.thunkWorker = exports.publishThunk = exports.mergeThunks = exports.makeThunk = exports.prepEvent = void 0;
|
|
4
4
|
const store_1 = require("svelte/store");
|
|
5
5
|
const lib_1 = require("@welshman/lib");
|
|
6
6
|
const signer_1 = require("@welshman/signer");
|
|
@@ -8,47 +8,7 @@ const util_1 = require("@welshman/util");
|
|
|
8
8
|
const net_1 = require("@welshman/net");
|
|
9
9
|
const core_1 = require("./core.cjs");
|
|
10
10
|
const session_1 = require("./session.cjs");
|
|
11
|
-
|
|
12
|
-
exports.thunkWorker = new lib_1.Worker();
|
|
13
|
-
exports.thunkWorker.addGlobalHandler(async ({ event, relays, resolve }) => {
|
|
14
|
-
// If we were given a wrapped event, make sure to publish the wrapper, not the rumor
|
|
15
|
-
if ((0, util_1.isUnwrappedEvent)(event)) {
|
|
16
|
-
event = event.wrap;
|
|
17
|
-
}
|
|
18
|
-
// If the event was already signed, leave it alone. Otherwise, sign it now. This is to
|
|
19
|
-
// decrease apparent latency in the UI that results from waiting for remote signers
|
|
20
|
-
if (!(0, util_1.isSignedEvent)(event)) {
|
|
21
|
-
const signer = (0, session_1.getSigner)((0, session_1.getSession)(event.pubkey));
|
|
22
|
-
if (!signer) {
|
|
23
|
-
return console.warn(`No signer found for ${event.pubkey}`);
|
|
24
|
-
}
|
|
25
|
-
event = await signer.sign(event);
|
|
26
|
-
}
|
|
27
|
-
// We're guaranteed to have a signed event at this point
|
|
28
|
-
const signedEvent = event;
|
|
29
|
-
const { id, sig } = signedEvent;
|
|
30
|
-
// Send it off
|
|
31
|
-
const pub = (0, net_1.publish)({ event: signedEvent, relays });
|
|
32
|
-
// Copy the signature over since we had deferred it
|
|
33
|
-
const savedEvent = core_1.repository.getEvent(id);
|
|
34
|
-
// The event may already be replaced or deleted
|
|
35
|
-
if (savedEvent) {
|
|
36
|
-
savedEvent.sig = sig;
|
|
37
|
-
}
|
|
38
|
-
// Track publish success
|
|
39
|
-
const statusByUrl = {};
|
|
40
|
-
pub.emitter.on("*", (status, url, message) => {
|
|
41
|
-
Object.assign(statusByUrl, { [url]: { id, url, status, message } });
|
|
42
|
-
exports.publishStatusData.update((0, lib_1.assoc)(id, statusByUrl));
|
|
43
|
-
if (status === net_1.PublishStatus.Success) {
|
|
44
|
-
core_1.tracker.track(id, url);
|
|
45
|
-
}
|
|
46
|
-
if (Object.values(statusByUrl).filter(s => s.status !== net_1.PublishStatus.Pending).length ===
|
|
47
|
-
relays.length) {
|
|
48
|
-
resolve(statusByUrl);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
11
|
+
const { Pending, Success, Failure, Timeout, Aborted } = net_1.PublishStatus;
|
|
52
12
|
const prepEvent = (event) => {
|
|
53
13
|
if (!(0, util_1.isStampedEvent)(event)) {
|
|
54
14
|
event = (0, signer_1.stamp)(event);
|
|
@@ -62,10 +22,103 @@ const prepEvent = (event) => {
|
|
|
62
22
|
return event;
|
|
63
23
|
};
|
|
64
24
|
exports.prepEvent = prepEvent;
|
|
65
|
-
const
|
|
66
|
-
const event = (0, exports.prepEvent)(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
25
|
+
const makeThunk = (request) => {
|
|
26
|
+
const event = (0, exports.prepEvent)(request.event);
|
|
27
|
+
const controller = new AbortController();
|
|
28
|
+
const result = (0, lib_1.defer)();
|
|
29
|
+
const status = (0, store_1.writable)({});
|
|
30
|
+
return { event, request, controller, result, status };
|
|
31
|
+
};
|
|
32
|
+
exports.makeThunk = makeThunk;
|
|
33
|
+
const mergeThunks = (thunks) => {
|
|
34
|
+
const controller = new AbortController();
|
|
35
|
+
controller.signal.addEventListener('abort', () => {
|
|
36
|
+
for (const thunk of thunks) {
|
|
37
|
+
thunk.controller.abort();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
thunks,
|
|
42
|
+
controller,
|
|
43
|
+
result: Promise.all(thunks.map(thunk => thunk.result)),
|
|
44
|
+
status: (0, store_1.derived)(thunks.map(thunk => thunk.status), statuses => {
|
|
45
|
+
const mergedStatus = {};
|
|
46
|
+
for (const url of (0, lib_1.uniq)(statuses.flatMap(s => Object.keys(s)))) {
|
|
47
|
+
const urlStatuses = statuses.map(s => s[url]);
|
|
48
|
+
const thunkStatus = [Aborted, Failure, Timeout, Pending, Success]
|
|
49
|
+
.map(status => urlStatuses.find(s => (s === null || s === void 0 ? void 0 : s.status) === status))
|
|
50
|
+
.find(lib_1.identity);
|
|
51
|
+
if (thunkStatus) {
|
|
52
|
+
mergedStatus[url] = thunkStatus;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return mergedStatus;
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.mergeThunks = mergeThunks;
|
|
60
|
+
const publishThunk = (request) => {
|
|
61
|
+
const thunk = (0, exports.makeThunk)(request);
|
|
62
|
+
exports.thunkWorker.push(thunk);
|
|
63
|
+
core_1.repository.publish(thunk.event);
|
|
64
|
+
thunk.controller.signal.addEventListener('abort', () => {
|
|
65
|
+
core_1.repository.removeEvent(thunk.event.id);
|
|
66
|
+
});
|
|
67
|
+
return thunk;
|
|
68
|
+
};
|
|
70
69
|
exports.publishThunk = publishThunk;
|
|
70
|
+
exports.thunkWorker = new lib_1.Worker();
|
|
71
|
+
exports.thunkWorker.addGlobalHandler((thunk) => {
|
|
72
|
+
let event = thunk.event;
|
|
73
|
+
// Handle abort immediately if possible
|
|
74
|
+
if (thunk.controller.signal.aborted)
|
|
75
|
+
return;
|
|
76
|
+
// If we were given a wrapped event, make sure to publish the wrapper, not the rumor
|
|
77
|
+
if ((0, util_1.isUnwrappedEvent)(event)) {
|
|
78
|
+
event = event.wrap;
|
|
79
|
+
}
|
|
80
|
+
// Avoid making this function async so multiple publishes can run concurrently
|
|
81
|
+
Promise.resolve().then(async () => {
|
|
82
|
+
// If the event was already signed, leave it alone. Otherwise, sign it now. This is to
|
|
83
|
+
// decrease apparent latency in the UI that results from waiting for remote signers
|
|
84
|
+
if (!(0, util_1.isSignedEvent)(event)) {
|
|
85
|
+
const signer = (0, session_1.getSigner)((0, session_1.getSession)(event.pubkey));
|
|
86
|
+
if (!signer) {
|
|
87
|
+
return console.warn(`No signer found for ${event.pubkey}`);
|
|
88
|
+
}
|
|
89
|
+
event = await signer.sign(event);
|
|
90
|
+
}
|
|
91
|
+
// We're guaranteed to have a signed event at this point
|
|
92
|
+
const signedEvent = event;
|
|
93
|
+
// Wait if the thunk is to be delayed
|
|
94
|
+
if (thunk.request.delay) {
|
|
95
|
+
await (0, lib_1.sleep)(thunk.request.delay);
|
|
96
|
+
}
|
|
97
|
+
// Skip publishing if aborted
|
|
98
|
+
if (thunk.controller.signal.aborted) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// Send it off
|
|
102
|
+
const pub = (0, net_1.publish)({ event: signedEvent, relays: thunk.request.relays });
|
|
103
|
+
// Copy the signature over since we had deferred it
|
|
104
|
+
const savedEvent = core_1.repository.getEvent(signedEvent.id);
|
|
105
|
+
// The event may already be replaced or deleted
|
|
106
|
+
if (savedEvent) {
|
|
107
|
+
savedEvent.sig = signedEvent.sig;
|
|
108
|
+
}
|
|
109
|
+
const completed = new Set();
|
|
110
|
+
pub.emitter.on("*", async (status, url, message = "") => {
|
|
111
|
+
thunk.status.update((0, lib_1.assoc)(url, { status, message }));
|
|
112
|
+
if (status !== net_1.PublishStatus.Pending) {
|
|
113
|
+
completed.add(url);
|
|
114
|
+
}
|
|
115
|
+
if (status === net_1.PublishStatus.Success) {
|
|
116
|
+
core_1.tracker.track(signedEvent.id, url);
|
|
117
|
+
}
|
|
118
|
+
if (completed.size === thunk.request.relays.length) {
|
|
119
|
+
thunk.result.resolve((0, store_1.get)(thunk.status));
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
71
124
|
//# sourceMappingURL=thunk.cjs.map
|
package/build/src/thunk.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thunk.cjs","sourceRoot":"","sources":["../../src/thunk.ts"],"names":[],"mappings":";;;AAAA,
|
|
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WAAW,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;aACnC;YAED,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;gBAClD,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAA,WAAG,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;aACxC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/build/src/thunk.d.ts
CHANGED
|
@@ -1,26 +1,52 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
|
+
import type { Writable, Readable } from 'svelte/store';
|
|
2
3
|
import { Worker } from '@welshman/lib';
|
|
4
|
+
import type { Deferred } from '@welshman/lib';
|
|
3
5
|
import type { TrustedEvent, EventTemplate, StampedEvent, OwnedEvent } from '@welshman/util';
|
|
4
6
|
import { PublishStatus } from "@welshman/net";
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
export type ThunkEvent = EventTemplate | StampedEvent | OwnedEvent | TrustedEvent;
|
|
8
|
+
export type ThunkRequest = {
|
|
9
|
+
event: ThunkEvent;
|
|
10
|
+
relays: string[];
|
|
11
|
+
delay?: number;
|
|
12
|
+
};
|
|
13
|
+
export type ThunkStatus = {
|
|
8
14
|
message: string;
|
|
9
15
|
status: PublishStatus;
|
|
10
16
|
};
|
|
11
|
-
export type
|
|
12
|
-
export type
|
|
13
|
-
export declare const publishStatusData: import("svelte/store").Writable<PublishStatusDataByUrlById>;
|
|
14
|
-
export type ThunkWithResolve = {
|
|
17
|
+
export type ThunkStatusByUrl = Record<string, ThunkStatus>;
|
|
18
|
+
export type Thunk = {
|
|
15
19
|
event: TrustedEvent;
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
request: ThunkRequest;
|
|
21
|
+
controller: AbortController;
|
|
22
|
+
result: Deferred<ThunkStatusByUrl>;
|
|
23
|
+
status: Writable<ThunkStatusByUrl>;
|
|
18
24
|
};
|
|
19
|
-
export declare const thunkWorker: Worker<ThunkWithResolve>;
|
|
20
|
-
export type ThunkEvent = EventTemplate | StampedEvent | OwnedEvent | TrustedEvent;
|
|
21
25
|
export declare const prepEvent: (event: ThunkEvent) => TrustedEvent;
|
|
22
|
-
export
|
|
23
|
-
event:
|
|
24
|
-
|
|
26
|
+
export declare const makeThunk: (request: ThunkRequest) => {
|
|
27
|
+
event: TrustedEvent;
|
|
28
|
+
request: ThunkRequest;
|
|
29
|
+
controller: AbortController;
|
|
30
|
+
result: Deferred<ThunkStatusByUrl>;
|
|
31
|
+
status: Writable<ThunkStatusByUrl>;
|
|
32
|
+
};
|
|
33
|
+
export type MergedThunk = {
|
|
34
|
+
thunks: Thunk[];
|
|
35
|
+
controller: AbortController;
|
|
36
|
+
result: Promise<ThunkStatusByUrl[]>;
|
|
37
|
+
status: Readable<ThunkStatusByUrl>;
|
|
38
|
+
};
|
|
39
|
+
export declare const mergeThunks: (thunks: Thunk[]) => {
|
|
40
|
+
thunks: Thunk[];
|
|
41
|
+
controller: AbortController;
|
|
42
|
+
result: Promise<ThunkStatusByUrl[]>;
|
|
43
|
+
status: Readable<ThunkStatusByUrl>;
|
|
44
|
+
};
|
|
45
|
+
export declare const publishThunk: (request: ThunkRequest) => {
|
|
46
|
+
event: TrustedEvent;
|
|
47
|
+
request: ThunkRequest;
|
|
48
|
+
controller: AbortController;
|
|
49
|
+
result: Deferred<ThunkStatusByUrl>;
|
|
50
|
+
status: Writable<ThunkStatusByUrl>;
|
|
25
51
|
};
|
|
26
|
-
export declare const
|
|
52
|
+
export declare const thunkWorker: Worker<Thunk>;
|
package/build/src/thunk.mjs
CHANGED
|
@@ -1,51 +1,11 @@
|
|
|
1
|
-
import { writable, get } from 'svelte/store';
|
|
2
|
-
import { Worker, assoc } from '@welshman/lib';
|
|
1
|
+
import { writable, derived, get } from 'svelte/store';
|
|
2
|
+
import { Worker, identity, uniq, defer, sleep, assoc } from '@welshman/lib';
|
|
3
3
|
import { stamp, own, hash } from "@welshman/signer";
|
|
4
4
|
import { isStampedEvent, isOwnedEvent, isHashedEvent, isUnwrappedEvent, isSignedEvent } from '@welshman/util';
|
|
5
5
|
import { publish, PublishStatus } from "@welshman/net";
|
|
6
6
|
import { repository, tracker } from "./core.mjs";
|
|
7
7
|
import { pubkey, getSession, getSigner } from "./session.mjs";
|
|
8
|
-
|
|
9
|
-
export const thunkWorker = new Worker();
|
|
10
|
-
thunkWorker.addGlobalHandler(async ({ event, relays, resolve }) => {
|
|
11
|
-
// If we were given a wrapped event, make sure to publish the wrapper, not the rumor
|
|
12
|
-
if (isUnwrappedEvent(event)) {
|
|
13
|
-
event = event.wrap;
|
|
14
|
-
}
|
|
15
|
-
// If the event was already signed, leave it alone. Otherwise, sign it now. This is to
|
|
16
|
-
// decrease apparent latency in the UI that results from waiting for remote signers
|
|
17
|
-
if (!isSignedEvent(event)) {
|
|
18
|
-
const signer = getSigner(getSession(event.pubkey));
|
|
19
|
-
if (!signer) {
|
|
20
|
-
return console.warn(`No signer found for ${event.pubkey}`);
|
|
21
|
-
}
|
|
22
|
-
event = await signer.sign(event);
|
|
23
|
-
}
|
|
24
|
-
// We're guaranteed to have a signed event at this point
|
|
25
|
-
const signedEvent = event;
|
|
26
|
-
const { id, sig } = signedEvent;
|
|
27
|
-
// Send it off
|
|
28
|
-
const pub = publish({ event: signedEvent, relays });
|
|
29
|
-
// Copy the signature over since we had deferred it
|
|
30
|
-
const savedEvent = repository.getEvent(id);
|
|
31
|
-
// The event may already be replaced or deleted
|
|
32
|
-
if (savedEvent) {
|
|
33
|
-
savedEvent.sig = sig;
|
|
34
|
-
}
|
|
35
|
-
// Track publish success
|
|
36
|
-
const statusByUrl = {};
|
|
37
|
-
pub.emitter.on("*", (status, url, message) => {
|
|
38
|
-
Object.assign(statusByUrl, { [url]: { id, url, status, message } });
|
|
39
|
-
publishStatusData.update(assoc(id, statusByUrl));
|
|
40
|
-
if (status === PublishStatus.Success) {
|
|
41
|
-
tracker.track(id, url);
|
|
42
|
-
}
|
|
43
|
-
if (Object.values(statusByUrl).filter(s => s.status !== PublishStatus.Pending).length ===
|
|
44
|
-
relays.length) {
|
|
45
|
-
resolve(statusByUrl);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
8
|
+
const { Pending, Success, Failure, Timeout, Aborted } = PublishStatus;
|
|
49
9
|
export const prepEvent = (event) => {
|
|
50
10
|
if (!isStampedEvent(event)) {
|
|
51
11
|
event = stamp(event);
|
|
@@ -58,9 +18,100 @@ export const prepEvent = (event) => {
|
|
|
58
18
|
}
|
|
59
19
|
return event;
|
|
60
20
|
};
|
|
61
|
-
export const
|
|
62
|
-
const event = prepEvent(
|
|
63
|
-
|
|
64
|
-
|
|
21
|
+
export const makeThunk = (request) => {
|
|
22
|
+
const event = prepEvent(request.event);
|
|
23
|
+
const controller = new AbortController();
|
|
24
|
+
const result = defer();
|
|
25
|
+
const status = writable({});
|
|
26
|
+
return { event, request, controller, result, status };
|
|
27
|
+
};
|
|
28
|
+
export const mergeThunks = (thunks) => {
|
|
29
|
+
const controller = new AbortController();
|
|
30
|
+
controller.signal.addEventListener('abort', () => {
|
|
31
|
+
for (const thunk of thunks) {
|
|
32
|
+
thunk.controller.abort();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
thunks,
|
|
37
|
+
controller,
|
|
38
|
+
result: Promise.all(thunks.map(thunk => thunk.result)),
|
|
39
|
+
status: derived(thunks.map(thunk => thunk.status), statuses => {
|
|
40
|
+
const mergedStatus = {};
|
|
41
|
+
for (const url of uniq(statuses.flatMap(s => Object.keys(s)))) {
|
|
42
|
+
const urlStatuses = statuses.map(s => s[url]);
|
|
43
|
+
const thunkStatus = [Aborted, Failure, Timeout, Pending, Success]
|
|
44
|
+
.map(status => urlStatuses.find(s => (s === null || s === void 0 ? void 0 : s.status) === status))
|
|
45
|
+
.find(identity);
|
|
46
|
+
if (thunkStatus) {
|
|
47
|
+
mergedStatus[url] = thunkStatus;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return mergedStatus;
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export const publishThunk = (request) => {
|
|
55
|
+
const thunk = makeThunk(request);
|
|
56
|
+
thunkWorker.push(thunk);
|
|
57
|
+
repository.publish(thunk.event);
|
|
58
|
+
thunk.controller.signal.addEventListener('abort', () => {
|
|
59
|
+
repository.removeEvent(thunk.event.id);
|
|
60
|
+
});
|
|
61
|
+
return thunk;
|
|
62
|
+
};
|
|
63
|
+
export const thunkWorker = new Worker();
|
|
64
|
+
thunkWorker.addGlobalHandler((thunk) => {
|
|
65
|
+
let event = thunk.event;
|
|
66
|
+
// Handle abort immediately if possible
|
|
67
|
+
if (thunk.controller.signal.aborted)
|
|
68
|
+
return;
|
|
69
|
+
// If we were given a wrapped event, make sure to publish the wrapper, not the rumor
|
|
70
|
+
if (isUnwrappedEvent(event)) {
|
|
71
|
+
event = event.wrap;
|
|
72
|
+
}
|
|
73
|
+
// Avoid making this function async so multiple publishes can run concurrently
|
|
74
|
+
Promise.resolve().then(async () => {
|
|
75
|
+
// If the event was already signed, leave it alone. Otherwise, sign it now. This is to
|
|
76
|
+
// decrease apparent latency in the UI that results from waiting for remote signers
|
|
77
|
+
if (!isSignedEvent(event)) {
|
|
78
|
+
const signer = getSigner(getSession(event.pubkey));
|
|
79
|
+
if (!signer) {
|
|
80
|
+
return console.warn(`No signer found for ${event.pubkey}`);
|
|
81
|
+
}
|
|
82
|
+
event = await signer.sign(event);
|
|
83
|
+
}
|
|
84
|
+
// We're guaranteed to have a signed event at this point
|
|
85
|
+
const signedEvent = event;
|
|
86
|
+
// Wait if the thunk is to be delayed
|
|
87
|
+
if (thunk.request.delay) {
|
|
88
|
+
await sleep(thunk.request.delay);
|
|
89
|
+
}
|
|
90
|
+
// Skip publishing if aborted
|
|
91
|
+
if (thunk.controller.signal.aborted) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// Send it off
|
|
95
|
+
const pub = publish({ event: signedEvent, relays: thunk.request.relays });
|
|
96
|
+
// Copy the signature over since we had deferred it
|
|
97
|
+
const savedEvent = repository.getEvent(signedEvent.id);
|
|
98
|
+
// The event may already be replaced or deleted
|
|
99
|
+
if (savedEvent) {
|
|
100
|
+
savedEvent.sig = signedEvent.sig;
|
|
101
|
+
}
|
|
102
|
+
const completed = new Set();
|
|
103
|
+
pub.emitter.on("*", async (status, url, message = "") => {
|
|
104
|
+
thunk.status.update(assoc(url, { status, message }));
|
|
105
|
+
if (status !== PublishStatus.Pending) {
|
|
106
|
+
completed.add(url);
|
|
107
|
+
}
|
|
108
|
+
if (status === PublishStatus.Success) {
|
|
109
|
+
tracker.track(signedEvent.id, url);
|
|
110
|
+
}
|
|
111
|
+
if (completed.size === thunk.request.relays.length) {
|
|
112
|
+
thunk.result.resolve(get(thunk.status));
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
65
116
|
});
|
|
66
117
|
//# sourceMappingURL=thunk.mjs.map
|
package/build/src/thunk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thunk.mjs","sourceRoot":"","sources":["../../src/thunk.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,GAAG,EAAC,MAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"thunk.mjs","sourceRoot":"","sources":["../../src/thunk.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAC,MAAM,cAAc;OAE5C,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,eAAe;OAElE,EAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,kBAAkB;OAE1C,EAAC,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,gBA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CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@welshman/app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"author": "hodlbod",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A collection of svelte stores for use in building nostr client applications.",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"typescript": "~5.1.6"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@welshman/lib": "~0.0.
|
|
34
|
+
"@welshman/lib": "~0.0.23",
|
|
35
35
|
"@welshman/feeds": "~0.0.20",
|
|
36
36
|
"@welshman/dvm": "~0.0.10",
|
|
37
|
-
"@welshman/net": "~0.0.
|
|
38
|
-
"@welshman/signer": "~0.0.
|
|
39
|
-
"@welshman/store": "~0.0.
|
|
40
|
-
"@welshman/util": "~0.0.
|
|
37
|
+
"@welshman/net": "~0.0.29",
|
|
38
|
+
"@welshman/signer": "~0.0.9",
|
|
39
|
+
"@welshman/store": "~0.0.11",
|
|
40
|
+
"@welshman/util": "~0.0.40",
|
|
41
41
|
"fuse.js": "^7.0.0",
|
|
42
42
|
"idb": "^8.0.0",
|
|
43
43
|
"svelte": "^4.2.18",
|