@marcoappio/marco-config 4.0.17 → 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.
- package/dist/appwrite/appwrite.d.ts +557 -561
- package/dist/appwrite/appwrite.d.ts.map +1 -1
- package/dist/appwrite/appwrite.js +4 -7
- package/dist/appwrite/appwrite.test.js +55 -288
- package/dist/appwrite/commands.js +5 -5
- package/dist/appwrite/commands.test.js +13 -116
- package/dist/appwrite/decodedSchemas.js +2 -2
- package/dist/appwrite/functions.js +6 -6
- package/dist/appwrite/functions.test.js +1 -1
- package/dist/appwrite/index.d.ts +5 -3
- package/dist/appwrite/index.d.ts.map +1 -1
- package/dist/appwrite/index.js +4 -3
- package/dist/appwrite/tableContract/identity.d.ts +62 -62
- package/dist/appwrite/tableContract/identity.js +1 -1
- package/dist/appwrite/tableContract/index.d.ts +726 -726
- package/dist/appwrite/tableContract/index.js +5 -5
- package/dist/appwrite/tableContract/index.test.js +5 -5
- package/dist/appwrite/tableContract/mailbox.d.ts +88 -88
- package/dist/appwrite/tableContract/mailbox.js +1 -1
- package/dist/appwrite/tableContract/operational.d.ts +76 -76
- package/dist/appwrite/tableContract/operational.js +1 -1
- package/dist/appwrite/tableContract/shared.d.ts +1 -1
- package/dist/appwrite/tableContract/shared.js +1 -1
- package/dist/constants/emailProvider.js +1 -1
- package/dist/constants/index.js +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.test.js +64 -14
- package/dist/schemas/app.js +1 -1
- package/dist/schemas/auth.js +1 -1
- package/dist/schemas/emailAccount.d.ts +1 -1
- package/dist/schemas/emailAccount.js +5 -5
- package/dist/schemas/index.d.ts +3 -3
- package/dist/schemas/index.js +9 -9
- package/dist/schemas/models/account.js +4 -4
- package/dist/schemas/models/contact.js +2 -2
- package/dist/schemas/models/draft.js +4 -4
- package/dist/schemas/models/index.d.ts +5 -5
- package/dist/schemas/models/index.js +5 -5
- package/dist/schemas/models/mailboxAddress.test.js +3 -3
- package/dist/schemas/models/numericSemantics.test.js +2 -2
- package/dist/schemas/models/thread.js +5 -5
- package/dist/schemas/models/user.d.ts +1 -1
- package/dist/schemas/models/user.js +3 -3
- package/dist/schemas/models/user.test.js +2 -2
- package/dist/schemas/number.js +1 -1
- package/dist/schemas/oauth.js +1 -1
- package/dist/schemas/pushNotifications.js +1 -1
- package/dist/schemas/scalars.test.js +2 -2
- package/dist/schemas/schemaValues.test.js +1 -1
- package/dist/schemas/string.js +1 -1
- package/dist/types/IMAPSourceLocation.d.ts +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.js +11 -11
- package/dist/utils/accounts/index.d.ts +1 -1
- package/dist/utils/accounts/index.js +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/labels/index.d.ts +1 -1
- package/dist/utils/threads/index.d.ts +2 -2
- package/dist/utils/threads/index.js +2 -2
- package/dist/utils/threads/parseLabelIdList/parseLabelIdList.test.js +1 -1
- package/dist/utils/threads/processSearchTerm/processSearchTerm.test.js +1 -1
- package/package.json +15 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appwrite.d.ts","sourceRoot":"","sources":["../../src/appwrite/appwrite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAyB5B,
|
|
1
|
+
{"version":3,"file":"appwrite.d.ts","sourceRoot":"","sources":["../../src/appwrite/appwrite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAyB5B,QAAA,MAAM,uBAAuB;;;;;;;aAO3B,CAAA;AAEF,QAAA,MAAM,sBAAsB;;;;aAI1B,CAAA;AAGF,MAAM,MAAM,yBAAyB,GAAG,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAA;AACnG,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAA;AAEjG,QAAA,MAAM,oBAAoB,EAAE,SAAS,CAAC,aAAa,EAAE,YAAY,EAAE,SAAS,CAA4C,CAAA;AACxH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAmCvE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAhCH,MAAM;kBACZ,MAAM;wBACA;YACd,MAAM,EAAE,MAAM,CAAA;YACd,SAAS,EAAE,MAAM,CAAA;SAClB;mBACU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CT,CAAA"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { string } from '../schemas/string';
|
|
3
|
-
import { MESSAGE_RECIPIENT_TYPES } from '../types';
|
|
4
|
-
import { persistedDraftAttachmentsSchema, persistedDraftEnvelopeSchema } from './decodedSchemas';
|
|
5
|
-
import { appwriteDataSchemas, appwriteIds, appwriteRowSchemas as generatedRowSchemas, appwriteRowIdSchema, appwriteTables, mailboxSyncLaneStates, mailboxSyncLanes, mailboxSyncStates, oauthOperations, oauthProviders, oauthReturnUris, oauthReturnUriSchema, pollShardStates, jsonObjectTextSchema, nonNegativeIntegerSchema, identifierSchema, } from './tableContract';
|
|
6
|
-
export { appwriteRowIdSchema, appwriteTableIdSchema, appwriteTableIds } from './tableContract';
|
|
7
|
-
export { appwriteDataSchemas, appwriteRowSchemas, appwriteTableContract, appwriteTables, defineAppwriteTables, } from './tableContract';
|
|
8
|
-
export { accountProviders, accountStates, appwriteRelationshipIdSchema, commandStates, draftStates, draftTypes, jobStates, labelSpecialUses, mailboxSyncLaneStates, mailboxSyncLanes, mailboxSyncProvisionedStates, mailboxSyncStates, oauthOperations, oauthProviders, oauthReturnUris, oauthReturnUriSchema, pollShardStates, } from './tableContract';
|
|
2
|
+
import { string } from '../schemas/string.js';
|
|
3
|
+
import { MESSAGE_RECIPIENT_TYPES } from '../types/index.js';
|
|
4
|
+
import { persistedDraftAttachmentsSchema, persistedDraftEnvelopeSchema } from './decodedSchemas.js';
|
|
5
|
+
import { appwriteDataSchemas, appwriteIds, appwriteRowSchemas as generatedRowSchemas, appwriteRowIdSchema, appwriteTables, mailboxSyncLaneStates, mailboxSyncLanes, mailboxSyncStates, oauthOperations, oauthProviders, oauthReturnUris, oauthReturnUriSchema, pollShardStates, jsonObjectTextSchema, nonNegativeIntegerSchema, identifierSchema, } from './tableContract/index.js';
|
|
9
6
|
const messageAttachmentSchema = v.looseObject({
|
|
10
7
|
fileId: v.optional(v.nullable(appwriteRowIdSchema)),
|
|
11
8
|
isAttachment: v.boolean(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from 'bun:test';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
-
import { appwrite
|
|
3
|
+
import { appwrite } from './appwrite.js';
|
|
4
|
+
import { appwriteTableIds } from './tableContract/index.js';
|
|
4
5
|
const metadata = {
|
|
5
6
|
$createdAt: '2026-07-15T00:00:00.000Z',
|
|
6
7
|
$databaseId: 'marco',
|
|
@@ -9,10 +10,14 @@ const metadata = {
|
|
|
9
10
|
$sequence: '1',
|
|
10
11
|
$updatedAt: '2026-07-15T00:00:00.000Z',
|
|
11
12
|
};
|
|
13
|
+
const rowFixture = (table, data, permissions = metadata.$permissions) => ({
|
|
14
|
+
...metadata,
|
|
15
|
+
$permissions: permissions,
|
|
16
|
+
$tableId: appwrite.ids.tables[table],
|
|
17
|
+
...data,
|
|
18
|
+
});
|
|
12
19
|
const validRows = {
|
|
13
|
-
accounts: {
|
|
14
|
-
...metadata,
|
|
15
|
-
$tableId: 'accounts',
|
|
20
|
+
accounts: rowFixture('accounts', {
|
|
16
21
|
colour: '#000000',
|
|
17
22
|
credential: null,
|
|
18
23
|
displayName: null,
|
|
@@ -30,10 +35,8 @@ const validRows = {
|
|
|
30
35
|
profileAssignmentKey: 'user-1',
|
|
31
36
|
provider: 'GMAIL',
|
|
32
37
|
state: 'CONNECTED',
|
|
33
|
-
},
|
|
34
|
-
aliases: {
|
|
35
|
-
...metadata,
|
|
36
|
-
$tableId: 'aliases',
|
|
38
|
+
}),
|
|
39
|
+
aliases: rowFixture('aliases', {
|
|
37
40
|
account: 'account-1',
|
|
38
41
|
accountAssignmentKey: 'account-1',
|
|
39
42
|
email: 'marco@example.com',
|
|
@@ -41,10 +44,8 @@ const validRows = {
|
|
|
41
44
|
name: 'Marco',
|
|
42
45
|
providerId: 'provider-1',
|
|
43
46
|
signature: '<p>Test signature</p>',
|
|
44
|
-
},
|
|
45
|
-
commands: {
|
|
46
|
-
...metadata,
|
|
47
|
-
$tableId: 'commands_v2',
|
|
47
|
+
}),
|
|
48
|
+
commands: rowFixture('commands', {
|
|
48
49
|
account: null,
|
|
49
50
|
accountId: null,
|
|
50
51
|
attempts: 0,
|
|
@@ -58,10 +59,8 @@ const validRows = {
|
|
|
58
59
|
state: 'ACCEPTED',
|
|
59
60
|
submittedAt: '2026-07-15T00:00:00.000Z',
|
|
60
61
|
userId: 'user-1',
|
|
61
|
-
},
|
|
62
|
-
contacts: {
|
|
63
|
-
...metadata,
|
|
64
|
-
$tableId: 'contacts',
|
|
62
|
+
}),
|
|
63
|
+
contacts: rowFixture('contacts', {
|
|
65
64
|
displayName: 'Marco',
|
|
66
65
|
lastContactedAt: '2026-07-15T00:00:00.000Z',
|
|
67
66
|
messageCount: 0,
|
|
@@ -69,10 +68,8 @@ const validRows = {
|
|
|
69
68
|
profile: 'user-1',
|
|
70
69
|
profileAssignmentKey: 'user-1',
|
|
71
70
|
searchText: 'marco',
|
|
72
|
-
},
|
|
73
|
-
credentials: {
|
|
74
|
-
...metadata,
|
|
75
|
-
$tableId: 'credentials',
|
|
71
|
+
}),
|
|
72
|
+
credentials: rowFixture('credentials', {
|
|
76
73
|
accountId: 'account-1',
|
|
77
74
|
encryptedPayload: 'encrypted-payload',
|
|
78
75
|
expiresAt: null,
|
|
@@ -80,10 +77,8 @@ const validRows = {
|
|
|
80
77
|
refreshLeaseExpiresAt: null,
|
|
81
78
|
refreshLeaseId: null,
|
|
82
79
|
userId: 'user-1',
|
|
83
|
-
},
|
|
84
|
-
drafts: {
|
|
85
|
-
...metadata,
|
|
86
|
-
$tableId: 'drafts',
|
|
80
|
+
}),
|
|
81
|
+
drafts: rowFixture('drafts', {
|
|
87
82
|
account: 'account-1',
|
|
88
83
|
accountAssignmentKey: 'account-1',
|
|
89
84
|
attachmentMetadata: '[]',
|
|
@@ -100,10 +95,8 @@ const validRows = {
|
|
|
100
95
|
sequence: 0,
|
|
101
96
|
status: 'DRAFT',
|
|
102
97
|
type: 'COMPOSE',
|
|
103
|
-
},
|
|
104
|
-
jobs: {
|
|
105
|
-
...metadata,
|
|
106
|
-
$tableId: 'jobs_v2',
|
|
98
|
+
}),
|
|
99
|
+
jobs: rowFixture('jobs', {
|
|
107
100
|
accountId: null,
|
|
108
101
|
attempts: 0,
|
|
109
102
|
commandId: 'command-1',
|
|
@@ -117,10 +110,8 @@ const validRows = {
|
|
|
117
110
|
payload: '{"threadId":"thread-1"}',
|
|
118
111
|
state: 'PENDING',
|
|
119
112
|
userId: 'user-1',
|
|
120
|
-
},
|
|
121
|
-
labels: {
|
|
122
|
-
...metadata,
|
|
123
|
-
$tableId: 'labels',
|
|
113
|
+
}),
|
|
114
|
+
labels: rowFixture('labels', {
|
|
124
115
|
account: 'account-1',
|
|
125
116
|
accountAssignmentKey: 'account-1',
|
|
126
117
|
name: null,
|
|
@@ -129,10 +120,8 @@ const validRows = {
|
|
|
129
120
|
specialUse: 'INBOX',
|
|
130
121
|
totalCount: 0,
|
|
131
122
|
unreadCount: 0,
|
|
132
|
-
},
|
|
133
|
-
mailboxSyncCandidates: {
|
|
134
|
-
...metadata,
|
|
135
|
-
$tableId: 'mailbox_sync_candidates_v2',
|
|
123
|
+
}),
|
|
124
|
+
mailboxSyncCandidates: rowFixture('mailboxSyncCandidates', {
|
|
136
125
|
account: 'account-1',
|
|
137
126
|
accountId: 'account-1',
|
|
138
127
|
generation: 1,
|
|
@@ -148,11 +137,8 @@ const validRows = {
|
|
|
148
137
|
uid: 1,
|
|
149
138
|
uidValidity: 1,
|
|
150
139
|
userId: 'user-1',
|
|
151
|
-
},
|
|
152
|
-
mailboxSyncLanes: {
|
|
153
|
-
...metadata,
|
|
154
|
-
$permissions: [],
|
|
155
|
-
$tableId: 'mailbox_sync_lanes',
|
|
140
|
+
}),
|
|
141
|
+
mailboxSyncLanes: rowFixture('mailboxSyncLanes', {
|
|
156
142
|
account: 'test-account-id-1',
|
|
157
143
|
accountId: 'test-account-id-1',
|
|
158
144
|
commandId: 'sync_test-command-id-1',
|
|
@@ -162,10 +148,8 @@ const validRows = {
|
|
|
162
148
|
lane: 'HEAD',
|
|
163
149
|
state: 'RUNNING',
|
|
164
150
|
userId: 'test-user-id-1',
|
|
165
|
-
},
|
|
166
|
-
mailboxSyncStates: {
|
|
167
|
-
...metadata,
|
|
168
|
-
$tableId: 'mailbox_sync_states',
|
|
151
|
+
}, []),
|
|
152
|
+
mailboxSyncStates: rowFixture('mailboxSyncStates', {
|
|
169
153
|
accountId: 'account-1',
|
|
170
154
|
errorCode: null,
|
|
171
155
|
lastEventAt: null,
|
|
@@ -178,10 +162,8 @@ const validRows = {
|
|
|
178
162
|
state: 'CURRENT',
|
|
179
163
|
uidValidity: null,
|
|
180
164
|
userId: 'user-1',
|
|
181
|
-
},
|
|
182
|
-
messageLocations: {
|
|
183
|
-
...metadata,
|
|
184
|
-
$tableId: 'message_locations',
|
|
165
|
+
}),
|
|
166
|
+
messageLocations: rowFixture('messageLocations', {
|
|
185
167
|
account: 'account-1',
|
|
186
168
|
accountAssignmentKey: 'account-1',
|
|
187
169
|
flagged: false,
|
|
@@ -194,10 +176,8 @@ const validRows = {
|
|
|
194
176
|
threadAssignmentKey: 'thread-1',
|
|
195
177
|
uid: 1,
|
|
196
178
|
uidValidity: 1,
|
|
197
|
-
},
|
|
198
|
-
messages: {
|
|
199
|
-
...metadata,
|
|
200
|
-
$tableId: 'messages',
|
|
179
|
+
}),
|
|
180
|
+
messages: rowFixture('messages', {
|
|
201
181
|
account: 'account-1',
|
|
202
182
|
accountAssignmentKey: 'account-1',
|
|
203
183
|
attachmentMetadata: '[]',
|
|
@@ -216,10 +196,8 @@ const validRows = {
|
|
|
216
196
|
subject: 'Test subject',
|
|
217
197
|
thread: 'thread-1',
|
|
218
198
|
threadAssignmentKey: 'thread-1',
|
|
219
|
-
},
|
|
220
|
-
oauthStates: {
|
|
221
|
-
...metadata,
|
|
222
|
-
$tableId: 'oauth_states',
|
|
199
|
+
}),
|
|
200
|
+
oauthStates: rowFixture('oauthStates', {
|
|
223
201
|
accountId: 'account-1',
|
|
224
202
|
email: 'marco@example.com',
|
|
225
203
|
expiresAt: '2026-07-15T00:10:00.000Z',
|
|
@@ -229,17 +207,11 @@ const validRows = {
|
|
|
229
207
|
provider: 'GMAIL',
|
|
230
208
|
returnUri: 'https://app.marcoapp.io/onboarding/loading',
|
|
231
209
|
userId: 'user-1',
|
|
232
|
-
},
|
|
233
|
-
pollShardCoordinators: {
|
|
234
|
-
...metadata,
|
|
235
|
-
$permissions: [],
|
|
236
|
-
$tableId: 'poll_shard_coordinators',
|
|
210
|
+
}),
|
|
211
|
+
pollShardCoordinators: rowFixture('pollShardCoordinators', {
|
|
237
212
|
accountCursor: null,
|
|
238
|
-
},
|
|
239
|
-
pollShards: {
|
|
240
|
-
...metadata,
|
|
241
|
-
$permissions: [],
|
|
242
|
-
$tableId: 'poll_shards',
|
|
213
|
+
}, []),
|
|
214
|
+
pollShards: rowFixture('pollShards', {
|
|
243
215
|
accountIds: ['test-account-id-1'],
|
|
244
216
|
errorCode: null,
|
|
245
217
|
generation: 1,
|
|
@@ -250,63 +222,48 @@ const validRows = {
|
|
|
250
222
|
pollingSnapshot: '{"members":[],"version":1}',
|
|
251
223
|
scheduledExecutionId: null,
|
|
252
224
|
state: 'ACTIVE',
|
|
253
|
-
},
|
|
254
|
-
profileAvatarCleanups: {
|
|
255
|
-
...metadata,
|
|
256
|
-
$permissions: [],
|
|
257
|
-
$tableId: 'profile_avatar_cleanups',
|
|
225
|
+
}, []),
|
|
226
|
+
profileAvatarCleanups: rowFixture('profileAvatarCleanups', {
|
|
258
227
|
claimedAt: null,
|
|
259
228
|
claimId: null,
|
|
260
229
|
fileId: 'test-file-id-1',
|
|
261
230
|
profile: 'user-1',
|
|
262
|
-
},
|
|
263
|
-
profiles: {
|
|
264
|
-
...metadata,
|
|
265
|
-
$tableId: 'profiles',
|
|
231
|
+
}, []),
|
|
232
|
+
profiles: rowFixture('profiles', {
|
|
266
233
|
avatarFileId: null,
|
|
267
234
|
deletionRequestedAt: null,
|
|
268
235
|
email: 'marco@example.com',
|
|
269
236
|
name: null,
|
|
270
237
|
onboardingState: null,
|
|
271
238
|
timezone: null,
|
|
272
|
-
},
|
|
273
|
-
pushNotificationTokens: {
|
|
274
|
-
...metadata,
|
|
275
|
-
$tableId: 'push_notification_tokens',
|
|
239
|
+
}),
|
|
240
|
+
pushNotificationTokens: rowFixture('pushNotificationTokens', {
|
|
276
241
|
profile: 'user-1',
|
|
277
242
|
token: 'ExponentPushToken[token]',
|
|
278
243
|
userId: 'user-1',
|
|
279
|
-
},
|
|
280
|
-
savedViews: {
|
|
281
|
-
...metadata,
|
|
282
|
-
$tableId: 'saved_views',
|
|
244
|
+
}),
|
|
245
|
+
savedViews: rowFixture('savedViews', {
|
|
283
246
|
aliasIds: ['alias-1'],
|
|
284
247
|
icon: 'mail',
|
|
285
248
|
name: 'Unread',
|
|
286
249
|
profile: 'user-1',
|
|
287
|
-
},
|
|
288
|
-
threadAliases: {
|
|
289
|
-
...metadata,
|
|
290
|
-
$tableId: 'thread_aliases',
|
|
250
|
+
}),
|
|
251
|
+
threadAliases: rowFixture('threadAliases', {
|
|
291
252
|
alias: 'alias-1',
|
|
292
253
|
aliasAssignmentKey: 'alias-1',
|
|
293
254
|
latestMessageAt: '2026-07-15T00:00:00.000Z',
|
|
294
255
|
thread: 'thread-1',
|
|
295
256
|
threadAssignmentKey: 'thread-1',
|
|
296
|
-
},
|
|
297
|
-
threadLabels: {
|
|
298
|
-
...metadata,
|
|
299
|
-
$tableId: 'thread_labels',
|
|
257
|
+
}),
|
|
258
|
+
threadLabels: rowFixture('threadLabels', {
|
|
300
259
|
label: 'label-1',
|
|
301
260
|
labelAssignmentKey: 'label-1',
|
|
302
261
|
latestMessageAt: '2026-07-15T00:00:00.000Z',
|
|
303
262
|
locationCount: 1,
|
|
304
263
|
thread: 'thread-1',
|
|
305
264
|
threadAssignmentKey: 'thread-1',
|
|
306
|
-
},
|
|
307
|
-
threads: {
|
|
308
|
-
...metadata,
|
|
309
|
-
$tableId: 'threads',
|
|
265
|
+
}),
|
|
266
|
+
threads: rowFixture('threads', {
|
|
310
267
|
account: 'account-1',
|
|
311
268
|
accountAssignmentKey: 'account-1',
|
|
312
269
|
archived: false,
|
|
@@ -331,14 +288,9 @@ const validRows = {
|
|
|
331
288
|
subject: null,
|
|
332
289
|
trashed: false,
|
|
333
290
|
unseenLocationCount: 0,
|
|
334
|
-
},
|
|
335
|
-
};
|
|
336
|
-
const validPollShardCoordinatorRow = {
|
|
337
|
-
...metadata,
|
|
338
|
-
$permissions: [],
|
|
339
|
-
$tableId: 'poll_shard_coordinators',
|
|
340
|
-
accountCursor: null,
|
|
291
|
+
}),
|
|
341
292
|
};
|
|
293
|
+
const validPollShardCoordinatorRow = validRows.pollShardCoordinators;
|
|
342
294
|
const pollShardCoordinatorSchema = Object.entries(appwrite.rowSchemas).find(([table]) => table === 'pollShardCoordinators')?.[1];
|
|
343
295
|
describe('appwrite', () => {
|
|
344
296
|
it('publishes the production browser and OAuth configuration', () => {
|
|
@@ -572,160 +524,7 @@ describe('appwrite', () => {
|
|
|
572
524
|
});
|
|
573
525
|
}
|
|
574
526
|
const rowTestCases = Object.keys(validRows);
|
|
575
|
-
const metadataKeys = ['$createdAt', '$databaseId', '$id', '$permissions', '$sequence', '$tableId', '$updatedAt'];
|
|
576
|
-
const expectedRowDataKeys = {
|
|
577
|
-
accounts: [
|
|
578
|
-
'colour',
|
|
579
|
-
'credential',
|
|
580
|
-
'displayName',
|
|
581
|
-
'initialSyncCompletedAt',
|
|
582
|
-
'lastErrorCode',
|
|
583
|
-
'lastSuccessfulSyncAt',
|
|
584
|
-
'mailboxSyncState',
|
|
585
|
-
'mailProcessedCount',
|
|
586
|
-
'mailTotalCount',
|
|
587
|
-
'pollShardAssignmentId',
|
|
588
|
-
'pollShardId',
|
|
589
|
-
'primaryAlias',
|
|
590
|
-
'primaryEmail',
|
|
591
|
-
'profile',
|
|
592
|
-
'profileAssignmentKey',
|
|
593
|
-
'provider',
|
|
594
|
-
'state',
|
|
595
|
-
],
|
|
596
|
-
aliases: ['account', 'accountAssignmentKey', 'email', 'isPrimary', 'name', 'providerId', 'signature'],
|
|
597
|
-
commands: ['account', 'accountId', 'attempts', 'canonicalRevision', 'draftId', 'errorCode', 'kind', 'payload', 'payloadHash', 'profile', 'state', 'submittedAt', 'userId'],
|
|
598
|
-
contacts: ['displayName', 'lastContactedAt', 'messageCount', 'normalisedAddress', 'profile', 'profileAssignmentKey', 'searchText'],
|
|
599
|
-
credentials: ['accountId', 'encryptedPayload', 'expiresAt', 'provider', 'refreshLeaseExpiresAt', 'refreshLeaseId', 'userId'],
|
|
600
|
-
drafts: [
|
|
601
|
-
'account',
|
|
602
|
-
'accountAssignmentKey',
|
|
603
|
-
'attachmentMetadata',
|
|
604
|
-
'contentHash',
|
|
605
|
-
'envelope',
|
|
606
|
-
'errorCode',
|
|
607
|
-
'executionLeaseExpiresAt',
|
|
608
|
-
'executionLeaseId',
|
|
609
|
-
'fromAlias',
|
|
610
|
-
'html',
|
|
611
|
-
'referencedMessage',
|
|
612
|
-
'revision',
|
|
613
|
-
'scheduledAt',
|
|
614
|
-
'sequence',
|
|
615
|
-
'status',
|
|
616
|
-
'type',
|
|
617
|
-
],
|
|
618
|
-
jobs: ['accountId', 'attempts', 'commandId', 'dedupeKey', 'errorCode', 'kind', 'leaseExpiresAt', 'leaseId', 'maxAttempts', 'nextRunAt', 'payload', 'state', 'userId'],
|
|
619
|
-
labels: ['account', 'accountAssignmentKey', 'name', 'path', 'providerId', 'specialUse', 'totalCount', 'unreadCount'],
|
|
620
|
-
mailboxSyncCandidates: [
|
|
621
|
-
'account',
|
|
622
|
-
'accountId',
|
|
623
|
-
'generation',
|
|
624
|
-
'label',
|
|
625
|
-
'labelId',
|
|
626
|
-
'lane',
|
|
627
|
-
'mailboxPath',
|
|
628
|
-
'mailboxPriority',
|
|
629
|
-
'mailboxSortKey',
|
|
630
|
-
'providerId',
|
|
631
|
-
'receivedAt',
|
|
632
|
-
'specialUse',
|
|
633
|
-
'uid',
|
|
634
|
-
'uidValidity',
|
|
635
|
-
'userId',
|
|
636
|
-
],
|
|
637
|
-
mailboxSyncLanes: ['account', 'accountId', 'commandId', 'cursor', 'errorCode', 'generation', 'lane', 'state', 'userId'],
|
|
638
|
-
mailboxSyncStates: [
|
|
639
|
-
'accountId',
|
|
640
|
-
'errorCode',
|
|
641
|
-
'lastEventAt',
|
|
642
|
-
'lastSyncAt',
|
|
643
|
-
'materialisationLeaseExpiresAt',
|
|
644
|
-
'materialisationLeaseId',
|
|
645
|
-
'nextPollAt',
|
|
646
|
-
'provider',
|
|
647
|
-
'providerCursor',
|
|
648
|
-
'state',
|
|
649
|
-
'uidValidity',
|
|
650
|
-
'userId',
|
|
651
|
-
],
|
|
652
|
-
messageLocations: [
|
|
653
|
-
'account',
|
|
654
|
-
'accountAssignmentKey',
|
|
655
|
-
'flagged',
|
|
656
|
-
'label',
|
|
657
|
-
'labelAssignmentKey',
|
|
658
|
-
'message',
|
|
659
|
-
'messageAt',
|
|
660
|
-
'seen',
|
|
661
|
-
'thread',
|
|
662
|
-
'threadAssignmentKey',
|
|
663
|
-
'uid',
|
|
664
|
-
'uidValidity',
|
|
665
|
-
],
|
|
666
|
-
messages: [
|
|
667
|
-
'account',
|
|
668
|
-
'accountAssignmentKey',
|
|
669
|
-
'attachmentMetadata',
|
|
670
|
-
'htmlFileId',
|
|
671
|
-
'preview',
|
|
672
|
-
'providerId',
|
|
673
|
-
'rawFileId',
|
|
674
|
-
'receivedAt',
|
|
675
|
-
'recipients',
|
|
676
|
-
'revision',
|
|
677
|
-
'rfcMessageId',
|
|
678
|
-
'sender',
|
|
679
|
-
'senderName',
|
|
680
|
-
'sentAt',
|
|
681
|
-
'size',
|
|
682
|
-
'subject',
|
|
683
|
-
'thread',
|
|
684
|
-
'threadAssignmentKey',
|
|
685
|
-
],
|
|
686
|
-
oauthStates: ['accountId', 'email', 'expiresAt', 'nonceHash', 'operation', 'profile', 'provider', 'returnUri', 'userId'],
|
|
687
|
-
pollShardCoordinators: ['accountCursor'],
|
|
688
|
-
pollShards: ['accountIds', 'errorCode', 'generation', 'lastStartedAt', 'leaseExpiresAt', 'leaseId', 'nextStartAt', 'pollingSnapshot', 'scheduledExecutionId', 'state'],
|
|
689
|
-
profileAvatarCleanups: ['claimedAt', 'claimId', 'fileId', 'profile'],
|
|
690
|
-
profiles: ['avatarFileId', 'deletionRequestedAt', 'email', 'name', 'onboardingState', 'timezone'],
|
|
691
|
-
pushNotificationTokens: ['profile', 'token', 'userId'],
|
|
692
|
-
savedViews: ['aliasIds', 'icon', 'name', 'profile'],
|
|
693
|
-
threadAliases: ['alias', 'aliasAssignmentKey', 'latestMessageAt', 'thread', 'threadAssignmentKey'],
|
|
694
|
-
threadLabels: ['label', 'labelAssignmentKey', 'latestMessageAt', 'locationCount', 'thread', 'threadAssignmentKey'],
|
|
695
|
-
threads: [
|
|
696
|
-
'account',
|
|
697
|
-
'accountAssignmentKey',
|
|
698
|
-
'archived',
|
|
699
|
-
'firstMessageAt',
|
|
700
|
-
'flagged',
|
|
701
|
-
'flaggedLocationCount',
|
|
702
|
-
'hasAttachments',
|
|
703
|
-
'labelIds',
|
|
704
|
-
'latestMessageAt',
|
|
705
|
-
'latestMessageId',
|
|
706
|
-
'messageCount',
|
|
707
|
-
'participants',
|
|
708
|
-
'preview',
|
|
709
|
-
'providerId',
|
|
710
|
-
'revision',
|
|
711
|
-
'searchText',
|
|
712
|
-
'seen',
|
|
713
|
-
'senderEmail',
|
|
714
|
-
'senderName',
|
|
715
|
-
'snoozedUntil',
|
|
716
|
-
'spam',
|
|
717
|
-
'subject',
|
|
718
|
-
'trashed',
|
|
719
|
-
'unseenLocationCount',
|
|
720
|
-
],
|
|
721
|
-
};
|
|
722
527
|
for (const table of rowTestCases) {
|
|
723
|
-
it(`exposes backend-aligned ${table} row keys`, () => {
|
|
724
|
-
const dataKeys = Object.keys(appwrite.rowSchemas[table].entries)
|
|
725
|
-
.filter(key => !metadataKeys.includes(key))
|
|
726
|
-
.sort();
|
|
727
|
-
expect(dataKeys).toEqual([...expectedRowDataKeys[table]].sort());
|
|
728
|
-
});
|
|
729
528
|
it(`accepts the ${table} wire row`, () => {
|
|
730
529
|
expect(v.safeParse(appwrite.rowSchemas[table], validRows[table]).success).toBe(true);
|
|
731
530
|
});
|
|
@@ -837,38 +636,6 @@ describe('appwrite', () => {
|
|
|
837
636
|
expect(v.safeParse(schema, row).success).toBe(false);
|
|
838
637
|
});
|
|
839
638
|
}
|
|
840
|
-
const obsoleteRelationshipFieldTestCases = [
|
|
841
|
-
{ field: 'pollShard', row: { ...validRows.accounts, pollShard: null }, schema: appwrite.rowSchemas.accounts, table: 'accounts' },
|
|
842
|
-
{ field: 'primaryAliasId', row: { ...validRows.accounts, primaryAliasId: 'alias-1' }, schema: appwrite.rowSchemas.accounts, table: 'accounts' },
|
|
843
|
-
{ field: 'userId', row: { ...validRows.accounts, userId: 'user-1' }, schema: appwrite.rowSchemas.accounts, table: 'accounts' },
|
|
844
|
-
{ field: 'accountId', row: { ...validRows.aliases, accountId: 'account-1' }, schema: appwrite.rowSchemas.aliases, table: 'aliases' },
|
|
845
|
-
{ field: 'userId', row: { ...validRows.aliases, userId: 'user-1' }, schema: appwrite.rowSchemas.aliases, table: 'aliases' },
|
|
846
|
-
{ field: 'userId', row: { ...validRows.contacts, userId: 'user-1' }, schema: appwrite.rowSchemas.contacts, table: 'contacts' },
|
|
847
|
-
{ field: 'accountId', row: { ...validRows.drafts, accountId: 'account-1' }, schema: appwrite.rowSchemas.drafts, table: 'drafts' },
|
|
848
|
-
{ field: 'fromAliasId', row: { ...validRows.drafts, fromAliasId: 'alias-1' }, schema: appwrite.rowSchemas.drafts, table: 'drafts' },
|
|
849
|
-
{ field: 'referencedMessageId', row: { ...validRows.drafts, referencedMessageId: 'message-1' }, schema: appwrite.rowSchemas.drafts, table: 'drafts' },
|
|
850
|
-
{ field: 'userId', row: { ...validRows.drafts, userId: 'user-1' }, schema: appwrite.rowSchemas.drafts, table: 'drafts' },
|
|
851
|
-
{ field: 'accountId', row: { ...validRows.labels, accountId: 'account-1' }, schema: appwrite.rowSchemas.labels, table: 'labels' },
|
|
852
|
-
{ field: 'userId', row: { ...validRows.labels, userId: 'user-1' }, schema: appwrite.rowSchemas.labels, table: 'labels' },
|
|
853
|
-
{ field: 'accountId', row: { ...validRows.messages, accountId: 'account-1' }, schema: appwrite.rowSchemas.messages, table: 'messages' },
|
|
854
|
-
{ field: 'threadId', row: { ...validRows.messages, threadId: 'thread-1' }, schema: appwrite.rowSchemas.messages, table: 'messages' },
|
|
855
|
-
{ field: 'userId', row: { ...validRows.messages, userId: 'user-1' }, schema: appwrite.rowSchemas.messages, table: 'messages' },
|
|
856
|
-
{ field: 'accountId', row: { ...validRows.threads, accountId: 'account-1' }, schema: appwrite.rowSchemas.threads, table: 'threads' },
|
|
857
|
-
{ field: 'userId', row: { ...validRows.threads, userId: 'user-1' }, schema: appwrite.rowSchemas.threads, table: 'threads' },
|
|
858
|
-
{ field: 'accountId', row: { ...validRows.threadAliases, accountId: 'account-1' }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
|
|
859
|
-
{ field: 'aliasId', row: { ...validRows.threadAliases, aliasId: 'alias-1' }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
|
|
860
|
-
{ field: 'threadId', row: { ...validRows.threadAliases, threadId: 'thread-1' }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
|
|
861
|
-
{ field: 'userId', row: { ...validRows.threadAliases, userId: 'user-1' }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
|
|
862
|
-
{ field: 'accountId', row: { ...validRows.threadLabels, accountId: 'account-1' }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
|
|
863
|
-
{ field: 'labelId', row: { ...validRows.threadLabels, labelId: 'label-1' }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
|
|
864
|
-
{ field: 'threadId', row: { ...validRows.threadLabels, threadId: 'thread-1' }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
|
|
865
|
-
{ field: 'userId', row: { ...validRows.threadLabels, userId: 'user-1' }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
|
|
866
|
-
];
|
|
867
|
-
for (const { field, row, schema, table } of obsoleteRelationshipFieldTestCases) {
|
|
868
|
-
it(`rejects obsolete ${field} on ${table}`, () => {
|
|
869
|
-
expect(v.safeParse(schema, row).success).toBe(false);
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
639
|
const nullableColumnTestCases = [
|
|
873
640
|
{
|
|
874
641
|
description: 'alias name',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { id } from '../schemas/id';
|
|
3
|
-
import { string } from '../schemas/string';
|
|
4
|
-
import { DRAFT_TYPES } from '../types';
|
|
5
|
-
import { appwriteDraftAttachmentSchema, appwriteDraftEnvelopeSchema } from './decodedSchemas';
|
|
6
|
-
import { canonicalTimestampSchema, commandStates, isoTimestampSchema, nonNegativeIntegerSchema } from './tableContract';
|
|
2
|
+
import { id } from '../schemas/id.js';
|
|
3
|
+
import { string } from '../schemas/string.js';
|
|
4
|
+
import { DRAFT_TYPES } from '../types/index.js';
|
|
5
|
+
import { appwriteDraftAttachmentSchema, appwriteDraftEnvelopeSchema } from './decodedSchemas.js';
|
|
6
|
+
import { canonicalTimestampSchema, commandStates, isoTimestampSchema, nonNegativeIntegerSchema } from './tableContract/index.js';
|
|
7
7
|
const commandIdSchema = v.pipe(v.string(), v.uuid(), v.brand('CommandId'));
|
|
8
8
|
const appwriteThreadCommandBatchSize = 100;
|
|
9
9
|
const threadIdsSchema = v.pipe(v.array(id.threadId.required()), v.minLength(1), v.maxLength(appwriteThreadCommandBatchSize));
|