@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,416 +0,0 @@
1
- import { describe, expect, it, mock } from 'bun:test';
2
- import { createMutators } from '../mutators';
3
- describe('draftMutators', () => {
4
- describe('scheduleSend', () => {
5
- it('marks immediate schedule send drafts as send requested', async () => {
6
- const draftUpdate = mock(async () => { });
7
- const transaction = {
8
- mutate: {
9
- draft: {
10
- delete: mock(async () => { }),
11
- insert: mock(async () => { }),
12
- update: draftUpdate,
13
- },
14
- },
15
- query: {},
16
- };
17
- const mutators = createMutators();
18
- await mutators.draft.scheduleSend(transaction, {
19
- id: 'test-draft-id-1',
20
- kind: 'IMMEDIATE',
21
- undoMs: 15_000,
22
- updatedAt: 1_000,
23
- });
24
- expect(draftUpdate).toHaveBeenCalledWith({
25
- id: 'test-draft-id-1',
26
- scheduledFor: 16_000,
27
- status: 'SEND_REQUESTED',
28
- updatedAt: 1_000,
29
- });
30
- });
31
- });
32
- describe('setContent', () => {
33
- it('applies string patches when updating draft content', async () => {
34
- const draftRecord = {
35
- body: { content: 'hello' },
36
- id: 'test-draft-id-1',
37
- };
38
- const run = mock(async () => draftRecord);
39
- const one = mock(() => ({ run }));
40
- const where = mock(() => ({ one }));
41
- const draftUpdate = mock(async () => { });
42
- const transaction = {
43
- mutate: {
44
- draft: {
45
- delete: mock(async () => { }),
46
- insert: mock(async () => { }),
47
- update: draftUpdate,
48
- },
49
- },
50
- query: {
51
- draft: {
52
- where,
53
- },
54
- },
55
- };
56
- const mutators = createMutators();
57
- await mutators.draft.setContent(transaction, {
58
- id: 'test-draft-id-1',
59
- patch: [
60
- {
61
- index: 5,
62
- type: 'INSERTION',
63
- value: '!',
64
- },
65
- ],
66
- updatedAt: 2_000,
67
- });
68
- expect(where).toHaveBeenCalledWith('id', 'test-draft-id-1');
69
- expect(draftUpdate).toHaveBeenCalledWith({
70
- body: {
71
- content: 'hello!',
72
- },
73
- id: 'test-draft-id-1',
74
- updatedAt: 2_000,
75
- });
76
- });
77
- });
78
- describe('cancelSend', () => {
79
- it('cancels draft send', async () => {
80
- const draftRecord = {
81
- id: 'test-draft-id-1',
82
- status: 'SEND_REQUESTED',
83
- };
84
- const run = mock(async () => draftRecord);
85
- const one = mock(() => ({ run }));
86
- const where = mock(() => ({ one }));
87
- const draftUpdate = mock(async () => { });
88
- const transaction = {
89
- mutate: {
90
- draft: {
91
- delete: mock(async () => { }),
92
- insert: mock(async () => { }),
93
- update: draftUpdate,
94
- },
95
- },
96
- query: {
97
- draft: {
98
- where,
99
- },
100
- },
101
- };
102
- const mutators = createMutators();
103
- await mutators.draft.cancelSend(transaction, {
104
- id: 'test-draft-id-1',
105
- updatedAt: 5_000,
106
- });
107
- expect(draftUpdate).toHaveBeenCalledWith({
108
- id: 'test-draft-id-1',
109
- scheduledFor: null,
110
- status: 'DRAFT',
111
- updatedAt: 5_000,
112
- });
113
- });
114
- it('throws error when draft is already sent', async () => {
115
- const draftRecord = {
116
- id: 'test-draft-id-1',
117
- status: 'SEND_CONFIRMED',
118
- };
119
- const run = mock(async () => draftRecord);
120
- const one = mock(() => ({ run }));
121
- const where = mock(() => ({ one }));
122
- const draftUpdate = mock(async () => { });
123
- const transaction = {
124
- mutate: {
125
- draft: {
126
- delete: mock(async () => { }),
127
- insert: mock(async () => { }),
128
- update: draftUpdate,
129
- },
130
- },
131
- query: {
132
- draft: {
133
- where,
134
- },
135
- },
136
- };
137
- const mutators = createMutators();
138
- await expect(mutators.draft.cancelSend(transaction, {
139
- id: 'test-draft-id-1',
140
- updatedAt: 5_000,
141
- })).rejects.toThrow('MutationError/ALREADY_APPLIED');
142
- expect(draftUpdate).not.toHaveBeenCalled();
143
- });
144
- it('throws error when draft not found', async () => {
145
- const run = mock(async () => null);
146
- const one = mock(() => ({ run }));
147
- const where = mock(() => ({ one }));
148
- const draftUpdate = mock(async () => { });
149
- const transaction = {
150
- mutate: {
151
- draft: {
152
- delete: mock(async () => { }),
153
- insert: mock(async () => { }),
154
- update: draftUpdate,
155
- },
156
- },
157
- query: {
158
- draft: {
159
- where,
160
- },
161
- },
162
- };
163
- const mutators = createMutators();
164
- await expect(mutators.draft.cancelSend(transaction, {
165
- id: 'test-draft-id-1',
166
- updatedAt: 5_000,
167
- })).rejects.toThrow('MutationError/ENTITY_NOT_FOUND');
168
- expect(draftUpdate).not.toHaveBeenCalled();
169
- });
170
- });
171
- describe('createAttachment', () => {
172
- it('creates draft attachment', async () => {
173
- const draftAttachmentInsert = mock(async () => { });
174
- const draftUpdate = mock(async () => { });
175
- const transaction = {
176
- mutate: {
177
- draft: {
178
- delete: mock(async () => { }),
179
- insert: mock(async () => { }),
180
- update: draftUpdate,
181
- },
182
- draftAttachment: {
183
- delete: mock(async () => { }),
184
- insert: draftAttachmentInsert,
185
- update: mock(async () => { }),
186
- },
187
- },
188
- query: {},
189
- };
190
- const mutators = createMutators();
191
- await mutators.draft.createAttachment(transaction, {
192
- attachment: {
193
- fileName: 'test-document.pdf',
194
- id: 'test-attachment-id-1',
195
- mimeType: 'application/pdf',
196
- status: 'PENDING',
197
- totalSize: 1024000,
198
- },
199
- id: 'test-draft-id-1',
200
- updatedAt: 3_000,
201
- });
202
- expect(draftAttachmentInsert).toHaveBeenCalledWith({
203
- draftId: 'test-draft-id-1',
204
- fileName: 'test-document.pdf',
205
- id: 'test-attachment-id-1',
206
- mimeType: 'application/pdf',
207
- status: 'PENDING',
208
- totalSize: 1024000,
209
- });
210
- expect(draftUpdate).toHaveBeenCalledWith({
211
- id: 'test-draft-id-1',
212
- updatedAt: 3_000,
213
- });
214
- });
215
- });
216
- describe('createDraft', () => {
217
- it('creates a draft', async () => {
218
- const draftInsert = mock(async () => { });
219
- const transaction = {
220
- mutate: {
221
- draft: {
222
- delete: mock(async () => { }),
223
- insert: draftInsert,
224
- update: mock(async () => { }),
225
- },
226
- draftAttachment: {
227
- delete: mock(async () => { }),
228
- insert: mock(async () => { }),
229
- update: mock(async () => { }),
230
- },
231
- },
232
- query: {},
233
- };
234
- const mutators = createMutators({ sub: 'test-user-id' });
235
- await mutators.draft.createDraft(transaction, {
236
- accountId: 'test-account-id-1',
237
- attachments: [],
238
- body: {
239
- bcc: [],
240
- cc: [],
241
- content: 'Draft content',
242
- subject: 'Test Subject',
243
- to: ['recipient@example.com'],
244
- },
245
- error: null,
246
- from: 'sender@example.com',
247
- fromName: 'Test Sender',
248
- id: 'test-draft-id-2',
249
- referencedMessageId: null,
250
- scheduledFor: null,
251
- status: 'DRAFT',
252
- type: 'NEW',
253
- updatedAt: 1_000,
254
- });
255
- expect(draftInsert).toHaveBeenCalledWith({
256
- accountId: 'test-account-id-1',
257
- body: {
258
- bcc: [],
259
- cc: [],
260
- content: 'Draft content',
261
- to: ['recipient@example.com'],
262
- },
263
- error: null,
264
- fromAliasId: null,
265
- fromEmail: 'sender@example.com',
266
- fromName: 'Test Sender',
267
- id: 'test-draft-id-2',
268
- referencedMessageId: null,
269
- scheduledFor: null,
270
- status: 'DRAFT',
271
- subject: 'Test Subject',
272
- type: 'NEW',
273
- updatedAt: 1_000,
274
- userId: 'test-user-id',
275
- });
276
- });
277
- });
278
- describe('deleteAttachment', () => {
279
- it('deletes draft attachment', async () => {
280
- const draftAttachmentDelete = mock(async () => { });
281
- const draftUpdate = mock(async () => { });
282
- const transaction = {
283
- mutate: {
284
- draft: {
285
- delete: mock(async () => { }),
286
- insert: mock(async () => { }),
287
- update: draftUpdate,
288
- },
289
- draftAttachment: {
290
- delete: draftAttachmentDelete,
291
- insert: mock(async () => { }),
292
- update: mock(async () => { }),
293
- },
294
- },
295
- query: {},
296
- };
297
- const mutators = createMutators();
298
- await mutators.draft.deleteAttachment(transaction, {
299
- attachmentId: 'test-attachment-id-1',
300
- id: 'test-draft-id-1',
301
- updatedAt: 4_000,
302
- });
303
- expect(draftAttachmentDelete).toHaveBeenCalledWith({
304
- id: 'test-attachment-id-1',
305
- });
306
- expect(draftUpdate).toHaveBeenCalledWith({
307
- id: 'test-draft-id-1',
308
- updatedAt: 4_000,
309
- });
310
- });
311
- });
312
- describe('deleteDraft', () => {
313
- it('deletes a draft', async () => {
314
- const draftDelete = mock(async () => { });
315
- const transaction = {
316
- mutate: {
317
- draft: {
318
- delete: draftDelete,
319
- insert: mock(async () => { }),
320
- update: mock(async () => { }),
321
- },
322
- },
323
- query: {},
324
- };
325
- const mutators = createMutators();
326
- await mutators.draft.deleteDraft(transaction, {
327
- id: 'test-draft-id-1',
328
- });
329
- expect(draftDelete).toHaveBeenCalledWith({
330
- id: 'test-draft-id-1',
331
- });
332
- });
333
- });
334
- describe('setEnvelope', () => {
335
- it('sets draft envelope', async () => {
336
- const draftRecord = {
337
- body: {
338
- content: 'Existing content',
339
- },
340
- id: 'test-draft-id-1',
341
- };
342
- const run = mock(async () => draftRecord);
343
- const one = mock(() => ({ run }));
344
- const where = mock(() => ({ one }));
345
- const draftUpdate = mock(async () => { });
346
- const transaction = {
347
- mutate: {
348
- draft: {
349
- delete: mock(async () => { }),
350
- insert: mock(async () => { }),
351
- update: draftUpdate,
352
- },
353
- },
354
- query: {
355
- draft: {
356
- where,
357
- },
358
- },
359
- };
360
- const mutators = createMutators();
361
- await mutators.draft.setEnvelope(transaction, {
362
- envelope: {
363
- bcc: ['bcc@example.com'],
364
- cc: ['cc@example.com'],
365
- subject: 'Updated Subject',
366
- to: ['to@example.com'],
367
- },
368
- id: 'test-draft-id-1',
369
- updatedAt: 6_000,
370
- });
371
- expect(draftUpdate).toHaveBeenCalledWith({
372
- body: {
373
- bcc: ['bcc@example.com'],
374
- cc: ['cc@example.com'],
375
- content: 'Existing content',
376
- to: ['to@example.com'],
377
- },
378
- id: 'test-draft-id-1',
379
- subject: 'Updated Subject',
380
- updatedAt: 6_000,
381
- });
382
- });
383
- });
384
- describe('setFrom', () => {
385
- it('sets draft from address', async () => {
386
- const draftUpdate = mock(async () => { });
387
- const transaction = {
388
- mutate: {
389
- draft: {
390
- delete: mock(async () => { }),
391
- insert: mock(async () => { }),
392
- update: draftUpdate,
393
- },
394
- },
395
- query: {},
396
- };
397
- const mutators = createMutators();
398
- await mutators.draft.setFrom(transaction, {
399
- accountId: 'test-account-id-1',
400
- aliasId: 'test-alias-id-1',
401
- from: 'sender@example.com',
402
- fromName: 'Updated Sender',
403
- id: 'test-draft-id-1',
404
- updatedAt: 7_000,
405
- });
406
- expect(draftUpdate).toHaveBeenCalledWith({
407
- accountId: 'test-account-id-1',
408
- fromAliasId: 'test-alias-id-1',
409
- fromEmail: 'sender@example.com',
410
- fromName: 'Updated Sender',
411
- id: 'test-draft-id-1',
412
- updatedAt: 7_000,
413
- });
414
- });
415
- });
416
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=threadMutators.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"threadMutators.test.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/threadMutators/threadMutators.test.ts"],"names":[],"mappings":""}