@marcoappio/marco-config 2.0.420 → 2.0.421

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.
@@ -1,6 +1,6 @@
1
1
  import type { MarcoSyncedQueryContext } from '../../types';
2
2
  type GetThreadsArgs = {
3
- limit?: number;
3
+ limit: number;
4
4
  search?: string;
5
5
  where?: {
6
6
  flagged?: boolean;
@@ -33,11 +33,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
33
33
  customType: string;
34
34
  }, "optional"> & {
35
35
  optional: true;
36
+ } & {
37
+ serverName: string;
36
38
  };
37
39
  readonly undoSendEnabled: {
38
40
  type: "boolean";
39
41
  optional: false;
40
42
  customType: boolean;
43
+ } & {
44
+ serverName: string;
41
45
  };
42
46
  };
43
47
  primaryKey: readonly [string, ...string[]];
@@ -51,6 +55,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
51
55
  type: "number";
52
56
  optional: false;
53
57
  customType: number;
58
+ } & {
59
+ serverName: string;
54
60
  };
55
61
  readonly id: {
56
62
  type: "string";
@@ -66,6 +72,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
66
72
  type: "string";
67
73
  optional: false;
68
74
  customType: string;
75
+ } & {
76
+ serverName: string;
69
77
  };
70
78
  };
71
79
  primaryKey: readonly [string, ...string[]];
@@ -79,6 +87,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
79
87
  type: "string";
80
88
  optional: false;
81
89
  customType: string;
90
+ } & {
91
+ serverName: string;
82
92
  };
83
93
  readonly id: {
84
94
  type: "string";
@@ -96,6 +106,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
96
106
  type: "string";
97
107
  optional: false;
98
108
  customType: string;
109
+ } & {
110
+ serverName: string;
99
111
  };
100
112
  };
101
113
  primaryKey: readonly [string, ...string[]];
@@ -116,6 +128,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
116
128
  customType: string;
117
129
  }, "optional"> & {
118
130
  optional: true;
131
+ } & {
132
+ serverName: string;
119
133
  };
120
134
  readonly id: {
121
135
  type: "string";
@@ -126,16 +140,22 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
126
140
  type: "string";
127
141
  optional: false;
128
142
  customType: "AWAITING_CONNECTION" | "CONNECTED" | "CONNECTION_FAILED_AUTHENTICATION_ERROR" | "CONNECTION_FAILED_CONNECTION_ERROR" | "CONNECTION_FAILED_OAUTH_EXCHANGE_ERROR" | "CONNECTION_FAILED_QUOTA_ERROR" | "CONNECTION_FAILED_UNKNOWN_ERROR";
143
+ } & {
144
+ serverName: string;
129
145
  };
130
146
  readonly mailProcessedCount: {
131
147
  type: "number";
132
148
  optional: false;
133
149
  customType: number;
150
+ } & {
151
+ serverName: string;
134
152
  };
135
153
  readonly mailTotalCount: {
136
154
  type: "number";
137
155
  optional: false;
138
156
  customType: number;
157
+ } & {
158
+ serverName: string;
139
159
  };
140
160
  readonly primaryAliasId: Omit<{
141
161
  type: "string";
@@ -143,11 +163,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
143
163
  customType: string;
144
164
  }, "optional"> & {
145
165
  optional: true;
166
+ } & {
167
+ serverName: string;
146
168
  };
147
169
  readonly userId: {
148
170
  type: "string";
149
171
  optional: false;
150
172
  customType: string;
173
+ } & {
174
+ serverName: string;
151
175
  };
152
176
  };
153
177
  primaryKey: readonly [string, ...string[]];
@@ -161,11 +185,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
161
185
  type: "string";
162
186
  optional: false;
163
187
  customType: string;
188
+ } & {
189
+ serverName: string;
164
190
  };
165
191
  readonly emailAddress: {
166
192
  type: "string";
167
193
  optional: false;
168
194
  customType: string;
195
+ } & {
196
+ serverName: string;
169
197
  };
170
198
  readonly id: {
171
199
  type: "string";
@@ -176,6 +204,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
176
204
  type: "boolean";
177
205
  optional: false;
178
206
  customType: boolean;
207
+ } & {
208
+ serverName: string;
179
209
  };
180
210
  readonly name: Omit<{
181
211
  type: "string";
@@ -196,6 +226,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
196
226
  type: "string";
197
227
  optional: false;
198
228
  customType: string;
229
+ } & {
230
+ serverName: string;
199
231
  };
200
232
  readonly id: {
201
233
  type: "string";
@@ -213,6 +245,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
213
245
  customType: "ARCHIVE" | "INBOX" | "SENT" | "SPAM" | "TRASH";
214
246
  }, "optional"> & {
215
247
  optional: true;
248
+ } & {
249
+ serverName: string;
216
250
  };
217
251
  };
218
252
  primaryKey: readonly [string, ...string[]];
@@ -226,6 +260,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
226
260
  type: "string";
227
261
  optional: false;
228
262
  customType: string;
263
+ } & {
264
+ serverName: string;
229
265
  };
230
266
  readonly body: {
231
267
  type: "json";
@@ -250,11 +286,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
250
286
  customType: string;
251
287
  }, "optional"> & {
252
288
  optional: true;
289
+ } & {
290
+ serverName: string;
253
291
  };
254
292
  readonly fromEmail: {
255
293
  type: "string";
256
294
  optional: false;
257
295
  customType: string;
296
+ } & {
297
+ serverName: string;
258
298
  };
259
299
  readonly fromName: Omit<{
260
300
  type: "string";
@@ -262,6 +302,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
262
302
  customType: string;
263
303
  }, "optional"> & {
264
304
  optional: true;
305
+ } & {
306
+ serverName: string;
265
307
  };
266
308
  readonly id: {
267
309
  type: "string";
@@ -274,6 +316,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
274
316
  customType: string;
275
317
  }, "optional"> & {
276
318
  optional: true;
319
+ } & {
320
+ serverName: string;
277
321
  };
278
322
  readonly scheduledFor: Omit<{
279
323
  type: "number";
@@ -281,6 +325,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
281
325
  customType: number;
282
326
  }, "optional"> & {
283
327
  optional: true;
328
+ } & {
329
+ serverName: string;
284
330
  };
285
331
  readonly status: {
286
332
  type: "string";
@@ -303,11 +349,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
303
349
  type: "number";
304
350
  optional: false;
305
351
  customType: number;
352
+ } & {
353
+ serverName: string;
306
354
  };
307
355
  readonly userId: {
308
356
  type: "string";
309
357
  optional: false;
310
358
  customType: string;
359
+ } & {
360
+ serverName: string;
311
361
  };
312
362
  };
313
363
  primaryKey: readonly [string, ...string[]];
@@ -321,11 +371,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
321
371
  type: "string";
322
372
  optional: false;
323
373
  customType: string;
374
+ } & {
375
+ serverName: string;
324
376
  };
325
377
  readonly emailAddress: {
326
378
  type: "string";
327
379
  optional: false;
328
380
  customType: string;
381
+ } & {
382
+ serverName: string;
329
383
  };
330
384
  readonly id: {
331
385
  type: "string";
@@ -349,6 +403,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
349
403
  type: "string";
350
404
  optional: false;
351
405
  customType: string;
406
+ } & {
407
+ serverName: string;
352
408
  };
353
409
  readonly failed: {
354
410
  type: "boolean";
@@ -359,6 +415,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
359
415
  type: "string";
360
416
  optional: false;
361
417
  customType: string;
418
+ } & {
419
+ serverName: string;
362
420
  };
363
421
  readonly id: {
364
422
  type: "string";
@@ -369,21 +427,29 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
369
427
  type: "string";
370
428
  optional: false;
371
429
  customType: string;
430
+ } & {
431
+ serverName: string;
372
432
  };
373
433
  readonly totalChunks: {
374
434
  type: "number";
375
435
  optional: false;
376
436
  customType: number;
437
+ } & {
438
+ serverName: string;
377
439
  };
378
440
  readonly totalSize: {
379
441
  type: "number";
380
442
  optional: false;
381
443
  customType: number;
444
+ } & {
445
+ serverName: string;
382
446
  };
383
447
  readonly uploadedChunks: {
384
448
  type: "number";
385
449
  optional: false;
386
450
  customType: number;
451
+ } & {
452
+ serverName: string;
387
453
  };
388
454
  };
389
455
  primaryKey: readonly [string, ...string[]];
@@ -397,6 +463,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
397
463
  type: "string";
398
464
  optional: false;
399
465
  customType: string;
466
+ } & {
467
+ serverName: string;
400
468
  };
401
469
  readonly flagged: {
402
470
  type: "boolean";
@@ -412,6 +480,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
412
480
  type: "number";
413
481
  optional: false;
414
482
  customType: number;
483
+ } & {
484
+ serverName: string;
415
485
  };
416
486
  readonly seen: {
417
487
  type: "boolean";
@@ -422,6 +492,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
422
492
  type: "string";
423
493
  optional: false;
424
494
  customType: string;
495
+ } & {
496
+ serverName: string;
425
497
  };
426
498
  readonly words: {
427
499
  type: "string";
@@ -440,11 +512,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
440
512
  type: "string";
441
513
  optional: false;
442
514
  customType: string;
515
+ } & {
516
+ serverName: string;
443
517
  };
444
518
  readonly threadId: {
445
519
  type: "string";
446
520
  optional: false;
447
521
  customType: string;
522
+ } & {
523
+ serverName: string;
448
524
  };
449
525
  };
450
526
  primaryKey: readonly [string, ...string[]];
@@ -458,6 +534,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
458
534
  type: "number";
459
535
  optional: false;
460
536
  customType: number;
537
+ } & {
538
+ serverName: string;
461
539
  };
462
540
  readonly envelopeSubject: Omit<{
463
541
  type: "string";
@@ -465,6 +543,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
465
543
  customType: string;
466
544
  }, "optional"> & {
467
545
  optional: true;
546
+ } & {
547
+ serverName: string;
468
548
  };
469
549
  readonly id: {
470
550
  type: "string";
@@ -475,11 +555,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
475
555
  type: "string";
476
556
  optional: false;
477
557
  customType: string;
558
+ } & {
559
+ serverName: string;
478
560
  };
479
561
  readonly senderEmail: {
480
562
  type: "string";
481
563
  optional: false;
482
564
  customType: string;
565
+ } & {
566
+ serverName: string;
483
567
  };
484
568
  readonly senderName: Omit<{
485
569
  type: "string";
@@ -487,11 +571,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
487
571
  customType: string;
488
572
  }, "optional"> & {
489
573
  optional: true;
574
+ } & {
575
+ serverName: string;
490
576
  };
491
577
  readonly threadId: {
492
578
  type: "string";
493
579
  optional: false;
494
580
  customType: string;
581
+ } & {
582
+ serverName: string;
495
583
  };
496
584
  };
497
585
  primaryKey: readonly [string, ...string[]];
@@ -505,6 +593,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
505
593
  type: "string";
506
594
  optional: false;
507
595
  customType: string;
596
+ } & {
597
+ serverName: string;
508
598
  };
509
599
  readonly id: {
510
600
  type: "string";
@@ -522,6 +612,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
522
612
  type: "string";
523
613
  optional: false;
524
614
  customType: string;
615
+ } & {
616
+ serverName: string;
525
617
  };
526
618
  readonly type: {
527
619
  type: "string";
@@ -540,6 +632,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
540
632
  type: "string";
541
633
  optional: false;
542
634
  customType: string;
635
+ } & {
636
+ serverName: string;
543
637
  };
544
638
  readonly id: {
545
639
  type: "string";
@@ -550,6 +644,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
550
644
  type: "string";
551
645
  optional: false;
552
646
  customType: string;
647
+ } & {
648
+ serverName: string;
553
649
  };
554
650
  readonly size: {
555
651
  type: "number";
@@ -565,6 +661,8 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
565
661
  type: "string";
566
662
  optional: false;
567
663
  customType: string;
664
+ } & {
665
+ serverName: string;
568
666
  };
569
667
  };
570
668
  primaryKey: readonly [string, ...string[]];
@@ -578,11 +676,15 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
578
676
  type: "string";
579
677
  optional: false;
580
678
  customType: string;
679
+ } & {
680
+ serverName: string;
581
681
  };
582
682
  readonly threadMessageId: {
583
683
  type: "string";
584
684
  optional: false;
585
685
  customType: string;
686
+ } & {
687
+ serverName: string;
586
688
  };
587
689
  };
588
690
  primaryKey: readonly [string, ...string[]];
@@ -594,7 +696,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
594
696
  readonly user: {
595
697
  accounts: [{
596
698
  readonly sourceField: string[];
597
- readonly destField: ("id" | "color" | "userId" | "mailProcessedCount" | "mailTotalCount" | "displayName" | "imapConnectionStatus" | "primaryAliasId")[];
699
+ readonly destField: ("id" | "color" | "userId" | "displayName" | "imapConnectionStatus" | "mailProcessedCount" | "mailTotalCount" | "primaryAliasId")[];
598
700
  readonly destSchema: "account";
599
701
  readonly cardinality: "many";
600
702
  }];
@@ -606,7 +708,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
606
708
  }];
607
709
  drafts: [{
608
710
  readonly sourceField: string[];
609
- readonly destField: ("type" | "status" | "id" | "updatedAt" | "body" | "accountId" | "subject" | "scheduledFor" | "error" | "fromName" | "referencedMessageId" | "userId" | "fromEmail" | "fromAliasId")[];
711
+ readonly destField: ("type" | "status" | "id" | "updatedAt" | "body" | "accountId" | "subject" | "scheduledFor" | "error" | "fromName" | "referencedMessageId" | "userId" | "fromAliasId" | "fromEmail")[];
610
712
  readonly destSchema: "draft";
611
713
  readonly cardinality: "many";
612
714
  }];
@@ -626,7 +728,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
626
728
  readonly userPushNotificationToken: {
627
729
  user: [{
628
730
  readonly sourceField: string[];
629
- readonly destField: ("id" | "name" | "undoSendEnabled" | "profilePicture")[];
731
+ readonly destField: ("id" | "name" | "profilePicture" | "undoSendEnabled")[];
630
732
  readonly destSchema: "user";
631
733
  readonly cardinality: "one";
632
734
  }];
@@ -634,7 +736,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
634
736
  readonly contact: {
635
737
  user: [{
636
738
  readonly sourceField: string[];
637
- readonly destField: ("id" | "name" | "undoSendEnabled" | "profilePicture")[];
739
+ readonly destField: ("id" | "name" | "profilePicture" | "undoSendEnabled")[];
638
740
  readonly destSchema: "user";
639
741
  readonly cardinality: "one";
640
742
  }];
@@ -648,7 +750,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
648
750
  }];
649
751
  drafts: [{
650
752
  readonly sourceField: string[];
651
- readonly destField: ("type" | "status" | "id" | "updatedAt" | "body" | "accountId" | "subject" | "scheduledFor" | "error" | "fromName" | "referencedMessageId" | "userId" | "fromEmail" | "fromAliasId")[];
753
+ readonly destField: ("type" | "status" | "id" | "updatedAt" | "body" | "accountId" | "subject" | "scheduledFor" | "error" | "fromName" | "referencedMessageId" | "userId" | "fromAliasId" | "fromEmail")[];
652
754
  readonly destSchema: "draft";
653
755
  readonly cardinality: "many";
654
756
  }];
@@ -672,7 +774,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
672
774
  }];
673
775
  user: [{
674
776
  readonly sourceField: string[];
675
- readonly destField: ("id" | "name" | "undoSendEnabled" | "profilePicture")[];
777
+ readonly destField: ("id" | "name" | "profilePicture" | "undoSendEnabled")[];
676
778
  readonly destSchema: "user";
677
779
  readonly cardinality: "one";
678
780
  }];
@@ -680,7 +782,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
680
782
  readonly accountAlias: {
681
783
  account: [{
682
784
  readonly sourceField: string[];
683
- readonly destField: ("id" | "color" | "userId" | "mailProcessedCount" | "mailTotalCount" | "displayName" | "imapConnectionStatus" | "primaryAliasId")[];
785
+ readonly destField: ("id" | "color" | "userId" | "displayName" | "imapConnectionStatus" | "mailProcessedCount" | "mailTotalCount" | "primaryAliasId")[];
684
786
  readonly destSchema: "account";
685
787
  readonly cardinality: "one";
686
788
  }];
@@ -688,7 +790,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
688
790
  readonly accountLabel: {
689
791
  account: [{
690
792
  readonly sourceField: string[];
691
- readonly destField: ("id" | "color" | "userId" | "mailProcessedCount" | "mailTotalCount" | "displayName" | "imapConnectionStatus" | "primaryAliasId")[];
793
+ readonly destField: ("id" | "color" | "userId" | "displayName" | "imapConnectionStatus" | "mailProcessedCount" | "mailTotalCount" | "primaryAliasId")[];
692
794
  readonly destSchema: "account";
693
795
  readonly cardinality: "one";
694
796
  }];
@@ -699,7 +801,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
699
801
  readonly cardinality: "many";
700
802
  }, {
701
803
  readonly sourceField: string[];
702
- readonly destField: ("threadId" | "id" | "envelopeDate" | "previewText" | "senderEmail" | "envelopeSubject" | "senderName")[];
804
+ readonly destField: ("threadId" | "id" | "envelopeDate" | "envelopeSubject" | "previewText" | "senderEmail" | "senderName")[];
703
805
  readonly destSchema: "threadMessage";
704
806
  readonly cardinality: "many";
705
807
  }];
@@ -718,7 +820,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
718
820
  readonly draft: {
719
821
  account: [{
720
822
  readonly sourceField: string[];
721
- readonly destField: ("id" | "color" | "userId" | "mailProcessedCount" | "mailTotalCount" | "displayName" | "imapConnectionStatus" | "primaryAliasId")[];
823
+ readonly destField: ("id" | "color" | "userId" | "displayName" | "imapConnectionStatus" | "mailProcessedCount" | "mailTotalCount" | "primaryAliasId")[];
722
824
  readonly destSchema: "account";
723
825
  readonly cardinality: "one";
724
826
  }];
@@ -736,7 +838,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
736
838
  }];
737
839
  user: [{
738
840
  readonly sourceField: string[];
739
- readonly destField: ("id" | "name" | "undoSendEnabled" | "profilePicture")[];
841
+ readonly destField: ("id" | "name" | "profilePicture" | "undoSendEnabled")[];
740
842
  readonly destSchema: "user";
741
843
  readonly cardinality: "one";
742
844
  }];
@@ -744,7 +846,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
744
846
  readonly draftRecipient: {
745
847
  draft: [{
746
848
  readonly sourceField: string[];
747
- readonly destField: ("type" | "status" | "id" | "updatedAt" | "body" | "accountId" | "subject" | "scheduledFor" | "error" | "fromName" | "referencedMessageId" | "userId" | "fromEmail" | "fromAliasId")[];
849
+ readonly destField: ("type" | "status" | "id" | "updatedAt" | "body" | "accountId" | "subject" | "scheduledFor" | "error" | "fromName" | "referencedMessageId" | "userId" | "fromAliasId" | "fromEmail")[];
748
850
  readonly destSchema: "draft";
749
851
  readonly cardinality: "one";
750
852
  }];
@@ -752,7 +854,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
752
854
  readonly draftAttachment: {
753
855
  draft: [{
754
856
  readonly sourceField: string[];
755
- readonly destField: ("type" | "status" | "id" | "updatedAt" | "body" | "accountId" | "subject" | "scheduledFor" | "error" | "fromName" | "referencedMessageId" | "userId" | "fromEmail" | "fromAliasId")[];
857
+ readonly destField: ("type" | "status" | "id" | "updatedAt" | "body" | "accountId" | "subject" | "scheduledFor" | "error" | "fromName" | "referencedMessageId" | "userId" | "fromAliasId" | "fromEmail")[];
756
858
  readonly destSchema: "draft";
757
859
  readonly cardinality: "one";
758
860
  }];
@@ -760,7 +862,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
760
862
  readonly thread: {
761
863
  account: [{
762
864
  readonly sourceField: string[];
763
- readonly destField: ("id" | "color" | "userId" | "mailProcessedCount" | "mailTotalCount" | "displayName" | "imapConnectionStatus" | "primaryAliasId")[];
865
+ readonly destField: ("id" | "color" | "userId" | "displayName" | "imapConnectionStatus" | "mailProcessedCount" | "mailTotalCount" | "primaryAliasId")[];
764
866
  readonly destSchema: "account";
765
867
  readonly cardinality: "one";
766
868
  }];
@@ -777,13 +879,13 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
777
879
  }];
778
880
  messages: [{
779
881
  readonly sourceField: string[];
780
- readonly destField: ("threadId" | "id" | "envelopeDate" | "previewText" | "senderEmail" | "envelopeSubject" | "senderName")[];
882
+ readonly destField: ("threadId" | "id" | "envelopeDate" | "envelopeSubject" | "previewText" | "senderEmail" | "senderName")[];
781
883
  readonly destSchema: "threadMessage";
782
884
  readonly cardinality: "many";
783
885
  }];
784
886
  user: [{
785
887
  readonly sourceField: string[];
786
- readonly destField: ("id" | "name" | "undoSendEnabled" | "profilePicture")[];
888
+ readonly destField: ("id" | "name" | "profilePicture" | "undoSendEnabled")[];
787
889
  readonly destSchema: "user";
788
890
  readonly cardinality: "one";
789
891
  }];
@@ -836,7 +938,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
836
938
  readonly threadMessageRecipient: {
837
939
  message: [{
838
940
  readonly sourceField: string[];
839
- readonly destField: ("threadId" | "id" | "envelopeDate" | "previewText" | "senderEmail" | "envelopeSubject" | "senderName")[];
941
+ readonly destField: ("threadId" | "id" | "envelopeDate" | "envelopeSubject" | "previewText" | "senderEmail" | "senderName")[];
840
942
  readonly destSchema: "threadMessage";
841
943
  readonly cardinality: "one";
842
944
  }];
@@ -844,7 +946,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
844
946
  readonly threadMessageAttachment: {
845
947
  message: [{
846
948
  readonly sourceField: string[];
847
- readonly destField: ("threadId" | "id" | "envelopeDate" | "previewText" | "senderEmail" | "envelopeSubject" | "senderName")[];
949
+ readonly destField: ("threadId" | "id" | "envelopeDate" | "envelopeSubject" | "previewText" | "senderEmail" | "senderName")[];
848
950
  readonly destSchema: "threadMessage";
849
951
  readonly cardinality: "one";
850
952
  }];
@@ -858,7 +960,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
858
960
  }];
859
961
  message: [{
860
962
  readonly sourceField: string[];
861
- readonly destField: ("threadId" | "id" | "envelopeDate" | "previewText" | "senderEmail" | "envelopeSubject" | "senderName")[];
963
+ readonly destField: ("threadId" | "id" | "envelopeDate" | "envelopeSubject" | "previewText" | "senderEmail" | "senderName")[];
862
964
  readonly destSchema: "threadMessage";
863
965
  readonly cardinality: "one";
864
966
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"getThreads.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/getThreads.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAGlE,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;QACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;QACvB,IAAI,CAAC,EAAE,OAAO,CAAA;KACf,CAAA;CACF,CAAA;AAmBD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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edQueryWithContext } from '@rocicorp/zero';
2
2
  import * as v from 'valibot';
3
3
  import { z } from '../../zero/queries';
4
+ const MAX_LIMIT = 1000;
5
+ const DEFAULT_LIMIT = 50;
4
6
  const parseArgs = (args) => {
5
7
  const schema = v.object({
6
- limit: v.optional(v.number()),
8
+ limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(MAX_LIMIT)), DEFAULT_LIMIT),
7
9
  search: v.optional(v.string()),
8
10
  where: v.optional(v.object({
9
11
  flagged: v.optional(v.boolean()),
@@ -13,12 +15,12 @@ const parseArgs = (args) => {
13
15
  seen: v.optional(v.boolean()),
14
16
  })),
15
17
  });
16
- return [v.parse(schema, args[0] ?? {})];
18
+ return [v.parse(schema, args[0])];
17
19
  };
18
20
  export const getThreads = syncedQueryWithContext('getThreads', parseArgs, ({ userId }, { search, limit, where }) => {
19
21
  let query = z.thread
20
22
  .where('userId', userId)
21
- .related('messages', q => q.related('recipients').related('attachments').related('labels'))
23
+ .related('messages', x => x.related('recipients').related('attachments').related('labels'))
22
24
  .related('labels')
23
25
  .related('account')
24
26
  .orderBy('latestMessageDate', 'desc');
@@ -30,28 +32,25 @@ export const getThreads = syncedQueryWithContext('getThreads', parseArgs, ({ use
30
32
  }
31
33
  if (where?.labelIds && where.labelIds.length > 0) {
32
34
  for (const labelId of where.labelIds) {
33
- query = query.whereExists('labels', q => q.where('id', labelId));
35
+ query = query.whereExists('labels', x => x.where('id', labelId));
34
36
  }
35
37
  }
36
38
  if (where?.messageIds && where.messageIds.length > 0) {
37
39
  for (const messageId of where.messageIds) {
38
- query = query.whereExists('messages', q => q.where('id', messageId));
40
+ query = query.whereExists('messages', x => x.where('id', messageId));
39
41
  }
40
42
  }
41
43
  if (where?.participants && where.participants.length > 0) {
42
44
  for (const participant of where.participants) {
43
- query = query.whereExists('messages', q => q.whereExists('recipients', r => r.where('emailAddress', participant)));
45
+ query = query.whereExists('messages', x => x.whereExists('recipients', y => y.where('emailAddress', participant)));
44
46
  }
45
47
  }
46
48
  if (search) {
47
49
  const sanitizedTerm = search.trim().toLowerCase();
48
50
  const tokens = sanitizedTerm.split(/\s+/).filter(Boolean);
49
51
  if (tokens.length > 0) {
50
- query = query.where(({ and, cmp }) => and(...tokens.map(token => cmp('words', 'ILIKE', `%${token}%`))));
52
+ query = query.where(({ and, cmp }) => and(...tokens.map(x => cmp('words', 'ILIKE', `%${x}%`))));
51
53
  }
52
54
  }
53
- if (typeof limit === 'number') {
54
- query = query.limit(limit);
55
- }
56
- return query;
55
+ return query.limit(limit);
57
56
  });