pocketbase-zod-schema 0.1.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.
- package/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +167 -0
- package/dist/cli/index.cjs +3383 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +30 -0
- package/dist/cli/index.d.ts +30 -0
- package/dist/cli/index.js +3331 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/migrate.cjs +3380 -0
- package/dist/cli/migrate.cjs.map +1 -0
- package/dist/cli/migrate.d.cts +1 -0
- package/dist/cli/migrate.d.ts +1 -0
- package/dist/cli/migrate.js +3353 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli/utils/index.cjs +540 -0
- package/dist/cli/utils/index.cjs.map +1 -0
- package/dist/cli/utils/index.d.cts +232 -0
- package/dist/cli/utils/index.d.ts +232 -0
- package/dist/cli/utils/index.js +487 -0
- package/dist/cli/utils/index.js.map +1 -0
- package/dist/enums.cjs +19 -0
- package/dist/enums.cjs.map +1 -0
- package/dist/enums.d.cts +6 -0
- package/dist/enums.d.ts +6 -0
- package/dist/enums.js +17 -0
- package/dist/enums.js.map +1 -0
- package/dist/index.cjs +4900 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +4726 -0
- package/dist/index.js.map +1 -0
- package/dist/migration/analyzer.cjs +1267 -0
- package/dist/migration/analyzer.cjs.map +1 -0
- package/dist/migration/analyzer.d.cts +186 -0
- package/dist/migration/analyzer.d.ts +186 -0
- package/dist/migration/analyzer.js +1232 -0
- package/dist/migration/analyzer.js.map +1 -0
- package/dist/migration/diff.cjs +557 -0
- package/dist/migration/diff.cjs.map +1 -0
- package/dist/migration/diff.d.cts +291 -0
- package/dist/migration/diff.d.ts +291 -0
- package/dist/migration/diff.js +534 -0
- package/dist/migration/diff.js.map +1 -0
- package/dist/migration/generator.cjs +778 -0
- package/dist/migration/generator.cjs.map +1 -0
- package/dist/migration/generator.d.cts +225 -0
- package/dist/migration/generator.d.ts +225 -0
- package/dist/migration/generator.js +737 -0
- package/dist/migration/generator.js.map +1 -0
- package/dist/migration/index.cjs +3390 -0
- package/dist/migration/index.cjs.map +1 -0
- package/dist/migration/index.d.cts +103 -0
- package/dist/migration/index.d.ts +103 -0
- package/dist/migration/index.js +3265 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/migration/snapshot.cjs +609 -0
- package/dist/migration/snapshot.cjs.map +1 -0
- package/dist/migration/snapshot.d.cts +167 -0
- package/dist/migration/snapshot.d.ts +167 -0
- package/dist/migration/snapshot.js +575 -0
- package/dist/migration/snapshot.js.map +1 -0
- package/dist/migration/utils/index.cjs +672 -0
- package/dist/migration/utils/index.cjs.map +1 -0
- package/dist/migration/utils/index.d.cts +207 -0
- package/dist/migration/utils/index.d.ts +207 -0
- package/dist/migration/utils/index.js +641 -0
- package/dist/migration/utils/index.js.map +1 -0
- package/dist/mutator.cjs +427 -0
- package/dist/mutator.cjs.map +1 -0
- package/dist/mutator.d.cts +190 -0
- package/dist/mutator.d.ts +190 -0
- package/dist/mutator.js +425 -0
- package/dist/mutator.js.map +1 -0
- package/dist/permissions-ZHafVSIx.d.cts +71 -0
- package/dist/permissions-ZHafVSIx.d.ts +71 -0
- package/dist/schema.cjs +430 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +316 -0
- package/dist/schema.d.ts +316 -0
- package/dist/schema.js +396 -0
- package/dist/schema.js.map +1 -0
- package/dist/types-BbTgmg6H.d.cts +91 -0
- package/dist/types-z1Dkjg8m.d.ts +91 -0
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +14 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/user-jS1aYoeD.d.cts +123 -0
- package/dist/user-jS1aYoeD.d.ts +123 -0
- package/package.json +165 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/migration/utils/pluralize.ts","../../../src/migration/utils/relation-detector.ts","../../../src/migration/utils/type-mapper.ts"],"names":["z"],"mappings":";;;;;AAQA,IAAM,aAAA,GAAwC;AAAA;AAAA,EAE5C,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO,UAAA;AAAA,EACP,KAAA,EAAO,UAAA;AAAA,EACP,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,IAAA,EAAM,MAAA;AAAA,EACN,IAAA,EAAM,MAAA;AAAA,EACN,KAAA,EAAO,MAAA;AAAA,EACP,KAAA,EAAO,MAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA;AAAA,EAGP,QAAA,EAAU,YAAA;AAAA,EACV,QAAA,EAAU,YAAA;AAAA,EACV,OAAA,EAAS,WAAA;AAAA,EACT,OAAA,EAAS,WAAA;AAAA,EACT,IAAA,EAAM,QAAA;AAAA,EACN,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,WAAA;AAAA,EACT,OAAA,EAAS,WAAA;AAAA,EACT,KAAA,EAAO,SAAA;AAAA,EACP,KAAA,EAAO,SAAA;AAAA,EACP,KAAA,EAAO,SAAA;AAAA,EACP,KAAA,EAAO,SAAA;AAAA,EACP,MAAA,EAAQ,UAAA;AAAA,EACR,MAAA,EAAQ,UAAA;AAAA,EACR,QAAA,EAAU,YAAA;AAAA,EACV,QAAA,EAAU,YAAA;AAAA,EACV,QAAA,EAAU,YAAA;AAAA,EACV,QAAA,EAAU,YAAA;AAAA;AAAA,EAGV,IAAA,EAAM,OAAA;AAAA,EACN,IAAA,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B,SAAA,EAAoC;AAC1F,EAAA,MAAM,IAAA,GAAO,sBAAA,CAAuB,OAAA,EAAS,SAAS,CAAA;AACtD,EAAA,MAAM,UAAA,GAAa,YAAY,OAAO,CAAA;AACtC,EAAA,MAAM,OAAA,GAAU,iCAAiC,OAAO,CAAA;AAExD,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["/**\n * Collection name pluralization utilities\n */\n\n/**\n * Special case pluralization rules\n * Maps singular forms to their plural forms\n */\nconst SPECIAL_CASES: Record<string, string> = {\n // Common irregular plurals\n person: \"people\",\n Person: \"People\",\n child: \"children\",\n Child: \"Children\",\n man: \"men\",\n Man: \"Men\",\n woman: \"women\",\n Woman: \"Women\",\n tooth: \"teeth\",\n Tooth: \"Teeth\",\n foot: \"feet\",\n Foot: \"Feet\",\n mouse: \"mice\",\n Mouse: \"Mice\",\n goose: \"geese\",\n Goose: \"Geese\",\n\n // Words ending in -y\n category: \"categories\",\n Category: \"Categories\",\n company: \"companies\",\n Company: \"Companies\",\n city: \"cities\",\n City: \"Cities\",\n country: \"countries\",\n Country: \"Countries\",\n story: \"stories\",\n Story: \"Stories\",\n party: \"parties\",\n Party: \"Parties\",\n family: \"families\",\n Family: \"Families\",\n activity: \"activities\",\n Activity: \"Activities\",\n priority: \"priorities\",\n Priority: \"Priorities\",\n\n // Words ending in -f or -fe\n life: \"lives\",\n Life: \"Lives\",\n wife: \"wives\",\n Wife: \"Wives\",\n knife: \"knives\",\n Knife: \"Knives\",\n leaf: \"leaves\",\n Leaf: \"Leaves\",\n shelf: \"shelves\",\n Shelf: \"Shelves\",\n half: \"halves\",\n Half: \"Halves\",\n\n // Words ending in -is\n analysis: \"analyses\",\n Analysis: \"Analyses\",\n basis: \"bases\",\n Basis: \"Bases\",\n crisis: \"crises\",\n Crisis: \"Crises\",\n thesis: \"theses\",\n Thesis: \"Theses\",\n\n // Words ending in -us\n cactus: \"cacti\",\n Cactus: \"Cacti\",\n focus: \"foci\",\n Focus: \"Foci\",\n fungus: \"fungi\",\n Fungus: \"Fungi\",\n nucleus: \"nuclei\",\n Nucleus: \"Nuclei\",\n radius: \"radii\",\n Radius: \"Radii\",\n\n // Words ending in -on\n phenomenon: \"phenomena\",\n Phenomenon: \"Phenomena\",\n criterion: \"criteria\",\n Criterion: \"Criteria\",\n\n // Words ending in -um\n datum: \"data\",\n Datum: \"Data\",\n medium: \"media\",\n Medium: \"Media\",\n curriculum: \"curricula\",\n Curriculum: \"Curricula\",\n\n // Unchanged plurals\n sheep: \"sheep\",\n Sheep: \"Sheep\",\n deer: \"deer\",\n Deer: \"Deer\",\n fish: \"fish\",\n Fish: \"Fish\",\n species: \"species\",\n Species: \"Species\",\n series: \"series\",\n Series: \"Series\",\n};\n\n/**\n * Pluralizes a singular noun to its plural form\n * Handles special cases and common English pluralization rules\n *\n * @param singular - The singular form of the noun\n * @returns The plural form of the noun\n */\nexport function pluralize(singular: string): string {\n // Check special cases first (before checking if already plural)\n if (SPECIAL_CASES[singular]) {\n return SPECIAL_CASES[singular];\n }\n\n // Check if it's already plural (ends with 's' and is longer than 3 chars)\n if (singular.length > 3 && singular.endsWith(\"s\") && !singular.endsWith(\"ss\")) {\n // Could already be plural, return as-is\n return singular;\n }\n\n // Preserve case for the transformation\n const lowerSingular = singular.toLowerCase();\n\n let plural: string;\n\n // Rule 1: Words ending in -s, -ss, -sh, -ch, -x, -z -> add -es\n if (/(?:s|ss|sh|ch|x|z)$/.test(lowerSingular)) {\n plural = singular + \"es\";\n }\n // Rule 2: Words ending in consonant + y -> change y to ies\n else if (/[^aeiou]y$/.test(lowerSingular)) {\n plural = singular.slice(0, -1) + \"ies\";\n }\n // Rule 3: Words ending in consonant + o -> add -es\n else if (/[^aeiou]o$/.test(lowerSingular)) {\n plural = singular + \"es\";\n }\n // Rule 4: Words ending in -f or -fe -> change to -ves\n else if (/fe?$/.test(lowerSingular)) {\n if (lowerSingular.endsWith(\"fe\")) {\n plural = singular.slice(0, -2) + \"ves\";\n } else {\n plural = singular.slice(0, -1) + \"ves\";\n }\n }\n // Rule 5: Default -> add -s\n else {\n plural = singular + \"s\";\n }\n\n return plural;\n}\n\n/**\n * Converts a singular entity name to a collection name\n * This is an alias for pluralize for better semantic clarity\n *\n * @param entityName - The singular entity name (e.g., \"User\", \"Project\")\n * @returns The collection name (e.g., \"Users\", \"Projects\")\n */\nexport function toCollectionName(entityName: string): string {\n return pluralize(entityName);\n}\n\n/**\n * Attempts to singularize a plural noun (reverse of pluralize)\n * Note: This is a best-effort implementation and may not handle all edge cases\n *\n * @param plural - The plural form of the noun\n * @returns The singular form of the noun\n */\nexport function singularize(plural: string): string {\n // Check reverse special cases\n for (const [singular, pluralForm] of Object.entries(SPECIAL_CASES)) {\n if (pluralForm === plural) {\n return singular;\n }\n }\n\n const lower = plural.toLowerCase();\n\n // Rule 1: Words ending in -ies -> change to -y\n if (lower.endsWith(\"ies\") && plural.length > 3) {\n return plural.slice(0, -3) + \"y\";\n }\n\n // Rule 2: Words ending in -ves -> change to -f or -fe\n if (lower.endsWith(\"ves\")) {\n // Try -fe first (more common)\n return plural.slice(0, -3) + \"fe\";\n }\n\n // Rule 3: Words ending in -ses, -shes, -ches, -xes, -zes -> remove -es\n if (/(?:ses|shes|ches|xes|zes)$/.test(lower)) {\n return plural.slice(0, -2);\n }\n\n // Rule 4: Words ending in -s -> remove -s\n if (lower.endsWith(\"s\") && plural.length > 1) {\n return plural.slice(0, -1);\n }\n\n // Default: return as-is\n return plural;\n}\n","/**\n * Relation field detection utilities\n */\n\nimport { z } from \"zod\";\nimport { pluralize } from \"./pluralize\";\n\n/**\n * Detects if a field is a single relation based on naming convention\n * Single relation: field name matches a collection name (e.g., \"User\" -> \"Users\" collection)\n */\nexport function isSingleRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean {\n // Unwrap optional/nullable/default\n let unwrappedType = zodType;\n if (zodType instanceof z.ZodOptional) {\n unwrappedType = zodType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodNullable) {\n unwrappedType = unwrappedType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodDefault) {\n unwrappedType = unwrappedType._def.innerType;\n }\n\n // Must be a string type\n if (!(unwrappedType instanceof z.ZodString)) {\n return false;\n }\n\n // Field name should start with uppercase (convention for entity references)\n // and not be a common string field name\n const startsWithUppercase = /^[A-Z]/.test(fieldName);\n\n // Exclude common string fields that start with uppercase\n const commonStringFields = [\"Title\", \"Name\", \"Description\", \"Content\", \"Summary\", \"Status\", \"Type\"];\n const isCommonField = commonStringFields.includes(fieldName);\n\n return startsWithUppercase && !isCommonField;\n}\n\n/**\n * Detects if a field is a multiple relation based on naming convention\n * Multiple relation: field name is an array of strings ending with entity name\n * (e.g., \"SubscriberUsers\" -> \"Users\" collection)\n */\nexport function isMultipleRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean {\n // Unwrap optional/nullable/default\n let unwrappedType = zodType;\n if (zodType instanceof z.ZodOptional) {\n unwrappedType = zodType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodNullable) {\n unwrappedType = unwrappedType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodDefault) {\n unwrappedType = unwrappedType._def.innerType;\n }\n\n // Must be an array type\n if (!(unwrappedType instanceof z.ZodArray)) {\n return false;\n }\n\n // Element type must be string\n const elementType = unwrappedType._def.type;\n if (!(elementType instanceof z.ZodString)) {\n return false;\n }\n\n // Field name should contain an uppercase letter (entity reference pattern)\n const hasUppercase = /[A-Z]/.test(fieldName);\n\n return hasUppercase;\n}\n\n/**\n * Resolves the target collection name from a relation field name\n * Examples:\n * - \"User\" -> \"Users\"\n * - \"SubscriberUsers\" -> \"Users\"\n * - \"Author\" -> \"Authors\"\n * - \"Category\" -> \"Categories\"\n */\nexport function resolveTargetCollection(fieldName: string): string {\n // For single relations, the field name is typically the entity name\n // For multiple relations, extract the entity name from the end\n\n // Check if field name ends with a known plural entity name\n // Common patterns: \"SubscriberUsers\", \"RelatedPosts\", \"Tags\"\n\n // Try to find the entity name by looking for uppercase letters\n const matches = fieldName.match(/[A-Z][a-z]+/g);\n\n if (!matches || matches.length === 0) {\n // Fallback: pluralize the entire field name\n return pluralize(fieldName);\n }\n\n // Take the last matched entity name (e.g., \"Users\" from \"SubscriberUsers\")\n const entityName = matches[matches.length - 1];\n\n // Pluralize the entity name to get collection name\n return pluralize(entityName);\n}\n\n/**\n * Detects if a field is any type of relation (single or multiple)\n */\nexport function isRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean {\n return isSingleRelationField(fieldName, zodType) || isMultipleRelationField(fieldName, zodType);\n}\n\n/**\n * Gets the maximum number of relations allowed for a relation field\n * Returns 1 for single relations, or the max constraint for multiple relations\n */\nexport function getMaxSelect(fieldName: string, zodType: z.ZodTypeAny): number {\n if (isSingleRelationField(fieldName, zodType)) {\n return 1;\n }\n\n if (isMultipleRelationField(fieldName, zodType)) {\n // Unwrap to get to the array type\n let unwrappedType = zodType;\n if (zodType instanceof z.ZodOptional) {\n unwrappedType = zodType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodNullable) {\n unwrappedType = unwrappedType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodDefault) {\n unwrappedType = unwrappedType._def.innerType;\n }\n\n if (unwrappedType instanceof z.ZodArray) {\n // Access the checks array from the array definition\n const arrayDef = unwrappedType._def;\n if (arrayDef.maxLength) {\n return arrayDef.maxLength.value;\n }\n // Default to 999 for multiple relations without explicit max\n return 999;\n }\n }\n\n return 1;\n}\n\n/**\n * Gets the minimum number of relations required for a relation field\n */\nexport function getMinSelect(fieldName: string, zodType: z.ZodTypeAny): number | undefined {\n if (!isMultipleRelationField(fieldName, zodType)) {\n return undefined;\n }\n\n // Unwrap to get to the array type\n let unwrappedType = zodType;\n if (zodType instanceof z.ZodOptional) {\n unwrappedType = zodType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodNullable) {\n unwrappedType = unwrappedType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodDefault) {\n unwrappedType = unwrappedType._def.innerType;\n }\n\n if (unwrappedType instanceof z.ZodArray) {\n // Access the minLength from the array definition\n const arrayDef = unwrappedType._def;\n if (arrayDef.minLength) {\n return arrayDef.minLength.value;\n }\n }\n\n return undefined;\n}\n","/**\n * Zod to PocketBase type mapping utilities\n *\n * This module provides comprehensive mapping between Zod schema types\n * and PocketBase field types, including support for all PocketBase field types:\n * - text, email, url, editor\n * - number, bool\n * - date, autodate\n * - select (single/multiple)\n * - relation (single/multiple)\n * - file (single/multiple)\n * - json\n * - geoPoint\n */\n\nimport { z } from \"zod\";\nimport type { PocketBaseFieldType } from \"../types\";\n\n/**\n * All supported PocketBase field types\n */\nexport const POCKETBASE_FIELD_TYPES: readonly PocketBaseFieldType[] = [\n \"text\",\n \"email\",\n \"url\",\n \"number\",\n \"bool\",\n \"date\",\n \"select\",\n \"relation\",\n \"file\",\n \"json\",\n \"editor\",\n \"geoPoint\",\n \"autodate\",\n] as const;\n\n/**\n * Field type metadata for documentation and validation\n */\nexport interface FieldTypeInfo {\n type: PocketBaseFieldType;\n description: string;\n zodTypes: string[];\n supportsMultiple: boolean;\n}\n\n/**\n * Metadata about each PocketBase field type\n */\nexport const FIELD_TYPE_INFO: Record<PocketBaseFieldType, FieldTypeInfo> = {\n text: {\n type: \"text\",\n description: \"Plain text field\",\n zodTypes: [\"ZodString\"],\n supportsMultiple: false,\n },\n email: {\n type: \"email\",\n description: \"Email address field with validation\",\n zodTypes: [\"ZodString with email()\"],\n supportsMultiple: false,\n },\n url: {\n type: \"url\",\n description: \"URL field with validation\",\n zodTypes: [\"ZodString with url()\"],\n supportsMultiple: false,\n },\n editor: {\n type: \"editor\",\n description: \"Rich text editor field\",\n zodTypes: [\"ZodString\"],\n supportsMultiple: false,\n },\n number: {\n type: \"number\",\n description: \"Numeric field (integer or float)\",\n zodTypes: [\"ZodNumber\"],\n supportsMultiple: false,\n },\n bool: {\n type: \"bool\",\n description: \"Boolean field\",\n zodTypes: [\"ZodBoolean\"],\n supportsMultiple: false,\n },\n date: {\n type: \"date\",\n description: \"Date/datetime field\",\n zodTypes: [\"ZodDate\", \"ZodString with datetime format\"],\n supportsMultiple: false,\n },\n autodate: {\n type: \"autodate\",\n description: \"Auto-managed date field (created/updated)\",\n zodTypes: [\"ZodString\"],\n supportsMultiple: false,\n },\n select: {\n type: \"select\",\n description: \"Single or multiple select from predefined values\",\n zodTypes: [\"ZodEnum\", \"ZodArray<ZodEnum>\"],\n supportsMultiple: true,\n },\n relation: {\n type: \"relation\",\n description: \"Reference to another collection\",\n zodTypes: [\"ZodString\", \"ZodArray<ZodString>\"],\n supportsMultiple: true,\n },\n file: {\n type: \"file\",\n description: \"File upload field\",\n zodTypes: [\"File\", \"ZodArray<File>\"],\n supportsMultiple: true,\n },\n json: {\n type: \"json\",\n description: \"JSON data field\",\n zodTypes: [\"ZodRecord\", \"ZodObject\", \"ZodArray\"],\n supportsMultiple: false,\n },\n geoPoint: {\n type: \"geoPoint\",\n description: \"Geographic coordinates (lon, lat)\",\n zodTypes: [\"ZodObject with lon/lat\"],\n supportsMultiple: false,\n },\n};\n\n/**\n * Maps Zod string types to PocketBase field types\n */\nexport function mapZodStringType(zodType: z.ZodString): PocketBaseFieldType {\n const checks = (zodType as any)._def.checks || [];\n\n // Check for email validation\n const hasEmail = checks.some((check: any) => check.kind === \"email\");\n if (hasEmail) {\n return \"email\";\n }\n\n // Check for URL validation\n const hasUrl = checks.some((check: any) => check.kind === \"url\");\n if (hasUrl) {\n return \"url\";\n }\n\n // Check for datetime validation (could be date field)\n const hasDatetime = checks.some((check: any) => check.kind === \"datetime\");\n if (hasDatetime) {\n return \"date\";\n }\n\n // Default to text\n return \"text\";\n}\n\n/**\n * Maps Zod number types to PocketBase number type\n */\nexport function mapZodNumberType(_zodType: z.ZodNumber): PocketBaseFieldType {\n return \"number\";\n}\n\n/**\n * Maps Zod boolean types to PocketBase bool type\n */\nexport function mapZodBooleanType(_zodType: z.ZodBoolean): PocketBaseFieldType {\n return \"bool\";\n}\n\n/**\n * Maps Zod enum types to PocketBase select type\n */\nexport function mapZodEnumType(_zodType: z.ZodEnum<any>): PocketBaseFieldType {\n return \"select\";\n}\n\n/**\n * Maps Zod array types to appropriate PocketBase types\n * Arrays of strings could be relations or file fields depending on context\n */\nexport function mapZodArrayType(zodType: z.ZodArray<any>, _fieldName: string): PocketBaseFieldType {\n const elementType = zodType._def.type;\n\n // Check if it's an array of File instances (file upload)\n if (elementType instanceof z.ZodType) {\n const typeName = elementType._def.typeName;\n if (typeName === \"ZodType\" && (elementType as any)._def?.innerType?.name === \"File\") {\n return \"file\";\n }\n }\n\n // Check for instanceof File\n if (elementType._def?.typeName === \"ZodType\") {\n const checks = (elementType as any)._def?.checks || [];\n const isFileInstance = checks.some(\n (check: any) => check.kind === \"instanceof\" || (elementType as any)._def?.innerType?.name === \"File\"\n );\n if (isFileInstance) {\n return \"file\";\n }\n }\n\n // Array of strings - could be relation (will be determined by relation detector)\n if (elementType instanceof z.ZodString) {\n return \"relation\";\n }\n\n // Default to JSON for other array types\n return \"json\";\n}\n\n/**\n * Maps Zod date types to PocketBase date type\n */\nexport function mapZodDateType(_zodType: z.ZodDate): PocketBaseFieldType {\n return \"date\";\n}\n\n/**\n * Maps Zod record/object types to PocketBase JSON type\n */\nexport function mapZodRecordType(_zodType: z.ZodRecord | z.ZodObject<any>): PocketBaseFieldType {\n return \"json\";\n}\n\n/**\n * Main type mapping function that determines PocketBase field type from Zod type\n */\nexport function mapZodTypeToPocketBase(zodType: z.ZodTypeAny, fieldName: string): PocketBaseFieldType {\n // Handle optional and nullable types by unwrapping\n let unwrappedType = zodType;\n\n if (zodType instanceof z.ZodOptional) {\n unwrappedType = zodType._def.innerType;\n }\n\n if (unwrappedType instanceof z.ZodNullable) {\n unwrappedType = unwrappedType._def.innerType;\n }\n\n if (unwrappedType instanceof z.ZodDefault) {\n unwrappedType = unwrappedType._def.innerType;\n }\n\n // Check for ZodEffects (which is what z.instanceof() creates)\n if ((unwrappedType as any)._def?.typeName === \"ZodEffects\") {\n const effect = (unwrappedType as any)._def?.effect;\n\n // z.instanceof(File) creates a refinement effect\n // We need to check if this is a File instance check\n // The field name 'avatar', 'image', 'file', 'attachment' etc. are hints\n if (effect?.type === \"refinement\") {\n // Common file field names\n const fileFieldNames = [\"avatar\", \"image\", \"file\", \"attachment\", \"photo\", \"picture\", \"document\", \"upload\"];\n if (fileFieldNames.some((name) => fieldName.toLowerCase().includes(name))) {\n return \"file\";\n }\n }\n }\n\n // Check for instanceof File (z.instanceof(File)) - legacy check\n if ((unwrappedType as any)._def?.typeName === \"ZodType\") {\n const checks = (unwrappedType as any)._def?.checks || [];\n const innerType = (unwrappedType as any)._def?.innerType;\n\n // Check if it's instanceof File\n if (innerType?.name === \"File\" || checks.some((check: any) => check.kind === \"instanceof\")) {\n return \"file\";\n }\n }\n\n // Map based on Zod type\n if (unwrappedType instanceof z.ZodString) {\n return mapZodStringType(unwrappedType);\n }\n\n if (unwrappedType instanceof z.ZodNumber) {\n return mapZodNumberType(unwrappedType);\n }\n\n if (unwrappedType instanceof z.ZodBoolean) {\n return mapZodBooleanType(unwrappedType);\n }\n\n if (unwrappedType instanceof z.ZodEnum) {\n return mapZodEnumType(unwrappedType);\n }\n\n if (unwrappedType instanceof z.ZodArray) {\n return mapZodArrayType(unwrappedType, fieldName);\n }\n\n if (unwrappedType instanceof z.ZodDate) {\n return mapZodDateType(unwrappedType);\n }\n\n if (unwrappedType instanceof z.ZodRecord || unwrappedType instanceof z.ZodObject) {\n return mapZodRecordType(unwrappedType);\n }\n\n // Default to text for unknown types\n return \"text\";\n}\n\n/**\n * Extracts field options from Zod type (min, max, pattern, etc.)\n */\nexport function extractFieldOptions(zodType: z.ZodTypeAny): Record<string, any> {\n const options: Record<string, any> = {};\n\n // Unwrap optional/nullable/default\n let unwrappedType = zodType;\n if (zodType instanceof z.ZodOptional) {\n unwrappedType = zodType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodNullable) {\n unwrappedType = unwrappedType._def.innerType;\n }\n if (unwrappedType instanceof z.ZodDefault) {\n unwrappedType = unwrappedType._def.innerType;\n }\n\n const checks = (unwrappedType as any)._def?.checks || [];\n\n // Extract string constraints\n if (unwrappedType instanceof z.ZodString) {\n for (const check of checks) {\n if (check.kind === \"min\") {\n options.min = check.value;\n }\n if (check.kind === \"max\") {\n options.max = check.value;\n }\n if (check.kind === \"regex\") {\n options.pattern = check.regex.source;\n }\n }\n }\n\n // Extract number constraints\n if (unwrappedType instanceof z.ZodNumber) {\n for (const check of checks) {\n if (check.kind === \"min\") {\n options.min = check.value;\n }\n if (check.kind === \"max\") {\n options.max = check.value;\n }\n }\n }\n\n // Extract enum values\n if (unwrappedType instanceof z.ZodEnum) {\n options.values = unwrappedType._def.values;\n }\n\n // Extract array constraints\n if (unwrappedType instanceof z.ZodArray) {\n const arrayChecks = (unwrappedType as any)._def?.checks || [];\n for (const check of arrayChecks) {\n if (check.kind === \"min\") {\n options.minSelect = check.value;\n }\n if (check.kind === \"max\") {\n options.maxSelect = check.value;\n }\n }\n }\n\n return options;\n}\n\n/**\n * Determines if a Zod field is required (not optional)\n */\nexport function isFieldRequired(zodType: z.ZodTypeAny): boolean {\n // Check if it's optional\n if (zodType instanceof z.ZodOptional) {\n return false;\n }\n\n // Check if it has a default value (makes it optional)\n if (zodType instanceof z.ZodDefault) {\n return false;\n }\n\n // Check for nullable (in PocketBase context, nullable means optional)\n if (zodType instanceof z.ZodNullable) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Unwraps a Zod type to get the inner type\n * Handles optional, nullable, and default wrappers\n */\nexport function unwrapZodType(zodType: z.ZodTypeAny): z.ZodTypeAny {\n let unwrapped = zodType;\n\n if (unwrapped instanceof z.ZodOptional) {\n unwrapped = unwrapped._def.innerType;\n }\n\n if (unwrapped instanceof z.ZodNullable) {\n unwrapped = unwrapped._def.innerType;\n }\n\n if (unwrapped instanceof z.ZodDefault) {\n unwrapped = unwrapped._def.innerType;\n }\n\n return unwrapped;\n}\n\n/**\n * Gets the default value from a Zod type if it has one\n */\nexport function getDefaultValue(zodType: z.ZodTypeAny): any {\n if (zodType instanceof z.ZodDefault) {\n return zodType._def.defaultValue();\n }\n return undefined;\n}\n\n/**\n * Checks if a Zod type is an array type\n */\nexport function isArrayType(zodType: z.ZodTypeAny): boolean {\n const unwrapped = unwrapZodType(zodType);\n return unwrapped instanceof z.ZodArray;\n}\n\n/**\n * Gets the element type of an array Zod type\n */\nexport function getArrayElementType(zodType: z.ZodTypeAny): z.ZodTypeAny | null {\n const unwrapped = unwrapZodType(zodType);\n if (unwrapped instanceof z.ZodArray) {\n return unwrapped._def.type;\n }\n return null;\n}\n\n/**\n * Checks if a Zod type represents a geo point (object with lon/lat)\n */\nexport function isGeoPointType(zodType: z.ZodTypeAny): boolean {\n const unwrapped = unwrapZodType(zodType);\n if (!(unwrapped instanceof z.ZodObject)) {\n return false;\n }\n\n const shape = unwrapped._def.shape();\n const hasLon = \"lon\" in shape && shape.lon instanceof z.ZodNumber;\n const hasLat = \"lat\" in shape && shape.lat instanceof z.ZodNumber;\n\n return hasLon && hasLat;\n}\n\n/**\n * Complete field options extracted from a Zod type\n */\nexport interface ExtractedFieldOptions {\n min?: number;\n max?: number;\n pattern?: string;\n values?: string[];\n minSelect?: number;\n maxSelect?: number;\n mimeTypes?: string[];\n maxSize?: number;\n thumbs?: string[];\n}\n\n/**\n * Extracts comprehensive field options from Zod type\n * Includes all constraints that can be mapped to PocketBase field options\n */\nexport function extractComprehensiveFieldOptions(zodType: z.ZodTypeAny): ExtractedFieldOptions {\n const options: ExtractedFieldOptions = {};\n const unwrapped = unwrapZodType(zodType);\n const checks = (unwrapped as any)._def?.checks || [];\n\n // Extract string constraints\n if (unwrapped instanceof z.ZodString) {\n for (const check of checks) {\n if (check.kind === \"min\") {\n options.min = check.value;\n }\n if (check.kind === \"max\") {\n options.max = check.value;\n }\n if (check.kind === \"regex\") {\n options.pattern = check.regex.source;\n }\n }\n }\n\n // Extract number constraints\n if (unwrapped instanceof z.ZodNumber) {\n for (const check of checks) {\n if (check.kind === \"min\") {\n options.min = check.value;\n }\n if (check.kind === \"max\") {\n options.max = check.value;\n }\n }\n }\n\n // Extract enum values\n if (unwrapped instanceof z.ZodEnum) {\n options.values = unwrapped._def.values;\n }\n\n // Extract array constraints\n if (unwrapped instanceof z.ZodArray) {\n const arrayDef = unwrapped._def;\n if (arrayDef.minLength) {\n options.minSelect = arrayDef.minLength.value;\n }\n if (arrayDef.maxLength) {\n options.maxSelect = arrayDef.maxLength.value;\n }\n\n // Check for enum element type\n const elementType = arrayDef.type;\n if (elementType instanceof z.ZodEnum) {\n options.values = elementType._def.values;\n }\n }\n\n return options;\n}\n\n/**\n * Determines if a field should be treated as an editor field\n * based on field name conventions\n */\nexport function isEditorField(fieldName: string): boolean {\n const editorFieldNames = [\n \"content\",\n \"body\",\n \"description\",\n \"bio\",\n \"about\",\n \"summary\",\n \"notes\",\n \"details\",\n \"html\",\n \"richtext\",\n \"editor\",\n ];\n return editorFieldNames.some((name) => fieldName.toLowerCase().includes(name));\n}\n\n/**\n * Determines if a field should be treated as a file field\n * based on field name conventions\n */\nexport function isFileFieldByName(fieldName: string): boolean {\n const fileFieldNames = [\n \"avatar\",\n \"image\",\n \"file\",\n \"attachment\",\n \"photo\",\n \"picture\",\n \"document\",\n \"upload\",\n \"thumbnail\",\n \"cover\",\n \"banner\",\n \"logo\",\n \"icon\",\n \"media\",\n ];\n return fileFieldNames.some((name) => fieldName.toLowerCase().includes(name));\n}\n\n/**\n * Gets the PocketBase field type with additional context\n */\nexport interface FieldTypeResult {\n type: PocketBaseFieldType;\n isMultiple: boolean;\n options: ExtractedFieldOptions;\n}\n\n/**\n * Comprehensive type mapping that returns full field information\n */\nexport function getFieldTypeInfo(zodType: z.ZodTypeAny, fieldName: string): FieldTypeResult {\n const type = mapZodTypeToPocketBase(zodType, fieldName);\n const isMultiple = isArrayType(zodType);\n const options = extractComprehensiveFieldOptions(zodType);\n\n return {\n type,\n isMultiple,\n options,\n };\n}\n"]}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { P as PocketBaseFieldType } from '../../types-BbTgmg6H.cjs';
|
|
3
|
+
import '../../permissions-ZHafVSIx.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Collection name pluralization utilities
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Pluralizes a singular noun to its plural form
|
|
10
|
+
* Handles special cases and common English pluralization rules
|
|
11
|
+
*
|
|
12
|
+
* @param singular - The singular form of the noun
|
|
13
|
+
* @returns The plural form of the noun
|
|
14
|
+
*/
|
|
15
|
+
declare function pluralize(singular: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Converts a singular entity name to a collection name
|
|
18
|
+
* This is an alias for pluralize for better semantic clarity
|
|
19
|
+
*
|
|
20
|
+
* @param entityName - The singular entity name (e.g., "User", "Project")
|
|
21
|
+
* @returns The collection name (e.g., "Users", "Projects")
|
|
22
|
+
*/
|
|
23
|
+
declare function toCollectionName(entityName: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Attempts to singularize a plural noun (reverse of pluralize)
|
|
26
|
+
* Note: This is a best-effort implementation and may not handle all edge cases
|
|
27
|
+
*
|
|
28
|
+
* @param plural - The plural form of the noun
|
|
29
|
+
* @returns The singular form of the noun
|
|
30
|
+
*/
|
|
31
|
+
declare function singularize(plural: string): string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Relation field detection utilities
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Detects if a field is a single relation based on naming convention
|
|
39
|
+
* Single relation: field name matches a collection name (e.g., "User" -> "Users" collection)
|
|
40
|
+
*/
|
|
41
|
+
declare function isSingleRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Detects if a field is a multiple relation based on naming convention
|
|
44
|
+
* Multiple relation: field name is an array of strings ending with entity name
|
|
45
|
+
* (e.g., "SubscriberUsers" -> "Users" collection)
|
|
46
|
+
*/
|
|
47
|
+
declare function isMultipleRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Resolves the target collection name from a relation field name
|
|
50
|
+
* Examples:
|
|
51
|
+
* - "User" -> "Users"
|
|
52
|
+
* - "SubscriberUsers" -> "Users"
|
|
53
|
+
* - "Author" -> "Authors"
|
|
54
|
+
* - "Category" -> "Categories"
|
|
55
|
+
*/
|
|
56
|
+
declare function resolveTargetCollection(fieldName: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Detects if a field is any type of relation (single or multiple)
|
|
59
|
+
*/
|
|
60
|
+
declare function isRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Gets the maximum number of relations allowed for a relation field
|
|
63
|
+
* Returns 1 for single relations, or the max constraint for multiple relations
|
|
64
|
+
*/
|
|
65
|
+
declare function getMaxSelect(fieldName: string, zodType: z.ZodTypeAny): number;
|
|
66
|
+
/**
|
|
67
|
+
* Gets the minimum number of relations required for a relation field
|
|
68
|
+
*/
|
|
69
|
+
declare function getMinSelect(fieldName: string, zodType: z.ZodTypeAny): number | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Zod to PocketBase type mapping utilities
|
|
73
|
+
*
|
|
74
|
+
* This module provides comprehensive mapping between Zod schema types
|
|
75
|
+
* and PocketBase field types, including support for all PocketBase field types:
|
|
76
|
+
* - text, email, url, editor
|
|
77
|
+
* - number, bool
|
|
78
|
+
* - date, autodate
|
|
79
|
+
* - select (single/multiple)
|
|
80
|
+
* - relation (single/multiple)
|
|
81
|
+
* - file (single/multiple)
|
|
82
|
+
* - json
|
|
83
|
+
* - geoPoint
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* All supported PocketBase field types
|
|
88
|
+
*/
|
|
89
|
+
declare const POCKETBASE_FIELD_TYPES: readonly PocketBaseFieldType[];
|
|
90
|
+
/**
|
|
91
|
+
* Field type metadata for documentation and validation
|
|
92
|
+
*/
|
|
93
|
+
interface FieldTypeInfo {
|
|
94
|
+
type: PocketBaseFieldType;
|
|
95
|
+
description: string;
|
|
96
|
+
zodTypes: string[];
|
|
97
|
+
supportsMultiple: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Metadata about each PocketBase field type
|
|
101
|
+
*/
|
|
102
|
+
declare const FIELD_TYPE_INFO: Record<PocketBaseFieldType, FieldTypeInfo>;
|
|
103
|
+
/**
|
|
104
|
+
* Maps Zod string types to PocketBase field types
|
|
105
|
+
*/
|
|
106
|
+
declare function mapZodStringType(zodType: z.ZodString): PocketBaseFieldType;
|
|
107
|
+
/**
|
|
108
|
+
* Maps Zod number types to PocketBase number type
|
|
109
|
+
*/
|
|
110
|
+
declare function mapZodNumberType(_zodType: z.ZodNumber): PocketBaseFieldType;
|
|
111
|
+
/**
|
|
112
|
+
* Maps Zod boolean types to PocketBase bool type
|
|
113
|
+
*/
|
|
114
|
+
declare function mapZodBooleanType(_zodType: z.ZodBoolean): PocketBaseFieldType;
|
|
115
|
+
/**
|
|
116
|
+
* Maps Zod enum types to PocketBase select type
|
|
117
|
+
*/
|
|
118
|
+
declare function mapZodEnumType(_zodType: z.ZodEnum<any>): PocketBaseFieldType;
|
|
119
|
+
/**
|
|
120
|
+
* Maps Zod array types to appropriate PocketBase types
|
|
121
|
+
* Arrays of strings could be relations or file fields depending on context
|
|
122
|
+
*/
|
|
123
|
+
declare function mapZodArrayType(zodType: z.ZodArray<any>, _fieldName: string): PocketBaseFieldType;
|
|
124
|
+
/**
|
|
125
|
+
* Maps Zod date types to PocketBase date type
|
|
126
|
+
*/
|
|
127
|
+
declare function mapZodDateType(_zodType: z.ZodDate): PocketBaseFieldType;
|
|
128
|
+
/**
|
|
129
|
+
* Maps Zod record/object types to PocketBase JSON type
|
|
130
|
+
*/
|
|
131
|
+
declare function mapZodRecordType(_zodType: z.ZodRecord | z.ZodObject<any>): PocketBaseFieldType;
|
|
132
|
+
/**
|
|
133
|
+
* Main type mapping function that determines PocketBase field type from Zod type
|
|
134
|
+
*/
|
|
135
|
+
declare function mapZodTypeToPocketBase(zodType: z.ZodTypeAny, fieldName: string): PocketBaseFieldType;
|
|
136
|
+
/**
|
|
137
|
+
* Extracts field options from Zod type (min, max, pattern, etc.)
|
|
138
|
+
*/
|
|
139
|
+
declare function extractFieldOptions(zodType: z.ZodTypeAny): Record<string, any>;
|
|
140
|
+
/**
|
|
141
|
+
* Determines if a Zod field is required (not optional)
|
|
142
|
+
*/
|
|
143
|
+
declare function isFieldRequired(zodType: z.ZodTypeAny): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Unwraps a Zod type to get the inner type
|
|
146
|
+
* Handles optional, nullable, and default wrappers
|
|
147
|
+
*/
|
|
148
|
+
declare function unwrapZodType(zodType: z.ZodTypeAny): z.ZodTypeAny;
|
|
149
|
+
/**
|
|
150
|
+
* Gets the default value from a Zod type if it has one
|
|
151
|
+
*/
|
|
152
|
+
declare function getDefaultValue(zodType: z.ZodTypeAny): any;
|
|
153
|
+
/**
|
|
154
|
+
* Checks if a Zod type is an array type
|
|
155
|
+
*/
|
|
156
|
+
declare function isArrayType(zodType: z.ZodTypeAny): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Gets the element type of an array Zod type
|
|
159
|
+
*/
|
|
160
|
+
declare function getArrayElementType(zodType: z.ZodTypeAny): z.ZodTypeAny | null;
|
|
161
|
+
/**
|
|
162
|
+
* Checks if a Zod type represents a geo point (object with lon/lat)
|
|
163
|
+
*/
|
|
164
|
+
declare function isGeoPointType(zodType: z.ZodTypeAny): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Complete field options extracted from a Zod type
|
|
167
|
+
*/
|
|
168
|
+
interface ExtractedFieldOptions {
|
|
169
|
+
min?: number;
|
|
170
|
+
max?: number;
|
|
171
|
+
pattern?: string;
|
|
172
|
+
values?: string[];
|
|
173
|
+
minSelect?: number;
|
|
174
|
+
maxSelect?: number;
|
|
175
|
+
mimeTypes?: string[];
|
|
176
|
+
maxSize?: number;
|
|
177
|
+
thumbs?: string[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Extracts comprehensive field options from Zod type
|
|
181
|
+
* Includes all constraints that can be mapped to PocketBase field options
|
|
182
|
+
*/
|
|
183
|
+
declare function extractComprehensiveFieldOptions(zodType: z.ZodTypeAny): ExtractedFieldOptions;
|
|
184
|
+
/**
|
|
185
|
+
* Determines if a field should be treated as an editor field
|
|
186
|
+
* based on field name conventions
|
|
187
|
+
*/
|
|
188
|
+
declare function isEditorField(fieldName: string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Determines if a field should be treated as a file field
|
|
191
|
+
* based on field name conventions
|
|
192
|
+
*/
|
|
193
|
+
declare function isFileFieldByName(fieldName: string): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Gets the PocketBase field type with additional context
|
|
196
|
+
*/
|
|
197
|
+
interface FieldTypeResult {
|
|
198
|
+
type: PocketBaseFieldType;
|
|
199
|
+
isMultiple: boolean;
|
|
200
|
+
options: ExtractedFieldOptions;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Comprehensive type mapping that returns full field information
|
|
204
|
+
*/
|
|
205
|
+
declare function getFieldTypeInfo(zodType: z.ZodTypeAny, fieldName: string): FieldTypeResult;
|
|
206
|
+
|
|
207
|
+
export { type ExtractedFieldOptions, FIELD_TYPE_INFO, type FieldTypeInfo, type FieldTypeResult, POCKETBASE_FIELD_TYPES, extractComprehensiveFieldOptions, extractFieldOptions, getArrayElementType, getDefaultValue, getFieldTypeInfo, getMaxSelect, getMinSelect, isArrayType, isEditorField, isFieldRequired, isFileFieldByName, isGeoPointType, isMultipleRelationField, isRelationField, isSingleRelationField, mapZodArrayType, mapZodBooleanType, mapZodDateType, mapZodEnumType, mapZodNumberType, mapZodRecordType, mapZodStringType, mapZodTypeToPocketBase, pluralize, resolveTargetCollection, singularize, toCollectionName, unwrapZodType };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { P as PocketBaseFieldType } from '../../types-z1Dkjg8m.js';
|
|
3
|
+
import '../../permissions-ZHafVSIx.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Collection name pluralization utilities
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Pluralizes a singular noun to its plural form
|
|
10
|
+
* Handles special cases and common English pluralization rules
|
|
11
|
+
*
|
|
12
|
+
* @param singular - The singular form of the noun
|
|
13
|
+
* @returns The plural form of the noun
|
|
14
|
+
*/
|
|
15
|
+
declare function pluralize(singular: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Converts a singular entity name to a collection name
|
|
18
|
+
* This is an alias for pluralize for better semantic clarity
|
|
19
|
+
*
|
|
20
|
+
* @param entityName - The singular entity name (e.g., "User", "Project")
|
|
21
|
+
* @returns The collection name (e.g., "Users", "Projects")
|
|
22
|
+
*/
|
|
23
|
+
declare function toCollectionName(entityName: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Attempts to singularize a plural noun (reverse of pluralize)
|
|
26
|
+
* Note: This is a best-effort implementation and may not handle all edge cases
|
|
27
|
+
*
|
|
28
|
+
* @param plural - The plural form of the noun
|
|
29
|
+
* @returns The singular form of the noun
|
|
30
|
+
*/
|
|
31
|
+
declare function singularize(plural: string): string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Relation field detection utilities
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Detects if a field is a single relation based on naming convention
|
|
39
|
+
* Single relation: field name matches a collection name (e.g., "User" -> "Users" collection)
|
|
40
|
+
*/
|
|
41
|
+
declare function isSingleRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Detects if a field is a multiple relation based on naming convention
|
|
44
|
+
* Multiple relation: field name is an array of strings ending with entity name
|
|
45
|
+
* (e.g., "SubscriberUsers" -> "Users" collection)
|
|
46
|
+
*/
|
|
47
|
+
declare function isMultipleRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Resolves the target collection name from a relation field name
|
|
50
|
+
* Examples:
|
|
51
|
+
* - "User" -> "Users"
|
|
52
|
+
* - "SubscriberUsers" -> "Users"
|
|
53
|
+
* - "Author" -> "Authors"
|
|
54
|
+
* - "Category" -> "Categories"
|
|
55
|
+
*/
|
|
56
|
+
declare function resolveTargetCollection(fieldName: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Detects if a field is any type of relation (single or multiple)
|
|
59
|
+
*/
|
|
60
|
+
declare function isRelationField(fieldName: string, zodType: z.ZodTypeAny): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Gets the maximum number of relations allowed for a relation field
|
|
63
|
+
* Returns 1 for single relations, or the max constraint for multiple relations
|
|
64
|
+
*/
|
|
65
|
+
declare function getMaxSelect(fieldName: string, zodType: z.ZodTypeAny): number;
|
|
66
|
+
/**
|
|
67
|
+
* Gets the minimum number of relations required for a relation field
|
|
68
|
+
*/
|
|
69
|
+
declare function getMinSelect(fieldName: string, zodType: z.ZodTypeAny): number | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Zod to PocketBase type mapping utilities
|
|
73
|
+
*
|
|
74
|
+
* This module provides comprehensive mapping between Zod schema types
|
|
75
|
+
* and PocketBase field types, including support for all PocketBase field types:
|
|
76
|
+
* - text, email, url, editor
|
|
77
|
+
* - number, bool
|
|
78
|
+
* - date, autodate
|
|
79
|
+
* - select (single/multiple)
|
|
80
|
+
* - relation (single/multiple)
|
|
81
|
+
* - file (single/multiple)
|
|
82
|
+
* - json
|
|
83
|
+
* - geoPoint
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* All supported PocketBase field types
|
|
88
|
+
*/
|
|
89
|
+
declare const POCKETBASE_FIELD_TYPES: readonly PocketBaseFieldType[];
|
|
90
|
+
/**
|
|
91
|
+
* Field type metadata for documentation and validation
|
|
92
|
+
*/
|
|
93
|
+
interface FieldTypeInfo {
|
|
94
|
+
type: PocketBaseFieldType;
|
|
95
|
+
description: string;
|
|
96
|
+
zodTypes: string[];
|
|
97
|
+
supportsMultiple: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Metadata about each PocketBase field type
|
|
101
|
+
*/
|
|
102
|
+
declare const FIELD_TYPE_INFO: Record<PocketBaseFieldType, FieldTypeInfo>;
|
|
103
|
+
/**
|
|
104
|
+
* Maps Zod string types to PocketBase field types
|
|
105
|
+
*/
|
|
106
|
+
declare function mapZodStringType(zodType: z.ZodString): PocketBaseFieldType;
|
|
107
|
+
/**
|
|
108
|
+
* Maps Zod number types to PocketBase number type
|
|
109
|
+
*/
|
|
110
|
+
declare function mapZodNumberType(_zodType: z.ZodNumber): PocketBaseFieldType;
|
|
111
|
+
/**
|
|
112
|
+
* Maps Zod boolean types to PocketBase bool type
|
|
113
|
+
*/
|
|
114
|
+
declare function mapZodBooleanType(_zodType: z.ZodBoolean): PocketBaseFieldType;
|
|
115
|
+
/**
|
|
116
|
+
* Maps Zod enum types to PocketBase select type
|
|
117
|
+
*/
|
|
118
|
+
declare function mapZodEnumType(_zodType: z.ZodEnum<any>): PocketBaseFieldType;
|
|
119
|
+
/**
|
|
120
|
+
* Maps Zod array types to appropriate PocketBase types
|
|
121
|
+
* Arrays of strings could be relations or file fields depending on context
|
|
122
|
+
*/
|
|
123
|
+
declare function mapZodArrayType(zodType: z.ZodArray<any>, _fieldName: string): PocketBaseFieldType;
|
|
124
|
+
/**
|
|
125
|
+
* Maps Zod date types to PocketBase date type
|
|
126
|
+
*/
|
|
127
|
+
declare function mapZodDateType(_zodType: z.ZodDate): PocketBaseFieldType;
|
|
128
|
+
/**
|
|
129
|
+
* Maps Zod record/object types to PocketBase JSON type
|
|
130
|
+
*/
|
|
131
|
+
declare function mapZodRecordType(_zodType: z.ZodRecord | z.ZodObject<any>): PocketBaseFieldType;
|
|
132
|
+
/**
|
|
133
|
+
* Main type mapping function that determines PocketBase field type from Zod type
|
|
134
|
+
*/
|
|
135
|
+
declare function mapZodTypeToPocketBase(zodType: z.ZodTypeAny, fieldName: string): PocketBaseFieldType;
|
|
136
|
+
/**
|
|
137
|
+
* Extracts field options from Zod type (min, max, pattern, etc.)
|
|
138
|
+
*/
|
|
139
|
+
declare function extractFieldOptions(zodType: z.ZodTypeAny): Record<string, any>;
|
|
140
|
+
/**
|
|
141
|
+
* Determines if a Zod field is required (not optional)
|
|
142
|
+
*/
|
|
143
|
+
declare function isFieldRequired(zodType: z.ZodTypeAny): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Unwraps a Zod type to get the inner type
|
|
146
|
+
* Handles optional, nullable, and default wrappers
|
|
147
|
+
*/
|
|
148
|
+
declare function unwrapZodType(zodType: z.ZodTypeAny): z.ZodTypeAny;
|
|
149
|
+
/**
|
|
150
|
+
* Gets the default value from a Zod type if it has one
|
|
151
|
+
*/
|
|
152
|
+
declare function getDefaultValue(zodType: z.ZodTypeAny): any;
|
|
153
|
+
/**
|
|
154
|
+
* Checks if a Zod type is an array type
|
|
155
|
+
*/
|
|
156
|
+
declare function isArrayType(zodType: z.ZodTypeAny): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Gets the element type of an array Zod type
|
|
159
|
+
*/
|
|
160
|
+
declare function getArrayElementType(zodType: z.ZodTypeAny): z.ZodTypeAny | null;
|
|
161
|
+
/**
|
|
162
|
+
* Checks if a Zod type represents a geo point (object with lon/lat)
|
|
163
|
+
*/
|
|
164
|
+
declare function isGeoPointType(zodType: z.ZodTypeAny): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Complete field options extracted from a Zod type
|
|
167
|
+
*/
|
|
168
|
+
interface ExtractedFieldOptions {
|
|
169
|
+
min?: number;
|
|
170
|
+
max?: number;
|
|
171
|
+
pattern?: string;
|
|
172
|
+
values?: string[];
|
|
173
|
+
minSelect?: number;
|
|
174
|
+
maxSelect?: number;
|
|
175
|
+
mimeTypes?: string[];
|
|
176
|
+
maxSize?: number;
|
|
177
|
+
thumbs?: string[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Extracts comprehensive field options from Zod type
|
|
181
|
+
* Includes all constraints that can be mapped to PocketBase field options
|
|
182
|
+
*/
|
|
183
|
+
declare function extractComprehensiveFieldOptions(zodType: z.ZodTypeAny): ExtractedFieldOptions;
|
|
184
|
+
/**
|
|
185
|
+
* Determines if a field should be treated as an editor field
|
|
186
|
+
* based on field name conventions
|
|
187
|
+
*/
|
|
188
|
+
declare function isEditorField(fieldName: string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Determines if a field should be treated as a file field
|
|
191
|
+
* based on field name conventions
|
|
192
|
+
*/
|
|
193
|
+
declare function isFileFieldByName(fieldName: string): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Gets the PocketBase field type with additional context
|
|
196
|
+
*/
|
|
197
|
+
interface FieldTypeResult {
|
|
198
|
+
type: PocketBaseFieldType;
|
|
199
|
+
isMultiple: boolean;
|
|
200
|
+
options: ExtractedFieldOptions;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Comprehensive type mapping that returns full field information
|
|
204
|
+
*/
|
|
205
|
+
declare function getFieldTypeInfo(zodType: z.ZodTypeAny, fieldName: string): FieldTypeResult;
|
|
206
|
+
|
|
207
|
+
export { type ExtractedFieldOptions, FIELD_TYPE_INFO, type FieldTypeInfo, type FieldTypeResult, POCKETBASE_FIELD_TYPES, extractComprehensiveFieldOptions, extractFieldOptions, getArrayElementType, getDefaultValue, getFieldTypeInfo, getMaxSelect, getMinSelect, isArrayType, isEditorField, isFieldRequired, isFileFieldByName, isGeoPointType, isMultipleRelationField, isRelationField, isSingleRelationField, mapZodArrayType, mapZodBooleanType, mapZodDateType, mapZodEnumType, mapZodNumberType, mapZodRecordType, mapZodStringType, mapZodTypeToPocketBase, pluralize, resolveTargetCollection, singularize, toCollectionName, unwrapZodType };
|