Compare commits
	
		
			1 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| dc0ba32801 | 
| @@ -16,6 +16,7 @@ This repository is a continuation of [Gregory Bouteiller's zod-pocketbase](https | ||||
| ## Changes from Original | ||||
|  | ||||
| ### Project Structure | ||||
| - Added `flake.nix` for **NixOS** development environment. | ||||
| - Removed `doc/`, `playground/` and monorepo configuration | ||||
| - Replaced `pnpm` and `node` in favor of `bun` | ||||
| - Switched `.github/` to `.gitea/` and `gh` to `tea` | ||||
|   | ||||
							
								
								
									
										31
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								flake.nix
									
									
									
									
									
								
							| @@ -17,7 +17,6 @@ | ||||
|       let | ||||
|         pkgs = nixpkgs.legacyPackages.${system}; | ||||
|         bun = pkgs.bun; | ||||
|  | ||||
|       in | ||||
|       { | ||||
|         devShells.default = pkgs.mkShell { | ||||
| @@ -26,7 +25,6 @@ | ||||
|             git | ||||
|             nodejs_24 | ||||
|             tea | ||||
|             # nodePackages.node-inspector | ||||
|           ]; | ||||
|  | ||||
|           shellHook = '' | ||||
| @@ -36,9 +34,13 @@ | ||||
|             echo "" | ||||
|             echo "Available commands:" | ||||
|             echo "  bun install           - Install dependencies" | ||||
|             echo "  bun run dev           - Start development" | ||||
|             echo "  bun build             - Build with Bun's bundler" | ||||
|             echo "  tea releases create   - Create Gitea release" | ||||
|             echo "  bun run dev           - Start development (build with --watch flag)" | ||||
|             echo "  bun run build         - Build library" | ||||
|             echo "  bun run lint          - Run Biome check" | ||||
|             echo "  bun run lint:w        - Run Biome check (with --write)" | ||||
|             echo "  bun run format        - Run Biome format" | ||||
|             echo "  bun run format:w      - Run Biome format (with --write)" | ||||
|             echo "  bun run release       - Run release script" | ||||
|             echo "" | ||||
|  | ||||
|             if [ ! -d "node_modules" ]; then | ||||
| @@ -50,25 +52,6 @@ | ||||
|           NODE_ENV = "development"; | ||||
|           BUN_RUNTIME = "bun"; | ||||
|         }; | ||||
|  | ||||
|         packages.default = pkgs.stdenv.mkDerivation { | ||||
|           name = "zod-pocketbase-continue"; | ||||
|           src = ./.; | ||||
|  | ||||
|           buildInputs = [ bun ]; | ||||
|  | ||||
|           buildPhase = '' | ||||
|             export HOME=$TMPDIR | ||||
|             bun install --frozen-lockfile | ||||
|             bun run build | ||||
|           ''; | ||||
|  | ||||
|           installPhase = '' | ||||
|             mkdir -p $out | ||||
|             cp -r dist $out/ | ||||
|             cp package.json $out/ | ||||
|           ''; | ||||
|         }; | ||||
|       } | ||||
|     ); | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
| 	"name": "zod-pocketbase-continue", | ||||
| 	"version": "0.6.0", | ||||
| 	"version": "0.6.1", | ||||
| 	"description": "Zod tooling for your PocketBase instance.", | ||||
| 	"author": { | ||||
| 		"email": "garandplg@garandplg.com", | ||||
|   | ||||
| @@ -89,15 +89,11 @@ export function stringifyContent(collections: CollectionModel[], opts: GenerateO | ||||
| 				const fileFieldMaxSelect = maxSelectFile ? `.max(${maxSelectFile})` : '' | ||||
| 				const fileFieldTypeArray = maxSelectFile === 1 ? '' : `.array()${fileFieldMaxSelect}` | ||||
|  | ||||
| 				let fileValidation = 'z.instanceof(File)' | ||||
| 				const fileMaxSizeFile = maxSizeFile ? `.max(${maxSizeFile})` : '' | ||||
| 				const fileMimeTypesArray = | ||||
| 					mimeTypesArray.length > 0 ? `.mime(${JSON.stringify(mimeTypesArray)})` : '' | ||||
|  | ||||
| 				if (maxSizeFile) | ||||
| 					fileValidation += `.refine((file) => file.size <= ${maxSizeFile}, { message: "File size too large" })` | ||||
|  | ||||
| 				if (mimeTypesArray.length > 0) | ||||
| 					fileValidation += `.refine((file) => ${JSON.stringify(mimeTypesArray)}.includes(file.type), { message: "Invalid file type" })` | ||||
|  | ||||
| 				const baseFileSchema = `z.union([z.string(), ${fileValidation}])` | ||||
| 				const baseFileSchema = `z.union([z.string(), z.file()${fileMaxSizeFile}${fileMimeTypesArray}])` | ||||
| 				schema = `${baseFileSchema}${fileFieldTypeArray}` | ||||
| 				break | ||||
| 			} | ||||
|   | ||||
| @@ -94,8 +94,8 @@ function fieldsFromRec<S>(schema: S, prefix = '') { | ||||
| function hasObjectSchemaDescendant(value: unknown): value is any { | ||||
| 	// Handle ZodPipe | ||||
| 	if (value && typeof value === 'object' && 'constructor' in value) { | ||||
| 		const constructor = (value as any).constructor | ||||
| 		if (constructor?.name === 'ZodPipe') { | ||||
| 		const valueConstructor = value.constructor | ||||
| 		if (valueConstructor?.name === 'ZodPipe') { | ||||
| 			const inputSchema = (value as any)._def?.in | ||||
| 			if (inputSchema) return hasObjectSchemaDescendant(inputSchema) | ||||
| 		} | ||||
| @@ -103,8 +103,8 @@ function hasObjectSchemaDescendant(value: unknown): value is any { | ||||
|  | ||||
| 	// Handle ZodTransform | ||||
| 	if (value && typeof value === 'object' && 'constructor' in value) { | ||||
| 		const constructor = (value as any).constructor | ||||
| 		if (constructor?.name === 'ZodTransform') { | ||||
| 		const valueConstructor = value.constructor | ||||
| 		if (valueConstructor?.name === 'ZodTransform') { | ||||
| 			const innerSchema = | ||||
| 				(value as any)._def?.input || (value as any)._def?.schema || (value as any).sourceType | ||||
| 			if (innerSchema) return hasObjectSchemaDescendant(innerSchema) | ||||
| @@ -123,8 +123,8 @@ function hasObjectSchemaDescendant(value: unknown): value is any { | ||||
| function getObjectSchemaDescendant<S>(schema: S): ZodObject | undefined { | ||||
| 	// Handle ZodPipe | ||||
| 	if (schema && typeof schema === 'object' && 'constructor' in schema) { | ||||
| 		const constructor = (schema as any).constructor | ||||
| 		if (constructor?.name === 'ZodPipe') { | ||||
| 		const schemaConstructor = schema.constructor | ||||
| 		if (schemaConstructor?.name === 'ZodPipe') { | ||||
| 			const inputSchema = (schema as any)._def?.in | ||||
| 			if (inputSchema) return getObjectSchemaDescendant(inputSchema) | ||||
| 		} | ||||
| @@ -132,8 +132,8 @@ function getObjectSchemaDescendant<S>(schema: S): ZodObject | undefined { | ||||
|  | ||||
| 	// Handle ZodTransform | ||||
| 	if (schema && typeof schema === 'object' && 'constructor' in schema) { | ||||
| 		const constructor = (schema as any).constructor | ||||
| 		if (constructor?.name === 'ZodTransform') { | ||||
| 		const schemaConstructor = schema.constructor | ||||
| 		if (schemaConstructor?.name === 'ZodTransform') { | ||||
| 			const innerSchema = | ||||
| 				(schema as any)._def?.input || (schema as any)._def?.schema || (schema as any).sourceType | ||||
| 			if (innerSchema) return getObjectSchemaDescendant(innerSchema) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user