@marcoappio/marco-config 2.0.467 → 2.0.469

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 (37) hide show
  1. package/dist/utils/threads/index.d.ts +4 -0
  2. package/dist/utils/threads/index.d.ts.map +1 -0
  3. package/dist/utils/threads/index.js +4 -0
  4. package/dist/utils/threads/processSearchTerm/index.d.ts +2 -0
  5. package/dist/utils/threads/processSearchTerm/index.d.ts.map +1 -0
  6. package/dist/utils/threads/processSearchTerm/index.js +1 -0
  7. package/dist/utils/threads/processSearchTerm/processSearchTerm.d.ts +2 -0
  8. package/dist/utils/threads/processSearchTerm/processSearchTerm.d.ts.map +1 -0
  9. package/dist/utils/threads/processSearchTerm/processSearchTerm.js +18 -0
  10. package/dist/utils/threads/processSearchTerm/processSearchTerm.test.d.ts +2 -0
  11. package/dist/utils/threads/processSearchTerm/processSearchTerm.test.d.ts.map +1 -0
  12. package/dist/utils/threads/processSearchTerm/processSearchTerm.test.js +38 -0
  13. package/dist/zero/index.d.ts +93 -35
  14. package/dist/zero/index.d.ts.map +1 -1
  15. package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
  16. package/dist/zero/mutators/threadMutators/threadMutators.js +15 -0
  17. package/dist/zero/mutators/threadMutators/threadMutators.test.js +62 -2
  18. package/dist/zero/queries/getAccounts.d.ts +12 -5
  19. package/dist/zero/queries/getAccounts.d.ts.map +1 -1
  20. package/dist/zero/queries/getContacts.d.ts +12 -5
  21. package/dist/zero/queries/getContacts.d.ts.map +1 -1
  22. package/dist/zero/queries/getDrafts.d.ts +12 -5
  23. package/dist/zero/queries/getDrafts.d.ts.map +1 -1
  24. package/dist/zero/queries/getThreadList.d.ts +13 -5
  25. package/dist/zero/queries/getThreadList.d.ts.map +1 -1
  26. package/dist/zero/queries/getThreadList.js +3 -3
  27. package/dist/zero/queries/getThreads.d.ts +13 -5
  28. package/dist/zero/queries/getThreads.d.ts.map +1 -1
  29. package/dist/zero/queries/getThreads.js +3 -3
  30. package/dist/zero/queries/getUser.d.ts +12 -5
  31. package/dist/zero/queries/getUser.d.ts.map +1 -1
  32. package/dist/zero/queries/index.d.ts +12 -5
  33. package/dist/zero/queries/index.d.ts.map +1 -1
  34. package/dist/zero/schema.d.ts +19 -5
  35. package/dist/zero/schema.d.ts.map +1 -1
  36. package/dist/zero/schema.js +1 -0
  37. package/package.json +3 -1
@@ -25,10 +25,20 @@ describe('threadMutators', () => {
25
25
  const runExisting = mock(async () => null);
26
26
  const oneExisting = mock(() => ({ run: runExisting }));
27
27
  const whereLabelId = mock(() => ({ one: oneExisting }));
28
- const whereThreadLabel = mock(() => ({ where: whereLabelId }));
28
+ const runAllThreadLabels = mock(async () => [{ labelId: 'test-label-id-1', threadId: 'test-thread-id-1' }]);
29
+ const whereThreadLabel = mock((field) => {
30
+ if (field === 'threadId') {
31
+ return { run: runAllThreadLabels, where: whereLabelId };
32
+ }
33
+ return { where: whereLabelId };
34
+ });
29
35
  const threadLabelInsert = mock(async () => { });
36
+ const threadUpdate = mock(async () => { });
30
37
  const transaction = {
31
38
  mutate: {
39
+ thread: {
40
+ update: threadUpdate,
41
+ },
32
42
  threadLabel: {
33
43
  delete: mock(async () => { }),
34
44
  insert: threadLabelInsert,
@@ -68,6 +78,10 @@ describe('threadMutators', () => {
68
78
  threadId: 'test-thread-id-1',
69
79
  threadMessageId: 'test-message-id-2',
70
80
  }));
81
+ expect(threadUpdate).toHaveBeenCalledWith({
82
+ id: 'test-thread-id-1',
83
+ labelIdList: ' test-label-id-1 ',
84
+ });
71
85
  });
72
86
  });
73
87
  describe('delete', () => {
@@ -125,11 +139,21 @@ describe('threadMutators', () => {
125
139
  const whereLabelPath = mock(() => ({ one: oneLabel }));
126
140
  const whereLabelAccount = mock(() => ({ where: whereLabelPath }));
127
141
  const runExisting = mock(async () => existingRecords);
142
+ const runRemainingLabels = mock(async () => []);
128
143
  const whereLabelId = mock(() => ({ run: runExisting }));
129
- const whereThreadLabel = mock(() => ({ where: whereLabelId }));
144
+ const whereThreadLabel = mock((field) => {
145
+ if (field === 'threadId') {
146
+ return { run: runRemainingLabels, where: whereLabelId };
147
+ }
148
+ return { where: whereLabelId };
149
+ });
130
150
  const threadLabelDelete = mock(async () => { });
151
+ const threadUpdate = mock(async () => { });
131
152
  const transaction = {
132
153
  mutate: {
154
+ thread: {
155
+ update: threadUpdate,
156
+ },
133
157
  threadLabel: {
134
158
  delete: threadLabelDelete,
135
159
  },
@@ -163,6 +187,10 @@ describe('threadMutators', () => {
163
187
  labelId: 'test-label-id-1',
164
188
  threadMessageId: 'test-message-id-2',
165
189
  });
190
+ expect(threadUpdate).toHaveBeenCalledWith({
191
+ id: 'test-thread-id-1',
192
+ labelIdList: '',
193
+ });
166
194
  });
167
195
  });
168
196
  describe('setArchive', () => {
@@ -192,8 +220,12 @@ describe('threadMutators', () => {
192
220
  const whereMessages = mock(() => ({ run: runMessages }));
193
221
  const threadLabelDelete = mock(async () => { });
194
222
  const threadLabelInsert = mock(async () => { });
223
+ const threadUpdate = mock(async () => { });
195
224
  const transaction = {
196
225
  mutate: {
226
+ thread: {
227
+ update: threadUpdate,
228
+ },
197
229
  threadLabel: {
198
230
  delete: threadLabelDelete,
199
231
  insert: threadLabelInsert,
@@ -230,6 +262,10 @@ describe('threadMutators', () => {
230
262
  threadId: 'test-thread-id-1',
231
263
  threadMessageId: 'test-message-id-1',
232
264
  }));
265
+ expect(threadUpdate).toHaveBeenCalledWith({
266
+ id: 'test-thread-id-1',
267
+ labelIdList: ' test-archive-label-id ',
268
+ });
233
269
  });
234
270
  });
235
271
  describe('setFlagged', () => {
@@ -281,8 +317,12 @@ describe('threadMutators', () => {
281
317
  const whereMessages = mock(() => ({ run: runMessages }));
282
318
  const threadLabelDelete = mock(async () => { });
283
319
  const threadLabelInsert = mock(async () => { });
320
+ const threadUpdate = mock(async () => { });
284
321
  const transaction = {
285
322
  mutate: {
323
+ thread: {
324
+ update: threadUpdate,
325
+ },
286
326
  threadLabel: {
287
327
  delete: threadLabelDelete,
288
328
  insert: threadLabelInsert,
@@ -319,6 +359,10 @@ describe('threadMutators', () => {
319
359
  threadId: 'test-thread-id-1',
320
360
  threadMessageId: 'test-message-id-1',
321
361
  }));
362
+ expect(threadUpdate).toHaveBeenCalledWith({
363
+ id: 'test-thread-id-1',
364
+ labelIdList: ' test-inbox-label-id ',
365
+ });
322
366
  });
323
367
  });
324
368
  describe('setSeen', () => {
@@ -424,8 +468,12 @@ describe('threadMutators', () => {
424
468
  const runMessages = mock(async () => messageRecords);
425
469
  const whereMessages = mock(() => ({ run: runMessages }));
426
470
  const threadLabelInsert = mock(async () => { });
471
+ const threadUpdate = mock(async () => { });
427
472
  const transaction = {
428
473
  mutate: {
474
+ thread: {
475
+ update: threadUpdate,
476
+ },
429
477
  threadLabel: {
430
478
  insert: threadLabelInsert,
431
479
  },
@@ -456,6 +504,10 @@ describe('threadMutators', () => {
456
504
  threadId: 'test-thread-id-1',
457
505
  threadMessageId: 'test-message-id-1',
458
506
  }));
507
+ expect(threadUpdate).toHaveBeenCalledWith({
508
+ id: 'test-thread-id-1',
509
+ labelIdList: ' test-spam-label-id ',
510
+ });
459
511
  });
460
512
  });
461
513
  describe('setTrash', () => {
@@ -482,8 +534,12 @@ describe('threadMutators', () => {
482
534
  const runMessages = mock(async () => messageRecords);
483
535
  const whereMessages = mock(() => ({ run: runMessages }));
484
536
  const threadLabelInsert = mock(async () => { });
537
+ const threadUpdate = mock(async () => { });
485
538
  const transaction = {
486
539
  mutate: {
540
+ thread: {
541
+ update: threadUpdate,
542
+ },
487
543
  threadLabel: {
488
544
  insert: threadLabelInsert,
489
545
  },
@@ -514,6 +570,10 @@ describe('threadMutators', () => {
514
570
  threadId: 'test-thread-id-1',
515
571
  threadMessageId: 'test-message-id-1',
516
572
  }));
573
+ expect(threadUpdate).toHaveBeenCalledWith({
574
+ id: 'test-thread-id-1',
575
+ labelIdList: ' test-trash-label-id ',
576
+ });
517
577
  });
518
578
  });
519
579
  });
@@ -442,6 +442,13 @@ export declare const getAccounts: import("@rocicorp/zero").SyncedQuery<"getAccou
442
442
  optional: false;
443
443
  customType: string;
444
444
  };
445
+ readonly labelIdList: {
446
+ type: "string";
447
+ optional: false;
448
+ customType: string;
449
+ } & {
450
+ serverName: string;
451
+ };
445
452
  readonly latestMessageDate: {
446
453
  type: "number";
447
454
  optional: false;
@@ -699,7 +706,7 @@ export declare const getAccounts: import("@rocicorp/zero").SyncedQuery<"getAccou
699
706
  }];
700
707
  threads: [{
701
708
  readonly sourceField: string[];
702
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
709
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
703
710
  readonly destSchema: "thread";
704
711
  readonly cardinality: "many";
705
712
  }];
@@ -747,7 +754,7 @@ export declare const getAccounts: import("@rocicorp/zero").SyncedQuery<"getAccou
747
754
  }];
748
755
  threads: [{
749
756
  readonly sourceField: string[];
750
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
757
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
751
758
  readonly destSchema: "thread";
752
759
  readonly cardinality: "many";
753
760
  }];
@@ -780,7 +787,7 @@ export declare const getAccounts: import("@rocicorp/zero").SyncedQuery<"getAccou
780
787
  readonly cardinality: "many";
781
788
  }, {
782
789
  readonly sourceField: string[];
783
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
790
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
784
791
  readonly destSchema: "thread";
785
792
  readonly cardinality: "many";
786
793
  }];
@@ -859,7 +866,7 @@ export declare const getAccounts: import("@rocicorp/zero").SyncedQuery<"getAccou
859
866
  }];
860
867
  thread: [{
861
868
  readonly sourceField: string[];
862
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
869
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
863
870
  readonly destSchema: "thread";
864
871
  readonly cardinality: "one";
865
872
  }];
@@ -890,7 +897,7 @@ export declare const getAccounts: import("@rocicorp/zero").SyncedQuery<"getAccou
890
897
  }];
891
898
  thread: [{
892
899
  readonly sourceField: string[];
893
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
900
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
894
901
  readonly destSchema: "thread";
895
902
  readonly cardinality: "one";
896
903
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"getAccounts.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/getAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAGlE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEvB,CAAA"}
@@ -451,6 +451,13 @@ export declare const getContacts: import("@rocicorp/zero").SyncedQuery<"getConta
451
451
  optional: false;
452
452
  customType: string;
453
453
  };
454
+ readonly labelIdList: {
455
+ type: "string";
456
+ optional: false;
457
+ customType: string;
458
+ } & {
459
+ serverName: string;
460
+ };
454
461
  readonly latestMessageDate: {
455
462
  type: "number";
456
463
  optional: false;
@@ -708,7 +715,7 @@ export declare const getContacts: import("@rocicorp/zero").SyncedQuery<"getConta
708
715
  }];
709
716
  threads: [{
710
717
  readonly sourceField: string[];
711
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
718
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
712
719
  readonly destSchema: "thread";
713
720
  readonly cardinality: "many";
714
721
  }];
@@ -756,7 +763,7 @@ export declare const getContacts: import("@rocicorp/zero").SyncedQuery<"getConta
756
763
  }];
757
764
  threads: [{
758
765
  readonly sourceField: string[];
759
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
766
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
760
767
  readonly destSchema: "thread";
761
768
  readonly cardinality: "many";
762
769
  }];
@@ -789,7 +796,7 @@ export declare const getContacts: import("@rocicorp/zero").SyncedQuery<"getConta
789
796
  readonly cardinality: "many";
790
797
  }, {
791
798
  readonly sourceField: string[];
792
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
799
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
793
800
  readonly destSchema: "thread";
794
801
  readonly cardinality: "many";
795
802
  }];
@@ -868,7 +875,7 @@ export declare const getContacts: import("@rocicorp/zero").SyncedQuery<"getConta
868
875
  }];
869
876
  thread: [{
870
877
  readonly sourceField: string[];
871
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
878
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
872
879
  readonly destSchema: "thread";
873
880
  readonly cardinality: "one";
874
881
  }];
@@ -899,7 +906,7 @@ export declare const getContacts: import("@rocicorp/zero").SyncedQuery<"getConta
899
906
  }];
900
907
  thread: [{
901
908
  readonly sourceField: string[];
902
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
909
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
903
910
  readonly destSchema: "thread";
904
911
  readonly cardinality: "one";
905
912
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"getContacts.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/getContacts.ts"],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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BvB,CAAA"}
@@ -448,6 +448,13 @@ export declare const getDrafts: import("@rocicorp/zero").SyncedQuery<"getDrafts"
448
448
  optional: false;
449
449
  customType: string;
450
450
  };
451
+ readonly labelIdList: {
452
+ type: "string";
453
+ optional: false;
454
+ customType: string;
455
+ } & {
456
+ serverName: string;
457
+ };
451
458
  readonly latestMessageDate: {
452
459
  type: "number";
453
460
  optional: false;
@@ -705,7 +712,7 @@ export declare const getDrafts: import("@rocicorp/zero").SyncedQuery<"getDrafts"
705
712
  }];
706
713
  threads: [{
707
714
  readonly sourceField: string[];
708
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
715
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
709
716
  readonly destSchema: "thread";
710
717
  readonly cardinality: "many";
711
718
  }];
@@ -753,7 +760,7 @@ export declare const getDrafts: import("@rocicorp/zero").SyncedQuery<"getDrafts"
753
760
  }];
754
761
  threads: [{
755
762
  readonly sourceField: string[];
756
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
763
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
757
764
  readonly destSchema: "thread";
758
765
  readonly cardinality: "many";
759
766
  }];
@@ -786,7 +793,7 @@ export declare const getDrafts: import("@rocicorp/zero").SyncedQuery<"getDrafts"
786
793
  readonly cardinality: "many";
787
794
  }, {
788
795
  readonly sourceField: string[];
789
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
796
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
790
797
  readonly destSchema: "thread";
791
798
  readonly cardinality: "many";
792
799
  }];
@@ -865,7 +872,7 @@ export declare const getDrafts: import("@rocicorp/zero").SyncedQuery<"getDrafts"
865
872
  }];
866
873
  thread: [{
867
874
  readonly sourceField: string[];
868
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
875
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
869
876
  readonly destSchema: "thread";
870
877
  readonly cardinality: "one";
871
878
  }];
@@ -896,7 +903,7 @@ export declare const getDrafts: import("@rocicorp/zero").SyncedQuery<"getDrafts"
896
903
  }];
897
904
  thread: [{
898
905
  readonly sourceField: string[];
899
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
906
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
900
907
  readonly destSchema: "thread";
901
908
  readonly cardinality: "one";
902
909
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"getDrafts.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/getDrafts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgBrB,CAAA"}
@@ -454,6 +454,13 @@ export declare const getThreadList: import("@rocicorp/zero").SyncedQuery<"getThr
454
454
  optional: false;
455
455
  customType: string;
456
456
  };
457
+ readonly labelIdList: {
458
+ type: "string";
459
+ optional: false;
460
+ customType: string;
461
+ } & {
462
+ serverName: string;
463
+ };
457
464
  readonly latestMessageDate: {
458
465
  type: "number";
459
466
  optional: false;
@@ -711,7 +718,7 @@ export declare const getThreadList: import("@rocicorp/zero").SyncedQuery<"getThr
711
718
  }];
712
719
  threads: [{
713
720
  readonly sourceField: string[];
714
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
721
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
715
722
  readonly destSchema: "thread";
716
723
  readonly cardinality: "many";
717
724
  }];
@@ -759,7 +766,7 @@ export declare const getThreadList: import("@rocicorp/zero").SyncedQuery<"getThr
759
766
  }];
760
767
  threads: [{
761
768
  readonly sourceField: string[];
762
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
769
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
763
770
  readonly destSchema: "thread";
764
771
  readonly cardinality: "many";
765
772
  }];
@@ -792,7 +799,7 @@ export declare const getThreadList: import("@rocicorp/zero").SyncedQuery<"getThr
792
799
  readonly cardinality: "many";
793
800
  }, {
794
801
  readonly sourceField: string[];
795
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
802
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
796
803
  readonly destSchema: "thread";
797
804
  readonly cardinality: "many";
798
805
  }];
@@ -871,7 +878,7 @@ export declare const getThreadList: import("@rocicorp/zero").SyncedQuery<"getThr
871
878
  }];
872
879
  thread: [{
873
880
  readonly sourceField: string[];
874
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
881
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
875
882
  readonly destSchema: "thread";
876
883
  readonly cardinality: "one";
877
884
  }];
@@ -902,7 +909,7 @@ export declare const getThreadList: import("@rocicorp/zero").SyncedQuery<"getThr
902
909
  }];
903
910
  thread: [{
904
911
  readonly sourceField: string[];
905
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
912
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
906
913
  readonly destSchema: "thread";
907
914
  readonly cardinality: "one";
908
915
  }];
@@ -930,6 +937,7 @@ export declare const getThreadList: import("@rocicorp/zero").SyncedQuery<"getThr
930
937
  readonly accountId: string;
931
938
  readonly flagged: boolean;
932
939
  readonly id: string;
940
+ readonly labelIdList: string;
933
941
  readonly latestMessageDate: number;
934
942
  readonly seen: boolean;
935
943
  readonly userId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"getThreadList.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/getThreadList.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDzB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { syncedQueryWithContext } from '@rocicorp/zero';
2
2
  import * as v from 'valibot';
3
+ import { threadsUtils } from '../../utils/threads';
3
4
  import { z } from '../../zero/queries';
4
5
  const MAX_LIMIT = 1000;
5
6
  const DEFAULT_LIMIT = 50;
@@ -35,7 +36,7 @@ export const getThreadList = syncedQueryWithContext('getThreadList', parseArgs,
35
36
  }
36
37
  if (where?.labelIds && where.labelIds.length > 0) {
37
38
  for (const labelId of where.labelIds) {
38
- query = query.whereExists('labels', x => x.where('id', labelId));
39
+ query = query.where('labelIdList', 'LIKE', `% ${labelId} %`);
39
40
  }
40
41
  }
41
42
  if (where?.messageIds && where.messageIds.length > 0) {
@@ -49,8 +50,7 @@ export const getThreadList = syncedQueryWithContext('getThreadList', parseArgs,
49
50
  }
50
51
  }
51
52
  if (search) {
52
- const sanitizedTerm = search.trim().toLowerCase();
53
- const tokens = sanitizedTerm.split(/\s+/).filter(Boolean);
53
+ const tokens = threadsUtils.processSearchTerm(search);
54
54
  if (tokens.length > 0) {
55
55
  query = query.where(({ and, cmp }) => and(...tokens.map(x => cmp('words', 'ILIKE', `%${x}%`))));
56
56
  }
@@ -454,6 +454,13 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
454
454
  optional: false;
455
455
  customType: string;
456
456
  };
457
+ readonly labelIdList: {
458
+ type: "string";
459
+ optional: false;
460
+ customType: string;
461
+ } & {
462
+ serverName: string;
463
+ };
457
464
  readonly latestMessageDate: {
458
465
  type: "number";
459
466
  optional: false;
@@ -711,7 +718,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
711
718
  }];
712
719
  threads: [{
713
720
  readonly sourceField: string[];
714
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
721
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
715
722
  readonly destSchema: "thread";
716
723
  readonly cardinality: "many";
717
724
  }];
@@ -759,7 +766,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
759
766
  }];
760
767
  threads: [{
761
768
  readonly sourceField: string[];
762
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
769
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
763
770
  readonly destSchema: "thread";
764
771
  readonly cardinality: "many";
765
772
  }];
@@ -792,7 +799,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
792
799
  readonly cardinality: "many";
793
800
  }, {
794
801
  readonly sourceField: string[];
795
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
802
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
796
803
  readonly destSchema: "thread";
797
804
  readonly cardinality: "many";
798
805
  }];
@@ -871,7 +878,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
871
878
  }];
872
879
  thread: [{
873
880
  readonly sourceField: string[];
874
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
881
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
875
882
  readonly destSchema: "thread";
876
883
  readonly cardinality: "one";
877
884
  }];
@@ -902,7 +909,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
902
909
  }];
903
910
  thread: [{
904
911
  readonly sourceField: string[];
905
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
912
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
906
913
  readonly destSchema: "thread";
907
914
  readonly cardinality: "one";
908
915
  }];
@@ -930,6 +937,7 @@ export declare const getThreads: import("@rocicorp/zero").SyncedQuery<"getThread
930
937
  readonly accountId: string;
931
938
  readonly flagged: boolean;
932
939
  readonly id: string;
940
+ readonly labelIdList: string;
933
941
  readonly latestMessageDate: number;
934
942
  readonly seen: boolean;
935
943
  readonly userId: string;
@@ -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;AAMlE,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,K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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDtB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { syncedQueryWithContext } from '@rocicorp/zero';
2
2
  import * as v from 'valibot';
3
+ import { threadsUtils } from '../../utils/threads';
3
4
  import { z } from '../../zero/queries';
4
5
  const MAX_LIMIT = 1000;
5
6
  const DEFAULT_LIMIT = 50;
@@ -35,7 +36,7 @@ export const getThreads = syncedQueryWithContext('getThreads', parseArgs, ({ use
35
36
  }
36
37
  if (where?.labelIds && where.labelIds.length > 0) {
37
38
  for (const labelId of where.labelIds) {
38
- query = query.whereExists('labels', x => x.where('id', labelId));
39
+ query = query.where('labelIdList', 'LIKE', `% ${labelId} %`);
39
40
  }
40
41
  }
41
42
  if (where?.messageIds && where.messageIds.length > 0) {
@@ -49,8 +50,7 @@ export const getThreads = syncedQueryWithContext('getThreads', parseArgs, ({ use
49
50
  }
50
51
  }
51
52
  if (search) {
52
- const sanitizedTerm = search.trim().toLowerCase();
53
- const tokens = sanitizedTerm.split(/\s+/).filter(Boolean);
53
+ const tokens = threadsUtils.processSearchTerm(search);
54
54
  if (tokens.length > 0) {
55
55
  query = query.where(({ and, cmp }) => and(...tokens.map(x => cmp('words', 'ILIKE', `%${x}%`))));
56
56
  }
@@ -442,6 +442,13 @@ export declare const getUser: import("@rocicorp/zero").SyncedQuery<"getUser", Ma
442
442
  optional: false;
443
443
  customType: string;
444
444
  };
445
+ readonly labelIdList: {
446
+ type: "string";
447
+ optional: false;
448
+ customType: string;
449
+ } & {
450
+ serverName: string;
451
+ };
445
452
  readonly latestMessageDate: {
446
453
  type: "number";
447
454
  optional: false;
@@ -699,7 +706,7 @@ export declare const getUser: import("@rocicorp/zero").SyncedQuery<"getUser", Ma
699
706
  }];
700
707
  threads: [{
701
708
  readonly sourceField: string[];
702
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
709
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
703
710
  readonly destSchema: "thread";
704
711
  readonly cardinality: "many";
705
712
  }];
@@ -747,7 +754,7 @@ export declare const getUser: import("@rocicorp/zero").SyncedQuery<"getUser", Ma
747
754
  }];
748
755
  threads: [{
749
756
  readonly sourceField: string[];
750
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
757
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
751
758
  readonly destSchema: "thread";
752
759
  readonly cardinality: "many";
753
760
  }];
@@ -780,7 +787,7 @@ export declare const getUser: import("@rocicorp/zero").SyncedQuery<"getUser", Ma
780
787
  readonly cardinality: "many";
781
788
  }, {
782
789
  readonly sourceField: string[];
783
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
790
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
784
791
  readonly destSchema: "thread";
785
792
  readonly cardinality: "many";
786
793
  }];
@@ -859,7 +866,7 @@ export declare const getUser: import("@rocicorp/zero").SyncedQuery<"getUser", Ma
859
866
  }];
860
867
  thread: [{
861
868
  readonly sourceField: string[];
862
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
869
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
863
870
  readonly destSchema: "thread";
864
871
  readonly cardinality: "one";
865
872
  }];
@@ -890,7 +897,7 @@ export declare const getUser: import("@rocicorp/zero").SyncedQuery<"getUser", Ma
890
897
  }];
891
898
  thread: [{
892
899
  readonly sourceField: string[];
893
- readonly destField: ("id" | "userId" | "accountId" | "flagged" | "latestMessageDate" | "seen" | "words")[];
900
+ readonly destField: ("id" | "userId" | "accountId" | "flagged" | "labelIdList" | "latestMessageDate" | "seen" | "words")[];
894
901
  readonly destSchema: "thread";
895
902
  readonly cardinality: "one";
896
903
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"getUser.d.ts","sourceRoot":"","sources":["../../../src/zero/queries/getUser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAGlE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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