@nostrify/nostrify 0.46.8 → 0.46.9

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 (44) hide show
  1. package/.turbo/turbo-build.log +124 -28
  2. package/.turbo/turbo-test.log +91 -123
  3. package/CHANGELOG.md +8 -0
  4. package/NIP05.ts +6 -6
  5. package/NSchema.ts +71 -30
  6. package/dist/NSchema.d.ts.map +1 -1
  7. package/dist/tsconfig.tsbuildinfo +1 -1
  8. package/package.json +3 -3
  9. package/tsconfig.json +1 -2
  10. package/dist/BunkerURI.js +0 -48
  11. package/dist/NBrowserSigner.js +0 -82
  12. package/dist/NCache.js +0 -39
  13. package/dist/NConnectSigner.js +0 -132
  14. package/dist/NIP05.js +0 -35
  15. package/dist/NIP50.js +0 -21
  16. package/dist/NIP98.js +0 -74
  17. package/dist/NKinds.js +0 -25
  18. package/dist/NPool.js +0 -154
  19. package/dist/NRelay1.js +0 -318
  20. package/dist/NSchema.js +0 -187
  21. package/dist/NSecSigner.js +0 -38
  22. package/dist/NSet.js +0 -143
  23. package/dist/RelayError.js +0 -20
  24. package/dist/ln/LNURL.js +0 -101
  25. package/dist/ln/mod.js +0 -4
  26. package/dist/ln/mod.js.map +0 -7
  27. package/dist/ln/types/LNURLCallback.js +0 -0
  28. package/dist/ln/types/LNURLDetails.js +0 -0
  29. package/dist/mod.js +0 -30
  30. package/dist/mod.js.map +0 -7
  31. package/dist/test/ErrorRelay.js +0 -23
  32. package/dist/test/MockRelay.js +0 -61
  33. package/dist/test/TestRelayServer.js +0 -149
  34. package/dist/test/mod.js +0 -24
  35. package/dist/test/mod.js.map +0 -7
  36. package/dist/uploaders/BlossomUploader.js +0 -70
  37. package/dist/uploaders/NostrBuildUploader.js +0 -65
  38. package/dist/uploaders/mod.js +0 -6
  39. package/dist/uploaders/mod.js.map +0 -7
  40. package/dist/utils/CircularSet.js +0 -29
  41. package/dist/utils/Machina.js +0 -38
  42. package/dist/utils/N64.js +0 -17
  43. package/dist/utils/mod.js +0 -6
  44. package/dist/utils/mod.js.map +0 -7
@@ -1,28 +1,124 @@
1
-
2
- > @nostrify/nostrify@0.46.7 build /home/sid/repos/nostrify/packages/nostrify
3
- > tsc -p tsconfig.json && node ../../esbuild.config.js --package ./
4
-
5
-
6
- dist/NRelay1.js 8.9kb
7
- dist/NSchema.js 5.6kb
8
- dist/NPool.js 5.0kb
9
- dist/test/TestRelayServer.js 4.4kb
10
- dist/NSet.js 4.1kb
11
- dist/NConnectSigner.js 3.9kb
12
- dist/ln/LNURL.js 3.3kb
13
- dist/NBrowserSigner.js 2.6kb
14
- dist/NIP98.js 2.4kb
15
- dist/uploaders/NostrBuildUploader.js 1.9kb
16
- dist/uploaders/BlossomUploader.js 1.8kb
17
- dist/test/MockRelay.js 1.4kb
18
- dist/BunkerURI.js 1.4kb
19
- dist/NKinds.js 1.1kb
20
- dist/NIP05.js 1.1kb
21
- dist/NSecSigner.js 1.1kb
22
- dist/utils/Machina.js 925b
23
- dist/NCache.js 828b
24
- dist/mod.js 752b
25
- dist/test/mod.js 701b
26
- ...and 10 more output files...
27
-
28
- Done in 22ms
1
+
2
+
3
+ > @nostrify/nostrify@0.46.8 build /home/sid/repos/nostrify/packages/nostrify
4
+ > tsc -p tsconfig.json && node ../../esbuild.config.js --package ./
5
+
6
+ NIP05.ts:18:5 - error TS2322: Type 'ZodObject<{ pubkey: ZodString; relays: ZodOptional<ZodArray<ZodType<`ws://${string}` | `wss://${string}`, ZodTypeDef, `ws://${string}` | `wss://${string}`>, "many">>; }, "strip", ZodTypeAny, { ...; }, { ...; }>' is not assignable to type 'ZodType<NProfilePointer, ZodTypeDef, NProfilePointer>'.
7
+ Types of property '_type' are incompatible.
8
+ Type '{ pubkey?: string; relays?: (`ws://${string}` | `wss://${string}`)[]; }' is not assignable to type 'NProfilePointer'.
9
+ Property 'pubkey' is optional in type '{ pubkey?: string; relays?: (`ws://${string}` | `wss://${string}`)[]; }' but required in type 'NProfilePointer'.
10
+
11
+ 18 return z.object({
12
+    ~~~~~~
13
+
14
+ NSchema.ts:45:5 - error TS2322: Type 'ZodObject<{ id: ZodString; kind: ZodNumber; pubkey: ZodString; tags: ZodArray<ZodArray<ZodString, "many">, "many">; content: ZodString; created_at: ZodNumber; sig: ZodString; }, "strip", ZodTypeAny, { ...; }, { ...; }>' is not assignable to type 'ZodType<NostrEvent, ZodTypeDef, NostrEvent>'.
15
+ Types of property '_type' are incompatible.
16
+ Type '{ pubkey?: string; tags?: string[][]; id?: string; sig?: string; created_at?: number; kind?: number; content?: string; }' is not assignable to type 'NostrEvent'.
17
+ Property 'id' is optional in type '{ pubkey?: string; tags?: string[][]; id?: string; sig?: string; created_at?: number; kind?: number; content?: string; }' but required in type 'NostrEvent'.
18
+
19
+ 45 return z.object({
20
+    ~~~~~~
21
+
22
+ NSchema.ts:108:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"EVENT">, ZodType<NostrEvent, ZodTypeDef, NostrEvent>], null>' is not assignable to type 'ZodType<NostrClientEVENT, ZodTypeDef, NostrClientEVENT>'.
23
+ Types of property '_type' are incompatible.
24
+ Type '["EVENT", NostrEvent, ...unknown[]]' is not assignable to type 'NostrClientEVENT'.
25
+ Target allows only 2 element(s) but source may have more.
26
+
27
+ 108 return z.tuple([z.literal('EVENT'), NSchema.event()]);
28
+    ~~~~~~
29
+
30
+ NSchema.ts:123:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"CLOSE">, ZodString], null>' is not assignable to type 'ZodType<NostrClientCLOSE, ZodTypeDef, NostrClientCLOSE>'.
31
+ Types of property '_type' are incompatible.
32
+ Type '["CLOSE", string, ...unknown[]]' is not assignable to type 'NostrClientCLOSE'.
33
+ Target allows only 2 element(s) but source may have more.
34
+
35
+ 123 return z.tuple([z.literal('CLOSE'), z.string()]);
36
+    ~~~~~~
37
+
38
+ NSchema.ts:128:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"AUTH">, ZodType<NostrEvent, ZodTypeDef, NostrEvent>], null>' is not assignable to type 'ZodType<NostrClientAUTH, ZodTypeDef, NostrClientAUTH>'.
39
+ Types of property '_type' are incompatible.
40
+ Type '["AUTH", NostrEvent, ...unknown[]]' is not assignable to type 'NostrClientAUTH'.
41
+ Target allows only 2 element(s) but source may have more.
42
+
43
+ 128 return z.tuple([z.literal('AUTH'), NSchema.event()]);
44
+    ~~~~~~
45
+
46
+ NSchema.ts:144:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"EVENT">, ZodString, ZodType<NostrEvent, ZodTypeDef, NostrEvent>], null>' is not assignable to type 'ZodType<NostrRelayEVENT, ZodTypeDef, NostrRelayEVENT>'.
47
+ Types of property '_type' are incompatible.
48
+ Type '["EVENT", string, NostrEvent, ...unknown[]]' is not assignable to type 'NostrRelayEVENT'.
49
+ Target allows only 3 element(s) but source may have more.
50
+
51
+ 144 return z.tuple([z.literal('EVENT'), z.string(), NSchema.event()]);
52
+    ~~~~~~
53
+
54
+ NSchema.ts:149:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"OK">, ZodString, ZodBoolean, ZodString], null>' is not assignable to type 'ZodType<NostrRelayOK, ZodTypeDef, NostrRelayOK>'.
55
+ Types of property '_type' are incompatible.
56
+ Type '["OK", string, boolean, string, ...unknown[]]' is not assignable to type 'NostrRelayOK'.
57
+ Target allows only 4 element(s) but source may have more.
58
+
59
+ 149 return z.tuple([z.literal('OK'), NSchema.id(), z.boolean(), z.string()]);
60
+    ~~~~~~
61
+
62
+ NSchema.ts:154:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"EOSE">, ZodString], null>' is not assignable to type 'ZodType<NostrRelayEOSE, ZodTypeDef, NostrRelayEOSE>'.
63
+ Types of property '_type' are incompatible.
64
+ Type '["EOSE", string, ...unknown[]]' is not assignable to type 'NostrRelayEOSE'.
65
+ Target allows only 2 element(s) but source may have more.
66
+
67
+ 154 return z.tuple([z.literal('EOSE'), z.string()]);
68
+    ~~~~~~
69
+
70
+ NSchema.ts:159:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"NOTICE">, ZodString], null>' is not assignable to type 'ZodType<NostrRelayNOTICE, ZodTypeDef, NostrRelayNOTICE>'.
71
+ Types of property '_type' are incompatible.
72
+ Type '["NOTICE", string, ...unknown[]]' is not assignable to type 'NostrRelayNOTICE'.
73
+ Target allows only 2 element(s) but source may have more.
74
+
75
+ 159 return z.tuple([z.literal('NOTICE'), z.string()]);
76
+    ~~~~~~
77
+
78
+ NSchema.ts:164:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"CLOSED">, ZodString, ZodString], null>' is not assignable to type 'ZodType<NostrRelayCLOSED, ZodTypeDef, NostrRelayCLOSED>'.
79
+ Types of property '_type' are incompatible.
80
+ Type '["CLOSED", string, string, ...unknown[]]' is not assignable to type 'NostrRelayCLOSED'.
81
+ Target allows only 3 element(s) but source may have more.
82
+
83
+ 164 return z.tuple([z.literal('CLOSED'), z.string(), z.string()]);
84
+    ~~~~~~
85
+
86
+ NSchema.ts:169:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"AUTH">, ZodString], null>' is not assignable to type 'ZodType<NostrRelayAUTH, ZodTypeDef, NostrRelayAUTH>'.
87
+ Types of property '_type' are incompatible.
88
+ Type '["AUTH", string, ...unknown[]]' is not assignable to type 'NostrRelayAUTH'.
89
+ Target allows only 2 element(s) but source may have more.
90
+
91
+ 169 return z.tuple([z.literal('AUTH'), z.string()]);
92
+    ~~~~~~
93
+
94
+ NSchema.ts:174:5 - error TS2322: Type 'ZodTuple<[ZodLiteral<"COUNT">, ZodString, ZodObject<{ count: ZodNumber; approximate: ZodOptional<ZodBoolean>; }, "strip", ZodTypeAny, { ...; }, { ...; }>], null>' is not assignable to type 'ZodType<NostrRelayCOUNT, ZodTypeDef, NostrRelayCOUNT>'.
95
+ Types of property '_type' are incompatible.
96
+ Type '["COUNT", string, { count?: number; approximate?: boolean; }, ...unknown[]]' is not assignable to type 'NostrRelayCOUNT'.
97
+ Target allows only 3 element(s) but source may have more.
98
+
99
+ 174 return z.tuple([
100
+    ~~~~~~
101
+
102
+ NSchema.ts:215:5 - error TS2322: Type 'ZodObject<{ id: ZodString; method: ZodString; params: ZodArray<ZodString, "many">; }, "strip", ZodTypeAny, { id?: string; params?: string[]; method?: string; }, { ...; }>' is not assignable to type 'ZodType<NostrConnectRequest, ZodTypeDef, NostrConnectRequest>'.
103
+ Types of property '_type' are incompatible.
104
+ Type '{ id?: string; params?: string[]; method?: string; }' is not assignable to type 'NostrConnectRequest'.
105
+ Property 'id' is optional in type '{ id?: string; params?: string[]; method?: string; }' but required in type 'NostrConnectRequest'.
106
+
107
+ 215 return z.object({
108
+    ~~~~~~
109
+
110
+ NSchema.ts:224:5 - error TS2322: Type 'ZodObject<{ id: ZodString; result: ZodString; error: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { id?: string; result?: string; error?: string; }, { ...; }>' is not assignable to type 'ZodType<NostrConnectResponse, ZodTypeDef, NostrConnectResponse>'.
111
+ Types of property '_type' are incompatible.
112
+ Type '{ id?: string; result?: string; error?: string; }' is not assignable to type 'NostrConnectResponse'.
113
+ Property 'id' is optional in type '{ id?: string; result?: string; error?: string; }' but required in type 'NostrConnectResponse'.
114
+
115
+ 224 return z.object({
116
+    ~~~~~~
117
+
118
+
119
+ Found 14 errors in 2 files.
120
+
121
+ Errors Files
122
+ 1 NIP05.ts:18
123
+ 13 NSchema.ts:45
124
+  ELIFECYCLE  Command failed with exit code 2.
@@ -1,123 +1,91 @@
1
-
2
- > @nostrify/nostrify@0.46.7 test /home/sid/repos/nostrify/packages/nostrify
3
- > node --test "**/*.test.ts"
4
-
5
- ✔ BunkerURI (3.139394ms)
6
- ✔ BunkerURI.fromJSON (1.078848ms)
7
- NBrowserSigner - without extension (6.464847ms)
8
- ✔ NBrowserSigner - with extension polyfill (234.080428ms)
9
- ✔ NBrowserSigner.nip44 - with extension polyfill (91.327807ms)
10
- ✔ NBrowserSigner.nip04 - with extension polyfill (83.997199ms)
11
- ✔ NBrowserSigner.getRelays - with extension polyfill (1.347041ms)
12
- ✔ NBrowserSigner - missing nip44 support (7.24135ms)
13
- ✔ NBrowserSigner - missing nip04 support (0.957463ms)
14
- ✔ NBrowserSigner - feature detection (0.630183ms)
15
- NCache (7.515339ms)
16
- NConnectSigner.signEvent with nip04 encryption (279.362646ms)
17
- ✔ NConnectSigner.signEvent with nip44 encryption (108.072198ms)
18
- NIP05.lookup (127.775302ms)
19
- ✔ NIP05.lookup with invalid values but valid profile pointer (11.722058ms)
20
- ✔ NIP05.lookup with invalid document (13.281978ms)
21
- NIP50.parseInput (3.655177ms)
22
- ✔ NIP50.parseInput with negated token (0.487567ms)
23
- NIP98.template (24.095253ms)
24
- ✔ NIP98.template with payload (53.842113ms)
25
- ✔ NIP98.verify (281.757944ms)
26
- ✔ NIP98.verify fails with missing header (7.416304ms)
27
- ✔ NIP98.verify fails with missing token (4.561446ms)
28
- ✔ NIP98.verify fails with invalid token (9.659557ms)
29
- ✔ NIP98.verify fails with invalid event (37.684884ms)
30
- ✔ NIP98.verify fails with wrong event kind (62.228241ms)
31
- ✔ NIP98.verify fails with wrong request URL (32.012672ms)
32
- ✔ NIP98.verify fails with wrong request method (61.338176ms)
33
- ✔ NIP98.verify fails with expired event (33.697888ms)
34
- ✔ NIP98.verify fails with invalid payload (73.713885ms)
35
- NKinds (2.137233ms)
36
- NPool.query (1002.066008ms)
37
- ✔ NPool.req (97.498969ms)
38
- ✔ NPool.event (267.305626ms)
39
- NRelay1.query (746.453455ms)
40
- ✔ NRelay1.query mismatched filter (259.123715ms)
41
- ✔ NRelay1.req (297.033979ms)
42
- ✔ NRelay1.event (246.217138ms)
43
- NRelay1 backoff (1.75855ms) # SKIP
44
- NRelay1 idleTimeout
45
- websocket opens (43.318751ms)
46
- ✔ websocket closes after idleTimeout (151.53622ms)
47
- ✔ websocket wakes up during activity (20.337967ms)
48
- NRelay1 idleTimeout (429.224616ms)
49
- ✔ NRelay1.count rejects when the server sends CLOSED (223.243687ms)
50
- ✔ NRelay1 closes when it receives a binary message (221.917598ms)
51
- n.id (19.246617ms)
52
- ✔ n.bech32 (5.666764ms)
53
- ✔ n.filter (41.374213ms)
54
- ✔ n.event (5.833826ms)
55
- ✔ n.metadata (22.364081ms)
56
- NSecSigner (265.119504ms)
57
- ✔ NSecSigner.nip44 (70.579379ms)
58
- NSet (36.583337ms)
59
- ✔ NSet.add (replaceable) (0.930993ms)
60
- ✔ NSet.add (parameterized) (1.035127ms)
61
- ✔ NSet.add (deletion) (0.479884ms)
62
- Construct a RelayError from the reason message (2.876998ms)
63
- Throw a new RelayError if the OK message is false (0.544837ms)
64
- LNURL.fromString (7.092726ms)
65
- ✔ LNURL.fromLightningAddress (1.072702ms)
66
- ✔ LNURL.toString (1.514522ms)
67
- ✔ LNURL.getDetails (94.441569ms)
68
- ✔ LNURL.getInvoice (8.24442ms)
69
- ErrorRelay (123.796477ms)
70
- MockRelay (3.191496ms)
71
- BlossomUploader.upload (1004.663359ms)
72
- {
73
- status: 'error',
74
- message: 'Unauthorized, please provide a valid nip-98 token',
75
- data: {}
76
- }
77
- NostrBuildUploader.upload (1590.593336ms)
78
- CircularSet (7.081691ms)
79
- ✔ push, iterate, & close (104.057684ms)
80
- close & reopen (0.858706ms)
81
- aborts with signal (52.838065ms)
82
- already aborted signal in constructor (0.887341ms)
83
- push after abort (1.140029ms)
84
- multiple messages in queue (0.695626ms)
85
- N64 (8.897581ms)
86
- N64.encodeEvent (0.552799ms)
87
- N64.decodeEvent (1.49315ms)
88
- tests 77
89
- suites 0
90
- pass 75
91
- fail 1
92
- ℹ cancelled 0
93
- ℹ skipped 1
94
- ℹ todo 0
95
- ℹ duration_ms 3317.855572
96
-
97
- ✖ failing tests:
98
-
99
- test at uploaders/NostrBuildUploader.test.ts:10:7
100
- ✖ NostrBuildUploader.upload (1590.593336ms)
101
- Error [ZodError]: [
102
- {
103
- "code": "invalid_type",
104
- "expected": "array",
105
- "received": "object",
106
- "path": [
107
- "data"
108
- ],
109
- "message": "Expected array, received object"
110
- }
111
- ]
112
- at get error (file:///home/sid/repos/nostrify/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js:39:31)
113
- at ZodObject.parse (file:///home/sid/repos/nostrify/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js:114:22)
114
- at NostrBuildUploader.upload (file:///home/sid/repos/nostrify/packages/nostrify/uploaders/NostrBuildUploader.ts:51:48)
115
- at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
116
- at async TestContext.<anonymous> (file:///home/sid/repos/nostrify/packages/nostrify/uploaders/NostrBuildUploader.test.ts:22:18)
117
- at async Test.run (node:internal/test_runner/test:1088:7)
118
- at async startSubtestAfterBootstrap (node:internal/test_runner/harness:332:3)
119
- at async file:///home/sid/repos/nostrify/packages/nostrify/uploaders/NostrBuildUploader.test.ts:10:1 {
120
- issues: [ { code: 'invalid_type', expected: 'array', received: 'object', path: [Array], message: 'Expected array, received object' } ],
121
- [errors]: [ { code: 'invalid_type', expected: 'array', received: 'object', path: [Array], message: 'Expected array, received object' } ]
122
- }
123
-  ELIFECYCLE  Test failed. See above for more details.
1
+
2
+
3
+ > @nostrify/nostrify@0.46.8 test /home/sid/repos/nostrify/packages/nostrify
4
+ > node --test "**/*.test.ts"
5
+
6
+ ✔ BunkerURI (2.901722ms)
7
+ BunkerURI.fromJSON (0.681727ms)
8
+ ✔ NBrowserSigner - without extension (2.955361ms)
9
+ ✔ NBrowserSigner - with extension polyfill (142.479686ms)
10
+ ✔ NBrowserSigner.nip44 - with extension polyfill (63.176698ms)
11
+ ✔ NBrowserSigner.nip04 - with extension polyfill (94.046199ms)
12
+ ✔ NBrowserSigner.getRelays - with extension polyfill (1.225726ms)
13
+ ✔ NBrowserSigner - missing nip44 support (0.470316ms)
14
+ ✔ NBrowserSigner - missing nip04 support (0.596869ms)
15
+ NBrowserSigner - feature detection (0.692134ms)
16
+ NCache (4.463457ms)
17
+ ✔ NConnectSigner.signEvent with nip04 encryption (264.497854ms)
18
+ NConnectSigner.signEvent with nip44 encryption (151.108865ms)
19
+ ✔ NIP05.lookup (82.449297ms)
20
+ ✔ NIP05.lookup with invalid values but valid profile pointer (5.343535ms)
21
+ NIP05.lookup with invalid document (5.910931ms)
22
+ ✔ NIP50.parseInput (6.388441ms)
23
+ NIP50.parseInput with negated token (0.443007ms)
24
+ ✔ NIP98.template (3.769298ms)
25
+ ✔ NIP98.template with payload (18.668676ms)
26
+ ✔ NIP98.verify (102.562862ms)
27
+ ✔ NIP98.verify fails with missing header (4.419038ms)
28
+ ✔ NIP98.verify fails with missing token (2.752191ms)
29
+ ✔ NIP98.verify fails with invalid token (4.587427ms)
30
+ ✔ NIP98.verify fails with invalid event (16.989187ms)
31
+ ✔ NIP98.verify fails with wrong event kind (40.621459ms)
32
+ ✔ NIP98.verify fails with wrong request URL (41.071101ms)
33
+ ✔ NIP98.verify fails with wrong request method (62.625645ms)
34
+ ✔ NIP98.verify fails with expired event (20.760162ms)
35
+ NIP98.verify fails with invalid payload (51.97091ms)
36
+ NKinds (3.308412ms)
37
+ ✔ NPool.query (368.093259ms)
38
+ ✔ NPool.req (266.969001ms)
39
+ NPool.event (232.161184ms)
40
+ ✔ NRelay1.query (280.362725ms)
41
+ ✔ NRelay1.query mismatched filter (245.542477ms)
42
+ ✔ NRelay1.req (247.658198ms)
43
+ NRelay1.event (216.357493ms)
44
+ NRelay1 backoff (0.334682ms) # SKIP
45
+ NRelay1 idleTimeout
46
+ ✔ websocket opens (40.531572ms)
47
+ ✔ websocket closes after idleTimeout (150.405626ms)
48
+ websocket wakes up during activity (14.544161ms)
49
+ ✔ NRelay1 idleTimeout (209.795356ms)
50
+ ✔ NRelay1.count rejects when the server sends CLOSED (6.440892ms)
51
+ NRelay1 closes when it receives a binary message (5.03225ms)
52
+ ✔ n.id (3.950608ms)
53
+ ✔ n.bech32 (1.817636ms)
54
+ ✔ n.filter (10.95275ms)
55
+ ✔ n.event (2.561941ms)
56
+ n.metadata (11.862022ms)
57
+ ✔ NSecSigner (178.164717ms)
58
+ NSecSigner.nip44 (31.935079ms)
59
+ ✔ NSet (19.978352ms)
60
+ ✔ NSet.add (replaceable) (0.615308ms)
61
+ ✔ NSet.add (parameterized) (0.985888ms)
62
+ NSet.add (deletion) (0.380918ms)
63
+ Construct a RelayError from the reason message (1.717692ms)
64
+ Throw a new RelayError if the OK message is false (0.750801ms)
65
+ ✔ LNURL.fromString (7.817616ms)
66
+ ✔ LNURL.fromLightningAddress (0.932529ms)
67
+ ✔ LNURL.toString (1.933713ms)
68
+ ✔ LNURL.getDetails (111.66131ms)
69
+ LNURL.getInvoice (13.562812ms)
70
+ ErrorRelay (112.209428ms)
71
+ MockRelay (3.019126ms)
72
+ ﹣ BlossomUploader.upload (1.127947ms) # SKIP
73
+ NostrBuildUploader.upload (2.842008ms) # SKIP
74
+ CircularSet (2.247513ms)
75
+ push, iterate, & close (103.751782ms)
76
+ ✔ close & reopen (0.982257ms)
77
+ aborts with signal (51.656203ms)
78
+ already aborted signal in constructor (1.251916ms)
79
+ ✔ push after abort (0.906129ms)
80
+ multiple messages in queue (0.531637ms)
81
+ N64 (8.171994ms)
82
+ N64.encodeEvent (0.513338ms)
83
+ N64.decodeEvent (1.449988ms)
84
+ tests 77
85
+ suites 0
86
+ pass 74
87
+ fail 0
88
+ cancelled 0
89
+ skipped 3
90
+ todo 0
91
+ duration_ms 2192.909865
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.46.9
4
+
5
+ ### Patch Changes
6
+
7
+ - tests should pass now
8
+ - Updated dependencies
9
+ - @nostrify/types@0.36.5
10
+
3
11
  ## 0.46.8
4
12
 
5
13
  ### Patch Changes
package/NIP05.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { NProfilePointer } from '@nostrify/types';
1
+ import type { NProfilePointer } from "@nostrify/types";
2
2
 
3
- import { NSchema as n, z } from './NSchema.ts';
3
+ import { NSchema as n, z } from "./NSchema.ts";
4
4
 
5
5
  interface LookupOpts {
6
6
  fetch?: typeof fetch;
@@ -18,7 +18,7 @@ export class NIP05 {
18
18
  return z.object({
19
19
  pubkey: n.id(),
20
20
  relays: n.relayUrl().array().optional(),
21
- });
21
+ }) as z.ZodType<NProfilePointer>;
22
22
  }
23
23
 
24
24
  /** Resolve NIP-05 name to a profile pointer. */
@@ -31,10 +31,10 @@ export class NIP05 {
31
31
  const match = nip05.match(NIP05.regex());
32
32
  if (!match) throw new Error(`NIP-05: invalid name ${nip05}`);
33
33
 
34
- const [_, name = '_', domain] = match;
34
+ const [_, name = "_", domain] = match;
35
35
 
36
- const url = new URL('/.well-known/nostr.json', `https://${domain}/`);
37
- url.searchParams.set('name', name);
36
+ const url = new URL("/.well-known/nostr.json", `https://${domain}/`);
37
+ url.searchParams.set("name", name);
38
38
 
39
39
  const response = await fetch(url, { signal });
40
40
  const json = await response.json();
package/NSchema.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
 
3
3
  import type {
4
4
  NostrClientAUTH,
@@ -20,7 +20,7 @@ import type {
20
20
  NostrRelayMsg,
21
21
  NostrRelayNOTICE,
22
22
  NostrRelayOK,
23
- } from '@nostrify/types';
23
+ } from "@nostrify/types";
24
24
 
25
25
  /**
26
26
  * A suite of [zod](https://github.com/colinhacks/zod) schemas for Nostr.
@@ -50,7 +50,15 @@ class NSchema {
50
50
  content: z.string(),
51
51
  created_at: z.number().int().nonnegative(),
52
52
  sig: z.string(),
53
- });
53
+ }).required({
54
+ id: true,
55
+ kind: true,
56
+ pubkey: true,
57
+ tags: true,
58
+ content: true,
59
+ created_at: true,
60
+ sig: true,
61
+ }) as z.ZodType<NostrEvent>;
54
62
  }
55
63
 
56
64
  /** Nostr filter schema. */
@@ -67,16 +75,16 @@ class NSchema {
67
75
  .passthrough()
68
76
  .transform((value) => {
69
77
  const keys = [
70
- 'kinds',
71
- 'ids',
72
- 'authors',
73
- 'since',
74
- 'until',
75
- 'limit',
76
- 'search',
78
+ "kinds",
79
+ "ids",
80
+ "authors",
81
+ "since",
82
+ "until",
83
+ "limit",
84
+ "search",
77
85
  ];
78
86
  return Object.entries(value).reduce((acc, [key, val]) => {
79
- if (keys.includes(key) || key.startsWith('#')) {
87
+ if (keys.includes(key) || key.startsWith("#")) {
80
88
  acc[key] = val;
81
89
  }
82
90
  return acc;
@@ -92,7 +100,9 @@ class NSchema {
92
100
  return z
93
101
  .string()
94
102
  .regex(/^[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}$/)
95
- .refine((value) => prefix ? value.startsWith(`${prefix}1`) : true) as z.ZodType<`${P}1${string}`>;
103
+ .refine((value) =>
104
+ prefix ? value.startsWith(`${prefix}1`) : true
105
+ ) as z.ZodType<`${P}1${string}`>;
96
106
  }
97
107
 
98
108
  /** WebSocket URL starting with `ws://` or `wss://`. */
@@ -105,27 +115,39 @@ class NSchema {
105
115
 
106
116
  /** NIP-01 `EVENT` message from client to relay. */
107
117
  static clientEVENT(): z.ZodType<NostrClientEVENT> {
108
- return z.tuple([z.literal('EVENT'), NSchema.event()]);
118
+ return z.tuple([
119
+ z.literal("EVENT"),
120
+ NSchema.event(),
121
+ ]) as unknown as z.ZodType<
122
+ NostrClientEVENT
123
+ >;
109
124
  }
110
125
 
111
126
  /** NIP-01 `REQ` message from client to relay. */
112
127
  static clientREQ(): z.ZodType<NostrClientREQ> {
113
- return z.tuple([z.literal('REQ'), z.string()]).rest(NSchema.filter());
128
+ return z.tuple([z.literal("REQ"), z.string()]).rest(NSchema.filter());
114
129
  }
115
130
 
116
131
  /** NIP-45 `COUNT` message from client to relay. */
117
132
  static clientCOUNT(): z.ZodType<NostrClientCOUNT> {
118
- return z.tuple([z.literal('COUNT'), z.string()]).rest(NSchema.filter());
133
+ return z.tuple([z.literal("COUNT"), z.string()]).rest(NSchema.filter());
119
134
  }
120
135
 
121
136
  /** NIP-01 `CLOSE` message from client to relay. */
122
137
  static clientCLOSE(): z.ZodType<NostrClientCLOSE> {
123
- return z.tuple([z.literal('CLOSE'), z.string()]);
138
+ return z.tuple([z.literal("CLOSE"), z.string()]) as unknown as z.ZodType<
139
+ NostrClientCLOSE
140
+ >;
124
141
  }
125
142
 
126
143
  /** NIP-42 `AUTH` message from client to relay. */
127
144
  static clientAUTH(): z.ZodType<NostrClientAUTH> {
128
- return z.tuple([z.literal('AUTH'), NSchema.event()]);
145
+ return z.tuple([
146
+ z.literal("AUTH"),
147
+ NSchema.event(),
148
+ ]) as unknown as z.ZodType<
149
+ NostrClientAUTH
150
+ >;
129
151
  }
130
152
 
131
153
  /** NIP-01 message from client to relay. */
@@ -136,49 +158,68 @@ class NSchema {
136
158
  NSchema.clientCOUNT(),
137
159
  NSchema.clientCLOSE(),
138
160
  NSchema.clientAUTH(),
139
- ]);
161
+ ]) as z.ZodType<NostrClientMsg>;
140
162
  }
141
163
 
142
164
  /** NIP-01 `EVENT` message from relay to client. */
143
165
  static relayEVENT(): z.ZodType<NostrRelayEVENT> {
144
- return z.tuple([z.literal('EVENT'), z.string(), NSchema.event()]);
166
+ return z.tuple([
167
+ z.literal("EVENT"),
168
+ z.string(),
169
+ NSchema.event(),
170
+ ]) as unknown as z.ZodType<NostrRelayEVENT>;
145
171
  }
146
172
 
147
173
  /** NIP-01 `OK` message from relay to client. */
148
174
  static relayOK(): z.ZodType<NostrRelayOK> {
149
- return z.tuple([z.literal('OK'), NSchema.id(), z.boolean(), z.string()]);
175
+ return z.tuple([
176
+ z.literal("OK"),
177
+ NSchema.id(),
178
+ z.boolean(),
179
+ z.string(),
180
+ ]) as unknown as z.ZodType<NostrRelayOK>;
150
181
  }
151
182
 
152
183
  /** NIP-01 `EOSE` message from relay to client. */
153
184
  static relayEOSE(): z.ZodType<NostrRelayEOSE> {
154
- return z.tuple([z.literal('EOSE'), z.string()]);
185
+ return z.tuple([z.literal("EOSE"), z.string()]) as unknown as z.ZodType<
186
+ NostrRelayEOSE
187
+ >;
155
188
  }
156
189
 
157
190
  /** NIP-01 `NOTICE` message from relay to client. */
158
191
  static relayNOTICE(): z.ZodType<NostrRelayNOTICE> {
159
- return z.tuple([z.literal('NOTICE'), z.string()]);
192
+ return z.tuple([z.literal("NOTICE"), z.string()]) as unknown as z.ZodType<
193
+ NostrRelayNOTICE
194
+ >;
160
195
  }
161
196
 
162
197
  /** NIP-01 `CLOSED` message from relay to client. */
163
198
  static relayCLOSED(): z.ZodType<NostrRelayCLOSED> {
164
- return z.tuple([z.literal('CLOSED'), z.string(), z.string()]);
199
+ return z.tuple([
200
+ z.literal("CLOSED"),
201
+ z.string(),
202
+ z.string(),
203
+ ]) as unknown as z.ZodType<NostrRelayCLOSED>;
165
204
  }
166
205
 
167
206
  /** NIP-42 `AUTH` message from relay to client. */
168
207
  static relayAUTH(): z.ZodType<NostrRelayAUTH> {
169
- return z.tuple([z.literal('AUTH'), z.string()]);
208
+ return z.tuple([z.literal("AUTH"), z.string()]) as unknown as z.ZodType<
209
+ NostrRelayAUTH
210
+ >;
170
211
  }
171
212
 
172
213
  /** NIP-45 `COUNT` message from relay to client. */
173
214
  static relayCOUNT(): z.ZodType<NostrRelayCOUNT> {
174
215
  return z.tuple([
175
- z.literal('COUNT'),
216
+ z.literal("COUNT"),
176
217
  z.string(),
177
218
  z.object({
178
219
  count: z.number().int().nonnegative(),
179
220
  approximate: z.boolean().optional(),
180
221
  }),
181
- ]);
222
+ ]) as unknown as z.ZodType<NostrRelayCOUNT>;
182
223
  }
183
224
 
184
225
  /** NIP-01 message from relay to client. */
@@ -201,7 +242,7 @@ class NSchema {
201
242
  banner: z.string().url().optional().catch(undefined),
202
243
  bot: z.boolean().optional().catch(undefined),
203
244
  display_name: z.string().optional().catch(undefined),
204
- lud06: NSchema.bech32('lnurl').optional().catch(undefined),
245
+ lud06: NSchema.bech32("lnurl").optional().catch(undefined),
205
246
  lud16: z.string().email().optional().catch(undefined),
206
247
  name: z.string().optional().catch(undefined),
207
248
  nip05: z.string().email().optional().catch(undefined),
@@ -216,7 +257,7 @@ class NSchema {
216
257
  id: z.string(),
217
258
  method: z.string(),
218
259
  params: z.string().array(),
219
- });
260
+ }) as z.ZodType<NostrConnectRequest>;
220
261
  }
221
262
 
222
263
  /** NIP-46 response content schema. */
@@ -225,7 +266,7 @@ class NSchema {
225
266
  id: z.string(),
226
267
  result: z.string(),
227
268
  error: z.string().optional(),
228
- });
269
+ }) as z.ZodType<NostrConnectResponse>;
229
270
  }
230
271
 
231
272
  /**
@@ -240,7 +281,7 @@ class NSchema {
240
281
  try {
241
282
  return JSON.parse(value) as unknown;
242
283
  } catch (_e) {
243
- ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Invalid JSON' });
284
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "Invalid JSON" });
244
285
  return z.NEVER;
245
286
  }
246
287
  });