@openpeepshq/common 0.13.0 → 0.15.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.
package/dist/types/api.js CHANGED
@@ -296,6 +296,9 @@ export const muteParticipantRequestSchema = z.object({
296
296
  identity: z.string().uuid(),
297
297
  trackSid: z.string(),
298
298
  });
299
+ export const removeParticipantRequestSchema = z.object({
300
+ identity: z.string().uuid(),
301
+ });
299
302
  export const guestPassRequestSchema = z.object({
300
303
  displayName: z.string().max(30),
301
304
  email: z.string().email(),
@@ -1,6 +1,16 @@
1
1
  import type { ReadableStream } from 'node:stream/web';
2
2
  import { z, ZodString, type ZodType } from 'zod';
3
3
  export declare const passwordPlaceHolder = "*********";
4
+ /**
5
+ * A post-reaction value: a non-empty emoji (or emoji sequence) string.
6
+ * Communities allow arbitrary emojis via `content.allowedReactions`, so this
7
+ * is a validated string rather than the curated enum. The schema lives here
8
+ * (not in `models.ts`) because `models.ts` already imports from this file,
9
+ * which keeps the dependency one-directional; the curated default set
10
+ * (`REACTION_TYPES`) and the `resolveAllowedReactions` helper live in
11
+ * `models.ts`, which re-exports nothing from the schema.
12
+ */
13
+ export declare const reactionEmojiSchema: z.ZodString;
4
14
  export declare const password: (sanitize?: boolean) => z.ZodString | z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
5
15
  export declare const fixed: <T extends ZodType>(type: T, sanitize?: boolean) => T;
6
16
  export declare const hidden: <T extends ZodType>(type: T) => T;
@@ -696,6 +706,7 @@ export declare const communityConfigSchemaFactory: (_sanitize?: boolean) => z.Zo
696
706
  welcomeEmail: z.ZodOptional<z.ZodString>;
697
707
  pinnedPost: z.ZodOptional<z.ZodString>;
698
708
  autoFollow: z.ZodOptional<z.ZodArray<z.ZodString>>;
709
+ allowedReactions: z.ZodOptional<z.ZodArray<z.ZodString>>;
699
710
  }, z.core.$strip>;
700
711
  settings: z.ZodObject<{
701
712
  openRegistrations: z.ZodBoolean;
@@ -779,6 +790,7 @@ export declare const communityConfigSchema: z.ZodObject<{
779
790
  welcomeEmail: z.ZodOptional<z.ZodString>;
780
791
  pinnedPost: z.ZodOptional<z.ZodString>;
781
792
  autoFollow: z.ZodOptional<z.ZodArray<z.ZodString>>;
793
+ allowedReactions: z.ZodOptional<z.ZodArray<z.ZodString>>;
782
794
  }, z.core.$strip>;
783
795
  settings: z.ZodObject<{
784
796
  openRegistrations: z.ZodBoolean;
@@ -862,6 +874,7 @@ export declare const communityConfigSanitizedSchema: z.ZodObject<{
862
874
  welcomeEmail: z.ZodOptional<z.ZodString>;
863
875
  pinnedPost: z.ZodOptional<z.ZodString>;
864
876
  autoFollow: z.ZodOptional<z.ZodArray<z.ZodString>>;
877
+ allowedReactions: z.ZodOptional<z.ZodArray<z.ZodString>>;
865
878
  }, z.core.$strip>;
866
879
  settings: z.ZodObject<{
867
880
  openRegistrations: z.ZodBoolean;
@@ -4,6 +4,16 @@ import { postCapabilities } from './capabilities.js';
4
4
  import { postRelationships } from './capabilities.js';
5
5
  import { additionalForbiddenHandlesSchema } from './forbiddenHandles.js';
6
6
  export const passwordPlaceHolder = '*********';
7
+ /**
8
+ * A post-reaction value: a non-empty emoji (or emoji sequence) string.
9
+ * Communities allow arbitrary emojis via `content.allowedReactions`, so this
10
+ * is a validated string rather than the curated enum. The schema lives here
11
+ * (not in `models.ts`) because `models.ts` already imports from this file,
12
+ * which keeps the dependency one-directional; the curated default set
13
+ * (`REACTION_TYPES`) and the `resolveAllowedReactions` helper live in
14
+ * `models.ts`, which re-exports nothing from the schema.
15
+ */
16
+ export const reactionEmojiSchema = z.string().trim().min(1).max(32);
7
17
  export const password = (sanitize) => sanitize
8
18
  ? z
9
19
  .string()
@@ -343,6 +353,13 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
343
353
  * Admin-managed via Community → Auto-follow accounts; only resolvable
344
354
  * local profiles may be designated (federated handles are rejected). */
345
355
  autoFollow: z.string().array().optional(),
356
+ /**
357
+ * Emojis members can attach to posts. Absent (or empty, the "reset"
358
+ * value) keeps the curated default set (REACTION_TYPES). Enforced at
359
+ * the write path; reactions attached before a set change stay visible
360
+ * (orphans).
361
+ */
362
+ allowedReactions: z.array(reactionEmojiSchema).max(64).optional(),
346
363
  }),
347
364
  settings: z.object({
348
365
  openRegistrations: z.boolean(),
@@ -173,6 +173,7 @@ export declare const dbNotificationSchema: z.ZodObject<{
173
173
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
174
174
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
175
175
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
176
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
176
177
  videoEnabled: z.ZodBoolean;
177
178
  type: z.ZodEnum<{
178
179
  "video-call": "video-call";
@@ -501,6 +502,7 @@ export declare const dbBasePostSchema: z.ZodObject<{
501
502
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
502
503
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
503
504
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
505
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
504
506
  videoEnabled: z.ZodBoolean;
505
507
  type: z.ZodEnum<{
506
508
  "video-call": "video-call";
@@ -847,6 +849,7 @@ export declare const dbBasePostSchema: z.ZodObject<{
847
849
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
848
850
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
849
851
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
852
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
850
853
  videoEnabled: z.ZodBoolean;
851
854
  type: z.ZodEnum<{
852
855
  "video-call": "video-call";
@@ -1538,15 +1541,7 @@ export declare const dbBasePostSchema: z.ZodObject<{
1538
1541
  replyCount: z.ZodNumber;
1539
1542
  repostCount: z.ZodNumber;
1540
1543
  reactions: z.ZodArray<z.ZodObject<{
1541
- reaction: z.ZodEnum<{
1542
- "\uD83D\uDC4D": "👍";
1543
- "\uD83D\uDC4E": "👎";
1544
- "\u2764\uFE0F": "❤️";
1545
- "\uD83D\uDE02": "😂";
1546
- "\uD83D\uDE2E": "😮";
1547
- "\uD83D\uDE22": "😢";
1548
- "\uD83C\uDF89": "🎉";
1549
- }>;
1544
+ reaction: z.ZodString;
1550
1545
  profile: z.ZodObject<{
1551
1546
  handle: z.ZodString;
1552
1547
  deletedHandle: z.ZodOptional<z.ZodString>;
@@ -1814,6 +1809,7 @@ export declare const dbBasePostSchema: z.ZodObject<{
1814
1809
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
1815
1810
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
1816
1811
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
1812
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
1817
1813
  videoEnabled: z.ZodBoolean;
1818
1814
  type: z.ZodEnum<{
1819
1815
  "video-call": "video-call";
@@ -2145,6 +2141,7 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
2145
2141
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
2146
2142
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
2147
2143
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
2144
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
2148
2145
  videoEnabled: z.ZodBoolean;
2149
2146
  type: z.ZodEnum<{
2150
2147
  "video-call": "video-call";
@@ -2491,6 +2488,7 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
2491
2488
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
2492
2489
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
2493
2490
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
2491
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
2494
2492
  videoEnabled: z.ZodBoolean;
2495
2493
  type: z.ZodEnum<{
2496
2494
  "video-call": "video-call";
@@ -3182,15 +3180,7 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
3182
3180
  replyCount: z.ZodNumber;
3183
3181
  repostCount: z.ZodNumber;
3184
3182
  reactions: z.ZodArray<z.ZodObject<{
3185
- reaction: z.ZodEnum<{
3186
- "\uD83D\uDC4D": "👍";
3187
- "\uD83D\uDC4E": "👎";
3188
- "\u2764\uFE0F": "❤️";
3189
- "\uD83D\uDE02": "😂";
3190
- "\uD83D\uDE2E": "😮";
3191
- "\uD83D\uDE22": "😢";
3192
- "\uD83C\uDF89": "🎉";
3193
- }>;
3183
+ reaction: z.ZodString;
3194
3184
  profile: z.ZodObject<{
3195
3185
  handle: z.ZodString;
3196
3186
  deletedHandle: z.ZodOptional<z.ZodString>;
@@ -3458,6 +3448,7 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
3458
3448
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
3459
3449
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
3460
3450
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
3451
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
3461
3452
  videoEnabled: z.ZodBoolean;
3462
3453
  type: z.ZodEnum<{
3463
3454
  "video-call": "video-call";
@@ -3768,6 +3759,7 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
3768
3759
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
3769
3760
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
3770
3761
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
3762
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
3771
3763
  videoEnabled: z.ZodBoolean;
3772
3764
  type: z.ZodEnum<{
3773
3765
  "video-call": "video-call";
@@ -4114,6 +4106,7 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
4114
4106
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
4115
4107
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
4116
4108
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
4109
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
4117
4110
  videoEnabled: z.ZodBoolean;
4118
4111
  type: z.ZodEnum<{
4119
4112
  "video-call": "video-call";
@@ -4805,15 +4798,7 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
4805
4798
  replyCount: z.ZodNumber;
4806
4799
  repostCount: z.ZodNumber;
4807
4800
  reactions: z.ZodArray<z.ZodObject<{
4808
- reaction: z.ZodEnum<{
4809
- "\uD83D\uDC4D": "👍";
4810
- "\uD83D\uDC4E": "👎";
4811
- "\u2764\uFE0F": "❤️";
4812
- "\uD83D\uDE02": "😂";
4813
- "\uD83D\uDE2E": "😮";
4814
- "\uD83D\uDE22": "😢";
4815
- "\uD83C\uDF89": "🎉";
4816
- }>;
4801
+ reaction: z.ZodString;
4817
4802
  profile: z.ZodObject<{
4818
4803
  handle: z.ZodString;
4819
4804
  deletedHandle: z.ZodOptional<z.ZodString>;
@@ -5081,6 +5066,7 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
5081
5066
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
5082
5067
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
5083
5068
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
5069
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
5084
5070
  videoEnabled: z.ZodBoolean;
5085
5071
  type: z.ZodEnum<{
5086
5072
  "video-call": "video-call";
@@ -5394,6 +5380,7 @@ export declare const dbPostSchema: z.ZodObject<{
5394
5380
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
5395
5381
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
5396
5382
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
5383
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
5397
5384
  videoEnabled: z.ZodBoolean;
5398
5385
  type: z.ZodEnum<{
5399
5386
  "video-call": "video-call";
@@ -5740,6 +5727,7 @@ export declare const dbPostSchema: z.ZodObject<{
5740
5727
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
5741
5728
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
5742
5729
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
5730
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
5743
5731
  videoEnabled: z.ZodBoolean;
5744
5732
  type: z.ZodEnum<{
5745
5733
  "video-call": "video-call";
@@ -6431,15 +6419,7 @@ export declare const dbPostSchema: z.ZodObject<{
6431
6419
  replyCount: z.ZodNumber;
6432
6420
  repostCount: z.ZodNumber;
6433
6421
  reactions: z.ZodArray<z.ZodObject<{
6434
- reaction: z.ZodEnum<{
6435
- "\uD83D\uDC4D": "👍";
6436
- "\uD83D\uDC4E": "👎";
6437
- "\u2764\uFE0F": "❤️";
6438
- "\uD83D\uDE02": "😂";
6439
- "\uD83D\uDE2E": "😮";
6440
- "\uD83D\uDE22": "😢";
6441
- "\uD83C\uDF89": "🎉";
6442
- }>;
6422
+ reaction: z.ZodString;
6443
6423
  profile: z.ZodObject<{
6444
6424
  handle: z.ZodString;
6445
6425
  deletedHandle: z.ZodOptional<z.ZodString>;
@@ -6707,6 +6687,7 @@ export declare const dbPostSchema: z.ZodObject<{
6707
6687
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
6708
6688
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
6709
6689
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
6690
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
6710
6691
  videoEnabled: z.ZodBoolean;
6711
6692
  type: z.ZodEnum<{
6712
6693
  "video-call": "video-call";
@@ -7017,6 +6998,7 @@ export declare const dbPostSchema: z.ZodObject<{
7017
6998
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
7018
6999
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
7019
7000
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
7001
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
7020
7002
  videoEnabled: z.ZodBoolean;
7021
7003
  type: z.ZodEnum<{
7022
7004
  "video-call": "video-call";
@@ -7363,6 +7345,7 @@ export declare const dbPostSchema: z.ZodObject<{
7363
7345
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
7364
7346
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
7365
7347
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
7348
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
7366
7349
  videoEnabled: z.ZodBoolean;
7367
7350
  type: z.ZodEnum<{
7368
7351
  "video-call": "video-call";
@@ -8054,15 +8037,7 @@ export declare const dbPostSchema: z.ZodObject<{
8054
8037
  replyCount: z.ZodNumber;
8055
8038
  repostCount: z.ZodNumber;
8056
8039
  reactions: z.ZodArray<z.ZodObject<{
8057
- reaction: z.ZodEnum<{
8058
- "\uD83D\uDC4D": "👍";
8059
- "\uD83D\uDC4E": "👎";
8060
- "\u2764\uFE0F": "❤️";
8061
- "\uD83D\uDE02": "😂";
8062
- "\uD83D\uDE2E": "😮";
8063
- "\uD83D\uDE22": "😢";
8064
- "\uD83C\uDF89": "🎉";
8065
- }>;
8040
+ reaction: z.ZodString;
8066
8041
  profile: z.ZodObject<{
8067
8042
  handle: z.ZodString;
8068
8043
  deletedHandle: z.ZodOptional<z.ZodString>;
@@ -8330,6 +8305,7 @@ export declare const dbPostSchema: z.ZodObject<{
8330
8305
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
8331
8306
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
8332
8307
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
8308
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
8333
8309
  videoEnabled: z.ZodBoolean;
8334
8310
  type: z.ZodEnum<{
8335
8311
  "video-call": "video-call";
@@ -8642,6 +8618,7 @@ export declare const dbPostSchema: z.ZodObject<{
8642
8618
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
8643
8619
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
8644
8620
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
8621
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
8645
8622
  videoEnabled: z.ZodBoolean;
8646
8623
  type: z.ZodEnum<{
8647
8624
  "video-call": "video-call";
@@ -8988,6 +8965,7 @@ export declare const dbPostSchema: z.ZodObject<{
8988
8965
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
8989
8966
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
8990
8967
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
8968
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
8991
8969
  videoEnabled: z.ZodBoolean;
8992
8970
  type: z.ZodEnum<{
8993
8971
  "video-call": "video-call";
@@ -9679,15 +9657,7 @@ export declare const dbPostSchema: z.ZodObject<{
9679
9657
  replyCount: z.ZodNumber;
9680
9658
  repostCount: z.ZodNumber;
9681
9659
  reactions: z.ZodArray<z.ZodObject<{
9682
- reaction: z.ZodEnum<{
9683
- "\uD83D\uDC4D": "👍";
9684
- "\uD83D\uDC4E": "👎";
9685
- "\u2764\uFE0F": "❤️";
9686
- "\uD83D\uDE02": "😂";
9687
- "\uD83D\uDE2E": "😮";
9688
- "\uD83D\uDE22": "😢";
9689
- "\uD83C\uDF89": "🎉";
9690
- }>;
9660
+ reaction: z.ZodString;
9691
9661
  profile: z.ZodObject<{
9692
9662
  handle: z.ZodString;
9693
9663
  deletedHandle: z.ZodOptional<z.ZodString>;
@@ -9955,6 +9925,7 @@ export declare const dbPostSchema: z.ZodObject<{
9955
9925
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
9956
9926
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
9957
9927
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
9928
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
9958
9929
  videoEnabled: z.ZodBoolean;
9959
9930
  type: z.ZodEnum<{
9960
9931
  "video-call": "video-call";
@@ -10265,6 +10236,7 @@ export declare const dbPostSchema: z.ZodObject<{
10265
10236
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
10266
10237
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
10267
10238
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
10239
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
10268
10240
  videoEnabled: z.ZodBoolean;
10269
10241
  type: z.ZodEnum<{
10270
10242
  "video-call": "video-call";
@@ -10611,6 +10583,7 @@ export declare const dbPostSchema: z.ZodObject<{
10611
10583
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
10612
10584
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
10613
10585
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
10586
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
10614
10587
  videoEnabled: z.ZodBoolean;
10615
10588
  type: z.ZodEnum<{
10616
10589
  "video-call": "video-call";
@@ -11302,15 +11275,7 @@ export declare const dbPostSchema: z.ZodObject<{
11302
11275
  replyCount: z.ZodNumber;
11303
11276
  repostCount: z.ZodNumber;
11304
11277
  reactions: z.ZodArray<z.ZodObject<{
11305
- reaction: z.ZodEnum<{
11306
- "\uD83D\uDC4D": "👍";
11307
- "\uD83D\uDC4E": "👎";
11308
- "\u2764\uFE0F": "❤️";
11309
- "\uD83D\uDE02": "😂";
11310
- "\uD83D\uDE2E": "😮";
11311
- "\uD83D\uDE22": "😢";
11312
- "\uD83C\uDF89": "🎉";
11313
- }>;
11278
+ reaction: z.ZodString;
11314
11279
  profile: z.ZodObject<{
11315
11280
  handle: z.ZodString;
11316
11281
  deletedHandle: z.ZodOptional<z.ZodString>;
@@ -11578,6 +11543,7 @@ export declare const dbPostSchema: z.ZodObject<{
11578
11543
  speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
11579
11544
  presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
11580
11545
  audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
11546
+ banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
11581
11547
  videoEnabled: z.ZodBoolean;
11582
11548
  type: z.ZodEnum<{
11583
11549
  "video-call": "video-call";
@@ -1,120 +1,56 @@
1
1
  import { z } from 'zod';
2
- /** Data a user can download as their account export. */
3
- export declare const accountExportSchema: z.ZodObject<{
4
- account: z.ZodObject<{
5
- id: z.ZodUUID;
6
- email: z.ZodEmail;
7
- emailValidated: z.ZodDefault<z.ZodBoolean>;
8
- }, z.core.$strip>;
9
- profiles: z.ZodArray<z.ZodObject<{
10
- id: z.ZodString;
11
- type: z.ZodEnum<{
12
- local: "local";
13
- guest: "guest";
14
- federated: "federated";
15
- }>;
16
- createdAt: z.ZodString;
17
- updatedAt: z.ZodString;
18
- deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
- handle: z.ZodString;
20
- avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
- header: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
- displayName: z.ZodOptional<z.ZodString>;
23
- bio: z.ZodOptional<z.ZodString>;
24
- location: z.ZodOptional<z.ZodObject<{
25
- text: z.ZodString;
26
- coordinates: z.ZodOptional<z.ZodObject<{
27
- lat: z.ZodNumber;
28
- lng: z.ZodNumber;
29
- alt: z.ZodOptional<z.ZodNumber>;
30
- }, z.core.$strip>>;
31
- }, z.core.$strip>>;
32
- locked: z.ZodOptional<z.ZodBoolean>;
33
- bot: z.ZodOptional<z.ZodBoolean>;
34
- discoverable: z.ZodOptional<z.ZodBoolean>;
35
- roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
36
- key: z.ZodString;
37
- displayName: z.ZodString;
38
- }, z.core.$strip>>>;
39
- memberships: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodObject<{
40
- roles: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodEnum<{
41
- none: "none";
42
- local: "local";
43
- member: "member";
44
- moderator: "moderator";
45
- admin: "admin";
46
- owner: "owner";
47
- invited: "invited";
48
- }>>>>;
49
- group: z.ZodObject<{
50
- handle: z.ZodString;
51
- avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
- header: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
- displayName: z.ZodOptional<z.ZodString>;
54
- description: z.ZodOptional<z.ZodString>;
55
- rules: z.ZodOptional<z.ZodString>;
56
- pinnedPostId: z.ZodOptional<z.ZodString>;
57
- discoverable: z.ZodOptional<z.ZodBoolean>;
58
- capabilities: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodObject<{
59
- add: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
- remove: z.ZodOptional<z.ZodArray<z.ZodString>>;
61
- }, z.core.$strip>>>;
62
- id: z.ZodUUID;
63
- createdAt: z.ZodISODateTime;
64
- updatedAt: z.ZodISODateTime;
65
- deletedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
66
- }, z.core.$strip>;
67
- }, z.core.$strip>>>, z.ZodTransform<{
68
- group: {
69
- handle: string;
70
- capabilities: Record<string, {
71
- add?: string[] | undefined;
72
- remove?: string[] | undefined;
73
- } | undefined>;
74
- id: string;
75
- createdAt: string;
76
- updatedAt: string;
77
- avatar?: string | null | undefined;
78
- header?: string | null | undefined;
79
- displayName?: string | undefined;
80
- description?: string | undefined;
81
- rules?: string | undefined;
82
- pinnedPostId?: string | undefined;
83
- discoverable?: boolean | undefined;
84
- deletedAt?: string | null | undefined;
85
- };
86
- roles?: ("none" | "local" | "member" | "moderator" | "admin" | "owner" | "invited")[] | null | undefined;
87
- }[] | undefined, {
88
- group: {
89
- handle: string;
90
- capabilities: Record<string, {
91
- add?: string[] | undefined;
92
- remove?: string[] | undefined;
93
- } | undefined>;
94
- id: string;
95
- createdAt: string;
96
- updatedAt: string;
97
- avatar?: string | null | undefined;
98
- header?: string | null | undefined;
99
- displayName?: string | undefined;
100
- description?: string | undefined;
101
- rules?: string | undefined;
102
- pinnedPostId?: string | undefined;
103
- discoverable?: boolean | undefined;
104
- deletedAt?: string | null | undefined;
105
- };
106
- roles?: ("none" | "local" | "member" | "moderator" | "admin" | "owner" | "invited")[] | null | undefined;
107
- }[] | undefined>>;
108
- fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
109
- name: z.ZodString;
110
- value: z.ZodString;
111
- }, z.core.$strip>>>;
112
- profileStats: z.ZodOptional<z.ZodObject<{
113
- followersCount: z.ZodNumber;
114
- followingCount: z.ZodNumber;
115
- }, z.core.$strip>>;
116
- pinnedPostId: z.ZodOptional<z.ZodString>;
117
- blockedByMe: z.ZodOptional<z.ZodBoolean>;
118
- }, z.core.$strip>>;
2
+ /**
3
+ * Full personal data export (GDPR-style). Requested via `POST`, assembled
4
+ * asynchronously by a worker job, downloaded via a short-lived token.
5
+ */
6
+ export declare const accountExportJobSchema: z.ZodObject<{
7
+ jobId: z.ZodUUID;
119
8
  }, z.core.$strip>;
120
- export type AccountExport = z.infer<typeof accountExportSchema>;
9
+ export type AccountExportJob = z.infer<typeof accountExportJobSchema>;
10
+ /**
11
+ * Lifecycle states of an account export, as reported by the status endpoint:
12
+ * - `building` — the worker has not (yet) written a record, or is assembling
13
+ * the archive; the client keeps polling.
14
+ * - `ready` — the archive exists; the response carries the single-use
15
+ * `downloadToken` and its `expiresAt`. The client stops polling and offers
16
+ * the download.
17
+ * - `error` — assembly failed; the response carries `error`. Stop polling.
18
+ * - `expired` — the record's token lapsed or the archive was cleaned up; the
19
+ * client stops polling and asks the user to start a new export.
20
+ * - `not-found` — no record for the given `jobId` (unknown to this account).
21
+ */
22
+ export declare const accountExportStateSchema: z.ZodEnum<{
23
+ error: "error";
24
+ ready: "ready";
25
+ building: "building";
26
+ expired: "expired";
27
+ "not-found": "not-found";
28
+ }>;
29
+ export type AccountExportState = z.infer<typeof accountExportStateSchema>;
30
+ /** `GET /accounts/current/export/status?jobId=…` */
31
+ export declare const accountExportStatusSchema: z.ZodObject<{
32
+ jobId: z.ZodUUID;
33
+ state: z.ZodEnum<{
34
+ error: "error";
35
+ ready: "ready";
36
+ building: "building";
37
+ expired: "expired";
38
+ "not-found": "not-found";
39
+ }>;
40
+ downloadToken: z.ZodOptional<z.ZodString>;
41
+ expiresAt: z.ZodOptional<z.ZodString>;
42
+ error: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>;
44
+ export type AccountExportStatus = z.infer<typeof accountExportStatusSchema>;
45
+ /**
46
+ * The "ready" payload shared by every producer of a finished export — the
47
+ * worker that assembles the archive and the status endpoint that reports it.
48
+ * Single-sourcing the `state`/`downloadToken`/`expiresAt` triple here keeps the
49
+ * two from drifting as the API grows (adding a field to the shape now means
50
+ * touching one type instead of both construction sites). Type-only: it mirrors
51
+ * `AccountExportStatus`'s ready fields, so it changes no runtime surface.
52
+ */
53
+ export type AccountExportReady = Pick<AccountExportStatus, 'downloadToken' | 'expiresAt'> & {
54
+ /** The ready state, as a literal — the only state that carries the fields. */
55
+ state: 'ready';
56
+ };
@@ -1,7 +1,37 @@
1
1
  import { z } from 'zod';
2
- import { publicAccountSchema, publicProfileSchema } from './api.js';
3
- /** Data a user can download as their account export. */
4
- export const accountExportSchema = z.object({
5
- account: publicAccountSchema,
6
- profiles: publicProfileSchema.array(),
2
+ /**
3
+ * Full personal data export (GDPR-style). Requested via `POST`, assembled
4
+ * asynchronously by a worker job, downloaded via a short-lived token.
5
+ */
6
+ export const accountExportJobSchema = z.object({
7
+ jobId: z.uuid(),
8
+ });
9
+ /**
10
+ * Lifecycle states of an account export, as reported by the status endpoint:
11
+ * - `building` — the worker has not (yet) written a record, or is assembling
12
+ * the archive; the client keeps polling.
13
+ * - `ready` — the archive exists; the response carries the single-use
14
+ * `downloadToken` and its `expiresAt`. The client stops polling and offers
15
+ * the download.
16
+ * - `error` — assembly failed; the response carries `error`. Stop polling.
17
+ * - `expired` — the record's token lapsed or the archive was cleaned up; the
18
+ * client stops polling and asks the user to start a new export.
19
+ * - `not-found` — no record for the given `jobId` (unknown to this account).
20
+ */
21
+ export const accountExportStateSchema = z.enum([
22
+ 'building',
23
+ 'ready',
24
+ 'error',
25
+ 'expired',
26
+ 'not-found',
27
+ ]);
28
+ /** `GET /accounts/current/export/status?jobId=…` */
29
+ export const accountExportStatusSchema = z.object({
30
+ jobId: z.uuid(),
31
+ state: accountExportStateSchema,
32
+ /** Present once `state === 'ready'`. Pass to the download endpoint. */
33
+ downloadToken: z.string().optional(),
34
+ /** When `state === 'ready'`, the download token stops working after this. */
35
+ expiresAt: z.string().datetime().optional(),
36
+ error: z.string().optional(),
7
37
  });