@marcoappio/marco-config 2.0.499 → 2.0.501
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/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/zero/mutators/accountMutators/accountMutators.js +3 -3
- package/dist/zero/mutators/draftMutators/draftMutators.js +3 -3
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.js +15 -15
- package/dist/zero/mutators/userMutators/userMutators.d.ts.map +1 -1
- package/dist/zero/mutators/userMutators/userMutators.js +1 -5
- package/package.json +1 -1
- package/dist/types/IMAPSourceLocation.d.ts +0 -7
- package/dist/types/IMAPSourceLocation.d.ts.map +0 -1
- package/dist/types/IMAPSourceLocation.js +0 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * from './DraftType';
|
|
|
4
4
|
export * from './EmailProvider';
|
|
5
5
|
export * from './Endpoint';
|
|
6
6
|
export * from './IMAPConnectionStatus';
|
|
7
|
-
export * from './IMAPSourceLocation';
|
|
8
7
|
export * from './LabelSpecialUse';
|
|
9
8
|
export * from './MarcoPlatform';
|
|
10
9
|
export * from './MessageRecipientType';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA"}
|
package/dist/types/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export * from './DraftType';
|
|
|
4
4
|
export * from './EmailProvider';
|
|
5
5
|
export * from './Endpoint';
|
|
6
6
|
export * from './IMAPConnectionStatus';
|
|
7
|
-
export * from './IMAPSourceLocation';
|
|
8
7
|
export * from './LabelSpecialUse';
|
|
9
8
|
export * from './MarcoPlatform';
|
|
10
9
|
export * from './MessageRecipientType';
|
|
@@ -80,10 +80,10 @@ export const accountMutators = {
|
|
|
80
80
|
await tx.mutate(zeroCRUD.account.delete({ id }));
|
|
81
81
|
}),
|
|
82
82
|
deleteAlias: defineMutator(accountMutatorSchemas.deleteAlias, async ({ tx, args: { accountId, aliasId } }) => {
|
|
83
|
-
const alias = await tx.query.accountAlias.where('id', aliasId).one()
|
|
83
|
+
const alias = await tx.run(tx.query.accountAlias.where('id', aliasId).one());
|
|
84
84
|
await tx.mutate(zeroCRUD.accountAlias.delete({ id: aliasId }));
|
|
85
85
|
if (alias?.isPrimary) {
|
|
86
|
-
const remainingAliases = await tx.query.accountAlias.where('accountId', accountId)
|
|
86
|
+
const remainingAliases = await tx.run(tx.query.accountAlias.where('accountId', accountId));
|
|
87
87
|
if (remainingAliases.length > 0) {
|
|
88
88
|
const newPrimaryAlias = remainingAliases[0];
|
|
89
89
|
await tx.mutate(zeroCRUD.accountAlias.update({
|
|
@@ -110,7 +110,7 @@ export const accountMutators = {
|
|
|
110
110
|
}));
|
|
111
111
|
}),
|
|
112
112
|
setAliasPrimary: defineMutator(accountMutatorSchemas.setAliasPrimary, async ({ tx, args: { accountId, aliasId } }) => {
|
|
113
|
-
const aliases = await tx.query.accountAlias.where('accountId', accountId)
|
|
113
|
+
const aliases = await tx.run(tx.query.accountAlias.where('accountId', accountId));
|
|
114
114
|
for (const alias of aliases) {
|
|
115
115
|
await tx.mutate(zeroCRUD.accountAlias.update({
|
|
116
116
|
id: alias.id,
|
|
@@ -86,7 +86,7 @@ export const draftMutatorSchemas = {
|
|
|
86
86
|
};
|
|
87
87
|
export const draftMutators = {
|
|
88
88
|
cancelSend: defineMutator(draftMutatorSchemas.cancelSend, async ({ tx, args: { id, updatedAt } }) => {
|
|
89
|
-
const draft = await tx.query.draft.where('id', id).one()
|
|
89
|
+
const draft = await tx.run(tx.query.draft.where('id', id).one());
|
|
90
90
|
if (!draft) {
|
|
91
91
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
92
92
|
}
|
|
@@ -172,7 +172,7 @@ export const draftMutators = {
|
|
|
172
172
|
}
|
|
173
173
|
}),
|
|
174
174
|
setContent: defineMutator(draftMutatorSchemas.setContent, async ({ tx, args: { id, patch, updatedAt } }) => {
|
|
175
|
-
const draft = await tx.query.draft.where('id', id).one()
|
|
175
|
+
const draft = await tx.run(tx.query.draft.where('id', id).one());
|
|
176
176
|
if (!draft) {
|
|
177
177
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
178
178
|
}
|
|
@@ -186,7 +186,7 @@ export const draftMutators = {
|
|
|
186
186
|
}));
|
|
187
187
|
}),
|
|
188
188
|
setEnvelope: defineMutator(draftMutatorSchemas.setEnvelope, async ({ tx, args: { id, envelope, updatedAt } }) => {
|
|
189
|
-
const draft = await tx.query.draft.where('id', id).one()
|
|
189
|
+
const draft = await tx.run(tx.query.draft.where('id', id).one());
|
|
190
190
|
if (!draft) {
|
|
191
191
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
192
192
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threadMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/threadMutators/threadMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAI1D,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,0CAA0C,CAAA;AAoB/F,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBhC,CAAA;AAED,eAAO,MAAM,cAAc,OACrB,gBAAgB,YACV,MAAM,oBACE,eAAe,KAChC,OAAO,CAAC,IAAI,CAqGd,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"threadMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/threadMutators/threadMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAI1D,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,0CAA0C,CAAA;AAoB/F,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBhC,CAAA;AAED,eAAO,MAAM,cAAc,OACrB,gBAAgB,YACV,MAAM,oBACE,eAAe,KAChC,OAAO,CAAC,IAAI,CAqGd,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsQ1B,CAAA"}
|
|
@@ -33,13 +33,13 @@ export const threadMutatorSchemas = {
|
|
|
33
33
|
setTrash: baseThreadSchema,
|
|
34
34
|
};
|
|
35
35
|
export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
|
|
36
|
-
const thread = await tx.query.thread.where('id', threadId).one()
|
|
36
|
+
const thread = await tx.run(tx.query.thread.where('id', threadId).one());
|
|
37
37
|
if (!thread) {
|
|
38
38
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
39
39
|
}
|
|
40
40
|
const [targetLabel, messages] = await Promise.all([
|
|
41
|
-
tx.query.accountLabel.where('accountId', thread.accountId).where('specialUse', targetSpecialUse).one()
|
|
42
|
-
tx.query.threadMessage.where('threadId', threadId)
|
|
41
|
+
tx.run(tx.query.accountLabel.where('accountId', thread.accountId).where('specialUse', targetSpecialUse).one()),
|
|
42
|
+
tx.run(tx.query.threadMessage.where('threadId', threadId)),
|
|
43
43
|
]);
|
|
44
44
|
if (!targetLabel) {
|
|
45
45
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
@@ -63,7 +63,7 @@ export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
|
|
|
63
63
|
...[...labelIdsToRemove].map(labelId => tx.mutate(zeroCRUD.threadByLabel.delete({ labelId, threadId }))),
|
|
64
64
|
]);
|
|
65
65
|
if (thread.seen === false && labelIdsToRemove.size > 0) {
|
|
66
|
-
const labelsToUpdate = await tx.query.accountLabel.where('id', 'IN', [...labelIdsToRemove])
|
|
66
|
+
const labelsToUpdate = await tx.run(tx.query.accountLabel.where('id', 'IN', [...labelIdsToRemove]));
|
|
67
67
|
await Promise.all(labelsToUpdate.map(label => tx.mutate(zeroCRUD.accountLabel.update({
|
|
68
68
|
id: label.id,
|
|
69
69
|
unreadCount: Math.max(0, (label.unreadCount ?? 0) - 1),
|
|
@@ -104,14 +104,14 @@ export const setSystemLabel = async (tx, threadId, targetSpecialUse) => {
|
|
|
104
104
|
export const threadMutators = {
|
|
105
105
|
addLabel: defineMutator(threadMutatorSchemas.addLabel, async ({ tx, args: { accounts, labelPath } }) => {
|
|
106
106
|
for (const [accountId, { threadIds }] of Object.entries(accounts)) {
|
|
107
|
-
const label = await tx.query.accountLabel.where('accountId', accountId).where('path', labelPath).one()
|
|
107
|
+
const label = await tx.run(tx.query.accountLabel.where('accountId', accountId).where('path', labelPath).one());
|
|
108
108
|
if (!label) {
|
|
109
109
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
110
110
|
}
|
|
111
111
|
for (const threadId of threadIds) {
|
|
112
112
|
const [thread, messages] = await Promise.all([
|
|
113
|
-
tx.query.thread.where('id', threadId).one()
|
|
114
|
-
tx.query.threadMessage.where('threadId', threadId)
|
|
113
|
+
tx.run(tx.query.thread.where('id', threadId).one()),
|
|
114
|
+
tx.run(tx.query.threadMessage.where('threadId', threadId)),
|
|
115
115
|
]);
|
|
116
116
|
if (!thread) {
|
|
117
117
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
@@ -134,7 +134,7 @@ export const threadMutators = {
|
|
|
134
134
|
: []),
|
|
135
135
|
]);
|
|
136
136
|
}
|
|
137
|
-
const existingChecks = await Promise.all(messages.map(x => tx.query.threadLabel.where('threadMessageId', x.id).where('labelId', label.id).one()
|
|
137
|
+
const existingChecks = await Promise.all(messages.map(x => tx.run(tx.query.threadLabel.where('threadMessageId', x.id).where('labelId', label.id).one())));
|
|
138
138
|
const messagesToInsert = messages.filter((_, i) => !existingChecks[i]);
|
|
139
139
|
const baseTimestamp = Date.now();
|
|
140
140
|
if (messagesToInsert.length > 0) {
|
|
@@ -159,12 +159,12 @@ export const threadMutators = {
|
|
|
159
159
|
delete: defineMutator(threadMutatorSchemas.delete, async ({ tx, args: { accounts } }) => {
|
|
160
160
|
for (const [, { threadIds }] of Object.entries(accounts)) {
|
|
161
161
|
for (const threadId of threadIds) {
|
|
162
|
-
const thread = await tx.query.thread.where('id', threadId).one()
|
|
162
|
+
const thread = await tx.run(tx.query.thread.where('id', threadId).one());
|
|
163
163
|
if (thread) {
|
|
164
164
|
if (thread.seen === false) {
|
|
165
165
|
const labelIds = threadsUtils.parseLabelIdList(thread.labelIdList);
|
|
166
166
|
if (labelIds.length > 0) {
|
|
167
|
-
const labels = await tx.query.accountLabel.where('id', 'IN', labelIds)
|
|
167
|
+
const labels = await tx.run(tx.query.accountLabel.where('id', 'IN', labelIds));
|
|
168
168
|
await Promise.all(labels.map(x => tx.mutate(zeroCRUD.accountLabel.update({
|
|
169
169
|
id: x.id,
|
|
170
170
|
unreadCount: Math.max(0, (x.unreadCount ?? 0) - 1),
|
|
@@ -180,14 +180,14 @@ export const threadMutators = {
|
|
|
180
180
|
}),
|
|
181
181
|
removeLabel: defineMutator(threadMutatorSchemas.removeLabel, async ({ tx, args: { accounts, labelPath } }) => {
|
|
182
182
|
for (const [accountId, { threadIds }] of Object.entries(accounts)) {
|
|
183
|
-
const label = await tx.query.accountLabel.where('accountId', accountId).where('path', labelPath).one()
|
|
183
|
+
const label = await tx.run(tx.query.accountLabel.where('accountId', accountId).where('path', labelPath).one());
|
|
184
184
|
if (!label) {
|
|
185
185
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
186
186
|
}
|
|
187
187
|
for (const threadId of threadIds) {
|
|
188
188
|
const [thread, messages] = await Promise.all([
|
|
189
|
-
tx.query.thread.where('id', threadId).one()
|
|
190
|
-
tx.query.threadMessage.where('threadId', threadId)
|
|
189
|
+
tx.run(tx.query.thread.where('id', threadId).one()),
|
|
190
|
+
tx.run(tx.query.threadMessage.where('threadId', threadId)),
|
|
191
191
|
]);
|
|
192
192
|
if (!thread) {
|
|
193
193
|
throw new Error(MutationError.ENTITY_NOT_FOUND);
|
|
@@ -247,7 +247,7 @@ export const threadMutators = {
|
|
|
247
247
|
}),
|
|
248
248
|
setSeen: defineMutator(threadMutatorSchemas.setSeen, async ({ tx, args: { accounts, seen } }) => {
|
|
249
249
|
const allThreadIds = Object.values(accounts).flatMap(x => x.threadIds);
|
|
250
|
-
const threads = await tx.query.thread.where('id', 'IN', allThreadIds)
|
|
250
|
+
const threads = await tx.run(tx.query.thread.where('id', 'IN', allThreadIds));
|
|
251
251
|
const labelCounts = new Map();
|
|
252
252
|
for (const thread of threads) {
|
|
253
253
|
if (thread.seen !== seen) {
|
|
@@ -257,7 +257,7 @@ export const threadMutators = {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
if (labelCounts.size > 0) {
|
|
260
|
-
const labels = await tx.query.accountLabel.where('id', 'IN', [...labelCounts.keys()])
|
|
260
|
+
const labels = await tx.run(tx.query.accountLabel.where('id', 'IN', [...labelCounts.keys()]));
|
|
261
261
|
const delta = seen ? -1 : 1;
|
|
262
262
|
await Promise.all(labels
|
|
263
263
|
.filter(x => labelCounts.has(x.id))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/userMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAM5B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;CAiB9B,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"userMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/userMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAM5B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;CAiB9B,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BxB,CAAA"}
|
|
@@ -28,11 +28,7 @@ export const userMutators = {
|
|
|
28
28
|
await tx.mutate(zeroCRUD.user.update({ id, name }));
|
|
29
29
|
}),
|
|
30
30
|
setSettingsPushNotificationToken: defineMutator(userMutatorSchemas.setSettingsPushNotificationToken, async ({ tx, args: { id, pushNotificationToken } }) => {
|
|
31
|
-
const existing = await tx.query.userPushNotificationToken
|
|
32
|
-
.where('userId', id)
|
|
33
|
-
.where('token', pushNotificationToken.token)
|
|
34
|
-
.one()
|
|
35
|
-
.run();
|
|
31
|
+
const existing = await tx.run(tx.query.userPushNotificationToken.where('userId', id).where('token', pushNotificationToken.token).one());
|
|
36
32
|
if (!existing) {
|
|
37
33
|
await tx.mutate(zeroCRUD.userPushNotificationToken.insert({
|
|
38
34
|
createdAt: pushNotificationToken.createdAt,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IMAPSourceLocation.d.ts","sourceRoot":"","sources":["../../src/types/IMAPSourceLocation.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|