@marcoappio/marco-config 2.0.491 → 2.0.493

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 (70) hide show
  1. package/dist/types/Zero.d.ts +0 -14
  2. package/dist/types/Zero.d.ts.map +1 -1
  3. package/dist/types/index.d.ts +0 -1
  4. package/dist/types/index.d.ts.map +1 -1
  5. package/dist/types/index.js +0 -1
  6. package/dist/zero/index.d.ts +1553 -1439
  7. package/dist/zero/index.d.ts.map +1 -1
  8. package/dist/zero/index.js +2 -4
  9. package/dist/zero/mutators/accountMutators/accountMutators.d.ts +108 -6
  10. package/dist/zero/mutators/accountMutators/accountMutators.d.ts.map +1 -1
  11. package/dist/zero/mutators/accountMutators/accountMutators.js +59 -34
  12. package/dist/zero/mutators/defineMutator.d.ts +16 -0
  13. package/dist/zero/mutators/defineMutator.d.ts.map +1 -0
  14. package/dist/zero/mutators/defineMutator.js +7 -0
  15. package/dist/zero/mutators/draftMutators/draftMutators.d.ts +166 -6
  16. package/dist/zero/mutators/draftMutators/draftMutators.d.ts.map +1 -1
  17. package/dist/zero/mutators/draftMutators/draftMutators.js +101 -40
  18. package/dist/zero/mutators/index.d.ts +2 -1
  19. package/dist/zero/mutators/index.d.ts.map +1 -1
  20. package/dist/zero/mutators/index.js +2 -1
  21. package/dist/zero/mutators/mutators.d.ts +438 -28
  22. package/dist/zero/mutators/mutators.d.ts.map +1 -1
  23. package/dist/zero/mutators/mutators.js +11 -38
  24. package/dist/zero/mutators/threadMutators/threadMutators.d.ts +127 -7
  25. package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
  26. package/dist/zero/mutators/threadMutators/threadMutators.js +40 -30
  27. package/dist/zero/mutators/userMutators/userMutators.d.ts +30 -6
  28. package/dist/zero/mutators/userMutators/userMutators.d.ts.map +1 -1
  29. package/dist/zero/mutators/userMutators/userMutators.js +25 -11
  30. package/dist/zero/queries/getAccounts.d.ts +134 -134
  31. package/dist/zero/queries/getContacts.d.ts +134 -134
  32. package/dist/zero/queries/getDrafts.d.ts +134 -134
  33. package/dist/zero/queries/getThread.d.ts +134 -134
  34. package/dist/zero/queries/getThreadList.d.ts +134 -134
  35. package/dist/zero/queries/getThreads.d.ts +134 -134
  36. package/dist/zero/queries/getUser.d.ts +134 -134
  37. package/dist/zero/queries/index.d.ts +132 -132
  38. package/dist/zero/schema.d.ts +132 -132
  39. package/dist/zero/schema.d.ts.map +1 -1
  40. package/package.json +2 -2
  41. package/dist/types/AuthData.d.ts +0 -4
  42. package/dist/types/AuthData.d.ts.map +0 -1
  43. package/dist/types/AuthData.js +0 -1
  44. package/dist/zero/mutatorSchemas/account.d.ts +0 -80
  45. package/dist/zero/mutatorSchemas/account.d.ts.map +0 -1
  46. package/dist/zero/mutatorSchemas/account.js +0 -66
  47. package/dist/zero/mutatorSchemas/draft.d.ts +0 -150
  48. package/dist/zero/mutatorSchemas/draft.d.ts.map +0 -1
  49. package/dist/zero/mutatorSchemas/draft.js +0 -104
  50. package/dist/zero/mutatorSchemas/index.d.ts +0 -323
  51. package/dist/zero/mutatorSchemas/index.d.ts.map +0 -1
  52. package/dist/zero/mutatorSchemas/index.js +0 -10
  53. package/dist/zero/mutatorSchemas/thread.d.ts +0 -71
  54. package/dist/zero/mutatorSchemas/thread.d.ts.map +0 -1
  55. package/dist/zero/mutatorSchemas/thread.js +0 -47
  56. package/dist/zero/mutatorSchemas/user.d.ts +0 -26
  57. package/dist/zero/mutatorSchemas/user.d.ts.map +0 -1
  58. package/dist/zero/mutatorSchemas/user.js +0 -27
  59. package/dist/zero/mutators/accountMutators/accountMutators.test.d.ts +0 -2
  60. package/dist/zero/mutators/accountMutators/accountMutators.test.d.ts.map +0 -1
  61. package/dist/zero/mutators/accountMutators/accountMutators.test.js +0 -390
  62. package/dist/zero/mutators/draftMutators/draftMutators.test.d.ts +0 -2
  63. package/dist/zero/mutators/draftMutators/draftMutators.test.d.ts.map +0 -1
  64. package/dist/zero/mutators/draftMutators/draftMutators.test.js +0 -416
  65. package/dist/zero/mutators/threadMutators/threadMutators.test.d.ts +0 -2
  66. package/dist/zero/mutators/threadMutators/threadMutators.test.d.ts.map +0 -1
  67. package/dist/zero/mutators/threadMutators/threadMutators.test.js +0 -755
  68. package/dist/zero/mutators/userMutators/userMutators.test.d.ts +0 -2
  69. package/dist/zero/mutators/userMutators/userMutators.test.d.ts.map +0 -1
  70. package/dist/zero/mutators/userMutators/userMutators.test.js +0 -84
@@ -1,390 +0,0 @@
1
- import { describe, expect, it, mock } from 'bun:test';
2
- import { createMutators, ZeroMutatorValidationError } from '../mutators';
3
- describe('accountMutators', () => {
4
- describe('createAccount', () => {
5
- it('creates an account and invokes the callback', async () => {
6
- const accountInsert = mock(async () => { });
7
- const accountAliasInsert = mock(async () => { });
8
- const createAccountCallback = mock(() => { });
9
- const mutators = createMutators({ sub: 'test-user-id' }, {
10
- account: {
11
- createAccount: createAccountCallback,
12
- },
13
- });
14
- const payload = {
15
- aliasId: 'test-alias-id-1',
16
- color: '#ff0000',
17
- emailAddress: 'user@example.com',
18
- id: 'test-account-id-1',
19
- };
20
- const transaction = {
21
- mutate: {
22
- account: {
23
- delete: mock(async () => { }),
24
- insert: accountInsert,
25
- update: mock(async () => { }),
26
- },
27
- accountAlias: {
28
- delete: mock(async () => { }),
29
- insert: accountAliasInsert,
30
- update: mock(async () => { }),
31
- },
32
- },
33
- query: {},
34
- };
35
- await mutators.account.createAccount(transaction, payload);
36
- expect(accountInsert).toHaveBeenCalledWith({
37
- color: payload.color,
38
- displayName: null,
39
- id: payload.id,
40
- imapConnectionStatus: 'AWAITING_CONNECTION',
41
- mailProcessedCount: 0,
42
- mailTotalCount: 0,
43
- primaryAliasId: payload.aliasId,
44
- userId: 'test-user-id',
45
- });
46
- expect(accountAliasInsert).toHaveBeenCalledWith({
47
- accountId: payload.id,
48
- emailAddress: payload.emailAddress,
49
- id: payload.aliasId,
50
- isPrimary: true,
51
- name: null,
52
- });
53
- expect(createAccountCallback).toHaveBeenCalledWith(payload);
54
- expect(accountInsert.mock.invocationCallOrder[0]).toBeLessThan(accountAliasInsert.mock.invocationCallOrder[0]);
55
- });
56
- it('throws ZeroMutatorValidationError on invalid payloads', async () => {
57
- const mutators = createMutators({ sub: 'test-user-id' });
58
- await expect(mutators.account.createAccount({
59
- mutate: {},
60
- query: {},
61
- }, {
62
- aliasId: 'test-alias-id-1',
63
- color: 'blue',
64
- emailAddress: 'invalid-email',
65
- id: 'test-account-id-1',
66
- })).rejects.toBeInstanceOf(ZeroMutatorValidationError);
67
- });
68
- });
69
- describe('createAlias', () => {
70
- it('creates an alias', async () => {
71
- const accountAliasInsert = mock(async () => { });
72
- const createAliasCallback = mock(() => { });
73
- const mutators = createMutators({ sub: 'test-user-id' }, {
74
- account: {
75
- createAlias: createAliasCallback,
76
- },
77
- });
78
- const transaction = {
79
- mutate: {
80
- accountAlias: {
81
- delete: mock(async () => { }),
82
- insert: accountAliasInsert,
83
- update: mock(async () => { }),
84
- },
85
- },
86
- query: {},
87
- };
88
- await mutators.account.createAlias(transaction, {
89
- accountId: 'test-account-id-1',
90
- alias: {
91
- emailAddress: 'alias@example.com',
92
- id: 'test-alias-id-2',
93
- name: 'Work Email',
94
- },
95
- });
96
- expect(accountAliasInsert).toHaveBeenCalledWith({
97
- accountId: 'test-account-id-1',
98
- emailAddress: 'alias@example.com',
99
- id: 'test-alias-id-2',
100
- isPrimary: false,
101
- name: 'Work Email',
102
- });
103
- expect(createAliasCallback).toHaveBeenCalled();
104
- });
105
- });
106
- describe('deleteAccount', () => {
107
- it('deletes an account', async () => {
108
- const accountDelete = mock(async () => { });
109
- const deleteAccountCallback = mock(() => { });
110
- const mutators = createMutators({ sub: 'test-user-id' }, {
111
- account: {
112
- deleteAccount: deleteAccountCallback,
113
- },
114
- });
115
- const transaction = {
116
- mutate: {
117
- account: {
118
- delete: accountDelete,
119
- insert: mock(async () => { }),
120
- update: mock(async () => { }),
121
- },
122
- },
123
- query: {},
124
- };
125
- await mutators.account.deleteAccount(transaction, {
126
- id: 'test-account-id-1',
127
- });
128
- expect(accountDelete).toHaveBeenCalledWith({
129
- id: 'test-account-id-1',
130
- });
131
- expect(deleteAccountCallback).toHaveBeenCalled();
132
- });
133
- });
134
- describe('deleteAlias', () => {
135
- it('deletes a non-primary alias', async () => {
136
- const aliasRecord = {
137
- id: 'test-alias-id-2',
138
- isPrimary: false,
139
- };
140
- const run = mock(async () => aliasRecord);
141
- const one = mock(() => ({ run }));
142
- const where = mock(() => ({ one }));
143
- const accountAliasDelete = mock(async () => { });
144
- const transaction = {
145
- mutate: {
146
- accountAlias: {
147
- delete: accountAliasDelete,
148
- insert: mock(async () => { }),
149
- update: mock(async () => { }),
150
- },
151
- },
152
- query: {
153
- accountAlias: {
154
- where,
155
- },
156
- },
157
- };
158
- const mutators = createMutators();
159
- await mutators.account.deleteAlias(transaction, {
160
- accountId: 'test-account-id-1',
161
- aliasId: 'test-alias-id-2',
162
- });
163
- expect(accountAliasDelete).toHaveBeenCalledWith({
164
- id: 'test-alias-id-2',
165
- });
166
- });
167
- it('deletes a primary alias and assigns new primary', async () => {
168
- const aliasRecord = {
169
- id: 'test-alias-id-1',
170
- isPrimary: true,
171
- };
172
- const remainingAliases = [
173
- {
174
- id: 'test-alias-id-2',
175
- isPrimary: false,
176
- },
177
- ];
178
- const runOne = mock(async () => aliasRecord);
179
- const one = mock(() => ({ run: runOne }));
180
- const runList = mock(async () => remainingAliases);
181
- const where = mock((field) => {
182
- if (field === 'accountId') {
183
- return { run: runList };
184
- }
185
- return { one };
186
- });
187
- const accountAliasDelete = mock(async () => { });
188
- const accountAliasUpdate = mock(async () => { });
189
- const accountUpdate = mock(async () => { });
190
- const transaction = {
191
- mutate: {
192
- account: {
193
- delete: mock(async () => { }),
194
- insert: mock(async () => { }),
195
- update: accountUpdate,
196
- },
197
- accountAlias: {
198
- delete: accountAliasDelete,
199
- insert: mock(async () => { }),
200
- update: accountAliasUpdate,
201
- },
202
- },
203
- query: {
204
- accountAlias: {
205
- where,
206
- },
207
- },
208
- };
209
- const mutators = createMutators();
210
- await mutators.account.deleteAlias(transaction, {
211
- accountId: 'test-account-id-1',
212
- aliasId: 'test-alias-id-1',
213
- });
214
- expect(accountAliasDelete).toHaveBeenCalledWith({
215
- id: 'test-alias-id-1',
216
- });
217
- expect(accountAliasUpdate).toHaveBeenCalledWith({
218
- id: 'test-alias-id-2',
219
- isPrimary: true,
220
- });
221
- expect(accountUpdate).toHaveBeenCalledWith({
222
- id: 'test-account-id-1',
223
- primaryAliasId: 'test-alias-id-2',
224
- });
225
- });
226
- });
227
- describe('setAliasName', () => {
228
- it('sets alias name', async () => {
229
- const accountAliasUpdate = mock(async () => { });
230
- const transaction = {
231
- mutate: {
232
- accountAlias: {
233
- delete: mock(async () => { }),
234
- insert: mock(async () => { }),
235
- update: accountAliasUpdate,
236
- },
237
- },
238
- query: {},
239
- };
240
- const mutators = createMutators();
241
- await mutators.account.setAliasName(transaction, {
242
- accountId: 'test-account-id-1',
243
- aliasId: 'test-alias-id-1',
244
- displayName: 'New Name',
245
- });
246
- expect(accountAliasUpdate).toHaveBeenCalledWith({
247
- id: 'test-alias-id-1',
248
- name: 'New Name',
249
- });
250
- });
251
- });
252
- describe('setAliasPrimary', () => {
253
- it('sets alias as primary', async () => {
254
- const aliases = [
255
- { id: 'test-alias-id-1', isPrimary: true },
256
- { id: 'test-alias-id-2', isPrimary: false },
257
- ];
258
- const run = mock(async () => aliases);
259
- const where = mock(() => ({ run }));
260
- const accountAliasUpdate = mock(async () => { });
261
- const accountUpdate = mock(async () => { });
262
- const transaction = {
263
- mutate: {
264
- account: {
265
- delete: mock(async () => { }),
266
- insert: mock(async () => { }),
267
- update: accountUpdate,
268
- },
269
- accountAlias: {
270
- delete: mock(async () => { }),
271
- insert: mock(async () => { }),
272
- update: accountAliasUpdate,
273
- },
274
- },
275
- query: {
276
- accountAlias: {
277
- where,
278
- },
279
- },
280
- };
281
- const mutators = createMutators();
282
- await mutators.account.setAliasPrimary(transaction, {
283
- accountId: 'test-account-id-1',
284
- aliasId: 'test-alias-id-2',
285
- });
286
- expect(accountAliasUpdate).toHaveBeenCalledTimes(2);
287
- expect(accountAliasUpdate).toHaveBeenCalledWith({
288
- id: 'test-alias-id-1',
289
- isPrimary: false,
290
- });
291
- expect(accountAliasUpdate).toHaveBeenCalledWith({
292
- id: 'test-alias-id-2',
293
- isPrimary: true,
294
- });
295
- expect(accountUpdate).toHaveBeenCalledWith({
296
- id: 'test-account-id-1',
297
- primaryAliasId: 'test-alias-id-2',
298
- });
299
- });
300
- });
301
- describe('setConnectionConfigImapRaw', () => {
302
- it('sets connection config for IMAP raw', async () => {
303
- const accountUpdate = mock(async () => { });
304
- const transaction = {
305
- mutate: {
306
- account: {
307
- delete: mock(async () => { }),
308
- insert: mock(async () => { }),
309
- update: accountUpdate,
310
- },
311
- },
312
- query: {},
313
- };
314
- const mutators = createMutators();
315
- await mutators.account.setConnectionConfigImapRaw(transaction, {
316
- connectionConfig: {
317
- imapHost: 'imap.example.com',
318
- imapPassword: 'test-password',
319
- imapPort: 993,
320
- imapSocketType: 'SSL',
321
- imapUser: 'user@example.com',
322
- smtpHost: 'smtp.example.com',
323
- smtpPassword: 'test-password',
324
- smtpPort: 465,
325
- smtpSocketType: 'SSL',
326
- smtpUser: 'user@example.com',
327
- },
328
- id: 'test-account-id-1',
329
- });
330
- expect(accountUpdate).toHaveBeenCalledWith({
331
- id: 'test-account-id-1',
332
- imapConnectionStatus: 'AWAITING_CONNECTION',
333
- });
334
- });
335
- });
336
- describe('setConnectionConfigOauth', () => {
337
- it('sets connection config for OAuth', async () => {
338
- const accountUpdate = mock(async () => { });
339
- const transaction = {
340
- mutate: {
341
- account: {
342
- delete: mock(async () => { }),
343
- insert: mock(async () => { }),
344
- update: accountUpdate,
345
- },
346
- },
347
- query: {},
348
- };
349
- const mutators = createMutators();
350
- await mutators.account.setConnectionConfigOauth(transaction, {
351
- connectionConfig: {
352
- code: 'test-auth-code',
353
- provider: 'GOOGLE',
354
- user: 'user@example.com',
355
- },
356
- id: 'test-account-id-1',
357
- });
358
- expect(accountUpdate).toHaveBeenCalledWith({
359
- id: 'test-account-id-1',
360
- imapConnectionStatus: 'AWAITING_CONNECTION',
361
- });
362
- });
363
- });
364
- describe('setSettings', () => {
365
- it('sets account settings', async () => {
366
- const accountUpdate = mock(async () => { });
367
- const transaction = {
368
- mutate: {
369
- account: {
370
- delete: mock(async () => { }),
371
- insert: mock(async () => { }),
372
- update: accountUpdate,
373
- },
374
- },
375
- query: {},
376
- };
377
- const mutators = createMutators();
378
- await mutators.account.setSettings(transaction, {
379
- color: '#00ff00',
380
- displayName: 'Work Account',
381
- id: 'test-account-id-1',
382
- });
383
- expect(accountUpdate).toHaveBeenCalledWith({
384
- color: '#00ff00',
385
- displayName: 'Work Account',
386
- id: 'test-account-id-1',
387
- });
388
- });
389
- });
390
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=draftMutators.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"draftMutators.test.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/draftMutators/draftMutators.test.ts"],"names":[],"mappings":""}