@marcoappio/marco-config 2.0.489 → 2.0.490
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zero/index.d.ts +12 -12
- package/dist/zero/mutatorSchemas/index.d.ts +12 -12
- package/dist/zero/mutatorSchemas/thread.d.ts +12 -12
- package/dist/zero/mutatorSchemas/thread.js +2 -2
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts +2 -2
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.js +30 -53
- package/dist/zero/mutators/threadMutators/threadMutators.test.js +8 -75
- package/package.json +1 -1
package/dist/zero/index.d.ts
CHANGED
|
@@ -231,12 +231,12 @@ export declare const marcoZero: {
|
|
|
231
231
|
readonly addLabel: {
|
|
232
232
|
readonly delta: import("valibot").ObjectSchema<{
|
|
233
233
|
readonly labelPath: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
234
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
234
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
235
235
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
236
236
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
237
237
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
238
238
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
239
|
-
}, undefined>, undefined>;
|
|
239
|
+
}, undefined>, undefined>, undefined>;
|
|
240
240
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
241
241
|
}, undefined>;
|
|
242
242
|
};
|
|
@@ -248,23 +248,23 @@ export declare const marcoZero: {
|
|
|
248
248
|
readonly removeLabel: {
|
|
249
249
|
readonly delta: import("valibot").ObjectSchema<{
|
|
250
250
|
readonly labelPath: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
251
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
251
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
252
252
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
253
253
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
254
254
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
255
255
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
256
|
-
}, undefined>, undefined>;
|
|
256
|
+
}, undefined>, undefined>, undefined>;
|
|
257
257
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
258
258
|
}, undefined>;
|
|
259
259
|
};
|
|
260
260
|
readonly setArchive: {
|
|
261
261
|
readonly delta: import("valibot").ObjectSchema<{
|
|
262
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
262
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
263
263
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
264
264
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
265
265
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
266
266
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
267
|
-
}, undefined>, undefined>;
|
|
267
|
+
}, undefined>, undefined>, undefined>;
|
|
268
268
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
269
269
|
}, undefined>;
|
|
270
270
|
};
|
|
@@ -276,12 +276,12 @@ export declare const marcoZero: {
|
|
|
276
276
|
};
|
|
277
277
|
readonly setInbox: {
|
|
278
278
|
readonly delta: import("valibot").ObjectSchema<{
|
|
279
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
279
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
280
280
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
281
281
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
282
282
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
283
283
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
284
|
-
}, undefined>, undefined>;
|
|
284
|
+
}, undefined>, undefined>, undefined>;
|
|
285
285
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
286
286
|
}, undefined>;
|
|
287
287
|
};
|
|
@@ -293,23 +293,23 @@ export declare const marcoZero: {
|
|
|
293
293
|
};
|
|
294
294
|
readonly setSpam: {
|
|
295
295
|
readonly delta: import("valibot").ObjectSchema<{
|
|
296
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
296
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
297
297
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
298
298
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
299
299
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
300
300
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
301
|
-
}, undefined>, undefined>;
|
|
301
|
+
}, undefined>, undefined>, undefined>;
|
|
302
302
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
303
303
|
}, undefined>;
|
|
304
304
|
};
|
|
305
305
|
readonly setTrash: {
|
|
306
306
|
readonly delta: import("valibot").ObjectSchema<{
|
|
307
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
307
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
308
308
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
309
309
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
310
310
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
311
311
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
312
|
-
}, undefined>, undefined>;
|
|
312
|
+
}, undefined>, undefined>, undefined>;
|
|
313
313
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
314
314
|
}, undefined>;
|
|
315
315
|
};
|
|
@@ -229,12 +229,12 @@ export declare const zeroMutatorSchemas: {
|
|
|
229
229
|
readonly addLabel: {
|
|
230
230
|
readonly delta: import("valibot").ObjectSchema<{
|
|
231
231
|
readonly labelPath: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
232
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
232
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
233
233
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
234
234
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
235
235
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
236
236
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
237
|
-
}, undefined>, undefined>;
|
|
237
|
+
}, undefined>, undefined>, undefined>;
|
|
238
238
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
239
239
|
}, undefined>;
|
|
240
240
|
};
|
|
@@ -246,23 +246,23 @@ export declare const zeroMutatorSchemas: {
|
|
|
246
246
|
readonly removeLabel: {
|
|
247
247
|
readonly delta: import("valibot").ObjectSchema<{
|
|
248
248
|
readonly labelPath: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
249
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
249
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
250
250
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
251
251
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
252
252
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
253
253
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
254
|
-
}, undefined>, undefined>;
|
|
254
|
+
}, undefined>, undefined>, undefined>;
|
|
255
255
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
256
256
|
}, undefined>;
|
|
257
257
|
};
|
|
258
258
|
readonly setArchive: {
|
|
259
259
|
readonly delta: import("valibot").ObjectSchema<{
|
|
260
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
260
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
261
261
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
262
262
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
263
263
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
264
264
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
265
|
-
}, undefined>, undefined>;
|
|
265
|
+
}, undefined>, undefined>, undefined>;
|
|
266
266
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
267
267
|
}, undefined>;
|
|
268
268
|
};
|
|
@@ -274,12 +274,12 @@ export declare const zeroMutatorSchemas: {
|
|
|
274
274
|
};
|
|
275
275
|
readonly setInbox: {
|
|
276
276
|
readonly delta: import("valibot").ObjectSchema<{
|
|
277
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
277
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
278
278
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
279
279
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
280
280
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
281
281
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
282
|
-
}, undefined>, undefined>;
|
|
282
|
+
}, undefined>, undefined>, undefined>;
|
|
283
283
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
284
284
|
}, undefined>;
|
|
285
285
|
};
|
|
@@ -291,23 +291,23 @@ export declare const zeroMutatorSchemas: {
|
|
|
291
291
|
};
|
|
292
292
|
readonly setSpam: {
|
|
293
293
|
readonly delta: import("valibot").ObjectSchema<{
|
|
294
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
294
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
295
295
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
296
296
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
297
297
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
298
298
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
299
|
-
}, undefined>, undefined>;
|
|
299
|
+
}, undefined>, undefined>, undefined>;
|
|
300
300
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
301
301
|
}, undefined>;
|
|
302
302
|
};
|
|
303
303
|
readonly setTrash: {
|
|
304
304
|
readonly delta: import("valibot").ObjectSchema<{
|
|
305
|
-
readonly sourceLocations: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
305
|
+
readonly sourceLocations: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
306
306
|
readonly labelId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
307
307
|
readonly threadMessageId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
308
308
|
readonly uid: import("valibot").NumberSchema<undefined>;
|
|
309
309
|
readonly uidValidity: import("valibot").NumberSchema<undefined>;
|
|
310
|
-
}, undefined>, undefined>;
|
|
310
|
+
}, undefined>, undefined>, undefined>;
|
|
311
311
|
readonly threadIds: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
312
312
|
}, undefined>;
|
|
313
313
|
};
|
|
@@ -3,12 +3,12 @@ export declare const threadMutatorSchemas: {
|
|
|
3
3
|
readonly addLabel: {
|
|
4
4
|
readonly delta: v.ObjectSchema<{
|
|
5
5
|
readonly labelPath: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
6
|
-
readonly sourceLocations: v.ArraySchema<v.ObjectSchema<{
|
|
6
|
+
readonly sourceLocations: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
7
7
|
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
8
8
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
9
9
|
readonly uid: v.NumberSchema<undefined>;
|
|
10
10
|
readonly uidValidity: v.NumberSchema<undefined>;
|
|
11
|
-
}, undefined>, undefined>;
|
|
11
|
+
}, undefined>, undefined>, undefined>;
|
|
12
12
|
readonly threadIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
13
13
|
}, undefined>;
|
|
14
14
|
};
|
|
@@ -20,23 +20,23 @@ export declare const threadMutatorSchemas: {
|
|
|
20
20
|
readonly removeLabel: {
|
|
21
21
|
readonly delta: v.ObjectSchema<{
|
|
22
22
|
readonly labelPath: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
23
|
-
readonly sourceLocations: v.ArraySchema<v.ObjectSchema<{
|
|
23
|
+
readonly sourceLocations: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
24
24
|
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
25
25
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
26
26
|
readonly uid: v.NumberSchema<undefined>;
|
|
27
27
|
readonly uidValidity: v.NumberSchema<undefined>;
|
|
28
|
-
}, undefined>, undefined>;
|
|
28
|
+
}, undefined>, undefined>, undefined>;
|
|
29
29
|
readonly threadIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
30
30
|
}, undefined>;
|
|
31
31
|
};
|
|
32
32
|
readonly setArchive: {
|
|
33
33
|
readonly delta: v.ObjectSchema<{
|
|
34
|
-
readonly sourceLocations: v.ArraySchema<v.ObjectSchema<{
|
|
34
|
+
readonly sourceLocations: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
35
35
|
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
36
36
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
37
37
|
readonly uid: v.NumberSchema<undefined>;
|
|
38
38
|
readonly uidValidity: v.NumberSchema<undefined>;
|
|
39
|
-
}, undefined>, undefined>;
|
|
39
|
+
}, undefined>, undefined>, undefined>;
|
|
40
40
|
readonly threadIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
41
41
|
}, undefined>;
|
|
42
42
|
};
|
|
@@ -48,12 +48,12 @@ export declare const threadMutatorSchemas: {
|
|
|
48
48
|
};
|
|
49
49
|
readonly setInbox: {
|
|
50
50
|
readonly delta: v.ObjectSchema<{
|
|
51
|
-
readonly sourceLocations: v.ArraySchema<v.ObjectSchema<{
|
|
51
|
+
readonly sourceLocations: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
52
52
|
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
53
53
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
54
54
|
readonly uid: v.NumberSchema<undefined>;
|
|
55
55
|
readonly uidValidity: v.NumberSchema<undefined>;
|
|
56
|
-
}, undefined>, undefined>;
|
|
56
|
+
}, undefined>, undefined>, undefined>;
|
|
57
57
|
readonly threadIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
58
58
|
}, undefined>;
|
|
59
59
|
};
|
|
@@ -65,23 +65,23 @@ export declare const threadMutatorSchemas: {
|
|
|
65
65
|
};
|
|
66
66
|
readonly setSpam: {
|
|
67
67
|
readonly delta: v.ObjectSchema<{
|
|
68
|
-
readonly sourceLocations: v.ArraySchema<v.ObjectSchema<{
|
|
68
|
+
readonly sourceLocations: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
69
69
|
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
70
70
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
71
71
|
readonly uid: v.NumberSchema<undefined>;
|
|
72
72
|
readonly uidValidity: v.NumberSchema<undefined>;
|
|
73
|
-
}, undefined>, undefined>;
|
|
73
|
+
}, undefined>, undefined>, undefined>;
|
|
74
74
|
readonly threadIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
75
75
|
}, undefined>;
|
|
76
76
|
};
|
|
77
77
|
readonly setTrash: {
|
|
78
78
|
readonly delta: v.ObjectSchema<{
|
|
79
|
-
readonly sourceLocations: v.ArraySchema<v.ObjectSchema<{
|
|
79
|
+
readonly sourceLocations: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
80
80
|
readonly labelId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
81
81
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
82
82
|
readonly uid: v.NumberSchema<undefined>;
|
|
83
83
|
readonly uidValidity: v.NumberSchema<undefined>;
|
|
84
|
-
}, undefined>, undefined>;
|
|
84
|
+
}, undefined>, undefined>, undefined>;
|
|
85
85
|
readonly threadIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
86
86
|
}, undefined>;
|
|
87
87
|
};
|
|
@@ -10,12 +10,12 @@ const imapSourceLocationSchema = v.object({
|
|
|
10
10
|
uidValidity: v.number(),
|
|
11
11
|
});
|
|
12
12
|
const specialUseLabelChangeDeltaSchema = v.object({
|
|
13
|
-
sourceLocations: v.array(imapSourceLocationSchema),
|
|
13
|
+
sourceLocations: v.optional(v.array(imapSourceLocationSchema)),
|
|
14
14
|
threadIds: v.array(marcoSchemas.string.required()),
|
|
15
15
|
});
|
|
16
16
|
const threadChangeLabelSchema = v.object({
|
|
17
17
|
labelPath: marcoSchemas.string.required(),
|
|
18
|
-
sourceLocations: v.array(imapSourceLocationSchema),
|
|
18
|
+
sourceLocations: v.optional(v.array(imapSourceLocationSchema)),
|
|
19
19
|
threadIds: v.array(marcoSchemas.string.required()),
|
|
20
20
|
});
|
|
21
21
|
export const threadMutatorSchemas = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Transaction } from '@rocicorp/zero';
|
|
2
2
|
import type * as v from 'valibot';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LabelSpecialUse } from '../../../types';
|
|
4
4
|
import { type AuthData, type HandlerMap } from '../../../types';
|
|
5
5
|
import type { ZeroMutatorSchemas } from '../../../zero/mutatorSchemas';
|
|
6
6
|
import type { MarcoZeroSchema } from '../../../zero/schema';
|
|
7
7
|
export type ThreadMutatorCallbacks = {
|
|
8
8
|
[K in keyof ZeroMutatorSchemas['thread']]?: (args: v.InferOutput<ZeroMutatorSchemas['thread'][K]['delta']>) => Promise<void>;
|
|
9
9
|
};
|
|
10
|
-
export declare const setSystemLabel: (tx: Transaction<MarcoZeroSchema>, threadId: string, targetSpecialUse: LabelSpecialUse) => Promise<
|
|
10
|
+
export declare const setSystemLabel: (tx: Transaction<MarcoZeroSchema>, threadId: string, targetSpecialUse: LabelSpecialUse) => Promise<void>;
|
|
11
11
|
export declare const createThreadMutators: (_authData: AuthData | undefined, callbacks?: ThreadMutatorCallbacks) => HandlerMap<ZeroMutatorSchemas["thread"]>;
|
|
12
12
|
//# 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;AACjD,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AAEjC,OAAO,KAAK,EAAE,
|
|
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;AACjD,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AAEjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAiB,MAAM,qBAAqB,CAAA;AAEnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEhE,MAAM,MAAM,sBAAsB,GAAG;KAClC,CAAC,IAAI,MAAM,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAC1C,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAC1D,OAAO,CAAC,IAAI,CAAC;CACnB,CAAA;AAKD,eAAO,MAAM,cAAc,OACrB,WAAW,CAAC,eAAe,CAAC,YACtB,MAAM,oBACE,eAAe,KAChC,OAAO,CAAC,IAAI,CAyFd,CAAA;AAED,eAAO,MAAM,oBAAoB,cACpB,QAAQ,GAAG,SAAS,cACnB,sBAAsB,KACjC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CA6OxC,CAAA"}
|
|
@@ -6,9 +6,9 @@ export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
|
|
|
6
6
|
if (!thread) {
|
|
7
7
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
8
8
|
}
|
|
9
|
-
const [targetLabel,
|
|
9
|
+
const [targetLabel, messages] = await Promise.all([
|
|
10
10
|
tx.query.accountLabel.where('accountId', thread.accountId).where('specialUse', targetSpecialUse).one().run(),
|
|
11
|
-
tx.query.
|
|
11
|
+
tx.query.threadMessage.where('threadId', threadId).run(),
|
|
12
12
|
]);
|
|
13
13
|
if (!targetLabel) {
|
|
14
14
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
@@ -17,25 +17,18 @@ export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
|
|
|
17
17
|
const hasTarget = currentLabelIds.has(targetLabel.id);
|
|
18
18
|
const labelIdsToRemove = new Set(currentLabelIds);
|
|
19
19
|
labelIdsToRemove.delete(targetLabel.id);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
uidValidity: label.uidValidity,
|
|
30
|
-
});
|
|
31
|
-
threadLabelDeletePromises.push(tx.mutate.threadLabel.delete({
|
|
32
|
-
accountId: thread.accountId,
|
|
33
|
-
labelId: label.labelId,
|
|
34
|
-
threadMessageId: label.threadMessageId,
|
|
35
|
-
}));
|
|
20
|
+
const threadLabelDeletes = [];
|
|
21
|
+
for (const message of messages) {
|
|
22
|
+
for (const labelId of labelIdsToRemove) {
|
|
23
|
+
threadLabelDeletes.push(tx.mutate.threadLabel.delete({
|
|
24
|
+
accountId: thread.accountId,
|
|
25
|
+
labelId,
|
|
26
|
+
threadMessageId: message.id,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
36
29
|
}
|
|
37
30
|
await Promise.all([
|
|
38
|
-
...
|
|
31
|
+
...threadLabelDeletes,
|
|
39
32
|
...[...labelIdsToRemove].map(labelId => tx.mutate.threadByLabel.delete({ labelId, threadId })),
|
|
40
33
|
]);
|
|
41
34
|
if (thread.seen === false && labelIdsToRemove.size > 0) {
|
|
@@ -46,7 +39,6 @@ export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
|
|
|
46
39
|
})));
|
|
47
40
|
}
|
|
48
41
|
if (!hasTarget) {
|
|
49
|
-
const messages = await tx.query.threadMessage.where('threadId', threadId).run();
|
|
50
42
|
const baseTimestamp = Date.now();
|
|
51
43
|
await Promise.all([
|
|
52
44
|
...messages.map((message, i) => tx.mutate.threadLabel.insert({
|
|
@@ -77,7 +69,6 @@ export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
|
|
|
77
69
|
id: threadId,
|
|
78
70
|
labelIdList: buildLabelIdList([targetLabel.id]),
|
|
79
71
|
});
|
|
80
|
-
return sourceLocations;
|
|
81
72
|
};
|
|
82
73
|
export const createThreadMutators = (_authData, callbacks) => ({
|
|
83
74
|
addLabel: async (tx, args) => {
|
|
@@ -125,13 +116,13 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
125
116
|
uidValidity: label.uidValidity ?? 0,
|
|
126
117
|
})));
|
|
127
118
|
}
|
|
128
|
-
|
|
119
|
+
currentLabelIds.add(label.id);
|
|
129
120
|
await tx.mutate.thread.update({
|
|
130
121
|
id: threadId,
|
|
131
|
-
labelIdList: buildLabelIdList([...
|
|
122
|
+
labelIdList: buildLabelIdList([...currentLabelIds]),
|
|
132
123
|
});
|
|
133
124
|
}
|
|
134
|
-
callbacks?.addLabel?.(
|
|
125
|
+
callbacks?.addLabel?.(args);
|
|
135
126
|
},
|
|
136
127
|
delete: async (tx, args) => {
|
|
137
128
|
for (const threadId of args.threadIds) {
|
|
@@ -155,38 +146,28 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
155
146
|
callbacks?.delete?.(args);
|
|
156
147
|
},
|
|
157
148
|
removeLabel: async (tx, args) => {
|
|
158
|
-
const allSourceLocations = [];
|
|
159
149
|
for (const threadId of args.threadIds) {
|
|
160
150
|
const thread = await tx.query.thread.where('id', threadId).one().run();
|
|
161
151
|
if (!thread) {
|
|
162
152
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
163
153
|
}
|
|
164
|
-
const [label,
|
|
154
|
+
const [label, messages] = await Promise.all([
|
|
165
155
|
tx.query.accountLabel.where('accountId', thread.accountId).where('path', args.labelPath).one().run(),
|
|
166
|
-
tx.query.
|
|
156
|
+
tx.query.threadMessage.where('threadId', threadId).run(),
|
|
167
157
|
]);
|
|
168
158
|
if (!label) {
|
|
169
159
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
170
160
|
}
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
161
|
+
const currentLabelIds = new Set(threadsUtils.parseLabelIdList(thread.labelIdList));
|
|
162
|
+
if (!currentLabelIds.has(label.id)) {
|
|
173
163
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
174
164
|
}
|
|
175
|
-
for (const existing of labelsForThisLabel) {
|
|
176
|
-
allSourceLocations.push({
|
|
177
|
-
labelId: existing.labelId,
|
|
178
|
-
threadMessageId: existing.threadMessageId,
|
|
179
|
-
uid: existing.uid,
|
|
180
|
-
uidValidity: existing.uidValidity,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
const currentLabelIds = new Set(threadsUtils.parseLabelIdList(thread.labelIdList));
|
|
184
165
|
currentLabelIds.delete(label.id);
|
|
185
166
|
await Promise.all([
|
|
186
|
-
...
|
|
167
|
+
...messages.map(message => tx.mutate.threadLabel.delete({
|
|
187
168
|
accountId: thread.accountId,
|
|
188
169
|
labelId: label.id,
|
|
189
|
-
threadMessageId:
|
|
170
|
+
threadMessageId: message.id,
|
|
190
171
|
})),
|
|
191
172
|
tx.mutate.threadByLabel.delete({
|
|
192
173
|
labelId: label.id,
|
|
@@ -206,14 +187,13 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
206
187
|
}),
|
|
207
188
|
]);
|
|
208
189
|
}
|
|
209
|
-
callbacks?.removeLabel?.(
|
|
190
|
+
callbacks?.removeLabel?.(args);
|
|
210
191
|
},
|
|
211
192
|
setArchive: async (tx, args) => {
|
|
212
|
-
const allSourceLocations = [];
|
|
213
193
|
for (const threadId of args.threadIds) {
|
|
214
|
-
|
|
194
|
+
await setSystemLabel(tx, threadId, 'ARCHIVE');
|
|
215
195
|
}
|
|
216
|
-
callbacks?.setArchive?.(
|
|
196
|
+
callbacks?.setArchive?.(args);
|
|
217
197
|
},
|
|
218
198
|
setFlagged: async (tx, args) => {
|
|
219
199
|
await Promise.all(args.threadIds.map(threadId => tx.mutate.thread.update({
|
|
@@ -223,11 +203,10 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
223
203
|
callbacks?.setFlagged?.(args);
|
|
224
204
|
},
|
|
225
205
|
setInbox: async (tx, args) => {
|
|
226
|
-
const allSourceLocations = [];
|
|
227
206
|
for (const threadId of args.threadIds) {
|
|
228
|
-
|
|
207
|
+
await setSystemLabel(tx, threadId, 'INBOX');
|
|
229
208
|
}
|
|
230
|
-
callbacks?.setInbox?.(
|
|
209
|
+
callbacks?.setInbox?.(args);
|
|
231
210
|
},
|
|
232
211
|
setSeen: async (tx, args) => {
|
|
233
212
|
const threads = await tx.query.thread.where('id', 'IN', args.threadIds).run();
|
|
@@ -256,17 +235,15 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
256
235
|
callbacks?.setSeen?.(args);
|
|
257
236
|
},
|
|
258
237
|
setSpam: async (tx, args) => {
|
|
259
|
-
const allSourceLocations = [];
|
|
260
238
|
for (const threadId of args.threadIds) {
|
|
261
|
-
|
|
239
|
+
await setSystemLabel(tx, threadId, 'SPAM');
|
|
262
240
|
}
|
|
263
|
-
callbacks?.setSpam?.(
|
|
241
|
+
callbacks?.setSpam?.(args);
|
|
264
242
|
},
|
|
265
243
|
setTrash: async (tx, args) => {
|
|
266
|
-
const allSourceLocations = [];
|
|
267
244
|
for (const threadId of args.threadIds) {
|
|
268
|
-
|
|
245
|
+
await setSystemLabel(tx, threadId, 'TRASH');
|
|
269
246
|
}
|
|
270
|
-
callbacks?.setTrash?.(
|
|
247
|
+
callbacks?.setTrash?.(args);
|
|
271
248
|
},
|
|
272
249
|
});
|
|
@@ -80,7 +80,6 @@ describe('threadMutators', () => {
|
|
|
80
80
|
const mutators = createMutators();
|
|
81
81
|
await mutators.thread.addLabel(transaction, {
|
|
82
82
|
labelPath: 'Work',
|
|
83
|
-
sourceLocations: [],
|
|
84
83
|
threadIds: ['test-thread-id-1'],
|
|
85
84
|
});
|
|
86
85
|
expect(threadLabelInsert).toHaveBeenCalledTimes(2);
|
|
@@ -209,24 +208,14 @@ describe('threadMutators', () => {
|
|
|
209
208
|
const threadRecord = {
|
|
210
209
|
accountId: 'test-account-id-1',
|
|
211
210
|
id: 'test-thread-id-1',
|
|
211
|
+
labelIdList: ' test-label-id-1 ',
|
|
212
212
|
};
|
|
213
213
|
const labelRecord = {
|
|
214
214
|
accountId: 'test-account-id-1',
|
|
215
215
|
id: 'test-label-id-1',
|
|
216
216
|
path: 'Work',
|
|
217
217
|
};
|
|
218
|
-
const
|
|
219
|
-
{
|
|
220
|
-
labelId: 'test-label-id-1',
|
|
221
|
-
threadId: 'test-thread-id-1',
|
|
222
|
-
threadMessageId: 'test-message-id-1',
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
labelId: 'test-label-id-1',
|
|
226
|
-
threadId: 'test-thread-id-1',
|
|
227
|
-
threadMessageId: 'test-message-id-2',
|
|
228
|
-
},
|
|
229
|
-
];
|
|
218
|
+
const messageRecords = [{ id: 'test-message-id-1' }, { id: 'test-message-id-2' }];
|
|
230
219
|
const runThread = mock(async () => threadRecord);
|
|
231
220
|
const oneThread = mock(() => ({ run: runThread }));
|
|
232
221
|
const whereThread = mock(() => ({ one: oneThread }));
|
|
@@ -234,25 +223,11 @@ describe('threadMutators', () => {
|
|
|
234
223
|
const oneLabel = mock(() => ({ run: runLabel }));
|
|
235
224
|
const whereLabelPath = mock(() => ({ one: oneLabel }));
|
|
236
225
|
const whereLabelAccount = mock(() => ({ where: whereLabelPath }));
|
|
237
|
-
const
|
|
238
|
-
const
|
|
239
|
-
const whereThreadLabel = mock((field) => {
|
|
240
|
-
if (field === 'threadId') {
|
|
241
|
-
return { run: runExisting, where: whereLabelId };
|
|
242
|
-
}
|
|
243
|
-
return { where: whereLabelId };
|
|
244
|
-
});
|
|
226
|
+
const runMessages = mock(async () => messageRecords);
|
|
227
|
+
const whereMessages = mock(() => ({ run: runMessages }));
|
|
245
228
|
const threadLabelDelete = mock(async () => { });
|
|
246
229
|
const threadUpdate = mock(async () => { });
|
|
247
230
|
const threadByLabelDelete = mock(async () => { });
|
|
248
|
-
const runThreadByLabel = mock(async () => ({
|
|
249
|
-
labelId: 'test-label-id-1',
|
|
250
|
-
latestMessageDate: 1234567890,
|
|
251
|
-
threadId: 'test-thread-id-1',
|
|
252
|
-
}));
|
|
253
|
-
const oneThreadByLabel = mock(() => ({ run: runThreadByLabel }));
|
|
254
|
-
const whereThreadByLabelThreadId = mock(() => ({ one: oneThreadByLabel }));
|
|
255
|
-
const whereThreadByLabel = mock(() => ({ where: whereThreadByLabelThreadId }));
|
|
256
231
|
const transaction = {
|
|
257
232
|
mutate: {
|
|
258
233
|
accountLabel: {
|
|
@@ -275,18 +250,14 @@ describe('threadMutators', () => {
|
|
|
275
250
|
thread: {
|
|
276
251
|
where: whereThread,
|
|
277
252
|
},
|
|
278
|
-
|
|
279
|
-
where:
|
|
280
|
-
},
|
|
281
|
-
threadLabel: {
|
|
282
|
-
where: whereThreadLabel,
|
|
253
|
+
threadMessage: {
|
|
254
|
+
where: whereMessages,
|
|
283
255
|
},
|
|
284
256
|
},
|
|
285
257
|
};
|
|
286
258
|
const mutators = createMutators();
|
|
287
259
|
await mutators.thread.removeLabel(transaction, {
|
|
288
260
|
labelPath: 'Work',
|
|
289
|
-
sourceLocations: [],
|
|
290
261
|
threadIds: ['test-thread-id-1'],
|
|
291
262
|
});
|
|
292
263
|
expect(threadLabelDelete).toHaveBeenCalledTimes(2);
|
|
@@ -311,6 +282,7 @@ describe('threadMutators', () => {
|
|
|
311
282
|
const threadRecord = {
|
|
312
283
|
accountId: 'test-account-id-1',
|
|
313
284
|
id: 'test-thread-id-1',
|
|
285
|
+
labelIdList: ' test-inbox-label-id ',
|
|
314
286
|
};
|
|
315
287
|
const archiveLabel = {
|
|
316
288
|
accountId: 'test-account-id-1',
|
|
@@ -331,10 +303,6 @@ describe('threadMutators', () => {
|
|
|
331
303
|
}
|
|
332
304
|
return { where: whereSpecialUse };
|
|
333
305
|
});
|
|
334
|
-
const runAllThreadLabels = mock(async () => [
|
|
335
|
-
{ labelId: 'test-inbox-label-id', threadId: 'test-thread-id-1', threadMessageId: 'test-message-id-1' },
|
|
336
|
-
]);
|
|
337
|
-
const whereThreadLabel = mock(() => ({ run: runAllThreadLabels }));
|
|
338
306
|
const runMessages = mock(async () => messageRecords);
|
|
339
307
|
const whereMessages = mock(() => ({ run: runMessages }));
|
|
340
308
|
const threadLabelDelete = mock(async () => { });
|
|
@@ -342,14 +310,6 @@ describe('threadMutators', () => {
|
|
|
342
310
|
const threadUpdate = mock(async () => { });
|
|
343
311
|
const threadByLabelDelete = mock(async () => { });
|
|
344
312
|
const threadByLabelInsert = mock(async () => { });
|
|
345
|
-
const runThreadByLabel = mock(async () => ({
|
|
346
|
-
labelId: 'test-inbox-label-id',
|
|
347
|
-
latestMessageDate: 1234567890,
|
|
348
|
-
threadId: 'test-thread-id-1',
|
|
349
|
-
}));
|
|
350
|
-
const oneThreadByLabel = mock(() => ({ run: runThreadByLabel }));
|
|
351
|
-
const whereThreadByLabelThreadId = mock(() => ({ one: oneThreadByLabel }));
|
|
352
|
-
const whereThreadByLabel = mock(() => ({ where: whereThreadByLabelThreadId }));
|
|
353
313
|
const transaction = {
|
|
354
314
|
mutate: {
|
|
355
315
|
accountLabel: {
|
|
@@ -374,12 +334,6 @@ describe('threadMutators', () => {
|
|
|
374
334
|
thread: {
|
|
375
335
|
where: whereThread,
|
|
376
336
|
},
|
|
377
|
-
threadByLabel: {
|
|
378
|
-
where: whereThreadByLabel,
|
|
379
|
-
},
|
|
380
|
-
threadLabel: {
|
|
381
|
-
where: whereThreadLabel,
|
|
382
|
-
},
|
|
383
337
|
threadMessage: {
|
|
384
338
|
where: whereMessages,
|
|
385
339
|
},
|
|
@@ -387,7 +341,6 @@ describe('threadMutators', () => {
|
|
|
387
341
|
};
|
|
388
342
|
const mutators = createMutators();
|
|
389
343
|
await mutators.thread.setArchive(transaction, {
|
|
390
|
-
sourceLocations: [],
|
|
391
344
|
threadIds: ['test-thread-id-1'],
|
|
392
345
|
});
|
|
393
346
|
expect(threadLabelDelete).toHaveBeenCalledWith({
|
|
@@ -434,6 +387,7 @@ describe('threadMutators', () => {
|
|
|
434
387
|
const threadRecord = {
|
|
435
388
|
accountId: 'test-account-id-1',
|
|
436
389
|
id: 'test-thread-id-1',
|
|
390
|
+
labelIdList: ' test-archive-label-id ',
|
|
437
391
|
};
|
|
438
392
|
const inboxLabel = {
|
|
439
393
|
accountId: 'test-account-id-1',
|
|
@@ -454,10 +408,6 @@ describe('threadMutators', () => {
|
|
|
454
408
|
}
|
|
455
409
|
return { where: whereSpecialUse };
|
|
456
410
|
});
|
|
457
|
-
const runAllThreadLabels = mock(async () => [
|
|
458
|
-
{ labelId: 'test-archive-label-id', threadId: 'test-thread-id-1', threadMessageId: 'test-message-id-1' },
|
|
459
|
-
]);
|
|
460
|
-
const whereThreadLabel = mock(() => ({ run: runAllThreadLabels }));
|
|
461
411
|
const runMessages = mock(async () => messageRecords);
|
|
462
412
|
const whereMessages = mock(() => ({ run: runMessages }));
|
|
463
413
|
const threadLabelDelete = mock(async () => { });
|
|
@@ -465,14 +415,6 @@ describe('threadMutators', () => {
|
|
|
465
415
|
const threadUpdate = mock(async () => { });
|
|
466
416
|
const threadByLabelDelete = mock(async () => { });
|
|
467
417
|
const threadByLabelInsert = mock(async () => { });
|
|
468
|
-
const runThreadByLabel = mock(async () => ({
|
|
469
|
-
labelId: 'test-archive-label-id',
|
|
470
|
-
latestMessageDate: 1234567890,
|
|
471
|
-
threadId: 'test-thread-id-1',
|
|
472
|
-
}));
|
|
473
|
-
const oneThreadByLabel = mock(() => ({ run: runThreadByLabel }));
|
|
474
|
-
const whereThreadByLabelThreadId = mock(() => ({ one: oneThreadByLabel }));
|
|
475
|
-
const whereThreadByLabel = mock(() => ({ where: whereThreadByLabelThreadId }));
|
|
476
418
|
const transaction = {
|
|
477
419
|
mutate: {
|
|
478
420
|
accountLabel: {
|
|
@@ -497,12 +439,6 @@ describe('threadMutators', () => {
|
|
|
497
439
|
thread: {
|
|
498
440
|
where: whereThread,
|
|
499
441
|
},
|
|
500
|
-
threadByLabel: {
|
|
501
|
-
where: whereThreadByLabel,
|
|
502
|
-
},
|
|
503
|
-
threadLabel: {
|
|
504
|
-
where: whereThreadLabel,
|
|
505
|
-
},
|
|
506
442
|
threadMessage: {
|
|
507
443
|
where: whereMessages,
|
|
508
444
|
},
|
|
@@ -510,7 +446,6 @@ describe('threadMutators', () => {
|
|
|
510
446
|
};
|
|
511
447
|
const mutators = createMutators();
|
|
512
448
|
await mutators.thread.setInbox(transaction, {
|
|
513
|
-
sourceLocations: [],
|
|
514
449
|
threadIds: ['test-thread-id-1'],
|
|
515
450
|
});
|
|
516
451
|
expect(threadLabelDelete).toHaveBeenCalledWith({
|
|
@@ -729,7 +664,6 @@ describe('threadMutators', () => {
|
|
|
729
664
|
};
|
|
730
665
|
const mutators = createMutators();
|
|
731
666
|
await mutators.thread.setSpam(transaction, {
|
|
732
|
-
sourceLocations: [],
|
|
733
667
|
threadIds: ['test-thread-id-1'],
|
|
734
668
|
});
|
|
735
669
|
expect(threadLabelInsert).toHaveBeenCalledWith(expect.objectContaining({
|
|
@@ -804,7 +738,6 @@ describe('threadMutators', () => {
|
|
|
804
738
|
};
|
|
805
739
|
const mutators = createMutators();
|
|
806
740
|
await mutators.thread.setTrash(transaction, {
|
|
807
|
-
sourceLocations: [],
|
|
808
741
|
threadIds: ['test-thread-id-1'],
|
|
809
742
|
});
|
|
810
743
|
expect(threadLabelInsert).toHaveBeenCalledWith(expect.objectContaining({
|