feat(13-01): auto-generate BACKEND_SCHEMAS, update RCLONE_TYPE_MAP for all 18 backends

- BACKEND_SCHEMAS now auto-generated via Object.fromEntries over registry keys
- RCLONE_TYPE_MAP expanded with 11 new entries for all 18 backend types
- RCLONE_TYPE_MAP exported for direct testing
- index.test.ts: added auto-generation coverage (3 tests) + 4 new backend schema smoke tests
- rclone-conf.test.ts: added RCLONE_TYPE_MAP exhaustiveness test + gdrive/ftp/smb conf output tests
- Rule 1 fix: BackendSelectionStep test used /next/i regex matching WebDAV "NextCloud" card buttons
This commit is contained in:
2026-04-01 16:20:18 +02:00
parent b8c64937ea
commit 3010cdb0c6
5 changed files with 251 additions and 16 deletions
+6 -10
View File
@@ -2,6 +2,7 @@
// Zod schemas derived programmatically from the Backend Schema Registry.
// DO NOT hand-write z.object() calls with hardcoded field names — all shapes come from the registry.
// Adding a field to BACKEND_REGISTRY automatically adds it to validation.
// BACKEND_SCHEMAS is auto-generated from registry keys — no manual per-backend calls needed.
import { z } from 'zod';
import { BACKEND_REGISTRY, BackendType } from './registry';
@@ -27,13 +28,8 @@ function buildZodSchema(backendType: BackendType): z.ZodObject<Record<string, z.
return z.object(shape);
}
export const BACKEND_SCHEMAS = {
azureblob: buildZodSchema('azureblob'),
s3: buildZodSchema('s3'),
's3-compatible': buildZodSchema('s3-compatible'),
onedrive: buildZodSchema('onedrive'),
sftp: buildZodSchema('sftp'),
gcs: buildZodSchema('gcs'),
b2: buildZodSchema('b2'),
} as const;
// Auto-generated from registry keys — expands automatically when BACKEND_REGISTRY grows.
// No manual buildZodSchema() call needed per new backend.
export const BACKEND_SCHEMAS = Object.fromEntries(
(Object.keys(BACKEND_REGISTRY) as BackendType[]).map(t => [t, buildZodSchema(t)])
) as Record<BackendType, ReturnType<typeof buildZodSchema>>;