@marcoappio/marco-config 4.0.18 → 4.0.19

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.
@@ -10,10 +10,14 @@ const metadata = {
10
10
  $sequence: '1',
11
11
  $updatedAt: '2026-07-15T00:00:00.000Z',
12
12
  };
13
+ const rowFixture = (table, data, permissions = metadata.$permissions) => ({
14
+ ...metadata,
15
+ $permissions: permissions,
16
+ $tableId: appwrite.ids.tables[table],
17
+ ...data,
18
+ });
13
19
  const validRows = {
14
- accounts: {
15
- ...metadata,
16
- $tableId: 'accounts',
20
+ accounts: rowFixture('accounts', {
17
21
  colour: '#000000',
18
22
  credential: null,
19
23
  displayName: null,
@@ -31,10 +35,8 @@ const validRows = {
31
35
  profileAssignmentKey: 'user-1',
32
36
  provider: 'GMAIL',
33
37
  state: 'CONNECTED',
34
- },
35
- aliases: {
36
- ...metadata,
37
- $tableId: 'aliases',
38
+ }),
39
+ aliases: rowFixture('aliases', {
38
40
  account: 'account-1',
39
41
  accountAssignmentKey: 'account-1',
40
42
  email: 'marco@example.com',
@@ -42,10 +44,8 @@ const validRows = {
42
44
  name: 'Marco',
43
45
  providerId: 'provider-1',
44
46
  signature: '<p>Test signature</p>',
45
- },
46
- commands: {
47
- ...metadata,
48
- $tableId: 'commands_v2',
47
+ }),
48
+ commands: rowFixture('commands', {
49
49
  account: null,
50
50
  accountId: null,
51
51
  attempts: 0,
@@ -59,10 +59,8 @@ const validRows = {
59
59
  state: 'ACCEPTED',
60
60
  submittedAt: '2026-07-15T00:00:00.000Z',
61
61
  userId: 'user-1',
62
- },
63
- contacts: {
64
- ...metadata,
65
- $tableId: 'contacts',
62
+ }),
63
+ contacts: rowFixture('contacts', {
66
64
  displayName: 'Marco',
67
65
  lastContactedAt: '2026-07-15T00:00:00.000Z',
68
66
  messageCount: 0,
@@ -70,10 +68,8 @@ const validRows = {
70
68
  profile: 'user-1',
71
69
  profileAssignmentKey: 'user-1',
72
70
  searchText: 'marco',
73
- },
74
- credentials: {
75
- ...metadata,
76
- $tableId: 'credentials',
71
+ }),
72
+ credentials: rowFixture('credentials', {
77
73
  accountId: 'account-1',
78
74
  encryptedPayload: 'encrypted-payload',
79
75
  expiresAt: null,
@@ -81,10 +77,8 @@ const validRows = {
81
77
  refreshLeaseExpiresAt: null,
82
78
  refreshLeaseId: null,
83
79
  userId: 'user-1',
84
- },
85
- drafts: {
86
- ...metadata,
87
- $tableId: 'drafts',
80
+ }),
81
+ drafts: rowFixture('drafts', {
88
82
  account: 'account-1',
89
83
  accountAssignmentKey: 'account-1',
90
84
  attachmentMetadata: '[]',
@@ -101,10 +95,8 @@ const validRows = {
101
95
  sequence: 0,
102
96
  status: 'DRAFT',
103
97
  type: 'COMPOSE',
104
- },
105
- jobs: {
106
- ...metadata,
107
- $tableId: 'jobs_v2',
98
+ }),
99
+ jobs: rowFixture('jobs', {
108
100
  accountId: null,
109
101
  attempts: 0,
110
102
  commandId: 'command-1',
@@ -118,10 +110,8 @@ const validRows = {
118
110
  payload: '{"threadId":"thread-1"}',
119
111
  state: 'PENDING',
120
112
  userId: 'user-1',
121
- },
122
- labels: {
123
- ...metadata,
124
- $tableId: 'labels',
113
+ }),
114
+ labels: rowFixture('labels', {
125
115
  account: 'account-1',
126
116
  accountAssignmentKey: 'account-1',
127
117
  name: null,
@@ -130,10 +120,8 @@ const validRows = {
130
120
  specialUse: 'INBOX',
131
121
  totalCount: 0,
132
122
  unreadCount: 0,
133
- },
134
- mailboxSyncCandidates: {
135
- ...metadata,
136
- $tableId: 'mailbox_sync_candidates_v2',
123
+ }),
124
+ mailboxSyncCandidates: rowFixture('mailboxSyncCandidates', {
137
125
  account: 'account-1',
138
126
  accountId: 'account-1',
139
127
  generation: 1,
@@ -149,11 +137,8 @@ const validRows = {
149
137
  uid: 1,
150
138
  uidValidity: 1,
151
139
  userId: 'user-1',
152
- },
153
- mailboxSyncLanes: {
154
- ...metadata,
155
- $permissions: [],
156
- $tableId: 'mailbox_sync_lanes',
140
+ }),
141
+ mailboxSyncLanes: rowFixture('mailboxSyncLanes', {
157
142
  account: 'test-account-id-1',
158
143
  accountId: 'test-account-id-1',
159
144
  commandId: 'sync_test-command-id-1',
@@ -163,10 +148,8 @@ const validRows = {
163
148
  lane: 'HEAD',
164
149
  state: 'RUNNING',
165
150
  userId: 'test-user-id-1',
166
- },
167
- mailboxSyncStates: {
168
- ...metadata,
169
- $tableId: 'mailbox_sync_states',
151
+ }, []),
152
+ mailboxSyncStates: rowFixture('mailboxSyncStates', {
170
153
  accountId: 'account-1',
171
154
  errorCode: null,
172
155
  lastEventAt: null,
@@ -179,10 +162,8 @@ const validRows = {
179
162
  state: 'CURRENT',
180
163
  uidValidity: null,
181
164
  userId: 'user-1',
182
- },
183
- messageLocations: {
184
- ...metadata,
185
- $tableId: 'message_locations',
165
+ }),
166
+ messageLocations: rowFixture('messageLocations', {
186
167
  account: 'account-1',
187
168
  accountAssignmentKey: 'account-1',
188
169
  flagged: false,
@@ -195,10 +176,8 @@ const validRows = {
195
176
  threadAssignmentKey: 'thread-1',
196
177
  uid: 1,
197
178
  uidValidity: 1,
198
- },
199
- messages: {
200
- ...metadata,
201
- $tableId: 'messages',
179
+ }),
180
+ messages: rowFixture('messages', {
202
181
  account: 'account-1',
203
182
  accountAssignmentKey: 'account-1',
204
183
  attachmentMetadata: '[]',
@@ -217,10 +196,8 @@ const validRows = {
217
196
  subject: 'Test subject',
218
197
  thread: 'thread-1',
219
198
  threadAssignmentKey: 'thread-1',
220
- },
221
- oauthStates: {
222
- ...metadata,
223
- $tableId: 'oauth_states',
199
+ }),
200
+ oauthStates: rowFixture('oauthStates', {
224
201
  accountId: 'account-1',
225
202
  email: 'marco@example.com',
226
203
  expiresAt: '2026-07-15T00:10:00.000Z',
@@ -230,17 +207,11 @@ const validRows = {
230
207
  provider: 'GMAIL',
231
208
  returnUri: 'https://app.marcoapp.io/onboarding/loading',
232
209
  userId: 'user-1',
233
- },
234
- pollShardCoordinators: {
235
- ...metadata,
236
- $permissions: [],
237
- $tableId: 'poll_shard_coordinators',
210
+ }),
211
+ pollShardCoordinators: rowFixture('pollShardCoordinators', {
238
212
  accountCursor: null,
239
- },
240
- pollShards: {
241
- ...metadata,
242
- $permissions: [],
243
- $tableId: 'poll_shards',
213
+ }, []),
214
+ pollShards: rowFixture('pollShards', {
244
215
  accountIds: ['test-account-id-1'],
245
216
  errorCode: null,
246
217
  generation: 1,
@@ -251,63 +222,48 @@ const validRows = {
251
222
  pollingSnapshot: '{"members":[],"version":1}',
252
223
  scheduledExecutionId: null,
253
224
  state: 'ACTIVE',
254
- },
255
- profileAvatarCleanups: {
256
- ...metadata,
257
- $permissions: [],
258
- $tableId: 'profile_avatar_cleanups',
225
+ }, []),
226
+ profileAvatarCleanups: rowFixture('profileAvatarCleanups', {
259
227
  claimedAt: null,
260
228
  claimId: null,
261
229
  fileId: 'test-file-id-1',
262
230
  profile: 'user-1',
263
- },
264
- profiles: {
265
- ...metadata,
266
- $tableId: 'profiles',
231
+ }, []),
232
+ profiles: rowFixture('profiles', {
267
233
  avatarFileId: null,
268
234
  deletionRequestedAt: null,
269
235
  email: 'marco@example.com',
270
236
  name: null,
271
237
  onboardingState: null,
272
238
  timezone: null,
273
- },
274
- pushNotificationTokens: {
275
- ...metadata,
276
- $tableId: 'push_notification_tokens',
239
+ }),
240
+ pushNotificationTokens: rowFixture('pushNotificationTokens', {
277
241
  profile: 'user-1',
278
242
  token: 'ExponentPushToken[token]',
279
243
  userId: 'user-1',
280
- },
281
- savedViews: {
282
- ...metadata,
283
- $tableId: 'saved_views',
244
+ }),
245
+ savedViews: rowFixture('savedViews', {
284
246
  aliasIds: ['alias-1'],
285
247
  icon: 'mail',
286
248
  name: 'Unread',
287
249
  profile: 'user-1',
288
- },
289
- threadAliases: {
290
- ...metadata,
291
- $tableId: 'thread_aliases',
250
+ }),
251
+ threadAliases: rowFixture('threadAliases', {
292
252
  alias: 'alias-1',
293
253
  aliasAssignmentKey: 'alias-1',
294
254
  latestMessageAt: '2026-07-15T00:00:00.000Z',
295
255
  thread: 'thread-1',
296
256
  threadAssignmentKey: 'thread-1',
297
- },
298
- threadLabels: {
299
- ...metadata,
300
- $tableId: 'thread_labels',
257
+ }),
258
+ threadLabels: rowFixture('threadLabels', {
301
259
  label: 'label-1',
302
260
  labelAssignmentKey: 'label-1',
303
261
  latestMessageAt: '2026-07-15T00:00:00.000Z',
304
262
  locationCount: 1,
305
263
  thread: 'thread-1',
306
264
  threadAssignmentKey: 'thread-1',
307
- },
308
- threads: {
309
- ...metadata,
310
- $tableId: 'threads',
265
+ }),
266
+ threads: rowFixture('threads', {
311
267
  account: 'account-1',
312
268
  accountAssignmentKey: 'account-1',
313
269
  archived: false,
@@ -332,14 +288,9 @@ const validRows = {
332
288
  subject: null,
333
289
  trashed: false,
334
290
  unseenLocationCount: 0,
335
- },
336
- };
337
- const validPollShardCoordinatorRow = {
338
- ...metadata,
339
- $permissions: [],
340
- $tableId: 'poll_shard_coordinators',
341
- accountCursor: null,
291
+ }),
342
292
  };
293
+ const validPollShardCoordinatorRow = validRows.pollShardCoordinators;
343
294
  const pollShardCoordinatorSchema = Object.entries(appwrite.rowSchemas).find(([table]) => table === 'pollShardCoordinators')?.[1];
344
295
  describe('appwrite', () => {
345
296
  it('publishes the production browser and OAuth configuration', () => {
@@ -573,160 +524,7 @@ describe('appwrite', () => {
573
524
  });
574
525
  }
575
526
  const rowTestCases = Object.keys(validRows);
576
- const metadataKeys = ['$createdAt', '$databaseId', '$id', '$permissions', '$sequence', '$tableId', '$updatedAt'];
577
- const expectedRowDataKeys = {
578
- accounts: [
579
- 'colour',
580
- 'credential',
581
- 'displayName',
582
- 'initialSyncCompletedAt',
583
- 'lastErrorCode',
584
- 'lastSuccessfulSyncAt',
585
- 'mailboxSyncState',
586
- 'mailProcessedCount',
587
- 'mailTotalCount',
588
- 'pollShardAssignmentId',
589
- 'pollShardId',
590
- 'primaryAlias',
591
- 'primaryEmail',
592
- 'profile',
593
- 'profileAssignmentKey',
594
- 'provider',
595
- 'state',
596
- ],
597
- aliases: ['account', 'accountAssignmentKey', 'email', 'isPrimary', 'name', 'providerId', 'signature'],
598
- commands: ['account', 'accountId', 'attempts', 'canonicalRevision', 'draftId', 'errorCode', 'kind', 'payload', 'payloadHash', 'profile', 'state', 'submittedAt', 'userId'],
599
- contacts: ['displayName', 'lastContactedAt', 'messageCount', 'normalisedAddress', 'profile', 'profileAssignmentKey', 'searchText'],
600
- credentials: ['accountId', 'encryptedPayload', 'expiresAt', 'provider', 'refreshLeaseExpiresAt', 'refreshLeaseId', 'userId'],
601
- drafts: [
602
- 'account',
603
- 'accountAssignmentKey',
604
- 'attachmentMetadata',
605
- 'contentHash',
606
- 'envelope',
607
- 'errorCode',
608
- 'executionLeaseExpiresAt',
609
- 'executionLeaseId',
610
- 'fromAlias',
611
- 'html',
612
- 'referencedMessage',
613
- 'revision',
614
- 'scheduledAt',
615
- 'sequence',
616
- 'status',
617
- 'type',
618
- ],
619
- jobs: ['accountId', 'attempts', 'commandId', 'dedupeKey', 'errorCode', 'kind', 'leaseExpiresAt', 'leaseId', 'maxAttempts', 'nextRunAt', 'payload', 'state', 'userId'],
620
- labels: ['account', 'accountAssignmentKey', 'name', 'path', 'providerId', 'specialUse', 'totalCount', 'unreadCount'],
621
- mailboxSyncCandidates: [
622
- 'account',
623
- 'accountId',
624
- 'generation',
625
- 'label',
626
- 'labelId',
627
- 'lane',
628
- 'mailboxPath',
629
- 'mailboxPriority',
630
- 'mailboxSortKey',
631
- 'providerId',
632
- 'receivedAt',
633
- 'specialUse',
634
- 'uid',
635
- 'uidValidity',
636
- 'userId',
637
- ],
638
- mailboxSyncLanes: ['account', 'accountId', 'commandId', 'cursor', 'errorCode', 'generation', 'lane', 'state', 'userId'],
639
- mailboxSyncStates: [
640
- 'accountId',
641
- 'errorCode',
642
- 'lastEventAt',
643
- 'lastSyncAt',
644
- 'materialisationLeaseExpiresAt',
645
- 'materialisationLeaseId',
646
- 'nextPollAt',
647
- 'provider',
648
- 'providerCursor',
649
- 'state',
650
- 'uidValidity',
651
- 'userId',
652
- ],
653
- messageLocations: [
654
- 'account',
655
- 'accountAssignmentKey',
656
- 'flagged',
657
- 'label',
658
- 'labelAssignmentKey',
659
- 'message',
660
- 'messageAt',
661
- 'seen',
662
- 'thread',
663
- 'threadAssignmentKey',
664
- 'uid',
665
- 'uidValidity',
666
- ],
667
- messages: [
668
- 'account',
669
- 'accountAssignmentKey',
670
- 'attachmentMetadata',
671
- 'htmlFileId',
672
- 'preview',
673
- 'providerId',
674
- 'rawFileId',
675
- 'receivedAt',
676
- 'recipients',
677
- 'revision',
678
- 'rfcMessageId',
679
- 'sender',
680
- 'senderName',
681
- 'sentAt',
682
- 'size',
683
- 'subject',
684
- 'thread',
685
- 'threadAssignmentKey',
686
- ],
687
- oauthStates: ['accountId', 'email', 'expiresAt', 'nonceHash', 'operation', 'profile', 'provider', 'returnUri', 'userId'],
688
- pollShardCoordinators: ['accountCursor'],
689
- pollShards: ['accountIds', 'errorCode', 'generation', 'lastStartedAt', 'leaseExpiresAt', 'leaseId', 'nextStartAt', 'pollingSnapshot', 'scheduledExecutionId', 'state'],
690
- profileAvatarCleanups: ['claimedAt', 'claimId', 'fileId', 'profile'],
691
- profiles: ['avatarFileId', 'deletionRequestedAt', 'email', 'name', 'onboardingState', 'timezone'],
692
- pushNotificationTokens: ['profile', 'token', 'userId'],
693
- savedViews: ['aliasIds', 'icon', 'name', 'profile'],
694
- threadAliases: ['alias', 'aliasAssignmentKey', 'latestMessageAt', 'thread', 'threadAssignmentKey'],
695
- threadLabels: ['label', 'labelAssignmentKey', 'latestMessageAt', 'locationCount', 'thread', 'threadAssignmentKey'],
696
- threads: [
697
- 'account',
698
- 'accountAssignmentKey',
699
- 'archived',
700
- 'firstMessageAt',
701
- 'flagged',
702
- 'flaggedLocationCount',
703
- 'hasAttachments',
704
- 'labelIds',
705
- 'latestMessageAt',
706
- 'latestMessageId',
707
- 'messageCount',
708
- 'participants',
709
- 'preview',
710
- 'providerId',
711
- 'revision',
712
- 'searchText',
713
- 'seen',
714
- 'senderEmail',
715
- 'senderName',
716
- 'snoozedUntil',
717
- 'spam',
718
- 'subject',
719
- 'trashed',
720
- 'unseenLocationCount',
721
- ],
722
- };
723
527
  for (const table of rowTestCases) {
724
- it(`exposes backend-aligned ${table} row keys`, () => {
725
- const dataKeys = Object.keys(appwrite.rowSchemas[table].entries)
726
- .filter(key => !metadataKeys.includes(key))
727
- .sort();
728
- expect(dataKeys).toEqual([...expectedRowDataKeys[table]].sort());
729
- });
730
528
  it(`accepts the ${table} wire row`, () => {
731
529
  expect(v.safeParse(appwrite.rowSchemas[table], validRows[table]).success).toBe(true);
732
530
  });
@@ -838,38 +636,6 @@ describe('appwrite', () => {
838
636
  expect(v.safeParse(schema, row).success).toBe(false);
839
637
  });
840
638
  }
841
- const obsoleteRelationshipFieldTestCases = [
842
- { field: 'pollShard', row: { ...validRows.accounts, pollShard: null }, schema: appwrite.rowSchemas.accounts, table: 'accounts' },
843
- { field: 'primaryAliasId', row: { ...validRows.accounts, primaryAliasId: 'alias-1' }, schema: appwrite.rowSchemas.accounts, table: 'accounts' },
844
- { field: 'userId', row: { ...validRows.accounts, userId: 'user-1' }, schema: appwrite.rowSchemas.accounts, table: 'accounts' },
845
- { field: 'accountId', row: { ...validRows.aliases, accountId: 'account-1' }, schema: appwrite.rowSchemas.aliases, table: 'aliases' },
846
- { field: 'userId', row: { ...validRows.aliases, userId: 'user-1' }, schema: appwrite.rowSchemas.aliases, table: 'aliases' },
847
- { field: 'userId', row: { ...validRows.contacts, userId: 'user-1' }, schema: appwrite.rowSchemas.contacts, table: 'contacts' },
848
- { field: 'accountId', row: { ...validRows.drafts, accountId: 'account-1' }, schema: appwrite.rowSchemas.drafts, table: 'drafts' },
849
- { field: 'fromAliasId', row: { ...validRows.drafts, fromAliasId: 'alias-1' }, schema: appwrite.rowSchemas.drafts, table: 'drafts' },
850
- { field: 'referencedMessageId', row: { ...validRows.drafts, referencedMessageId: 'message-1' }, schema: appwrite.rowSchemas.drafts, table: 'drafts' },
851
- { field: 'userId', row: { ...validRows.drafts, userId: 'user-1' }, schema: appwrite.rowSchemas.drafts, table: 'drafts' },
852
- { field: 'accountId', row: { ...validRows.labels, accountId: 'account-1' }, schema: appwrite.rowSchemas.labels, table: 'labels' },
853
- { field: 'userId', row: { ...validRows.labels, userId: 'user-1' }, schema: appwrite.rowSchemas.labels, table: 'labels' },
854
- { field: 'accountId', row: { ...validRows.messages, accountId: 'account-1' }, schema: appwrite.rowSchemas.messages, table: 'messages' },
855
- { field: 'threadId', row: { ...validRows.messages, threadId: 'thread-1' }, schema: appwrite.rowSchemas.messages, table: 'messages' },
856
- { field: 'userId', row: { ...validRows.messages, userId: 'user-1' }, schema: appwrite.rowSchemas.messages, table: 'messages' },
857
- { field: 'accountId', row: { ...validRows.threads, accountId: 'account-1' }, schema: appwrite.rowSchemas.threads, table: 'threads' },
858
- { field: 'userId', row: { ...validRows.threads, userId: 'user-1' }, schema: appwrite.rowSchemas.threads, table: 'threads' },
859
- { field: 'accountId', row: { ...validRows.threadAliases, accountId: 'account-1' }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
860
- { field: 'aliasId', row: { ...validRows.threadAliases, aliasId: 'alias-1' }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
861
- { field: 'threadId', row: { ...validRows.threadAliases, threadId: 'thread-1' }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
862
- { field: 'userId', row: { ...validRows.threadAliases, userId: 'user-1' }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
863
- { field: 'accountId', row: { ...validRows.threadLabels, accountId: 'account-1' }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
864
- { field: 'labelId', row: { ...validRows.threadLabels, labelId: 'label-1' }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
865
- { field: 'threadId', row: { ...validRows.threadLabels, threadId: 'thread-1' }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
866
- { field: 'userId', row: { ...validRows.threadLabels, userId: 'user-1' }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
867
- ];
868
- for (const { field, row, schema, table } of obsoleteRelationshipFieldTestCases) {
869
- it(`rejects obsolete ${field} on ${table}`, () => {
870
- expect(v.safeParse(schema, row).success).toBe(false);
871
- });
872
- }
873
639
  const nullableColumnTestCases = [
874
640
  {
875
641
  description: 'alias name',
@@ -9,10 +9,12 @@ const commandMetadata = {
9
9
  version: 1,
10
10
  };
11
11
  const avatarSha256 = 'a'.repeat(64);
12
- const commandFixtures = [
12
+ const commandFixture = (command) => ({
13
+ command: { ...commandMetadata, accountId: 'account_1', ...command },
14
+ });
15
+ const commandFixtureInputs = [
13
16
  {
14
17
  command: {
15
- ...commandMetadata,
16
18
  accountId: null,
17
19
  kind: 'profile.settings.set',
18
20
  payload: { name: 'Isaac', timezone: 'Europe/London' },
@@ -20,186 +22,140 @@ const commandFixtures = [
20
22
  },
21
23
  {
22
24
  command: {
23
- ...commandMetadata,
24
- accountId: 'account_1',
25
25
  kind: 'account.settings.set',
26
26
  payload: { colour: '#000000', displayName: 'Marco' },
27
27
  },
28
28
  },
29
- { command: { ...commandMetadata, accountId: 'account_1', kind: 'account.delete', payload: {} } },
29
+ { command: { kind: 'account.delete', payload: {} } },
30
30
  {
31
31
  command: {
32
- ...commandMetadata,
33
- accountId: 'account_1',
34
32
  kind: 'alias.create',
35
33
  payload: { aliasId: 'alias_1', email: 'marco@example.com', name: null, signature: null },
36
34
  },
37
35
  },
38
36
  {
39
37
  command: {
40
- ...commandMetadata,
41
- accountId: 'account_1',
42
38
  kind: 'alias.delete',
43
39
  payload: { aliasId: 'alias_1' },
44
40
  },
45
41
  },
46
42
  {
47
43
  command: {
48
- ...commandMetadata,
49
- accountId: 'account_1',
50
44
  kind: 'alias.name.set',
51
45
  payload: { aliasId: 'alias_1', name: 'Marco' },
52
46
  },
53
47
  },
54
48
  {
55
49
  command: {
56
- ...commandMetadata,
57
- accountId: 'account_1',
58
50
  kind: 'alias.primary.set',
59
51
  payload: { aliasId: 'alias_1' },
60
52
  },
61
53
  },
62
54
  {
63
55
  command: {
64
- ...commandMetadata,
65
- accountId: 'account_1',
66
56
  kind: 'alias.signature.set',
67
57
  payload: { aliasId: 'alias_1', signature: 'Regards' },
68
58
  },
69
59
  },
70
60
  {
71
61
  command: {
72
- ...commandMetadata,
73
- accountId: 'account_1',
74
62
  kind: 'label.create',
75
63
  payload: { labelId: 'label_1', path: 'Projects' },
76
64
  },
77
65
  },
78
66
  {
79
67
  command: {
80
- ...commandMetadata,
81
- accountId: 'account_1',
82
68
  kind: 'label.delete',
83
69
  payload: { labelId: 'label_1' },
84
70
  },
85
71
  },
86
72
  {
87
73
  command: {
88
- ...commandMetadata,
89
- accountId: 'account_1',
90
74
  kind: 'label.rename',
91
75
  payload: { labelId: 'label_1', path: 'Projects/Marco' },
92
76
  },
93
77
  },
94
78
  {
95
79
  command: {
96
- ...commandMetadata,
97
- accountId: 'account_1',
98
80
  kind: 'thread.label.add',
99
81
  payload: { labelId: 'label_1', threadIds: ['thread_1'] },
100
82
  },
101
83
  },
102
84
  {
103
85
  command: {
104
- ...commandMetadata,
105
- accountId: 'account_1',
106
86
  kind: 'thread.label.remove',
107
87
  payload: { labelId: 'label_1', threadIds: ['thread_1'] },
108
88
  },
109
89
  },
110
90
  {
111
91
  command: {
112
- ...commandMetadata,
113
- accountId: 'account_1',
114
92
  kind: 'thread.archive.set',
115
93
  payload: { archived: true, threadIds: ['thread_1'] },
116
94
  },
117
95
  },
118
96
  {
119
97
  command: {
120
- ...commandMetadata,
121
- accountId: 'account_1',
122
98
  kind: 'thread.flagged.set',
123
99
  payload: { flagged: true, threadIds: ['thread_1'] },
124
100
  },
125
101
  },
126
102
  {
127
103
  command: {
128
- ...commandMetadata,
129
- accountId: 'account_1',
130
104
  kind: 'thread.seen.set',
131
105
  payload: { seen: true, threadIds: ['thread_1'] },
132
106
  },
133
107
  },
134
108
  {
135
109
  command: {
136
- ...commandMetadata,
137
- accountId: 'account_1',
138
110
  kind: 'thread.snooze.set',
139
111
  payload: { snoozedUntil: '2026-07-16T00:00:00.000Z', threadIds: ['thread_1'] },
140
112
  },
141
113
  },
142
114
  {
143
115
  command: {
144
- ...commandMetadata,
145
- accountId: 'account_1',
146
116
  kind: 'thread.spam.set',
147
117
  payload: { spam: true, threadIds: ['thread_1'] },
148
118
  },
149
119
  },
150
120
  {
151
121
  command: {
152
- ...commandMetadata,
153
- accountId: 'account_1',
154
122
  kind: 'thread.trash.set',
155
123
  payload: { threadIds: ['thread_1'], trashed: true },
156
124
  },
157
125
  },
158
126
  {
159
127
  command: {
160
- ...commandMetadata,
161
- accountId: 'account_1',
162
128
  kind: 'thread.delete',
163
129
  payload: { threadIds: ['thread_1'] },
164
130
  },
165
131
  },
166
132
  {
167
133
  command: {
168
- ...commandMetadata,
169
- accountId: 'account_1',
170
134
  kind: 'draft.create',
171
135
  payload: { draftId: 'draft_1', fromAliasId: null, referencedMessageId: null, type: 'NEW' },
172
136
  },
173
137
  },
174
138
  {
175
139
  command: {
176
- ...commandMetadata,
177
- accountId: 'account_1',
178
140
  kind: 'draft.content.set',
179
141
  payload: { draftId: 'draft_1', html: '<p>Hello</p>' },
180
142
  },
181
143
  },
182
144
  {
183
145
  command: {
184
- ...commandMetadata,
185
- accountId: 'account_1',
186
146
  kind: 'draft.envelope.set',
187
147
  payload: { bcc: [], cc: [], draftId: 'draft_1', subject: 'Hello', to: ['marco@example.com'] },
188
148
  },
189
149
  },
190
150
  {
191
151
  command: {
192
- ...commandMetadata,
193
- accountId: 'account_1',
194
152
  kind: 'draft.from.set',
195
153
  payload: { draftId: 'draft_1', fromAliasId: 'alias_1', targetAccountId: 'account_2' },
196
154
  },
197
155
  },
198
- { command: { ...commandMetadata, accountId: 'account_1', kind: 'draft.delete', payload: { draftId: 'draft_1' } } },
156
+ { command: { kind: 'draft.delete', payload: { draftId: 'draft_1' } } },
199
157
  {
200
158
  command: {
201
- ...commandMetadata,
202
- accountId: 'account_1',
203
159
  kind: 'draft.attachment.link',
204
160
  payload: {
205
161
  draftId: 'draft_1',
@@ -212,74 +168,35 @@ const commandFixtures = [
212
168
  },
213
169
  {
214
170
  command: {
215
- ...commandMetadata,
216
- accountId: 'account_1',
217
171
  kind: 'draft.attachment.delete',
218
172
  payload: { draftId: 'draft_1', fileId: 'file_1' },
219
173
  },
220
174
  },
221
- { command: { ...commandMetadata, accountId: 'account_1', kind: 'draft.send', payload: { draftId: 'draft_1' } } },
175
+ { command: { kind: 'draft.send', payload: { draftId: 'draft_1' } } },
222
176
  {
223
177
  command: {
224
- ...commandMetadata,
225
- accountId: 'account_1',
226
178
  kind: 'draft.send.cancel',
227
179
  payload: { draftId: 'draft_1' },
228
180
  },
229
181
  },
230
182
  {
231
183
  command: {
232
- ...commandMetadata,
233
- accountId: 'account_1',
234
184
  kind: 'draft.send.schedule',
235
185
  payload: { draftId: 'draft_1', scheduledAt: '2026-07-16T00:00:00.000Z' },
236
186
  },
237
187
  },
238
188
  {
239
189
  command: {
240
- ...commandMetadata,
241
190
  accountId: null,
242
191
  kind: 'profile.avatar.set',
243
192
  payload: { sha256: avatarSha256 },
244
193
  },
245
194
  },
246
195
  ];
196
+ const commandFixtures = commandFixtureInputs.map(({ command }) => commandFixture(command));
247
197
  describe('appwriteCommands', () => {
248
- it('publishes the complete version-one command and status manifest', () => {
198
+ it('publishes the version-one status and error manifest', () => {
249
199
  expect(appwriteCommands.version).toBe(1);
250
- expect(appwriteCommands.kinds).toEqual([
251
- 'account.delete',
252
- 'account.settings.set',
253
- 'alias.create',
254
- 'alias.delete',
255
- 'alias.name.set',
256
- 'alias.primary.set',
257
- 'alias.signature.set',
258
- 'draft.attachment.delete',
259
- 'draft.attachment.link',
260
- 'draft.content.set',
261
- 'draft.create',
262
- 'draft.delete',
263
- 'draft.envelope.set',
264
- 'draft.from.set',
265
- 'draft.send',
266
- 'draft.send.cancel',
267
- 'draft.send.schedule',
268
- 'label.create',
269
- 'label.delete',
270
- 'label.rename',
271
- 'profile.avatar.set',
272
- 'profile.settings.set',
273
- 'thread.archive.set',
274
- 'thread.delete',
275
- 'thread.flagged.set',
276
- 'thread.label.add',
277
- 'thread.label.remove',
278
- 'thread.seen.set',
279
- 'thread.snooze.set',
280
- 'thread.spam.set',
281
- 'thread.trash.set',
282
- ]);
283
200
  expect(appwriteCommands.states).toEqual(['ACCEPTED', 'RUNNING', 'SUCCEEDED', 'FAILED']);
284
201
  expect(appwriteCommands.errorCodes).toEqual([
285
202
  'AUTHENTICATION_FAILED',
@@ -296,27 +213,7 @@ describe('appwriteCommands', () => {
296
213
  const groupedKinds = Object.values(appwriteCommandGroups).flat();
297
214
  const fixtureKinds = commandFixtures.map(({ command }) => command.kind);
298
215
  expect(Object.keys(appwriteCommandGroups)).toEqual(['account', 'draft', 'draftSend', 'label', 'profileAvatar', 'profileSettings', 'thread']);
299
- expect(appwriteCommandGroups).toEqual({
300
- account: ['account.delete', 'account.settings.set', 'alias.create', 'alias.delete', 'alias.name.set', 'alias.primary.set', 'alias.signature.set'],
301
- draft: ['draft.attachment.delete', 'draft.attachment.link', 'draft.content.set', 'draft.create', 'draft.delete', 'draft.envelope.set', 'draft.from.set'],
302
- draftSend: ['draft.send', 'draft.send.cancel', 'draft.send.schedule'],
303
- label: ['label.create', 'label.delete', 'label.rename'],
304
- profileAvatar: ['profile.avatar.set'],
305
- profileSettings: ['profile.settings.set'],
306
- thread: [
307
- 'thread.archive.set',
308
- 'thread.delete',
309
- 'thread.flagged.set',
310
- 'thread.label.add',
311
- 'thread.label.remove',
312
- 'thread.seen.set',
313
- 'thread.snooze.set',
314
- 'thread.spam.set',
315
- 'thread.trash.set',
316
- ],
317
- });
318
- expect(groupedKinds).toHaveLength(31);
319
- expect(new Set(groupedKinds).size).toBe(31);
216
+ expect(new Set(groupedKinds).size).toBe(groupedKinds.length);
320
217
  expect(groupedKinds).toEqual([...appwriteCommands.kinds]);
321
218
  expect(Object.values(appwriteCommandGroups).every(Object.isFrozen)).toBe(true);
322
219
  expect(Object.isFrozen(appwriteCommands.kinds)).toBe(true);
@@ -65,13 +65,6 @@ describe('public exports', () => {
65
65
  const typeExportKeys = new Set(Object.keys(types));
66
66
  expect(Object.keys(appwrite).filter(key => typeExportKeys.has(key))).toEqual([]);
67
67
  });
68
- it('omits Railway-era runtime contracts', async () => {
69
- const config = await import('./index.js');
70
- const removedExports = ['MARCO_ENV', 'marcoPublicConfig', 'marcoSDK'];
71
- for (const removedExport of removedExports) {
72
- expect(removedExport in config).toBe(false);
73
- }
74
- });
75
68
  it('omits legacy schemas', async () => {
76
69
  const config = await import('./index.js');
77
70
  const removedSchemas = ['mutators', 'websocket'];
@@ -105,8 +98,4 @@ describe('public exports', () => {
105
98
  expect('labelUtils' in config).toBe(false);
106
99
  expect('threadsUtils' in config).toBe(false);
107
100
  });
108
- it('omits the Railway REST constants', async () => {
109
- const config = await import('./index.js');
110
- expect('api' in config.marcoConstants).toBe(false);
111
- });
112
101
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "4.0.18",
3
+ "version": "4.0.19",
4
4
  "author": "team@marcoapp.io",
5
5
  "exports": {
6
6
  ".": {