appwrite-utils
Version:
`appwrite-utils` is a comprehensive TypeScript library designed to streamline the development process for Appwrite projects. It provides a suite of utilities and helper functions that facilitate data manipulation, schema management, and seamless integrati
58 lines (53 loc) • 1.55 kB
text/typescript
import { z } from "zod";
import {
stringAttributeSchema,
type StringAttribute,
} from "../schemas/stringAttribute.js";
import {
integerAttributeSchema,
type IntegerAttribute,
} from "../schemas/integerAttribute.js";
import {
floatAttributeSchema,
type FloatAttribute,
} from "../schemas/floatAttribute.js";
import {
booleanAttributeSchema,
type BooleanAttribute,
} from "../schemas/booleanAttribute.js";
import {
datetimeAttributeSchema,
type DatetimeAttribute,
} from "../schemas/datetimeAttribute.js";
import {
emailAttributeSchema,
type EmailAttribute,
} from "../schemas/emailAttribute.js";
import { ipAttributeSchema, type IpAttribute } from "../schemas/ipAttribute.js";
import {
urlAttributeSchema,
type UrlAttribute,
} from "../schemas/urlAttribute.js";
import {
enumAttributeSchema,
type EnumAttribute,
} from "../schemas/enumAttribute.js";
import {
relationshipAttributeSchema,
type RelationshipAttribute,
} from "../schemas/relationshipAttribute.js";
export const attributeSchema = z.discriminatedUnion("type", [
stringAttributeSchema,
integerAttributeSchema,
floatAttributeSchema,
booleanAttributeSchema,
datetimeAttributeSchema,
emailAttributeSchema,
ipAttributeSchema,
urlAttributeSchema,
enumAttributeSchema,
relationshipAttributeSchema,
]);
export type Attribute = z.infer<typeof attributeSchema>;
export const attributesSchema = z.array(attributeSchema);
export type Attributes = z.infer<typeof attributesSchema>;