@tracearr/shared 2.2.4-beta.3 → 2.3.0-beta.1

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 (42) hide show
  1. package/dist/automations/__tests__/definition.test.js +6 -2
  2. package/dist/automations/__tests__/definition.test.js.map +1 -1
  3. package/dist/automations/__tests__/triggers.test.js +18 -1
  4. package/dist/automations/__tests__/triggers.test.js.map +1 -1
  5. package/dist/automations/definition.d.ts +7 -0
  6. package/dist/automations/definition.d.ts.map +1 -1
  7. package/dist/automations/dryRun.d.ts +2 -0
  8. package/dist/automations/dryRun.d.ts.map +1 -1
  9. package/dist/automations/templates.d.ts +4 -0
  10. package/dist/automations/templates.d.ts.map +1 -1
  11. package/dist/automations/triggers.d.ts +13 -1
  12. package/dist/automations/triggers.d.ts.map +1 -1
  13. package/dist/automations/triggers.js +16 -1
  14. package/dist/automations/triggers.js.map +1 -1
  15. package/dist/destinations.d.ts +102 -12
  16. package/dist/destinations.d.ts.map +1 -1
  17. package/dist/destinations.js +201 -4
  18. package/dist/destinations.js.map +1 -1
  19. package/dist/emailRichText.d.ts +199 -0
  20. package/dist/emailRichText.d.ts.map +1 -0
  21. package/dist/emailRichText.js +133 -0
  22. package/dist/emailRichText.js.map +1 -0
  23. package/dist/index.d.ts +8 -4
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +7 -3
  26. package/dist/index.js.map +1 -1
  27. package/dist/mediaServerLinks.d.ts +15 -0
  28. package/dist/mediaServerLinks.d.ts.map +1 -1
  29. package/dist/mediaServerLinks.js +60 -0
  30. package/dist/mediaServerLinks.js.map +1 -1
  31. package/dist/newsletters.d.ts +1367 -0
  32. package/dist/newsletters.d.ts.map +1 -0
  33. package/dist/newsletters.js +215 -0
  34. package/dist/newsletters.js.map +1 -0
  35. package/dist/schemas.d.ts +13 -0
  36. package/dist/schemas.d.ts.map +1 -1
  37. package/dist/schemas.js +49 -18
  38. package/dist/schemas.js.map +1 -1
  39. package/dist/types.d.ts +4 -1
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/types.js.map +1 -1
  42. package/package.json +1 -1
@@ -0,0 +1,1367 @@
1
+ import { z } from 'zod';
2
+ import { type EmailRichTextDoc } from './emailRichText.js';
3
+ /** 12 is the largest cap at which the heaviest digest the assembler can emit stays clear of Gmail's 102 KB clip, proven by the size gate in packages/emails. */
4
+ export declare const NEWSLETTER_SECTION_MAX = 12;
5
+ export declare const NEWSLETTER_MOST_WATCHED_MAX = 10;
6
+ export declare const NEWSLETTER_SEASONS_PER_SHOW_MAX = 8;
7
+ export declare const NEWSLETTER_WINDOW_MAX_DAYS = 31;
8
+ export declare const NEWSLETTER_EXTRA_ADDRESSES_MAX = 200;
9
+ export declare const NEWSLETTER_EXCLUDED_USERS_MAX = 200;
10
+ export declare const NEWSLETTER_SENDER_NAME_MAX = 100;
11
+ export declare const NEWSLETTER_SEND_TRIGGERS: readonly ['schedule', 'manual', 'test'];
12
+ export type NewsletterSendTrigger = (typeof NEWSLETTER_SEND_TRIGGERS)[number];
13
+ export declare const NEWSLETTER_SEND_OUTCOMES: readonly ['rendering', 'sending', 'sent', 'partial', 'failed', 'skipped_empty'];
14
+ export type NewsletterSendOutcome = (typeof NEWSLETTER_SEND_OUTCOMES)[number];
15
+ export declare const NEWSLETTER_RECIPIENT_STATUSES: readonly ['queued', 'sent', 'failed', 'suppressed', 'unknown'];
16
+ export type NewsletterRecipientStatus = (typeof NEWSLETTER_RECIPIENT_STATUSES)[number];
17
+ export declare const NEWSLETTER_IMAGE_MODES: readonly ['auto', 'hosted', 'inline', 'none'];
18
+ export type NewsletterImageMode = (typeof NEWSLETTER_IMAGE_MODES)[number];
19
+ export declare const EMAIL_SUPPRESSION_REASONS: readonly ['unsubscribed', 'manual'];
20
+ export type EmailSuppressionReason = (typeof EMAIL_SUPPRESSION_REASONS)[number];
21
+ export declare const DEFAULT_NEWSLETTER_SUBJECT = "What's new on {{server_name}} ({{end_date}})";
22
+ export declare const cronExpressionSchema: z.ZodString;
23
+ export declare const newsletterScheduleSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
24
+ kind: z.ZodLiteral<"daily">;
25
+ time: z.ZodString;
26
+ }, z.core.$strict>, z.ZodObject<{
27
+ kind: z.ZodLiteral<"weekly">;
28
+ dayOfWeek: z.ZodNumber;
29
+ time: z.ZodString;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ kind: z.ZodLiteral<"monthly">;
32
+ dayOfMonth: z.ZodNumber;
33
+ time: z.ZodString;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ kind: z.ZodLiteral<"cron">;
36
+ expression: z.ZodString;
37
+ }, z.core.$strict>], "kind">;
38
+ export type NewsletterSchedule = z.infer<typeof newsletterScheduleSchema>;
39
+ export declare const newsletterWindowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
40
+ kind: z.ZodLiteral<"since_last_send">;
41
+ fallbackDays: z.ZodNumber;
42
+ }, z.core.$strict>, z.ZodObject<{
43
+ kind: z.ZodLiteral<"fixed">;
44
+ days: z.ZodNumber;
45
+ }, z.core.$strict>], "kind">;
46
+ export type NewsletterWindow = z.infer<typeof newsletterWindowSchema>;
47
+ export declare const newsletterSectionsSchema: z.ZodObject<{
48
+ movies: z.ZodObject<{
49
+ enabled: z.ZodBoolean;
50
+ max: z.ZodNumber;
51
+ }, z.core.$strict>;
52
+ shows: z.ZodObject<{
53
+ enabled: z.ZodBoolean;
54
+ max: z.ZodNumber;
55
+ maxSeasonsPerShow: z.ZodNumber;
56
+ }, z.core.$strict>;
57
+ music: z.ZodObject<{
58
+ enabled: z.ZodBoolean;
59
+ max: z.ZodNumber;
60
+ }, z.core.$strict>;
61
+ mostWatched: z.ZodObject<{
62
+ enabled: z.ZodBoolean;
63
+ max: z.ZodNumber;
64
+ }, z.core.$strict>;
65
+ }, z.core.$strict>;
66
+ export type NewsletterSections = z.infer<typeof newsletterSectionsSchema>;
67
+ export declare const DEFAULT_NEWSLETTER_SECTIONS: NewsletterSections;
68
+ export declare const NEWSLETTER_SCOPE_LIBRARIES_MAX = 200;
69
+ /** A library id is only unique with its server: Plex section ids start at 1 on every server. */
70
+ export declare const newsletterScopeLibrarySchema: z.ZodObject<{
71
+ serverId: z.ZodUUID;
72
+ libraryId: z.ZodString;
73
+ }, z.core.$strict>;
74
+ export type NewsletterScopeLibrary = z.infer<typeof newsletterScopeLibrarySchema>;
75
+ export declare const newsletterScopeSchema: z.ZodObject<{
76
+ serverIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
77
+ libraries: z.ZodDefault<z.ZodArray<z.ZodObject<{
78
+ serverId: z.ZodUUID;
79
+ libraryId: z.ZodString;
80
+ }, z.core.$strict>>>;
81
+ }, z.core.$strict>;
82
+ export type NewsletterScope = z.infer<typeof newsletterScopeSchema>;
83
+ export declare const newsletterRecipientsSchema: z.ZodObject<{
84
+ members: z.ZodDefault<z.ZodBoolean>;
85
+ extraAddresses: z.ZodDefault<z.ZodArray<z.ZodObject<{
86
+ address: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
87
+ name: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strict>>>;
89
+ excludeUserIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
90
+ }, z.core.$strict>;
91
+ export type NewsletterRecipients = z.infer<typeof newsletterRecipientsSchema>;
92
+ export declare const newsletterLinksSchema: z.ZodObject<{
93
+ tracearr: z.ZodBoolean;
94
+ }, z.core.$strict>;
95
+ export type NewsletterLinks = z.infer<typeof newsletterLinksSchema>;
96
+ export declare const DEFAULT_NEWSLETTER_LINKS: NewsletterLinks;
97
+ export declare const createNewsletterSchema: z.ZodObject<{
98
+ name: z.ZodString;
99
+ enabled: z.ZodDefault<z.ZodBoolean>;
100
+ destinationId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
101
+ schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
102
+ kind: z.ZodLiteral<"daily">;
103
+ time: z.ZodString;
104
+ }, z.core.$strict>, z.ZodObject<{
105
+ kind: z.ZodLiteral<"weekly">;
106
+ dayOfWeek: z.ZodNumber;
107
+ time: z.ZodString;
108
+ }, z.core.$strict>, z.ZodObject<{
109
+ kind: z.ZodLiteral<"monthly">;
110
+ dayOfMonth: z.ZodNumber;
111
+ time: z.ZodString;
112
+ }, z.core.$strict>, z.ZodObject<{
113
+ kind: z.ZodLiteral<"cron">;
114
+ expression: z.ZodString;
115
+ }, z.core.$strict>], "kind">;
116
+ timezone: z.ZodString;
117
+ window: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
118
+ kind: z.ZodLiteral<"since_last_send">;
119
+ fallbackDays: z.ZodNumber;
120
+ }, z.core.$strict>, z.ZodObject<{
121
+ kind: z.ZodLiteral<"fixed">;
122
+ days: z.ZodNumber;
123
+ }, z.core.$strict>], "kind">>;
124
+ scope: z.ZodDefault<z.ZodObject<{
125
+ serverIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
126
+ libraries: z.ZodDefault<z.ZodArray<z.ZodObject<{
127
+ serverId: z.ZodUUID;
128
+ libraryId: z.ZodString;
129
+ }, z.core.$strict>>>;
130
+ }, z.core.$strict>>;
131
+ sections: z.ZodDefault<z.ZodObject<{
132
+ movies: z.ZodObject<{
133
+ enabled: z.ZodBoolean;
134
+ max: z.ZodNumber;
135
+ }, z.core.$strict>;
136
+ shows: z.ZodObject<{
137
+ enabled: z.ZodBoolean;
138
+ max: z.ZodNumber;
139
+ maxSeasonsPerShow: z.ZodNumber;
140
+ }, z.core.$strict>;
141
+ music: z.ZodObject<{
142
+ enabled: z.ZodBoolean;
143
+ max: z.ZodNumber;
144
+ }, z.core.$strict>;
145
+ mostWatched: z.ZodObject<{
146
+ enabled: z.ZodBoolean;
147
+ max: z.ZodNumber;
148
+ }, z.core.$strict>;
149
+ }, z.core.$strict>>;
150
+ subject: z.ZodDefault<z.ZodString>;
151
+ senderName: z.ZodDefault<z.ZodNullable<z.ZodString>>;
152
+ intro: z.ZodDefault<z.ZodPipe<z.ZodNullable<z.ZodObject<{
153
+ type: z.ZodLiteral<"doc">;
154
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
155
+ type: z.ZodLiteral<"paragraph">;
156
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
157
+ type: z.ZodLiteral<"text">;
158
+ text: z.ZodString;
159
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
160
+ type: z.ZodLiteral<"bold">;
161
+ }, z.core.$strict>, z.ZodObject<{
162
+ type: z.ZodLiteral<"italic">;
163
+ }, z.core.$strict>, z.ZodObject<{
164
+ type: z.ZodLiteral<"link">;
165
+ attrs: z.ZodObject<{
166
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
167
+ }, z.core.$strict>;
168
+ }, z.core.$strict>], "type">>>;
169
+ }, z.core.$strict>, z.ZodObject<{
170
+ type: z.ZodLiteral<"hardBreak">;
171
+ }, z.core.$strict>], "type">>>;
172
+ }, z.core.$strict>, z.ZodObject<{
173
+ type: z.ZodLiteral<"bulletList">;
174
+ content: z.ZodArray<z.ZodObject<{
175
+ type: z.ZodLiteral<"listItem">;
176
+ content: z.ZodArray<z.ZodObject<{
177
+ type: z.ZodLiteral<"paragraph">;
178
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
179
+ type: z.ZodLiteral<"text">;
180
+ text: z.ZodString;
181
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
182
+ type: z.ZodLiteral<"bold">;
183
+ }, z.core.$strict>, z.ZodObject<{
184
+ type: z.ZodLiteral<"italic">;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ type: z.ZodLiteral<"link">;
187
+ attrs: z.ZodObject<{
188
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
189
+ }, z.core.$strict>;
190
+ }, z.core.$strict>], "type">>>;
191
+ }, z.core.$strict>, z.ZodObject<{
192
+ type: z.ZodLiteral<"hardBreak">;
193
+ }, z.core.$strict>], "type">>>;
194
+ }, z.core.$strict>>;
195
+ }, z.core.$strict>>;
196
+ }, z.core.$strict>], "type">>;
197
+ }, z.core.$strict>>, z.ZodTransform<{
198
+ type: "doc";
199
+ content: ({
200
+ type: "paragraph";
201
+ content?: ({
202
+ type: "text";
203
+ text: string;
204
+ marks?: ({
205
+ type: "bold";
206
+ } | {
207
+ type: "italic";
208
+ } | {
209
+ type: "link";
210
+ attrs: {
211
+ href: string;
212
+ };
213
+ })[] | undefined;
214
+ } | {
215
+ type: "hardBreak";
216
+ })[] | undefined;
217
+ } | {
218
+ type: "bulletList";
219
+ content: {
220
+ type: "listItem";
221
+ content: {
222
+ type: "paragraph";
223
+ content?: ({
224
+ type: "text";
225
+ text: string;
226
+ marks?: ({
227
+ type: "bold";
228
+ } | {
229
+ type: "italic";
230
+ } | {
231
+ type: "link";
232
+ attrs: {
233
+ href: string;
234
+ };
235
+ })[] | undefined;
236
+ } | {
237
+ type: "hardBreak";
238
+ })[] | undefined;
239
+ }[];
240
+ }[];
241
+ })[];
242
+ } | null, {
243
+ type: "doc";
244
+ content: ({
245
+ type: "paragraph";
246
+ content?: ({
247
+ type: "text";
248
+ text: string;
249
+ marks?: ({
250
+ type: "bold";
251
+ } | {
252
+ type: "italic";
253
+ } | {
254
+ type: "link";
255
+ attrs: {
256
+ href: string;
257
+ };
258
+ })[] | undefined;
259
+ } | {
260
+ type: "hardBreak";
261
+ })[] | undefined;
262
+ } | {
263
+ type: "bulletList";
264
+ content: {
265
+ type: "listItem";
266
+ content: {
267
+ type: "paragraph";
268
+ content?: ({
269
+ type: "text";
270
+ text: string;
271
+ marks?: ({
272
+ type: "bold";
273
+ } | {
274
+ type: "italic";
275
+ } | {
276
+ type: "link";
277
+ attrs: {
278
+ href: string;
279
+ };
280
+ })[] | undefined;
281
+ } | {
282
+ type: "hardBreak";
283
+ })[] | undefined;
284
+ }[];
285
+ }[];
286
+ })[];
287
+ } | null>>>;
288
+ outro: z.ZodDefault<z.ZodPipe<z.ZodNullable<z.ZodObject<{
289
+ type: z.ZodLiteral<"doc">;
290
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
291
+ type: z.ZodLiteral<"paragraph">;
292
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
293
+ type: z.ZodLiteral<"text">;
294
+ text: z.ZodString;
295
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
296
+ type: z.ZodLiteral<"bold">;
297
+ }, z.core.$strict>, z.ZodObject<{
298
+ type: z.ZodLiteral<"italic">;
299
+ }, z.core.$strict>, z.ZodObject<{
300
+ type: z.ZodLiteral<"link">;
301
+ attrs: z.ZodObject<{
302
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
303
+ }, z.core.$strict>;
304
+ }, z.core.$strict>], "type">>>;
305
+ }, z.core.$strict>, z.ZodObject<{
306
+ type: z.ZodLiteral<"hardBreak">;
307
+ }, z.core.$strict>], "type">>>;
308
+ }, z.core.$strict>, z.ZodObject<{
309
+ type: z.ZodLiteral<"bulletList">;
310
+ content: z.ZodArray<z.ZodObject<{
311
+ type: z.ZodLiteral<"listItem">;
312
+ content: z.ZodArray<z.ZodObject<{
313
+ type: z.ZodLiteral<"paragraph">;
314
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
315
+ type: z.ZodLiteral<"text">;
316
+ text: z.ZodString;
317
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
318
+ type: z.ZodLiteral<"bold">;
319
+ }, z.core.$strict>, z.ZodObject<{
320
+ type: z.ZodLiteral<"italic">;
321
+ }, z.core.$strict>, z.ZodObject<{
322
+ type: z.ZodLiteral<"link">;
323
+ attrs: z.ZodObject<{
324
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
325
+ }, z.core.$strict>;
326
+ }, z.core.$strict>], "type">>>;
327
+ }, z.core.$strict>, z.ZodObject<{
328
+ type: z.ZodLiteral<"hardBreak">;
329
+ }, z.core.$strict>], "type">>>;
330
+ }, z.core.$strict>>;
331
+ }, z.core.$strict>>;
332
+ }, z.core.$strict>], "type">>;
333
+ }, z.core.$strict>>, z.ZodTransform<{
334
+ type: "doc";
335
+ content: ({
336
+ type: "paragraph";
337
+ content?: ({
338
+ type: "text";
339
+ text: string;
340
+ marks?: ({
341
+ type: "bold";
342
+ } | {
343
+ type: "italic";
344
+ } | {
345
+ type: "link";
346
+ attrs: {
347
+ href: string;
348
+ };
349
+ })[] | undefined;
350
+ } | {
351
+ type: "hardBreak";
352
+ })[] | undefined;
353
+ } | {
354
+ type: "bulletList";
355
+ content: {
356
+ type: "listItem";
357
+ content: {
358
+ type: "paragraph";
359
+ content?: ({
360
+ type: "text";
361
+ text: string;
362
+ marks?: ({
363
+ type: "bold";
364
+ } | {
365
+ type: "italic";
366
+ } | {
367
+ type: "link";
368
+ attrs: {
369
+ href: string;
370
+ };
371
+ })[] | undefined;
372
+ } | {
373
+ type: "hardBreak";
374
+ })[] | undefined;
375
+ }[];
376
+ }[];
377
+ })[];
378
+ } | null, {
379
+ type: "doc";
380
+ content: ({
381
+ type: "paragraph";
382
+ content?: ({
383
+ type: "text";
384
+ text: string;
385
+ marks?: ({
386
+ type: "bold";
387
+ } | {
388
+ type: "italic";
389
+ } | {
390
+ type: "link";
391
+ attrs: {
392
+ href: string;
393
+ };
394
+ })[] | undefined;
395
+ } | {
396
+ type: "hardBreak";
397
+ })[] | undefined;
398
+ } | {
399
+ type: "bulletList";
400
+ content: {
401
+ type: "listItem";
402
+ content: {
403
+ type: "paragraph";
404
+ content?: ({
405
+ type: "text";
406
+ text: string;
407
+ marks?: ({
408
+ type: "bold";
409
+ } | {
410
+ type: "italic";
411
+ } | {
412
+ type: "link";
413
+ attrs: {
414
+ href: string;
415
+ };
416
+ })[] | undefined;
417
+ } | {
418
+ type: "hardBreak";
419
+ })[] | undefined;
420
+ }[];
421
+ }[];
422
+ })[];
423
+ } | null>>>;
424
+ recipients: z.ZodDefault<z.ZodObject<{
425
+ members: z.ZodDefault<z.ZodBoolean>;
426
+ extraAddresses: z.ZodDefault<z.ZodArray<z.ZodObject<{
427
+ address: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
428
+ name: z.ZodOptional<z.ZodString>;
429
+ }, z.core.$strict>>>;
430
+ excludeUserIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
431
+ }, z.core.$strict>>;
432
+ imageMode: z.ZodDefault<z.ZodEnum<{
433
+ auto: "auto";
434
+ hosted: "hosted";
435
+ inline: "inline";
436
+ none: "none";
437
+ }>>;
438
+ skipWhenEmpty: z.ZodDefault<z.ZodBoolean>;
439
+ links: z.ZodDefault<z.ZodObject<{
440
+ tracearr: z.ZodBoolean;
441
+ }, z.core.$strict>>;
442
+ }, z.core.$strict>;
443
+ export type CreateNewsletterInput = z.infer<typeof createNewsletterSchema>;
444
+ /** A PATCH body: absent keys stay absent instead of resetting to the create defaults. */
445
+ export declare const updateNewsletterSchema: z.ZodObject<{
446
+ name: z.ZodOptional<z.ZodString>;
447
+ enabled: z.ZodOptional<z.ZodBoolean>;
448
+ destinationId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
449
+ schedule: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
450
+ kind: z.ZodLiteral<"daily">;
451
+ time: z.ZodString;
452
+ }, z.core.$strict>, z.ZodObject<{
453
+ kind: z.ZodLiteral<"weekly">;
454
+ dayOfWeek: z.ZodNumber;
455
+ time: z.ZodString;
456
+ }, z.core.$strict>, z.ZodObject<{
457
+ kind: z.ZodLiteral<"monthly">;
458
+ dayOfMonth: z.ZodNumber;
459
+ time: z.ZodString;
460
+ }, z.core.$strict>, z.ZodObject<{
461
+ kind: z.ZodLiteral<"cron">;
462
+ expression: z.ZodString;
463
+ }, z.core.$strict>], "kind">>;
464
+ timezone: z.ZodOptional<z.ZodString>;
465
+ window: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
466
+ kind: z.ZodLiteral<"since_last_send">;
467
+ fallbackDays: z.ZodNumber;
468
+ }, z.core.$strict>, z.ZodObject<{
469
+ kind: z.ZodLiteral<"fixed">;
470
+ days: z.ZodNumber;
471
+ }, z.core.$strict>], "kind">>;
472
+ scope: z.ZodOptional<z.ZodObject<{
473
+ serverIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
474
+ libraries: z.ZodDefault<z.ZodArray<z.ZodObject<{
475
+ serverId: z.ZodUUID;
476
+ libraryId: z.ZodString;
477
+ }, z.core.$strict>>>;
478
+ }, z.core.$strict>>;
479
+ sections: z.ZodOptional<z.ZodObject<{
480
+ movies: z.ZodObject<{
481
+ enabled: z.ZodBoolean;
482
+ max: z.ZodNumber;
483
+ }, z.core.$strict>;
484
+ shows: z.ZodObject<{
485
+ enabled: z.ZodBoolean;
486
+ max: z.ZodNumber;
487
+ maxSeasonsPerShow: z.ZodNumber;
488
+ }, z.core.$strict>;
489
+ music: z.ZodObject<{
490
+ enabled: z.ZodBoolean;
491
+ max: z.ZodNumber;
492
+ }, z.core.$strict>;
493
+ mostWatched: z.ZodObject<{
494
+ enabled: z.ZodBoolean;
495
+ max: z.ZodNumber;
496
+ }, z.core.$strict>;
497
+ }, z.core.$strict>>;
498
+ subject: z.ZodOptional<z.ZodString>;
499
+ senderName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
500
+ intro: z.ZodOptional<z.ZodPipe<z.ZodNullable<z.ZodObject<{
501
+ type: z.ZodLiteral<"doc">;
502
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
503
+ type: z.ZodLiteral<"paragraph">;
504
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
505
+ type: z.ZodLiteral<"text">;
506
+ text: z.ZodString;
507
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
508
+ type: z.ZodLiteral<"bold">;
509
+ }, z.core.$strict>, z.ZodObject<{
510
+ type: z.ZodLiteral<"italic">;
511
+ }, z.core.$strict>, z.ZodObject<{
512
+ type: z.ZodLiteral<"link">;
513
+ attrs: z.ZodObject<{
514
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
515
+ }, z.core.$strict>;
516
+ }, z.core.$strict>], "type">>>;
517
+ }, z.core.$strict>, z.ZodObject<{
518
+ type: z.ZodLiteral<"hardBreak">;
519
+ }, z.core.$strict>], "type">>>;
520
+ }, z.core.$strict>, z.ZodObject<{
521
+ type: z.ZodLiteral<"bulletList">;
522
+ content: z.ZodArray<z.ZodObject<{
523
+ type: z.ZodLiteral<"listItem">;
524
+ content: z.ZodArray<z.ZodObject<{
525
+ type: z.ZodLiteral<"paragraph">;
526
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
527
+ type: z.ZodLiteral<"text">;
528
+ text: z.ZodString;
529
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
530
+ type: z.ZodLiteral<"bold">;
531
+ }, z.core.$strict>, z.ZodObject<{
532
+ type: z.ZodLiteral<"italic">;
533
+ }, z.core.$strict>, z.ZodObject<{
534
+ type: z.ZodLiteral<"link">;
535
+ attrs: z.ZodObject<{
536
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
537
+ }, z.core.$strict>;
538
+ }, z.core.$strict>], "type">>>;
539
+ }, z.core.$strict>, z.ZodObject<{
540
+ type: z.ZodLiteral<"hardBreak">;
541
+ }, z.core.$strict>], "type">>>;
542
+ }, z.core.$strict>>;
543
+ }, z.core.$strict>>;
544
+ }, z.core.$strict>], "type">>;
545
+ }, z.core.$strict>>, z.ZodTransform<{
546
+ type: "doc";
547
+ content: ({
548
+ type: "paragraph";
549
+ content?: ({
550
+ type: "text";
551
+ text: string;
552
+ marks?: ({
553
+ type: "bold";
554
+ } | {
555
+ type: "italic";
556
+ } | {
557
+ type: "link";
558
+ attrs: {
559
+ href: string;
560
+ };
561
+ })[] | undefined;
562
+ } | {
563
+ type: "hardBreak";
564
+ })[] | undefined;
565
+ } | {
566
+ type: "bulletList";
567
+ content: {
568
+ type: "listItem";
569
+ content: {
570
+ type: "paragraph";
571
+ content?: ({
572
+ type: "text";
573
+ text: string;
574
+ marks?: ({
575
+ type: "bold";
576
+ } | {
577
+ type: "italic";
578
+ } | {
579
+ type: "link";
580
+ attrs: {
581
+ href: string;
582
+ };
583
+ })[] | undefined;
584
+ } | {
585
+ type: "hardBreak";
586
+ })[] | undefined;
587
+ }[];
588
+ }[];
589
+ })[];
590
+ } | null, {
591
+ type: "doc";
592
+ content: ({
593
+ type: "paragraph";
594
+ content?: ({
595
+ type: "text";
596
+ text: string;
597
+ marks?: ({
598
+ type: "bold";
599
+ } | {
600
+ type: "italic";
601
+ } | {
602
+ type: "link";
603
+ attrs: {
604
+ href: string;
605
+ };
606
+ })[] | undefined;
607
+ } | {
608
+ type: "hardBreak";
609
+ })[] | undefined;
610
+ } | {
611
+ type: "bulletList";
612
+ content: {
613
+ type: "listItem";
614
+ content: {
615
+ type: "paragraph";
616
+ content?: ({
617
+ type: "text";
618
+ text: string;
619
+ marks?: ({
620
+ type: "bold";
621
+ } | {
622
+ type: "italic";
623
+ } | {
624
+ type: "link";
625
+ attrs: {
626
+ href: string;
627
+ };
628
+ })[] | undefined;
629
+ } | {
630
+ type: "hardBreak";
631
+ })[] | undefined;
632
+ }[];
633
+ }[];
634
+ })[];
635
+ } | null>>>;
636
+ outro: z.ZodOptional<z.ZodPipe<z.ZodNullable<z.ZodObject<{
637
+ type: z.ZodLiteral<"doc">;
638
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
639
+ type: z.ZodLiteral<"paragraph">;
640
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
641
+ type: z.ZodLiteral<"text">;
642
+ text: z.ZodString;
643
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
644
+ type: z.ZodLiteral<"bold">;
645
+ }, z.core.$strict>, z.ZodObject<{
646
+ type: z.ZodLiteral<"italic">;
647
+ }, z.core.$strict>, z.ZodObject<{
648
+ type: z.ZodLiteral<"link">;
649
+ attrs: z.ZodObject<{
650
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
651
+ }, z.core.$strict>;
652
+ }, z.core.$strict>], "type">>>;
653
+ }, z.core.$strict>, z.ZodObject<{
654
+ type: z.ZodLiteral<"hardBreak">;
655
+ }, z.core.$strict>], "type">>>;
656
+ }, z.core.$strict>, z.ZodObject<{
657
+ type: z.ZodLiteral<"bulletList">;
658
+ content: z.ZodArray<z.ZodObject<{
659
+ type: z.ZodLiteral<"listItem">;
660
+ content: z.ZodArray<z.ZodObject<{
661
+ type: z.ZodLiteral<"paragraph">;
662
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
663
+ type: z.ZodLiteral<"text">;
664
+ text: z.ZodString;
665
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
666
+ type: z.ZodLiteral<"bold">;
667
+ }, z.core.$strict>, z.ZodObject<{
668
+ type: z.ZodLiteral<"italic">;
669
+ }, z.core.$strict>, z.ZodObject<{
670
+ type: z.ZodLiteral<"link">;
671
+ attrs: z.ZodObject<{
672
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
673
+ }, z.core.$strict>;
674
+ }, z.core.$strict>], "type">>>;
675
+ }, z.core.$strict>, z.ZodObject<{
676
+ type: z.ZodLiteral<"hardBreak">;
677
+ }, z.core.$strict>], "type">>>;
678
+ }, z.core.$strict>>;
679
+ }, z.core.$strict>>;
680
+ }, z.core.$strict>], "type">>;
681
+ }, z.core.$strict>>, z.ZodTransform<{
682
+ type: "doc";
683
+ content: ({
684
+ type: "paragraph";
685
+ content?: ({
686
+ type: "text";
687
+ text: string;
688
+ marks?: ({
689
+ type: "bold";
690
+ } | {
691
+ type: "italic";
692
+ } | {
693
+ type: "link";
694
+ attrs: {
695
+ href: string;
696
+ };
697
+ })[] | undefined;
698
+ } | {
699
+ type: "hardBreak";
700
+ })[] | undefined;
701
+ } | {
702
+ type: "bulletList";
703
+ content: {
704
+ type: "listItem";
705
+ content: {
706
+ type: "paragraph";
707
+ content?: ({
708
+ type: "text";
709
+ text: string;
710
+ marks?: ({
711
+ type: "bold";
712
+ } | {
713
+ type: "italic";
714
+ } | {
715
+ type: "link";
716
+ attrs: {
717
+ href: string;
718
+ };
719
+ })[] | undefined;
720
+ } | {
721
+ type: "hardBreak";
722
+ })[] | undefined;
723
+ }[];
724
+ }[];
725
+ })[];
726
+ } | null, {
727
+ type: "doc";
728
+ content: ({
729
+ type: "paragraph";
730
+ content?: ({
731
+ type: "text";
732
+ text: string;
733
+ marks?: ({
734
+ type: "bold";
735
+ } | {
736
+ type: "italic";
737
+ } | {
738
+ type: "link";
739
+ attrs: {
740
+ href: string;
741
+ };
742
+ })[] | undefined;
743
+ } | {
744
+ type: "hardBreak";
745
+ })[] | undefined;
746
+ } | {
747
+ type: "bulletList";
748
+ content: {
749
+ type: "listItem";
750
+ content: {
751
+ type: "paragraph";
752
+ content?: ({
753
+ type: "text";
754
+ text: string;
755
+ marks?: ({
756
+ type: "bold";
757
+ } | {
758
+ type: "italic";
759
+ } | {
760
+ type: "link";
761
+ attrs: {
762
+ href: string;
763
+ };
764
+ })[] | undefined;
765
+ } | {
766
+ type: "hardBreak";
767
+ })[] | undefined;
768
+ }[];
769
+ }[];
770
+ })[];
771
+ } | null>>>;
772
+ recipients: z.ZodOptional<z.ZodObject<{
773
+ members: z.ZodDefault<z.ZodBoolean>;
774
+ extraAddresses: z.ZodDefault<z.ZodArray<z.ZodObject<{
775
+ address: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
776
+ name: z.ZodOptional<z.ZodString>;
777
+ }, z.core.$strict>>>;
778
+ excludeUserIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
779
+ }, z.core.$strict>>;
780
+ imageMode: z.ZodOptional<z.ZodEnum<{
781
+ auto: "auto";
782
+ hosted: "hosted";
783
+ inline: "inline";
784
+ none: "none";
785
+ }>>;
786
+ skipWhenEmpty: z.ZodOptional<z.ZodBoolean>;
787
+ links: z.ZodOptional<z.ZodObject<{
788
+ tracearr: z.ZodBoolean;
789
+ }, z.core.$strict>>;
790
+ }, z.core.$strict>;
791
+ export type UpdateNewsletterInput = z.infer<typeof updateNewsletterSchema>;
792
+ /** The set of a newsletter's servers a person belongs to, as one string: the ids deduped, sorted and joined by a comma. */
793
+ export declare function variantKey(serverIds: readonly string[]): string;
794
+ /** The scoped servers a member has an account on, in the scope's order; every scoped server for null, an extra address that belongs to no server. */
795
+ export declare function variantServerIds(memberServerIds: readonly string[] | null, scopedServerIds: readonly string[]): string[];
796
+ /** A digest that covers several servers has no natural sender name, so the editor asks for one before the Tracearr fallback could fire. */
797
+ export declare function needsSenderName(senderName: string | null, scopedServerCount: number): boolean;
798
+ /** The shape variantKey() produces; anything else is refused before a send looks the variant up. */
799
+ export declare const variantKeySchema: z.ZodString;
800
+ export declare const newsletterTestSendSchema: z.ZodObject<{
801
+ address: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
802
+ variantKey: z.ZodOptional<z.ZodString>;
803
+ }, z.core.$strict>;
804
+ /** POST /newsletters/preview: the form as the create route would receive it, plus the saved row's id when editing so the window starts at its watermark. */
805
+ export declare const newsletterPreviewDraftSchema: z.ZodObject<{
806
+ newsletterId: z.ZodOptional<z.ZodUUID>;
807
+ newsletter: z.ZodObject<{
808
+ name: z.ZodString;
809
+ enabled: z.ZodDefault<z.ZodBoolean>;
810
+ destinationId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
811
+ schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
812
+ kind: z.ZodLiteral<"daily">;
813
+ time: z.ZodString;
814
+ }, z.core.$strict>, z.ZodObject<{
815
+ kind: z.ZodLiteral<"weekly">;
816
+ dayOfWeek: z.ZodNumber;
817
+ time: z.ZodString;
818
+ }, z.core.$strict>, z.ZodObject<{
819
+ kind: z.ZodLiteral<"monthly">;
820
+ dayOfMonth: z.ZodNumber;
821
+ time: z.ZodString;
822
+ }, z.core.$strict>, z.ZodObject<{
823
+ kind: z.ZodLiteral<"cron">;
824
+ expression: z.ZodString;
825
+ }, z.core.$strict>], "kind">;
826
+ timezone: z.ZodString;
827
+ window: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
828
+ kind: z.ZodLiteral<"since_last_send">;
829
+ fallbackDays: z.ZodNumber;
830
+ }, z.core.$strict>, z.ZodObject<{
831
+ kind: z.ZodLiteral<"fixed">;
832
+ days: z.ZodNumber;
833
+ }, z.core.$strict>], "kind">>;
834
+ scope: z.ZodDefault<z.ZodObject<{
835
+ serverIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
836
+ libraries: z.ZodDefault<z.ZodArray<z.ZodObject<{
837
+ serverId: z.ZodUUID;
838
+ libraryId: z.ZodString;
839
+ }, z.core.$strict>>>;
840
+ }, z.core.$strict>>;
841
+ sections: z.ZodDefault<z.ZodObject<{
842
+ movies: z.ZodObject<{
843
+ enabled: z.ZodBoolean;
844
+ max: z.ZodNumber;
845
+ }, z.core.$strict>;
846
+ shows: z.ZodObject<{
847
+ enabled: z.ZodBoolean;
848
+ max: z.ZodNumber;
849
+ maxSeasonsPerShow: z.ZodNumber;
850
+ }, z.core.$strict>;
851
+ music: z.ZodObject<{
852
+ enabled: z.ZodBoolean;
853
+ max: z.ZodNumber;
854
+ }, z.core.$strict>;
855
+ mostWatched: z.ZodObject<{
856
+ enabled: z.ZodBoolean;
857
+ max: z.ZodNumber;
858
+ }, z.core.$strict>;
859
+ }, z.core.$strict>>;
860
+ subject: z.ZodDefault<z.ZodString>;
861
+ senderName: z.ZodDefault<z.ZodNullable<z.ZodString>>;
862
+ intro: z.ZodDefault<z.ZodPipe<z.ZodNullable<z.ZodObject<{
863
+ type: z.ZodLiteral<"doc">;
864
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
865
+ type: z.ZodLiteral<"paragraph">;
866
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
867
+ type: z.ZodLiteral<"text">;
868
+ text: z.ZodString;
869
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
870
+ type: z.ZodLiteral<"bold">;
871
+ }, z.core.$strict>, z.ZodObject<{
872
+ type: z.ZodLiteral<"italic">;
873
+ }, z.core.$strict>, z.ZodObject<{
874
+ type: z.ZodLiteral<"link">;
875
+ attrs: z.ZodObject<{
876
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
877
+ }, z.core.$strict>;
878
+ }, z.core.$strict>], "type">>>;
879
+ }, z.core.$strict>, z.ZodObject<{
880
+ type: z.ZodLiteral<"hardBreak">;
881
+ }, z.core.$strict>], "type">>>;
882
+ }, z.core.$strict>, z.ZodObject<{
883
+ type: z.ZodLiteral<"bulletList">;
884
+ content: z.ZodArray<z.ZodObject<{
885
+ type: z.ZodLiteral<"listItem">;
886
+ content: z.ZodArray<z.ZodObject<{
887
+ type: z.ZodLiteral<"paragraph">;
888
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
889
+ type: z.ZodLiteral<"text">;
890
+ text: z.ZodString;
891
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
892
+ type: z.ZodLiteral<"bold">;
893
+ }, z.core.$strict>, z.ZodObject<{
894
+ type: z.ZodLiteral<"italic">;
895
+ }, z.core.$strict>, z.ZodObject<{
896
+ type: z.ZodLiteral<"link">;
897
+ attrs: z.ZodObject<{
898
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
899
+ }, z.core.$strict>;
900
+ }, z.core.$strict>], "type">>>;
901
+ }, z.core.$strict>, z.ZodObject<{
902
+ type: z.ZodLiteral<"hardBreak">;
903
+ }, z.core.$strict>], "type">>>;
904
+ }, z.core.$strict>>;
905
+ }, z.core.$strict>>;
906
+ }, z.core.$strict>], "type">>;
907
+ }, z.core.$strict>>, z.ZodTransform<{
908
+ type: "doc";
909
+ content: ({
910
+ type: "paragraph";
911
+ content?: ({
912
+ type: "text";
913
+ text: string;
914
+ marks?: ({
915
+ type: "bold";
916
+ } | {
917
+ type: "italic";
918
+ } | {
919
+ type: "link";
920
+ attrs: {
921
+ href: string;
922
+ };
923
+ })[] | undefined;
924
+ } | {
925
+ type: "hardBreak";
926
+ })[] | undefined;
927
+ } | {
928
+ type: "bulletList";
929
+ content: {
930
+ type: "listItem";
931
+ content: {
932
+ type: "paragraph";
933
+ content?: ({
934
+ type: "text";
935
+ text: string;
936
+ marks?: ({
937
+ type: "bold";
938
+ } | {
939
+ type: "italic";
940
+ } | {
941
+ type: "link";
942
+ attrs: {
943
+ href: string;
944
+ };
945
+ })[] | undefined;
946
+ } | {
947
+ type: "hardBreak";
948
+ })[] | undefined;
949
+ }[];
950
+ }[];
951
+ })[];
952
+ } | null, {
953
+ type: "doc";
954
+ content: ({
955
+ type: "paragraph";
956
+ content?: ({
957
+ type: "text";
958
+ text: string;
959
+ marks?: ({
960
+ type: "bold";
961
+ } | {
962
+ type: "italic";
963
+ } | {
964
+ type: "link";
965
+ attrs: {
966
+ href: string;
967
+ };
968
+ })[] | undefined;
969
+ } | {
970
+ type: "hardBreak";
971
+ })[] | undefined;
972
+ } | {
973
+ type: "bulletList";
974
+ content: {
975
+ type: "listItem";
976
+ content: {
977
+ type: "paragraph";
978
+ content?: ({
979
+ type: "text";
980
+ text: string;
981
+ marks?: ({
982
+ type: "bold";
983
+ } | {
984
+ type: "italic";
985
+ } | {
986
+ type: "link";
987
+ attrs: {
988
+ href: string;
989
+ };
990
+ })[] | undefined;
991
+ } | {
992
+ type: "hardBreak";
993
+ })[] | undefined;
994
+ }[];
995
+ }[];
996
+ })[];
997
+ } | null>>>;
998
+ outro: z.ZodDefault<z.ZodPipe<z.ZodNullable<z.ZodObject<{
999
+ type: z.ZodLiteral<"doc">;
1000
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1001
+ type: z.ZodLiteral<"paragraph">;
1002
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1003
+ type: z.ZodLiteral<"text">;
1004
+ text: z.ZodString;
1005
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1006
+ type: z.ZodLiteral<"bold">;
1007
+ }, z.core.$strict>, z.ZodObject<{
1008
+ type: z.ZodLiteral<"italic">;
1009
+ }, z.core.$strict>, z.ZodObject<{
1010
+ type: z.ZodLiteral<"link">;
1011
+ attrs: z.ZodObject<{
1012
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
1013
+ }, z.core.$strict>;
1014
+ }, z.core.$strict>], "type">>>;
1015
+ }, z.core.$strict>, z.ZodObject<{
1016
+ type: z.ZodLiteral<"hardBreak">;
1017
+ }, z.core.$strict>], "type">>>;
1018
+ }, z.core.$strict>, z.ZodObject<{
1019
+ type: z.ZodLiteral<"bulletList">;
1020
+ content: z.ZodArray<z.ZodObject<{
1021
+ type: z.ZodLiteral<"listItem">;
1022
+ content: z.ZodArray<z.ZodObject<{
1023
+ type: z.ZodLiteral<"paragraph">;
1024
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1025
+ type: z.ZodLiteral<"text">;
1026
+ text: z.ZodString;
1027
+ marks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1028
+ type: z.ZodLiteral<"bold">;
1029
+ }, z.core.$strict>, z.ZodObject<{
1030
+ type: z.ZodLiteral<"italic">;
1031
+ }, z.core.$strict>, z.ZodObject<{
1032
+ type: z.ZodLiteral<"link">;
1033
+ attrs: z.ZodObject<{
1034
+ href: z.ZodPipe<z.ZodString, z.ZodURL>;
1035
+ }, z.core.$strict>;
1036
+ }, z.core.$strict>], "type">>>;
1037
+ }, z.core.$strict>, z.ZodObject<{
1038
+ type: z.ZodLiteral<"hardBreak">;
1039
+ }, z.core.$strict>], "type">>>;
1040
+ }, z.core.$strict>>;
1041
+ }, z.core.$strict>>;
1042
+ }, z.core.$strict>], "type">>;
1043
+ }, z.core.$strict>>, z.ZodTransform<{
1044
+ type: "doc";
1045
+ content: ({
1046
+ type: "paragraph";
1047
+ content?: ({
1048
+ type: "text";
1049
+ text: string;
1050
+ marks?: ({
1051
+ type: "bold";
1052
+ } | {
1053
+ type: "italic";
1054
+ } | {
1055
+ type: "link";
1056
+ attrs: {
1057
+ href: string;
1058
+ };
1059
+ })[] | undefined;
1060
+ } | {
1061
+ type: "hardBreak";
1062
+ })[] | undefined;
1063
+ } | {
1064
+ type: "bulletList";
1065
+ content: {
1066
+ type: "listItem";
1067
+ content: {
1068
+ type: "paragraph";
1069
+ content?: ({
1070
+ type: "text";
1071
+ text: string;
1072
+ marks?: ({
1073
+ type: "bold";
1074
+ } | {
1075
+ type: "italic";
1076
+ } | {
1077
+ type: "link";
1078
+ attrs: {
1079
+ href: string;
1080
+ };
1081
+ })[] | undefined;
1082
+ } | {
1083
+ type: "hardBreak";
1084
+ })[] | undefined;
1085
+ }[];
1086
+ }[];
1087
+ })[];
1088
+ } | null, {
1089
+ type: "doc";
1090
+ content: ({
1091
+ type: "paragraph";
1092
+ content?: ({
1093
+ type: "text";
1094
+ text: string;
1095
+ marks?: ({
1096
+ type: "bold";
1097
+ } | {
1098
+ type: "italic";
1099
+ } | {
1100
+ type: "link";
1101
+ attrs: {
1102
+ href: string;
1103
+ };
1104
+ })[] | undefined;
1105
+ } | {
1106
+ type: "hardBreak";
1107
+ })[] | undefined;
1108
+ } | {
1109
+ type: "bulletList";
1110
+ content: {
1111
+ type: "listItem";
1112
+ content: {
1113
+ type: "paragraph";
1114
+ content?: ({
1115
+ type: "text";
1116
+ text: string;
1117
+ marks?: ({
1118
+ type: "bold";
1119
+ } | {
1120
+ type: "italic";
1121
+ } | {
1122
+ type: "link";
1123
+ attrs: {
1124
+ href: string;
1125
+ };
1126
+ })[] | undefined;
1127
+ } | {
1128
+ type: "hardBreak";
1129
+ })[] | undefined;
1130
+ }[];
1131
+ }[];
1132
+ })[];
1133
+ } | null>>>;
1134
+ recipients: z.ZodDefault<z.ZodObject<{
1135
+ members: z.ZodDefault<z.ZodBoolean>;
1136
+ extraAddresses: z.ZodDefault<z.ZodArray<z.ZodObject<{
1137
+ address: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
1138
+ name: z.ZodOptional<z.ZodString>;
1139
+ }, z.core.$strict>>>;
1140
+ excludeUserIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
1141
+ }, z.core.$strict>>;
1142
+ imageMode: z.ZodDefault<z.ZodEnum<{
1143
+ auto: "auto";
1144
+ hosted: "hosted";
1145
+ inline: "inline";
1146
+ none: "none";
1147
+ }>>;
1148
+ skipWhenEmpty: z.ZodDefault<z.ZodBoolean>;
1149
+ links: z.ZodDefault<z.ZodObject<{
1150
+ tracearr: z.ZodBoolean;
1151
+ }, z.core.$strict>>;
1152
+ }, z.core.$strict>;
1153
+ }, z.core.$strict>;
1154
+ export type NewsletterPreviewDraftInput = z.infer<typeof newsletterPreviewDraftSchema>;
1155
+ export declare const emailSuppressionCreateSchema: z.ZodObject<{
1156
+ address: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
1157
+ }, z.core.$strict>;
1158
+ export declare const newsletterSendsQuerySchema: z.ZodObject<{
1159
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1160
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1161
+ }, z.core.$strip>;
1162
+ export declare const EMAIL_LOGO_MODES: readonly ['tracearr', 'none', 'url'];
1163
+ export type EmailLogoMode = (typeof EMAIL_LOGO_MODES)[number];
1164
+ export declare const emailBrandingSchema: z.ZodObject<{
1165
+ logo: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
1166
+ mode: z.ZodLiteral<"tracearr">;
1167
+ }, z.core.$strict>, z.ZodObject<{
1168
+ mode: z.ZodLiteral<"none">;
1169
+ }, z.core.$strict>, z.ZodObject<{
1170
+ mode: z.ZodLiteral<"url">;
1171
+ url: z.ZodPipe<z.ZodString, z.ZodURL>;
1172
+ }, z.core.$strict>], "mode">>;
1173
+ accentColor: z.ZodDefault<z.ZodString>;
1174
+ footerText: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1175
+ postalAddress: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1176
+ mailtoUnsubscribe: z.ZodDefault<z.ZodBoolean>;
1177
+ }, z.core.$strict>;
1178
+ export type EmailBrandingSettings = z.infer<typeof emailBrandingSchema>;
1179
+ export declare const DEFAULT_EMAIL_BRANDING: EmailBrandingSettings;
1180
+ /** A block an older build wrote may carry keys this one dropped; the read path strips them instead of resetting to defaults. */
1181
+ export declare const emailBrandingReadSchema: z.ZodObject<{
1182
+ logo: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
1183
+ mode: z.ZodLiteral<"tracearr">;
1184
+ }, z.core.$strict>, z.ZodObject<{
1185
+ mode: z.ZodLiteral<"none">;
1186
+ }, z.core.$strict>, z.ZodObject<{
1187
+ mode: z.ZodLiteral<"url">;
1188
+ url: z.ZodPipe<z.ZodString, z.ZodURL>;
1189
+ }, z.core.$strict>], "mode">>;
1190
+ accentColor: z.ZodDefault<z.ZodString>;
1191
+ footerText: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1192
+ postalAddress: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1193
+ mailtoUnsubscribe: z.ZodDefault<z.ZodBoolean>;
1194
+ }, z.core.$strip>;
1195
+ export declare const NEWSLETTER_VIEW_TOKEN_LENGTH = 43;
1196
+ export declare const NEWSLETTER_SNAPSHOT_RETENTION_DAYS = 90;
1197
+ export declare const NEWSLETTER_SEND_RETENTION_DAYS = 365;
1198
+ export interface NewsletterSendHtml {
1199
+ subject: string;
1200
+ html: string;
1201
+ }
1202
+ export declare function newsletterCron(schedule: NewsletterSchedule): string;
1203
+ /** Null means the scoped server's name when the scope resolves to exactly one server; several servers have no natural name. */
1204
+ export declare function resolveSenderName(senderName: string | null, scopedServerNames: string[]): string;
1205
+ /** What one set of the newsletter's servers received: who, how much was trimmed to fit, how big, or that nothing was new there. */
1206
+ export interface NewsletterSendVariant {
1207
+ key: string;
1208
+ serverIds: string[];
1209
+ serverNames: string[];
1210
+ /** Deliverable recipients in this variant. */
1211
+ recipientCount: number;
1212
+ trimmed: NewsletterSectionCounts;
1213
+ bytes: number;
1214
+ /** Nothing new in the window for these servers: no snapshot, nobody in the variant was mailed. */
1215
+ empty: boolean;
1216
+ }
1217
+ /** API shapes. Dates are ISO strings. */
1218
+ export interface NewsletterSendSummary {
1219
+ id: string;
1220
+ trigger: NewsletterSendTrigger;
1221
+ outcome: NewsletterSendOutcome;
1222
+ windowStart: string;
1223
+ windowEnd: string;
1224
+ recipientCount: number;
1225
+ itemCounts: Record<string, number>;
1226
+ error: string | null;
1227
+ startedAt: string | null;
1228
+ finishedAt: string | null;
1229
+ hasSnapshot: boolean;
1230
+ variants: NewsletterSendVariant[];
1231
+ }
1232
+ export interface Newsletter {
1233
+ id: string;
1234
+ name: string;
1235
+ enabled: boolean;
1236
+ destinationId: string | null;
1237
+ schedule: NewsletterSchedule;
1238
+ timezone: string;
1239
+ window: NewsletterWindow;
1240
+ scope: NewsletterScope;
1241
+ sections: NewsletterSections;
1242
+ subject: string;
1243
+ senderName: string | null;
1244
+ intro: EmailRichTextDoc | null;
1245
+ outro: EmailRichTextDoc | null;
1246
+ recipients: NewsletterRecipients;
1247
+ imageMode: NewsletterImageMode;
1248
+ skipWhenEmpty: boolean;
1249
+ links: NewsletterLinks;
1250
+ createdAt: string;
1251
+ updatedAt: string;
1252
+ lastSend: NewsletterSendSummary | null;
1253
+ nextRunAt: string | null;
1254
+ }
1255
+ export interface NewsletterSendRecipient {
1256
+ id: string;
1257
+ address: string;
1258
+ userId: string | null;
1259
+ status: NewsletterRecipientStatus;
1260
+ variantKey: string;
1261
+ attempts: number;
1262
+ error: string | null;
1263
+ sentAt: string | null;
1264
+ }
1265
+ export interface NewsletterSendDetail extends NewsletterSendSummary {
1266
+ recipients: NewsletterSendRecipient[];
1267
+ }
1268
+ export interface NewsletterSendsPage {
1269
+ sends: NewsletterSendSummary[];
1270
+ total: number;
1271
+ page: number;
1272
+ pageSize: number;
1273
+ }
1274
+ export interface NewsletterRecipientPerson {
1275
+ userId: string;
1276
+ /** The person's oldest account on a scoped server; the identity PATCH route and the user page key on it. */
1277
+ serverUserId: string;
1278
+ name: string | null;
1279
+ username: string | null;
1280
+ serverId: string;
1281
+ serverName: string;
1282
+ thumbUrl: string | null;
1283
+ /** Every scoped server this person has an active account on, oldest account first. */
1284
+ serverIds: string[];
1285
+ }
1286
+ export declare const NEWSLETTER_EXCLUDED_REASONS: readonly ['excluded', 'banned', 'pending', 'noServer'];
1287
+ export type NewsletterExcludedReason = (typeof NEWSLETTER_EXCLUDED_REASONS)[number];
1288
+ /** Why a person with an account on a scoped server is not on the list: the owner excluded them, or their identity is banned or still pending. */
1289
+ export interface NewsletterExcludedPerson extends NewsletterRecipientPerson {
1290
+ reason: NewsletterExcludedReason;
1291
+ }
1292
+ export interface NewsletterResolvedRecipient {
1293
+ address: string;
1294
+ userId: string | null;
1295
+ serverUserId: string | null;
1296
+ name: string | null;
1297
+ suppressed: boolean;
1298
+ serverId: string | null;
1299
+ username: string | null;
1300
+ serverName: string | null;
1301
+ thumbUrl: string | null;
1302
+ /** Every scoped server the person has an account on; empty for an extra address. */
1303
+ serverIds: string[];
1304
+ }
1305
+ /** GET /newsletters/:id/recipients: who the next send reaches, who has no address, and who the owner excluded. */
1306
+ export interface NewsletterRecipientsView {
1307
+ recipients: NewsletterResolvedRecipient[];
1308
+ missing: NewsletterRecipientPerson[];
1309
+ excluded: NewsletterExcludedPerson[];
1310
+ }
1311
+ export interface EmailSuppression {
1312
+ address: string;
1313
+ reason: EmailSuppressionReason;
1314
+ sourceSendId: string | null;
1315
+ sourceNewsletterId: string | null;
1316
+ createdAt: string;
1317
+ }
1318
+ /** Cards a section holds, albums counted across artists; also the shape of what the render-time fit loop removed per section. */
1319
+ export interface NewsletterSectionCounts {
1320
+ movies: number;
1321
+ shows: number;
1322
+ albums: number;
1323
+ mostWatched: number;
1324
+ }
1325
+ export interface NewsletterPreviewVariant {
1326
+ key: string;
1327
+ serverIds: string[];
1328
+ serverNames: string[];
1329
+ /** Deliverable recipients in this variant. */
1330
+ recipientCount: number;
1331
+ subject: string;
1332
+ html: string;
1333
+ counts: Record<string, number>;
1334
+ /** Items the fit loop removed so the email stays under the clip budget; each shows in its section's "+N more" line. */
1335
+ trimmed: NewsletterSectionCounts;
1336
+ }
1337
+ export interface NewsletterPreview {
1338
+ /** fromWatermark is true when a since_last_send window started at the last counted send rather than the fallback days. */
1339
+ window: {
1340
+ start: string;
1341
+ end: string;
1342
+ fromWatermark: boolean;
1343
+ };
1344
+ recipients: {
1345
+ resolved: number;
1346
+ missingEmail: number;
1347
+ suppressed: number;
1348
+ };
1349
+ /** The union of the newsletter's servers first, then one entry per set some recipient belongs to. */
1350
+ variants: [NewsletterPreviewVariant, ...NewsletterPreviewVariant[]];
1351
+ }
1352
+ /** GET /newsletters/:id/variants: what each set of servers would get from the next send, without rendering. */
1353
+ export interface NewsletterVariantsView {
1354
+ window: {
1355
+ start: string;
1356
+ end: string;
1357
+ };
1358
+ variants: {
1359
+ key: string;
1360
+ serverIds: string[];
1361
+ serverNames: string[];
1362
+ recipientCount: number;
1363
+ counts: Record<string, number>;
1364
+ isEmpty: boolean;
1365
+ }[];
1366
+ }
1367
+ //# sourceMappingURL=newsletters.d.ts.map