@marcoappio/marco-config 2.0.490 → 2.0.492

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.
Files changed (25) hide show
  1. package/dist/zero/index.d.ts +28 -46
  2. package/dist/zero/index.d.ts.map +1 -1
  3. package/dist/zero/mutatorSchemas/index.d.ts +27 -45
  4. package/dist/zero/mutatorSchemas/index.d.ts.map +1 -1
  5. package/dist/zero/mutatorSchemas/thread.d.ts +27 -45
  6. package/dist/zero/mutatorSchemas/thread.d.ts.map +1 -1
  7. package/dist/zero/mutatorSchemas/thread.js +12 -20
  8. package/dist/zero/mutators/accountMutators/accountMutators.d.ts +1 -5
  9. package/dist/zero/mutators/accountMutators/accountMutators.d.ts.map +1 -1
  10. package/dist/zero/mutators/accountMutators/accountMutators.js +1 -10
  11. package/dist/zero/mutators/accountMutators/accountMutators.test.js +4 -22
  12. package/dist/zero/mutators/draftMutators/draftMutators.d.ts +1 -5
  13. package/dist/zero/mutators/draftMutators/draftMutators.d.ts.map +1 -1
  14. package/dist/zero/mutators/draftMutators/draftMutators.js +5 -16
  15. package/dist/zero/mutators/mutators.d.ts +3 -14
  16. package/dist/zero/mutators/mutators.d.ts.map +1 -1
  17. package/dist/zero/mutators/mutators.js +5 -5
  18. package/dist/zero/mutators/threadMutators/threadMutators.d.ts +1 -5
  19. package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
  20. package/dist/zero/mutators/threadMutators/threadMutators.js +130 -122
  21. package/dist/zero/mutators/threadMutators/threadMutators.test.js +14 -14
  22. package/dist/zero/mutators/userMutators/userMutators.d.ts +1 -5
  23. package/dist/zero/mutators/userMutators/userMutators.d.ts.map +1 -1
  24. package/dist/zero/mutators/userMutators/userMutators.js +1 -4
  25. package/package.json +1 -1
@@ -79,8 +79,8 @@ describe('threadMutators', () => {
79
79
  };
80
80
  const mutators = createMutators();
81
81
  await mutators.thread.addLabel(transaction, {
82
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
82
83
  labelPath: 'Work',
83
- threadIds: ['test-thread-id-1'],
84
84
  });
85
85
  expect(threadLabelInsert).toHaveBeenCalledTimes(2);
86
86
  expect(threadLabelInsert).toHaveBeenCalledWith(expect.objectContaining({
@@ -139,7 +139,7 @@ describe('threadMutators', () => {
139
139
  };
140
140
  const mutators = createMutators();
141
141
  await mutators.thread.delete(transaction, {
142
- threadIds: ['test-thread-id-1', 'test-thread-id-2'],
142
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1', 'test-thread-id-2'] } },
143
143
  });
144
144
  expect(threadDelete).toHaveBeenCalledTimes(2);
145
145
  expect(threadDelete).toHaveBeenCalledWith({ id: 'test-thread-id-1' });
@@ -174,7 +174,7 @@ describe('threadMutators', () => {
174
174
  };
175
175
  const mutators = createMutators();
176
176
  await mutators.thread.delete(transaction, {
177
- threadIds: ['test-thread-id-1'],
177
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
178
178
  });
179
179
  expect(threadDelete).toHaveBeenCalledTimes(1);
180
180
  expect(labelUpdate).not.toHaveBeenCalled();
@@ -198,7 +198,7 @@ describe('threadMutators', () => {
198
198
  };
199
199
  const mutators = createMutators();
200
200
  await mutators.thread.delete(transaction, {
201
- threadIds: ['non-existent-thread'],
201
+ accounts: { 'test-account-id-1': { threadIds: ['non-existent-thread'] } },
202
202
  });
203
203
  expect(threadDelete).not.toHaveBeenCalled();
204
204
  });
@@ -257,8 +257,8 @@ describe('threadMutators', () => {
257
257
  };
258
258
  const mutators = createMutators();
259
259
  await mutators.thread.removeLabel(transaction, {
260
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
260
261
  labelPath: 'Work',
261
- threadIds: ['test-thread-id-1'],
262
262
  });
263
263
  expect(threadLabelDelete).toHaveBeenCalledTimes(2);
264
264
  expect(threadLabelDelete).toHaveBeenCalledWith({
@@ -341,7 +341,7 @@ describe('threadMutators', () => {
341
341
  };
342
342
  const mutators = createMutators();
343
343
  await mutators.thread.setArchive(transaction, {
344
- threadIds: ['test-thread-id-1'],
344
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
345
345
  });
346
346
  expect(threadLabelDelete).toHaveBeenCalledWith({
347
347
  accountId: 'test-account-id-1',
@@ -373,8 +373,8 @@ describe('threadMutators', () => {
373
373
  };
374
374
  const mutators = createMutators();
375
375
  await mutators.thread.setFlagged(transaction, {
376
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
376
377
  flagged: true,
377
- threadIds: ['test-thread-id-1'],
378
378
  });
379
379
  expect(threadUpdate).toHaveBeenCalledWith({
380
380
  flagged: true,
@@ -446,7 +446,7 @@ describe('threadMutators', () => {
446
446
  };
447
447
  const mutators = createMutators();
448
448
  await mutators.thread.setInbox(transaction, {
449
- threadIds: ['test-thread-id-1'],
449
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
450
450
  });
451
451
  expect(threadLabelDelete).toHaveBeenCalledWith({
452
452
  accountId: 'test-account-id-1',
@@ -498,8 +498,8 @@ describe('threadMutators', () => {
498
498
  };
499
499
  const mutators = createMutators();
500
500
  await mutators.thread.setSeen(transaction, {
501
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1', 'test-thread-id-2'] } },
501
502
  seen: true,
502
- threadIds: ['test-thread-id-1', 'test-thread-id-2'],
503
503
  });
504
504
  expect(threadUpdate).toHaveBeenCalledTimes(2);
505
505
  expect(labelUpdate).toHaveBeenCalledWith({
@@ -536,8 +536,8 @@ describe('threadMutators', () => {
536
536
  };
537
537
  const mutators = createMutators();
538
538
  await mutators.thread.setSeen(transaction, {
539
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
539
540
  seen: false,
540
- threadIds: ['test-thread-id-1'],
541
541
  });
542
542
  expect(threadUpdate).toHaveBeenCalledTimes(1);
543
543
  expect(labelUpdate).toHaveBeenCalledWith({
@@ -568,8 +568,8 @@ describe('threadMutators', () => {
568
568
  };
569
569
  const mutators = createMutators();
570
570
  await mutators.thread.setSeen(transaction, {
571
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
571
572
  seen: true,
572
- threadIds: ['test-thread-id-1'],
573
573
  });
574
574
  expect(threadUpdate).toHaveBeenCalledTimes(1);
575
575
  expect(labelUpdate).not.toHaveBeenCalled();
@@ -597,8 +597,8 @@ describe('threadMutators', () => {
597
597
  };
598
598
  const mutators = createMutators();
599
599
  await mutators.thread.setSeen(transaction, {
600
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
600
601
  seen: true,
601
- threadIds: ['test-thread-id-1'],
602
602
  });
603
603
  expect(threadUpdate).toHaveBeenCalledTimes(1);
604
604
  expect(labelUpdate).not.toHaveBeenCalled();
@@ -664,7 +664,7 @@ describe('threadMutators', () => {
664
664
  };
665
665
  const mutators = createMutators();
666
666
  await mutators.thread.setSpam(transaction, {
667
- threadIds: ['test-thread-id-1'],
667
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
668
668
  });
669
669
  expect(threadLabelInsert).toHaveBeenCalledWith(expect.objectContaining({
670
670
  accountId: 'test-account-id-1',
@@ -738,7 +738,7 @@ describe('threadMutators', () => {
738
738
  };
739
739
  const mutators = createMutators();
740
740
  await mutators.thread.setTrash(transaction, {
741
- threadIds: ['test-thread-id-1'],
741
+ accounts: { 'test-account-id-1': { threadIds: ['test-thread-id-1'] } },
742
742
  });
743
743
  expect(threadLabelInsert).toHaveBeenCalledWith(expect.objectContaining({
744
744
  accountId: 'test-account-id-1',
@@ -1,8 +1,4 @@
1
- import type * as v from 'valibot';
2
1
  import type { AuthData, HandlerMap } from '../../../types';
3
2
  import type { ZeroMutatorSchemas } from '../../../zero/mutatorSchemas';
4
- export type UserMutatorCallbacks = {
5
- [K in keyof ZeroMutatorSchemas['user']]?: (args: v.InferOutput<ZeroMutatorSchemas['user'][K]['delta']>) => Promise<void>;
6
- };
7
- export declare const createUserMutators: (_authData: AuthData | undefined, callbacks?: UserMutatorCallbacks) => HandlerMap<ZeroMutatorSchemas["user"]>;
3
+ export declare const createUserMutators: (_authData: AuthData | undefined) => HandlerMap<ZeroMutatorSchemas["user"]>;
8
4
  //# sourceMappingURL=userMutators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"userMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/userMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AAEjC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,MAAM,MAAM,oBAAoB,GAAG;KAChC,CAAC,IAAI,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACxC,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KACxD,OAAO,CAAC,IAAI,CAAC;CACnB,CAAA;AAED,eAAO,MAAM,kBAAkB,cAClB,QAAQ,GAAG,SAAS,cACnB,oBAAoB,KAC/B,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAkCtC,CAAA"}
1
+ {"version":3,"file":"userMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/userMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,eAAO,MAAM,kBAAkB,cAAe,QAAQ,GAAG,SAAS,KAAG,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CA4BxG,CAAA"}
@@ -1,16 +1,14 @@
1
- export const createUserMutators = (_authData, callbacks) => ({
1
+ export const createUserMutators = (_authData) => ({
2
2
  deleteSettingsPushNotificationToken: async (tx, args) => {
3
3
  await tx.mutate.userPushNotificationToken.delete({
4
4
  id: args.id,
5
5
  });
6
- callbacks?.deleteSettingsPushNotificationToken?.(args);
7
6
  },
8
7
  setSettingsName: async (tx, args) => {
9
8
  await tx.mutate.user.update({
10
9
  id: args.id,
11
10
  name: args.name,
12
11
  });
13
- callbacks?.setSettingsName?.(args);
14
12
  },
15
13
  setSettingsPushNotificationToken: async (tx, args) => {
16
14
  const existing = await tx.query.userPushNotificationToken
@@ -25,7 +23,6 @@ export const createUserMutators = (_authData, callbacks) => ({
25
23
  token: args.pushNotificationToken.token,
26
24
  userId: args.id,
27
25
  });
28
- callbacks?.setSettingsPushNotificationToken?.(args);
29
26
  }
30
27
  },
31
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "2.0.490",
3
+ "version": "2.0.492",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",