@marcoappio/marco-config 2.0.499 → 2.0.500

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.
@@ -42,8 +42,5 @@ export declare const marcoConstants: {
42
42
  };
43
43
  readonly redirectPath: "/v1/wh/oauth/callback";
44
44
  };
45
- zero: {
46
- mutateURL: string;
47
- };
48
45
  };
49
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAO1B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAM1B,CAAA"}
@@ -3,12 +3,10 @@ import { emailAccounts } from './emailAccounts';
3
3
  import { emailProvider } from './emailProvider';
4
4
  import { messages } from './messages';
5
5
  import { oauth } from './oauth';
6
- import { zero } from './zero';
7
6
  export const marcoConstants = {
8
7
  api,
9
8
  emailAccounts,
10
9
  emailProvider,
11
10
  messages,
12
11
  oauth,
13
- zero,
14
12
  };
@@ -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,sBAAsB,CAAA;AACpC,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"}
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"}
@@ -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().run();
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).run();
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).run();
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().run();
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().run();
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().run();
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,K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-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().run();
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().run(),
42
- tx.query.threadMessage.where('threadId', threadId).run(),
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]).run();
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().run();
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().run(),
114
- tx.query.threadMessage.where('threadId', threadId).run(),
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().run()));
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().run();
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).run();
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().run();
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().run(),
190
- tx.query.threadMessage.where('threadId', threadId).run(),
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).run();
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()]).run();
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BxB,CAAA"}
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "2.0.499",
3
+ "version": "2.0.500",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",
@@ -1,4 +0,0 @@
1
- export declare const zero: {
2
- mutateURL: string;
3
- };
4
- //# sourceMappingURL=zero.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zero.d.ts","sourceRoot":"","sources":["../../src/constants/zero.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;CAEhB,CAAA"}
@@ -1,3 +0,0 @@
1
- export const zero = {
2
- mutateURL: 'http://marco-backend.railway.internal:3000/v1/pv/zero/push',
3
- };
@@ -1,7 +0,0 @@
1
- export type IMAPSourceLocation = {
2
- labelId: string;
3
- threadMessageId: string;
4
- uid: number;
5
- uidValidity: number;
6
- };
7
- //# sourceMappingURL=IMAPSourceLocation.d.ts.map
@@ -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 {};