@marcoappio/marco-config 2.0.442 → 2.0.444
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/marcoPublicConfig.d.ts +0 -7
- package/dist/marcoPublicConfig.d.ts.map +1 -1
- package/dist/marcoPublicConfig.js +0 -9
- package/dist/zero/index.d.ts +4 -10
- package/dist/zero/index.d.ts.map +1 -1
- package/dist/zero/mutatorSchemas/index.d.ts +4 -10
- package/dist/zero/mutatorSchemas/index.d.ts.map +1 -1
- package/dist/zero/mutatorSchemas/thread.d.ts +4 -10
- package/dist/zero/mutatorSchemas/thread.d.ts.map +1 -1
- package/dist/zero/mutatorSchemas/thread.js +12 -27
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts +2 -0
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.js +40 -129
- package/dist/zero/mutators/threadMutators/threadMutators.test.js +13 -51
- package/package.json +1 -1
|
@@ -23,13 +23,6 @@ type MarcoPublicConfig = {
|
|
|
23
23
|
tenantId: string;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated Replicache support is being removed in favor of Zero.
|
|
28
|
-
* Downstream consumers should migrate to `zero`.
|
|
29
|
-
*/
|
|
30
|
-
replicache?: {
|
|
31
|
-
licenseKey: string;
|
|
32
|
-
};
|
|
33
26
|
zero: {
|
|
34
27
|
cacheUrl: string;
|
|
35
28
|
pushUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marcoPublicConfig.d.ts","sourceRoot":"","sources":["../src/marcoPublicConfig.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;AAEvE,eAAO,MAAM,SAAS,kBAGP,CAAA;AAEf,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE;QACL,GAAG,EAAE;YACH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D,eAAO,MAAM,iBAAiB,SAAS,gBAAgB,sBAAmC,CAAA"}
|
|
@@ -25,9 +25,6 @@ const configMap = {
|
|
|
25
25
|
tenantId: '33fe2afe-644d-4fe2-a264-c4f2c34fa2cf',
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
|
-
replicache: {
|
|
29
|
-
licenseKey: 'la6cf85ee37b5495481575ecececc3e49',
|
|
30
|
-
},
|
|
31
28
|
workOS: {
|
|
32
29
|
clientId: 'client_01J51ET6KV4GBGMGHY0PJ9VGP2',
|
|
33
30
|
},
|
|
@@ -59,9 +56,6 @@ const configMap = {
|
|
|
59
56
|
tenantId: '33fe2afe-644d-4fe2-a264-c4f2c34fa2cf',
|
|
60
57
|
},
|
|
61
58
|
},
|
|
62
|
-
replicache: {
|
|
63
|
-
licenseKey: 'la6cf85ee37b5495481575ecececc3e49',
|
|
64
|
-
},
|
|
65
59
|
workOS: {
|
|
66
60
|
clientId: 'client_01J51ET6RT5WCS3NNQYBB7FAE7',
|
|
67
61
|
},
|
|
@@ -93,9 +87,6 @@ const configMap = {
|
|
|
93
87
|
tenantId: '33fe2afe-644d-4fe2-a264-c4f2c34fa2cf',
|
|
94
88
|
},
|
|
95
89
|
},
|
|
96
|
-
replicache: {
|
|
97
|
-
licenseKey: 'la6cf85ee37b5495481575ecececc3e49',
|
|
98
|
-
},
|
|
99
90
|
workOS: {
|
|
100
91
|
clientId: 'client_01J51ET6KV4GBGMGHY0PJ9VGP2',
|
|
101
92
|
},
|
package/dist/zero/index.d.ts
CHANGED
|
@@ -258,13 +258,10 @@ export declare const marcoZero: {
|
|
|
258
258
|
}, undefined>;
|
|
259
259
|
};
|
|
260
260
|
readonly requestAttachmentDownload: {
|
|
261
|
-
readonly delta: import("valibot").
|
|
262
|
-
readonly attachmentId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
263
|
-
readonly threadId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
264
|
-
}, undefined>, import("valibot").ObjectSchema<{
|
|
261
|
+
readonly delta: import("valibot").ObjectSchema<{
|
|
265
262
|
readonly attachmentIds: 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>;
|
|
266
263
|
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
|
-
}, undefined
|
|
264
|
+
}, undefined>;
|
|
268
265
|
};
|
|
269
266
|
readonly setArchive: {
|
|
270
267
|
readonly delta: import("valibot").ObjectSchema<{
|
|
@@ -272,13 +269,10 @@ export declare const marcoZero: {
|
|
|
272
269
|
}, undefined>;
|
|
273
270
|
};
|
|
274
271
|
readonly setFlagged: {
|
|
275
|
-
readonly delta: import("valibot").
|
|
276
|
-
readonly flagged: import("valibot").NonOptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
277
|
-
readonly threadId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
278
|
-
}, undefined>, import("valibot").ObjectSchema<{
|
|
272
|
+
readonly delta: import("valibot").ObjectSchema<{
|
|
279
273
|
readonly flagged: import("valibot").NonOptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
280
274
|
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>;
|
|
281
|
-
}, undefined
|
|
275
|
+
}, undefined>;
|
|
282
276
|
};
|
|
283
277
|
readonly setInbox: {
|
|
284
278
|
readonly delta: import("valibot").ObjectSchema<{
|
package/dist/zero/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zero/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zero/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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{
|
|
|
256
256
|
}, undefined>;
|
|
257
257
|
};
|
|
258
258
|
readonly requestAttachmentDownload: {
|
|
259
|
-
readonly delta: import("valibot").
|
|
260
|
-
readonly attachmentId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
261
|
-
readonly threadId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
262
|
-
}, undefined>, import("valibot").ObjectSchema<{
|
|
259
|
+
readonly delta: import("valibot").ObjectSchema<{
|
|
263
260
|
readonly attachmentIds: 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>;
|
|
264
261
|
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>;
|
|
265
|
-
}, undefined
|
|
262
|
+
}, undefined>;
|
|
266
263
|
};
|
|
267
264
|
readonly setArchive: {
|
|
268
265
|
readonly delta: import("valibot").ObjectSchema<{
|
|
@@ -270,13 +267,10 @@ export declare const zeroMutatorSchemas: {
|
|
|
270
267
|
}, undefined>;
|
|
271
268
|
};
|
|
272
269
|
readonly setFlagged: {
|
|
273
|
-
readonly delta: import("valibot").
|
|
274
|
-
readonly flagged: import("valibot").NonOptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
275
|
-
readonly threadId: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
276
|
-
}, undefined>, import("valibot").ObjectSchema<{
|
|
270
|
+
readonly delta: import("valibot").ObjectSchema<{
|
|
277
271
|
readonly flagged: import("valibot").NonOptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
278
272
|
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>;
|
|
279
|
-
}, undefined
|
|
273
|
+
}, undefined>;
|
|
280
274
|
};
|
|
281
275
|
readonly setInbox: {
|
|
282
276
|
readonly delta: import("valibot").ObjectSchema<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/zero/mutatorSchemas/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/zero/mutatorSchemas/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKrB,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAA"}
|
|
@@ -18,13 +18,10 @@ export declare const threadMutatorSchemas: {
|
|
|
18
18
|
}, undefined>;
|
|
19
19
|
};
|
|
20
20
|
readonly requestAttachmentDownload: {
|
|
21
|
-
readonly delta: v.
|
|
22
|
-
readonly attachmentId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
23
|
-
readonly threadId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
24
|
-
}, undefined>, v.ObjectSchema<{
|
|
21
|
+
readonly delta: v.ObjectSchema<{
|
|
25
22
|
readonly attachmentIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
26
23
|
readonly threadIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
27
|
-
}, undefined
|
|
24
|
+
}, undefined>;
|
|
28
25
|
};
|
|
29
26
|
readonly setArchive: {
|
|
30
27
|
readonly delta: v.ObjectSchema<{
|
|
@@ -32,13 +29,10 @@ export declare const threadMutatorSchemas: {
|
|
|
32
29
|
}, undefined>;
|
|
33
30
|
};
|
|
34
31
|
readonly setFlagged: {
|
|
35
|
-
readonly delta: v.
|
|
36
|
-
readonly flagged: v.NonOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
37
|
-
readonly threadId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
38
|
-
}, undefined>, v.ObjectSchema<{
|
|
32
|
+
readonly delta: v.ObjectSchema<{
|
|
39
33
|
readonly flagged: v.NonOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
40
34
|
readonly threadIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>, undefined>;
|
|
41
|
-
}, undefined
|
|
35
|
+
}, undefined>;
|
|
42
36
|
};
|
|
43
37
|
readonly setInbox: {
|
|
44
38
|
readonly delta: v.ObjectSchema<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../../src/zero/mutatorSchemas/thread.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../../src/zero/mutatorSchemas/thread.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAa5B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCvB,CAAA"}
|
|
@@ -7,30 +7,6 @@ const threadAddRemoveLabelSchema = v.object({
|
|
|
7
7
|
labelPath: marcoSchemas.string.required(),
|
|
8
8
|
threadIds: v.array(marcoSchemas.string.required()),
|
|
9
9
|
});
|
|
10
|
-
const threadRequestAttachmentSchema = v.union([
|
|
11
|
-
v.object({
|
|
12
|
-
attachmentId: marcoSchemas.string.required(),
|
|
13
|
-
threadId: marcoSchemas.string.required(),
|
|
14
|
-
}),
|
|
15
|
-
v.object({
|
|
16
|
-
attachmentIds: v.array(marcoSchemas.string.required()),
|
|
17
|
-
threadIds: v.array(marcoSchemas.string.required()),
|
|
18
|
-
}),
|
|
19
|
-
]);
|
|
20
|
-
const threadSetFlaggedSchema = v.union([
|
|
21
|
-
v.object({
|
|
22
|
-
flagged: v.nonOptional(v.boolean()),
|
|
23
|
-
threadId: marcoSchemas.string.required(),
|
|
24
|
-
}),
|
|
25
|
-
v.object({
|
|
26
|
-
flagged: v.nonOptional(v.boolean()),
|
|
27
|
-
threadIds: v.array(marcoSchemas.string.required()),
|
|
28
|
-
}),
|
|
29
|
-
]);
|
|
30
|
-
const threadSetSeenSchema = v.object({
|
|
31
|
-
seen: v.boolean(),
|
|
32
|
-
threadIds: v.array(marcoSchemas.string.required()),
|
|
33
|
-
});
|
|
34
10
|
export const threadMutatorSchemas = {
|
|
35
11
|
addLabel: {
|
|
36
12
|
delta: threadAddRemoveLabelSchema,
|
|
@@ -42,19 +18,28 @@ export const threadMutatorSchemas = {
|
|
|
42
18
|
delta: threadAddRemoveLabelSchema,
|
|
43
19
|
},
|
|
44
20
|
requestAttachmentDownload: {
|
|
45
|
-
delta:
|
|
21
|
+
delta: v.object({
|
|
22
|
+
attachmentIds: v.array(marcoSchemas.string.required()),
|
|
23
|
+
threadIds: v.array(marcoSchemas.string.required()),
|
|
24
|
+
}),
|
|
46
25
|
},
|
|
47
26
|
setArchive: {
|
|
48
27
|
delta: threadIdsSchema,
|
|
49
28
|
},
|
|
50
29
|
setFlagged: {
|
|
51
|
-
delta:
|
|
30
|
+
delta: v.object({
|
|
31
|
+
flagged: v.nonOptional(v.boolean()),
|
|
32
|
+
threadIds: v.array(marcoSchemas.string.required()),
|
|
33
|
+
}),
|
|
52
34
|
},
|
|
53
35
|
setInbox: {
|
|
54
36
|
delta: threadIdsSchema,
|
|
55
37
|
},
|
|
56
38
|
setSeen: {
|
|
57
|
-
delta:
|
|
39
|
+
delta: v.object({
|
|
40
|
+
seen: v.boolean(),
|
|
41
|
+
threadIds: v.array(marcoSchemas.string.required()),
|
|
42
|
+
}),
|
|
58
43
|
},
|
|
59
44
|
setSpam: {
|
|
60
45
|
delta: threadIdsSchema,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type * as v from 'valibot';
|
|
2
|
+
import type { LabelSpecialUse } from '../../../types';
|
|
2
3
|
import { type AuthData, type HandlerMap } from '../../../types';
|
|
3
4
|
import type { ZeroMutatorSchemas } from '../../../zero/mutatorSchemas';
|
|
4
5
|
export type ThreadMutatorCallbacks = {
|
|
5
6
|
[K in keyof ZeroMutatorSchemas['thread']]?: (args: v.InferOutput<ZeroMutatorSchemas['thread'][K]['delta']>) => Promise<void>;
|
|
6
7
|
};
|
|
8
|
+
export declare const setSystemLabel: (tx: any, threadId: string, targetSpecialUse: LabelSpecialUse) => Promise<void>;
|
|
7
9
|
export declare const createThreadMutators: (_authData: AuthData | undefined, callbacks?: ThreadMutatorCallbacks) => HandlerMap<ZeroMutatorSchemas["thread"]>;
|
|
8
10
|
//# 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,KAAK,CAAC,MAAM,SAAS,CAAA;AAEjC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAiB,MAAM,qBAAqB,CAAA;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,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;AAED,eAAO,MAAM,oBAAoB,cACpB,QAAQ,GAAG,SAAS,cACnB,sBAAsB,KACjC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"threadMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/threadMutators/threadMutators.ts"],"names":[],"mappings":"AAAA,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;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,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;AAED,eAAO,MAAM,cAAc,OAAc,GAAG,YAAY,MAAM,oBAAoB,eAAe,KAAG,OAAO,CAAC,IAAI,CAwC/G,CAAA;AAED,eAAO,MAAM,oBAAoB,cACpB,QAAQ,GAAG,SAAS,cACnB,sBAAsB,KACjC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAwIxC,CAAA"}
|
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
import { MutationError } from '../../../types';
|
|
2
|
+
export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
|
|
3
|
+
const thread = await tx.query.thread.where('id', threadId).one().run();
|
|
4
|
+
if (!thread) {
|
|
5
|
+
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
6
|
+
}
|
|
7
|
+
const { accountId } = thread;
|
|
8
|
+
const targetLabel = await tx.query.accountLabel
|
|
9
|
+
.where('accountId', accountId)
|
|
10
|
+
.where('specialUse', targetSpecialUse)
|
|
11
|
+
.one()
|
|
12
|
+
.run();
|
|
13
|
+
if (!targetLabel) {
|
|
14
|
+
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
15
|
+
}
|
|
16
|
+
const allThreadLabels = await tx.query.threadLabel.where('threadId', threadId).run();
|
|
17
|
+
let hasTarget = false;
|
|
18
|
+
for (const label of allThreadLabels) {
|
|
19
|
+
if (label.labelId === targetLabel.id) {
|
|
20
|
+
hasTarget = true;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
await tx.mutate.threadLabel.delete({
|
|
24
|
+
labelId: label.labelId,
|
|
25
|
+
threadId,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!hasTarget) {
|
|
30
|
+
await tx.mutate.threadLabel.insert({
|
|
31
|
+
labelId: targetLabel.id,
|
|
32
|
+
threadId,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
2
36
|
export const createThreadMutators = (_authData, callbacks) => ({
|
|
3
37
|
addLabel: async (tx, args) => {
|
|
4
38
|
for (const threadId of args.threadIds) {
|
|
@@ -58,8 +92,7 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
58
92
|
callbacks?.removeLabel?.(args);
|
|
59
93
|
},
|
|
60
94
|
requestAttachmentDownload: async (tx, args) => {
|
|
61
|
-
const
|
|
62
|
-
for (const attachmentId of attachmentIds) {
|
|
95
|
+
for (const attachmentId of args.attachmentIds) {
|
|
63
96
|
const attachment = await tx.query.threadMessageAttachment.where('id', attachmentId).one().run();
|
|
64
97
|
if (!attachment) {
|
|
65
98
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
@@ -73,55 +106,12 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
73
106
|
},
|
|
74
107
|
setArchive: async (tx, args) => {
|
|
75
108
|
for (const threadId of args.threadIds) {
|
|
76
|
-
|
|
77
|
-
if (!thread) {
|
|
78
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
79
|
-
}
|
|
80
|
-
const inboxLabel = await tx.query.accountLabel
|
|
81
|
-
.where('accountId', thread.accountId)
|
|
82
|
-
.where('specialUse', 'INBOX')
|
|
83
|
-
.one()
|
|
84
|
-
.run();
|
|
85
|
-
const archiveLabel = await tx.query.accountLabel
|
|
86
|
-
.where('accountId', thread.accountId)
|
|
87
|
-
.where('specialUse', 'ARCHIVE')
|
|
88
|
-
.one()
|
|
89
|
-
.run();
|
|
90
|
-
if (!inboxLabel || !archiveLabel) {
|
|
91
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
92
|
-
}
|
|
93
|
-
if (inboxLabel) {
|
|
94
|
-
const existing = await tx.query.threadLabel
|
|
95
|
-
.where('threadId', threadId)
|
|
96
|
-
.where('labelId', inboxLabel.id)
|
|
97
|
-
.one()
|
|
98
|
-
.run();
|
|
99
|
-
if (existing) {
|
|
100
|
-
await tx.mutate.threadLabel.delete({
|
|
101
|
-
labelId: inboxLabel.id,
|
|
102
|
-
threadId,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (archiveLabel) {
|
|
107
|
-
const existing = await tx.query.threadLabel
|
|
108
|
-
.where('threadId', threadId)
|
|
109
|
-
.where('labelId', archiveLabel.id)
|
|
110
|
-
.one()
|
|
111
|
-
.run();
|
|
112
|
-
if (!existing) {
|
|
113
|
-
await tx.mutate.threadLabel.insert({
|
|
114
|
-
labelId: archiveLabel.id,
|
|
115
|
-
threadId,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
109
|
+
await setSystemLabel(tx, threadId, 'ARCHIVE');
|
|
119
110
|
}
|
|
120
111
|
callbacks?.setArchive?.(args);
|
|
121
112
|
},
|
|
122
113
|
setFlagged: async (tx, args) => {
|
|
123
|
-
const
|
|
124
|
-
for (const threadId of threadIds) {
|
|
114
|
+
for (const threadId of args.threadIds) {
|
|
125
115
|
await tx.mutate.thread.update({
|
|
126
116
|
flagged: args.flagged,
|
|
127
117
|
id: threadId,
|
|
@@ -131,46 +121,7 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
131
121
|
},
|
|
132
122
|
setInbox: async (tx, args) => {
|
|
133
123
|
for (const threadId of args.threadIds) {
|
|
134
|
-
|
|
135
|
-
if (!thread) {
|
|
136
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
137
|
-
}
|
|
138
|
-
const inboxLabel = await tx.query.accountLabel
|
|
139
|
-
.where('accountId', thread.accountId)
|
|
140
|
-
.where('specialUse', 'INBOX')
|
|
141
|
-
.one()
|
|
142
|
-
.run();
|
|
143
|
-
const archiveLabel = await tx.query.accountLabel
|
|
144
|
-
.where('accountId', thread.accountId)
|
|
145
|
-
.where('specialUse', 'ARCHIVE')
|
|
146
|
-
.one()
|
|
147
|
-
.run();
|
|
148
|
-
if (archiveLabel) {
|
|
149
|
-
const existing = await tx.query.threadLabel
|
|
150
|
-
.where('threadId', threadId)
|
|
151
|
-
.where('labelId', archiveLabel.id)
|
|
152
|
-
.one()
|
|
153
|
-
.run();
|
|
154
|
-
if (existing) {
|
|
155
|
-
await tx.mutate.threadLabel.delete({
|
|
156
|
-
labelId: archiveLabel.id,
|
|
157
|
-
threadId,
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (inboxLabel) {
|
|
162
|
-
const existing = await tx.query.threadLabel
|
|
163
|
-
.where('threadId', threadId)
|
|
164
|
-
.where('labelId', inboxLabel.id)
|
|
165
|
-
.one()
|
|
166
|
-
.run();
|
|
167
|
-
if (!existing) {
|
|
168
|
-
await tx.mutate.threadLabel.insert({
|
|
169
|
-
labelId: inboxLabel.id,
|
|
170
|
-
threadId,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
124
|
+
await setSystemLabel(tx, threadId, 'INBOX');
|
|
174
125
|
}
|
|
175
126
|
callbacks?.setInbox?.(args);
|
|
176
127
|
},
|
|
@@ -185,53 +136,13 @@ export const createThreadMutators = (_authData, callbacks) => ({
|
|
|
185
136
|
},
|
|
186
137
|
setSpam: async (tx, args) => {
|
|
187
138
|
for (const threadId of args.threadIds) {
|
|
188
|
-
|
|
189
|
-
if (!thread) {
|
|
190
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
191
|
-
}
|
|
192
|
-
const spamLabel = await tx.query.accountLabel
|
|
193
|
-
.where('accountId', thread.accountId)
|
|
194
|
-
.where('specialUse', 'SPAM')
|
|
195
|
-
.one()
|
|
196
|
-
.run();
|
|
197
|
-
if (!spamLabel) {
|
|
198
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
199
|
-
}
|
|
200
|
-
const existing = await tx.query.threadLabel.where('threadId', threadId).where('labelId', spamLabel.id).one().run();
|
|
201
|
-
if (!existing) {
|
|
202
|
-
await tx.mutate.threadLabel.insert({
|
|
203
|
-
labelId: spamLabel.id,
|
|
204
|
-
threadId,
|
|
205
|
-
});
|
|
206
|
-
}
|
|
139
|
+
await setSystemLabel(tx, threadId, 'SPAM');
|
|
207
140
|
}
|
|
208
141
|
callbacks?.setSpam?.(args);
|
|
209
142
|
},
|
|
210
143
|
setTrash: async (tx, args) => {
|
|
211
144
|
for (const threadId of args.threadIds) {
|
|
212
|
-
|
|
213
|
-
if (!thread) {
|
|
214
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
215
|
-
}
|
|
216
|
-
const trashLabel = await tx.query.accountLabel
|
|
217
|
-
.where('accountId', thread.accountId)
|
|
218
|
-
.where('specialUse', 'TRASH')
|
|
219
|
-
.one()
|
|
220
|
-
.run();
|
|
221
|
-
if (!trashLabel) {
|
|
222
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
223
|
-
}
|
|
224
|
-
const existing = await tx.query.threadLabel
|
|
225
|
-
.where('threadId', threadId)
|
|
226
|
-
.where('labelId', trashLabel.id)
|
|
227
|
-
.one()
|
|
228
|
-
.run();
|
|
229
|
-
if (!existing) {
|
|
230
|
-
await tx.mutate.threadLabel.insert({
|
|
231
|
-
labelId: trashLabel.id,
|
|
232
|
-
threadId,
|
|
233
|
-
});
|
|
234
|
-
}
|
|
145
|
+
await setSystemLabel(tx, threadId, 'TRASH');
|
|
235
146
|
}
|
|
236
147
|
callbacks?.setTrash?.(args);
|
|
237
148
|
},
|
|
@@ -158,8 +158,8 @@ describe('threadMutators', () => {
|
|
|
158
158
|
};
|
|
159
159
|
const mutators = createMutators();
|
|
160
160
|
await mutators.thread.requestAttachmentDownload(transaction, {
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
attachmentIds: ['test-attachment-id-1'],
|
|
162
|
+
threadIds: ['test-thread-id-1'],
|
|
163
163
|
});
|
|
164
164
|
expect(attachmentUpdate).toHaveBeenCalledWith({
|
|
165
165
|
id: 'test-attachment-id-1',
|
|
@@ -169,17 +169,10 @@ describe('threadMutators', () => {
|
|
|
169
169
|
});
|
|
170
170
|
describe('setArchive', () => {
|
|
171
171
|
it('archives thread', async () => {
|
|
172
|
-
let labelQueryCount = 0;
|
|
173
|
-
let threadLabelQueryCount = 0;
|
|
174
172
|
const threadRecord = {
|
|
175
173
|
accountId: 'test-account-id-1',
|
|
176
174
|
id: 'test-thread-id-1',
|
|
177
175
|
};
|
|
178
|
-
const inboxLabel = {
|
|
179
|
-
accountId: 'test-account-id-1',
|
|
180
|
-
id: 'test-inbox-label-id',
|
|
181
|
-
specialUse: 'INBOX',
|
|
182
|
-
};
|
|
183
176
|
const archiveLabel = {
|
|
184
177
|
accountId: 'test-account-id-1',
|
|
185
178
|
id: 'test-archive-label-id',
|
|
@@ -188,22 +181,12 @@ describe('threadMutators', () => {
|
|
|
188
181
|
const runThread = mock(async () => threadRecord);
|
|
189
182
|
const oneThread = mock(() => ({ run: runThread }));
|
|
190
183
|
const whereThread = mock(() => ({ one: oneThread }));
|
|
191
|
-
const runLabel = mock(async () =>
|
|
192
|
-
const result = labelQueryCount === 0 ? inboxLabel : archiveLabel;
|
|
193
|
-
labelQueryCount++;
|
|
194
|
-
return result;
|
|
195
|
-
});
|
|
184
|
+
const runLabel = mock(async () => archiveLabel);
|
|
196
185
|
const oneLabel = mock(() => ({ run: runLabel }));
|
|
197
186
|
const whereSpecialUse = mock(() => ({ one: oneLabel }));
|
|
198
187
|
const whereLabelAccount = mock(() => ({ where: whereSpecialUse }));
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
threadLabelQueryCount++;
|
|
202
|
-
return result;
|
|
203
|
-
});
|
|
204
|
-
const oneExisting = mock(() => ({ run: runExisting }));
|
|
205
|
-
const whereLabel = mock(() => ({ one: oneExisting }));
|
|
206
|
-
const whereThreadLabel = mock(() => ({ where: whereLabel }));
|
|
188
|
+
const runAllThreadLabels = mock(async () => [{ labelId: 'test-inbox-label-id', threadId: 'test-thread-id-1' }]);
|
|
189
|
+
const whereThreadLabel = mock(() => ({ run: runAllThreadLabels }));
|
|
207
190
|
const threadLabelDelete = mock(async () => { });
|
|
208
191
|
const threadLabelInsert = mock(async () => { });
|
|
209
192
|
const transaction = {
|
|
@@ -253,7 +236,7 @@ describe('threadMutators', () => {
|
|
|
253
236
|
const mutators = createMutators();
|
|
254
237
|
await mutators.thread.setFlagged(transaction, {
|
|
255
238
|
flagged: true,
|
|
256
|
-
|
|
239
|
+
threadIds: ['test-thread-id-1'],
|
|
257
240
|
});
|
|
258
241
|
expect(threadUpdate).toHaveBeenCalledWith({
|
|
259
242
|
flagged: true,
|
|
@@ -263,8 +246,6 @@ describe('threadMutators', () => {
|
|
|
263
246
|
});
|
|
264
247
|
describe('setInbox', () => {
|
|
265
248
|
it('moves thread to inbox', async () => {
|
|
266
|
-
let labelQueryCount = 0;
|
|
267
|
-
let threadLabelQueryCount = 0;
|
|
268
249
|
const threadRecord = {
|
|
269
250
|
accountId: 'test-account-id-1',
|
|
270
251
|
id: 'test-thread-id-1',
|
|
@@ -274,30 +255,15 @@ describe('threadMutators', () => {
|
|
|
274
255
|
id: 'test-inbox-label-id',
|
|
275
256
|
specialUse: 'INBOX',
|
|
276
257
|
};
|
|
277
|
-
const archiveLabel = {
|
|
278
|
-
accountId: 'test-account-id-1',
|
|
279
|
-
id: 'test-archive-label-id',
|
|
280
|
-
specialUse: 'ARCHIVE',
|
|
281
|
-
};
|
|
282
258
|
const runThread = mock(async () => threadRecord);
|
|
283
259
|
const oneThread = mock(() => ({ run: runThread }));
|
|
284
260
|
const whereThread = mock(() => ({ one: oneThread }));
|
|
285
|
-
const runLabel = mock(async () =>
|
|
286
|
-
const result = labelQueryCount === 0 ? inboxLabel : archiveLabel;
|
|
287
|
-
labelQueryCount++;
|
|
288
|
-
return result;
|
|
289
|
-
});
|
|
261
|
+
const runLabel = mock(async () => inboxLabel);
|
|
290
262
|
const oneLabel = mock(() => ({ run: runLabel }));
|
|
291
263
|
const whereSpecialUse = mock(() => ({ one: oneLabel }));
|
|
292
264
|
const whereLabelAccount = mock(() => ({ where: whereSpecialUse }));
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
threadLabelQueryCount++;
|
|
296
|
-
return result;
|
|
297
|
-
});
|
|
298
|
-
const oneExisting = mock(() => ({ run: runExisting }));
|
|
299
|
-
const whereLabel = mock(() => ({ one: oneExisting }));
|
|
300
|
-
const whereThreadLabel = mock(() => ({ where: whereLabel }));
|
|
265
|
+
const runAllThreadLabels = mock(async () => [{ labelId: 'test-archive-label-id', threadId: 'test-thread-id-1' }]);
|
|
266
|
+
const whereThreadLabel = mock(() => ({ run: runAllThreadLabels }));
|
|
301
267
|
const threadLabelDelete = mock(async () => { });
|
|
302
268
|
const threadLabelInsert = mock(async () => { });
|
|
303
269
|
const transaction = {
|
|
@@ -378,10 +344,8 @@ describe('threadMutators', () => {
|
|
|
378
344
|
const oneLabel = mock(() => ({ run: runSpam }));
|
|
379
345
|
const whereSpecialUse = mock(() => ({ one: oneLabel }));
|
|
380
346
|
const whereLabelAccount = mock(() => ({ where: whereSpecialUse }));
|
|
381
|
-
const
|
|
382
|
-
const
|
|
383
|
-
const whereLabel = mock(() => ({ one: oneExisting }));
|
|
384
|
-
const whereThreadLabel = mock(() => ({ where: whereLabel }));
|
|
347
|
+
const runAllThreadLabels = mock(async () => []);
|
|
348
|
+
const whereThreadLabel = mock(() => ({ run: runAllThreadLabels }));
|
|
385
349
|
const threadLabelInsert = mock(async () => { });
|
|
386
350
|
const transaction = {
|
|
387
351
|
mutate: {
|
|
@@ -429,10 +393,8 @@ describe('threadMutators', () => {
|
|
|
429
393
|
const oneLabel = mock(() => ({ run: runTrash }));
|
|
430
394
|
const whereSpecialUse = mock(() => ({ one: oneLabel }));
|
|
431
395
|
const whereLabelAccount = mock(() => ({ where: whereSpecialUse }));
|
|
432
|
-
const
|
|
433
|
-
const
|
|
434
|
-
const whereLabel = mock(() => ({ one: oneExisting }));
|
|
435
|
-
const whereThreadLabel = mock(() => ({ where: whereLabel }));
|
|
396
|
+
const runAllThreadLabels = mock(async () => []);
|
|
397
|
+
const whereThreadLabel = mock(() => ({ run: runAllThreadLabels }));
|
|
436
398
|
const threadLabelInsert = mock(async () => { });
|
|
437
399
|
const transaction = {
|
|
438
400
|
mutate: {
|