@marcoappio/marco-config 4.0.13 → 4.0.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/appwrite/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAa5B,eAAO,MAAM,cAAc;8BACC,MAAM,KAAG,MAAM;CAC1C,CAAA;AAED,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCR,CAAA;AAEV,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAA;AAIlF,eAAO,MAAM,qBAAqB;;;;;;;;CAkC6D,CAAA;AAiL/F,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUnB,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,WAAW,CAAC,CAAA;AACrF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,aAAa,CAAC,CAAA;AACzF,MAAM,MAAM,sBAAsB,CAAC,KAAK,SAAS,mBAAmB,IAAI,OA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,oBAAoB,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAA"}
@@ -2,6 +2,7 @@ import * as v from 'valibot';
2
2
  import { id } from '../schemas/id';
3
3
  import { string } from '../schemas/string';
4
4
  import { DRAFT_TYPES } from '../types';
5
+ import { appwriteDraftAttachmentSchema, appwriteDraftEnvelopeSchema } from './decodedSchemas';
5
6
  import { canonicalTimestampSchema, commandStates, isoTimestampSchema, nonNegativeIntegerSchema } from './tableContract';
6
7
  const commandIdSchema = v.pipe(v.string(), v.uuid(), v.brand('CommandId'));
7
8
  const appwriteThreadCommandBatchSize = 100;
@@ -10,74 +11,6 @@ const avatarSha256Schema = v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/));
10
11
  export const appwriteAvatar = {
11
12
  createFileId: (commandId) => v.parse(commandIdSchema, commandId),
12
13
  };
13
- const commandKinds = {
14
- accountDelete: 'account.delete',
15
- accountSettingsSet: 'account.settings.set',
16
- aliasCreate: 'alias.create',
17
- aliasDelete: 'alias.delete',
18
- aliasNameSet: 'alias.name.set',
19
- aliasPrimarySet: 'alias.primary.set',
20
- aliasSignatureSet: 'alias.signature.set',
21
- draftAttachmentDelete: 'draft.attachment.delete',
22
- draftAttachmentLink: 'draft.attachment.link',
23
- draftContentSet: 'draft.content.set',
24
- draftCreate: 'draft.create',
25
- draftDelete: 'draft.delete',
26
- draftEnvelopeSet: 'draft.envelope.set',
27
- draftFromSet: 'draft.from.set',
28
- draftSend: 'draft.send',
29
- draftSendCancel: 'draft.send.cancel',
30
- draftSendSchedule: 'draft.send.schedule',
31
- labelCreate: 'label.create',
32
- labelDelete: 'label.delete',
33
- labelRename: 'label.rename',
34
- profileAvatarSet: 'profile.avatar.set',
35
- profileSettingsSet: 'profile.settings.set',
36
- threadArchiveSet: 'thread.archive.set',
37
- threadDelete: 'thread.delete',
38
- threadFlaggedSet: 'thread.flagged.set',
39
- threadLabelAdd: 'thread.label.add',
40
- threadLabelRemove: 'thread.label.remove',
41
- threadSeenSet: 'thread.seen.set',
42
- threadSnoozeSet: 'thread.snooze.set',
43
- threadSpamSet: 'thread.spam.set',
44
- threadTrashSet: 'thread.trash.set',
45
- };
46
- export const appwriteCommandGroups = {
47
- account: [
48
- commandKinds.accountDelete,
49
- commandKinds.accountSettingsSet,
50
- commandKinds.aliasCreate,
51
- commandKinds.aliasDelete,
52
- commandKinds.aliasNameSet,
53
- commandKinds.aliasPrimarySet,
54
- commandKinds.aliasSignatureSet,
55
- ],
56
- draft: [
57
- commandKinds.draftAttachmentDelete,
58
- commandKinds.draftAttachmentLink,
59
- commandKinds.draftContentSet,
60
- commandKinds.draftCreate,
61
- commandKinds.draftDelete,
62
- commandKinds.draftEnvelopeSet,
63
- commandKinds.draftFromSet,
64
- ],
65
- draftSend: [commandKinds.draftSend, commandKinds.draftSendCancel, commandKinds.draftSendSchedule],
66
- label: [commandKinds.labelCreate, commandKinds.labelDelete, commandKinds.labelRename],
67
- profileAvatar: [commandKinds.profileAvatarSet],
68
- profileSettings: [commandKinds.profileSettingsSet],
69
- thread: [
70
- commandKinds.threadArchiveSet,
71
- commandKinds.threadDelete,
72
- commandKinds.threadFlaggedSet,
73
- commandKinds.threadLabelAdd,
74
- commandKinds.threadLabelRemove,
75
- commandKinds.threadSeenSet,
76
- commandKinds.threadSnoozeSet,
77
- commandKinds.threadSpamSet,
78
- commandKinds.threadTrashSet,
79
- ],
80
- };
81
14
  const commandErrorCodes = [
82
15
  'AUTHENTICATION_FAILED',
83
16
  'AUTHORIZATION_FAILED',
@@ -89,6 +22,10 @@ const commandErrorCodes = [
89
22
  'INTERNAL_ERROR',
90
23
  ];
91
24
  const accountIdSchema = id.accountId.required();
25
+ const commandAccountIdSchemas = {
26
+ NULLABLE: v.nullable(accountIdSchema),
27
+ REQUIRED: accountIdSchema,
28
+ };
92
29
  const createCommandRequestSchema = (kind, payload, accountId) => v.strictObject({
93
30
  accountId,
94
31
  id: commandIdSchema,
@@ -97,7 +34,6 @@ const createCommandRequestSchema = (kind, payload, accountId) => v.strictObject(
97
34
  submittedAt: isoTimestampSchema,
98
35
  version: v.literal(1),
99
36
  });
100
- const createAccountCommandRequestSchema = (kind, payload) => createCommandRequestSchema(kind, payload, accountIdSchema);
101
37
  const profileSettingsSetPayloadSchema = v.strictObject({
102
38
  name: v.optional(v.nullable(string.required())),
103
39
  timezone: v.optional(v.nullable(string.required())),
@@ -150,11 +86,8 @@ const draftContentSetPayloadSchema = v.strictObject({
150
86
  html: v.pipe(v.string(), v.maxLength(384_000)),
151
87
  });
152
88
  const draftEnvelopeSetPayloadSchema = v.strictObject({
153
- bcc: v.array(string.mailboxAddress()),
154
- cc: v.array(string.mailboxAddress()),
89
+ ...appwriteDraftEnvelopeSchema.entries,
155
90
  draftId: id.draftId.required(),
156
- subject: v.nullable(v.pipe(v.string(), v.maxLength(998))),
157
- to: v.array(string.mailboxAddress()),
158
91
  });
159
92
  const draftFromSetPayloadSchema = v.strictObject({
160
93
  draftId: id.draftId.required(),
@@ -163,79 +96,102 @@ const draftFromSetPayloadSchema = v.strictObject({
163
96
  });
164
97
  const draftDeletePayloadSchema = v.strictObject({ draftId: id.draftId.required() });
165
98
  const draftAttachmentLinkPayloadSchema = v.strictObject({
99
+ ...appwriteDraftAttachmentSchema.entries,
166
100
  draftId: id.draftId.required(),
167
- fileId: string.required(36),
168
- fileName: string.required(),
169
- mimeType: string.required(),
170
- size: nonNegativeIntegerSchema,
171
101
  });
172
102
  const draftAttachmentDeletePayloadSchema = v.strictObject({
173
103
  draftId: id.draftId.required(),
174
- fileId: string.required(36),
104
+ fileId: appwriteDraftAttachmentSchema.entries.fileId,
175
105
  });
176
106
  const draftSendPayloadSchema = v.strictObject({ draftId: id.draftId.required() });
177
107
  const draftSendCancelPayloadSchema = v.strictObject({ draftId: id.draftId.required() });
178
108
  const draftSendSchedulePayloadSchema = v.strictObject({ draftId: id.draftId.required(), scheduledAt: canonicalTimestampSchema });
179
- const commandRequestSchemas = {
180
- [commandKinds.accountDelete]: createAccountCommandRequestSchema(commandKinds.accountDelete, accountDeletePayloadSchema),
181
- [commandKinds.accountSettingsSet]: createAccountCommandRequestSchema(commandKinds.accountSettingsSet, accountSettingsSetPayloadSchema),
182
- [commandKinds.aliasCreate]: createAccountCommandRequestSchema(commandKinds.aliasCreate, aliasCreatePayloadSchema),
183
- [commandKinds.aliasDelete]: createAccountCommandRequestSchema(commandKinds.aliasDelete, aliasDeletePayloadSchema),
184
- [commandKinds.aliasNameSet]: createAccountCommandRequestSchema(commandKinds.aliasNameSet, aliasNameSetPayloadSchema),
185
- [commandKinds.aliasPrimarySet]: createAccountCommandRequestSchema(commandKinds.aliasPrimarySet, aliasPrimarySetPayloadSchema),
186
- [commandKinds.aliasSignatureSet]: createAccountCommandRequestSchema(commandKinds.aliasSignatureSet, aliasSignatureSetPayloadSchema),
187
- [commandKinds.draftAttachmentDelete]: createAccountCommandRequestSchema(commandKinds.draftAttachmentDelete, draftAttachmentDeletePayloadSchema),
188
- [commandKinds.draftAttachmentLink]: createAccountCommandRequestSchema(commandKinds.draftAttachmentLink, draftAttachmentLinkPayloadSchema),
189
- [commandKinds.draftContentSet]: createAccountCommandRequestSchema(commandKinds.draftContentSet, draftContentSetPayloadSchema),
190
- [commandKinds.draftCreate]: createAccountCommandRequestSchema(commandKinds.draftCreate, draftCreatePayloadSchema),
191
- [commandKinds.draftDelete]: createAccountCommandRequestSchema(commandKinds.draftDelete, draftDeletePayloadSchema),
192
- [commandKinds.draftEnvelopeSet]: createAccountCommandRequestSchema(commandKinds.draftEnvelopeSet, draftEnvelopeSetPayloadSchema),
193
- [commandKinds.draftFromSet]: createAccountCommandRequestSchema(commandKinds.draftFromSet, draftFromSetPayloadSchema),
194
- [commandKinds.draftSend]: createAccountCommandRequestSchema(commandKinds.draftSend, draftSendPayloadSchema),
195
- [commandKinds.draftSendCancel]: createAccountCommandRequestSchema(commandKinds.draftSendCancel, draftSendCancelPayloadSchema),
196
- [commandKinds.draftSendSchedule]: createAccountCommandRequestSchema(commandKinds.draftSendSchedule, draftSendSchedulePayloadSchema),
197
- [commandKinds.labelCreate]: createAccountCommandRequestSchema(commandKinds.labelCreate, labelCreatePayloadSchema),
198
- [commandKinds.labelDelete]: createAccountCommandRequestSchema(commandKinds.labelDelete, labelDeletePayloadSchema),
199
- [commandKinds.labelRename]: createAccountCommandRequestSchema(commandKinds.labelRename, labelRenamePayloadSchema),
200
- [commandKinds.profileAvatarSet]: createCommandRequestSchema(commandKinds.profileAvatarSet, profileAvatarSetPayloadSchema, v.nullable(accountIdSchema)),
201
- [commandKinds.profileSettingsSet]: createCommandRequestSchema(commandKinds.profileSettingsSet, profileSettingsSetPayloadSchema, v.nullable(accountIdSchema)),
202
- [commandKinds.threadArchiveSet]: createAccountCommandRequestSchema(commandKinds.threadArchiveSet, threadArchiveSetPayloadSchema),
203
- [commandKinds.threadDelete]: createAccountCommandRequestSchema(commandKinds.threadDelete, threadDeletePayloadSchema),
204
- [commandKinds.threadFlaggedSet]: createAccountCommandRequestSchema(commandKinds.threadFlaggedSet, threadFlaggedSetPayloadSchema),
205
- [commandKinds.threadLabelAdd]: createAccountCommandRequestSchema(commandKinds.threadLabelAdd, threadLabelAddPayloadSchema),
206
- [commandKinds.threadLabelRemove]: createAccountCommandRequestSchema(commandKinds.threadLabelRemove, threadLabelRemovePayloadSchema),
207
- [commandKinds.threadSeenSet]: createAccountCommandRequestSchema(commandKinds.threadSeenSet, threadSeenSetPayloadSchema),
208
- [commandKinds.threadSnoozeSet]: createAccountCommandRequestSchema(commandKinds.threadSnoozeSet, threadSnoozeSetPayloadSchema),
209
- [commandKinds.threadSpamSet]: createAccountCommandRequestSchema(commandKinds.threadSpamSet, threadSpamSetPayloadSchema),
210
- [commandKinds.threadTrashSet]: createAccountCommandRequestSchema(commandKinds.threadTrashSet, threadTrashSetPayloadSchema),
109
+ const defineCommand = (kind, accountScope, payloadSchema) => ({
110
+ ...createCommandRequestSchema(kind, payloadSchema, commandAccountIdSchemas[accountScope]),
111
+ accountScope,
112
+ commandKind: kind,
113
+ payloadSchema,
114
+ });
115
+ const commandDefinitions = {
116
+ account: [
117
+ defineCommand('account.delete', 'REQUIRED', accountDeletePayloadSchema),
118
+ defineCommand('account.settings.set', 'REQUIRED', accountSettingsSetPayloadSchema),
119
+ defineCommand('alias.create', 'REQUIRED', aliasCreatePayloadSchema),
120
+ defineCommand('alias.delete', 'REQUIRED', aliasDeletePayloadSchema),
121
+ defineCommand('alias.name.set', 'REQUIRED', aliasNameSetPayloadSchema),
122
+ defineCommand('alias.primary.set', 'REQUIRED', aliasPrimarySetPayloadSchema),
123
+ defineCommand('alias.signature.set', 'REQUIRED', aliasSignatureSetPayloadSchema),
124
+ ],
125
+ draft: [
126
+ defineCommand('draft.attachment.delete', 'REQUIRED', draftAttachmentDeletePayloadSchema),
127
+ defineCommand('draft.attachment.link', 'REQUIRED', draftAttachmentLinkPayloadSchema),
128
+ defineCommand('draft.content.set', 'REQUIRED', draftContentSetPayloadSchema),
129
+ defineCommand('draft.create', 'REQUIRED', draftCreatePayloadSchema),
130
+ defineCommand('draft.delete', 'REQUIRED', draftDeletePayloadSchema),
131
+ defineCommand('draft.envelope.set', 'REQUIRED', draftEnvelopeSetPayloadSchema),
132
+ defineCommand('draft.from.set', 'REQUIRED', draftFromSetPayloadSchema),
133
+ ],
134
+ draftSend: [
135
+ defineCommand('draft.send', 'REQUIRED', draftSendPayloadSchema),
136
+ defineCommand('draft.send.cancel', 'REQUIRED', draftSendCancelPayloadSchema),
137
+ defineCommand('draft.send.schedule', 'REQUIRED', draftSendSchedulePayloadSchema),
138
+ ],
139
+ label: [
140
+ defineCommand('label.create', 'REQUIRED', labelCreatePayloadSchema),
141
+ defineCommand('label.delete', 'REQUIRED', labelDeletePayloadSchema),
142
+ defineCommand('label.rename', 'REQUIRED', labelRenamePayloadSchema),
143
+ ],
144
+ profileAvatar: [defineCommand('profile.avatar.set', 'NULLABLE', profileAvatarSetPayloadSchema)],
145
+ profileSettings: [defineCommand('profile.settings.set', 'NULLABLE', profileSettingsSetPayloadSchema)],
146
+ thread: [
147
+ defineCommand('thread.archive.set', 'REQUIRED', threadArchiveSetPayloadSchema),
148
+ defineCommand('thread.delete', 'REQUIRED', threadDeletePayloadSchema),
149
+ defineCommand('thread.flagged.set', 'REQUIRED', threadFlaggedSetPayloadSchema),
150
+ defineCommand('thread.label.add', 'REQUIRED', threadLabelAddPayloadSchema),
151
+ defineCommand('thread.label.remove', 'REQUIRED', threadLabelRemovePayloadSchema),
152
+ defineCommand('thread.seen.set', 'REQUIRED', threadSeenSetPayloadSchema),
153
+ defineCommand('thread.snooze.set', 'REQUIRED', threadSnoozeSetPayloadSchema),
154
+ defineCommand('thread.spam.set', 'REQUIRED', threadSpamSetPayloadSchema),
155
+ defineCommand('thread.trash.set', 'REQUIRED', threadTrashSetPayloadSchema),
156
+ ],
157
+ };
158
+ export const appwriteCommandGroups = {
159
+ account: Object.freeze(commandDefinitions.account.map(({ commandKind }) => commandKind)),
160
+ draft: Object.freeze(commandDefinitions.draft.map(({ commandKind }) => commandKind)),
161
+ draftSend: Object.freeze(commandDefinitions.draftSend.map(({ commandKind }) => commandKind)),
162
+ label: Object.freeze(commandDefinitions.label.map(({ commandKind }) => commandKind)),
163
+ profileAvatar: Object.freeze(commandDefinitions.profileAvatar.map(({ commandKind }) => commandKind)),
164
+ profileSettings: Object.freeze(commandDefinitions.profileSettings.map(({ commandKind }) => commandKind)),
165
+ thread: Object.freeze(commandDefinitions.thread.map(({ commandKind }) => commandKind)),
211
166
  };
167
+ const commandRequestSchemas = Object.values(commandDefinitions).flat();
212
168
  const commandErrorSchema = v.strictObject({
213
169
  code: v.picklist(commandErrorCodes),
214
170
  retryable: v.boolean(),
215
171
  });
172
+ const commandResponseEntries = {
173
+ canonicalRevision: v.nullable(nonNegativeIntegerSchema),
174
+ id: commandIdSchema,
175
+ };
216
176
  const commandResponseSchemas = [
217
177
  v.strictObject({
218
- canonicalRevision: v.nullable(nonNegativeIntegerSchema),
178
+ ...commandResponseEntries,
219
179
  error: v.null_(),
220
- id: commandIdSchema,
221
180
  state: v.literal('ACCEPTED'),
222
181
  }),
223
182
  v.strictObject({
224
- canonicalRevision: v.nullable(nonNegativeIntegerSchema),
183
+ ...commandResponseEntries,
225
184
  error: v.null_(),
226
- id: commandIdSchema,
227
185
  state: v.literal('RUNNING'),
228
186
  }),
229
187
  v.strictObject({
230
- canonicalRevision: v.nullable(nonNegativeIntegerSchema),
188
+ ...commandResponseEntries,
231
189
  error: v.null_(),
232
- id: commandIdSchema,
233
190
  state: v.literal('SUCCEEDED'),
234
191
  }),
235
192
  v.strictObject({
236
- canonicalRevision: v.nullable(nonNegativeIntegerSchema),
193
+ ...commandResponseEntries,
237
194
  error: commandErrorSchema,
238
- id: commandIdSchema,
239
195
  state: v.literal('FAILED'),
240
196
  }),
241
197
  ];
@@ -243,8 +199,8 @@ export const appwriteCommands = {
243
199
  errorCodes: commandErrorCodes,
244
200
  errorSchema: commandErrorSchema,
245
201
  idSchema: commandIdSchema,
246
- kinds: Object.values(appwriteCommandGroups).flat(),
247
- requestSchema: v.variant('kind', Object.values(commandRequestSchemas)),
202
+ kinds: Object.freeze(Object.values(appwriteCommandGroups).flat()),
203
+ requestSchema: v.variant('kind', commandRequestSchemas),
248
204
  responseSchema: v.variant('state', commandResponseSchemas),
249
205
  states: commandStates,
250
206
  threadCommandBatchSize: appwriteThreadCommandBatchSize,
@@ -1,4 +1,4 @@
1
- import { describe, expect, it } from 'bun:test';
1
+ import { describe, expect, expectTypeOf, it } from 'bun:test';
2
2
  import * as v from 'valibot';
3
3
  import { appwriteCommandGroups as rootCommandGroups } from '../index';
4
4
  import { appwriteAvatar, appwriteCommandGroups, appwriteCommands } from './commands';
@@ -296,13 +296,48 @@ describe('appwriteCommands', () => {
296
296
  const groupedKinds = Object.values(appwriteCommandGroups).flat();
297
297
  const fixtureKinds = commandFixtures.map(({ command }) => command.kind);
298
298
  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
+ });
299
318
  expect(groupedKinds).toHaveLength(31);
300
319
  expect(new Set(groupedKinds).size).toBe(31);
301
320
  expect(groupedKinds).toEqual([...appwriteCommands.kinds]);
321
+ expect(Object.values(appwriteCommandGroups).every(Object.isFrozen)).toBe(true);
322
+ expect(Object.isFrozen(appwriteCommands.kinds)).toBe(true);
302
323
  expect(Array.from(new Set(fixtureKinds)).sort()).toEqual(Array.from(new Set(appwriteCommands.kinds)).sort());
303
324
  expect(appwriteIndexCommandGroups).toBe(appwriteCommandGroups);
304
325
  expect(rootCommandGroups).toBe(appwriteCommandGroups);
305
326
  });
327
+ it('preserves group-specific command and payload inference', () => {
328
+ expectTypeOf().toEqualTypeOf();
329
+ expectTypeOf().toEqualTypeOf();
330
+ expectTypeOf().toEqualTypeOf();
331
+ expectTypeOf().toEqualTypeOf();
332
+ expectTypeOf().toEqualTypeOf();
333
+ });
334
+ it('enforces each command account scope', () => {
335
+ const nullableKinds = new Set([...appwriteCommandGroups.profileAvatar, ...appwriteCommandGroups.profileSettings]);
336
+ for (const { command } of commandFixtures) {
337
+ expect(v.safeParse(appwriteCommands.requestSchema, { ...command, accountId: 'account_1' }).success).toBe(true);
338
+ expect(v.safeParse(appwriteCommands.requestSchema, { ...command, accountId: null }).success).toBe(nullableKinds.has(command.kind));
339
+ }
340
+ });
306
341
  it('derives a command-scoped avatar file ID within Appwrite limits', () => {
307
342
  expect(appwriteAvatar.createFileId(commandMetadata.id)).toBe(commandMetadata.id);
308
343
  expect(appwriteAvatar.createFileId('0197f3d4-1b22-7abc-8def-123456789abd')).not.toBe(appwriteAvatar.createFileId(commandMetadata.id));
@@ -333,6 +368,38 @@ describe('appwriteCommands', () => {
333
368
  expect(v.safeParse(appwriteCommands.requestSchema, command).success).toBe(true);
334
369
  expect(v.safeParse(appwriteCommands.requestSchema, { ...command, payload: { ...command.payload, to: [overlongAddress] } }).success).toBe(false);
335
370
  });
371
+ it('shares persisted draft envelope and attachment boundaries', () => {
372
+ const envelopeCommand = {
373
+ ...commandMetadata,
374
+ accountId: 'account_1',
375
+ kind: 'draft.envelope.set',
376
+ payload: { bcc: [], cc: [], draftId: 'draft_1', subject: 'a'.repeat(998), to: ['recipient@example.com'] },
377
+ };
378
+ const attachmentCommand = {
379
+ ...commandMetadata,
380
+ accountId: 'account_1',
381
+ kind: 'draft.attachment.link',
382
+ payload: { draftId: 'draft_1', fileId: 'test-file-id-1', fileName: 'proposal.pdf', mimeType: 'application/pdf', size: 0 },
383
+ };
384
+ expect(v.safeParse(appwriteCommands.requestSchema, envelopeCommand).success).toBe(true);
385
+ expect(v.safeParse(appwriteCommands.requestSchema, { ...envelopeCommand, payload: { ...envelopeCommand.payload, subject: 'a'.repeat(999) } }).success).toBe(false);
386
+ expect(v.safeParse(appwriteCommands.requestSchema, attachmentCommand).success).toBe(true);
387
+ for (const payload of [
388
+ { ...attachmentCommand.payload, fileId: '-invalid' },
389
+ { ...attachmentCommand.payload, fileName: 'a'.repeat(256) },
390
+ { ...attachmentCommand.payload, mimeType: 'x' },
391
+ { ...attachmentCommand.payload, size: -1 },
392
+ { ...attachmentCommand.payload, unexpected: true },
393
+ ]) {
394
+ expect(v.safeParse(appwriteCommands.requestSchema, { ...attachmentCommand, payload }).success).toBe(false);
395
+ }
396
+ expect(v.safeParse(appwriteCommands.requestSchema, {
397
+ ...commandMetadata,
398
+ accountId: 'account_1',
399
+ kind: 'draft.attachment.delete',
400
+ payload: { draftId: 'draft_1', fileId: '-invalid' },
401
+ }).success).toBe(false);
402
+ });
336
403
  it('rejects non-canonical scheduled command timestamps', () => {
337
404
  for (const command of [
338
405
  {
@@ -0,0 +1,35 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
2
+ import * as v from 'valibot';
3
+ export declare const appwriteDraftAttachmentSchema: v.StrictObjectSchema<{
4
+ readonly fileId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
5
+ readonly fileName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
6
+ readonly mimeType: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 3, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
7
+ readonly size: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
8
+ }, undefined>;
9
+ export declare const appwriteDraftAttachmentsSchema: v.ArraySchema<v.StrictObjectSchema<{
10
+ readonly fileId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
11
+ readonly fileName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
12
+ readonly mimeType: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 3, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
13
+ readonly size: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
14
+ }, undefined>, undefined>;
15
+ export declare const persistedDraftAttachmentsSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.ParseJsonAction<string, undefined, undefined>, v.ArraySchema<v.StrictObjectSchema<{
16
+ readonly fileId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
17
+ readonly fileName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
18
+ readonly mimeType: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 3, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
19
+ readonly size: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
20
+ }, undefined>, undefined>]>;
21
+ export declare const appwriteDraftEnvelopeSchema: v.StrictObjectSchema<{
22
+ readonly bcc: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
23
+ readonly cc: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
24
+ readonly subject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 998, undefined>]>, undefined>;
25
+ readonly to: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
26
+ }, undefined>;
27
+ export declare const persistedDraftEnvelopeSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.ParseJsonAction<string, undefined, undefined>, v.StrictObjectSchema<{
28
+ readonly bcc: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
29
+ readonly cc: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
30
+ readonly subject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 998, undefined>]>, undefined>;
31
+ readonly to: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
32
+ }, undefined>]>;
33
+ export type AppwriteDraftAttachment = ReadonlyDeep<v.InferOutput<typeof appwriteDraftAttachmentSchema>>;
34
+ export type AppwriteDraftEnvelope = ReadonlyDeep<v.InferOutput<typeof appwriteDraftEnvelopeSchema>>;
35
+ //# sourceMappingURL=decodedSchemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decodedSchemas.d.ts","sourceRoot":"","sources":["../../src/appwrite/decodedSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAM5B,eAAO,MAAM,6BAA6B;;;;;aAKxC,CAAA;AACF,eAAO,MAAM,8BAA8B;;;;;yBAAyC,CAAA;AACpF,eAAO,MAAM,+BAA+B;;;;;2BAAoE,CAAA;AAEhH,eAAO,MAAM,2BAA2B;;;;;aAKtC,CAAA;AACF,eAAO,MAAM,4BAA4B;;;;;eAAiE,CAAA;AAE1G,MAAM,MAAM,uBAAuB,GAAG,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAA;AACvG,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import * as v from 'valibot';
2
+ import { mailboxAddressSchema, nonNegativeIntegerSchema } from '../schemas/scalars';
3
+ import { appwriteRowIdSchema } from './tableContract';
4
+ export const appwriteDraftAttachmentSchema = v.strictObject({
5
+ fileId: appwriteRowIdSchema,
6
+ fileName: v.pipe(v.string(), v.minLength(1), v.maxLength(255)),
7
+ mimeType: v.pipe(v.string(), v.minLength(3), v.maxLength(255)),
8
+ size: nonNegativeIntegerSchema,
9
+ });
10
+ export const appwriteDraftAttachmentsSchema = v.array(appwriteDraftAttachmentSchema);
11
+ export const persistedDraftAttachmentsSchema = v.pipe(v.string(), v.parseJson(), appwriteDraftAttachmentsSchema);
12
+ export const appwriteDraftEnvelopeSchema = v.strictObject({
13
+ bcc: v.array(mailboxAddressSchema),
14
+ cc: v.array(mailboxAddressSchema),
15
+ subject: v.nullable(v.pipe(v.string(), v.maxLength(998))),
16
+ to: v.array(mailboxAddressSchema),
17
+ });
18
+ export const persistedDraftEnvelopeSchema = v.pipe(v.string(), v.parseJson(), appwriteDraftEnvelopeSchema);