Add Nix flake for Zod-PocketBase dev environment and remove doc and

playground
This commit is contained in:
2025-10-05 14:51:00 +02:00
parent 41f083d69e
commit c15e42b967
69 changed files with 1190 additions and 16604 deletions

42
assets/stubs/index.ts Normal file
View File

@@ -0,0 +1,42 @@
import type Pocketbase from "pocketbase";
import type { RecordService } from "pocketbase";
import { z } from "zod";
/******* ENUMS *******/
export const collectionValues = @@_COLLECTION_NAMES_@@ as const;
export const Collection = z.enum(collectionValues);
export type Collection = z.infer<typeof Collection>;
export const COLLECTION = Collection.enum;
@@_ENUMS_@@
/******* BASE *******/
export const BaseModel = z.object({
created: z.string().pipe(z.coerce.date()),
id: z.string(),
updated: z.string().pipe(z.coerce.date()),
});
export type BaseModel = z.infer<typeof BaseModel>;
export const AdminModel = z.object({
...BaseModel.shape,
avatar: z.string(),
email: z.string().email(),
});
export type AdminModel = z.infer<typeof AdminModel>;
export const RecordModel = z.object({
...BaseModel.shape,
collectionId: z.string(),
collectionName: z.string(),
expand: z.any().optional(),
});
export type RecordModel = z.infer<typeof RecordModel>;
/******* RECORDS *******/
@@_RECORDS_@@
/******* CLIENT *******/
export type TypedPocketbase = Pocketbase & {
@@_SERVICES_@@
};