@llun/activities.schema 0.0.7 → 0.0.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.
Binary file
package/dist/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from "./like.js";
4
4
  export * from "./note.js";
5
5
  export * from "./reject.js";
6
6
  export * from "./undo.js";
7
+ export * as Mastodon from "./mastodon/index.js";
package/dist/index.js CHANGED
@@ -4,3 +4,4 @@ export * from "./like.js";
4
4
  export * from "./note.js";
5
5
  export * from "./reject.js";
6
6
  export * from "./undo.js";
7
+ export * as Mastodon from "./mastodon/index.js";
package/dist/like.d.ts CHANGED
@@ -3,10 +3,9 @@ export declare const Like: z.ZodObject<{
3
3
  type: z.ZodLiteral<"Like">;
4
4
  id: z.ZodString;
5
5
  actor: z.ZodString;
6
- object: z.ZodUnion<[z.ZodString, z.ZodObject<{
6
+ object: z.ZodUnion<[z.ZodString, z.ZodObject<z.objectUtil.extendShape<{
7
7
  id: z.ZodString;
8
8
  url: z.ZodString;
9
- updated: z.ZodOptional<z.ZodString>;
10
9
  attributedTo: z.ZodString;
11
10
  to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
12
11
  cc: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
@@ -143,14 +142,16 @@ export declare const Like: z.ZodObject<{
143
142
  };
144
143
  }>]>, "many">;
145
144
  published: z.ZodString;
145
+ updated: z.ZodOptional<z.ZodString>;
146
+ }, {
146
147
  type: z.ZodLiteral<"Note">;
147
- }, "strip", z.ZodTypeAny, {
148
+ }>, "strip", z.ZodTypeAny, {
148
149
  id: string;
149
150
  type: "Note";
150
151
  url: string;
151
152
  attributedTo: string;
152
- to: (string | string[]) & (string | string[] | undefined);
153
- cc: (string | string[]) & (string | string[] | undefined);
153
+ to: string | string[];
154
+ cc: string | string[];
154
155
  inReplyTo: string | null;
155
156
  tag: ({
156
157
  type: "Emoji";
@@ -204,8 +205,8 @@ export declare const Like: z.ZodObject<{
204
205
  type: "Note";
205
206
  url: string;
206
207
  attributedTo: string;
207
- to: (string | string[]) & (string | string[] | undefined);
208
- cc: (string | string[]) & (string | string[] | undefined);
208
+ to: string | string[];
209
+ cc: string | string[];
209
210
  inReplyTo: string | null;
210
211
  tag: ({
211
212
  type: "Emoji";
@@ -256,13 +257,13 @@ export declare const Like: z.ZodObject<{
256
257
  })[] | undefined;
257
258
  }>]>;
258
259
  }, "strip", z.ZodTypeAny, {
259
- object: (string | {
260
+ object: string | {
260
261
  id: string;
261
262
  type: "Note";
262
263
  url: string;
263
264
  attributedTo: string;
264
- to: (string | string[]) & (string | string[] | undefined);
265
- cc: (string | string[]) & (string | string[] | undefined);
265
+ to: string | string[];
266
+ cc: string | string[];
266
267
  inReplyTo: string | null;
267
268
  tag: ({
268
269
  type: "Emoji";
@@ -311,128 +312,18 @@ export declare const Like: z.ZodObject<{
311
312
  value: string;
312
313
  name: string;
313
314
  })[] | undefined;
314
- }) & (string | {
315
- id: string;
316
- type: "Note";
317
- url: string;
318
- attributedTo: string;
319
- to: (string | string[]) & (string | string[] | undefined);
320
- cc: (string | string[]) & (string | string[] | undefined);
321
- inReplyTo: string | null;
322
- tag: ({
323
- type: "Emoji";
324
- name: string;
325
- updated: string;
326
- icon: {
327
- type: "Image";
328
- mediaType: string;
329
- url: string;
330
- };
331
- } | {
332
- type: "Mention";
333
- name: string;
334
- href: string;
335
- })[];
336
- published: string;
337
- updated?: string | undefined;
338
- summary?: string | undefined;
339
- summaryMap?: Record<string, string> | undefined;
340
- content?: string | undefined;
341
- contentMap?: Record<string, string> | undefined;
342
- attachment?: {
343
- type: "Document";
344
- mediaType: string;
345
- url: string;
346
- blurhash?: string | undefined;
347
- width?: number | undefined;
348
- height?: number | undefined;
349
- name?: string | null | undefined;
350
- focalPoint?: [number, number] | undefined;
351
- } | {
352
- type: "PropertyValue";
353
- value: string;
354
- name: string;
355
- } | ({
356
- type: "Document";
357
- mediaType: string;
358
- url: string;
359
- blurhash?: string | undefined;
360
- width?: number | undefined;
361
- height?: number | undefined;
362
- name?: string | null | undefined;
363
- focalPoint?: [number, number] | undefined;
364
- } | {
365
- type: "PropertyValue";
366
- value: string;
367
- name: string;
368
- })[] | undefined;
369
- } | undefined);
315
+ };
370
316
  id: string;
371
317
  type: "Like";
372
318
  actor: string;
373
319
  }, {
374
- object: (string | {
375
- id: string;
376
- type: "Note";
377
- url: string;
378
- attributedTo: string;
379
- to: (string | string[]) & (string | string[] | undefined);
380
- cc: (string | string[]) & (string | string[] | undefined);
381
- inReplyTo: string | null;
382
- tag: ({
383
- type: "Emoji";
384
- name: string;
385
- updated: string;
386
- icon: {
387
- type: "Image";
388
- mediaType: string;
389
- url: string;
390
- };
391
- } | {
392
- type: "Mention";
393
- name: string;
394
- href: string;
395
- })[];
396
- published: string;
397
- updated?: string | undefined;
398
- summary?: string | undefined;
399
- summaryMap?: Record<string, string> | undefined;
400
- content?: string | undefined;
401
- contentMap?: Record<string, string> | undefined;
402
- attachment?: {
403
- type: "Document";
404
- mediaType: string;
405
- url: string;
406
- blurhash?: string | undefined;
407
- width?: number | undefined;
408
- height?: number | undefined;
409
- name?: string | null | undefined;
410
- focalPoint?: [number, number] | undefined;
411
- } | {
412
- type: "PropertyValue";
413
- value: string;
414
- name: string;
415
- } | ({
416
- type: "Document";
417
- mediaType: string;
418
- url: string;
419
- blurhash?: string | undefined;
420
- width?: number | undefined;
421
- height?: number | undefined;
422
- name?: string | null | undefined;
423
- focalPoint?: [number, number] | undefined;
424
- } | {
425
- type: "PropertyValue";
426
- value: string;
427
- name: string;
428
- })[] | undefined;
429
- }) & (string | {
320
+ object: string | {
430
321
  id: string;
431
322
  type: "Note";
432
323
  url: string;
433
324
  attributedTo: string;
434
- to: (string | string[]) & (string | string[] | undefined);
435
- cc: (string | string[]) & (string | string[] | undefined);
325
+ to: string | string[];
326
+ cc: string | string[];
436
327
  inReplyTo: string | null;
437
328
  tag: ({
438
329
  type: "Emoji";
@@ -481,7 +372,7 @@ export declare const Like: z.ZodObject<{
481
372
  value: string;
482
373
  name: string;
483
374
  })[] | undefined;
484
- } | undefined);
375
+ };
485
376
  id: string;
486
377
  type: "Like";
487
378
  actor: string;
@@ -0,0 +1,327 @@
1
+ import { z } from "zod";
2
+ export declare const Account: z.ZodObject<z.objectUtil.extendShape<{
3
+ id: z.ZodString;
4
+ username: z.ZodString;
5
+ acct: z.ZodString;
6
+ url: z.ZodString;
7
+ display_name: z.ZodString;
8
+ note: z.ZodString;
9
+ avatar: z.ZodString;
10
+ avatar_static: z.ZodString;
11
+ header: z.ZodString;
12
+ header_static: z.ZodString;
13
+ loacked: z.ZodString;
14
+ fields: z.ZodArray<z.ZodObject<{
15
+ name: z.ZodString;
16
+ value: z.ZodString;
17
+ verified_at: z.ZodNullable<z.ZodString>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ value: string;
20
+ name: string;
21
+ verified_at: string | null;
22
+ }, {
23
+ value: string;
24
+ name: string;
25
+ verified_at: string | null;
26
+ }>, "many">;
27
+ emojis: z.ZodArray<z.ZodObject<{
28
+ shortcode: z.ZodString;
29
+ static_url: z.ZodString;
30
+ url: z.ZodString;
31
+ visible_in_picker: z.ZodBoolean;
32
+ category: z.ZodNullable<z.ZodString>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ url: string;
35
+ shortcode: string;
36
+ static_url: string;
37
+ visible_in_picker: boolean;
38
+ category: string | null;
39
+ }, {
40
+ url: string;
41
+ shortcode: string;
42
+ static_url: string;
43
+ visible_in_picker: boolean;
44
+ category: string | null;
45
+ }>, "many">;
46
+ bot: z.ZodBoolean;
47
+ group: z.ZodBoolean;
48
+ discoverable: z.ZodNullable<z.ZodBoolean>;
49
+ noindex: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
50
+ suspended: z.ZodOptional<z.ZodBoolean>;
51
+ limited: z.ZodOptional<z.ZodBoolean>;
52
+ created_at: z.ZodString;
53
+ last_status_at: z.ZodNullable<z.ZodString>;
54
+ statuses_count: z.ZodNumber;
55
+ followers_count: z.ZodNumber;
56
+ following_count: z.ZodNumber;
57
+ }, {
58
+ moved: z.ZodNullable<z.ZodObject<{
59
+ id: z.ZodString;
60
+ username: z.ZodString;
61
+ acct: z.ZodString;
62
+ url: z.ZodString;
63
+ display_name: z.ZodString;
64
+ note: z.ZodString;
65
+ avatar: z.ZodString;
66
+ avatar_static: z.ZodString;
67
+ header: z.ZodString;
68
+ header_static: z.ZodString;
69
+ loacked: z.ZodString;
70
+ fields: z.ZodArray<z.ZodObject<{
71
+ name: z.ZodString;
72
+ value: z.ZodString;
73
+ verified_at: z.ZodNullable<z.ZodString>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ value: string;
76
+ name: string;
77
+ verified_at: string | null;
78
+ }, {
79
+ value: string;
80
+ name: string;
81
+ verified_at: string | null;
82
+ }>, "many">;
83
+ emojis: z.ZodArray<z.ZodObject<{
84
+ shortcode: z.ZodString;
85
+ static_url: z.ZodString;
86
+ url: z.ZodString;
87
+ visible_in_picker: z.ZodBoolean;
88
+ category: z.ZodNullable<z.ZodString>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ url: string;
91
+ shortcode: string;
92
+ static_url: string;
93
+ visible_in_picker: boolean;
94
+ category: string | null;
95
+ }, {
96
+ url: string;
97
+ shortcode: string;
98
+ static_url: string;
99
+ visible_in_picker: boolean;
100
+ category: string | null;
101
+ }>, "many">;
102
+ bot: z.ZodBoolean;
103
+ group: z.ZodBoolean;
104
+ discoverable: z.ZodNullable<z.ZodBoolean>;
105
+ noindex: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
106
+ suspended: z.ZodOptional<z.ZodBoolean>;
107
+ limited: z.ZodOptional<z.ZodBoolean>;
108
+ created_at: z.ZodString;
109
+ last_status_at: z.ZodNullable<z.ZodString>;
110
+ statuses_count: z.ZodNumber;
111
+ followers_count: z.ZodNumber;
112
+ following_count: z.ZodNumber;
113
+ }, "strip", z.ZodTypeAny, {
114
+ id: string;
115
+ url: string;
116
+ username: string;
117
+ acct: string;
118
+ display_name: string;
119
+ note: string;
120
+ avatar: string;
121
+ avatar_static: string;
122
+ header: string;
123
+ header_static: string;
124
+ loacked: string;
125
+ fields: {
126
+ value: string;
127
+ name: string;
128
+ verified_at: string | null;
129
+ }[];
130
+ emojis: {
131
+ url: string;
132
+ shortcode: string;
133
+ static_url: string;
134
+ visible_in_picker: boolean;
135
+ category: string | null;
136
+ }[];
137
+ bot: boolean;
138
+ group: boolean;
139
+ discoverable: boolean | null;
140
+ created_at: string;
141
+ last_status_at: string | null;
142
+ statuses_count: number;
143
+ followers_count: number;
144
+ following_count: number;
145
+ noindex?: boolean | null | undefined;
146
+ suspended?: boolean | undefined;
147
+ limited?: boolean | undefined;
148
+ }, {
149
+ id: string;
150
+ url: string;
151
+ username: string;
152
+ acct: string;
153
+ display_name: string;
154
+ note: string;
155
+ avatar: string;
156
+ avatar_static: string;
157
+ header: string;
158
+ header_static: string;
159
+ loacked: string;
160
+ fields: {
161
+ value: string;
162
+ name: string;
163
+ verified_at: string | null;
164
+ }[];
165
+ emojis: {
166
+ url: string;
167
+ shortcode: string;
168
+ static_url: string;
169
+ visible_in_picker: boolean;
170
+ category: string | null;
171
+ }[];
172
+ bot: boolean;
173
+ group: boolean;
174
+ discoverable: boolean | null;
175
+ created_at: string;
176
+ last_status_at: string | null;
177
+ statuses_count: number;
178
+ followers_count: number;
179
+ following_count: number;
180
+ noindex?: boolean | null | undefined;
181
+ suspended?: boolean | undefined;
182
+ limited?: boolean | undefined;
183
+ }>>;
184
+ }>, "strip", z.ZodTypeAny, {
185
+ id: string;
186
+ url: string;
187
+ username: string;
188
+ acct: string;
189
+ display_name: string;
190
+ note: string;
191
+ avatar: string;
192
+ avatar_static: string;
193
+ header: string;
194
+ header_static: string;
195
+ loacked: string;
196
+ fields: {
197
+ value: string;
198
+ name: string;
199
+ verified_at: string | null;
200
+ }[];
201
+ emojis: {
202
+ url: string;
203
+ shortcode: string;
204
+ static_url: string;
205
+ visible_in_picker: boolean;
206
+ category: string | null;
207
+ }[];
208
+ bot: boolean;
209
+ group: boolean;
210
+ discoverable: boolean | null;
211
+ created_at: string;
212
+ last_status_at: string | null;
213
+ statuses_count: number;
214
+ followers_count: number;
215
+ following_count: number;
216
+ moved: {
217
+ id: string;
218
+ url: string;
219
+ username: string;
220
+ acct: string;
221
+ display_name: string;
222
+ note: string;
223
+ avatar: string;
224
+ avatar_static: string;
225
+ header: string;
226
+ header_static: string;
227
+ loacked: string;
228
+ fields: {
229
+ value: string;
230
+ name: string;
231
+ verified_at: string | null;
232
+ }[];
233
+ emojis: {
234
+ url: string;
235
+ shortcode: string;
236
+ static_url: string;
237
+ visible_in_picker: boolean;
238
+ category: string | null;
239
+ }[];
240
+ bot: boolean;
241
+ group: boolean;
242
+ discoverable: boolean | null;
243
+ created_at: string;
244
+ last_status_at: string | null;
245
+ statuses_count: number;
246
+ followers_count: number;
247
+ following_count: number;
248
+ noindex?: boolean | null | undefined;
249
+ suspended?: boolean | undefined;
250
+ limited?: boolean | undefined;
251
+ } | null;
252
+ noindex?: boolean | null | undefined;
253
+ suspended?: boolean | undefined;
254
+ limited?: boolean | undefined;
255
+ }, {
256
+ id: string;
257
+ url: string;
258
+ username: string;
259
+ acct: string;
260
+ display_name: string;
261
+ note: string;
262
+ avatar: string;
263
+ avatar_static: string;
264
+ header: string;
265
+ header_static: string;
266
+ loacked: string;
267
+ fields: {
268
+ value: string;
269
+ name: string;
270
+ verified_at: string | null;
271
+ }[];
272
+ emojis: {
273
+ url: string;
274
+ shortcode: string;
275
+ static_url: string;
276
+ visible_in_picker: boolean;
277
+ category: string | null;
278
+ }[];
279
+ bot: boolean;
280
+ group: boolean;
281
+ discoverable: boolean | null;
282
+ created_at: string;
283
+ last_status_at: string | null;
284
+ statuses_count: number;
285
+ followers_count: number;
286
+ following_count: number;
287
+ moved: {
288
+ id: string;
289
+ url: string;
290
+ username: string;
291
+ acct: string;
292
+ display_name: string;
293
+ note: string;
294
+ avatar: string;
295
+ avatar_static: string;
296
+ header: string;
297
+ header_static: string;
298
+ loacked: string;
299
+ fields: {
300
+ value: string;
301
+ name: string;
302
+ verified_at: string | null;
303
+ }[];
304
+ emojis: {
305
+ url: string;
306
+ shortcode: string;
307
+ static_url: string;
308
+ visible_in_picker: boolean;
309
+ category: string | null;
310
+ }[];
311
+ bot: boolean;
312
+ group: boolean;
313
+ discoverable: boolean | null;
314
+ created_at: string;
315
+ last_status_at: string | null;
316
+ statuses_count: number;
317
+ followers_count: number;
318
+ following_count: number;
319
+ noindex?: boolean | null | undefined;
320
+ suspended?: boolean | undefined;
321
+ limited?: boolean | undefined;
322
+ } | null;
323
+ noindex?: boolean | null | undefined;
324
+ suspended?: boolean | undefined;
325
+ limited?: boolean | undefined;
326
+ }>;
327
+ export type Account = z.infer<typeof Account>;
@@ -0,0 +1,87 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Account/
2
+ import { z } from "zod";
3
+ import { AccountField } from "./accountField.js";
4
+ import { CustomEmoji } from "./customEmoji.js";
5
+ const BaseAccount = z.object({
6
+ id: z.string({
7
+ description: "This is actor id, for Mastodon, it is a string that case from number but in Activities.next, this is URI",
8
+ }),
9
+ username: z.string({
10
+ description: "The username of the actor, not including domain",
11
+ }),
12
+ acct: z.string({
13
+ description: "The Webfinger actor URI. Equal to username for local users, or username@domain for remote users",
14
+ }),
15
+ url: z.string({
16
+ description: "The location of the user's profile page",
17
+ }),
18
+ display_name: z.string({
19
+ description: "The profile's display name",
20
+ }),
21
+ note: z.string({
22
+ description: "The profile's bio or description",
23
+ }),
24
+ avatar: z.string({
25
+ description: "An image URL icon that is shown next to statuses and in the profile",
26
+ }),
27
+ avatar_static: z.string({
28
+ description: "A static version of the `avatar`. Equal to `avatar` if its value is a static image; different if `avatar` is an animated GIF",
29
+ }),
30
+ header: z.string({
31
+ description: "An image banner URL that is shown above the profile and in profile cards.",
32
+ }),
33
+ header_static: z.string({
34
+ description: "A static version of the `header`. Equal to `header` if its value is a static image; different if `header` is an animated GIF",
35
+ }),
36
+ loacked: z.string({
37
+ description: "Whether the actor manually approves follow requests",
38
+ }),
39
+ fields: AccountField.array().describe("Additional metadata attached to a profile as name-value pairs"),
40
+ emojis: CustomEmoji.array().describe("Custom emoji entities to be used when rendering the profile"),
41
+ bot: z.boolean({
42
+ description: "Indicates that the actor may perform automated actions, may not be monitored, or identifies as a robot",
43
+ }),
44
+ group: z.boolean({
45
+ description: "Indicates that the actor represents a Group actor",
46
+ }),
47
+ discoverable: z
48
+ .boolean({
49
+ description: "Whether the actor has opted into discovery features such as the profile directory",
50
+ })
51
+ .nullable(),
52
+ noindex: z
53
+ .boolean({
54
+ description: "Whether the local user has opted out of being indexed by search engines",
55
+ })
56
+ .nullish(),
57
+ suspended: z
58
+ .boolean({
59
+ description: "An extra attribute returned only when an actor is suspended",
60
+ })
61
+ .optional(),
62
+ limited: z
63
+ .boolean({
64
+ description: "An extra attribute returned only when an actor is silenced. If true, indicates that the actor should be hidden behind a warning screen.",
65
+ })
66
+ .optional(),
67
+ created_at: z.string({
68
+ description: "The time the actor was created in ISO 8601 Datetime format",
69
+ }),
70
+ last_status_at: z
71
+ .string({
72
+ description: "The time when the most recent status was posted in ISO 8601 Datetime format",
73
+ })
74
+ .nullable(),
75
+ statuses_count: z.number({
76
+ description: "How many statuses are attached to this actor",
77
+ }),
78
+ followers_count: z.number({
79
+ description: "The reported followers of this profile",
80
+ }),
81
+ following_count: z.number({
82
+ description: "The reported follows of this profile",
83
+ }),
84
+ });
85
+ export const Account = BaseAccount.extend({
86
+ moved: BaseAccount.nullable().describe("Indicates that the profile is currently inactive and that its user has moved to a new account"),
87
+ });
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ export declare const AccountField: z.ZodObject<{
3
+ name: z.ZodString;
4
+ value: z.ZodString;
5
+ verified_at: z.ZodNullable<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ value: string;
8
+ name: string;
9
+ verified_at: string | null;
10
+ }, {
11
+ value: string;
12
+ name: string;
13
+ verified_at: string | null;
14
+ }>;
15
+ export type AccountField = z.infer<typeof AccountField>;
@@ -0,0 +1,15 @@
1
+ // This schema is base on https://docs.joinmastodon.org/entities/Account/#Field
2
+ import { z } from "zod";
3
+ export const AccountField = z.object({
4
+ name: z.string({
5
+ description: "The key of a given field’s key-value pair",
6
+ }),
7
+ value: z.string({
8
+ description: "The value associated with the `name` key.",
9
+ }),
10
+ verified_at: z
11
+ .string({
12
+ description: 'Timestamp of when the server verified a URL value for a rel="me" link in ISO 8601 Date time format',
13
+ })
14
+ .nullable(),
15
+ });
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ export declare const CustomEmoji: z.ZodObject<{
3
+ shortcode: z.ZodString;
4
+ static_url: z.ZodString;
5
+ url: z.ZodString;
6
+ visible_in_picker: z.ZodBoolean;
7
+ category: z.ZodNullable<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ url: string;
10
+ shortcode: string;
11
+ static_url: string;
12
+ visible_in_picker: boolean;
13
+ category: string | null;
14
+ }, {
15
+ url: string;
16
+ shortcode: string;
17
+ static_url: string;
18
+ visible_in_picker: boolean;
19
+ category: string | null;
20
+ }>;
21
+ export type CustomEmoji = z.infer<typeof CustomEmoji>;