UNPKG

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

366 lines (365 loc) 12.1 kB
import { z } from "zod"; export declare const importDefSchema: z.ZodObject<{ type: z.ZodOptional<z.ZodDefault<z.ZodEnum<["create", "update"]>>>; filePath: z.ZodString; basePath: z.ZodOptional<z.ZodString>; primaryKeyField: z.ZodDefault<z.ZodString>; idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{ sourceField: z.ZodString; fieldToSet: z.ZodOptional<z.ZodString>; targetFieldToMatch: z.ZodOptional<z.ZodString>; targetField: z.ZodString; targetCollection: z.ZodString; }, "strip", z.ZodTypeAny, { sourceField: string; targetField: string; targetCollection: string; fieldToSet?: string | undefined; targetFieldToMatch?: string | undefined; }, { sourceField: string; targetField: string; targetCollection: string; fieldToSet?: string | undefined; targetFieldToMatch?: string | undefined; }>, "many">>; createUsers: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>; updateMapping: z.ZodOptional<z.ZodObject<{ originalIdField: z.ZodString; targetField: z.ZodString; }, "strip", z.ZodTypeAny, { targetField: string; originalIdField: string; }, { targetField: string; originalIdField: string; }>>; attributeMappings: z.ZodArray<z.ZodObject<{ oldKey: z.ZodOptional<z.ZodString>; oldKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; targetKey: z.ZodString; valueToSet: z.ZodOptional<z.ZodAny>; fileData: z.ZodOptional<z.ZodObject<{ name: z.ZodString; path: z.ZodString; }, "strip", z.ZodTypeAny, { path: string; name: string; }, { path: string; name: string; }>>; converters: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>; validationActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ action: z.ZodString; params: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { params: string[]; action: string; }, { params: string[]; action: string; }>, "many">>>; postImportActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ action: z.ZodString; params: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "many">; }, "strip", z.ZodTypeAny, { params: (string | Record<string, any>)[]; action: string; }, { params: (string | Record<string, any>)[]; action: string; }>, "many">>>; }, "strip", z.ZodTypeAny, { targetKey: string; oldKey?: string | undefined; oldKeys?: string[] | undefined; valueToSet?: any; fileData?: { path: string; name: string; } | undefined; converters?: string[] | undefined; validationActions?: { params: string[]; action: string; }[] | undefined; postImportActions?: { params: (string | Record<string, any>)[]; action: string; }[] | undefined; }, { targetKey: string; oldKey?: string | undefined; oldKeys?: string[] | undefined; valueToSet?: any; fileData?: { path: string; name: string; } | undefined; converters?: string[] | undefined; validationActions?: { params: string[]; action: string; }[] | undefined; postImportActions?: { params: (string | Record<string, any>)[]; action: string; }[] | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { filePath: string; primaryKeyField: string; attributeMappings: { targetKey: string; oldKey?: string | undefined; oldKeys?: string[] | undefined; valueToSet?: any; fileData?: { path: string; name: string; } | undefined; converters?: string[] | undefined; validationActions?: { params: string[]; action: string; }[] | undefined; postImportActions?: { params: (string | Record<string, any>)[]; action: string; }[] | undefined; }[]; type?: "create" | "update" | undefined; basePath?: string | undefined; idMappings?: { sourceField: string; targetField: string; targetCollection: string; fieldToSet?: string | undefined; targetFieldToMatch?: string | undefined; }[] | undefined; createUsers?: boolean | null | undefined; updateMapping?: { targetField: string; originalIdField: string; } | undefined; }, { filePath: string; attributeMappings: { targetKey: string; oldKey?: string | undefined; oldKeys?: string[] | undefined; valueToSet?: any; fileData?: { path: string; name: string; } | undefined; converters?: string[] | undefined; validationActions?: { params: string[]; action: string; }[] | undefined; postImportActions?: { params: (string | Record<string, any>)[]; action: string; }[] | undefined; }[]; type?: "create" | "update" | undefined; basePath?: string | undefined; primaryKeyField?: string | undefined; idMappings?: { sourceField: string; targetField: string; targetCollection: string; fieldToSet?: string | undefined; targetFieldToMatch?: string | undefined; }[] | undefined; createUsers?: boolean | null | undefined; updateMapping?: { targetField: string; originalIdField: string; } | undefined; }>; export declare const importDefSchemas: z.ZodArray<z.ZodObject<{ type: z.ZodOptional<z.ZodDefault<z.ZodEnum<["create", "update"]>>>; filePath: z.ZodString; basePath: z.ZodOptional<z.ZodString>; primaryKeyField: z.ZodDefault<z.ZodString>; idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{ sourceField: z.ZodString; fieldToSet: z.ZodOptional<z.ZodString>; targetFieldToMatch: z.ZodOptional<z.ZodString>; targetField: z.ZodString; targetCollection: z.ZodString; }, "strip", z.ZodTypeAny, { sourceField: string; targetField: string; targetCollection: string; fieldToSet?: string | undefined; targetFieldToMatch?: string | undefined; }, { sourceField: string; targetField: string; targetCollection: string; fieldToSet?: string | undefined; targetFieldToMatch?: string | undefined; }>, "many">>; createUsers: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>; updateMapping: z.ZodOptional<z.ZodObject<{ originalIdField: z.ZodString; targetField: z.ZodString; }, "strip", z.ZodTypeAny, { targetField: string; originalIdField: string; }, { targetField: string; originalIdField: string; }>>; attributeMappings: z.ZodArray<z.ZodObject<{ oldKey: z.ZodOptional<z.ZodString>; oldKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; targetKey: z.ZodString; valueToSet: z.ZodOptional<z.ZodAny>; fileData: z.ZodOptional<z.ZodObject<{ name: z.ZodString; path: z.ZodString; }, "strip", z.ZodTypeAny, { path: string; name: string; }, { path: string; name: string; }>>; converters: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>; validationActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ action: z.ZodString; params: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { params: string[]; action: string; }, { params: string[]; action: string; }>, "many">>>; postImportActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ action: z.ZodString; params: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "many">; }, "strip", z.ZodTypeAny, { params: (string | Record<string, any>)[]; action: string; }, { params: (string | Record<string, any>)[]; action: string; }>, "many">>>; }, "strip", z.ZodTypeAny, { targetKey: string; oldKey?: string | undefined; oldKeys?: string[] | undefined; valueToSet?: any; fileData?: { path: string; name: string; } | undefined; converters?: string[] | undefined; validationActions?: { params: string[]; action: string; }[] | undefined; postImportActions?: { params: (string | Record<string, any>)[]; action: string; }[] | undefined; }, { targetKey: string; oldKey?: string | undefined; oldKeys?: string[] | undefined; valueToSet?: any; fileData?: { path: string; name: string; } | undefined; converters?: string[] | undefined; validationActions?: { params: string[]; action: string; }[] | undefined; postImportActions?: { params: (string | Record<string, any>)[]; action: string; }[] | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { filePath: string; primaryKeyField: string; attributeMappings: { targetKey: string; oldKey?: string | undefined; oldKeys?: string[] | undefined; valueToSet?: any; fileData?: { path: string; name: string; } | undefined; converters?: string[] | undefined; validationActions?: { params: string[]; action: string; }[] | undefined; postImportActions?: { params: (string | Record<string, any>)[]; action: string; }[] | undefined; }[]; type?: "create" | "update" | undefined; basePath?: string | undefined; idMappings?: { sourceField: string; targetField: string; targetCollection: string; fieldToSet?: string | undefined; targetFieldToMatch?: string | undefined; }[] | undefined; createUsers?: boolean | null | undefined; updateMapping?: { targetField: string; originalIdField: string; } | undefined; }, { filePath: string; attributeMappings: { targetKey: string; oldKey?: string | undefined; oldKeys?: string[] | undefined; valueToSet?: any; fileData?: { path: string; name: string; } | undefined; converters?: string[] | undefined; validationActions?: { params: string[]; action: string; }[] | undefined; postImportActions?: { params: (string | Record<string, any>)[]; action: string; }[] | undefined; }[]; type?: "create" | "update" | undefined; basePath?: string | undefined; primaryKeyField?: string | undefined; idMappings?: { sourceField: string; targetField: string; targetCollection: string; fieldToSet?: string | undefined; targetFieldToMatch?: string | undefined; }[] | undefined; createUsers?: boolean | null | undefined; updateMapping?: { targetField: string; originalIdField: string; } | undefined; }>, "many">; export type ImportDef = z.infer<typeof importDefSchema>; export type ImportDefs = z.infer<typeof importDefSchemas>;