@marcoappio/marco-config 3.0.7 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appwrite/appwrite.d.ts +21 -0
- package/dist/appwrite/appwrite.d.ts.map +1 -1
- package/dist/appwrite/appwrite.js +6 -0
- package/dist/appwrite/appwrite.test.js +20 -0
- package/dist/appwrite/functions.d.ts +16 -16
- package/dist/appwrite/functions.js +10 -10
- package/dist/appwrite/functions.test.js +5 -5
- package/package.json +1 -1
|
@@ -275,6 +275,16 @@ declare const rowSchemas: {
|
|
|
275
275
|
readonly $tableId: v.LiteralSchema<"oauth_states", undefined>;
|
|
276
276
|
readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
277
277
|
}, undefined>;
|
|
278
|
+
readonly pollShardCoordinators: v.StrictObjectSchema<{
|
|
279
|
+
readonly $permissions: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.LengthAction<string[], 0, undefined>]>;
|
|
280
|
+
readonly accountCursor: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
|
|
281
|
+
readonly $createdAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
282
|
+
readonly $databaseId: v.LiteralSchema<"marco", undefined>;
|
|
283
|
+
readonly $id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
|
|
284
|
+
readonly $sequence: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
|
|
285
|
+
readonly $tableId: v.LiteralSchema<"poll_shard_coordinators", undefined>;
|
|
286
|
+
readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
287
|
+
}, undefined>;
|
|
278
288
|
readonly pollShards: v.StrictObjectSchema<{
|
|
279
289
|
readonly $permissions: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.LengthAction<string[], 0, undefined>]>;
|
|
280
290
|
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>]>;
|
|
@@ -456,6 +466,7 @@ export declare const appwrite: {
|
|
|
456
466
|
readonly mailboxSyncStates: "mailbox_sync_states";
|
|
457
467
|
readonly messages: "messages";
|
|
458
468
|
readonly oauthStates: "oauth_states";
|
|
469
|
+
readonly pollShardCoordinators: "poll_shard_coordinators";
|
|
459
470
|
readonly pollShards: "poll_shards";
|
|
460
471
|
readonly profiles: "profiles";
|
|
461
472
|
readonly pushNotificationTokens: "push_notification_tokens";
|
|
@@ -714,6 +725,16 @@ export declare const appwrite: {
|
|
|
714
725
|
readonly $tableId: v.LiteralSchema<"oauth_states", undefined>;
|
|
715
726
|
readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
716
727
|
}, undefined>;
|
|
728
|
+
readonly pollShardCoordinators: v.StrictObjectSchema<{
|
|
729
|
+
readonly $permissions: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.LengthAction<string[], 0, undefined>]>;
|
|
730
|
+
readonly accountCursor: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>, undefined>;
|
|
731
|
+
readonly $createdAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
732
|
+
readonly $databaseId: v.LiteralSchema<"marco", undefined>;
|
|
733
|
+
readonly $id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
|
|
734
|
+
readonly $sequence: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
|
|
735
|
+
readonly $tableId: v.LiteralSchema<"poll_shard_coordinators", undefined>;
|
|
736
|
+
readonly $updatedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
737
|
+
}, undefined>;
|
|
717
738
|
readonly pollShards: v.StrictObjectSchema<{
|
|
718
739
|
readonly $permissions: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.LengthAction<string[], 0, undefined>]>;
|
|
719
740
|
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>]>;
|
|
@@ -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;AAO5B,eAAO,MAAM,mBAAmB,6KAA+F,CAAA;AAW/H,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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B,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"}
|
|
@@ -102,6 +102,7 @@ const appwriteIds = {
|
|
|
102
102
|
mailboxSyncStates: 'mailbox_sync_states',
|
|
103
103
|
messages: 'messages',
|
|
104
104
|
oauthStates: 'oauth_states',
|
|
105
|
+
pollShardCoordinators: 'poll_shard_coordinators',
|
|
105
106
|
pollShards: 'poll_shards',
|
|
106
107
|
profiles: 'profiles',
|
|
107
108
|
pushNotificationTokens: 'push_notification_tokens',
|
|
@@ -284,6 +285,11 @@ const rowSchemas = {
|
|
|
284
285
|
returnUri: oauthReturnUriSchema,
|
|
285
286
|
userId: identifierSchema,
|
|
286
287
|
}),
|
|
288
|
+
pollShardCoordinators: v.strictObject({
|
|
289
|
+
...wireMetadata(appwriteIds.tables.pollShardCoordinators),
|
|
290
|
+
$permissions: v.pipe(v.array(v.string()), v.length(0)),
|
|
291
|
+
accountCursor: v.nullable(identifierSchema),
|
|
292
|
+
}),
|
|
287
293
|
pollShards: v.strictObject({
|
|
288
294
|
...wireMetadata(appwriteIds.tables.pollShards),
|
|
289
295
|
$permissions: v.pipe(v.array(v.string()), v.length(0)),
|
|
@@ -272,6 +272,13 @@ const validRows = {
|
|
|
272
272
|
state: 'ACTIVE',
|
|
273
273
|
},
|
|
274
274
|
};
|
|
275
|
+
const validPollShardCoordinatorRow = {
|
|
276
|
+
...metadata,
|
|
277
|
+
$permissions: [],
|
|
278
|
+
$tableId: 'poll_shard_coordinators',
|
|
279
|
+
accountCursor: null,
|
|
280
|
+
};
|
|
281
|
+
const pollShardCoordinatorSchema = Object.entries(appwrite.rowSchemas).find(([table]) => table === 'pollShardCoordinators')?.[1];
|
|
275
282
|
describe('appwrite', () => {
|
|
276
283
|
it('publishes the production browser and OAuth configuration', () => {
|
|
277
284
|
expect(appwrite.environments).toEqual(['development', 'production', 'staging']);
|
|
@@ -307,6 +314,7 @@ describe('appwrite', () => {
|
|
|
307
314
|
mailboxSyncStates: 'mailbox_sync_states',
|
|
308
315
|
messages: 'messages',
|
|
309
316
|
oauthStates: 'oauth_states',
|
|
317
|
+
pollShardCoordinators: 'poll_shard_coordinators',
|
|
310
318
|
pollShards: 'poll_shards',
|
|
311
319
|
profiles: 'profiles',
|
|
312
320
|
pushNotificationTokens: 'push_notification_tokens',
|
|
@@ -355,6 +363,18 @@ describe('appwrite', () => {
|
|
|
355
363
|
pollingSnapshot: '{"members":[]}',
|
|
356
364
|
}).success).toBe(true);
|
|
357
365
|
});
|
|
366
|
+
it('exports the strict server-only poll shard coordinator row contract', () => {
|
|
367
|
+
expect(pollShardCoordinatorSchema).toBeDefined();
|
|
368
|
+
if (pollShardCoordinatorSchema) {
|
|
369
|
+
for (const accountCursor of [null, 'test-account-id-1']) {
|
|
370
|
+
expect(v.safeParse(pollShardCoordinatorSchema, { ...validPollShardCoordinatorRow, accountCursor }).success).toBe(true);
|
|
371
|
+
}
|
|
372
|
+
expect(v.safeParse(pollShardCoordinatorSchema, { ...validPollShardCoordinatorRow, $permissions: ['read("user:test-user-id-1")'] }).success).toBe(false);
|
|
373
|
+
expect(v.safeParse(pollShardCoordinatorSchema, { ...validPollShardCoordinatorRow, unexpected: true }).success).toBe(false);
|
|
374
|
+
const { $id: _, ...rowWithoutId } = validPollShardCoordinatorRow;
|
|
375
|
+
expect(v.safeParse(pollShardCoordinatorSchema, rowWithoutId).success).toBe(false);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
358
378
|
const serverOnlyPollingRows = [
|
|
359
379
|
{ row: validRows.mailboxSyncLanes, schema: appwrite.rowSchemas.mailboxSyncLanes },
|
|
360
380
|
{ row: validRows.pollShards, schema: appwrite.rowSchemas.pollShards },
|
|
@@ -471,6 +471,22 @@ export declare const appwriteFunctions: {
|
|
|
471
471
|
readonly state: v.LiteralSchema<"COMPLETED", undefined>;
|
|
472
472
|
}, undefined>;
|
|
473
473
|
};
|
|
474
|
+
readonly pollsRun: {
|
|
475
|
+
errorSchema: v.StrictObjectSchema<{
|
|
476
|
+
readonly code: v.PicklistSchema<readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "CONFLICT", "INVALID_REQUEST", "NOT_FOUND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"], undefined>;
|
|
477
|
+
readonly retryable: v.BooleanSchema<undefined>;
|
|
478
|
+
}, undefined>;
|
|
479
|
+
context: "internal";
|
|
480
|
+
method: "POST";
|
|
481
|
+
path: "/polls/run";
|
|
482
|
+
requestSchema: v.StrictObjectSchema<{
|
|
483
|
+
readonly scheduledFor: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>, v.CheckAction<string, undefined>]>;
|
|
484
|
+
readonly shardId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
|
|
485
|
+
}, undefined>;
|
|
486
|
+
responseSchema: v.StrictObjectSchema<{
|
|
487
|
+
readonly state: v.LiteralSchema<"COMPLETED", undefined>;
|
|
488
|
+
}, undefined>;
|
|
489
|
+
};
|
|
474
490
|
readonly profileEnsure: {
|
|
475
491
|
errorSchema: v.StrictObjectSchema<{
|
|
476
492
|
readonly code: v.PicklistSchema<readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "CONFLICT", "INVALID_REQUEST", "NOT_FOUND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"], undefined>;
|
|
@@ -525,22 +541,6 @@ export declare const appwriteFunctions: {
|
|
|
525
541
|
readonly state: v.LiteralSchema<"COMPLETED", undefined>;
|
|
526
542
|
}, undefined>;
|
|
527
543
|
};
|
|
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 scheduledFor: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>, v.CheckAction<string, undefined>]>;
|
|
538
|
-
readonly shardId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
|
|
539
|
-
}, undefined>;
|
|
540
|
-
responseSchema: v.StrictObjectSchema<{
|
|
541
|
-
readonly state: v.LiteralSchema<"COMPLETED", undefined>;
|
|
542
|
-
}, undefined>;
|
|
543
|
-
};
|
|
544
544
|
readonly supervisor: {
|
|
545
545
|
errorSchema: v.StrictObjectSchema<{
|
|
546
546
|
readonly code: v.PicklistSchema<readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "CONFLICT", "INVALID_REQUEST", "NOT_FOUND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"], undefined>;
|
|
@@ -111,6 +111,16 @@ const apiRoutes = {
|
|
|
111
111
|
}),
|
|
112
112
|
responseSchema: completedSchema,
|
|
113
113
|
}),
|
|
114
|
+
pollsRun: createRoute({
|
|
115
|
+
context: 'internal',
|
|
116
|
+
method: 'POST',
|
|
117
|
+
path: '/polls/run',
|
|
118
|
+
requestSchema: v.strictObject({
|
|
119
|
+
scheduledFor: timestampSchema,
|
|
120
|
+
shardId: appwriteRowIdSchema,
|
|
121
|
+
}),
|
|
122
|
+
responseSchema: completedSchema,
|
|
123
|
+
}),
|
|
114
124
|
profileEnsure: createRoute({
|
|
115
125
|
context: 'authenticated',
|
|
116
126
|
method: 'POST',
|
|
@@ -137,16 +147,6 @@ const workerRoutes = {
|
|
|
137
147
|
requestSchema: v.strictObject({ jobId: id.jobId.required() }),
|
|
138
148
|
responseSchema: completedSchema,
|
|
139
149
|
}),
|
|
140
|
-
pollsRun: createRoute({
|
|
141
|
-
context: 'internal',
|
|
142
|
-
method: 'POST',
|
|
143
|
-
path: '/polls/run',
|
|
144
|
-
requestSchema: v.strictObject({
|
|
145
|
-
scheduledFor: timestampSchema,
|
|
146
|
-
shardId: appwriteRowIdSchema,
|
|
147
|
-
}),
|
|
148
|
-
responseSchema: completedSchema,
|
|
149
|
-
}),
|
|
150
150
|
supervisor: createRoute({
|
|
151
151
|
context: 'internal',
|
|
152
152
|
method: 'POST',
|
|
@@ -107,7 +107,7 @@ const routeFixtures = [
|
|
|
107
107
|
name: 'poll runner',
|
|
108
108
|
request: { scheduledFor: '2026-07-23T12:00:30.000Z', shardId: 'test-poll-shard-id-1' },
|
|
109
109
|
response: { state: 'COMPLETED' },
|
|
110
|
-
route: () => appwriteFunctions.
|
|
110
|
+
route: () => appwriteFunctions.api.routes.pollsRun,
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
name: 'watcher runner',
|
|
@@ -127,9 +127,9 @@ describe('appwriteFunctions', () => {
|
|
|
127
127
|
{ functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.pushTokens },
|
|
128
128
|
{ functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.accountDelete },
|
|
129
129
|
{ functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.oauthWebhook },
|
|
130
|
+
{ functionId: appwriteFunctions.api.id, route: appwriteFunctions.api.routes.pollsRun },
|
|
130
131
|
{ functionId: appwriteFunctions.worker.id, route: appwriteFunctions.worker.routes.supervisor },
|
|
131
132
|
{ functionId: appwriteFunctions.worker.id, route: appwriteFunctions.worker.routes.jobsRun },
|
|
132
|
-
{ functionId: appwriteFunctions.worker.id, route: appwriteFunctions.worker.routes.pollsRun },
|
|
133
133
|
{ functionId: appwriteFunctions.worker.id, route: appwriteFunctions.worker.routes.watchersRun },
|
|
134
134
|
].map(({ functionId, route }) => ({
|
|
135
135
|
context: route.context,
|
|
@@ -145,9 +145,9 @@ describe('appwriteFunctions', () => {
|
|
|
145
145
|
{ context: 'authenticated', functionId: 'marco-api', method: 'POST', path: '/push-tokens' },
|
|
146
146
|
{ context: 'authenticated', functionId: 'marco-api', method: 'DELETE', path: '/account/delete' },
|
|
147
147
|
{ context: 'webhook', functionId: 'marco-api', method: 'GET', path: '/v1/wh/oauth/callback' },
|
|
148
|
+
{ context: 'internal', functionId: 'marco-api', method: 'POST', path: '/polls/run' },
|
|
148
149
|
{ context: 'internal', functionId: 'marco-worker', method: 'POST', path: '/' },
|
|
149
150
|
{ context: 'internal', functionId: 'marco-worker', method: 'POST', path: '/jobs/run' },
|
|
150
|
-
{ context: 'internal', functionId: 'marco-worker', method: 'POST', path: '/polls/run' },
|
|
151
151
|
{ context: 'internal', functionId: 'marco-worker', method: 'POST', path: '/watchers/run' },
|
|
152
152
|
]);
|
|
153
153
|
});
|
|
@@ -182,7 +182,7 @@ describe('appwriteFunctions', () => {
|
|
|
182
182
|
{
|
|
183
183
|
description: 'poll',
|
|
184
184
|
request: { scheduledFor: '2026-07-23T12:00:30.000Z', shardId: 'test invalid shard id' },
|
|
185
|
-
requestSchema: appwriteFunctions.
|
|
185
|
+
requestSchema: appwriteFunctions.api.routes.pollsRun.requestSchema,
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
188
|
description: 'watcher',
|
|
@@ -219,7 +219,7 @@ describe('appwriteFunctions', () => {
|
|
|
219
219
|
},
|
|
220
220
|
]) {
|
|
221
221
|
it(`rejects a poll request with ${description}`, () => {
|
|
222
|
-
expect(v.safeParse(appwriteFunctions.
|
|
222
|
+
expect(v.safeParse(appwriteFunctions.api.routes.pollsRun.requestSchema, request).success).toBe(false);
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
it('redacts credentials from connection responses and compact errors', () => {
|