Spaces:
Runtime error
Runtime error
File size: 1,269 Bytes
4782147 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | import { JSONSchema7 } from "json-schema";
import { z } from "zod";
export const envBooleanSchema = z
.union([z.string(), z.boolean()])
.optional()
.transform((val) => {
if (typeof val === "boolean") return val;
if (typeof val === "string") {
const lowerVal = val.toLowerCase();
return lowerVal === "true" || lowerVal === "1" || lowerVal === "y";
}
return false;
});
export type ObjectJsonSchema7 = {
type: "object";
required?: string[];
description?: string;
properties: {
[key: string]: JSONSchema7;
};
};
export type TipTapMentionJsonContentPart =
| {
type: "text";
text: string;
}
| {
type: "mention";
attrs: {
id: string;
label: string;
};
};
export type TipTapMentionJsonContent = {
type: "doc";
content: {
type: "paragraph";
content?: (
| {
type: "text";
text: string;
}
| {
type: "mention";
attrs: {
id: string;
label: string;
};
}
| {
type: "hardBreak";
}
)[];
}[];
};
export const VisibilitySchema = z.enum(["public", "private", "readonly"]);
export type Visibility = z.infer<typeof VisibilitySchema>;
|