applesauce-actions 3.0.0 → 4.0.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.
@@ -0,0 +1,2 @@
1
+ import { Action } from "../action-hub.js";
2
+ export declare function UpdateAppData<T>(identifier: string, data: T): Action;
@@ -0,0 +1,13 @@
1
+ import { APP_DATA_KIND, getAppDataEncryption } from "applesauce-core/helpers/app-data";
2
+ import { AppDataBlueprint } from "applesauce-factory/blueprints/app-data";
3
+ import { AppData } from "applesauce-factory/operations";
4
+ export function UpdateAppData(identifier, data) {
5
+ return async function* ({ self, factory, events }) {
6
+ const event = events.getReplaceable(APP_DATA_KIND, self, identifier);
7
+ const encryption = !!event && getAppDataEncryption(event);
8
+ const draft = event
9
+ ? await factory.modify(event, AppData.setContent(data, encryption))
10
+ : await factory.create(AppDataBlueprint, identifier, data, encryption);
11
+ yield await factory.sign(draft);
12
+ };
13
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./app-data.js";
1
2
  export * from "./blocked-relays.js";
2
3
  export * from "./blossom.js";
3
4
  export * from "./bookmarks.js";
@@ -1,3 +1,4 @@
1
+ export * from "./app-data.js";
1
2
  export * from "./blocked-relays.js";
2
3
  export * from "./blossom.js";
3
4
  export * from "./bookmarks.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-actions",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "A package for performing common nostr actions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,24 +32,26 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "applesauce-core": "^3.0.0",
36
- "applesauce-factory": "^3.0.0",
37
- "nostr-tools": "^2.13",
35
+ "applesauce-core": "^4.0.0",
36
+ "applesauce-factory": "^4.0.0",
37
+ "nostr-tools": "~2.17",
38
38
  "rxjs": "^7.8.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@hirez_io/observer-spy": "^2.2.0",
42
42
  "@types/debug": "^4.1.12",
43
- "applesauce-signers": "^3.0.0",
43
+ "applesauce-signers": "^4.0.0",
44
44
  "nanoid": "^5.1.5",
45
+ "rimraf": "^6.0.1",
45
46
  "typescript": "^5.8.3",
46
- "vitest": "^3.2.3"
47
+ "vitest": "^3.2.4"
47
48
  },
48
49
  "funding": {
49
50
  "type": "lightning",
50
51
  "url": "lightning:nostrudel@geyser.fund"
51
52
  },
52
53
  "scripts": {
54
+ "prebuild": "rimraf dist",
53
55
  "build": "tsc",
54
56
  "watch:build": "tsc --watch > /dev/null",
55
57
  "test": "vitest run --passWithNoTests",