@marcoappio/marco-config 2.0.522 → 2.0.524
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/sdk/endpoints/index.d.ts +26 -0
- package/dist/sdk/endpoints/index.d.ts.map +1 -1
- package/dist/sdk/endpoints/private/index.d.ts +26 -0
- package/dist/sdk/endpoints/private/index.d.ts.map +1 -1
- package/dist/sdk/endpoints/private/user/index.d.ts +26 -0
- package/dist/sdk/endpoints/private/user/index.d.ts.map +1 -1
- package/dist/sdk/endpoints/private/user/index.js +2 -0
- package/dist/sdk/endpoints/private/user/uploadProfilePicture.d.ts +28 -0
- package/dist/sdk/endpoints/private/user/uploadProfilePicture.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/user/uploadProfilePicture.js +19 -0
- package/dist/sdk/index.d.ts +44 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/validation/errors.d.ts +36 -0
- package/dist/sdk/validation/errors.d.ts.map +1 -1
- package/dist/sdk/validation/errors.js +15 -0
- package/dist/sdk/validation/index.d.ts +18 -0
- package/dist/sdk/validation/index.d.ts.map +1 -1
- package/dist/types/SDKError.d.ts +1 -1
- package/dist/types/SDKError.d.ts.map +1 -1
- package/dist/types/Zero.d.ts +1 -2
- package/dist/types/Zero.d.ts.map +1 -1
- package/dist/types/Zero.js +0 -1
- package/dist/zero/mutators.d.ts.map +1 -1
- package/dist/zero/mutators.js +171 -183
- package/dist/zero/mutators.test.js +17 -11
- package/package.json +1 -1
|
@@ -62,6 +62,32 @@ export declare const endpoints: {
|
|
|
62
62
|
}, undefined>, import("valibot").ObjectSchema<{
|
|
63
63
|
readonly status: import("valibot").LiteralSchema<204, undefined>;
|
|
64
64
|
}, undefined>], undefined>>;
|
|
65
|
+
uploadProfilePicture: EndpointConfig<"/v1/pv/user/profile-picture", import("valibot").BlobSchema<undefined>, GenericSchema | undefined, import("valibot").UnionSchema<[import("valibot").ObjectSchema<{
|
|
66
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
67
|
+
readonly code: import("valibot").LiteralSchema<"AUTHENTICATION_FAILED", undefined>;
|
|
68
|
+
}, undefined>;
|
|
69
|
+
readonly status: import("valibot").LiteralSchema<401, undefined>;
|
|
70
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
71
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
72
|
+
readonly code: import("valibot").LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
73
|
+
}, undefined>;
|
|
74
|
+
readonly status: import("valibot").LiteralSchema<413, undefined>;
|
|
75
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
76
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
77
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
78
|
+
}, undefined>;
|
|
79
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
80
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
81
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
82
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
83
|
+
}, undefined>;
|
|
84
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
85
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
86
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
87
|
+
readonly profilePicture: import("valibot").StringSchema<undefined>;
|
|
88
|
+
}, undefined>;
|
|
89
|
+
readonly status: import("valibot").LiteralSchema<200, undefined>;
|
|
90
|
+
}, undefined>], undefined>>;
|
|
65
91
|
};
|
|
66
92
|
};
|
|
67
93
|
public: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,qBAAqB,CAAA;AAWtE,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,qBAAqB,CAAA;AAWtE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGM,CAAA"}
|
|
@@ -59,6 +59,32 @@ export declare const privateGroup: {
|
|
|
59
59
|
}, undefined>, import("valibot").ObjectSchema<{
|
|
60
60
|
readonly status: import("valibot").LiteralSchema<204, undefined>;
|
|
61
61
|
}, undefined>], undefined>>;
|
|
62
|
+
uploadProfilePicture: import("../../..").EndpointConfig<"/v1/pv/user/profile-picture", import("valibot").BlobSchema<undefined>, import("valibot").GenericSchema | undefined, import("valibot").UnionSchema<[import("valibot").ObjectSchema<{
|
|
63
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
64
|
+
readonly code: import("valibot").LiteralSchema<"AUTHENTICATION_FAILED", undefined>;
|
|
65
|
+
}, undefined>;
|
|
66
|
+
readonly status: import("valibot").LiteralSchema<401, undefined>;
|
|
67
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
68
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
69
|
+
readonly code: import("valibot").LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
70
|
+
}, undefined>;
|
|
71
|
+
readonly status: import("valibot").LiteralSchema<413, undefined>;
|
|
72
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
73
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
74
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
75
|
+
}, undefined>;
|
|
76
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
77
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
78
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
79
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
80
|
+
}, undefined>;
|
|
81
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
82
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
83
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
84
|
+
readonly profilePicture: import("valibot").StringSchema<undefined>;
|
|
85
|
+
}, undefined>;
|
|
86
|
+
readonly status: import("valibot").LiteralSchema<200, undefined>;
|
|
87
|
+
}, undefined>], undefined>>;
|
|
62
88
|
};
|
|
63
89
|
};
|
|
64
90
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sdk/endpoints/private/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sdk/endpoints/private/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIxB,CAAA"}
|
|
@@ -7,5 +7,31 @@ export declare const user: {
|
|
|
7
7
|
}, undefined>, import("valibot").ObjectSchema<{
|
|
8
8
|
readonly status: import("valibot").LiteralSchema<204, undefined>;
|
|
9
9
|
}, undefined>], undefined>>;
|
|
10
|
+
uploadProfilePicture: import("../../../..").EndpointConfig<"/v1/pv/user/profile-picture", import("valibot").BlobSchema<undefined>, import("valibot").GenericSchema | undefined, import("valibot").UnionSchema<[import("valibot").ObjectSchema<{
|
|
11
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
12
|
+
readonly code: import("valibot").LiteralSchema<"AUTHENTICATION_FAILED", undefined>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
readonly status: import("valibot").LiteralSchema<401, undefined>;
|
|
15
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
16
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
17
|
+
readonly code: import("valibot").LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
18
|
+
}, undefined>;
|
|
19
|
+
readonly status: import("valibot").LiteralSchema<413, undefined>;
|
|
20
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
21
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
22
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
23
|
+
}, undefined>;
|
|
24
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
25
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
26
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
27
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
28
|
+
}, undefined>;
|
|
29
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
30
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
31
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
32
|
+
readonly profilePicture: import("valibot").StringSchema<undefined>;
|
|
33
|
+
}, undefined>;
|
|
34
|
+
readonly status: import("valibot").LiteralSchema<200, undefined>;
|
|
35
|
+
}, undefined>], undefined>>;
|
|
10
36
|
};
|
|
11
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/endpoints/private/user/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/endpoints/private/user/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGhB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const uploadProfilePicture: import("../../../..").EndpointConfig<"/v1/pv/user/profile-picture", v.BlobSchema<undefined>, v.GenericSchema | undefined, v.UnionSchema<[v.ObjectSchema<{
|
|
3
|
+
readonly data: v.ObjectSchema<{
|
|
4
|
+
readonly code: v.LiteralSchema<"AUTHENTICATION_FAILED", undefined>;
|
|
5
|
+
}, undefined>;
|
|
6
|
+
readonly status: v.LiteralSchema<401, undefined>;
|
|
7
|
+
}, undefined>, v.ObjectSchema<{
|
|
8
|
+
readonly data: v.ObjectSchema<{
|
|
9
|
+
readonly code: v.LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
10
|
+
}, undefined>;
|
|
11
|
+
readonly status: v.LiteralSchema<413, undefined>;
|
|
12
|
+
}, undefined>, v.ObjectSchema<{
|
|
13
|
+
readonly data: v.ObjectSchema<{
|
|
14
|
+
readonly code: v.LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
15
|
+
}, undefined>;
|
|
16
|
+
readonly status: v.LiteralSchema<415, undefined>;
|
|
17
|
+
}, undefined>, v.ObjectSchema<{
|
|
18
|
+
readonly data: v.ObjectSchema<{
|
|
19
|
+
readonly code: v.LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
20
|
+
}, undefined>;
|
|
21
|
+
readonly status: v.LiteralSchema<415, undefined>;
|
|
22
|
+
}, undefined>, v.ObjectSchema<{
|
|
23
|
+
readonly data: v.ObjectSchema<{
|
|
24
|
+
readonly profilePicture: v.StringSchema<undefined>;
|
|
25
|
+
}, undefined>;
|
|
26
|
+
readonly status: v.LiteralSchema<200, undefined>;
|
|
27
|
+
}, undefined>], undefined>>;
|
|
28
|
+
//# sourceMappingURL=uploadProfilePicture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadProfilePicture.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/endpoints/private/user/uploadProfilePicture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAU5B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;2BAe/B,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { createEndpoint } from '../../../../sdk/endpoints/createEndpointConfig';
|
|
3
|
+
import { authFailedErrorSchema, fileTooLargeErrorSchema, invalidFileTypeErrorSchema, invalidImageDimensionsErrorSchema, } from '../../../../sdk/validation/errors';
|
|
4
|
+
export const uploadProfilePicture = createEndpoint({
|
|
5
|
+
body: v.blob(),
|
|
6
|
+
bodyType: 'blob',
|
|
7
|
+
method: 'POST',
|
|
8
|
+
path: '/v1/pv/user/profile-picture',
|
|
9
|
+
response: v.union([
|
|
10
|
+
authFailedErrorSchema,
|
|
11
|
+
fileTooLargeErrorSchema,
|
|
12
|
+
invalidFileTypeErrorSchema,
|
|
13
|
+
invalidImageDimensionsErrorSchema,
|
|
14
|
+
v.object({
|
|
15
|
+
data: v.object({ profilePicture: v.string() }),
|
|
16
|
+
status: v.literal(200),
|
|
17
|
+
}),
|
|
18
|
+
]),
|
|
19
|
+
});
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -61,6 +61,32 @@ export declare const marcoSDK: {
|
|
|
61
61
|
}, undefined>, import("valibot").ObjectSchema<{
|
|
62
62
|
readonly status: import("valibot").LiteralSchema<204, undefined>;
|
|
63
63
|
}, undefined>], undefined>>;
|
|
64
|
+
uploadProfilePicture: import("..").EndpointConfig<"/v1/pv/user/profile-picture", import("valibot").BlobSchema<undefined>, import("valibot").GenericSchema | undefined, import("valibot").UnionSchema<[import("valibot").ObjectSchema<{
|
|
65
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
66
|
+
readonly code: import("valibot").LiteralSchema<"AUTHENTICATION_FAILED", undefined>;
|
|
67
|
+
}, undefined>;
|
|
68
|
+
readonly status: import("valibot").LiteralSchema<401, undefined>;
|
|
69
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
70
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
71
|
+
readonly code: import("valibot").LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
72
|
+
}, undefined>;
|
|
73
|
+
readonly status: import("valibot").LiteralSchema<413, undefined>;
|
|
74
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
75
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
76
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
77
|
+
}, undefined>;
|
|
78
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
79
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
80
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
81
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
82
|
+
}, undefined>;
|
|
83
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
84
|
+
}, undefined>, import("valibot").ObjectSchema<{
|
|
85
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
86
|
+
readonly profilePicture: import("valibot").StringSchema<undefined>;
|
|
87
|
+
}, undefined>;
|
|
88
|
+
readonly status: import("valibot").LiteralSchema<200, undefined>;
|
|
89
|
+
}, undefined>], undefined>>;
|
|
64
90
|
};
|
|
65
91
|
};
|
|
66
92
|
public: {
|
|
@@ -274,6 +300,24 @@ export declare const marcoSDK: {
|
|
|
274
300
|
}, undefined>;
|
|
275
301
|
readonly status: import("valibot").LiteralSchema<401, undefined>;
|
|
276
302
|
}, undefined>;
|
|
303
|
+
readonly fileTooLargeErrorSchema: import("valibot").ObjectSchema<{
|
|
304
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
305
|
+
readonly code: import("valibot").LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
306
|
+
}, undefined>;
|
|
307
|
+
readonly status: import("valibot").LiteralSchema<413, undefined>;
|
|
308
|
+
}, undefined>;
|
|
309
|
+
readonly invalidFileTypeErrorSchema: import("valibot").ObjectSchema<{
|
|
310
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
311
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
312
|
+
}, undefined>;
|
|
313
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
314
|
+
}, undefined>;
|
|
315
|
+
readonly invalidImageDimensionsErrorSchema: import("valibot").ObjectSchema<{
|
|
316
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
317
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
318
|
+
}, undefined>;
|
|
319
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
320
|
+
}, undefined>;
|
|
277
321
|
readonly inviteNotFoundErrorSchema: import("valibot").ObjectSchema<{
|
|
278
322
|
readonly data: import("valibot").ObjectSchema<{
|
|
279
323
|
readonly code: import("valibot").LiteralSchema<"INVITE_NOT_FOUND", undefined>;
|
package/dist/sdk/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGpB,CAAA"}
|
|
@@ -100,6 +100,24 @@ export declare const validationFailedErrorSchema: v.ObjectSchema<{
|
|
|
100
100
|
}, undefined>;
|
|
101
101
|
readonly status: v.LiteralSchema<400, undefined>;
|
|
102
102
|
}, undefined>;
|
|
103
|
+
export declare const fileTooLargeErrorSchema: v.ObjectSchema<{
|
|
104
|
+
readonly data: v.ObjectSchema<{
|
|
105
|
+
readonly code: v.LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
106
|
+
}, undefined>;
|
|
107
|
+
readonly status: v.LiteralSchema<413, undefined>;
|
|
108
|
+
}, undefined>;
|
|
109
|
+
export declare const invalidFileTypeErrorSchema: v.ObjectSchema<{
|
|
110
|
+
readonly data: v.ObjectSchema<{
|
|
111
|
+
readonly code: v.LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
112
|
+
}, undefined>;
|
|
113
|
+
readonly status: v.LiteralSchema<415, undefined>;
|
|
114
|
+
}, undefined>;
|
|
115
|
+
export declare const invalidImageDimensionsErrorSchema: v.ObjectSchema<{
|
|
116
|
+
readonly data: v.ObjectSchema<{
|
|
117
|
+
readonly code: v.LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
118
|
+
}, undefined>;
|
|
119
|
+
readonly status: v.LiteralSchema<415, undefined>;
|
|
120
|
+
}, undefined>;
|
|
103
121
|
export declare const errors: {
|
|
104
122
|
readonly accountNotFoundErrorSchema: v.ObjectSchema<{
|
|
105
123
|
readonly data: v.ObjectSchema<{
|
|
@@ -161,6 +179,24 @@ export declare const errors: {
|
|
|
161
179
|
}, undefined>;
|
|
162
180
|
readonly status: v.LiteralSchema<401, undefined>;
|
|
163
181
|
}, undefined>;
|
|
182
|
+
readonly fileTooLargeErrorSchema: v.ObjectSchema<{
|
|
183
|
+
readonly data: v.ObjectSchema<{
|
|
184
|
+
readonly code: v.LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
185
|
+
}, undefined>;
|
|
186
|
+
readonly status: v.LiteralSchema<413, undefined>;
|
|
187
|
+
}, undefined>;
|
|
188
|
+
readonly invalidFileTypeErrorSchema: v.ObjectSchema<{
|
|
189
|
+
readonly data: v.ObjectSchema<{
|
|
190
|
+
readonly code: v.LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
191
|
+
}, undefined>;
|
|
192
|
+
readonly status: v.LiteralSchema<415, undefined>;
|
|
193
|
+
}, undefined>;
|
|
194
|
+
readonly invalidImageDimensionsErrorSchema: v.ObjectSchema<{
|
|
195
|
+
readonly data: v.ObjectSchema<{
|
|
196
|
+
readonly code: v.LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
197
|
+
}, undefined>;
|
|
198
|
+
readonly status: v.LiteralSchema<415, undefined>;
|
|
199
|
+
}, undefined>;
|
|
164
200
|
readonly inviteNotFoundErrorSchema: v.ObjectSchema<{
|
|
165
201
|
readonly data: v.ObjectSchema<{
|
|
166
202
|
readonly code: v.LiteralSchema<"INVITE_NOT_FOUND", undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/sdk/validation/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,yBAAyB;;;;;aAGpC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;;;aAGzC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;aAG5C,CAAA;AAEF,eAAO,MAAM,uCAAuC;;;;;aAGlD,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;aAGhC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;aAGlC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;aAGlC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;aAG3C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;aAGxC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;aAG5C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;aAGtC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;aAUtC,CAAA;AAEF,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/sdk/validation/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,yBAAyB;;;;;aAGpC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;;;aAGzC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;aAG5C,CAAA;AAEF,eAAO,MAAM,uCAAuC;;;;;aAGlD,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;aAGhC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;aAGlC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;aAGlC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;aAG3C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;aAGxC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;aAG5C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;aAGtC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;aAUtC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;aAGlC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;aAGrC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;aAG5C,CAAA;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBT,CAAA"}
|
|
@@ -70,6 +70,18 @@ export const validationFailedErrorSchema = v.object({
|
|
|
70
70
|
}),
|
|
71
71
|
status: v.literal(400),
|
|
72
72
|
});
|
|
73
|
+
export const fileTooLargeErrorSchema = v.object({
|
|
74
|
+
data: v.object({ code: v.literal('FILE_TOO_LARGE') }),
|
|
75
|
+
status: v.literal(413),
|
|
76
|
+
});
|
|
77
|
+
export const invalidFileTypeErrorSchema = v.object({
|
|
78
|
+
data: v.object({ code: v.literal('INVALID_FILE_TYPE') }),
|
|
79
|
+
status: v.literal(415),
|
|
80
|
+
});
|
|
81
|
+
export const invalidImageDimensionsErrorSchema = v.object({
|
|
82
|
+
data: v.object({ code: v.literal('INVALID_IMAGE_DIMENSIONS') }),
|
|
83
|
+
status: v.literal(415),
|
|
84
|
+
});
|
|
73
85
|
export const errors = {
|
|
74
86
|
accountNotFoundErrorSchema,
|
|
75
87
|
attachmentNotFoundErrorSchema,
|
|
@@ -81,6 +93,9 @@ export const errors = {
|
|
|
81
93
|
authRefreshTokenInvalid,
|
|
82
94
|
authServerResponseUnexpectedErrorSchema,
|
|
83
95
|
authTooManyAttemptsErrorSchema,
|
|
96
|
+
fileTooLargeErrorSchema,
|
|
97
|
+
invalidFileTypeErrorSchema,
|
|
98
|
+
invalidImageDimensionsErrorSchema,
|
|
84
99
|
inviteNotFoundErrorSchema,
|
|
85
100
|
messageNotFoundErrorSchema,
|
|
86
101
|
mutationRejectedErrorSchema,
|
|
@@ -60,6 +60,24 @@ export declare const validation: {
|
|
|
60
60
|
}, undefined>;
|
|
61
61
|
readonly status: import("valibot").LiteralSchema<401, undefined>;
|
|
62
62
|
}, undefined>;
|
|
63
|
+
readonly fileTooLargeErrorSchema: import("valibot").ObjectSchema<{
|
|
64
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
65
|
+
readonly code: import("valibot").LiteralSchema<"FILE_TOO_LARGE", undefined>;
|
|
66
|
+
}, undefined>;
|
|
67
|
+
readonly status: import("valibot").LiteralSchema<413, undefined>;
|
|
68
|
+
}, undefined>;
|
|
69
|
+
readonly invalidFileTypeErrorSchema: import("valibot").ObjectSchema<{
|
|
70
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
71
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_FILE_TYPE", undefined>;
|
|
72
|
+
}, undefined>;
|
|
73
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
74
|
+
}, undefined>;
|
|
75
|
+
readonly invalidImageDimensionsErrorSchema: import("valibot").ObjectSchema<{
|
|
76
|
+
readonly data: import("valibot").ObjectSchema<{
|
|
77
|
+
readonly code: import("valibot").LiteralSchema<"INVALID_IMAGE_DIMENSIONS", undefined>;
|
|
78
|
+
}, undefined>;
|
|
79
|
+
readonly status: import("valibot").LiteralSchema<415, undefined>;
|
|
80
|
+
}, undefined>;
|
|
63
81
|
readonly inviteNotFoundErrorSchema: import("valibot").ObjectSchema<{
|
|
64
82
|
readonly data: import("valibot").ObjectSchema<{
|
|
65
83
|
readonly code: import("valibot").LiteralSchema<"INVITE_NOT_FOUND", undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/validation/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/validation/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAoB,CAAA"}
|
package/dist/types/SDKError.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type * as v from 'valibot';
|
|
2
2
|
import type { errors } from '../sdk/validation/errors';
|
|
3
|
-
export type SDKError = v.InferOutput<typeof errors.authCodeExpiredErrorSchema> | v.InferOutput<typeof errors.authCodePreviouslyUsedErrorSchema> | v.InferOutput<typeof errors.authRefreshTokenInvalid> | v.InferOutput<typeof errors.authServerResponseUnexpectedErrorSchema> | v.InferOutput<typeof errors.authTooManyAttemptsErrorSchema> | v.InferOutput<typeof errors.authCodeInvalidErrorSchema> | v.InferOutput<typeof errors.authFailedErrorSchema> | v.InferOutput<typeof errors.messageNotFoundErrorSchema> | v.InferOutput<typeof errors.accountNotFoundErrorSchema> | v.InferOutput<typeof errors.userNotFoundErrorSchema> | v.InferOutput<typeof errors.validationFailedErrorSchema> | v.InferOutput<typeof errors.inviteNotFoundErrorSchema> | v.InferOutput<typeof errors.userMarkedForDeletionErrorSchema> | v.InferOutput<typeof errors.mutationRejectedErrorSchema> | v.InferOutput<typeof errors.attachmentNotFoundErrorSchema> | v.InferOutput<typeof errors.attachmentStateInvalidErrorSchema>;
|
|
3
|
+
export type SDKError = v.InferOutput<typeof errors.authCodeExpiredErrorSchema> | v.InferOutput<typeof errors.authCodePreviouslyUsedErrorSchema> | v.InferOutput<typeof errors.authRefreshTokenInvalid> | v.InferOutput<typeof errors.authServerResponseUnexpectedErrorSchema> | v.InferOutput<typeof errors.authTooManyAttemptsErrorSchema> | v.InferOutput<typeof errors.authCodeInvalidErrorSchema> | v.InferOutput<typeof errors.authFailedErrorSchema> | v.InferOutput<typeof errors.messageNotFoundErrorSchema> | v.InferOutput<typeof errors.accountNotFoundErrorSchema> | v.InferOutput<typeof errors.userNotFoundErrorSchema> | v.InferOutput<typeof errors.validationFailedErrorSchema> | v.InferOutput<typeof errors.inviteNotFoundErrorSchema> | v.InferOutput<typeof errors.userMarkedForDeletionErrorSchema> | v.InferOutput<typeof errors.mutationRejectedErrorSchema> | v.InferOutput<typeof errors.attachmentNotFoundErrorSchema> | v.InferOutput<typeof errors.attachmentStateInvalidErrorSchema> | v.InferOutput<typeof errors.fileTooLargeErrorSchema> | v.InferOutput<typeof errors.invalidFileTypeErrorSchema> | v.InferOutput<typeof errors.invalidImageDimensionsErrorSchema>;
|
|
4
4
|
//# sourceMappingURL=SDKError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SDKError.d.ts","sourceRoot":"","sources":["../../src/types/SDKError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAA;AAEjE,MAAM,MAAM,QAAQ,GAChB,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,iCAAiC,CAAC,GAC9D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,uBAAuB,CAAC,GACpD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,uCAAuC,CAAC,GACpE,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,8BAA8B,CAAC,GAC3D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,qBAAqB,CAAC,GAClD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,uBAAuB,CAAC,GACpD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,2BAA2B,CAAC,GACxD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,yBAAyB,CAAC,GACtD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,gCAAgC,CAAC,GAC7D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,2BAA2B,CAAC,GACxD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,6BAA6B,CAAC,GAC1D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,iCAAiC,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"SDKError.d.ts","sourceRoot":"","sources":["../../src/types/SDKError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAA;AAEjE,MAAM,MAAM,QAAQ,GAChB,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,iCAAiC,CAAC,GAC9D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,uBAAuB,CAAC,GACpD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,uCAAuC,CAAC,GACpE,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,8BAA8B,CAAC,GAC3D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,qBAAqB,CAAC,GAClD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,uBAAuB,CAAC,GACpD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,2BAA2B,CAAC,GACxD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,yBAAyB,CAAC,GACtD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,gCAAgC,CAAC,GAC7D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,2BAA2B,CAAC,GACxD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,6BAA6B,CAAC,GAC1D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,iCAAiC,CAAC,GAC9D,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,uBAAuB,CAAC,GACpD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,0BAA0B,CAAC,GACvD,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,iCAAiC,CAAC,CAAA"}
|
package/dist/types/Zero.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { schema, tables } from '../zero/schema';
|
|
2
2
|
export declare enum MutationError {
|
|
3
3
|
AUTHENTICATION_REQUIRED = "MutationError/AUTHENTICATION_REQUIRED",
|
|
4
|
-
ALREADY_APPLIED = "MutationError/ALREADY_APPLIED"
|
|
5
|
-
ENTITY_NOT_FOUND = "MutationError/ENTITY_NOT_FOUND"
|
|
4
|
+
ALREADY_APPLIED = "MutationError/ALREADY_APPLIED"
|
|
6
5
|
}
|
|
7
6
|
export type MarcoZeroSchema = typeof schema;
|
|
8
7
|
export type MarcoZeroTables = typeof tables;
|
package/dist/types/Zero.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Zero.d.ts","sourceRoot":"","sources":["../../src/types/Zero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAE/D,oBAAY,aAAa;IACvB,uBAAuB,0CAA0C;IACjE,eAAe,kCAAkC;
|
|
1
|
+
{"version":3,"file":"Zero.d.ts","sourceRoot":"","sources":["../../src/types/Zero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAE/D,oBAAY,aAAa;IACvB,uBAAuB,0CAA0C;IACjE,eAAe,kCAAkC;CAClD;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,MAAM,CAAA;AAC3C,MAAM,MAAM,eAAe,GAAG,OAAO,MAAM,CAAA;AAC3C,MAAM,MAAM,gBAAgB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjD,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,YAAY;QACpB,MAAM,EAAE,OAAO,MAAM,CAAA;QACrB,OAAO,EAAE,gBAAgB,CAAA;KAC1B;CACF"}
|
package/dist/types/Zero.js
CHANGED
|
@@ -2,5 +2,4 @@ export var MutationError;
|
|
|
2
2
|
(function (MutationError) {
|
|
3
3
|
MutationError["AUTHENTICATION_REQUIRED"] = "MutationError/AUTHENTICATION_REQUIRED";
|
|
4
4
|
MutationError["ALREADY_APPLIED"] = "MutationError/ALREADY_APPLIED";
|
|
5
|
-
MutationError["ENTITY_NOT_FOUND"] = "MutationError/ENTITY_NOT_FOUND";
|
|
6
5
|
})(MutationError || (MutationError = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutators.d.ts","sourceRoot":"","sources":["../../src/zero/mutators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutators.d.ts","sourceRoot":"","sources":["../../src/zero/mutators.ts"],"names":[],"mappings":"AAQA,KAAK,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAqGjC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6fnB,CAAA"}
|
package/dist/zero/mutators.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createBuilder, defineMutators, defineMutatorWithType } from '@rocicorp/zero';
|
|
2
|
-
import { MutationError } from '../types';
|
|
3
2
|
import { stringPatch } from '../utils';
|
|
4
3
|
import { threadsUtils } from '../utils/threads';
|
|
5
4
|
import { mutatorSchemas } from '../zero/mutatorSchemas';
|
|
@@ -9,72 +8,70 @@ const defineMutator = defineMutatorWithType();
|
|
|
9
8
|
const buildLabelIdList = (x) => (x.length === 0 ? '' : ` ${[...new Set(x)].join(' ')} `);
|
|
10
9
|
const setSystemLabel = async (tx, builder, threadId, targetSpecialUse) => {
|
|
11
10
|
const thread = await tx.run(builder.thread.where('id', threadId).one());
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
tx.run(builder.accountLabel.where('accountId', thread.accountId).where('specialUse', targetSpecialUse).one()),
|
|
17
|
-
tx.run(builder.threadMessage.where('threadId', threadId)),
|
|
18
|
-
]);
|
|
19
|
-
if (!targetLabel) {
|
|
20
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
21
|
-
}
|
|
22
|
-
const currentLabelIds = new Set(threadsUtils.parseLabelIdList(thread.labelIdList));
|
|
23
|
-
const hasTarget = currentLabelIds.has(targetLabel.id);
|
|
24
|
-
const labelIdsToRemove = new Set(currentLabelIds);
|
|
25
|
-
labelIdsToRemove.delete(targetLabel.id);
|
|
26
|
-
const threadLabelDeletes = [];
|
|
27
|
-
for (const message of messages) {
|
|
28
|
-
for (const labelId of labelIdsToRemove) {
|
|
29
|
-
threadLabelDeletes.push(tx.mutate.threadLabel.delete({
|
|
30
|
-
accountId: thread.accountId,
|
|
31
|
-
labelId,
|
|
32
|
-
threadMessageId: message.id,
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
await Promise.all([
|
|
37
|
-
...threadLabelDeletes,
|
|
38
|
-
...[...labelIdsToRemove].map(labelId => tx.mutate.threadByLabel.delete({ labelId, threadId })),
|
|
39
|
-
]);
|
|
40
|
-
if (thread.seen === false && labelIdsToRemove.size > 0) {
|
|
41
|
-
const labelsToUpdate = await tx.run(builder.accountLabel.where('id', 'IN', [...labelIdsToRemove]));
|
|
42
|
-
await Promise.all(labelsToUpdate.map(label => tx.mutate.accountLabel.update({
|
|
43
|
-
id: label.id,
|
|
44
|
-
unreadCount: Math.max(0, (label.unreadCount ?? 0) - 1),
|
|
45
|
-
})));
|
|
46
|
-
}
|
|
47
|
-
if (!hasTarget) {
|
|
48
|
-
const baseTimestamp = Date.now();
|
|
49
|
-
await Promise.all([
|
|
50
|
-
...messages.map((message, i) => tx.mutate.threadLabel.insert({
|
|
51
|
-
accountId: thread.accountId,
|
|
52
|
-
labelId: targetLabel.id,
|
|
53
|
-
lastSyncedAt: 0,
|
|
54
|
-
threadId,
|
|
55
|
-
threadMessageId: message.id,
|
|
56
|
-
uid: -(baseTimestamp + i),
|
|
57
|
-
uidValidity: targetLabel.uidValidity ?? 0,
|
|
58
|
-
})),
|
|
59
|
-
tx.mutate.threadByLabel.insert({
|
|
60
|
-
labelId: targetLabel.id,
|
|
61
|
-
latestMessageDate: thread.latestMessageDate,
|
|
62
|
-
threadId,
|
|
63
|
-
}),
|
|
64
|
-
...(thread.seen === false
|
|
65
|
-
? [
|
|
66
|
-
tx.mutate.accountLabel.update({
|
|
67
|
-
id: targetLabel.id,
|
|
68
|
-
unreadCount: (targetLabel.unreadCount ?? 0) + 1,
|
|
69
|
-
}),
|
|
70
|
-
]
|
|
71
|
-
: []),
|
|
11
|
+
if (thread) {
|
|
12
|
+
const [targetLabel, messages] = await Promise.all([
|
|
13
|
+
tx.run(builder.accountLabel.where('accountId', thread.accountId).where('specialUse', targetSpecialUse).one()),
|
|
14
|
+
tx.run(builder.threadMessage.where('threadId', threadId)),
|
|
72
15
|
]);
|
|
16
|
+
if (targetLabel) {
|
|
17
|
+
const currentLabelIds = new Set(threadsUtils.parseLabelIdList(thread.labelIdList));
|
|
18
|
+
const hasTarget = currentLabelIds.has(targetLabel.id);
|
|
19
|
+
const labelIdsToRemove = new Set(currentLabelIds);
|
|
20
|
+
labelIdsToRemove.delete(targetLabel.id);
|
|
21
|
+
const threadLabelDeletes = [];
|
|
22
|
+
for (const message of messages) {
|
|
23
|
+
for (const labelId of labelIdsToRemove) {
|
|
24
|
+
threadLabelDeletes.push(tx.mutate.threadLabel.delete({
|
|
25
|
+
accountId: thread.accountId,
|
|
26
|
+
labelId,
|
|
27
|
+
threadMessageId: message.id,
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
await Promise.all([
|
|
32
|
+
...threadLabelDeletes,
|
|
33
|
+
...[...labelIdsToRemove].map(labelId => tx.mutate.threadByLabel.delete({ labelId, threadId })),
|
|
34
|
+
]);
|
|
35
|
+
if (thread.seen === false && labelIdsToRemove.size > 0) {
|
|
36
|
+
const labelsToUpdate = await tx.run(builder.accountLabel.where('id', 'IN', [...labelIdsToRemove]));
|
|
37
|
+
await Promise.all(labelsToUpdate.map(label => tx.mutate.accountLabel.update({
|
|
38
|
+
id: label.id,
|
|
39
|
+
unreadCount: Math.max(0, (label.unreadCount ?? 0) - 1),
|
|
40
|
+
})));
|
|
41
|
+
}
|
|
42
|
+
if (!hasTarget) {
|
|
43
|
+
const baseTimestamp = Date.now();
|
|
44
|
+
await Promise.all([
|
|
45
|
+
...messages.map((message, i) => tx.mutate.threadLabel.insert({
|
|
46
|
+
accountId: thread.accountId,
|
|
47
|
+
labelId: targetLabel.id,
|
|
48
|
+
lastSyncedAt: 0,
|
|
49
|
+
threadId,
|
|
50
|
+
threadMessageId: message.id,
|
|
51
|
+
uid: -(baseTimestamp + i),
|
|
52
|
+
uidValidity: targetLabel.uidValidity ?? 0,
|
|
53
|
+
})),
|
|
54
|
+
tx.mutate.threadByLabel.insert({
|
|
55
|
+
labelId: targetLabel.id,
|
|
56
|
+
latestMessageDate: thread.latestMessageDate,
|
|
57
|
+
threadId,
|
|
58
|
+
}),
|
|
59
|
+
...(thread.seen === false
|
|
60
|
+
? [
|
|
61
|
+
tx.mutate.accountLabel.update({
|
|
62
|
+
id: targetLabel.id,
|
|
63
|
+
unreadCount: (targetLabel.unreadCount ?? 0) + 1,
|
|
64
|
+
}),
|
|
65
|
+
]
|
|
66
|
+
: []),
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
await tx.mutate.thread.update({
|
|
70
|
+
id: threadId,
|
|
71
|
+
labelIdList: buildLabelIdList([targetLabel.id]),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
73
74
|
}
|
|
74
|
-
await tx.mutate.thread.update({
|
|
75
|
-
id: threadId,
|
|
76
|
-
labelIdList: buildLabelIdList([targetLabel.id]),
|
|
77
|
-
});
|
|
78
75
|
};
|
|
79
76
|
export const mutators = defineMutators({
|
|
80
77
|
account: {
|
|
@@ -179,18 +176,16 @@ export const mutators = defineMutators({
|
|
|
179
176
|
draft: {
|
|
180
177
|
cancelSend: defineMutator(mutatorSchemas.draft.cancelSend, async ({ tx, args }) => {
|
|
181
178
|
const draft = await tx.run(zql.draft.where('id', args.id).one());
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
if (draft) {
|
|
180
|
+
if (draft.status !== 'SEND_CONFIRMED') {
|
|
181
|
+
await tx.mutate.draft.update({
|
|
182
|
+
id: args.id,
|
|
183
|
+
scheduledFor: null,
|
|
184
|
+
status: 'DRAFT',
|
|
185
|
+
updatedAt: args.updatedAt,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
187
188
|
}
|
|
188
|
-
await tx.mutate.draft.update({
|
|
189
|
-
id: args.id,
|
|
190
|
-
scheduledFor: null,
|
|
191
|
-
status: 'DRAFT',
|
|
192
|
-
updatedAt: args.updatedAt,
|
|
193
|
-
});
|
|
194
189
|
}),
|
|
195
190
|
createAttachment: defineMutator(mutatorSchemas.draft.createAttachment, async ({ tx, args }) => {
|
|
196
191
|
await tx.mutate.draftAttachment.insert({
|
|
@@ -273,34 +268,32 @@ export const mutators = defineMutators({
|
|
|
273
268
|
}),
|
|
274
269
|
setContent: defineMutator(mutatorSchemas.draft.setContent, async ({ tx, args }) => {
|
|
275
270
|
const draft = await tx.run(zql.draft.where('id', args.id).one());
|
|
276
|
-
if (
|
|
277
|
-
|
|
271
|
+
if (draft) {
|
|
272
|
+
await tx.mutate.draft.update({
|
|
273
|
+
body: {
|
|
274
|
+
...draft.body,
|
|
275
|
+
content: stringPatch.apply(typeof draft.body?.content === 'string' ? draft.body.content : '', args.patch),
|
|
276
|
+
},
|
|
277
|
+
id: args.id,
|
|
278
|
+
updatedAt: args.updatedAt,
|
|
279
|
+
});
|
|
278
280
|
}
|
|
279
|
-
await tx.mutate.draft.update({
|
|
280
|
-
body: {
|
|
281
|
-
...draft.body,
|
|
282
|
-
content: stringPatch.apply(typeof draft.body?.content === 'string' ? draft.body.content : '', args.patch),
|
|
283
|
-
},
|
|
284
|
-
id: args.id,
|
|
285
|
-
updatedAt: args.updatedAt,
|
|
286
|
-
});
|
|
287
281
|
}),
|
|
288
282
|
setEnvelope: defineMutator(mutatorSchemas.draft.setEnvelope, async ({ tx, args }) => {
|
|
289
283
|
const draft = await tx.run(zql.draft.where('id', args.id).one());
|
|
290
|
-
if (
|
|
291
|
-
|
|
284
|
+
if (draft) {
|
|
285
|
+
await tx.mutate.draft.update({
|
|
286
|
+
body: {
|
|
287
|
+
bcc: args.envelope.bcc,
|
|
288
|
+
cc: args.envelope.cc,
|
|
289
|
+
content: draft.body.content,
|
|
290
|
+
to: args.envelope.to,
|
|
291
|
+
},
|
|
292
|
+
id: args.id,
|
|
293
|
+
subject: args.envelope.subject,
|
|
294
|
+
updatedAt: args.updatedAt,
|
|
295
|
+
});
|
|
292
296
|
}
|
|
293
|
-
await tx.mutate.draft.update({
|
|
294
|
-
body: {
|
|
295
|
-
bcc: args.envelope.bcc,
|
|
296
|
-
cc: args.envelope.cc,
|
|
297
|
-
content: draft.body.content,
|
|
298
|
-
to: args.envelope.to,
|
|
299
|
-
},
|
|
300
|
-
id: args.id,
|
|
301
|
-
subject: args.envelope.subject,
|
|
302
|
-
updatedAt: args.updatedAt,
|
|
303
|
-
});
|
|
304
297
|
}),
|
|
305
298
|
setFrom: defineMutator(mutatorSchemas.draft.setFrom, async ({ tx, args }) => {
|
|
306
299
|
await tx.mutate.draft.update({
|
|
@@ -317,54 +310,52 @@ export const mutators = defineMutators({
|
|
|
317
310
|
addLabel: defineMutator(mutatorSchemas.thread.addLabel, async ({ tx, args }) => {
|
|
318
311
|
for (const [accountId, { threadIds }] of Object.entries(args.accounts)) {
|
|
319
312
|
const label = await tx.run(zql.accountLabel.where('accountId', accountId).where('path', args.labelPath).one());
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
tx.run(zql.thread.where('id', threadId).one()),
|
|
326
|
-
tx.run(zql.threadMessage.where('threadId', threadId)),
|
|
327
|
-
]);
|
|
328
|
-
if (!thread) {
|
|
329
|
-
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
330
|
-
}
|
|
331
|
-
const currentLabelIds = new Set(threadsUtils.parseLabelIdList(thread.labelIdList));
|
|
332
|
-
if (!currentLabelIds.has(label.id)) {
|
|
333
|
-
await Promise.all([
|
|
334
|
-
tx.mutate.threadByLabel.insert({
|
|
335
|
-
labelId: label.id,
|
|
336
|
-
latestMessageDate: thread.latestMessageDate,
|
|
337
|
-
threadId,
|
|
338
|
-
}),
|
|
339
|
-
...(thread.seen === false
|
|
340
|
-
? [
|
|
341
|
-
tx.mutate.accountLabel.update({
|
|
342
|
-
id: label.id,
|
|
343
|
-
unreadCount: (label.unreadCount ?? 0) + 1,
|
|
344
|
-
}),
|
|
345
|
-
]
|
|
346
|
-
: []),
|
|
313
|
+
if (label) {
|
|
314
|
+
for (const threadId of threadIds) {
|
|
315
|
+
const [thread, messages] = await Promise.all([
|
|
316
|
+
tx.run(zql.thread.where('id', threadId).one()),
|
|
317
|
+
tx.run(zql.threadMessage.where('threadId', threadId)),
|
|
347
318
|
]);
|
|
319
|
+
if (thread) {
|
|
320
|
+
const currentLabelIds = new Set(threadsUtils.parseLabelIdList(thread.labelIdList));
|
|
321
|
+
if (!currentLabelIds.has(label.id)) {
|
|
322
|
+
await Promise.all([
|
|
323
|
+
tx.mutate.threadByLabel.insert({
|
|
324
|
+
labelId: label.id,
|
|
325
|
+
latestMessageDate: thread.latestMessageDate,
|
|
326
|
+
threadId,
|
|
327
|
+
}),
|
|
328
|
+
...(thread.seen === false
|
|
329
|
+
? [
|
|
330
|
+
tx.mutate.accountLabel.update({
|
|
331
|
+
id: label.id,
|
|
332
|
+
unreadCount: (label.unreadCount ?? 0) + 1,
|
|
333
|
+
}),
|
|
334
|
+
]
|
|
335
|
+
: []),
|
|
336
|
+
]);
|
|
337
|
+
}
|
|
338
|
+
const existingChecks = await Promise.all(messages.map(x => tx.run(zql.threadLabel.where('threadMessageId', x.id).where('labelId', label.id).one())));
|
|
339
|
+
const messagesToInsert = messages.filter((_, i) => !existingChecks[i]);
|
|
340
|
+
const baseTimestamp = Date.now();
|
|
341
|
+
if (messagesToInsert.length > 0) {
|
|
342
|
+
await Promise.all(messagesToInsert.map((x, i) => tx.mutate.threadLabel.insert({
|
|
343
|
+
accountId,
|
|
344
|
+
labelId: label.id,
|
|
345
|
+
lastSyncedAt: 0,
|
|
346
|
+
threadId,
|
|
347
|
+
threadMessageId: x.id,
|
|
348
|
+
uid: -(baseTimestamp + i),
|
|
349
|
+
uidValidity: label.uidValidity ?? 0,
|
|
350
|
+
})));
|
|
351
|
+
}
|
|
352
|
+
currentLabelIds.add(label.id);
|
|
353
|
+
await tx.mutate.thread.update({
|
|
354
|
+
id: threadId,
|
|
355
|
+
labelIdList: buildLabelIdList([...currentLabelIds]),
|
|
356
|
+
});
|
|
357
|
+
}
|
|
348
358
|
}
|
|
349
|
-
const existingChecks = await Promise.all(messages.map(x => tx.run(zql.threadLabel.where('threadMessageId', x.id).where('labelId', label.id).one())));
|
|
350
|
-
const messagesToInsert = messages.filter((_, i) => !existingChecks[i]);
|
|
351
|
-
const baseTimestamp = Date.now();
|
|
352
|
-
if (messagesToInsert.length > 0) {
|
|
353
|
-
await Promise.all(messagesToInsert.map((x, i) => tx.mutate.threadLabel.insert({
|
|
354
|
-
accountId,
|
|
355
|
-
labelId: label.id,
|
|
356
|
-
lastSyncedAt: 0,
|
|
357
|
-
threadId,
|
|
358
|
-
threadMessageId: x.id,
|
|
359
|
-
uid: -(baseTimestamp + i),
|
|
360
|
-
uidValidity: label.uidValidity ?? 0,
|
|
361
|
-
})));
|
|
362
|
-
}
|
|
363
|
-
currentLabelIds.add(label.id);
|
|
364
|
-
await tx.mutate.thread.update({
|
|
365
|
-
id: threadId,
|
|
366
|
-
labelIdList: buildLabelIdList([...currentLabelIds]),
|
|
367
|
-
});
|
|
368
359
|
}
|
|
369
360
|
}
|
|
370
361
|
}),
|
|
@@ -393,45 +384,42 @@ export const mutators = defineMutators({
|
|
|
393
384
|
removeLabel: defineMutator(mutatorSchemas.thread.removeLabel, async ({ tx, args }) => {
|
|
394
385
|
for (const [accountId, { threadIds }] of Object.entries(args.accounts)) {
|
|
395
386
|
const label = await tx.run(zql.accountLabel.where('accountId', accountId).where('path', args.labelPath).one());
|
|
396
|
-
if (
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
387
|
+
if (label) {
|
|
388
|
+
for (const threadId of threadIds) {
|
|
389
|
+
const [thread, messages] = await Promise.all([
|
|
390
|
+
tx.run(zql.thread.where('id', threadId).one()),
|
|
391
|
+
tx.run(zql.threadMessage.where('threadId', threadId)),
|
|
392
|
+
]);
|
|
393
|
+
if (thread) {
|
|
394
|
+
const currentLabelIds = new Set(threadsUtils.parseLabelIdList(thread.labelIdList));
|
|
395
|
+
if (currentLabelIds.has(label.id)) {
|
|
396
|
+
currentLabelIds.delete(label.id);
|
|
397
|
+
await Promise.all([
|
|
398
|
+
...messages.map(x => tx.mutate.threadLabel.delete({
|
|
399
|
+
accountId,
|
|
400
|
+
labelId: label.id,
|
|
401
|
+
threadMessageId: x.id,
|
|
402
|
+
})),
|
|
403
|
+
tx.mutate.threadByLabel.delete({
|
|
404
|
+
labelId: label.id,
|
|
405
|
+
threadId,
|
|
406
|
+
}),
|
|
407
|
+
...(thread.seen === false
|
|
408
|
+
? [
|
|
409
|
+
tx.mutate.accountLabel.update({
|
|
410
|
+
id: label.id,
|
|
411
|
+
unreadCount: Math.max(0, (label.unreadCount ?? 0) - 1),
|
|
412
|
+
}),
|
|
413
|
+
]
|
|
414
|
+
: []),
|
|
415
|
+
tx.mutate.thread.update({
|
|
416
|
+
id: threadId,
|
|
417
|
+
labelIdList: buildLabelIdList([...currentLabelIds]),
|
|
418
|
+
}),
|
|
419
|
+
]);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
410
422
|
}
|
|
411
|
-
currentLabelIds.delete(label.id);
|
|
412
|
-
await Promise.all([
|
|
413
|
-
...messages.map(x => tx.mutate.threadLabel.delete({
|
|
414
|
-
accountId,
|
|
415
|
-
labelId: label.id,
|
|
416
|
-
threadMessageId: x.id,
|
|
417
|
-
})),
|
|
418
|
-
tx.mutate.threadByLabel.delete({
|
|
419
|
-
labelId: label.id,
|
|
420
|
-
threadId,
|
|
421
|
-
}),
|
|
422
|
-
...(thread.seen === false
|
|
423
|
-
? [
|
|
424
|
-
tx.mutate.accountLabel.update({
|
|
425
|
-
id: label.id,
|
|
426
|
-
unreadCount: Math.max(0, (label.unreadCount ?? 0) - 1),
|
|
427
|
-
}),
|
|
428
|
-
]
|
|
429
|
-
: []),
|
|
430
|
-
tx.mutate.thread.update({
|
|
431
|
-
id: threadId,
|
|
432
|
-
labelIdList: buildLabelIdList([...currentLabelIds]),
|
|
433
|
-
}),
|
|
434
|
-
]);
|
|
435
423
|
}
|
|
436
424
|
}
|
|
437
425
|
}),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, mock } from 'bun:test';
|
|
2
|
-
import { MutationError } from '../types';
|
|
3
2
|
import { mutators } from './mutators';
|
|
4
3
|
const createMockTx = () => ({
|
|
5
4
|
mutate: {
|
|
@@ -212,15 +211,17 @@ describe('mutators', () => {
|
|
|
212
211
|
updatedAt: 1234567890,
|
|
213
212
|
});
|
|
214
213
|
});
|
|
215
|
-
it('
|
|
214
|
+
it('does nothing if draft not found', async () => {
|
|
216
215
|
tx.run = mock(() => Promise.resolve(null));
|
|
217
216
|
const args = { id: 'draft-1', updatedAt: 1234567890 };
|
|
218
|
-
await
|
|
217
|
+
await mutators.draft.cancelSend.fn({ args, ctx, tx: tx });
|
|
218
|
+
expect(tx.mutate.draft.update).not.toHaveBeenCalled();
|
|
219
219
|
});
|
|
220
|
-
it('
|
|
220
|
+
it('does nothing if already confirmed', async () => {
|
|
221
221
|
tx.run = mock(() => Promise.resolve({ status: 'SEND_CONFIRMED' }));
|
|
222
222
|
const args = { id: 'draft-1', updatedAt: 1234567890 };
|
|
223
|
-
await
|
|
223
|
+
await mutators.draft.cancelSend.fn({ args, ctx, tx: tx });
|
|
224
|
+
expect(tx.mutate.draft.update).not.toHaveBeenCalled();
|
|
224
225
|
});
|
|
225
226
|
});
|
|
226
227
|
describe('createAttachment', () => {
|
|
@@ -354,10 +355,11 @@ describe('mutators', () => {
|
|
|
354
355
|
updatedAt: 1234567890,
|
|
355
356
|
});
|
|
356
357
|
});
|
|
357
|
-
it('
|
|
358
|
+
it('does nothing if draft not found', async () => {
|
|
358
359
|
tx.run = mock(() => Promise.resolve(null));
|
|
359
360
|
const args = { id: 'draft-1', patch: [], updatedAt: 1234567890 };
|
|
360
|
-
await
|
|
361
|
+
await mutators.draft.setContent.fn({ args, ctx, tx: tx });
|
|
362
|
+
expect(tx.mutate.draft.update).not.toHaveBeenCalled();
|
|
361
363
|
});
|
|
362
364
|
});
|
|
363
365
|
describe('setEnvelope', () => {
|
|
@@ -428,13 +430,15 @@ describe('mutators', () => {
|
|
|
428
430
|
labelIdList: expect.stringContaining('label-1'),
|
|
429
431
|
});
|
|
430
432
|
});
|
|
431
|
-
it('
|
|
433
|
+
it('does nothing if label not found', async () => {
|
|
432
434
|
tx.run = mock(() => Promise.resolve(null));
|
|
433
435
|
const args = {
|
|
434
436
|
accounts: { 'account-1': { threadIds: ['thread-1'] } },
|
|
435
437
|
labelPath: 'NONEXISTENT',
|
|
436
438
|
};
|
|
437
|
-
await
|
|
439
|
+
await mutators.thread.addLabel.fn({ args, ctx, tx: tx });
|
|
440
|
+
expect(tx.mutate.thread.update).not.toHaveBeenCalled();
|
|
441
|
+
expect(tx.mutate.threadByLabel.insert).not.toHaveBeenCalled();
|
|
438
442
|
});
|
|
439
443
|
});
|
|
440
444
|
describe('delete', () => {
|
|
@@ -477,7 +481,7 @@ describe('mutators', () => {
|
|
|
477
481
|
});
|
|
478
482
|
expect(tx.mutate.accountLabel.update).toHaveBeenCalledWith({ id: 'label-1', unreadCount: 4 });
|
|
479
483
|
});
|
|
480
|
-
it('
|
|
484
|
+
it('does nothing if thread does not have label', async () => {
|
|
481
485
|
tx.run = mock()
|
|
482
486
|
.mockResolvedValueOnce({ id: 'label-1' })
|
|
483
487
|
.mockResolvedValueOnce({ id: 'thread-1', labelIdList: ' label-2 ' })
|
|
@@ -486,7 +490,9 @@ describe('mutators', () => {
|
|
|
486
490
|
accounts: { 'account-1': { threadIds: ['thread-1'] } },
|
|
487
491
|
labelPath: 'INBOX',
|
|
488
492
|
};
|
|
489
|
-
await
|
|
493
|
+
await mutators.thread.removeLabel.fn({ args, ctx, tx: tx });
|
|
494
|
+
expect(tx.mutate.threadLabel.delete).not.toHaveBeenCalled();
|
|
495
|
+
expect(tx.mutate.threadByLabel.delete).not.toHaveBeenCalled();
|
|
490
496
|
});
|
|
491
497
|
});
|
|
492
498
|
describe('setFlagged', () => {
|