@marcoappio/marco-config 2.0.512 → 2.0.514
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 +12 -0
- package/dist/types/Zero.d.ts.map +1 -1
- package/dist/zero/index.d.ts +369 -369
- package/dist/zero/index.d.ts.map +1 -1
- package/dist/zero/index.js +1 -2
- package/dist/zero/mutators.d.ts +385 -123
- package/dist/zero/mutators.d.ts.map +1 -1
- package/dist/zero/mutators.js +176 -2
- package/dist/zero/queries.d.ts +123 -123
- package/dist/zero/schema.d.ts +123 -124
- package/dist/zero/schema.d.ts.map +1 -1
- package/dist/zero/schema.js +0 -1
- package/package.json +1 -1
- package/dist/zero/mutatorSchemas.d.ts +0 -263
- package/dist/zero/mutatorSchemas.d.ts.map +0 -1
- package/dist/zero/mutatorSchemas.js +0 -176
|
@@ -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":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAS5B,KAAK,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAmDjC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0I1B,CAAA;AAoGD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0iBnB,CAAA"}
|
package/dist/zero/mutators.js
CHANGED
|
@@ -1,11 +1,185 @@
|
|
|
1
1
|
import { createBuilder, defineMutators, defineMutatorWithType } from '@rocicorp/zero';
|
|
2
|
-
import
|
|
2
|
+
import * as v from 'valibot';
|
|
3
|
+
import { marcoSchemas } from '../schemas';
|
|
4
|
+
import { DRAFT_ATTACHMENT_UPLOAD_STATUSES, DRAFT_STATUSES, DRAFT_TYPES, MutationError } from '../types';
|
|
3
5
|
import { stringPatch } from '../utils';
|
|
4
6
|
import { threadsUtils } from '../utils/threads';
|
|
5
|
-
import { mutatorSchemas } from '../zero/mutatorSchemas';
|
|
6
7
|
import { schema } from '../zero/schema';
|
|
7
8
|
const zql = createBuilder(schema);
|
|
8
9
|
const defineMutator = defineMutatorWithType();
|
|
10
|
+
const accountAliasSchema = v.object({
|
|
11
|
+
emailAddress: marcoSchemas.string.email(),
|
|
12
|
+
id: marcoSchemas.string.required(),
|
|
13
|
+
name: marcoSchemas.string.nullable(),
|
|
14
|
+
});
|
|
15
|
+
const accountsSchema = v.record(marcoSchemas.string.required(), v.object({
|
|
16
|
+
threadIds: v.array(marcoSchemas.string.required()),
|
|
17
|
+
}));
|
|
18
|
+
const baseThreadSchema = v.object({
|
|
19
|
+
accounts: accountsSchema,
|
|
20
|
+
});
|
|
21
|
+
const threadChangeLabelSchema = v.object({
|
|
22
|
+
accounts: accountsSchema,
|
|
23
|
+
labelPath: marcoSchemas.string.required(),
|
|
24
|
+
});
|
|
25
|
+
const draftBodySchema = v.object({
|
|
26
|
+
bcc: v.array(marcoSchemas.string.email()),
|
|
27
|
+
cc: v.array(marcoSchemas.string.email()),
|
|
28
|
+
content: v.pipe(v.string(), v.maxLength(384000)),
|
|
29
|
+
subject: marcoSchemas.string.nullable(),
|
|
30
|
+
to: v.array(marcoSchemas.string.email()),
|
|
31
|
+
});
|
|
32
|
+
const draftAttachmentSchema = v.object({
|
|
33
|
+
fileName: marcoSchemas.string.required(),
|
|
34
|
+
id: marcoSchemas.string.required(),
|
|
35
|
+
mimeType: marcoSchemas.string.required(),
|
|
36
|
+
status: v.picklist(DRAFT_ATTACHMENT_UPLOAD_STATUSES),
|
|
37
|
+
totalSize: marcoSchemas.number.positiveInteger(),
|
|
38
|
+
});
|
|
39
|
+
const userPushNotificationTokenSchema = v.object({
|
|
40
|
+
createdAt: marcoSchemas.number.positiveInteger(),
|
|
41
|
+
id: marcoSchemas.string.required(),
|
|
42
|
+
token: marcoSchemas.string.required(),
|
|
43
|
+
});
|
|
44
|
+
export const mutatorSchemas = {
|
|
45
|
+
account: {
|
|
46
|
+
createAccount: v.object({
|
|
47
|
+
aliasId: marcoSchemas.string.required(),
|
|
48
|
+
color: marcoSchemas.string.required(),
|
|
49
|
+
emailAddress: marcoSchemas.string.email(),
|
|
50
|
+
id: marcoSchemas.string.required(),
|
|
51
|
+
}),
|
|
52
|
+
createAlias: v.object({
|
|
53
|
+
accountId: marcoSchemas.string.required(),
|
|
54
|
+
alias: accountAliasSchema,
|
|
55
|
+
}),
|
|
56
|
+
deleteAccount: v.object({
|
|
57
|
+
id: marcoSchemas.string.required(),
|
|
58
|
+
}),
|
|
59
|
+
deleteAlias: v.object({
|
|
60
|
+
accountId: marcoSchemas.string.required(),
|
|
61
|
+
aliasId: marcoSchemas.string.required(),
|
|
62
|
+
}),
|
|
63
|
+
setAliasName: v.object({
|
|
64
|
+
accountId: marcoSchemas.string.required(),
|
|
65
|
+
aliasId: marcoSchemas.string.required(),
|
|
66
|
+
displayName: marcoSchemas.string.nullable(),
|
|
67
|
+
}),
|
|
68
|
+
setAliasPrimary: v.object({
|
|
69
|
+
accountId: marcoSchemas.string.required(),
|
|
70
|
+
aliasId: marcoSchemas.string.required(),
|
|
71
|
+
}),
|
|
72
|
+
setConnectionConfigImapRaw: v.object({
|
|
73
|
+
connectionConfig: marcoSchemas.emailAccount.connectionConfigImapRaw(),
|
|
74
|
+
id: marcoSchemas.string.required(),
|
|
75
|
+
}),
|
|
76
|
+
setConnectionConfigOauth: v.object({
|
|
77
|
+
connectionConfig: marcoSchemas.emailAccount.connectionConfigOauth(),
|
|
78
|
+
id: marcoSchemas.string.required(),
|
|
79
|
+
}),
|
|
80
|
+
setSettings: v.object({
|
|
81
|
+
color: v.optional(marcoSchemas.string.nullable()),
|
|
82
|
+
displayName: v.optional(marcoSchemas.string.nullable()),
|
|
83
|
+
id: marcoSchemas.string.required(),
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
draft: {
|
|
87
|
+
cancelSend: v.object({
|
|
88
|
+
id: marcoSchemas.string.required(),
|
|
89
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
90
|
+
}),
|
|
91
|
+
createAttachment: v.object({
|
|
92
|
+
attachment: draftAttachmentSchema,
|
|
93
|
+
id: marcoSchemas.string.required(),
|
|
94
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
95
|
+
}),
|
|
96
|
+
createDraft: v.object({
|
|
97
|
+
accountId: marcoSchemas.string.required(),
|
|
98
|
+
attachments: v.array(draftAttachmentSchema),
|
|
99
|
+
body: draftBodySchema,
|
|
100
|
+
error: marcoSchemas.string.nullable(),
|
|
101
|
+
from: marcoSchemas.string.email(),
|
|
102
|
+
fromName: marcoSchemas.string.nullable(),
|
|
103
|
+
id: marcoSchemas.string.required(),
|
|
104
|
+
referencedMessageId: marcoSchemas.string.nullable(),
|
|
105
|
+
scheduledFor: v.nullable(marcoSchemas.number.positiveInteger()),
|
|
106
|
+
status: v.picklist(DRAFT_STATUSES),
|
|
107
|
+
type: v.picklist(DRAFT_TYPES),
|
|
108
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
109
|
+
}),
|
|
110
|
+
deleteAttachment: v.object({
|
|
111
|
+
attachmentId: marcoSchemas.string.required(),
|
|
112
|
+
id: marcoSchemas.string.required(),
|
|
113
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
114
|
+
}),
|
|
115
|
+
deleteDraft: v.object({
|
|
116
|
+
id: marcoSchemas.string.required(),
|
|
117
|
+
}),
|
|
118
|
+
scheduleSend: v.union([
|
|
119
|
+
v.object({
|
|
120
|
+
id: marcoSchemas.string.required(),
|
|
121
|
+
kind: v.literal('IMMEDIATE'),
|
|
122
|
+
undoMs: marcoSchemas.number.positiveInteger(),
|
|
123
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
124
|
+
}),
|
|
125
|
+
v.object({
|
|
126
|
+
id: marcoSchemas.string.required(),
|
|
127
|
+
kind: v.literal('SCHEDULED'),
|
|
128
|
+
scheduledFor: marcoSchemas.number.positiveInteger(),
|
|
129
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
130
|
+
}),
|
|
131
|
+
]),
|
|
132
|
+
setContent: v.object({
|
|
133
|
+
id: marcoSchemas.string.required(),
|
|
134
|
+
patch: marcoSchemas.drafts.contentPatch.patch(),
|
|
135
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
136
|
+
}),
|
|
137
|
+
setEnvelope: v.object({
|
|
138
|
+
envelope: v.omit(draftBodySchema, ['content']),
|
|
139
|
+
id: marcoSchemas.string.required(),
|
|
140
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
141
|
+
}),
|
|
142
|
+
setFrom: v.object({
|
|
143
|
+
accountId: marcoSchemas.string.required(),
|
|
144
|
+
aliasId: marcoSchemas.string.required(),
|
|
145
|
+
from: marcoSchemas.string.email(),
|
|
146
|
+
fromName: marcoSchemas.string.nullable(),
|
|
147
|
+
id: marcoSchemas.string.required(),
|
|
148
|
+
updatedAt: marcoSchemas.number.positiveInteger(),
|
|
149
|
+
}),
|
|
150
|
+
},
|
|
151
|
+
thread: {
|
|
152
|
+
addLabel: threadChangeLabelSchema,
|
|
153
|
+
delete: baseThreadSchema,
|
|
154
|
+
removeLabel: threadChangeLabelSchema,
|
|
155
|
+
setArchive: baseThreadSchema,
|
|
156
|
+
setFlagged: v.object({
|
|
157
|
+
accounts: accountsSchema,
|
|
158
|
+
flagged: v.boolean(),
|
|
159
|
+
}),
|
|
160
|
+
setInbox: baseThreadSchema,
|
|
161
|
+
setSeen: v.object({
|
|
162
|
+
accounts: accountsSchema,
|
|
163
|
+
seen: v.boolean(),
|
|
164
|
+
}),
|
|
165
|
+
setSpam: baseThreadSchema,
|
|
166
|
+
setTrash: baseThreadSchema,
|
|
167
|
+
},
|
|
168
|
+
user: {
|
|
169
|
+
deleteSettingsPushNotificationToken: v.object({
|
|
170
|
+
id: marcoSchemas.string.required(),
|
|
171
|
+
token: marcoSchemas.string.required(),
|
|
172
|
+
}),
|
|
173
|
+
setSettingsName: v.object({
|
|
174
|
+
id: marcoSchemas.string.required(),
|
|
175
|
+
name: marcoSchemas.string.nullable(),
|
|
176
|
+
}),
|
|
177
|
+
setSettingsPushNotificationToken: v.object({
|
|
178
|
+
id: marcoSchemas.string.required(),
|
|
179
|
+
pushNotificationToken: userPushNotificationTokenSchema,
|
|
180
|
+
}),
|
|
181
|
+
},
|
|
182
|
+
};
|
|
9
183
|
const buildLabelIdList = (x) => (x.length === 0 ? '' : ` ${[...new Set(x)].join(' ')} `);
|
|
10
184
|
const setSystemLabel = async (tx, builder, threadId, targetSpecialUse) => {
|
|
11
185
|
const thread = await tx.run(builder.thread.where('id', threadId).one());
|