@marcoappio/marco-config 3.0.0 → 3.0.1

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,5 +1,6 @@
1
1
  import type { ReadonlyDeep } from 'type-fest';
2
2
  import * as v from 'valibot';
3
+ export declare const appwriteRowIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
3
4
  declare const draftAttachmentSchema: v.StrictObjectSchema<{
4
5
  readonly fileId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
5
6
  readonly fileName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
@@ -29,8 +30,16 @@ export type AppwriteDraftAttachment = ReadonlyDeep<v.InferOutput<typeof draftAtt
29
30
  export type AppwriteDraftEnvelope = ReadonlyDeep<v.InferOutput<typeof draftEnvelopeSchema>>;
30
31
  export type AppwriteMessageAttachment = ReadonlyDeep<v.InferOutput<typeof messageAttachmentSchema>>;
31
32
  export type AppwriteMessageRecipient = ReadonlyDeep<v.InferOutput<typeof messageRecipientSchema>>;
33
+ declare const mailboxSyncLanes: readonly ["HEAD", "BACKFILL"];
34
+ declare const mailboxSyncLaneStates: readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"];
35
+ declare const mailboxSyncStates: readonly ["INITIAL", "SYNCING", "CURRENT", "IDLE", "ERROR"];
36
+ declare const pollShardStates: readonly ["ACTIVE", "STOPPED", "FAILED"];
32
37
  declare const appwriteEnvironments: readonly ['development', 'production', 'staging'];
33
38
  export type AppwriteEnvironment = (typeof appwriteEnvironments)[number];
39
+ export type AppwriteMailboxSyncLane = (typeof mailboxSyncLanes)[number];
40
+ export type AppwriteMailboxSyncLaneState = (typeof mailboxSyncLaneStates)[number];
41
+ export type AppwriteMailboxSyncState = (typeof mailboxSyncStates)[number];
42
+ export type AppwritePollShardState = (typeof pollShardStates)[number];
34
43
  declare const rowSchemas: {
35
44
  readonly accounts: v.StrictObjectSchema<{
36
45
  readonly colour: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 64, undefined>]>;
@@ -42,6 +51,8 @@ declare const rowSchemas: {
42
51
  readonly mailboxSyncState: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
43
52
  readonly mailProcessedCount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
44
53
  readonly mailTotalCount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
54
+ readonly pollShard: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
55
+ readonly pollShardId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
45
56
  readonly primaryAlias: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
46
57
  readonly primaryAliasId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
47
58
  readonly primaryEmail: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>]>;
@@ -185,6 +196,23 @@ declare const rowSchemas: {
185
196
  readonly $tableId: v.LiteralSchema<"labels", undefined>;
186
197
  readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
187
198
  }, undefined>;
199
+ readonly mailboxSyncLanes: v.StrictObjectSchema<{
200
+ readonly $permissions: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.LengthAction<string[], 0, undefined>]>;
201
+ readonly accountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
202
+ readonly commandId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>, v.BrandAction<string, "CommandId">]>;
203
+ readonly cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
204
+ readonly errorCode: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
205
+ readonly generation: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
206
+ readonly lane: v.PicklistSchema<readonly ["HEAD", "BACKFILL"], undefined>;
207
+ readonly state: v.PicklistSchema<readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"], undefined>;
208
+ readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
209
+ readonly $createdAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
210
+ readonly $databaseId: v.LiteralSchema<"marco", undefined>;
211
+ readonly $id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
212
+ readonly $sequence: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
213
+ readonly $tableId: v.LiteralSchema<"mailbox_sync_lanes", undefined>;
214
+ readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
215
+ }, undefined>;
188
216
  readonly mailboxSyncStates: v.StrictObjectSchema<{
189
217
  readonly errorCode: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
190
218
  readonly lastEventAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
@@ -192,7 +220,7 @@ declare const rowSchemas: {
192
220
  readonly nextPollAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
193
221
  readonly provider: v.PicklistSchema<readonly ["GMAIL", "OUTLOOK", "IMAP"], undefined>;
194
222
  readonly providerCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
195
- readonly state: v.PicklistSchema<readonly ["INITIAL", "SYNCING", "IDLE", "ERROR"], undefined>;
223
+ readonly state: v.PicklistSchema<readonly ["INITIAL", "SYNCING", "CURRENT", "IDLE", "ERROR"], undefined>;
196
224
  readonly uidValidity: v.NullableSchema<v.StringSchema<undefined>, undefined>;
197
225
  readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
198
226
  readonly $createdAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
@@ -247,6 +275,24 @@ declare const rowSchemas: {
247
275
  readonly $tableId: v.LiteralSchema<"oauth_states", undefined>;
248
276
  readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
249
277
  }, undefined>;
278
+ readonly pollShards: v.StrictObjectSchema<{
279
+ readonly $permissions: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.LengthAction<string[], 0, undefined>]>;
280
+ readonly accountIds: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>, v.MaxLengthAction<string[], 10, undefined>]>;
281
+ readonly errorCode: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
282
+ readonly generation: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
283
+ readonly lastStartedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
284
+ readonly leaseExpiresAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
285
+ readonly leaseId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
286
+ readonly nextStartAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
287
+ readonly scheduledExecutionId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
288
+ readonly state: v.PicklistSchema<readonly ["ACTIVE", "STOPPED", "FAILED"], undefined>;
289
+ readonly $createdAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
290
+ readonly $databaseId: v.LiteralSchema<"marco", undefined>;
291
+ readonly $id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
292
+ readonly $sequence: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
293
+ readonly $tableId: v.LiteralSchema<"poll_shards", undefined>;
294
+ readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
295
+ }, undefined>;
250
296
  readonly profiles: v.StrictObjectSchema<{
251
297
  readonly avatarFileId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>, undefined>;
252
298
  readonly deletionRequestedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
@@ -405,9 +451,11 @@ export declare const appwrite: {
405
451
  readonly drafts: "drafts";
406
452
  readonly jobs: "jobs_v2";
407
453
  readonly labels: "labels";
454
+ readonly mailboxSyncLanes: "mailbox_sync_lanes";
408
455
  readonly mailboxSyncStates: "mailbox_sync_states";
409
456
  readonly messages: "messages";
410
457
  readonly oauthStates: "oauth_states";
458
+ readonly pollShards: "poll_shards";
411
459
  readonly profiles: "profiles";
412
460
  readonly pushNotificationTokens: "push_notification_tokens";
413
461
  readonly savedViews: "saved_views";
@@ -416,12 +464,20 @@ export declare const appwrite: {
416
464
  readonly watcherShards: "watcher_shards";
417
465
  };
418
466
  };
467
+ readonly mailboxSync: {
468
+ readonly laneStates: readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"];
469
+ readonly lanes: readonly ["HEAD", "BACKFILL"];
470
+ readonly states: readonly ["INITIAL", "SYNCING", "CURRENT", "IDLE", "ERROR"];
471
+ };
419
472
  readonly oauth: {
420
473
  readonly operations: readonly ["CONNECT", "REPLACE"];
421
474
  readonly providers: readonly ["GMAIL", "OUTLOOK"];
422
475
  readonly returnUriSchema: v.PicklistSchema<readonly ["https://app.marcoapp.io/onboarding/provider-selection", "https://app.staging.marcoapp.io/onboarding/provider-selection"], undefined>;
423
476
  readonly returnUris: readonly ["https://app.marcoapp.io/onboarding/provider-selection", "https://app.staging.marcoapp.io/onboarding/provider-selection"];
424
477
  };
478
+ readonly polling: {
479
+ readonly shardStates: readonly ["ACTIVE", "STOPPED", "FAILED"];
480
+ };
425
481
  readonly rowSchemas: {
426
482
  readonly accounts: v.StrictObjectSchema<{
427
483
  readonly colour: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 64, undefined>]>;
@@ -433,6 +489,8 @@ export declare const appwrite: {
433
489
  readonly mailboxSyncState: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
434
490
  readonly mailProcessedCount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
435
491
  readonly mailTotalCount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
492
+ readonly pollShard: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
493
+ readonly pollShardId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
436
494
  readonly primaryAlias: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
437
495
  readonly primaryAliasId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
438
496
  readonly primaryEmail: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>]>;
@@ -576,6 +634,23 @@ export declare const appwrite: {
576
634
  readonly $tableId: v.LiteralSchema<"labels", undefined>;
577
635
  readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
578
636
  }, undefined>;
637
+ readonly mailboxSyncLanes: v.StrictObjectSchema<{
638
+ readonly $permissions: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.LengthAction<string[], 0, undefined>]>;
639
+ readonly accountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
640
+ readonly commandId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>, v.BrandAction<string, "CommandId">]>;
641
+ readonly cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
642
+ readonly errorCode: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
643
+ readonly generation: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
644
+ readonly lane: v.PicklistSchema<readonly ["HEAD", "BACKFILL"], undefined>;
645
+ readonly state: v.PicklistSchema<readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"], undefined>;
646
+ readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
647
+ readonly $createdAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
648
+ readonly $databaseId: v.LiteralSchema<"marco", undefined>;
649
+ readonly $id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
650
+ readonly $sequence: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
651
+ readonly $tableId: v.LiteralSchema<"mailbox_sync_lanes", undefined>;
652
+ readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
653
+ }, undefined>;
579
654
  readonly mailboxSyncStates: v.StrictObjectSchema<{
580
655
  readonly errorCode: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
581
656
  readonly lastEventAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
@@ -583,7 +658,7 @@ export declare const appwrite: {
583
658
  readonly nextPollAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
584
659
  readonly provider: v.PicklistSchema<readonly ["GMAIL", "OUTLOOK", "IMAP"], undefined>;
585
660
  readonly providerCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
586
- readonly state: v.PicklistSchema<readonly ["INITIAL", "SYNCING", "IDLE", "ERROR"], undefined>;
661
+ readonly state: v.PicklistSchema<readonly ["INITIAL", "SYNCING", "CURRENT", "IDLE", "ERROR"], undefined>;
587
662
  readonly uidValidity: v.NullableSchema<v.StringSchema<undefined>, undefined>;
588
663
  readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
589
664
  readonly $createdAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
@@ -638,6 +713,24 @@ export declare const appwrite: {
638
713
  readonly $tableId: v.LiteralSchema<"oauth_states", undefined>;
639
714
  readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
640
715
  }, undefined>;
716
+ readonly pollShards: v.StrictObjectSchema<{
717
+ readonly $permissions: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.LengthAction<string[], 0, undefined>]>;
718
+ readonly accountIds: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>, v.MaxLengthAction<string[], 10, undefined>]>;
719
+ readonly errorCode: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
720
+ readonly generation: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
721
+ readonly lastStartedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
722
+ readonly leaseExpiresAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
723
+ readonly leaseId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
724
+ readonly nextStartAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
725
+ readonly scheduledExecutionId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
726
+ readonly state: v.PicklistSchema<readonly ["ACTIVE", "STOPPED", "FAILED"], undefined>;
727
+ readonly $createdAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
728
+ readonly $databaseId: v.LiteralSchema<"marco", undefined>;
729
+ readonly $id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
730
+ readonly $sequence: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
731
+ readonly $tableId: v.LiteralSchema<"poll_shards", undefined>;
732
+ readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
733
+ }, undefined>;
641
734
  readonly profiles: v.StrictObjectSchema<{
642
735
  readonly avatarFileId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>, undefined>;
643
736
  readonly deletionRequestedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
@@ -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;AAgB5B,QAAA,MAAM,qBAAqB;;;;;aAKzB,CAAA;AAEF,QAAA,MAAM,mBAAmB;;;;;eASxB,CAAA;AACD,QAAA,MAAM,uBAAuB;;;;;;;aAO3B,CAAA;AAEF,QAAA,MAAM,sBAAsB;;;;aAI1B,CAAA;AAGF,MAAM,MAAM,uBAAuB,GAAG,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAA;AAC/F,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC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A;SAClB;mBACU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+VT,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"}
@@ -1,7 +1,8 @@
1
1
  import * as v from 'valibot';
2
2
  import { MESSAGE_RECIPIENT_TYPES } from '../types';
3
+ import { appwriteCommands } from './commands';
3
4
  const identifierSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(255));
4
- const appwriteRowIdSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(36), v.regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/));
5
+ export const appwriteRowIdSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(36), v.regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/));
5
6
  const timestampSchema = v.pipe(v.string(), v.isoTimestamp());
6
7
  const nonNegativeIntegerSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
7
8
  const colourSchema = v.pipe(v.string(), v.maxLength(64));
@@ -42,7 +43,9 @@ const draftStates = ['DRAFT', 'SCHEDULED', 'SENDING', 'SENT', 'FAILED', 'CANCELL
42
43
  const draftTypes = ['COMPOSE', 'REPLY', 'FORWARD'];
43
44
  const jobStates = ['PENDING', 'RUNNING', 'SUCCEEDED', 'FAILED', 'CANCELLED'];
44
45
  const labelSpecialUses = ['ALL', 'ARCHIVE', 'DRAFTS', 'INBOX', 'JUNK', 'SENT', 'STARRED', 'TRASH'];
45
- const mailboxSyncStates = ['INITIAL', 'SYNCING', 'IDLE', 'ERROR'];
46
+ const mailboxSyncLanes = ['HEAD', 'BACKFILL'];
47
+ const mailboxSyncLaneStates = ['PENDING', 'RUNNING', 'COMPLETED', 'FAILED'];
48
+ const mailboxSyncStates = ['INITIAL', 'SYNCING', 'CURRENT', 'IDLE', 'ERROR'];
46
49
  const oauthOperations = ['CONNECT', 'REPLACE'];
47
50
  const oauthProviders = ['GMAIL', 'OUTLOOK'];
48
51
  const oauthReturnUris = [
@@ -50,6 +53,7 @@ const oauthReturnUris = [
50
53
  'https://app.staging.marcoapp.io/onboarding/provider-selection',
51
54
  ];
52
55
  const oauthReturnUriSchema = v.picklist(oauthReturnUris);
56
+ const pollShardStates = ['ACTIVE', 'STOPPED', 'FAILED'];
53
57
  const watcherShardStates = ['ACTIVE', 'IDLE', 'STOPPED', 'FAILED'];
54
58
  const appwriteEnvironments = ['development', 'production', 'staging'];
55
59
  const appwriteDeployments = {
@@ -97,9 +101,11 @@ const appwriteIds = {
97
101
  drafts: 'drafts',
98
102
  jobs: 'jobs_v2',
99
103
  labels: 'labels',
104
+ mailboxSyncLanes: 'mailbox_sync_lanes',
100
105
  mailboxSyncStates: 'mailbox_sync_states',
101
106
  messages: 'messages',
102
107
  oauthStates: 'oauth_states',
108
+ pollShards: 'poll_shards',
103
109
  profiles: 'profiles',
104
110
  pushNotificationTokens: 'push_notification_tokens',
105
111
  savedViews: 'saved_views',
@@ -129,6 +135,8 @@ const rowSchemas = {
129
135
  mailboxSyncState: identifierSchema,
130
136
  mailProcessedCount: nonNegativeIntegerSchema,
131
137
  mailTotalCount: nonNegativeIntegerSchema,
138
+ pollShard: v.nullable(identifierSchema),
139
+ pollShardId: v.nullable(identifierSchema),
132
140
  primaryAlias: v.nullable(identifierSchema),
133
141
  primaryAliasId: v.nullable(identifierSchema),
134
142
  primaryEmail: emailSchema,
@@ -223,6 +231,18 @@ const rowSchemas = {
223
231
  unreadCount: nonNegativeIntegerSchema,
224
232
  userId: identifierSchema,
225
233
  }),
234
+ mailboxSyncLanes: v.strictObject({
235
+ ...wireMetadata(appwriteIds.tables.mailboxSyncLanes),
236
+ $permissions: v.pipe(v.array(v.string()), v.length(0)),
237
+ accountId: identifierSchema,
238
+ commandId: appwriteCommands.idSchema,
239
+ cursor: v.nullable(v.string()),
240
+ errorCode: v.nullable(identifierSchema),
241
+ generation: nonNegativeIntegerSchema,
242
+ lane: v.picklist(mailboxSyncLanes),
243
+ state: v.picklist(mailboxSyncLaneStates),
244
+ userId: identifierSchema,
245
+ }),
226
246
  mailboxSyncStates: v.strictObject({
227
247
  ...wireMetadata(appwriteIds.tables.mailboxSyncStates),
228
248
  errorCode: v.nullable(identifierSchema),
@@ -267,6 +287,19 @@ const rowSchemas = {
267
287
  returnUri: oauthReturnUriSchema,
268
288
  userId: identifierSchema,
269
289
  }),
290
+ pollShards: v.strictObject({
291
+ ...wireMetadata(appwriteIds.tables.pollShards),
292
+ $permissions: v.pipe(v.array(v.string()), v.length(0)),
293
+ accountIds: v.pipe(v.array(identifierSchema), v.maxLength(10)),
294
+ errorCode: v.nullable(identifierSchema),
295
+ generation: nonNegativeIntegerSchema,
296
+ lastStartedAt: v.nullable(timestampSchema),
297
+ leaseExpiresAt: v.nullable(timestampSchema),
298
+ leaseId: v.nullable(identifierSchema),
299
+ nextStartAt: timestampSchema,
300
+ scheduledExecutionId: v.nullable(identifierSchema),
301
+ state: v.picklist(pollShardStates),
302
+ }),
270
303
  profiles: v.strictObject({
271
304
  ...wireMetadata(appwriteIds.tables.profiles),
272
305
  avatarFileId: v.nullable(appwriteRowIdSchema),
@@ -345,11 +378,19 @@ export const appwrite = {
345
378
  deployments: appwriteDeployments,
346
379
  environments: appwriteEnvironments,
347
380
  ids: appwriteIds,
381
+ mailboxSync: {
382
+ laneStates: mailboxSyncLaneStates,
383
+ lanes: mailboxSyncLanes,
384
+ states: mailboxSyncStates,
385
+ },
348
386
  oauth: {
349
387
  operations: oauthOperations,
350
388
  providers: oauthProviders,
351
389
  returnUriSchema: oauthReturnUriSchema,
352
390
  returnUris: oauthReturnUris,
353
391
  },
392
+ polling: {
393
+ shardStates: pollShardStates,
394
+ },
354
395
  rowSchemas,
355
396
  };
@@ -22,6 +22,8 @@ const validRows = {
22
22
  mailboxSyncState: 'account-1',
23
23
  mailProcessedCount: 0,
24
24
  mailTotalCount: 0,
25
+ pollShard: null,
26
+ pollShardId: null,
25
27
  primaryAlias: 'alias-1',
26
28
  primaryAliasId: 'alias-1',
27
29
  primaryEmail: 'marco@example.com',
@@ -123,6 +125,19 @@ const validRows = {
123
125
  unreadCount: 0,
124
126
  userId: 'user-1',
125
127
  },
128
+ mailboxSyncLanes: {
129
+ ...metadata,
130
+ $permissions: [],
131
+ $tableId: 'mailbox_sync_lanes',
132
+ accountId: 'test-account-id-1',
133
+ commandId: '0197f3d4-1b22-7abc-8def-123456789abc',
134
+ cursor: null,
135
+ errorCode: null,
136
+ generation: 1,
137
+ lane: 'HEAD',
138
+ state: 'RUNNING',
139
+ userId: 'test-user-id-1',
140
+ },
126
141
  mailboxSyncStates: {
127
142
  ...metadata,
128
143
  $tableId: 'mailbox_sync_states',
@@ -170,6 +185,20 @@ const validRows = {
170
185
  returnUri: 'https://app.marcoapp.io/onboarding/provider-selection',
171
186
  userId: 'user-1',
172
187
  },
188
+ pollShards: {
189
+ ...metadata,
190
+ $permissions: [],
191
+ $tableId: 'poll_shards',
192
+ accountIds: ['test-account-id-1'],
193
+ errorCode: null,
194
+ generation: 1,
195
+ lastStartedAt: null,
196
+ leaseExpiresAt: null,
197
+ leaseId: null,
198
+ nextStartAt: '2026-07-15T00:00:30.000Z',
199
+ scheduledExecutionId: null,
200
+ state: 'ACTIVE',
201
+ },
173
202
  profiles: {
174
203
  ...metadata,
175
204
  $tableId: 'profiles',
@@ -273,9 +302,11 @@ describe('appwrite', () => {
273
302
  drafts: 'drafts',
274
303
  jobs: 'jobs_v2',
275
304
  labels: 'labels',
305
+ mailboxSyncLanes: 'mailbox_sync_lanes',
276
306
  mailboxSyncStates: 'mailbox_sync_states',
277
307
  messages: 'messages',
278
308
  oauthStates: 'oauth_states',
309
+ pollShards: 'poll_shards',
279
310
  profiles: 'profiles',
280
311
  pushNotificationTokens: 'push_notification_tokens',
281
312
  savedViews: 'saved_views',
@@ -295,6 +326,40 @@ describe('appwrite', () => {
295
326
  ],
296
327
  });
297
328
  });
329
+ it('exports the additive mailbox polling contract', () => {
330
+ expect(appwrite.mailboxSync).toEqual({
331
+ laneStates: ['PENDING', 'RUNNING', 'COMPLETED', 'FAILED'],
332
+ lanes: ['HEAD', 'BACKFILL'],
333
+ states: ['INITIAL', 'SYNCING', 'CURRENT', 'IDLE', 'ERROR'],
334
+ });
335
+ expect(appwrite.polling).toEqual({ shardStates: ['ACTIVE', 'STOPPED', 'FAILED'] });
336
+ });
337
+ for (const state of ['CURRENT', 'IDLE']) {
338
+ it(`accepts the transitional ${state} mailbox sync state`, () => {
339
+ expect(v.safeParse(appwrite.rowSchemas.mailboxSyncStates, { ...validRows.mailboxSyncStates, state }).success).toBe(true);
340
+ });
341
+ }
342
+ it('rejects a mailbox sync lane without a command UUID', () => {
343
+ expect(v.safeParse(appwrite.rowSchemas.mailboxSyncLanes, {
344
+ ...validRows.mailboxSyncLanes,
345
+ commandId: 'not-a-command-uuid',
346
+ }).success).toBe(false);
347
+ });
348
+ it('rejects a poll shard with more than ten accounts', () => {
349
+ expect(v.safeParse(appwrite.rowSchemas.pollShards, {
350
+ ...validRows.pollShards,
351
+ accountIds: Array.from({ length: 11 }, (_, index) => `test-account-id-${index + 1}`),
352
+ }).success).toBe(false);
353
+ });
354
+ const serverOnlyPollingRows = [
355
+ { row: validRows.mailboxSyncLanes, schema: appwrite.rowSchemas.mailboxSyncLanes },
356
+ { row: validRows.pollShards, schema: appwrite.rowSchemas.pollShards },
357
+ ];
358
+ for (const { row, schema } of serverOnlyPollingRows) {
359
+ it(`rejects client permissions on ${row.$tableId}`, () => {
360
+ expect(v.safeParse(schema, { ...row, $permissions: ['read("user:test-user-id-1")'] }).success).toBe(false);
361
+ });
362
+ }
298
363
  const rowTestCases = Object.keys(validRows);
299
364
  for (const table of rowTestCases) {
300
365
  it(`accepts the ${table} wire row`, () => {
@@ -8,6 +8,7 @@ export declare const appwriteCommands: {
8
8
  readonly code: v.PicklistSchema<readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "COMMAND_CONFLICT", "COMMAND_NOT_FOUND", "INVALID_COMMAND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"], undefined>;
9
9
  readonly retryable: v.BooleanSchema<undefined>;
10
10
  }, undefined>;
11
+ readonly idSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>, v.BrandAction<string, "CommandId">]>;
11
12
  readonly kinds: readonly ["profile.settings.set", "profile.avatar.set", "account.settings.set", "account.delete", "alias.create", "alias.delete", "alias.name.set", "alias.primary.set", "alias.signature.set", "label.create", "label.delete", "label.rename", "thread.label.add", "thread.label.remove", "thread.archive.set", "thread.flagged.set", "thread.seen.set", "thread.snooze.set", "thread.spam.set", "thread.trash.set", "thread.delete", "draft.create", "draft.content.set", "draft.envelope.set", "draft.from.set", "draft.delete", "draft.attachment.link", "draft.attachment.delete", "draft.send", "draft.send.cancel", "draft.send.schedule"];
12
13
  readonly requestSchema: v.VariantSchema<"kind", readonly [v.StrictObjectSchema<{
13
14
  readonly accountId: v.NullableSchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "AccountId">]>, undefined>, undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/appwrite/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAiB5B,eAAO,MAAM,cAAc;8BACC,MAAM,KAAG,MAAM;CAC1C,CAAA;AAgQD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASnB,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,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAA;AAChE,MAAM,MAAM,sBAAsB,CAAC,KAAK,SAAS,mBAAmB,IAAI,OAAO,CAC7E,sBAAsB,EACtB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAChB,CAAC,SAAS,CAAC,CAAA;AACZ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,cAAc,CAAC,CAAA;AAC3F,MAAM,MAAM,oBAAoB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AO,CAAC,CAAA"}
@@ -242,6 +242,7 @@ const commandResponseSchemas = [
242
242
  export const appwriteCommands = {
243
243
  errorCodes: commandErrorCodes,
244
244
  errorSchema: commandErrorSchema,
245
+ idSchema: commandIdSchema,
245
246
  kinds: appwriteCommandKinds,
246
247
  requestSchema: v.variant('kind', commandRequestSchemas),
247
248
  responseSchema: v.variant('state', commandResponseSchemas),
@@ -94,6 +94,23 @@ export declare const appwriteFunctions: {
94
94
  readonly state: v.PicklistSchema<readonly ["AWAITING_CONNECTION", "CONNECTED", "DISCONNECTED", "ERROR"], undefined>;
95
95
  }, undefined>;
96
96
  };
97
+ readonly accountsPoll: {
98
+ errorSchema: v.StrictObjectSchema<{
99
+ readonly code: v.PicklistSchema<readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "CONFLICT", "INVALID_REQUEST", "NOT_FOUND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"], undefined>;
100
+ readonly retryable: v.BooleanSchema<undefined>;
101
+ }, undefined>;
102
+ context: "authenticated";
103
+ method: "POST";
104
+ path: "/accounts/poll";
105
+ requestSchema: v.StrictObjectSchema<{}, undefined>;
106
+ responseSchema: v.StrictObjectSchema<{
107
+ readonly commands: v.ArraySchema<v.StrictObjectSchema<{
108
+ readonly accountId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "AccountId">]>, undefined>;
109
+ readonly commandId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>, v.BrandAction<string, "CommandId">]>;
110
+ }, undefined>, undefined>;
111
+ readonly failedAccountIds: v.ArraySchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "AccountId">]>, undefined>, undefined>;
112
+ }, undefined>;
113
+ };
97
114
  readonly commands: {
98
115
  errorSchema: v.StrictObjectSchema<{
99
116
  readonly code: v.PicklistSchema<readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "CONFLICT", "INVALID_REQUEST", "NOT_FOUND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"], undefined>;
@@ -508,6 +525,21 @@ export declare const appwriteFunctions: {
508
525
  readonly state: v.LiteralSchema<"COMPLETED", undefined>;
509
526
  }, undefined>;
510
527
  };
528
+ readonly pollsRun: {
529
+ errorSchema: v.StrictObjectSchema<{
530
+ readonly code: v.PicklistSchema<readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "CONFLICT", "INVALID_REQUEST", "NOT_FOUND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"], undefined>;
531
+ readonly retryable: v.BooleanSchema<undefined>;
532
+ }, undefined>;
533
+ context: "internal";
534
+ method: "POST";
535
+ path: "/polls/run";
536
+ requestSchema: v.StrictObjectSchema<{
537
+ readonly shardId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
538
+ }, undefined>;
539
+ responseSchema: v.StrictObjectSchema<{
540
+ readonly state: v.LiteralSchema<"COMPLETED", undefined>;
541
+ }, undefined>;
542
+ };
511
543
  readonly supervisor: {
512
544
  errorSchema: v.StrictObjectSchema<{
513
545
  readonly code: v.PicklistSchema<readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "CONFLICT", "INVALID_REQUEST", "NOT_FOUND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"], undefined>;
@@ -530,7 +562,7 @@ export declare const appwriteFunctions: {
530
562
  method: "POST";
531
563
  path: "/watchers/run";
532
564
  requestSchema: v.StrictObjectSchema<{
533
- readonly shardId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
565
+ readonly shardId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
534
566
  }, undefined>;
535
567
  responseSchema: v.StrictObjectSchema<{
536
568
  readonly state: v.LiteralSchema<"COMPLETED", undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/appwrite/functions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAS5B,KAAK,uBAAuB,GAAG,eAAe,GAAG,UAAU,GAAG,SAAS,CAAA;AAsJvE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWpB,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,WAAW,CAAC,CA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AS,oBAAoB,EACtC,MAAM,SAAS,yBAAyB,CAAC,SAAS,CAAC,IACjD,SAAS,SAAS,oBAAoB,GACtC,MAAM,SAAS,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,GAClE,CAAC,OAAO,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GACvD,KAAK,GACP,KAAK,CAAA;AACT,MAAM,MAAM,uBAAuB,CACjC,SAAS,SAAS,oBAAoB,EACtC,MAAM,SAAS,yBAAyB,CAAC,SAAS,CAAC,IACjD,qBAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS;IAAE,aAAa,EAAE,MAAM,OAAO,SAAS,CAAC,CAAC,aAAa,CAAA;CAAE,GACzG,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,GACtB,KAAK,CAAA;AACT,MAAM,MAAM,wBAAwB,CAClC,SAAS,SAAS,oBAAoB,EACtC,MAAM,SAAS,yBAAyB,CAAC,SAAS,CAAC,IACjD,qBAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS;IAAE,cAAc,EAAE,MAAM,OAAO,SAAS,CAAC,CAAC,aAAa,CAAA;CAAE,GAC1G,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,GACtB,KAAK,CAAA"}
@@ -2,7 +2,7 @@ import * as v from 'valibot';
2
2
  import { oauth } from '../constants/oauth';
3
3
  import { id } from '../schemas/id';
4
4
  import { string } from '../schemas/string';
5
- import { appwrite } from './appwrite';
5
+ import { appwrite, appwriteRowIdSchema } from './appwrite';
6
6
  import { appwriteCommands } from './commands';
7
7
  const accountStates = ['AWAITING_CONNECTION', 'CONNECTED', 'DISCONNECTED', 'ERROR'];
8
8
  const functionErrorCodes = [
@@ -77,6 +77,19 @@ const apiRoutes = {
77
77
  requestSchema: v.strictObject({ connection: connectionSchema }),
78
78
  responseSchema: connectionResultSchema,
79
79
  }),
80
+ accountsPoll: createRoute({
81
+ context: 'authenticated',
82
+ method: 'POST',
83
+ path: '/accounts/poll',
84
+ requestSchema: emptySchema,
85
+ responseSchema: v.strictObject({
86
+ commands: v.array(v.strictObject({
87
+ accountId: id.accountId.required(),
88
+ commandId: appwriteCommands.idSchema,
89
+ })),
90
+ failedAccountIds: v.array(id.accountId.required()),
91
+ }),
92
+ }),
80
93
  commands: createRoute({
81
94
  context: 'authenticated',
82
95
  method: 'POST',
@@ -120,6 +133,13 @@ const workerRoutes = {
120
133
  requestSchema: v.strictObject({ jobId: id.jobId.required() }),
121
134
  responseSchema: completedSchema,
122
135
  }),
136
+ pollsRun: createRoute({
137
+ context: 'internal',
138
+ method: 'POST',
139
+ path: '/polls/run',
140
+ requestSchema: v.strictObject({ shardId: appwriteRowIdSchema }),
141
+ responseSchema: completedSchema,
142
+ }),
123
143
  supervisor: createRoute({
124
144
  context: 'internal',
125
145
  method: 'POST',
@@ -131,7 +151,7 @@ const workerRoutes = {
131
151
  context: 'internal',
132
152
  method: 'POST',
133
153
  path: '/watchers/run',
134
- requestSchema: v.strictObject({ shardId: string.required() }),
154
+ requestSchema: v.strictObject({ shardId: appwriteRowIdSchema }),
135
155
  responseSchema: completedSchema,
136
156
  }),
137
157
  };
@@ -64,6 +64,15 @@ const routeFixtures = [
64
64
  },
65
65
  route: () => appwriteFunctions.api.routes.accountsConnect,
66
66
  },
67
+ {
68
+ name: 'account poll',
69
+ request: {},
70
+ response: {
71
+ commands: [{ accountId: 'test-account-id-1', commandId: '0197f3d4-1b22-7abc-8def-123456789abc' }],
72
+ failedAccountIds: ['test-account-id-2'],
73
+ },
74
+ route: () => appwriteFunctions.api.routes.accountsPoll,
75
+ },
67
76
  {
68
77
  name: 'push tokens',
69
78
  request: { operation: 'REGISTER', token: 'ExponentPushToken[example]' },
@@ -94,9 +103,15 @@ const routeFixtures = [
94
103
  response: { state: 'COMPLETED' },
95
104
  route: () => appwriteFunctions.worker.routes.jobsRun,
96
105
  },
106
+ {
107
+ name: 'poll runner',
108
+ request: { shardId: 'test-poll-shard-id-1' },
109
+ response: { state: 'COMPLETED' },
110
+ route: () => appwriteFunctions.worker.routes.pollsRun,
111
+ },
97
112
  {
98
113
  name: 'watcher runner',
99
- request: { shardId: 'watcher-shard_1' },
114
+ request: { shardId: 'test-watcher-shard-id-1' },
100
115
  response: { state: 'COMPLETED' },
101
116
  route: () => appwriteFunctions.worker.routes.watchersRun,
102
117
  },
@@ -107,12 +122,14 @@ describe('appwriteFunctions', () => {
107
122
  { functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.profileEnsure },
108
123
  { functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.commands },
109
124
  { functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.accountsConnect },
125
+ { functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.accountsPoll },
110
126
  { functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.accountConnection },
111
127
  { functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.pushTokens },
112
128
  { functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.accountDelete },
113
129
  { functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.oauthWebhook },
114
130
  { functionId: appwriteFunctions.worker.id, route: appwriteFunctions.worker.routes.supervisor },
115
131
  { functionId: appwriteFunctions.worker.id, route: appwriteFunctions.worker.routes.jobsRun },
132
+ { functionId: appwriteFunctions.worker.id, route: appwriteFunctions.worker.routes.pollsRun },
116
133
  { functionId: appwriteFunctions.worker.id, route: appwriteFunctions.worker.routes.watchersRun },
117
134
  ].map(({ functionId, route }) => ({
118
135
  context: route.context,
@@ -123,12 +140,14 @@ describe('appwriteFunctions', () => {
123
140
  { context: 'authenticated', functionId: 'marco-api', method: 'POST', path: '/profile/ensure' },
124
141
  { context: 'authenticated', functionId: 'marco-api', method: 'POST', path: '/commands' },
125
142
  { context: 'authenticated', functionId: 'marco-api', method: 'POST', path: '/accounts/connect' },
143
+ { context: 'authenticated', functionId: 'marco-api', method: 'POST', path: '/accounts/poll' },
126
144
  { context: 'authenticated', functionId: 'marco-api', method: 'PUT', path: '/accounts/connection' },
127
145
  { context: 'authenticated', functionId: 'marco-api', method: 'POST', path: '/push-tokens' },
128
146
  { context: 'authenticated', functionId: 'marco-api', method: 'DELETE', path: '/account/delete' },
129
147
  { context: 'webhook', functionId: 'marco-api', method: 'GET', path: '/v1/wh/oauth/callback' },
130
148
  { context: 'internal', functionId: 'marco-worker', method: 'POST', path: '/' },
131
149
  { context: 'internal', functionId: 'marco-worker', method: 'POST', path: '/jobs/run' },
150
+ { context: 'internal', functionId: 'marco-worker', method: 'POST', path: '/polls/run' },
132
151
  { context: 'internal', functionId: 'marco-worker', method: 'POST', path: '/watchers/run' },
133
152
  ]);
134
153
  });
@@ -142,6 +161,20 @@ describe('appwriteFunctions', () => {
142
161
  expect(v.safeParse(route().responseSchema, { ...response, userId: 'another-user' }).success).toBe(false);
143
162
  });
144
163
  }
164
+ it('rejects caller-selected accounts for manual polling', () => {
165
+ const requestSchema = appwriteFunctions.api.routes.accountsPoll.requestSchema;
166
+ expect(v.safeParse(requestSchema, { accountId: 'account_1' }).success).toBe(false);
167
+ expect(v.safeParse(requestSchema, { accountIds: ['account_1'] }).success).toBe(false);
168
+ });
169
+ const workerShardRoutes = [
170
+ { description: 'poll', requestSchema: appwriteFunctions.worker.routes.pollsRun.requestSchema },
171
+ { description: 'watcher', requestSchema: appwriteFunctions.worker.routes.watchersRun.requestSchema },
172
+ ];
173
+ for (const { description, requestSchema } of workerShardRoutes) {
174
+ it(`rejects a malformed ${description} shard ID`, () => {
175
+ expect(v.safeParse(requestSchema, { shardId: 'test invalid shard id' }).success).toBe(false);
176
+ });
177
+ }
145
178
  it('redacts credentials from connection responses and compact errors', () => {
146
179
  expect(v.safeParse(appwriteFunctions.api.routes.accountsConnect.responseSchema, {
147
180
  accountId: 'account_1',
@@ -1,4 +1,4 @@
1
- export { type AppwriteDraftAttachment, type AppwriteDraftEnvelope, type AppwriteEnvironment, type AppwriteMessageAttachment, type AppwriteMessageRecipient, type AppwriteRow, type AppwriteRowTable, appwrite, } from './appwrite';
1
+ export { type AppwriteDraftAttachment, type AppwriteDraftEnvelope, type AppwriteEnvironment, type AppwriteMailboxSyncLane, type AppwriteMailboxSyncLaneState, type AppwriteMailboxSyncState, type AppwriteMessageAttachment, type AppwriteMessageRecipient, type AppwritePollShardState, type AppwriteRow, type AppwriteRowTable, appwrite, } from './appwrite';
2
2
  export { type AppwriteCommandError, type AppwriteCommandKind, type AppwriteCommandPayload, type AppwriteCommandRequest, type AppwriteCommandResponse, type AppwriteCommandState, appwriteAvatar, appwriteCommands, } from './commands';
3
3
  export { type AppwriteFunctionContext, type AppwriteFunctionError, type AppwriteFunctionName, type AppwriteFunctionRequest, type AppwriteFunctionResponse, type AppwriteFunctionRoute, type AppwriteFunctionRouteName, appwriteFunctions, } from './functions';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appwrite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,QAAQ,GACT,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,cAAc,EACd,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,iBAAiB,GAClB,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appwrite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,QAAQ,GACT,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,cAAc,EACd,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,iBAAiB,GAClB,MAAM,aAAa,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type AppwriteCommandError, type AppwriteCommandKind, type AppwriteCommandPayload, type AppwriteCommandRequest, type AppwriteCommandResponse, type AppwriteCommandState, type AppwriteEnvironment, type AppwriteFunctionContext, type AppwriteFunctionError, type AppwriteFunctionName, type AppwriteFunctionRequest, type AppwriteFunctionResponse, type AppwriteFunctionRoute, type AppwriteFunctionRouteName, type AppwriteMessageAttachment, type AppwriteMessageRecipient, type AppwriteRow, type AppwriteRowTable, appwrite, appwriteAvatar, appwriteCommands, appwriteFunctions, } from './appwrite';
1
+ export { type AppwriteCommandError, type AppwriteCommandKind, type AppwriteCommandPayload, type AppwriteCommandRequest, type AppwriteCommandResponse, type AppwriteCommandState, type AppwriteEnvironment, type AppwriteFunctionContext, type AppwriteFunctionError, type AppwriteFunctionName, type AppwriteFunctionRequest, type AppwriteFunctionResponse, type AppwriteFunctionRoute, type AppwriteFunctionRouteName, type AppwriteMailboxSyncLane, type AppwriteMailboxSyncLaneState, type AppwriteMailboxSyncState, type AppwriteMessageAttachment, type AppwriteMessageRecipient, type AppwritePollShardState, type AppwriteRow, type AppwriteRowTable, appwrite, appwriteAvatar, appwriteCommands, appwriteFunctions, } from './appwrite';
2
2
  export { marcoConstants } from './constants';
3
3
  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 JobId, type LabelId, type MessageId, marcoSchemas, type PushNotificationTokenId, type RecipientId, type Thread, type ThreadId, type ThreadMessage, type ThreadMessageAttachment, type ThreadMessageRecipient, type UserId, type UserView, type ViewId, } from './schemas';
4
4
  export * from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK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,CAAA;AAC5C,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,KAAK,EACV,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,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,MAAM,GACZ,MAAM,WAAW,CAAA;AAClB,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,KAAK,kBAAkB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",