applesauce-actions 6.1.0 → 6.2.0
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/action-runner.d.ts +1 -1
- package/dist/action-runner.js +18 -18
- package/package.json +4 -4
package/dist/action-runner.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class ActionRunner {
|
|
|
43
43
|
publish(event: NostrEvent | NostrEvent[], relays?: string[]): Promise<void>;
|
|
44
44
|
/** Run an action and publish events using the publish method */
|
|
45
45
|
run<Args extends Array<any>>(builder: ActionBuilder<Args>, ...args: Args): Promise<void>;
|
|
46
|
-
/** Run an action without
|
|
46
|
+
/** Run an action without waiting for publishing */
|
|
47
47
|
exec<Args extends Array<any>>(builder: ActionBuilder<Args>, ...args: Args): Observable<NostrEvent>;
|
|
48
48
|
}
|
|
49
49
|
/** @deprecated Use ActionRunner instead */
|
package/dist/action-runner.js
CHANGED
|
@@ -38,23 +38,23 @@ export class ActionRunner {
|
|
|
38
38
|
await Promise.all(event.map((e) => this.publish(e, relays)));
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
// Save the event to the store first so subscribers (and the UI) update immediately, before the
|
|
42
|
+
// potentially slow relay publish resolves. The event is already signed and valid at this point, so
|
|
43
|
+
// there is no reason to gate the local store update on the network round-trip.
|
|
44
|
+
if (this.saveToStore)
|
|
45
|
+
this.events.add(event);
|
|
46
|
+
let result;
|
|
47
|
+
if ("publish" in this.publishMethod)
|
|
48
|
+
result = this.publishMethod.publish(event, relays);
|
|
49
|
+
else if (typeof this.publishMethod === "function")
|
|
50
|
+
result = this.publishMethod(event, relays);
|
|
51
|
+
else
|
|
52
|
+
throw new Error("Invalid publish method");
|
|
53
|
+
if (isObservable(result)) {
|
|
54
|
+
await lastValueFrom(result);
|
|
55
|
+
}
|
|
56
|
+
else if (result instanceof Promise) {
|
|
57
|
+
await result;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
/** Run an action and publish events using the publish method */
|
|
@@ -63,7 +63,7 @@ export class ActionRunner {
|
|
|
63
63
|
const context = await this.getContext();
|
|
64
64
|
await builder(...args)(context);
|
|
65
65
|
}
|
|
66
|
-
/** Run an action without
|
|
66
|
+
/** Run an action without waiting for publishing */
|
|
67
67
|
exec(builder, ...args) {
|
|
68
68
|
return from(this.getContext()).pipe(
|
|
69
69
|
// Run the action
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-actions",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "A package for performing common nostr actions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"applesauce-common": "^6.
|
|
36
|
-
"applesauce-core": "^6.
|
|
35
|
+
"applesauce-common": "^6.2.0",
|
|
36
|
+
"applesauce-core": "^6.2.0",
|
|
37
37
|
"rxjs": "^7.8.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@hirez_io/observer-spy": "^2.2.0",
|
|
41
41
|
"@types/debug": "^4.1.12",
|
|
42
|
-
"applesauce-signers": "^6.
|
|
42
|
+
"applesauce-signers": "^6.2.0",
|
|
43
43
|
"nanoid": "^5.1.5",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
45
|
"typescript": "^5.8.3",
|