initial commit

This commit is contained in:
2026-04-04 22:13:55 -04:00
commit 5d77e207c9
10181 changed files with 522212 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import * as z from 'zod';
export type JsonPrimitive = string | number | boolean | null;
export type JsonValue = JsonPrimitive | JsonValue[] | { [k: string]: JsonValue };
export type InputJsonValue = JsonPrimitive | InputJsonValue[] | { [k: string]: InputJsonValue | null };
export type NullableJsonInput = JsonValue | 'JsonNull' | 'DbNull' | null;
export const transformJsonNull = (v?: NullableJsonInput) => {
if (v == null || v === 'DbNull') return null;
if (v === 'JsonNull') return null;
return v as JsonValue;
};
export const JsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>
z.union([
z.string(), z.number(), z.boolean(), z.literal(null),
z.record(z.string(), z.lazy(() => JsonValueSchema.optional())),
z.array(z.lazy(() => JsonValueSchema)),
])
) as z.ZodType<JsonValue>;
export const InputJsonValueSchema: z.ZodType<InputJsonValue> = z.lazy(() =>
z.union([
z.string(), z.number(), z.boolean(),
z.record(z.string(), z.lazy(() => z.union([InputJsonValueSchema, z.literal(null)]))),
z.array(z.lazy(() => z.union([InputJsonValueSchema, z.literal(null)]))),
])
) as z.ZodType<InputJsonValue>;
export const NullableJsonValue = z
.union([JsonValueSchema, z.literal('DbNull'), z.literal('JsonNull'), z.literal(null)])
.transform((v) => transformJsonNull(v as NullableJsonInput));