@marcoappio/marco-config 2.0.573 → 2.0.575

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appwrite.d.ts","sourceRoot":"","sources":["../../src/appwrite/appwrite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAgE5B,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoLN,CAAA;AAEV,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYX,CAAA;AAEV,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,UAAU,CAAA;AACtD,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,gBAAgB,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA"}
@@ -0,0 +1,246 @@
1
+ import * as v from 'valibot';
2
+ const identifierSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(255));
3
+ const appwriteRowIdSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(36), v.regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/));
4
+ const timestampSchema = v.pipe(v.string(), v.isoTimestamp());
5
+ const nonNegativeIntegerSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
6
+ const colourSchema = v.pipe(v.string(), v.maxLength(64));
7
+ const emailSchema = v.pipe(v.string(), v.email());
8
+ const jsonArrayTextSchema = v.pipe(v.string(), v.parseJson(), v.array(v.unknown()));
9
+ const jsonObjectTextSchema = v.pipe(v.string(), v.parseJson(), v.check(value => !Array.isArray(value)), v.looseObject({}));
10
+ const accountProviders = ['GMAIL', 'OUTLOOK', 'IMAP'];
11
+ const accountStates = ['AWAITING_CONNECTION', 'CONNECTED', 'ERROR', 'DISCONNECTED'];
12
+ const commandStates = ['ACCEPTED', 'RUNNING', 'SUCCEEDED', 'FAILED'];
13
+ const draftStates = ['DRAFT', 'SCHEDULED', 'SENDING', 'SENT', 'FAILED', 'CANCELLED'];
14
+ const draftTypes = ['COMPOSE', 'REPLY', 'FORWARD'];
15
+ const jobStates = ['PENDING', 'RUNNING', 'SUCCEEDED', 'FAILED', 'CANCELLED'];
16
+ const labelSpecialUses = ['ALL', 'ARCHIVE', 'DRAFTS', 'INBOX', 'JUNK', 'SENT', 'STARRED', 'TRASH'];
17
+ const mailboxSyncStates = ['INITIAL', 'SYNCING', 'IDLE', 'ERROR'];
18
+ const watcherShardStates = ['ACTIVE', 'IDLE', 'STOPPED', 'FAILED'];
19
+ const appwriteIds = {
20
+ bucket: 'marco-files',
21
+ database: 'marco',
22
+ functions: {
23
+ api: 'marco-api',
24
+ worker: 'marco-worker',
25
+ },
26
+ tables: {
27
+ accounts: 'accounts',
28
+ aliases: 'aliases',
29
+ commands: 'commands',
30
+ contacts: 'contacts',
31
+ credentials: 'credentials',
32
+ drafts: 'drafts',
33
+ jobs: 'jobs',
34
+ labels: 'labels',
35
+ mailboxSyncStates: 'mailbox_sync_states',
36
+ messages: 'messages',
37
+ profiles: 'profiles',
38
+ pushNotificationTokens: 'push_notification_tokens',
39
+ savedViews: 'saved_views',
40
+ threads: 'threads',
41
+ watcherShards: 'watcher_shards',
42
+ },
43
+ };
44
+ const wireMetadata = (tableId) => ({
45
+ $createdAt: timestampSchema,
46
+ $databaseId: v.literal(appwriteIds.database),
47
+ $id: appwriteRowIdSchema,
48
+ $permissions: v.array(v.string()),
49
+ $sequence: nonNegativeIntegerSchema,
50
+ $tableId: v.literal(tableId),
51
+ $updatedAt: timestampSchema,
52
+ });
53
+ const rowSchemas = {
54
+ accounts: v.strictObject({
55
+ ...wireMetadata(appwriteIds.tables.accounts),
56
+ colour: colourSchema,
57
+ displayName: v.optional(identifierSchema),
58
+ initialSyncCompletedAt: v.optional(timestampSchema),
59
+ lastErrorCode: v.optional(identifierSchema),
60
+ lastSuccessfulSyncAt: v.optional(timestampSchema),
61
+ mailProcessedCount: nonNegativeIntegerSchema,
62
+ mailTotalCount: nonNegativeIntegerSchema,
63
+ primaryAliasId: v.optional(identifierSchema),
64
+ primaryEmail: emailSchema,
65
+ provider: v.picklist(accountProviders),
66
+ state: v.picklist(accountStates),
67
+ userId: identifierSchema,
68
+ watcherShardId: v.optional(identifierSchema),
69
+ }),
70
+ aliases: v.strictObject({
71
+ ...wireMetadata(appwriteIds.tables.aliases),
72
+ accountId: identifierSchema,
73
+ email: emailSchema,
74
+ isPrimary: v.boolean(),
75
+ name: v.optional(identifierSchema),
76
+ providerId: identifierSchema,
77
+ signature: v.optional(v.string()),
78
+ userId: identifierSchema,
79
+ }),
80
+ commands: v.strictObject({
81
+ ...wireMetadata(appwriteIds.tables.commands),
82
+ accountId: v.nullable(identifierSchema),
83
+ attempts: nonNegativeIntegerSchema,
84
+ canonicalRevision: v.nullable(nonNegativeIntegerSchema),
85
+ errorCode: v.nullable(identifierSchema),
86
+ kind: identifierSchema,
87
+ payload: v.string(),
88
+ payloadHash: identifierSchema,
89
+ state: v.picklist(commandStates),
90
+ submittedAt: timestampSchema,
91
+ userId: identifierSchema,
92
+ }),
93
+ contacts: v.strictObject({
94
+ ...wireMetadata(appwriteIds.tables.contacts),
95
+ displayName: v.optional(identifierSchema),
96
+ lastContactedAt: v.optional(timestampSchema),
97
+ messageCount: nonNegativeIntegerSchema,
98
+ normalisedAddress: emailSchema,
99
+ searchText: v.string(),
100
+ userId: identifierSchema,
101
+ }),
102
+ credentials: v.strictObject({
103
+ ...wireMetadata(appwriteIds.tables.credentials),
104
+ encryptedPayload: v.string(),
105
+ expiresAt: v.optional(timestampSchema),
106
+ provider: v.picklist(accountProviders),
107
+ userId: identifierSchema,
108
+ }),
109
+ drafts: v.strictObject({
110
+ ...wireMetadata(appwriteIds.tables.drafts),
111
+ accountId: identifierSchema,
112
+ attachmentMetadata: v.string(),
113
+ contentHash: identifierSchema,
114
+ envelope: v.string(),
115
+ errorCode: v.nullable(identifierSchema),
116
+ fromAliasId: v.nullable(identifierSchema),
117
+ html: v.string(),
118
+ referencedMessageId: v.nullable(identifierSchema),
119
+ revision: nonNegativeIntegerSchema,
120
+ scheduledAt: v.nullable(timestampSchema),
121
+ sequence: nonNegativeIntegerSchema,
122
+ status: v.picklist(draftStates),
123
+ type: v.picklist(draftTypes),
124
+ userId: identifierSchema,
125
+ }),
126
+ jobs: v.strictObject({
127
+ ...wireMetadata(appwriteIds.tables.jobs),
128
+ accountId: v.nullable(identifierSchema),
129
+ attempts: nonNegativeIntegerSchema,
130
+ commandId: identifierSchema,
131
+ dedupeKey: identifierSchema,
132
+ errorCode: v.nullable(identifierSchema),
133
+ kind: identifierSchema,
134
+ leaseExpiresAt: v.nullable(timestampSchema),
135
+ leaseId: v.nullable(identifierSchema),
136
+ maxAttempts: nonNegativeIntegerSchema,
137
+ nextRunAt: timestampSchema,
138
+ payload: v.string(),
139
+ state: v.picklist(jobStates),
140
+ userId: identifierSchema,
141
+ }),
142
+ labels: v.strictObject({
143
+ ...wireMetadata(appwriteIds.tables.labels),
144
+ accountId: identifierSchema,
145
+ path: identifierSchema,
146
+ providerId: identifierSchema,
147
+ specialUse: v.nullable(v.picklist(labelSpecialUses)),
148
+ totalCount: nonNegativeIntegerSchema,
149
+ unreadCount: nonNegativeIntegerSchema,
150
+ userId: identifierSchema,
151
+ }),
152
+ mailboxSyncStates: v.strictObject({
153
+ ...wireMetadata(appwriteIds.tables.mailboxSyncStates),
154
+ errorCode: v.nullable(identifierSchema),
155
+ lastEventAt: v.nullable(timestampSchema),
156
+ lastSyncAt: v.nullable(timestampSchema),
157
+ nextPollAt: v.nullable(timestampSchema),
158
+ provider: v.picklist(accountProviders),
159
+ providerCursor: v.nullable(v.string()),
160
+ state: v.picklist(mailboxSyncStates),
161
+ uidValidity: v.nullable(v.string()),
162
+ userId: identifierSchema,
163
+ }),
164
+ messages: v.strictObject({
165
+ ...wireMetadata(appwriteIds.tables.messages),
166
+ accountId: identifierSchema,
167
+ attachmentMetadata: v.string(),
168
+ htmlFileId: v.nullable(identifierSchema),
169
+ preview: v.string(),
170
+ providerId: identifierSchema,
171
+ rawFileId: v.nullable(identifierSchema),
172
+ receivedAt: v.nullable(timestampSchema),
173
+ recipients: v.string(),
174
+ revision: nonNegativeIntegerSchema,
175
+ rfcMessageId: v.nullable(identifierSchema),
176
+ sender: v.string(),
177
+ sentAt: timestampSchema,
178
+ size: nonNegativeIntegerSchema,
179
+ threadId: identifierSchema,
180
+ userId: identifierSchema,
181
+ }),
182
+ profiles: v.strictObject({
183
+ ...wireMetadata(appwriteIds.tables.profiles),
184
+ email: emailSchema,
185
+ name: v.optional(identifierSchema),
186
+ onboardingState: v.optional(identifierSchema),
187
+ timezone: v.optional(identifierSchema),
188
+ }),
189
+ pushNotificationTokens: v.strictObject({
190
+ ...wireMetadata(appwriteIds.tables.pushNotificationTokens),
191
+ token: identifierSchema,
192
+ userId: identifierSchema,
193
+ }),
194
+ savedViews: v.strictObject({
195
+ ...wireMetadata(appwriteIds.tables.savedViews),
196
+ aliasEmails: v.array(emailSchema),
197
+ icon: v.optional(identifierSchema),
198
+ name: identifierSchema,
199
+ }),
200
+ threads: v.strictObject({
201
+ ...wireMetadata(appwriteIds.tables.threads),
202
+ accountId: identifierSchema,
203
+ archived: v.boolean(),
204
+ flagged: v.boolean(),
205
+ hasAttachments: v.boolean(),
206
+ labelIds: v.array(identifierSchema),
207
+ latestMessageAt: timestampSchema,
208
+ latestMessageId: identifierSchema,
209
+ messageCount: nonNegativeIntegerSchema,
210
+ participants: v.string(),
211
+ preview: v.string(),
212
+ providerId: identifierSchema,
213
+ revision: nonNegativeIntegerSchema,
214
+ searchText: v.string(),
215
+ seen: v.boolean(),
216
+ snoozedUntil: v.nullable(timestampSchema),
217
+ spam: v.boolean(),
218
+ subject: v.nullable(v.string()),
219
+ trashed: v.boolean(),
220
+ userId: identifierSchema,
221
+ }),
222
+ watcherShards: v.strictObject({
223
+ ...wireMetadata(appwriteIds.tables.watcherShards),
224
+ accountIds: v.array(identifierSchema),
225
+ errorCode: v.nullable(identifierSchema),
226
+ generation: nonNegativeIntegerSchema,
227
+ heartbeatAt: v.nullable(timestampSchema),
228
+ lastHandoffAt: v.nullable(timestampSchema),
229
+ leaseExpiresAt: v.nullable(timestampSchema),
230
+ leaseId: v.nullable(identifierSchema),
231
+ state: v.picklist(watcherShardStates),
232
+ }),
233
+ };
234
+ export const appwrite = {
235
+ decodedSchemas: {
236
+ attachmentMetadata: jsonArrayTextSchema,
237
+ commandPayload: jsonObjectTextSchema,
238
+ draftEnvelope: jsonObjectTextSchema,
239
+ jobPayload: jsonObjectTextSchema,
240
+ messageRecipients: jsonArrayTextSchema,
241
+ messageSender: jsonObjectTextSchema,
242
+ threadParticipants: jsonArrayTextSchema,
243
+ },
244
+ ids: appwriteIds,
245
+ rowSchemas,
246
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=appwrite.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appwrite.test.d.ts","sourceRoot":"","sources":["../../src/appwrite/appwrite.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,301 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import * as v from 'valibot';
3
+ import { appwrite } from './appwrite';
4
+ const metadata = {
5
+ $createdAt: '2026-07-15T00:00:00.000Z',
6
+ $databaseId: 'marco',
7
+ $id: 'row-1',
8
+ $permissions: ['read("user:user-1")'],
9
+ $sequence: 1,
10
+ $updatedAt: '2026-07-15T00:00:00.000Z',
11
+ };
12
+ const validRows = {
13
+ accounts: {
14
+ ...metadata,
15
+ $tableId: 'accounts',
16
+ colour: '#000000',
17
+ mailProcessedCount: 0,
18
+ mailTotalCount: 0,
19
+ primaryEmail: 'marco@example.com',
20
+ provider: 'GMAIL',
21
+ state: 'CONNECTED',
22
+ userId: 'user-1',
23
+ },
24
+ aliases: {
25
+ ...metadata,
26
+ $tableId: 'aliases',
27
+ accountId: 'account-1',
28
+ email: 'marco@example.com',
29
+ isPrimary: true,
30
+ providerId: 'provider-1',
31
+ userId: 'user-1',
32
+ },
33
+ commands: {
34
+ ...metadata,
35
+ $tableId: 'commands',
36
+ accountId: null,
37
+ attempts: 0,
38
+ canonicalRevision: null,
39
+ errorCode: null,
40
+ kind: 'thread.archive',
41
+ payload: '{"threadId":"thread-1"}',
42
+ payloadHash: 'hash-1',
43
+ state: 'ACCEPTED',
44
+ submittedAt: '2026-07-15T00:00:00.000Z',
45
+ userId: 'user-1',
46
+ },
47
+ contacts: {
48
+ ...metadata,
49
+ $tableId: 'contacts',
50
+ messageCount: 0,
51
+ normalisedAddress: 'marco@example.com',
52
+ searchText: 'marco',
53
+ userId: 'user-1',
54
+ },
55
+ credentials: {
56
+ ...metadata,
57
+ $tableId: 'credentials',
58
+ encryptedPayload: 'encrypted-payload',
59
+ provider: 'GMAIL',
60
+ userId: 'user-1',
61
+ },
62
+ drafts: {
63
+ ...metadata,
64
+ $tableId: 'drafts',
65
+ accountId: 'account-1',
66
+ attachmentMetadata: '[]',
67
+ contentHash: 'hash-1',
68
+ envelope: '{"to":[]}',
69
+ errorCode: null,
70
+ fromAliasId: null,
71
+ html: '<p>Draft</p>',
72
+ referencedMessageId: null,
73
+ revision: 0,
74
+ scheduledAt: null,
75
+ sequence: 0,
76
+ status: 'DRAFT',
77
+ type: 'COMPOSE',
78
+ userId: 'user-1',
79
+ },
80
+ jobs: {
81
+ ...metadata,
82
+ $tableId: 'jobs',
83
+ accountId: null,
84
+ attempts: 0,
85
+ commandId: 'command-1',
86
+ dedupeKey: 'dedupe-1',
87
+ errorCode: null,
88
+ kind: 'thread.archive',
89
+ leaseExpiresAt: null,
90
+ leaseId: null,
91
+ maxAttempts: 3,
92
+ nextRunAt: '2026-07-15T00:00:00.000Z',
93
+ payload: '{"threadId":"thread-1"}',
94
+ state: 'PENDING',
95
+ userId: 'user-1',
96
+ },
97
+ labels: {
98
+ ...metadata,
99
+ $tableId: 'labels',
100
+ accountId: 'account-1',
101
+ path: 'Inbox',
102
+ providerId: 'provider-1',
103
+ specialUse: 'INBOX',
104
+ totalCount: 0,
105
+ unreadCount: 0,
106
+ userId: 'user-1',
107
+ },
108
+ mailboxSyncStates: {
109
+ ...metadata,
110
+ $tableId: 'mailbox_sync_states',
111
+ errorCode: null,
112
+ lastEventAt: null,
113
+ lastSyncAt: null,
114
+ nextPollAt: null,
115
+ provider: 'GMAIL',
116
+ providerCursor: null,
117
+ state: 'IDLE',
118
+ uidValidity: null,
119
+ userId: 'user-1',
120
+ },
121
+ messages: {
122
+ ...metadata,
123
+ $tableId: 'messages',
124
+ accountId: 'account-1',
125
+ attachmentMetadata: '[]',
126
+ htmlFileId: null,
127
+ preview: 'Preview',
128
+ providerId: 'provider-1',
129
+ rawFileId: null,
130
+ receivedAt: null,
131
+ recipients: '[]',
132
+ revision: 0,
133
+ rfcMessageId: null,
134
+ sender: '{"email":"marco@example.com"}',
135
+ sentAt: '2026-07-15T00:00:00.000Z',
136
+ size: 1,
137
+ threadId: 'thread-1',
138
+ userId: 'user-1',
139
+ },
140
+ profiles: {
141
+ ...metadata,
142
+ $tableId: 'profiles',
143
+ email: 'marco@example.com',
144
+ },
145
+ pushNotificationTokens: {
146
+ ...metadata,
147
+ $tableId: 'push_notification_tokens',
148
+ token: 'ExponentPushToken[token]',
149
+ userId: 'user-1',
150
+ },
151
+ savedViews: {
152
+ ...metadata,
153
+ $tableId: 'saved_views',
154
+ aliasEmails: ['marco@example.com'],
155
+ name: 'Unread',
156
+ },
157
+ threads: {
158
+ ...metadata,
159
+ $tableId: 'threads',
160
+ accountId: 'account-1',
161
+ archived: false,
162
+ flagged: false,
163
+ hasAttachments: false,
164
+ labelIds: ['label-1'],
165
+ latestMessageAt: '2026-07-15T00:00:00.000Z',
166
+ latestMessageId: 'message-1',
167
+ messageCount: 1,
168
+ participants: '[]',
169
+ preview: 'Preview',
170
+ providerId: 'provider-1',
171
+ revision: 0,
172
+ searchText: 'preview',
173
+ seen: true,
174
+ snoozedUntil: null,
175
+ spam: false,
176
+ subject: null,
177
+ trashed: false,
178
+ userId: 'user-1',
179
+ },
180
+ watcherShards: {
181
+ ...metadata,
182
+ $tableId: 'watcher_shards',
183
+ accountIds: ['account-1'],
184
+ errorCode: null,
185
+ generation: 1,
186
+ heartbeatAt: null,
187
+ lastHandoffAt: null,
188
+ leaseExpiresAt: null,
189
+ leaseId: null,
190
+ state: 'ACTIVE',
191
+ },
192
+ };
193
+ describe('appwrite', () => {
194
+ it('exports the approved resource identifiers', () => {
195
+ expect(appwrite.ids).toEqual({
196
+ bucket: 'marco-files',
197
+ database: 'marco',
198
+ functions: { api: 'marco-api', worker: 'marco-worker' },
199
+ tables: {
200
+ accounts: 'accounts',
201
+ aliases: 'aliases',
202
+ commands: 'commands',
203
+ contacts: 'contacts',
204
+ credentials: 'credentials',
205
+ drafts: 'drafts',
206
+ jobs: 'jobs',
207
+ labels: 'labels',
208
+ mailboxSyncStates: 'mailbox_sync_states',
209
+ messages: 'messages',
210
+ profiles: 'profiles',
211
+ pushNotificationTokens: 'push_notification_tokens',
212
+ savedViews: 'saved_views',
213
+ threads: 'threads',
214
+ watcherShards: 'watcher_shards',
215
+ },
216
+ });
217
+ });
218
+ const rowTestCases = Object.keys(validRows);
219
+ for (const table of rowTestCases) {
220
+ it(`accepts the ${table} wire row`, () => {
221
+ expect(v.safeParse(appwrite.rowSchemas[table], validRows[table]).success).toBe(true);
222
+ });
223
+ it(`rejects incomplete ${table} metadata`, () => {
224
+ const { $id: _, ...rowWithoutId } = validRows[table];
225
+ expect(v.safeParse(appwrite.rowSchemas[table], rowWithoutId).success).toBe(false);
226
+ });
227
+ }
228
+ const invalidAccountRows = [
229
+ { description: 'an unknown state', row: { ...validRows.accounts, state: 'UNKNOWN' } },
230
+ { description: 'an unknown database ID', row: { ...validRows.accounts, $databaseId: 'other' } },
231
+ { description: 'a leading separator in $id', row: { ...validRows.accounts, $id: '-row-1' } },
232
+ { description: 'an overlong $id', row: { ...validRows.accounts, $id: 'a'.repeat(37) } },
233
+ ];
234
+ for (const testCase of invalidAccountRows) {
235
+ it(`rejects ${testCase.description}`, () => {
236
+ expect(v.safeParse(appwrite.rowSchemas.accounts, testCase.row).success).toBe(false);
237
+ });
238
+ }
239
+ const jsonTextTestCases = [
240
+ {
241
+ expected: [],
242
+ invalidValue: '{}',
243
+ name: 'attachment metadata',
244
+ schema: appwrite.decodedSchemas.attachmentMetadata,
245
+ value: '[]',
246
+ },
247
+ {
248
+ expected: { threadId: 'thread-1' },
249
+ invalidValue: '[]',
250
+ name: 'command payload',
251
+ schema: appwrite.decodedSchemas.commandPayload,
252
+ value: '{"threadId":"thread-1"}',
253
+ },
254
+ {
255
+ expected: { to: [] },
256
+ invalidValue: '[]',
257
+ name: 'draft envelope',
258
+ schema: appwrite.decodedSchemas.draftEnvelope,
259
+ value: '{"to":[]}',
260
+ },
261
+ {
262
+ expected: { threadId: 'thread-1' },
263
+ invalidValue: '[]',
264
+ name: 'job payload',
265
+ schema: appwrite.decodedSchemas.jobPayload,
266
+ value: '{"threadId":"thread-1"}',
267
+ },
268
+ {
269
+ expected: [],
270
+ invalidValue: '{}',
271
+ name: 'message recipients',
272
+ schema: appwrite.decodedSchemas.messageRecipients,
273
+ value: '[]',
274
+ },
275
+ {
276
+ expected: { email: 'marco@example.com' },
277
+ invalidValue: '[]',
278
+ name: 'message sender',
279
+ schema: appwrite.decodedSchemas.messageSender,
280
+ value: '{"email":"marco@example.com"}',
281
+ },
282
+ {
283
+ expected: [],
284
+ invalidValue: '{}',
285
+ name: 'thread participants',
286
+ schema: appwrite.decodedSchemas.threadParticipants,
287
+ value: '[]',
288
+ },
289
+ ];
290
+ for (const testCase of jsonTextTestCases) {
291
+ it(`decodes ${testCase.name} JSON text`, () => {
292
+ const result = v.safeParse(testCase.schema, testCase.value);
293
+ expect(result.success).toBe(true);
294
+ if (result.success) {
295
+ expect(result.output).toEqual(testCase.expected);
296
+ }
297
+ expect(v.safeParse(testCase.schema, testCase.invalidValue).success).toBe(false);
298
+ expect(v.safeParse(testCase.schema, '{').success).toBe(false);
299
+ });
300
+ }
301
+ });
@@ -0,0 +1,2 @@
1
+ export { type AppwriteRow, type AppwriteRowTable, appwrite } from './appwrite';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appwrite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1 @@
1
+ export { appwrite } from './appwrite';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { type AppwriteRow, type AppwriteRowTable, appwrite } from './appwrite';
1
2
  export { marcoConstants } from './constants';
2
3
  export { MARCO_ENV, MarcoEnvironment, marcoPublicConfig } from './marcoPublicConfig';
3
4
  export { type Account, type AccountAlias, type AccountId, type AccountLabel, type AliasId, type AttachmentId, type Contact, type ContactId, type Draft, type DraftAttachment, type DraftBody, type DraftId, type LabelId, type MessageId, marcoSchemas, type PushNotificationTokenId, type RecipientId, type Thread, type ThreadId, type ThreadMessage, type ThreadMessageAttachment, type ThreadMessageRecipient, type User, type UserId, type UserPushNotificationToken, type UserView, type ViewId, } from './schemas';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,YAAY,EACZ,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,MAAM,GACZ,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,YAAY,EACZ,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,MAAM,GACZ,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { appwrite } from './appwrite';
1
2
  export { marcoConstants } from './constants';
2
3
  export { MARCO_ENV, marcoPublicConfig } from './marcoPublicConfig';
3
4
  export { marcoSchemas, } from './schemas';
@@ -586,36 +586,36 @@ export declare const marcoSchemas: {
586
586
  readonly to: import("valibot").ArraySchema<import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RfcEmailAction<string, undefined>]>, undefined>, undefined>;
587
587
  }, "content">;
588
588
  readonly '~standard': import("valibot").StandardProps<{
589
+ subject: string | null;
589
590
  bcc: string[];
590
591
  cc: string[];
591
592
  to: string[];
592
- subject: string | null;
593
593
  }, {
594
+ subject: string | null;
594
595
  bcc: string[];
595
596
  cc: string[];
596
597
  to: string[];
597
- subject: string | null;
598
598
  }>;
599
599
  readonly '~run': (dataset: import("valibot").UnknownDataset, config: import("valibot").Config<import("valibot").BaseIssue<unknown>>) => import("valibot").OutputDataset<{
600
+ subject: string | null;
600
601
  bcc: string[];
601
602
  cc: string[];
602
603
  to: string[];
603
- subject: string | null;
604
- }, import("valibot").ObjectIssue | import("valibot").StringIssue | import("valibot").ArrayIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, number> | import("valibot").NonOptionalIssue | import("valibot").RfcEmailIssue<string>>;
604
+ }, import("valibot").StringIssue | import("valibot").ArrayIssue | import("valibot").ObjectIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, number> | import("valibot").NonOptionalIssue | import("valibot").RfcEmailIssue<string>>;
605
605
  readonly '~types'?: {
606
606
  readonly input: {
607
+ subject: string | null;
607
608
  bcc: string[];
608
609
  cc: string[];
609
610
  to: string[];
610
- subject: string | null;
611
611
  };
612
612
  readonly output: {
613
+ subject: string | null;
613
614
  bcc: string[];
614
615
  cc: string[];
615
616
  to: string[];
616
- subject: string | null;
617
617
  };
618
- readonly issue: import("valibot").ObjectIssue | import("valibot").StringIssue | import("valibot").ArrayIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, number> | import("valibot").NonOptionalIssue | import("valibot").RfcEmailIssue<string>;
618
+ readonly issue: import("valibot").StringIssue | import("valibot").ArrayIssue | import("valibot").ObjectIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, number> | import("valibot").NonOptionalIssue | import("valibot").RfcEmailIssue<string>;
619
619
  } | undefined;
620
620
  };
621
621
  readonly id: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>, import("valibot").BrandAction<string, "DraftId">]>, undefined>;
@@ -161,36 +161,36 @@ export declare const mutatorSchemas: {
161
161
  readonly to: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, undefined>, undefined>;
162
162
  }, "content">;
163
163
  readonly '~standard': v.StandardProps<{
164
+ subject: string | null;
164
165
  bcc: string[];
165
166
  cc: string[];
166
167
  to: string[];
167
- subject: string | null;
168
168
  }, {
169
+ subject: string | null;
169
170
  bcc: string[];
170
171
  cc: string[];
171
172
  to: string[];
172
- subject: string | null;
173
173
  }>;
174
174
  readonly '~run': (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
175
+ subject: string | null;
175
176
  bcc: string[];
176
177
  cc: string[];
177
178
  to: string[];
178
- subject: string | null;
179
- }, v.ObjectIssue | v.StringIssue | v.ArrayIssue | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, number> | v.NonOptionalIssue | v.RfcEmailIssue<string>>;
179
+ }, v.StringIssue | v.ArrayIssue | v.ObjectIssue | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, number> | v.NonOptionalIssue | v.RfcEmailIssue<string>>;
180
180
  readonly '~types'?: {
181
181
  readonly input: {
182
+ subject: string | null;
182
183
  bcc: string[];
183
184
  cc: string[];
184
185
  to: string[];
185
- subject: string | null;
186
186
  };
187
187
  readonly output: {
188
+ subject: string | null;
188
189
  bcc: string[];
189
190
  cc: string[];
190
191
  to: string[];
191
- subject: string | null;
192
192
  };
193
- readonly issue: v.ObjectIssue | v.StringIssue | v.ArrayIssue | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, number> | v.NonOptionalIssue | v.RfcEmailIssue<string>;
193
+ readonly issue: v.StringIssue | v.ArrayIssue | v.ObjectIssue | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, number> | v.NonOptionalIssue | v.RfcEmailIssue<string>;
194
194
  } | undefined;
195
195
  };
196
196
  readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "DraftId">]>, undefined>;