@marcoappio/marco-config 2.0.493 → 2.0.494

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 (40) hide show
  1. package/dist/types/Zero.d.ts +8 -0
  2. package/dist/types/Zero.d.ts.map +1 -1
  3. package/dist/zero/crud.d.ts +1024 -0
  4. package/dist/zero/crud.d.ts.map +1 -0
  5. package/dist/zero/crud.js +3 -0
  6. package/dist/zero/index.d.ts +98 -38
  7. package/dist/zero/index.d.ts.map +1 -1
  8. package/dist/zero/mutators/accountMutators/accountMutators.d.ts +27 -9
  9. package/dist/zero/mutators/accountMutators/accountMutators.d.ts.map +1 -1
  10. package/dist/zero/mutators/accountMutators/accountMutators.js +30 -29
  11. package/dist/zero/mutators/draftMutators/draftMutators.d.ts +27 -9
  12. package/dist/zero/mutators/draftMutators/draftMutators.d.ts.map +1 -1
  13. package/dist/zero/mutators/draftMutators/draftMutators.js +28 -27
  14. package/dist/zero/mutators/index.d.ts +0 -1
  15. package/dist/zero/mutators/index.d.ts.map +1 -1
  16. package/dist/zero/mutators/index.js +0 -1
  17. package/dist/zero/mutators/mutators.d.ts +90 -31
  18. package/dist/zero/mutators/mutators.d.ts.map +1 -1
  19. package/dist/zero/mutators/mutators.js +0 -1
  20. package/dist/zero/mutators/threadMutators/threadMutators.d.ts +29 -12
  21. package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
  22. package/dist/zero/mutators/threadMutators/threadMutators.js +41 -40
  23. package/dist/zero/mutators/userMutators/userMutators.d.ts +9 -3
  24. package/dist/zero/mutators/userMutators/userMutators.d.ts.map +1 -1
  25. package/dist/zero/mutators/userMutators/userMutators.js +8 -7
  26. package/dist/zero/queries/getAccounts.d.ts +1 -1
  27. package/dist/zero/queries/getContacts.d.ts +1 -1
  28. package/dist/zero/queries/getDrafts.d.ts +1 -1
  29. package/dist/zero/queries/getThread.d.ts +1 -1
  30. package/dist/zero/queries/getThreadList.d.ts +1 -1
  31. package/dist/zero/queries/getThreads.d.ts +1 -1
  32. package/dist/zero/queries/getUser.d.ts +1 -1
  33. package/dist/zero/queries/index.d.ts +1 -1
  34. package/dist/zero/schema.d.ts +1 -1
  35. package/dist/zero/schema.d.ts.map +1 -1
  36. package/dist/zero/schema.js +0 -1
  37. package/package.json +2 -2
  38. package/dist/zero/mutators/defineMutator.d.ts +0 -16
  39. package/dist/zero/mutators/defineMutator.d.ts.map +0 -1
  40. package/dist/zero/mutators/defineMutator.js +0 -7
@@ -1,4 +1,3 @@
1
- export { defineMutator, type MarcoZeroContext } from './defineMutator';
2
1
  export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
3
2
  readonly account: {
4
3
  createAccount: import("@rocicorp/zero").MutatorDefinition<{
@@ -11,7 +10,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
11
10
  color: string;
12
11
  emailAddress: string;
13
12
  id: string;
14
- }, import("./defineMutator").MarcoZeroContext>;
13
+ }, {
14
+ readonly userId: string;
15
+ }, unknown>;
15
16
  createAlias: import("@rocicorp/zero").MutatorDefinition<{
16
17
  accountId: string;
17
18
  alias: {
@@ -26,19 +27,25 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
26
27
  id: string;
27
28
  name: string | null;
28
29
  };
29
- }, import("./defineMutator").MarcoZeroContext>;
30
+ }, {
31
+ readonly userId: string;
32
+ }, unknown>;
30
33
  deleteAccount: import("@rocicorp/zero").MutatorDefinition<{
31
34
  id: string;
32
35
  }, {
33
36
  id: string;
34
- }, import("./defineMutator").MarcoZeroContext>;
37
+ }, {
38
+ readonly userId: string;
39
+ }, unknown>;
35
40
  deleteAlias: import("@rocicorp/zero").MutatorDefinition<{
36
41
  accountId: string;
37
42
  aliasId: string;
38
43
  }, {
39
44
  accountId: string;
40
45
  aliasId: string;
41
- }, import("./defineMutator").MarcoZeroContext>;
46
+ }, {
47
+ readonly userId: string;
48
+ }, unknown>;
42
49
  setAliasName: import("@rocicorp/zero").MutatorDefinition<{
43
50
  accountId: string;
44
51
  aliasId: string;
@@ -47,14 +54,18 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
47
54
  accountId: string;
48
55
  aliasId: string;
49
56
  displayName: string | null;
50
- }, import("./defineMutator").MarcoZeroContext>;
57
+ }, {
58
+ readonly userId: string;
59
+ }, unknown>;
51
60
  setAliasPrimary: import("@rocicorp/zero").MutatorDefinition<{
52
61
  accountId: string;
53
62
  aliasId: string;
54
63
  }, {
55
64
  accountId: string;
56
65
  aliasId: string;
57
- }, import("./defineMutator").MarcoZeroContext>;
66
+ }, {
67
+ readonly userId: string;
68
+ }, unknown>;
58
69
  setConnectionConfigImapRaw: import("@rocicorp/zero").MutatorDefinition<{
59
70
  connectionConfig: {
60
71
  imapHost: string;
@@ -83,7 +94,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
83
94
  smtpUser: string;
84
95
  };
85
96
  id: string;
86
- }, import("./defineMutator").MarcoZeroContext>;
97
+ }, {
98
+ readonly userId: string;
99
+ }, unknown>;
87
100
  setConnectionConfigOauth: import("@rocicorp/zero").MutatorDefinition<{
88
101
  connectionConfig: {
89
102
  code: string;
@@ -98,7 +111,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
98
111
  user: string;
99
112
  };
100
113
  id: string;
101
- }, import("./defineMutator").MarcoZeroContext>;
114
+ }, {
115
+ readonly userId: string;
116
+ }, unknown>;
102
117
  setSettings: import("@rocicorp/zero").MutatorDefinition<{
103
118
  color?: string | null | undefined;
104
119
  displayName?: string | null | undefined;
@@ -107,7 +122,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
107
122
  color?: string | null | undefined;
108
123
  displayName?: string | null | undefined;
109
124
  id: string;
110
- }, import("./defineMutator").MarcoZeroContext>;
125
+ }, {
126
+ readonly userId: string;
127
+ }, unknown>;
111
128
  };
112
129
  readonly draft: {
113
130
  cancelSend: import("@rocicorp/zero").MutatorDefinition<{
@@ -116,7 +133,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
116
133
  }, {
117
134
  id: string;
118
135
  updatedAt: number;
119
- }, import("./defineMutator").MarcoZeroContext>;
136
+ }, {
137
+ readonly userId: string;
138
+ }, unknown>;
120
139
  createAttachment: import("@rocicorp/zero").MutatorDefinition<{
121
140
  attachment: {
122
141
  fileName: string;
@@ -137,7 +156,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
137
156
  };
138
157
  id: string;
139
158
  updatedAt: number;
140
- }, import("./defineMutator").MarcoZeroContext>;
159
+ }, {
160
+ readonly userId: string;
161
+ }, unknown>;
141
162
  createDraft: import("@rocicorp/zero").MutatorDefinition<{
142
163
  accountId: string;
143
164
  attachments: {
@@ -188,7 +209,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
188
209
  status: "DRAFT" | "SEND_REQUESTED" | "SEND_CONFIRMED" | "SEND_FAILED";
189
210
  type: "NEW" | "REPLY" | "FORWARD";
190
211
  updatedAt: number;
191
- }, import("./defineMutator").MarcoZeroContext>;
212
+ }, {
213
+ readonly userId: string;
214
+ }, unknown>;
192
215
  deleteAttachment: import("@rocicorp/zero").MutatorDefinition<{
193
216
  attachmentId: string;
194
217
  id: string;
@@ -197,12 +220,16 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
197
220
  attachmentId: string;
198
221
  id: string;
199
222
  updatedAt: number;
200
- }, import("./defineMutator").MarcoZeroContext>;
223
+ }, {
224
+ readonly userId: string;
225
+ }, unknown>;
201
226
  deleteDraft: import("@rocicorp/zero").MutatorDefinition<{
202
227
  id: string;
203
228
  }, {
204
229
  id: string;
205
- }, import("./defineMutator").MarcoZeroContext>;
230
+ }, {
231
+ readonly userId: string;
232
+ }, unknown>;
206
233
  scheduleSend: import("@rocicorp/zero").MutatorDefinition<{
207
234
  id: string;
208
235
  kind: "IMMEDIATE";
@@ -223,7 +250,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
223
250
  kind: "SCHEDULED";
224
251
  scheduledFor: number;
225
252
  updatedAt: number;
226
- }, import("./defineMutator").MarcoZeroContext>;
253
+ }, {
254
+ readonly userId: string;
255
+ }, unknown>;
227
256
  setContent: import("@rocicorp/zero").MutatorDefinition<{
228
257
  id: string;
229
258
  patch: {
@@ -240,7 +269,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
240
269
  value: string;
241
270
  }[];
242
271
  updatedAt: number;
243
- }, import("./defineMutator").MarcoZeroContext>;
272
+ }, {
273
+ readonly userId: string;
274
+ }, unknown>;
244
275
  setEnvelope: import("@rocicorp/zero").MutatorDefinition<{
245
276
  envelope: {
246
277
  bcc: string[];
@@ -259,7 +290,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
259
290
  };
260
291
  id: string;
261
292
  updatedAt: number;
262
- }, import("./defineMutator").MarcoZeroContext>;
293
+ }, {
294
+ readonly userId: string;
295
+ }, unknown>;
263
296
  setFrom: import("@rocicorp/zero").MutatorDefinition<{
264
297
  accountId: string;
265
298
  aliasId: string;
@@ -274,7 +307,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
274
307
  fromName: string | null;
275
308
  id: string;
276
309
  updatedAt: number;
277
- }, import("./defineMutator").MarcoZeroContext>;
310
+ }, {
311
+ readonly userId: string;
312
+ }, unknown>;
278
313
  };
279
314
  readonly thread: {
280
315
  addLabel: import("@rocicorp/zero").MutatorDefinition<{
@@ -291,7 +326,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
291
326
  };
292
327
  };
293
328
  labelPath: string;
294
- }, import("./defineMutator").MarcoZeroContext>;
329
+ }, {
330
+ readonly userId: string;
331
+ }, unknown>;
295
332
  delete: import("@rocicorp/zero").MutatorDefinition<{
296
333
  accounts: {
297
334
  [x: string]: {
@@ -304,7 +341,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
304
341
  threadIds: string[];
305
342
  };
306
343
  };
307
- }, import("./defineMutator").MarcoZeroContext>;
344
+ }, {
345
+ readonly userId: string;
346
+ }, unknown>;
308
347
  removeLabel: import("@rocicorp/zero").MutatorDefinition<{
309
348
  accounts: {
310
349
  [x: string]: {
@@ -319,7 +358,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
319
358
  };
320
359
  };
321
360
  labelPath: string;
322
- }, import("./defineMutator").MarcoZeroContext>;
361
+ }, {
362
+ readonly userId: string;
363
+ }, unknown>;
323
364
  setArchive: import("@rocicorp/zero").MutatorDefinition<{
324
365
  accounts: {
325
366
  [x: string]: {
@@ -332,7 +373,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
332
373
  threadIds: string[];
333
374
  };
334
375
  };
335
- }, import("./defineMutator").MarcoZeroContext>;
376
+ }, {
377
+ readonly userId: string;
378
+ }, unknown>;
336
379
  setFlagged: import("@rocicorp/zero").MutatorDefinition<{
337
380
  accounts: {
338
381
  [x: string]: {
@@ -347,7 +390,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
347
390
  };
348
391
  };
349
392
  flagged: boolean;
350
- }, import("./defineMutator").MarcoZeroContext>;
393
+ }, {
394
+ readonly userId: string;
395
+ }, unknown>;
351
396
  setInbox: import("@rocicorp/zero").MutatorDefinition<{
352
397
  accounts: {
353
398
  [x: string]: {
@@ -360,7 +405,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
360
405
  threadIds: string[];
361
406
  };
362
407
  };
363
- }, import("./defineMutator").MarcoZeroContext>;
408
+ }, {
409
+ readonly userId: string;
410
+ }, unknown>;
364
411
  setSeen: import("@rocicorp/zero").MutatorDefinition<{
365
412
  accounts: {
366
413
  [x: string]: {
@@ -375,7 +422,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
375
422
  };
376
423
  };
377
424
  seen: boolean;
378
- }, import("./defineMutator").MarcoZeroContext>;
425
+ }, {
426
+ readonly userId: string;
427
+ }, unknown>;
379
428
  setSpam: import("@rocicorp/zero").MutatorDefinition<{
380
429
  accounts: {
381
430
  [x: string]: {
@@ -388,7 +437,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
388
437
  threadIds: string[];
389
438
  };
390
439
  };
391
- }, import("./defineMutator").MarcoZeroContext>;
440
+ }, {
441
+ readonly userId: string;
442
+ }, unknown>;
392
443
  setTrash: import("@rocicorp/zero").MutatorDefinition<{
393
444
  accounts: {
394
445
  [x: string]: {
@@ -401,7 +452,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
401
452
  threadIds: string[];
402
453
  };
403
454
  };
404
- }, import("./defineMutator").MarcoZeroContext>;
455
+ }, {
456
+ readonly userId: string;
457
+ }, unknown>;
405
458
  };
406
459
  readonly user: {
407
460
  deleteSettingsPushNotificationToken: import("@rocicorp/zero").MutatorDefinition<{
@@ -410,14 +463,18 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
410
463
  }, {
411
464
  id: string;
412
465
  token: string;
413
- }, import("./defineMutator").MarcoZeroContext>;
466
+ }, {
467
+ readonly userId: string;
468
+ }, unknown>;
414
469
  setSettingsName: import("@rocicorp/zero").MutatorDefinition<{
415
470
  id: string;
416
471
  name: string | null;
417
472
  }, {
418
473
  id: string;
419
474
  name: string | null;
420
- }, import("./defineMutator").MarcoZeroContext>;
475
+ }, {
476
+ readonly userId: string;
477
+ }, unknown>;
421
478
  setSettingsPushNotificationToken: import("@rocicorp/zero").MutatorDefinition<{
422
479
  id: string;
423
480
  pushNotificationToken: {
@@ -432,7 +489,9 @@ export declare const mutators: import("@rocicorp/zero").MutatorRegistry<{
432
489
  id: string;
433
490
  token: string;
434
491
  };
435
- }, import("./defineMutator").MarcoZeroContext>;
492
+ }, {
493
+ readonly userId: string;
494
+ }, unknown>;
436
495
  };
437
496
  }, import("@rocicorp/zero").Schema>;
438
497
  export type MarcoZeroMutators = typeof mutators;
@@ -1 +1 @@
1
- {"version":3,"file":"mutators.d.ts","sourceRoot":"","sources":["../../../src/zero/mutators/mutators.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEtE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAKnB,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,OAAO,QAAQ,CAAA"}
1
+ {"version":3,"file":"mutators.d.ts","sourceRoot":"","sources":["../../../src/zero/mutators/mutators.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAKnB,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,OAAO,QAAQ,CAAA"}
@@ -3,7 +3,6 @@ import { accountMutators } from './accountMutators';
3
3
  import { draftMutators } from './draftMutators';
4
4
  import { threadMutators } from './threadMutators';
5
5
  import { userMutators } from './userMutators';
6
- export { defineMutator } from './defineMutator';
7
6
  export const mutators = defineMutators({
8
7
  account: accountMutators,
9
8
  draft: draftMutators,
@@ -1,7 +1,6 @@
1
- import type { Transaction } from '@rocicorp/zero';
1
+ import { type Transaction } from '@rocicorp/zero';
2
2
  import type { LabelSpecialUse } from '../../../types';
3
- import type { MarcoZeroSchema } from '../../../zero/schema';
4
- export declare const setSystemLabel: (tx: Transaction<MarcoZeroSchema>, threadId: string, targetSpecialUse: LabelSpecialUse) => Promise<void>;
3
+ export declare const setSystemLabel: (tx: Transaction, threadId: string, targetSpecialUse: LabelSpecialUse) => Promise<void>;
5
4
  export declare const threadMutators: {
6
5
  addLabel: import("@rocicorp/zero").MutatorDefinition<{
7
6
  accounts: {
@@ -17,7 +16,9 @@ export declare const threadMutators: {
17
16
  };
18
17
  };
19
18
  labelPath: string;
20
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
19
+ }, {
20
+ readonly userId: string;
21
+ }, unknown>;
21
22
  delete: import("@rocicorp/zero").MutatorDefinition<{
22
23
  accounts: {
23
24
  [x: string]: {
@@ -30,7 +31,9 @@ export declare const threadMutators: {
30
31
  threadIds: string[];
31
32
  };
32
33
  };
33
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
34
+ }, {
35
+ readonly userId: string;
36
+ }, unknown>;
34
37
  removeLabel: import("@rocicorp/zero").MutatorDefinition<{
35
38
  accounts: {
36
39
  [x: string]: {
@@ -45,7 +48,9 @@ export declare const threadMutators: {
45
48
  };
46
49
  };
47
50
  labelPath: string;
48
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
51
+ }, {
52
+ readonly userId: string;
53
+ }, unknown>;
49
54
  setArchive: import("@rocicorp/zero").MutatorDefinition<{
50
55
  accounts: {
51
56
  [x: string]: {
@@ -58,7 +63,9 @@ export declare const threadMutators: {
58
63
  threadIds: string[];
59
64
  };
60
65
  };
61
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
66
+ }, {
67
+ readonly userId: string;
68
+ }, unknown>;
62
69
  setFlagged: import("@rocicorp/zero").MutatorDefinition<{
63
70
  accounts: {
64
71
  [x: string]: {
@@ -73,7 +80,9 @@ export declare const threadMutators: {
73
80
  };
74
81
  };
75
82
  flagged: boolean;
76
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
83
+ }, {
84
+ readonly userId: string;
85
+ }, unknown>;
77
86
  setInbox: import("@rocicorp/zero").MutatorDefinition<{
78
87
  accounts: {
79
88
  [x: string]: {
@@ -86,7 +95,9 @@ export declare const threadMutators: {
86
95
  threadIds: string[];
87
96
  };
88
97
  };
89
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
98
+ }, {
99
+ readonly userId: string;
100
+ }, unknown>;
90
101
  setSeen: import("@rocicorp/zero").MutatorDefinition<{
91
102
  accounts: {
92
103
  [x: string]: {
@@ -101,7 +112,9 @@ export declare const threadMutators: {
101
112
  };
102
113
  };
103
114
  seen: boolean;
104
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
115
+ }, {
116
+ readonly userId: string;
117
+ }, unknown>;
105
118
  setSpam: import("@rocicorp/zero").MutatorDefinition<{
106
119
  accounts: {
107
120
  [x: string]: {
@@ -114,7 +127,9 @@ export declare const threadMutators: {
114
127
  threadIds: string[];
115
128
  };
116
129
  };
117
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
130
+ }, {
131
+ readonly userId: string;
132
+ }, unknown>;
118
133
  setTrash: import("@rocicorp/zero").MutatorDefinition<{
119
134
  accounts: {
120
135
  [x: string]: {
@@ -127,6 +142,8 @@ export declare const threadMutators: {
127
142
  threadIds: string[];
128
143
  };
129
144
  };
130
- }, import("../../../zero/mutators/defineMutator").MarcoZeroContext>;
145
+ }, {
146
+ readonly userId: string;
147
+ }, unknown>;
131
148
  };
132
149
  //# sourceMappingURL=threadMutators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"threadMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/threadMutators/threadMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAIjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAI1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAoBhE,eAAO,MAAM,cAAc,OACrB,WAAW,CAAC,eAAe,CAAC,YACtB,MAAM,oBACE,eAAe,KAChC,OAAO,CAAC,IAAI,CAyFd,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsP1B,CAAA"}
1
+ {"version":3,"file":"threadMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/threadMutators/threadMutators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAIhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAuB1D,eAAO,MAAM,cAAc,OACrB,WAAW,YACL,MAAM,oBACE,eAAe,KAChC,OAAO,CAAC,IAAI,CAqGd,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgR1B,CAAA"}
@@ -1,8 +1,9 @@
1
+ import { defineMutator } from '@rocicorp/zero';
1
2
  import * as v from 'valibot';
2
3
  import { marcoSchemas } from '../../../schemas';
3
4
  import { MutationError } from '../../../types';
4
5
  import { threadsUtils } from '../../../utils/threads';
5
- import { defineMutator } from '../../../zero/mutators/defineMutator';
6
+ import { zeroCRUD } from '../../../zero/crud';
6
7
  const buildLabelIdList = (x) => (x.length === 0 ? '' : ` ${[...new Set(x)].join(' ')} `);
7
8
  const accountsSchema = v.record(marcoSchemas.string.required(), v.object({
8
9
  threadIds: v.array(marcoSchemas.string.required()),
@@ -33,28 +34,28 @@ export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
33
34
  const threadLabelDeletes = [];
34
35
  for (const message of messages) {
35
36
  for (const labelId of labelIdsToRemove) {
36
- threadLabelDeletes.push(tx.mutate.threadLabel.delete({
37
+ threadLabelDeletes.push(tx.mutate(zeroCRUD.threadLabel.delete({
37
38
  accountId: thread.accountId,
38
39
  labelId,
39
40
  threadMessageId: message.id,
40
- }));
41
+ })));
41
42
  }
42
43
  }
43
44
  await Promise.all([
44
45
  ...threadLabelDeletes,
45
- ...[...labelIdsToRemove].map(labelId => tx.mutate.threadByLabel.delete({ labelId, threadId })),
46
+ ...[...labelIdsToRemove].map(labelId => tx.mutate(zeroCRUD.threadByLabel.delete({ labelId, threadId }))),
46
47
  ]);
47
48
  if (thread.seen === false && labelIdsToRemove.size > 0) {
48
49
  const labelsToUpdate = await tx.query.accountLabel.where('id', 'IN', [...labelIdsToRemove]).run();
49
- await Promise.all(labelsToUpdate.map(label => tx.mutate.accountLabel.update({
50
+ await Promise.all(labelsToUpdate.map(label => tx.mutate(zeroCRUD.accountLabel.update({
50
51
  id: label.id,
51
52
  unreadCount: Math.max(0, (label.unreadCount ?? 0) - 1),
52
- })));
53
+ }))));
53
54
  }
54
55
  if (!hasTarget) {
55
56
  const baseTimestamp = Date.now();
56
57
  await Promise.all([
57
- ...messages.map((message, i) => tx.mutate.threadLabel.insert({
58
+ ...messages.map((message, i) => tx.mutate(zeroCRUD.threadLabel.insert({
58
59
  accountId: thread.accountId,
59
60
  labelId: targetLabel.id,
60
61
  lastSyncedAt: 0,
@@ -62,26 +63,26 @@ export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
62
63
  threadMessageId: message.id,
63
64
  uid: -(baseTimestamp + i),
64
65
  uidValidity: targetLabel.uidValidity ?? 0,
65
- })),
66
- tx.mutate.threadByLabel.insert({
66
+ }))),
67
+ tx.mutate(zeroCRUD.threadByLabel.insert({
67
68
  labelId: targetLabel.id,
68
69
  latestMessageDate: thread.latestMessageDate,
69
70
  threadId,
70
- }),
71
+ })),
71
72
  ...(thread.seen === false
72
73
  ? [
73
- tx.mutate.accountLabel.update({
74
+ tx.mutate(zeroCRUD.accountLabel.update({
74
75
  id: targetLabel.id,
75
76
  unreadCount: (targetLabel.unreadCount ?? 0) + 1,
76
- }),
77
+ })),
77
78
  ]
78
79
  : []),
79
80
  ]);
80
81
  }
81
- await tx.mutate.thread.update({
82
+ await tx.mutate(zeroCRUD.thread.update({
82
83
  id: threadId,
83
84
  labelIdList: buildLabelIdList([targetLabel.id]),
84
- });
85
+ }));
85
86
  };
86
87
  export const threadMutators = {
87
88
  addLabel: defineMutator(threadChangeLabelSchema, async ({ tx, args }) => {
@@ -101,17 +102,17 @@ export const threadMutators = {
101
102
  const currentLabelIds = new Set(threadsUtils.parseLabelIdList(thread.labelIdList));
102
103
  if (!currentLabelIds.has(label.id)) {
103
104
  await Promise.all([
104
- tx.mutate.threadByLabel.insert({
105
+ tx.mutate(zeroCRUD.threadByLabel.insert({
105
106
  labelId: label.id,
106
107
  latestMessageDate: thread.latestMessageDate,
107
108
  threadId,
108
- }),
109
+ })),
109
110
  ...(thread.seen === false
110
111
  ? [
111
- tx.mutate.accountLabel.update({
112
+ tx.mutate(zeroCRUD.accountLabel.update({
112
113
  id: label.id,
113
114
  unreadCount: (label.unreadCount ?? 0) + 1,
114
- }),
115
+ })),
115
116
  ]
116
117
  : []),
117
118
  ]);
@@ -120,7 +121,7 @@ export const threadMutators = {
120
121
  const messagesToInsert = messages.filter((_, i) => !existingChecks[i]);
121
122
  const baseTimestamp = Date.now();
122
123
  if (messagesToInsert.length > 0) {
123
- await Promise.all(messagesToInsert.map((x, i) => tx.mutate.threadLabel.insert({
124
+ await Promise.all(messagesToInsert.map((x, i) => tx.mutate(zeroCRUD.threadLabel.insert({
124
125
  accountId,
125
126
  labelId: label.id,
126
127
  lastSyncedAt: 0,
@@ -128,13 +129,13 @@ export const threadMutators = {
128
129
  threadMessageId: x.id,
129
130
  uid: -(baseTimestamp + i),
130
131
  uidValidity: label.uidValidity ?? 0,
131
- })));
132
+ }))));
132
133
  }
133
134
  currentLabelIds.add(label.id);
134
- await tx.mutate.thread.update({
135
+ await tx.mutate(zeroCRUD.thread.update({
135
136
  id: threadId,
136
137
  labelIdList: buildLabelIdList([...currentLabelIds]),
137
- });
138
+ }));
138
139
  }
139
140
  }
140
141
  }),
@@ -147,15 +148,15 @@ export const threadMutators = {
147
148
  const labelIds = threadsUtils.parseLabelIdList(thread.labelIdList);
148
149
  if (labelIds.length > 0) {
149
150
  const labels = await tx.query.accountLabel.where('id', 'IN', labelIds).run();
150
- await Promise.all(labels.map(x => tx.mutate.accountLabel.update({
151
+ await Promise.all(labels.map(x => tx.mutate(zeroCRUD.accountLabel.update({
151
152
  id: x.id,
152
153
  unreadCount: Math.max(0, (x.unreadCount ?? 0) - 1),
153
- })));
154
+ }))));
154
155
  }
155
156
  }
156
- await tx.mutate.thread.delete({
157
+ await tx.mutate(zeroCRUD.thread.delete({
157
158
  id: threadId,
158
- });
159
+ }));
159
160
  }
160
161
  }
161
162
  }
@@ -180,27 +181,27 @@ export const threadMutators = {
180
181
  }
181
182
  currentLabelIds.delete(label.id);
182
183
  await Promise.all([
183
- ...messages.map(x => tx.mutate.threadLabel.delete({
184
+ ...messages.map(x => tx.mutate(zeroCRUD.threadLabel.delete({
184
185
  accountId,
185
186
  labelId: label.id,
186
187
  threadMessageId: x.id,
187
- })),
188
- tx.mutate.threadByLabel.delete({
188
+ }))),
189
+ tx.mutate(zeroCRUD.threadByLabel.delete({
189
190
  labelId: label.id,
190
191
  threadId,
191
- }),
192
+ })),
192
193
  ...(thread.seen === false
193
194
  ? [
194
- tx.mutate.accountLabel.update({
195
+ tx.mutate(zeroCRUD.accountLabel.update({
195
196
  id: label.id,
196
197
  unreadCount: Math.max(0, (label.unreadCount ?? 0) - 1),
197
- }),
198
+ })),
198
199
  ]
199
200
  : []),
200
- tx.mutate.thread.update({
201
+ tx.mutate(zeroCRUD.thread.update({
201
202
  id: threadId,
202
203
  labelIdList: buildLabelIdList([...currentLabelIds]),
203
- }),
204
+ })),
204
205
  ]);
205
206
  }
206
207
  }
@@ -217,10 +218,10 @@ export const threadMutators = {
217
218
  flagged: v.nonOptional(v.boolean()),
218
219
  }), async ({ tx, args }) => {
219
220
  for (const [, { threadIds }] of Object.entries(args.accounts)) {
220
- await Promise.all(threadIds.map(threadId => tx.mutate.thread.update({
221
+ await Promise.all(threadIds.map(threadId => tx.mutate(zeroCRUD.thread.update({
221
222
  flagged: args.flagged,
222
223
  id: threadId,
223
- })));
224
+ }))));
224
225
  }
225
226
  }),
226
227
  setInbox: defineMutator(baseThreadSchema, async ({ tx, args }) => {
@@ -249,15 +250,15 @@ export const threadMutators = {
249
250
  const delta = args.seen ? -1 : 1;
250
251
  await Promise.all(labels
251
252
  .filter(x => labelCounts.has(x.id))
252
- .map(x => tx.mutate.accountLabel.update({
253
+ .map(x => tx.mutate(zeroCRUD.accountLabel.update({
253
254
  id: x.id,
254
255
  unreadCount: Math.max(0, (x.unreadCount ?? 0) + delta * (labelCounts.get(x.id) ?? 0)),
255
- })));
256
+ }))));
256
257
  }
257
- await Promise.all(allThreadIds.map(threadId => tx.mutate.thread.update({
258
+ await Promise.all(allThreadIds.map(threadId => tx.mutate(zeroCRUD.thread.update({
258
259
  id: threadId,
259
260
  seen: args.seen,
260
- })));
261
+ }))));
261
262
  }),
262
263
  setSpam: defineMutator(baseThreadSchema, async ({ tx, args }) => {
263
264
  for (const [, { threadIds }] of Object.entries(args.accounts)) {