@marcoappio/marco-config 2.0.493 → 2.0.495
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/types/Zero.d.ts +8 -0
- package/dist/types/Zero.d.ts.map +1 -1
- package/dist/zero/crud.d.ts +1024 -0
- package/dist/zero/crud.d.ts.map +1 -0
- package/dist/zero/crud.js +3 -0
- package/dist/zero/index.d.ts +322 -38
- package/dist/zero/index.d.ts.map +1 -1
- package/dist/zero/index.js +2 -1
- package/dist/zero/mutators/accountMutators/accountMutators.d.ts +88 -9
- package/dist/zero/mutators/accountMutators/accountMutators.d.ts.map +1 -1
- package/dist/zero/mutators/accountMutators/accountMutators.js +100 -99
- package/dist/zero/mutators/accountMutators/index.d.ts +1 -1
- package/dist/zero/mutators/accountMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/accountMutators/index.js +1 -1
- package/dist/zero/mutators/draftMutators/draftMutators.d.ts +121 -9
- package/dist/zero/mutators/draftMutators/draftMutators.d.ts.map +1 -1
- package/dist/zero/mutators/draftMutators/draftMutators.js +97 -97
- package/dist/zero/mutators/draftMutators/index.d.ts +1 -1
- package/dist/zero/mutators/draftMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/draftMutators/index.js +1 -1
- package/dist/zero/mutators/index.d.ts +224 -1
- package/dist/zero/mutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/index.js +10 -1
- package/dist/zero/mutators/mutators.d.ts +90 -31
- package/dist/zero/mutators/mutators.d.ts.map +1 -1
- package/dist/zero/mutators/mutators.js +0 -1
- package/dist/zero/mutators/threadMutators/index.d.ts +1 -1
- package/dist/zero/mutators/threadMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/index.js +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts +81 -12
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.js +82 -70
- package/dist/zero/mutators/userMutators/index.d.ts +1 -1
- package/dist/zero/mutators/userMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/userMutators/index.js +1 -1
- package/dist/zero/mutators/userMutators/userMutators.d.ts +28 -3
- package/dist/zero/mutators/userMutators/userMutators.d.ts.map +1 -1
- package/dist/zero/mutators/userMutators/userMutators.js +29 -29
- package/dist/zero/queries/getAccounts.d.ts +1 -1
- package/dist/zero/queries/getContacts.d.ts +1 -1
- package/dist/zero/queries/getDrafts.d.ts +1 -1
- package/dist/zero/queries/getThread.d.ts +1 -1
- package/dist/zero/queries/getThreadList.d.ts +1 -1
- package/dist/zero/queries/getThreads.d.ts +1 -1
- package/dist/zero/queries/getUser.d.ts +1 -1
- package/dist/zero/queries/index.d.ts +1 -1
- package/dist/zero/schema.d.ts +1 -1
- package/dist/zero/schema.d.ts.map +1 -1
- package/dist/zero/schema.js +0 -1
- package/package.json +2 -2
- package/dist/zero/mutators/defineMutator.d.ts +0 -16
- package/dist/zero/mutators/defineMutator.d.ts.map +0 -1
- package/dist/zero/mutators/defineMutator.js +0 -7
|
@@ -1,3 +1,97 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const draftMutatorSchemas: {
|
|
3
|
+
cancelSend: v.ObjectSchema<{
|
|
4
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
5
|
+
readonly updatedAt: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
6
|
+
}, undefined>;
|
|
7
|
+
createAttachment: v.ObjectSchema<{
|
|
8
|
+
readonly attachment: v.ObjectSchema<{
|
|
9
|
+
readonly fileName: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
10
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
11
|
+
readonly mimeType: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
12
|
+
readonly status: v.PicklistSchema<readonly ["PENDING", "COMPLETE", "FAILED"], undefined>;
|
|
13
|
+
readonly totalSize: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
14
|
+
}, undefined>;
|
|
15
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
16
|
+
readonly updatedAt: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
17
|
+
}, undefined>;
|
|
18
|
+
deleteAttachment: v.ObjectSchema<{
|
|
19
|
+
readonly attachmentId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
20
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
21
|
+
readonly updatedAt: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
22
|
+
}, undefined>;
|
|
23
|
+
deleteDraft: v.ObjectSchema<{
|
|
24
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
25
|
+
}, undefined>;
|
|
26
|
+
setContent: v.ObjectSchema<{
|
|
27
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
28
|
+
readonly patch: v.ArraySchema<v.ObjectSchema<{
|
|
29
|
+
readonly index: v.NumberSchema<undefined>;
|
|
30
|
+
readonly type: v.UnionSchema<[v.LiteralSchema<"INSERTION", undefined>, v.LiteralSchema<"DELETION", undefined>], undefined>;
|
|
31
|
+
readonly value: v.StringSchema<undefined>;
|
|
32
|
+
}, undefined>, undefined>;
|
|
33
|
+
readonly updatedAt: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
34
|
+
}, undefined>;
|
|
35
|
+
setEnvelope: v.ObjectSchema<{
|
|
36
|
+
readonly envelope: Omit<v.ObjectSchema<{
|
|
37
|
+
readonly bcc: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>, undefined>;
|
|
38
|
+
readonly cc: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>, undefined>;
|
|
39
|
+
readonly content: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 384000, undefined>]>;
|
|
40
|
+
readonly subject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
41
|
+
readonly to: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>, undefined>;
|
|
42
|
+
}, undefined>, "~standard" | "~run" | "~types" | "entries"> & {
|
|
43
|
+
readonly entries: Omit<{
|
|
44
|
+
readonly bcc: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>, undefined>;
|
|
45
|
+
readonly cc: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>, undefined>;
|
|
46
|
+
readonly content: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 384000, undefined>]>;
|
|
47
|
+
readonly subject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
48
|
+
readonly to: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>, undefined>;
|
|
49
|
+
}, "content">;
|
|
50
|
+
readonly '~standard': v.StandardProps<{
|
|
51
|
+
bcc: string[];
|
|
52
|
+
cc: string[];
|
|
53
|
+
to: string[];
|
|
54
|
+
subject: string | null;
|
|
55
|
+
}, {
|
|
56
|
+
bcc: string[];
|
|
57
|
+
cc: string[];
|
|
58
|
+
to: string[];
|
|
59
|
+
subject: string | null;
|
|
60
|
+
}>;
|
|
61
|
+
readonly '~run': (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
62
|
+
bcc: string[];
|
|
63
|
+
cc: string[];
|
|
64
|
+
to: string[];
|
|
65
|
+
subject: string | null;
|
|
66
|
+
}, v.StringIssue | v.EmailIssue<string> | v.MaxLengthIssue<string, 255> | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, number> | v.ObjectIssue | v.ArrayIssue | v.NonOptionalIssue>;
|
|
67
|
+
readonly '~types'?: {
|
|
68
|
+
readonly input: {
|
|
69
|
+
bcc: string[];
|
|
70
|
+
cc: string[];
|
|
71
|
+
to: string[];
|
|
72
|
+
subject: string | null;
|
|
73
|
+
};
|
|
74
|
+
readonly output: {
|
|
75
|
+
bcc: string[];
|
|
76
|
+
cc: string[];
|
|
77
|
+
to: string[];
|
|
78
|
+
subject: string | null;
|
|
79
|
+
};
|
|
80
|
+
readonly issue: v.StringIssue | v.EmailIssue<string> | v.MaxLengthIssue<string, 255> | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, number> | v.ObjectIssue | v.ArrayIssue | v.NonOptionalIssue;
|
|
81
|
+
} | undefined;
|
|
82
|
+
};
|
|
83
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
84
|
+
readonly updatedAt: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
85
|
+
}, undefined>;
|
|
86
|
+
setFrom: v.ObjectSchema<{
|
|
87
|
+
readonly accountId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
88
|
+
readonly aliasId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
89
|
+
readonly from: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
|
|
90
|
+
readonly fromName: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
91
|
+
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
92
|
+
readonly updatedAt: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
93
|
+
}, undefined>;
|
|
94
|
+
};
|
|
1
95
|
export declare const draftMutators: {
|
|
2
96
|
cancelSend: import("@rocicorp/zero").MutatorDefinition<{
|
|
3
97
|
id: string;
|
|
@@ -5,7 +99,9 @@ export declare const draftMutators: {
|
|
|
5
99
|
}, {
|
|
6
100
|
id: string;
|
|
7
101
|
updatedAt: number;
|
|
8
|
-
},
|
|
102
|
+
}, {
|
|
103
|
+
readonly userId: string;
|
|
104
|
+
}, unknown>;
|
|
9
105
|
createAttachment: import("@rocicorp/zero").MutatorDefinition<{
|
|
10
106
|
attachment: {
|
|
11
107
|
fileName: string;
|
|
@@ -26,7 +122,9 @@ export declare const draftMutators: {
|
|
|
26
122
|
};
|
|
27
123
|
id: string;
|
|
28
124
|
updatedAt: number;
|
|
29
|
-
},
|
|
125
|
+
}, {
|
|
126
|
+
readonly userId: string;
|
|
127
|
+
}, unknown>;
|
|
30
128
|
createDraft: import("@rocicorp/zero").MutatorDefinition<{
|
|
31
129
|
accountId: string;
|
|
32
130
|
attachments: {
|
|
@@ -77,7 +175,9 @@ export declare const draftMutators: {
|
|
|
77
175
|
status: "DRAFT" | "SEND_REQUESTED" | "SEND_CONFIRMED" | "SEND_FAILED";
|
|
78
176
|
type: "NEW" | "REPLY" | "FORWARD";
|
|
79
177
|
updatedAt: number;
|
|
80
|
-
},
|
|
178
|
+
}, {
|
|
179
|
+
readonly userId: string;
|
|
180
|
+
}, unknown>;
|
|
81
181
|
deleteAttachment: import("@rocicorp/zero").MutatorDefinition<{
|
|
82
182
|
attachmentId: string;
|
|
83
183
|
id: string;
|
|
@@ -86,12 +186,16 @@ export declare const draftMutators: {
|
|
|
86
186
|
attachmentId: string;
|
|
87
187
|
id: string;
|
|
88
188
|
updatedAt: number;
|
|
89
|
-
},
|
|
189
|
+
}, {
|
|
190
|
+
readonly userId: string;
|
|
191
|
+
}, unknown>;
|
|
90
192
|
deleteDraft: import("@rocicorp/zero").MutatorDefinition<{
|
|
91
193
|
id: string;
|
|
92
194
|
}, {
|
|
93
195
|
id: string;
|
|
94
|
-
},
|
|
196
|
+
}, {
|
|
197
|
+
readonly userId: string;
|
|
198
|
+
}, unknown>;
|
|
95
199
|
scheduleSend: import("@rocicorp/zero").MutatorDefinition<{
|
|
96
200
|
id: string;
|
|
97
201
|
kind: "IMMEDIATE";
|
|
@@ -112,7 +216,9 @@ export declare const draftMutators: {
|
|
|
112
216
|
kind: "SCHEDULED";
|
|
113
217
|
scheduledFor: number;
|
|
114
218
|
updatedAt: number;
|
|
115
|
-
},
|
|
219
|
+
}, {
|
|
220
|
+
readonly userId: string;
|
|
221
|
+
}, unknown>;
|
|
116
222
|
setContent: import("@rocicorp/zero").MutatorDefinition<{
|
|
117
223
|
id: string;
|
|
118
224
|
patch: {
|
|
@@ -129,7 +235,9 @@ export declare const draftMutators: {
|
|
|
129
235
|
value: string;
|
|
130
236
|
}[];
|
|
131
237
|
updatedAt: number;
|
|
132
|
-
},
|
|
238
|
+
}, {
|
|
239
|
+
readonly userId: string;
|
|
240
|
+
}, unknown>;
|
|
133
241
|
setEnvelope: import("@rocicorp/zero").MutatorDefinition<{
|
|
134
242
|
envelope: {
|
|
135
243
|
bcc: string[];
|
|
@@ -148,7 +256,9 @@ export declare const draftMutators: {
|
|
|
148
256
|
};
|
|
149
257
|
id: string;
|
|
150
258
|
updatedAt: number;
|
|
151
|
-
},
|
|
259
|
+
}, {
|
|
260
|
+
readonly userId: string;
|
|
261
|
+
}, unknown>;
|
|
152
262
|
setFrom: import("@rocicorp/zero").MutatorDefinition<{
|
|
153
263
|
accountId: string;
|
|
154
264
|
aliasId: string;
|
|
@@ -163,6 +273,8 @@ export declare const draftMutators: {
|
|
|
163
273
|
fromName: string | null;
|
|
164
274
|
id: string;
|
|
165
275
|
updatedAt: number;
|
|
166
|
-
},
|
|
276
|
+
}, {
|
|
277
|
+
readonly userId: string;
|
|
278
|
+
}, unknown>;
|
|
167
279
|
};
|
|
168
280
|
//# sourceMappingURL=draftMutators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draftMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/draftMutators/draftMutators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"draftMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/draftMutators/draftMutators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAqD5B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC/B,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyKzB,CAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { defineMutator } from '@rocicorp/zero';
|
|
1
2
|
import * as v from 'valibot';
|
|
2
3
|
import { marcoSchemas } from '../../../schemas';
|
|
3
4
|
import { DRAFT_ATTACHMENT_UPLOAD_STATUSES, DRAFT_STATUSES, DRAFT_TYPES, MutationError } from '../../../types';
|
|
4
5
|
import { stringPatch } from '../../../utils';
|
|
5
|
-
import {
|
|
6
|
-
const draftStatusSchema = v.picklist(DRAFT_STATUSES);
|
|
7
|
-
const draftTypeSchema = v.picklist(DRAFT_TYPES);
|
|
6
|
+
import { zeroCRUD } from '../../../zero/crud';
|
|
8
7
|
const draftBodySchema = v.object({
|
|
9
8
|
bcc: v.array(marcoSchemas.string.email()),
|
|
10
9
|
cc: v.array(marcoSchemas.string.email()),
|
|
@@ -43,49 +42,76 @@ const draftModelSchema = v.object({
|
|
|
43
42
|
id: marcoSchemas.string.required(),
|
|
44
43
|
referencedMessageId: marcoSchemas.string.nullable(),
|
|
45
44
|
scheduledFor: v.nullable(marcoSchemas.number.positiveInteger()),
|
|
46
|
-
status:
|
|
47
|
-
type:
|
|
45
|
+
status: v.picklist(DRAFT_STATUSES),
|
|
46
|
+
type: v.picklist(DRAFT_TYPES),
|
|
48
47
|
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
49
48
|
});
|
|
50
|
-
export const
|
|
51
|
-
cancelSend:
|
|
49
|
+
export const draftMutatorSchemas = {
|
|
50
|
+
cancelSend: v.object({
|
|
51
|
+
id: marcoSchemas.string.required(),
|
|
52
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
53
|
+
}),
|
|
54
|
+
createAttachment: v.object({
|
|
55
|
+
attachment: draftAttachmentSchema,
|
|
56
|
+
id: marcoSchemas.string.required(),
|
|
57
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
58
|
+
}),
|
|
59
|
+
deleteAttachment: v.object({
|
|
60
|
+
attachmentId: marcoSchemas.string.required(),
|
|
61
|
+
id: marcoSchemas.string.required(),
|
|
62
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
63
|
+
}),
|
|
64
|
+
deleteDraft: v.object({
|
|
65
|
+
id: marcoSchemas.string.required(),
|
|
66
|
+
}),
|
|
67
|
+
setContent: v.object({
|
|
68
|
+
id: marcoSchemas.string.required(),
|
|
69
|
+
patch: marcoSchemas.drafts.contentPatch.patch(),
|
|
70
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
71
|
+
}),
|
|
72
|
+
setEnvelope: v.object({
|
|
73
|
+
envelope: v.omit(draftBodySchema, ['content']),
|
|
74
|
+
id: marcoSchemas.string.required(),
|
|
75
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
76
|
+
}),
|
|
77
|
+
setFrom: v.object({
|
|
78
|
+
accountId: marcoSchemas.string.required(),
|
|
79
|
+
aliasId: marcoSchemas.string.required(),
|
|
80
|
+
from: marcoSchemas.string.email(),
|
|
81
|
+
fromName: marcoSchemas.string.nullable(),
|
|
52
82
|
id: marcoSchemas.string.required(),
|
|
53
83
|
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
54
|
-
}),
|
|
55
|
-
|
|
84
|
+
}),
|
|
85
|
+
};
|
|
86
|
+
export const draftMutators = {
|
|
87
|
+
cancelSend: defineMutator(draftMutatorSchemas.cancelSend, async ({ tx, args: { id, updatedAt } }) => {
|
|
88
|
+
const draft = await tx.query.draft.where('id', id).one().run();
|
|
56
89
|
if (!draft) {
|
|
57
90
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
58
91
|
}
|
|
59
92
|
if (draft.status === 'SEND_CONFIRMED') {
|
|
60
93
|
throw new Error(MutationError.ALREADY_APPLIED);
|
|
61
94
|
}
|
|
62
|
-
await tx.mutate.draft.update({
|
|
63
|
-
id
|
|
95
|
+
await tx.mutate(zeroCRUD.draft.update({
|
|
96
|
+
id,
|
|
64
97
|
scheduledFor: null,
|
|
65
98
|
status: 'DRAFT',
|
|
66
|
-
updatedAt
|
|
67
|
-
});
|
|
99
|
+
updatedAt,
|
|
100
|
+
}));
|
|
68
101
|
}),
|
|
69
|
-
createAttachment: defineMutator(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
status: args.attachment.status,
|
|
80
|
-
totalSize: args.attachment.totalSize,
|
|
81
|
-
});
|
|
82
|
-
await tx.mutate.draft.update({
|
|
83
|
-
id: args.id,
|
|
84
|
-
updatedAt: args.updatedAt,
|
|
85
|
-
});
|
|
102
|
+
createAttachment: defineMutator(draftMutatorSchemas.createAttachment, async ({ tx, args: { id, attachment, updatedAt } }) => {
|
|
103
|
+
await tx.mutate(zeroCRUD.draftAttachment.insert({
|
|
104
|
+
draftId: id,
|
|
105
|
+
fileName: attachment.fileName,
|
|
106
|
+
id: attachment.id,
|
|
107
|
+
mimeType: attachment.mimeType,
|
|
108
|
+
status: attachment.status,
|
|
109
|
+
totalSize: attachment.totalSize,
|
|
110
|
+
}));
|
|
111
|
+
await tx.mutate(zeroCRUD.draft.update({ id, updatedAt }));
|
|
86
112
|
}),
|
|
87
113
|
createDraft: defineMutator(draftModelSchema, async ({ tx, ctx: { userId }, args }) => {
|
|
88
|
-
await tx.mutate.draft.insert({
|
|
114
|
+
await tx.mutate(zeroCRUD.draft.insert({
|
|
89
115
|
accountId: args.accountId,
|
|
90
116
|
body: {
|
|
91
117
|
bcc: args.body.bcc,
|
|
@@ -105,110 +131,84 @@ export const draftMutators = {
|
|
|
105
131
|
type: args.type,
|
|
106
132
|
updatedAt: args.updatedAt,
|
|
107
133
|
userId,
|
|
108
|
-
});
|
|
134
|
+
}));
|
|
109
135
|
for (const attachment of args.attachments) {
|
|
110
|
-
await tx.mutate.draftAttachment.insert({
|
|
136
|
+
await tx.mutate(zeroCRUD.draftAttachment.insert({
|
|
111
137
|
draftId: args.id,
|
|
112
138
|
fileName: attachment.fileName,
|
|
113
139
|
id: attachment.id,
|
|
114
140
|
mimeType: attachment.mimeType,
|
|
115
141
|
status: attachment.status,
|
|
116
142
|
totalSize: attachment.totalSize,
|
|
117
|
-
});
|
|
143
|
+
}));
|
|
118
144
|
}
|
|
119
145
|
}),
|
|
120
|
-
deleteAttachment: defineMutator(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
await tx.mutate.draftAttachment.delete({
|
|
126
|
-
id: args.attachmentId,
|
|
127
|
-
});
|
|
128
|
-
await tx.mutate.draft.update({
|
|
129
|
-
id: args.id,
|
|
130
|
-
updatedAt: args.updatedAt,
|
|
131
|
-
});
|
|
146
|
+
deleteAttachment: defineMutator(draftMutatorSchemas.deleteAttachment, async ({ tx, args: { id, attachmentId, updatedAt } }) => {
|
|
147
|
+
await tx.mutate(zeroCRUD.draftAttachment.delete({
|
|
148
|
+
id: attachmentId,
|
|
149
|
+
}));
|
|
150
|
+
await tx.mutate(zeroCRUD.draft.update({ id, updatedAt }));
|
|
132
151
|
}),
|
|
133
|
-
deleteDraft: defineMutator(
|
|
134
|
-
|
|
135
|
-
}), async ({ tx, args }) => {
|
|
136
|
-
await tx.mutate.draft.delete({
|
|
137
|
-
id: args.id,
|
|
138
|
-
});
|
|
152
|
+
deleteDraft: defineMutator(draftMutatorSchemas.deleteDraft, async ({ tx, args: { id } }) => {
|
|
153
|
+
await tx.mutate(zeroCRUD.draft.delete({ id }));
|
|
139
154
|
}),
|
|
140
155
|
scheduleSend: defineMutator(draftScheduleSchema, async ({ tx, args }) => {
|
|
141
156
|
if (args.kind === 'IMMEDIATE') {
|
|
142
|
-
await tx.mutate.draft.update({
|
|
157
|
+
await tx.mutate(zeroCRUD.draft.update({
|
|
143
158
|
id: args.id,
|
|
144
159
|
scheduledFor: args.updatedAt + args.undoMs,
|
|
145
160
|
status: 'SEND_REQUESTED',
|
|
146
161
|
updatedAt: args.updatedAt,
|
|
147
|
-
});
|
|
162
|
+
}));
|
|
148
163
|
}
|
|
149
164
|
else {
|
|
150
|
-
await tx.mutate.draft.update({
|
|
165
|
+
await tx.mutate(zeroCRUD.draft.update({
|
|
151
166
|
id: args.id,
|
|
152
167
|
scheduledFor: args.scheduledFor,
|
|
153
168
|
status: 'SEND_REQUESTED',
|
|
154
169
|
updatedAt: args.updatedAt,
|
|
155
|
-
});
|
|
170
|
+
}));
|
|
156
171
|
}
|
|
157
172
|
}),
|
|
158
|
-
setContent: defineMutator(
|
|
159
|
-
id
|
|
160
|
-
patch: marcoSchemas.drafts.contentPatch.patch(),
|
|
161
|
-
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
162
|
-
}), async ({ tx, args }) => {
|
|
163
|
-
const draft = await tx.query.draft.where('id', args.id).one().run();
|
|
173
|
+
setContent: defineMutator(draftMutatorSchemas.setContent, async ({ tx, args: { id, patch, updatedAt } }) => {
|
|
174
|
+
const draft = await tx.query.draft.where('id', id).one().run();
|
|
164
175
|
if (!draft) {
|
|
165
176
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
166
177
|
}
|
|
167
|
-
await tx.mutate.draft.update({
|
|
178
|
+
await tx.mutate(zeroCRUD.draft.update({
|
|
168
179
|
body: {
|
|
169
180
|
...draft.body,
|
|
170
|
-
content: stringPatch.apply(typeof draft.body?.content === 'string' ? draft.body.content : '',
|
|
181
|
+
content: stringPatch.apply(typeof draft.body?.content === 'string' ? draft.body.content : '', patch),
|
|
171
182
|
},
|
|
172
|
-
id
|
|
173
|
-
updatedAt
|
|
174
|
-
});
|
|
183
|
+
id,
|
|
184
|
+
updatedAt,
|
|
185
|
+
}));
|
|
175
186
|
}),
|
|
176
|
-
setEnvelope: defineMutator(
|
|
177
|
-
|
|
178
|
-
id: marcoSchemas.string.required(),
|
|
179
|
-
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
180
|
-
}), async ({ tx, args }) => {
|
|
181
|
-
const draft = await tx.query.draft.where('id', args.id).one().run();
|
|
187
|
+
setEnvelope: defineMutator(draftMutatorSchemas.setEnvelope, async ({ tx, args: { id, envelope, updatedAt } }) => {
|
|
188
|
+
const draft = await tx.query.draft.where('id', id).one().run();
|
|
182
189
|
if (!draft) {
|
|
183
190
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
184
191
|
}
|
|
185
|
-
await tx.mutate.draft.update({
|
|
192
|
+
await tx.mutate(zeroCRUD.draft.update({
|
|
186
193
|
body: {
|
|
187
|
-
bcc:
|
|
188
|
-
cc:
|
|
194
|
+
bcc: envelope.bcc,
|
|
195
|
+
cc: envelope.cc,
|
|
189
196
|
content: draft.body.content,
|
|
190
|
-
to:
|
|
197
|
+
to: envelope.to,
|
|
191
198
|
},
|
|
192
|
-
id
|
|
193
|
-
subject:
|
|
194
|
-
updatedAt
|
|
195
|
-
});
|
|
199
|
+
id,
|
|
200
|
+
subject: envelope.subject,
|
|
201
|
+
updatedAt,
|
|
202
|
+
}));
|
|
196
203
|
}),
|
|
197
|
-
setFrom: defineMutator(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
accountId: args.accountId,
|
|
207
|
-
fromAliasId: args.aliasId,
|
|
208
|
-
fromEmail: args.from,
|
|
209
|
-
fromName: args.fromName,
|
|
210
|
-
id: args.id,
|
|
211
|
-
updatedAt: args.updatedAt,
|
|
212
|
-
});
|
|
204
|
+
setFrom: defineMutator(draftMutatorSchemas.setFrom, async ({ tx, args: { id, accountId, aliasId, from, fromName, updatedAt } }) => {
|
|
205
|
+
await tx.mutate(zeroCRUD.draft.update({
|
|
206
|
+
accountId,
|
|
207
|
+
fromAliasId: aliasId,
|
|
208
|
+
fromEmail: from,
|
|
209
|
+
fromName: fromName,
|
|
210
|
+
id,
|
|
211
|
+
updatedAt,
|
|
212
|
+
}));
|
|
213
213
|
}),
|
|
214
214
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { draftMutatorSchemas, draftMutators } from './draftMutators';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/draftMutators/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/draftMutators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { draftMutatorSchemas, draftMutators } from './draftMutators';
|