@marcoappio/marco-config 3.0.1 → 3.0.2
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.
|
@@ -106,7 +106,7 @@ export declare const appwriteFunctions: {
|
|
|
106
106
|
responseSchema: v.StrictObjectSchema<{
|
|
107
107
|
readonly commands: v.ArraySchema<v.StrictObjectSchema<{
|
|
108
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.
|
|
109
|
+
readonly commandId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, undefined>]>;
|
|
110
110
|
}, undefined>, undefined>;
|
|
111
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
112
|
}, undefined>;
|
|
@@ -85,7 +85,7 @@ const apiRoutes = {
|
|
|
85
85
|
responseSchema: v.strictObject({
|
|
86
86
|
commands: v.array(v.strictObject({
|
|
87
87
|
accountId: id.accountId.required(),
|
|
88
|
-
commandId:
|
|
88
|
+
commandId: appwriteRowIdSchema,
|
|
89
89
|
})),
|
|
90
90
|
failedAccountIds: v.array(id.accountId.required()),
|
|
91
91
|
}),
|
|
@@ -68,7 +68,7 @@ const routeFixtures = [
|
|
|
68
68
|
name: 'account poll',
|
|
69
69
|
request: {},
|
|
70
70
|
response: {
|
|
71
|
-
commands: [{ accountId: 'test-account-id-1', commandId: '
|
|
71
|
+
commands: [{ accountId: 'test-account-id-1', commandId: 'sync_0123456789abcdef0123456789ab' }],
|
|
72
72
|
failedAccountIds: ['test-account-id-2'],
|
|
73
73
|
},
|
|
74
74
|
route: () => appwriteFunctions.api.routes.accountsPoll,
|
|
@@ -166,6 +166,18 @@ describe('appwriteFunctions', () => {
|
|
|
166
166
|
expect(v.safeParse(requestSchema, { accountId: 'account_1' }).success).toBe(false);
|
|
167
167
|
expect(v.safeParse(requestSchema, { accountIds: ['account_1'] }).success).toBe(false);
|
|
168
168
|
});
|
|
169
|
+
for (const { description, value } of [
|
|
170
|
+
{ description: 'empty', value: '' },
|
|
171
|
+
{ description: 'overlong', value: 'a'.repeat(37) },
|
|
172
|
+
{ description: 'illegal', value: 'test/command/id/1' },
|
|
173
|
+
]) {
|
|
174
|
+
it(`rejects an ${description} manual-poll command ID`, () => {
|
|
175
|
+
expect(v.safeParse(appwriteFunctions.api.routes.accountsPoll.responseSchema, {
|
|
176
|
+
commands: [{ accountId: 'test-account-id-1', commandId: value }],
|
|
177
|
+
failedAccountIds: [],
|
|
178
|
+
}).success).toBe(false);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
169
181
|
const workerShardRoutes = [
|
|
170
182
|
{ description: 'poll', requestSchema: appwriteFunctions.worker.routes.pollsRun.requestSchema },
|
|
171
183
|
{ description: 'watcher', requestSchema: appwriteFunctions.worker.routes.watchersRun.requestSchema },
|