@llun/activities.schema 0.2.8 → 0.2.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.
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HashTag = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.HashTag = zod_1.z.object({
6
+ type: zod_1.z.literal("Hashtag"),
7
+ href: zod_1.z.string().url(),
8
+ name: zod_1.z.string().startsWith("#"),
9
+ });
@@ -4,4 +4,5 @@ exports.Tag = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const emoji_js_1 = require("./emoji.js");
6
6
  const mention_js_1 = require("./mention.js");
7
- exports.Tag = zod_1.z.union([mention_js_1.Mention, emoji_js_1.Emoji]);
7
+ const hashtag_js_1 = require("./hashtag.js");
8
+ exports.Tag = zod_1.z.union([mention_js_1.Mention, emoji_js_1.Emoji, hashtag_js_1.HashTag]);
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export const HashTag = z.object({
3
+ type: z.literal("Hashtag"),
4
+ href: z.string().url(),
5
+ name: z.string().startsWith("#"),
6
+ });
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { Emoji } from "./emoji.js";
3
3
  import { Mention } from "./mention.js";
4
- export const Tag = z.union([Mention, Emoji]);
4
+ import { HashTag } from "./hashtag.js";
5
+ export const Tag = z.union([Mention, Emoji, HashTag]);
@@ -140,6 +140,18 @@ export declare const Like: z.ZodObject<{
140
140
  mediaType: string;
141
141
  url: string;
142
142
  };
143
+ }>, z.ZodObject<{
144
+ type: z.ZodLiteral<"Hashtag">;
145
+ href: z.ZodString;
146
+ name: z.ZodString;
147
+ }, "strip", z.ZodTypeAny, {
148
+ type: "Hashtag";
149
+ name: string;
150
+ href: string;
151
+ }, {
152
+ type: "Hashtag";
153
+ name: string;
154
+ href: string;
143
155
  }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
144
156
  type: z.ZodLiteral<"Mention">;
145
157
  href: z.ZodString;
@@ -187,6 +199,18 @@ export declare const Like: z.ZodObject<{
187
199
  mediaType: string;
188
200
  url: string;
189
201
  };
202
+ }>, z.ZodObject<{
203
+ type: z.ZodLiteral<"Hashtag">;
204
+ href: z.ZodString;
205
+ name: z.ZodString;
206
+ }, "strip", z.ZodTypeAny, {
207
+ type: "Hashtag";
208
+ name: string;
209
+ href: string;
210
+ }, {
211
+ type: "Hashtag";
212
+ name: string;
213
+ href: string;
190
214
  }>]>, "many">]>;
191
215
  published: z.ZodString;
192
216
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -213,6 +237,10 @@ export declare const Like: z.ZodObject<{
213
237
  type: "Mention";
214
238
  name: string;
215
239
  href: string;
240
+ } | {
241
+ type: "Hashtag";
242
+ name: string;
243
+ href: string;
216
244
  } | ({
217
245
  type: "Emoji";
218
246
  name: string;
@@ -226,6 +254,10 @@ export declare const Like: z.ZodObject<{
226
254
  type: "Mention";
227
255
  name: string;
228
256
  href: string;
257
+ } | {
258
+ type: "Hashtag";
259
+ name: string;
260
+ href: string;
229
261
  })[];
230
262
  updated?: string | null | undefined;
231
263
  inReplyTo?: string | null | undefined;
@@ -281,6 +313,10 @@ export declare const Like: z.ZodObject<{
281
313
  type: "Mention";
282
314
  name: string;
283
315
  href: string;
316
+ } | {
317
+ type: "Hashtag";
318
+ name: string;
319
+ href: string;
284
320
  } | ({
285
321
  type: "Emoji";
286
322
  name: string;
@@ -294,6 +330,10 @@ export declare const Like: z.ZodObject<{
294
330
  type: "Mention";
295
331
  name: string;
296
332
  href: string;
333
+ } | {
334
+ type: "Hashtag";
335
+ name: string;
336
+ href: string;
297
337
  })[];
298
338
  updated?: string | null | undefined;
299
339
  inReplyTo?: string | null | undefined;
@@ -351,6 +391,10 @@ export declare const Like: z.ZodObject<{
351
391
  type: "Mention";
352
392
  name: string;
353
393
  href: string;
394
+ } | {
395
+ type: "Hashtag";
396
+ name: string;
397
+ href: string;
354
398
  } | ({
355
399
  type: "Emoji";
356
400
  name: string;
@@ -364,6 +408,10 @@ export declare const Like: z.ZodObject<{
364
408
  type: "Mention";
365
409
  name: string;
366
410
  href: string;
411
+ } | {
412
+ type: "Hashtag";
413
+ name: string;
414
+ href: string;
367
415
  })[];
368
416
  updated?: string | null | undefined;
369
417
  inReplyTo?: string | null | undefined;
@@ -424,6 +472,10 @@ export declare const Like: z.ZodObject<{
424
472
  type: "Mention";
425
473
  name: string;
426
474
  href: string;
475
+ } | {
476
+ type: "Hashtag";
477
+ name: string;
478
+ href: string;
427
479
  } | ({
428
480
  type: "Emoji";
429
481
  name: string;
@@ -437,6 +489,10 @@ export declare const Like: z.ZodObject<{
437
489
  type: "Mention";
438
490
  name: string;
439
491
  href: string;
492
+ } | {
493
+ type: "Hashtag";
494
+ name: string;
495
+ href: string;
440
496
  })[];
441
497
  updated?: string | null | undefined;
442
498
  inReplyTo?: string | null | undefined;
@@ -136,6 +136,18 @@ export declare const BaseContent: z.ZodObject<{
136
136
  mediaType: string;
137
137
  url: string;
138
138
  };
139
+ }>, z.ZodObject<{
140
+ type: z.ZodLiteral<"Hashtag">;
141
+ href: z.ZodString;
142
+ name: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ type: "Hashtag";
145
+ name: string;
146
+ href: string;
147
+ }, {
148
+ type: "Hashtag";
149
+ name: string;
150
+ href: string;
139
151
  }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
140
152
  type: z.ZodLiteral<"Mention">;
141
153
  href: z.ZodString;
@@ -183,6 +195,18 @@ export declare const BaseContent: z.ZodObject<{
183
195
  mediaType: string;
184
196
  url: string;
185
197
  };
198
+ }>, z.ZodObject<{
199
+ type: z.ZodLiteral<"Hashtag">;
200
+ href: z.ZodString;
201
+ name: z.ZodString;
202
+ }, "strip", z.ZodTypeAny, {
203
+ type: "Hashtag";
204
+ name: string;
205
+ href: string;
206
+ }, {
207
+ type: "Hashtag";
208
+ name: string;
209
+ href: string;
186
210
  }>]>, "many">]>;
187
211
  published: z.ZodString;
188
212
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -206,6 +230,10 @@ export declare const BaseContent: z.ZodObject<{
206
230
  type: "Mention";
207
231
  name: string;
208
232
  href: string;
233
+ } | {
234
+ type: "Hashtag";
235
+ name: string;
236
+ href: string;
209
237
  } | ({
210
238
  type: "Emoji";
211
239
  name: string;
@@ -219,6 +247,10 @@ export declare const BaseContent: z.ZodObject<{
219
247
  type: "Mention";
220
248
  name: string;
221
249
  href: string;
250
+ } | {
251
+ type: "Hashtag";
252
+ name: string;
253
+ href: string;
222
254
  })[];
223
255
  updated?: string | null | undefined;
224
256
  inReplyTo?: string | null | undefined;
@@ -273,6 +305,10 @@ export declare const BaseContent: z.ZodObject<{
273
305
  type: "Mention";
274
306
  name: string;
275
307
  href: string;
308
+ } | {
309
+ type: "Hashtag";
310
+ name: string;
311
+ href: string;
276
312
  } | ({
277
313
  type: "Emoji";
278
314
  name: string;
@@ -286,6 +322,10 @@ export declare const BaseContent: z.ZodObject<{
286
322
  type: "Mention";
287
323
  name: string;
288
324
  href: string;
325
+ } | {
326
+ type: "Hashtag";
327
+ name: string;
328
+ href: string;
289
329
  })[];
290
330
  updated?: string | null | undefined;
291
331
  inReplyTo?: string | null | undefined;
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ export declare const HashTag: z.ZodObject<{
3
+ type: z.ZodLiteral<"Hashtag">;
4
+ href: z.ZodString;
5
+ name: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ type: "Hashtag";
8
+ name: string;
9
+ href: string;
10
+ }, {
11
+ type: "Hashtag";
12
+ name: string;
13
+ href: string;
14
+ }>;
15
+ export type HashTag = z.infer<typeof HashTag>;
@@ -46,5 +46,17 @@ export declare const Tag: z.ZodUnion<[z.ZodObject<{
46
46
  mediaType: string;
47
47
  url: string;
48
48
  };
49
+ }>, z.ZodObject<{
50
+ type: z.ZodLiteral<"Hashtag">;
51
+ href: z.ZodString;
52
+ name: z.ZodString;
53
+ }, "strip", z.ZodTypeAny, {
54
+ type: "Hashtag";
55
+ name: string;
56
+ href: string;
57
+ }, {
58
+ type: "Hashtag";
59
+ name: string;
60
+ href: string;
49
61
  }>]>;
50
62
  export type Tag = z.infer<typeof Tag>;
@@ -136,6 +136,18 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
136
136
  mediaType: string;
137
137
  url: string;
138
138
  };
139
+ }>, z.ZodObject<{
140
+ type: z.ZodLiteral<"Hashtag">;
141
+ href: z.ZodString;
142
+ name: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ type: "Hashtag";
145
+ name: string;
146
+ href: string;
147
+ }, {
148
+ type: "Hashtag";
149
+ name: string;
150
+ href: string;
139
151
  }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
140
152
  type: z.ZodLiteral<"Mention">;
141
153
  href: z.ZodString;
@@ -183,6 +195,18 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
183
195
  mediaType: string;
184
196
  url: string;
185
197
  };
198
+ }>, z.ZodObject<{
199
+ type: z.ZodLiteral<"Hashtag">;
200
+ href: z.ZodString;
201
+ name: z.ZodString;
202
+ }, "strip", z.ZodTypeAny, {
203
+ type: "Hashtag";
204
+ name: string;
205
+ href: string;
206
+ }, {
207
+ type: "Hashtag";
208
+ name: string;
209
+ href: string;
186
210
  }>]>, "many">]>;
187
211
  published: z.ZodString;
188
212
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -209,6 +233,10 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
209
233
  type: "Mention";
210
234
  name: string;
211
235
  href: string;
236
+ } | {
237
+ type: "Hashtag";
238
+ name: string;
239
+ href: string;
212
240
  } | ({
213
241
  type: "Emoji";
214
242
  name: string;
@@ -222,6 +250,10 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
222
250
  type: "Mention";
223
251
  name: string;
224
252
  href: string;
253
+ } | {
254
+ type: "Hashtag";
255
+ name: string;
256
+ href: string;
225
257
  })[];
226
258
  updated?: string | null | undefined;
227
259
  inReplyTo?: string | null | undefined;
@@ -277,6 +309,10 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
277
309
  type: "Mention";
278
310
  name: string;
279
311
  href: string;
312
+ } | {
313
+ type: "Hashtag";
314
+ name: string;
315
+ href: string;
280
316
  } | ({
281
317
  type: "Emoji";
282
318
  name: string;
@@ -290,6 +326,10 @@ export declare const Note: z.ZodObject<z.objectUtil.extendShape<{
290
326
  type: "Mention";
291
327
  name: string;
292
328
  href: string;
329
+ } | {
330
+ type: "Hashtag";
331
+ name: string;
332
+ href: string;
293
333
  })[];
294
334
  updated?: string | null | undefined;
295
335
  inReplyTo?: string | null | undefined;
@@ -144,6 +144,18 @@ export declare const Undo: z.ZodObject<{
144
144
  mediaType: string;
145
145
  url: string;
146
146
  };
147
+ }>, z.ZodObject<{
148
+ type: z.ZodLiteral<"Hashtag">;
149
+ href: z.ZodString;
150
+ name: z.ZodString;
151
+ }, "strip", z.ZodTypeAny, {
152
+ type: "Hashtag";
153
+ name: string;
154
+ href: string;
155
+ }, {
156
+ type: "Hashtag";
157
+ name: string;
158
+ href: string;
147
159
  }>]>, z.ZodArray<z.ZodUnion<[z.ZodObject<{
148
160
  type: z.ZodLiteral<"Mention">;
149
161
  href: z.ZodString;
@@ -191,6 +203,18 @@ export declare const Undo: z.ZodObject<{
191
203
  mediaType: string;
192
204
  url: string;
193
205
  };
206
+ }>, z.ZodObject<{
207
+ type: z.ZodLiteral<"Hashtag">;
208
+ href: z.ZodString;
209
+ name: z.ZodString;
210
+ }, "strip", z.ZodTypeAny, {
211
+ type: "Hashtag";
212
+ name: string;
213
+ href: string;
214
+ }, {
215
+ type: "Hashtag";
216
+ name: string;
217
+ href: string;
194
218
  }>]>, "many">]>;
195
219
  published: z.ZodString;
196
220
  updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -217,6 +241,10 @@ export declare const Undo: z.ZodObject<{
217
241
  type: "Mention";
218
242
  name: string;
219
243
  href: string;
244
+ } | {
245
+ type: "Hashtag";
246
+ name: string;
247
+ href: string;
220
248
  } | ({
221
249
  type: "Emoji";
222
250
  name: string;
@@ -230,6 +258,10 @@ export declare const Undo: z.ZodObject<{
230
258
  type: "Mention";
231
259
  name: string;
232
260
  href: string;
261
+ } | {
262
+ type: "Hashtag";
263
+ name: string;
264
+ href: string;
233
265
  })[];
234
266
  updated?: string | null | undefined;
235
267
  inReplyTo?: string | null | undefined;
@@ -285,6 +317,10 @@ export declare const Undo: z.ZodObject<{
285
317
  type: "Mention";
286
318
  name: string;
287
319
  href: string;
320
+ } | {
321
+ type: "Hashtag";
322
+ name: string;
323
+ href: string;
288
324
  } | ({
289
325
  type: "Emoji";
290
326
  name: string;
@@ -298,6 +334,10 @@ export declare const Undo: z.ZodObject<{
298
334
  type: "Mention";
299
335
  name: string;
300
336
  href: string;
337
+ } | {
338
+ type: "Hashtag";
339
+ name: string;
340
+ href: string;
301
341
  })[];
302
342
  updated?: string | null | undefined;
303
343
  inReplyTo?: string | null | undefined;
@@ -355,6 +395,10 @@ export declare const Undo: z.ZodObject<{
355
395
  type: "Mention";
356
396
  name: string;
357
397
  href: string;
398
+ } | {
399
+ type: "Hashtag";
400
+ name: string;
401
+ href: string;
358
402
  } | ({
359
403
  type: "Emoji";
360
404
  name: string;
@@ -368,6 +412,10 @@ export declare const Undo: z.ZodObject<{
368
412
  type: "Mention";
369
413
  name: string;
370
414
  href: string;
415
+ } | {
416
+ type: "Hashtag";
417
+ name: string;
418
+ href: string;
371
419
  })[];
372
420
  updated?: string | null | undefined;
373
421
  inReplyTo?: string | null | undefined;
@@ -428,6 +476,10 @@ export declare const Undo: z.ZodObject<{
428
476
  type: "Mention";
429
477
  name: string;
430
478
  href: string;
479
+ } | {
480
+ type: "Hashtag";
481
+ name: string;
482
+ href: string;
431
483
  } | ({
432
484
  type: "Emoji";
433
485
  name: string;
@@ -441,6 +493,10 @@ export declare const Undo: z.ZodObject<{
441
493
  type: "Mention";
442
494
  name: string;
443
495
  href: string;
496
+ } | {
497
+ type: "Hashtag";
498
+ name: string;
499
+ href: string;
444
500
  })[];
445
501
  updated?: string | null | undefined;
446
502
  inReplyTo?: string | null | undefined;
@@ -523,6 +579,10 @@ export declare const Undo: z.ZodObject<{
523
579
  type: "Mention";
524
580
  name: string;
525
581
  href: string;
582
+ } | {
583
+ type: "Hashtag";
584
+ name: string;
585
+ href: string;
526
586
  } | ({
527
587
  type: "Emoji";
528
588
  name: string;
@@ -536,6 +596,10 @@ export declare const Undo: z.ZodObject<{
536
596
  type: "Mention";
537
597
  name: string;
538
598
  href: string;
599
+ } | {
600
+ type: "Hashtag";
601
+ name: string;
602
+ href: string;
539
603
  })[];
540
604
  updated?: string | null | undefined;
541
605
  inReplyTo?: string | null | undefined;
@@ -606,6 +670,10 @@ export declare const Undo: z.ZodObject<{
606
670
  type: "Mention";
607
671
  name: string;
608
672
  href: string;
673
+ } | {
674
+ type: "Hashtag";
675
+ name: string;
676
+ href: string;
609
677
  } | ({
610
678
  type: "Emoji";
611
679
  name: string;
@@ -619,6 +687,10 @@ export declare const Undo: z.ZodObject<{
619
687
  type: "Mention";
620
688
  name: string;
621
689
  href: string;
690
+ } | {
691
+ type: "Hashtag";
692
+ name: string;
693
+ href: string;
622
694
  })[];
623
695
  updated?: string | null | undefined;
624
696
  inReplyTo?: string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llun/activities.schema",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Validate ActivityPub and Mastodon with Zod",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+
3
+ export const HashTag = z.object({
4
+ type: z.literal("Hashtag"),
5
+ href: z.string().url(),
6
+ name: z.string().startsWith("#"),
7
+ });
8
+
9
+ export type HashTag = z.infer<typeof HashTag>;
package/src/note/tag.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { Emoji } from "./emoji.js";
3
3
  import { Mention } from "./mention.js";
4
+ import { HashTag } from "./hashtag.js";
4
5
 
5
- export const Tag = z.union([Mention, Emoji]);
6
+ export const Tag = z.union([Mention, Emoji, HashTag]);
6
7
  export type Tag = z.infer<typeof Tag>;