@nostrify/nostrify 0.49.0 → 0.49.2

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/NSchema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { NostrClientAUTH, NostrClientCLOSE, NostrClientCOUNT, NostrClientEVENT, NostrClientMsg, NostrClientREQ, NostrConnectRequest, NostrConnectResponse, NostrEvent, NostrFilter, NostrMetadata, NostrRelayAUTH, NostrRelayCLOSED, NostrRelayCOUNT, NostrRelayEOSE, NostrRelayEVENT, NostrRelayMsg, NostrRelayNOTICE, NostrRelayOK } from "@nostrify/types";
2
+ import type { NostrFilter } from "@nostrify/types";
3
3
  /**
4
4
  * A suite of [zod](https://github.com/colinhacks/zod) schemas for Nostr.
5
5
  *
@@ -16,50 +16,216 @@ declare class NSchema {
16
16
  /** Schema to validate Nostr hex IDs such as event IDs and pubkeys. */
17
17
  static id(): z.ZodString;
18
18
  /** Nostr event schema. */
19
- static event(): z.ZodType<NostrEvent>;
19
+ static event(): z.ZodObject<{
20
+ id: z.ZodNonOptional<z.ZodString>;
21
+ kind: z.ZodNonOptional<z.ZodNumber>;
22
+ pubkey: z.ZodNonOptional<z.ZodString>;
23
+ tags: z.ZodNonOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
24
+ content: z.ZodNonOptional<z.ZodString>;
25
+ created_at: z.ZodNonOptional<z.ZodNumber>;
26
+ sig: z.ZodNonOptional<z.ZodString>;
27
+ }, z.core.$strip>;
20
28
  /** Nostr filter schema. */
21
- static filter(): z.ZodType<NostrFilter>;
29
+ static filter(): z.ZodPipe<z.ZodObject<{
30
+ kinds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
31
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ since: z.ZodOptional<z.ZodNumber>;
34
+ until: z.ZodOptional<z.ZodNumber>;
35
+ limit: z.ZodOptional<z.ZodNumber>;
36
+ search: z.ZodOptional<z.ZodString>;
37
+ }, z.core.$loose>, z.ZodTransform<NostrFilter, {
38
+ [x: string]: unknown;
39
+ kinds?: number[] | undefined;
40
+ ids?: string[] | undefined;
41
+ authors?: string[] | undefined;
42
+ since?: number | undefined;
43
+ until?: number | undefined;
44
+ limit?: number | undefined;
45
+ search?: string | undefined;
46
+ }>>;
22
47
  /**
23
48
  * Bech32 string.
24
49
  * @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
25
50
  */
26
- static bech32<P extends string>(prefix?: P): z.ZodType<`${P}1${string}`>;
51
+ static bech32<P extends string>(prefix?: P): z.ZodString;
27
52
  /** WebSocket URL starting with `ws://` or `wss://`. */
28
- static relayUrl(): z.ZodType<`ws://${string}` | `wss://${string}`>;
53
+ static relayUrl(): z.ZodURL;
29
54
  /** NIP-01 `EVENT` message from client to relay. */
30
- static clientEVENT(): z.ZodType<NostrClientEVENT>;
55
+ static clientEVENT(): z.ZodTuple<[z.ZodLiteral<"EVENT">, z.ZodObject<{
56
+ id: z.ZodNonOptional<z.ZodString>;
57
+ kind: z.ZodNonOptional<z.ZodNumber>;
58
+ pubkey: z.ZodNonOptional<z.ZodString>;
59
+ tags: z.ZodNonOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
60
+ content: z.ZodNonOptional<z.ZodString>;
61
+ created_at: z.ZodNonOptional<z.ZodNumber>;
62
+ sig: z.ZodNonOptional<z.ZodString>;
63
+ }, z.core.$strip>], null>;
31
64
  /** NIP-01 `REQ` message from client to relay. */
32
- static clientREQ(): z.ZodType<NostrClientREQ>;
65
+ static clientREQ(): z.ZodTuple<[z.ZodLiteral<"REQ">, z.ZodString], z.ZodPipe<z.ZodObject<{
66
+ kinds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
67
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
+ since: z.ZodOptional<z.ZodNumber>;
70
+ until: z.ZodOptional<z.ZodNumber>;
71
+ limit: z.ZodOptional<z.ZodNumber>;
72
+ search: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$loose>, z.ZodTransform<NostrFilter, {
74
+ [x: string]: unknown;
75
+ kinds?: number[] | undefined;
76
+ ids?: string[] | undefined;
77
+ authors?: string[] | undefined;
78
+ since?: number | undefined;
79
+ until?: number | undefined;
80
+ limit?: number | undefined;
81
+ search?: string | undefined;
82
+ }>>>;
33
83
  /** NIP-45 `COUNT` message from client to relay. */
34
- static clientCOUNT(): z.ZodType<NostrClientCOUNT>;
84
+ static clientCOUNT(): z.ZodTuple<[z.ZodLiteral<"COUNT">, z.ZodString], z.ZodPipe<z.ZodObject<{
85
+ kinds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
86
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
+ since: z.ZodOptional<z.ZodNumber>;
89
+ until: z.ZodOptional<z.ZodNumber>;
90
+ limit: z.ZodOptional<z.ZodNumber>;
91
+ search: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$loose>, z.ZodTransform<NostrFilter, {
93
+ [x: string]: unknown;
94
+ kinds?: number[] | undefined;
95
+ ids?: string[] | undefined;
96
+ authors?: string[] | undefined;
97
+ since?: number | undefined;
98
+ until?: number | undefined;
99
+ limit?: number | undefined;
100
+ search?: string | undefined;
101
+ }>>>;
35
102
  /** NIP-01 `CLOSE` message from client to relay. */
36
- static clientCLOSE(): z.ZodType<NostrClientCLOSE>;
103
+ static clientCLOSE(): z.ZodTuple<[z.ZodLiteral<"CLOSE">, z.ZodString], null>;
37
104
  /** NIP-42 `AUTH` message from client to relay. */
38
- static clientAUTH(): z.ZodType<NostrClientAUTH>;
105
+ static clientAUTH(): z.ZodTuple<[z.ZodLiteral<"AUTH">, z.ZodObject<{
106
+ id: z.ZodNonOptional<z.ZodString>;
107
+ kind: z.ZodNonOptional<z.ZodNumber>;
108
+ pubkey: z.ZodNonOptional<z.ZodString>;
109
+ tags: z.ZodNonOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
110
+ content: z.ZodNonOptional<z.ZodString>;
111
+ created_at: z.ZodNonOptional<z.ZodNumber>;
112
+ sig: z.ZodNonOptional<z.ZodString>;
113
+ }, z.core.$strip>], null>;
39
114
  /** NIP-01 message from client to relay. */
40
- static clientMsg(): z.ZodType<NostrClientMsg>;
115
+ static clientMsg(): z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"EVENT">, z.ZodObject<{
116
+ id: z.ZodNonOptional<z.ZodString>;
117
+ kind: z.ZodNonOptional<z.ZodNumber>;
118
+ pubkey: z.ZodNonOptional<z.ZodString>;
119
+ tags: z.ZodNonOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
120
+ content: z.ZodNonOptional<z.ZodString>;
121
+ created_at: z.ZodNonOptional<z.ZodNumber>;
122
+ sig: z.ZodNonOptional<z.ZodString>;
123
+ }, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"REQ">, z.ZodString], z.ZodPipe<z.ZodObject<{
124
+ kinds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
125
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
126
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ since: z.ZodOptional<z.ZodNumber>;
128
+ until: z.ZodOptional<z.ZodNumber>;
129
+ limit: z.ZodOptional<z.ZodNumber>;
130
+ search: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$loose>, z.ZodTransform<NostrFilter, {
132
+ [x: string]: unknown;
133
+ kinds?: number[] | undefined;
134
+ ids?: string[] | undefined;
135
+ authors?: string[] | undefined;
136
+ since?: number | undefined;
137
+ until?: number | undefined;
138
+ limit?: number | undefined;
139
+ search?: string | undefined;
140
+ }>>>, z.ZodTuple<[z.ZodLiteral<"COUNT">, z.ZodString], z.ZodPipe<z.ZodObject<{
141
+ kinds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
142
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
143
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
144
+ since: z.ZodOptional<z.ZodNumber>;
145
+ until: z.ZodOptional<z.ZodNumber>;
146
+ limit: z.ZodOptional<z.ZodNumber>;
147
+ search: z.ZodOptional<z.ZodString>;
148
+ }, z.core.$loose>, z.ZodTransform<NostrFilter, {
149
+ [x: string]: unknown;
150
+ kinds?: number[] | undefined;
151
+ ids?: string[] | undefined;
152
+ authors?: string[] | undefined;
153
+ since?: number | undefined;
154
+ until?: number | undefined;
155
+ limit?: number | undefined;
156
+ search?: string | undefined;
157
+ }>>>, z.ZodTuple<[z.ZodLiteral<"CLOSE">, z.ZodString], null>, z.ZodTuple<[z.ZodLiteral<"AUTH">, z.ZodObject<{
158
+ id: z.ZodNonOptional<z.ZodString>;
159
+ kind: z.ZodNonOptional<z.ZodNumber>;
160
+ pubkey: z.ZodNonOptional<z.ZodString>;
161
+ tags: z.ZodNonOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
162
+ content: z.ZodNonOptional<z.ZodString>;
163
+ created_at: z.ZodNonOptional<z.ZodNumber>;
164
+ sig: z.ZodNonOptional<z.ZodString>;
165
+ }, z.core.$strip>], null>]>;
41
166
  /** NIP-01 `EVENT` message from relay to client. */
42
- static relayEVENT(): z.ZodType<NostrRelayEVENT>;
167
+ static relayEVENT(): z.ZodTuple<[z.ZodLiteral<"EVENT">, z.ZodString, z.ZodObject<{
168
+ id: z.ZodNonOptional<z.ZodString>;
169
+ kind: z.ZodNonOptional<z.ZodNumber>;
170
+ pubkey: z.ZodNonOptional<z.ZodString>;
171
+ tags: z.ZodNonOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
172
+ content: z.ZodNonOptional<z.ZodString>;
173
+ created_at: z.ZodNonOptional<z.ZodNumber>;
174
+ sig: z.ZodNonOptional<z.ZodString>;
175
+ }, z.core.$strip>], null>;
43
176
  /** NIP-01 `OK` message from relay to client. */
44
- static relayOK(): z.ZodType<NostrRelayOK>;
177
+ static relayOK(): z.ZodTuple<[z.ZodLiteral<"OK">, z.ZodString, z.ZodBoolean, z.ZodString], null>;
45
178
  /** NIP-01 `EOSE` message from relay to client. */
46
- static relayEOSE(): z.ZodType<NostrRelayEOSE>;
179
+ static relayEOSE(): z.ZodTuple<[z.ZodLiteral<"EOSE">, z.ZodString], null>;
47
180
  /** NIP-01 `NOTICE` message from relay to client. */
48
- static relayNOTICE(): z.ZodType<NostrRelayNOTICE>;
181
+ static relayNOTICE(): z.ZodTuple<[z.ZodLiteral<"NOTICE">, z.ZodString], null>;
49
182
  /** NIP-01 `CLOSED` message from relay to client. */
50
- static relayCLOSED(): z.ZodType<NostrRelayCLOSED>;
183
+ static relayCLOSED(): z.ZodTuple<[z.ZodLiteral<"CLOSED">, z.ZodString, z.ZodString], null>;
51
184
  /** NIP-42 `AUTH` message from relay to client. */
52
- static relayAUTH(): z.ZodType<NostrRelayAUTH>;
185
+ static relayAUTH(): z.ZodTuple<[z.ZodLiteral<"AUTH">, z.ZodString], null>;
53
186
  /** NIP-45 `COUNT` message from relay to client. */
54
- static relayCOUNT(): z.ZodType<NostrRelayCOUNT>;
187
+ static relayCOUNT(): z.ZodTuple<[z.ZodLiteral<"COUNT">, z.ZodString, z.ZodObject<{
188
+ count: z.ZodNumber;
189
+ approximate: z.ZodOptional<z.ZodBoolean>;
190
+ }, z.core.$strip>], null>;
55
191
  /** NIP-01 message from relay to client. */
56
- static relayMsg(): z.ZodType<NostrRelayMsg>;
192
+ static relayMsg(): z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"EVENT">, z.ZodString, z.ZodObject<{
193
+ id: z.ZodNonOptional<z.ZodString>;
194
+ kind: z.ZodNonOptional<z.ZodNumber>;
195
+ pubkey: z.ZodNonOptional<z.ZodString>;
196
+ tags: z.ZodNonOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
197
+ content: z.ZodNonOptional<z.ZodString>;
198
+ created_at: z.ZodNonOptional<z.ZodNumber>;
199
+ sig: z.ZodNonOptional<z.ZodString>;
200
+ }, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"OK">, z.ZodString, z.ZodBoolean, z.ZodString], null>, z.ZodTuple<[z.ZodLiteral<"EOSE">, z.ZodString], null>, z.ZodTuple<[z.ZodLiteral<"NOTICE">, z.ZodString], null>, z.ZodTuple<[z.ZodLiteral<"CLOSED">, z.ZodString, z.ZodString], null>, z.ZodTuple<[z.ZodLiteral<"AUTH">, z.ZodString], null>, z.ZodTuple<[z.ZodLiteral<"COUNT">, z.ZodString, z.ZodObject<{
201
+ count: z.ZodNumber;
202
+ approximate: z.ZodOptional<z.ZodBoolean>;
203
+ }, z.core.$strip>], null>]>;
57
204
  /** Kind 0 content schema. */
58
- static metadata(): z.ZodType<NostrMetadata>;
205
+ static metadata(): z.ZodObject<{
206
+ about: z.ZodCatch<z.ZodOptional<z.ZodString>>;
207
+ banner: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
208
+ bot: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
209
+ display_name: z.ZodCatch<z.ZodOptional<z.ZodString>>;
210
+ lud06: z.ZodCatch<z.ZodOptional<z.ZodString>>;
211
+ lud16: z.ZodCatch<z.ZodOptional<z.ZodEmail>>;
212
+ name: z.ZodCatch<z.ZodOptional<z.ZodString>>;
213
+ nip05: z.ZodCatch<z.ZodOptional<z.ZodEmail>>;
214
+ picture: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
215
+ website: z.ZodCatch<z.ZodOptional<z.ZodURL>>;
216
+ }, z.core.$loose>;
59
217
  /** NIP-46 request content schema. */
60
- static connectRequest(): z.ZodType<NostrConnectRequest>;
218
+ static connectRequest(): z.ZodObject<{
219
+ id: z.ZodString;
220
+ method: z.ZodString;
221
+ params: z.ZodArray<z.ZodString>;
222
+ }, z.core.$strip>;
61
223
  /** NIP-46 response content schema. */
62
- static connectResponse(): z.ZodType<NostrConnectResponse>;
224
+ static connectResponse(): z.ZodObject<{
225
+ id: z.ZodString;
226
+ result: z.ZodString;
227
+ error: z.ZodOptional<z.ZodString>;
228
+ }, z.core.$strip>;
63
229
  /**
64
230
  * Helper schema to parse a JSON string. It should then be piped into another schema. For example:
65
231
  *
@@ -67,7 +233,7 @@ declare class NSchema {
67
233
  * const event = NSchema.json().pipe(NSchema.event()).parse(data);
68
234
  * ```
69
235
  */
70
- static json(): z.ZodType<unknown>;
236
+ static json(): z.ZodPipe<z.ZodString, z.ZodTransform<unknown, string>>;
71
237
  }
72
238
  export { NSchema, z };
73
239
  //# sourceMappingURL=NSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NSchema.d.ts","sourceRoot":"","sources":["../NSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;GAWG;AACH,cAAM,OAAO;IACX,sEAAsE;IACtE,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,SAAS;IAIxB,0BAA0B;IAC1B,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAoBrC,2BAA2B;IAC3B,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IA8BvC;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,MAA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3C,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUhB,mDAAmD;IACnD,MAAM,CAAC,UAAU;;;;;;;;;IAQjB,gDAAgD;IAChD,MAAM,CAAC,OAAO;IASd,kDAAkD;IAClD,MAAM,CAAC,SAAS;IAIhB,oDAAoD;IACpD,MAAM,CAAC,WAAW;IAIlB,oDAAoD;IACpD,MAAM,CAAC,WAAW;IAQlB,kDAAkD;IAClD,MAAM,CAAC,SAAS;IAIhB,mDAAmD;IACnD,MAAM,CAAC,UAAU;;;;IAWjB,2CAA2C;IAC3C,MAAM,CAAC,QAAQ;;;;;;;;;;;;IAYf,6BAA6B;IAC7B,MAAM,CAAC,QAAQ;;;;;;;;;;;;IAef,qCAAqC;IACrC,MAAM,CAAC,cAAc;;;;;IAQrB,sCAAsC;IACtC,MAAM,CAAC,eAAe;;;;;IAQtB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI;CAUZ;AAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC"}
package/dist/NSchema.js CHANGED
@@ -26,7 +26,7 @@ class NSchema {
26
26
  }
27
27
  /** Nostr filter schema. */
28
28
  static filter() {
29
- return z.object({
29
+ return z.looseObject({
30
30
  kinds: z.number().int().nonnegative().array().optional(),
31
31
  ids: NSchema.id().array().optional(),
32
32
  authors: NSchema.id().array().optional(),
@@ -34,7 +34,7 @@ class NSchema {
34
34
  until: z.number().int().nonnegative().optional(),
35
35
  limit: z.number().int().nonnegative().optional(),
36
36
  search: z.string().optional()
37
- }).passthrough().transform((value) => {
37
+ }).transform((value) => {
38
38
  const keys = [
39
39
  "kinds",
40
40
  "ids",
@@ -63,7 +63,7 @@ class NSchema {
63
63
  }
64
64
  /** WebSocket URL starting with `ws://` or `wss://`. */
65
65
  static relayUrl() {
66
- return z.string().url().regex(/^wss?:\/\//);
66
+ return z.url().regex(/^wss?:\/\//);
67
67
  }
68
68
  /** NIP-01 `EVENT` message from client to relay. */
69
69
  static clientEVENT() {
@@ -163,18 +163,18 @@ class NSchema {
163
163
  }
164
164
  /** Kind 0 content schema. */
165
165
  static metadata() {
166
- return z.object({
166
+ return z.looseObject({
167
167
  about: z.string().optional().catch(void 0),
168
- banner: z.string().url().optional().catch(void 0),
168
+ banner: z.url().optional().catch(void 0),
169
169
  bot: z.boolean().optional().catch(void 0),
170
170
  display_name: z.string().optional().catch(void 0),
171
171
  lud06: NSchema.bech32("lnurl").optional().catch(void 0),
172
- lud16: z.string().email().optional().catch(void 0),
172
+ lud16: z.email().optional().catch(void 0),
173
173
  name: z.string().optional().catch(void 0),
174
- nip05: z.string().email().optional().catch(void 0),
175
- picture: z.string().url().optional().catch(void 0),
176
- website: z.string().url().optional().catch(void 0)
177
- }).passthrough();
174
+ nip05: z.email().optional().catch(void 0),
175
+ picture: z.url().optional().catch(void 0),
176
+ website: z.url().optional().catch(void 0)
177
+ });
178
178
  }
179
179
  /** NIP-46 request content schema. */
180
180
  static connectRequest() {
@@ -203,7 +203,7 @@ class NSchema {
203
203
  return z.string().transform((value, ctx) => {
204
204
  try {
205
205
  return JSON.parse(value);
206
- } catch (_e) {
206
+ } catch {
207
207
  ctx.addIssue({ code: z.ZodIssueCode.custom, message: "Invalid JSON" });
208
208
  return z.NEVER;
209
209
  }