@marcoappio/marco-config 2.0.595 → 2.0.596
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,6 +1,6 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
export declare const appwriteAvatar: {
|
|
3
|
-
createFileId: (
|
|
3
|
+
createFileId: (commandId: string) => string;
|
|
4
4
|
};
|
|
5
5
|
export declare const appwriteCommands: {
|
|
6
6
|
readonly errorCodes: readonly ["AUTHENTICATION_FAILED", "AUTHORIZATION_FAILED", "COMMAND_CONFLICT", "COMMAND_NOT_FOUND", "INVALID_COMMAND", "PROVIDER_REJECTED", "TRANSIENT_FAILURE", "INTERNAL_ERROR"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/appwrite/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
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,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAA"}
|
|
@@ -8,9 +8,8 @@ const timestampSchema = v.pipe(v.string(), v.isoTimestamp());
|
|
|
8
8
|
const appwriteThreadCommandBatchSize = 100;
|
|
9
9
|
const threadIdsSchema = v.pipe(v.array(id.threadId.required()), v.minLength(1), v.maxLength(appwriteThreadCommandBatchSize));
|
|
10
10
|
const avatarSha256Schema = v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/));
|
|
11
|
-
const appwriteUserIdSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(20), v.regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/));
|
|
12
11
|
export const appwriteAvatar = {
|
|
13
|
-
createFileId: (
|
|
12
|
+
createFileId: (commandId) => v.parse(commandIdSchema, commandId),
|
|
14
13
|
};
|
|
15
14
|
const commandKinds = {
|
|
16
15
|
accountDelete: 'account.delete',
|
|
@@ -7,7 +7,6 @@ const commandMetadata = {
|
|
|
7
7
|
version: 1,
|
|
8
8
|
};
|
|
9
9
|
const avatarSha256 = 'a'.repeat(64);
|
|
10
|
-
const avatarUserId = 'avatarowner123456789';
|
|
11
10
|
const commandFixtures = [
|
|
12
11
|
{
|
|
13
12
|
command: {
|
|
@@ -291,12 +290,12 @@ describe('appwriteCommands', () => {
|
|
|
291
290
|
'INTERNAL_ERROR',
|
|
292
291
|
]);
|
|
293
292
|
});
|
|
294
|
-
it('derives a
|
|
295
|
-
expect(appwriteAvatar.createFileId(
|
|
293
|
+
it('derives a command-scoped avatar file ID within Appwrite limits', () => {
|
|
294
|
+
expect(appwriteAvatar.createFileId(commandMetadata.id)).toBe(commandMetadata.id);
|
|
295
|
+
expect(appwriteAvatar.createFileId('0197f3d4-1b22-7abc-8def-123456789abd')).not.toBe(appwriteAvatar.createFileId(commandMetadata.id));
|
|
296
296
|
});
|
|
297
|
-
it('rejects an invalid
|
|
298
|
-
expect(() => appwriteAvatar.createFileId(
|
|
299
|
-
expect(() => appwriteAvatar.createFileId('invalid!user', avatarSha256)).toThrow();
|
|
297
|
+
it('rejects an invalid command ID before deriving an avatar file ID', () => {
|
|
298
|
+
expect(() => appwriteAvatar.createFileId('not-a-command-id')).toThrow();
|
|
300
299
|
});
|
|
301
300
|
it('rejects a thread command larger than one bounded worker page', () => {
|
|
302
301
|
expect(v.safeParse(appwriteCommands.requestSchema, {
|