From 9fa65a9ac39aaf4cf8aae32dd271ec8b80acf735 Mon Sep 17 00:00:00 2001 From: imeepos Date: Tue, 13 Jan 2026 14:58:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0better=20auth=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/auth.tsx | 5 + lib/auth.ts | 135 +- lib/fetch-logger.ts | 101 + lib/i18n.ts | 24 +- lib/plugins/loomart-plugin.ts | 7 - lib/plugins/loomart.d.ts | 7333 --------------------------------- lib/plugins/stripe-plugin.ts | 37 + lib/plugins/stripe.d.ts | 422 ++ lib/storage.native.ts | 15 + lib/storage.ts | 17 + 10 files changed, 720 insertions(+), 7376 deletions(-) create mode 100644 app/auth.tsx create mode 100644 lib/fetch-logger.ts delete mode 100644 lib/plugins/loomart-plugin.ts delete mode 100644 lib/plugins/loomart.d.ts create mode 100644 lib/plugins/stripe-plugin.ts create mode 100644 lib/plugins/stripe.d.ts create mode 100644 lib/storage.native.ts create mode 100644 lib/storage.ts diff --git a/app/auth.tsx b/app/auth.tsx new file mode 100644 index 0000000..26148c8 --- /dev/null +++ b/app/auth.tsx @@ -0,0 +1,5 @@ + + +export default () => { + return null; +} \ No newline at end of file diff --git a/lib/auth.ts b/lib/auth.ts index 5d7c1fa..d761861 100644 --- a/lib/auth.ts +++ b/lib/auth.ts @@ -1,27 +1,114 @@ -import { createAuthClient } from "better-auth/react"; -import { usernameClient, phoneNumberClient, emailOTPClient, genericOAuthClient, adminClient, organizationClient, jwtClient } from 'better-auth/client/plugins' -import * as SecureStore from "expo-secure-store"; -import { expoClient } from "@better-auth/expo/client"; +import 'reflect-metadata' -import loomartPlugin from './plugins/loomart-plugin'; +import { expoClient } from '@better-auth/expo/client' +import { createSkerClientPlugin } from '@repo/sdk' +import { + adminClient, + emailOTPClient, + genericOAuthClient, + jwtClient, + organizationClient, + phoneNumberClient, + usernameClient, +} from 'better-auth/client/plugins' +import { createAuthClient } from 'better-auth/react' + +import { fetchWithLogger } from './fetch-logger' +import type { Subscription } from './plugins/stripe' +import { stripeClient } from './plugins/stripe-plugin' +import { storage } from './storage' +import type { ApiError } from './types' + +export interface CreditBalance { + tokenUsage: number + remainingTokenBalance: number + currentCreditBalance: number + unitPrice: number +} + +export interface SubscriptionListItem extends Subscription { + type?: 'metered' | 'licenced' + limits?: Record + creditBalance?: CreditBalance + highestTierPlan?: string + highestTierCredits?: number +} + +export interface SubscriptionListParams { + query?: { + referenceId?: string + } +} + +export interface SubscriptionRestoreParams { + referenceId?: string + subscriptionId?: string +} + +export interface SubscriptionRestoreResponse { + success: boolean + subscription: { + id: string + stripeSubscriptionId: string + cancelAtPeriodEnd: boolean + periodEnd?: Date + status: string + } +} + +export interface BillingPortalParams { + locale?: string + referenceId?: string + returnUrl?: string +} + +export interface BillingPortalResponse { + url: string + redirect: boolean +} + +export interface ISubscription { + list: (params?: SubscriptionListParams) => Promise<{ data?: SubscriptionListItem[]; error?: ApiError }> + restore: (params?: SubscriptionRestoreParams) => Promise<{ data?: SubscriptionRestoreResponse; error?: ApiError }> + billingPortal: (params?: BillingPortalParams) => Promise<{ data?: BillingPortalResponse; error?: ApiError }> +} +export const getAuthToken = async () => (await storage.getItem('bestaibest.better-auth.session_token')) || '' + +export const setAuthToken = async (token: string) => { + await storage.setItem(`bestaibest.better-auth.session_token`, token) +} export const authClient = createAuthClient({ - baseURL: "http://localhost:14333/api/auth", - trustedOrigins: ["duooomi://"], - storage: SecureStore, - scheme: "duooomi", - plugins: [ - loomartPlugin(), - usernameClient(), - phoneNumberClient(), - emailOTPClient(), - genericOAuthClient(), - jwtClient(), - adminClient(), - organizationClient(), - expoClient({ - storage: SecureStore - }) - ], -}); + baseURL: 'https://api.mixvideo.bowong.cc', + trustedOrigins: ['duooomi://', 'https://api.mixvideo.bowong.cc'], + storage, + scheme: 'duooomi', + fetchOptions: { + auth: { + type: 'Bearer', + token: async () => { + const Authorization = await getAuthToken() + return Authorization + }, + }, + customFetchImpl: fetchWithLogger as typeof fetch, + }, + plugins: [ + createSkerClientPlugin(), + stripeClient(), + usernameClient(), + phoneNumberClient(), + emailOTPClient(), + genericOAuthClient(), + jwtClient(), + adminClient(), + organizationClient(), + expoClient({ + storage: storage as any, + }), + ], +}) -export const { signIn, signUp, signOut, useSession, $Infer, loomart, admin } = authClient; +export const { signIn, signUp, signOut, useSession, $Infer, admin, forgetPassword, resetPassword, emailOtp } = + authClient + +export const subscription: ISubscription = Reflect.get(authClient, 'subscription') diff --git a/lib/fetch-logger.ts b/lib/fetch-logger.ts new file mode 100644 index 0000000..ac68839 --- /dev/null +++ b/lib/fetch-logger.ts @@ -0,0 +1,101 @@ +import { router } from 'expo-router' + +import { storage } from './storage' + +interface FetchLoggerOptions { + enableLogging?: boolean + logRequest?: boolean + logResponse?: boolean + logError?: boolean +} + +const defaultOptions: FetchLoggerOptions = { + enableLogging: __DEV__, + logRequest: true, + logResponse: true, + logError: true, +} + +const originalFetch = global.fetch + +export const createFetchWithLogger = (options: FetchLoggerOptions = {}) => { + const config = { ...defaultOptions, ...options } + + return async (input: RequestInfo | URL, init?: RequestInit): Promise => { + const startTime = Date.now() + const url = typeof input === 'string' ? input : input instanceof URL ? input.toString() : input.url + const method = init?.method || 'GET' + + try { + const token = await storage.getItem('token') + + if (token) { + init = { + ...init, + headers: { + ...init?.headers, + authorization: `Bearer ${token}`, + }, + } + } + + const response = await originalFetch(input, init) + + if (response.status === 401) { + console.warn('🔐 401 未授权,跳转到登录页') + // router.replace('/auth') + router.push('/auth') + } + + return response + } catch (error) { + const duration = Date.now() - startTime + + if (config.enableLogging && config.logError) { + console.group(`❌ [FETCH 错误] ${method} ${url}`) + console.error('📍 URL:', url) + console.error('🔧 Method:', method) + console.error('⏱️ Duration:', `${duration}ms`) + + if (init?.headers) { + console.error('📋 Request Headers:', JSON.stringify(init.headers, null, 2)) + } + + if (init?.body) { + try { + const bodyContent = typeof init.body === 'string' ? init.body : JSON.stringify(init.body) + console.error('📦 Request Body:', bodyContent) + } catch (e) { + console.error('📦 Request Body: [无法序列化]') + } + } + + console.error('💥 Error Type:', error?.constructor?.name || 'Unknown') + console.error('💥 Error Message:', error instanceof Error ? error.message : String(error)) + + if (error instanceof Error && error.stack) { + console.error('📚 Stack Trace:', error.stack) + } + + if (error && typeof error === 'object') { + console.error('🔍 Error Details:', JSON.stringify(error, Object.getOwnPropertyNames(error), 2)) + } + + console.groupEnd() + } + + throw error + } + } +} + +export const fetchWithLogger = createFetchWithLogger() + +export const setupGlobalFetchLogger = (options?: FetchLoggerOptions) => { + const loggedFetch = createFetchWithLogger(options) + global.fetch = loggedFetch as typeof fetch + + return () => { + global.fetch = originalFetch + } +} diff --git a/lib/i18n.ts b/lib/i18n.ts index d34485f..cb33c8d 100644 --- a/lib/i18n.ts +++ b/lib/i18n.ts @@ -1,11 +1,11 @@ import i18n from 'i18next' import { initReactI18next } from 'react-i18next' -import AsyncStorage from '@react-native-async-storage/async-storage' import { NativeModules, Platform } from 'react-native' +import { storage } from './storage' // 导入语言资源 -import zhCN from '../locales/zh-CN.json' import enUS from '../locales/en-US.json' +import zhCN from '../locales/zh-CN.json' // 定义支持的语言 export const SUPPORTED_LANGUAGES = { @@ -52,7 +52,7 @@ const languageDetector = { detect: async (callback: (lng: string) => void) => { try { // 1. 优先使用用户保存的语言设置 - const savedLanguage = await AsyncStorage.getItem('app_language') + const savedLanguage = await storage.getItem('app_language') if (savedLanguage) { // 兼容旧的语言代码格式 if (savedLanguage === 'zh' || savedLanguage === 'zh-CN') { @@ -63,7 +63,7 @@ const languageDetector = { return } } - + // 2. 如果没有保存的语言,尝试使用系统语言 const systemLang = getSystemLanguage() callback(systemLang) @@ -73,11 +73,11 @@ const languageDetector = { callback('zh-CN') } }, - init: () => {}, + init: () => { }, cacheUserLanguage: async (lng: string) => { try { // AsyncStorage 在 Android 和 iOS 上都正常工作 - await AsyncStorage.setItem('app_language', lng) + await storage.setItem('app_language', lng) } catch (error) { console.error('Error saving language:', error) } @@ -97,25 +97,25 @@ i18n.use(languageDetector) translation: enUS, }, }, - + // 默认语言 fallbackLng: 'zh-CN', - + // 调试模式(开发环境开启) debug: false, - + // 兼容性配置:使用 v3 格式处理复数,避免 Android 端 Intl.PluralRules 不支持的问题 compatibilityJSON: 'v3', - + // 插值配置 interpolation: { escapeValue: false, // React已经处理了XSS防护 }, - + // 命名空间配置 defaultNS: 'translation', ns: ['translation'], - + // 键值分隔符 keySeparator: '.', nsSeparator: ':', diff --git a/lib/plugins/loomart-plugin.ts b/lib/plugins/loomart-plugin.ts deleted file mode 100644 index 076e91e..0000000 --- a/lib/plugins/loomart-plugin.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { loomart } from "./loomart"; -export default () => { - return { - id: "loomart", - $InferServerPlugin: {} as ReturnType, - } -} diff --git a/lib/plugins/loomart.d.ts b/lib/plugins/loomart.d.ts deleted file mode 100644 index 2d318ab..0000000 --- a/lib/plugins/loomart.d.ts +++ /dev/null @@ -1,7333 +0,0 @@ -import * as zod from 'zod'; -import { z } from 'zod'; -import * as better_call from 'better-call'; -import * as better_auth from 'better-auth'; -import { Workflow } from '@cloudflare/workers-types'; -import * as better_auth_plugins_access from 'better-auth/plugins/access'; - -declare const getSchema: () => { - readonly project: { - readonly fields: { - readonly userId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "user"; - readonly field: "id"; - }; - }; - readonly sourceTemplateId: { - readonly type: "string"; - }; - readonly title: { - readonly type: "string"; - readonly required: true; - }; - readonly titleEn: { - readonly type: "string"; - readonly required: true; - }; - readonly description: { - readonly type: "string"; - readonly required: true; - }; - readonly descriptionEn: { - readonly type: "string"; - readonly required: true; - }; - readonly resultUrl: { - readonly type: "string"; - readonly required: false; - readonly defaultValue: ""; - }; - readonly content: { - readonly type: "json"; - readonly required: true; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly category: { - readonly fields: { - readonly ownerId: { - readonly type: "string"; - }; - readonly name: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly nameEn: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly description: { - readonly type: "string"; - readonly required: true; - }; - readonly descriptionEn: { - readonly type: "string"; - readonly required: true; - }; - readonly sortOrder: { - readonly type: "number"; - readonly required: true; - readonly defaultValue: 0; - }; - readonly isActive: { - readonly type: "boolean"; - readonly required: true; - readonly defaultValue: true; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly template: { - readonly fields: { - readonly userId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "user"; - readonly field: "id"; - }; - }; - readonly title: { - readonly type: "string"; - readonly required: true; - }; - readonly titleEn: { - readonly type: "string"; - readonly required: true; - }; - readonly ownerId: { - readonly type: "string"; - }; - readonly description: { - readonly type: "string"; - readonly required: true; - }; - readonly descriptionEn: { - readonly type: "string"; - readonly required: true; - }; - readonly coverImageUrl: { - readonly type: "string"; - readonly required: true; - readonly defaultValue: ""; - }; - readonly previewUrl: { - readonly type: "string"; - readonly required: true; - readonly defaultValue: ""; - }; - readonly content: { - readonly type: "json"; - readonly required: true; - }; - readonly formSchema: { - readonly type: "json"; - }; - readonly uploadSapecifications: { - readonly type: "string"; - }; - readonly uploadSapecificationsEn: { - readonly type: "string"; - }; - readonly sortOrder: { - readonly type: "number"; - readonly required: true; - readonly defaultValue: 0; - }; - readonly costPrice: { - readonly type: "number"; - }; - readonly price: { - readonly type: "number"; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - readonly aspectRatio: { - readonly type: "string"; - readonly required: true; - readonly defaultValue: "9:16"; - }; - readonly status: { - readonly type: "string"; - readonly required: true; - readonly defaultValue: "AUDITING"; - }; - readonly isDeleted: { - readonly type: "boolean"; - readonly required: true; - readonly defaultValue: false; - }; - readonly deletedAt: { - readonly type: "date"; - }; - }; - }; - readonly recommendedTemplate: { - readonly fields: { - readonly templateId: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - readonly references: { - readonly model: "template"; - readonly field: "id"; - }; - }; - readonly sortOrder: { - readonly type: "number"; - readonly required: true; - readonly defaultValue: 0; - }; - readonly isActive: { - readonly type: "boolean"; - readonly required: true; - readonly defaultValue: true; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly tag: { - readonly fields: { - readonly ownerId: { - readonly type: "string"; - }; - readonly name: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly nameEn: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly description: { - readonly type: "string"; - readonly defaultValue: ""; - }; - readonly descriptionEn: { - readonly type: "string"; - readonly defaultValue: ""; - }; - readonly sortOrder: { - readonly type: "number"; - readonly required: true; - readonly defaultValue: 0; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly categoryTag: { - readonly fields: { - readonly categoryId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "category"; - readonly field: "id"; - }; - }; - readonly tagId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "tag"; - readonly field: "id"; - }; - }; - readonly sortOrder: { - readonly type: "number"; - readonly defaultValue: 0; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly categoryTagTemplate: { - readonly fields: { - readonly templateId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "template"; - readonly field: "id"; - }; - }; - readonly categoryTagId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "categoryTag"; - readonly field: "id"; - }; - }; - readonly sortOrder: { - readonly type: "number"; - readonly defaultValue: 0; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly activity: { - readonly fields: { - readonly title: { - readonly type: "string"; - readonly required: true; - }; - readonly titleEn: { - readonly type: "string"; - readonly required: true; - }; - readonly desc: { - readonly type: "string"; - readonly required: true; - }; - readonly descEn: { - readonly type: "string"; - readonly required: true; - }; - readonly coverUrl: { - readonly type: "string"; - readonly required: true; - }; - readonly videoUrl: { - readonly type: "string"; - }; - readonly ownerId: { - readonly type: "string"; - }; - readonly link: { - readonly type: "string"; - readonly required: true; - }; - readonly isActive: { - readonly type: "boolean"; - readonly defaultValue: true; - }; - readonly sortOrder: { - readonly type: "number"; - readonly defaultValue: 0; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly aigcBilling: { - readonly fields: { - readonly userId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "user"; - readonly field: "id"; - }; - }; - readonly taskId: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly taskType: { - readonly type: "string"; - readonly required: true; - }; - readonly modelName: { - readonly type: "string"; - }; - readonly status: { - readonly type: "string"; - readonly defaultValue: "pending"; - }; - readonly input: { - readonly type: "json"; - }; - readonly output: { - readonly type: "json"; - }; - readonly price: { - readonly type: "number"; - }; - readonly usage: { - readonly type: "json"; - }; - readonly rating: { - readonly type: "number"; - }; - readonly errorMessage: { - readonly type: "string"; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly templateGeneration: { - readonly fields: { - readonly userId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "user"; - readonly field: "id"; - }; - }; - readonly templateId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "template"; - readonly field: "id"; - }; - }; - readonly type: { - readonly type: "string"; - readonly required: true; - }; - readonly resultUrl: { - readonly type: "json"; - readonly required: true; - }; - readonly originalUrl: { - readonly type: "string"; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - readonly status: { - readonly type: "string"; - readonly defaultValue: "pending"; - }; - readonly creditsCost: { - readonly type: "number"; - readonly defaultValue: 0; - }; - readonly creditsTransactionId: { - readonly type: "string"; - }; - }; - }; -}; - -type SchemaDef = ReturnType; -type GetZodType = T extends { - type: 'string'; -} ? z.ZodString : T extends { - type: 'number'; -} ? z.ZodNumber : T extends { - type: 'boolean'; -} ? z.ZodBoolean : T extends { - type: 'date'; -} ? z.ZodDate : T extends { - type: 'json'; -} ? z.ZodAny : z.ZodAny; -type ZodFieldType = T extends { - required: true; -} ? GetZodType : z.ZodNullable>>; -type ModelShape = { - [F in keyof SchemaDef[M]['fields']]: ZodFieldType; -} & { - id: z.ZodString; -}; -type InferZodSchema = z.infer>>; -declare const getZodSchemaFromModel: (modelName: M) => z.ZodObject>; - -declare function getLoomartOptions(context: any): LoomartOptions; - -declare const defaultStatements: { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; -}; -type Statements = typeof defaultStatements; -declare const ac: { - newRole(statements: better_auth_plugins_access.Subset): { - authorize(request: K_1 extends infer T extends K_2 ? { [key in T]?: better_auth_plugins_access.Subset[key] | { - actions: better_auth_plugins_access.Subset[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset; - }; - statements: { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }; -}; -/** - * 角色 - 权限 - * 组织 - * 用户 superadmin 没有组织 user/editor 没有组织 contentAdmin有组织 - */ -declare const user: { - authorize(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"template" | "selfFile", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key] | { - actions: better_auth_plugins_access.Subset<"template" | "selfFile", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset<"template" | "selfFile", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>; -}; -declare const editor: { - authorize(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"project" | "template" | "category" | "tag", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key] | { - actions: better_auth_plugins_access.Subset<"project" | "template" | "category" | "tag", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset<"project" | "template" | "category" | "tag", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>; -}; -declare const contentadmin: { - authorize(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"template" | "recommendedTemplate" | "category" | "file" | "tag" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key] | { - actions: better_auth_plugins_access.Subset<"template" | "recommendedTemplate" | "category" | "file" | "tag" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset<"template" | "recommendedTemplate" | "category" | "file" | "tag" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>; -}; -declare const superadmin: { - authorize(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"activity" | "project" | "template" | "recommendedTemplate" | "category" | "file" | "tag" | "wallet" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key] | { - actions: better_auth_plugins_access.Subset<"activity" | "project" | "template" | "recommendedTemplate" | "category" | "file" | "tag" | "wallet" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset<"activity" | "project" | "template" | "recommendedTemplate" | "category" | "file" | "tag" | "wallet" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>; -}; -declare const roles: { - user: { - authorize(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"template" | "selfFile", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key] | { - actions: better_auth_plugins_access.Subset<"template" | "selfFile", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset<"template" | "selfFile", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>; - }; - editor: { - authorize(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"project" | "template" | "category" | "tag", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key] | { - actions: better_auth_plugins_access.Subset<"project" | "template" | "category" | "tag", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset<"project" | "template" | "category" | "tag", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>; - }; - contentadmin: { - authorize(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"template" | "recommendedTemplate" | "category" | "file" | "tag" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key] | { - actions: better_auth_plugins_access.Subset<"template" | "recommendedTemplate" | "category" | "file" | "tag" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset<"template" | "recommendedTemplate" | "category" | "file" | "tag" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>; - }; - superadmin: { - authorize(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"activity" | "project" | "template" | "recommendedTemplate" | "category" | "file" | "tag" | "wallet" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key] | { - actions: better_auth_plugins_access.Subset<"activity" | "project" | "template" | "recommendedTemplate" | "category" | "file" | "tag" | "wallet" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>[key]; - connector: "OR" | "AND"; - } | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse; - statements: better_auth_plugins_access.Subset<"activity" | "project" | "template" | "recommendedTemplate" | "category" | "file" | "tag" | "wallet" | "user", { - readonly activity: readonly ["create", "read", "update", "delete"]; - readonly project: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly template: readonly ["create", "read", "list", "update", "delete", "run"]; - readonly recommendedTemplate: readonly ["create", "read", "list", "update", "delete"]; - readonly category: readonly ["create", "read", "list", "update", "delete"]; - readonly file: readonly ["upload", "list", "update", "delete"]; - readonly selfFile: readonly ["upload", "list", "update", "delete"]; - readonly tag: readonly ["create", "list", "read", "update", "delete"]; - readonly wallet: readonly ["grantCredit", "revokeCredit"]; - readonly user: readonly ["create", "read", "list", "update", "delete"]; - }>; - }; -}; - -interface FileUploadResponse { - status: boolean; - msg: string; - data: string; - usage?: { - price: number; - price_desc: string; - }; -} -interface VideoCompressRequest { - url: string; - compress: 'low' | 'medium' | 'high'; -} -interface VideoCompressResponse { - status: boolean; - msg: string; - data: string; -} - -interface AigcModelInfo { - model_name: string; - description: string; - supported_ar: string[]; - supported_count: number[]; - mode: string; - model_provider: string; - extra: { - img_count: { - min: number; - max: number; - }; - other_params: Record; - }; - tags: string[]; - provider: string; - display_name: string; -} -interface AigcTaskResponse { - status: boolean; - msg: string; - data: string; -} -interface AigcTaskStatus { - status: boolean | string; - msg: string | { - message: string; - }; - data?: string[] | null; - extra?: string; - usage?: Record; -} - -interface GeneratedUser { - name: string; - email: string; - username: string; - displayUsername: string; -} - -interface LoomartOptions { - query: (sql: string, params: any[]) => Promise; - workflow?: Workflow; - prisma: any; -} -declare const loomart: (options: LoomartOptions) => { - id: "loomart"; - schema: { - readonly project: { - readonly fields: { - readonly userId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "user"; - readonly field: "id"; - }; - }; - readonly sourceTemplateId: { - readonly type: "string"; - }; - readonly title: { - readonly type: "string"; - readonly required: true; - }; - readonly titleEn: { - readonly type: "string"; - readonly required: true; - }; - readonly description: { - readonly type: "string"; - readonly required: true; - }; - readonly descriptionEn: { - readonly type: "string"; - readonly required: true; - }; - readonly resultUrl: { - readonly type: "string"; - readonly required: false; - readonly defaultValue: ""; - }; - readonly content: { - readonly type: "json"; - readonly required: true; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly category: { - readonly fields: { - readonly ownerId: { - readonly type: "string"; - }; - readonly name: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly nameEn: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly description: { - readonly type: "string"; - readonly required: true; - }; - readonly descriptionEn: { - readonly type: "string"; - readonly required: true; - }; - readonly sortOrder: { - readonly type: "number"; - readonly required: true; - readonly defaultValue: 0; - }; - readonly isActive: { - readonly type: "boolean"; - readonly required: true; - readonly defaultValue: true; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly template: { - readonly fields: { - readonly userId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "user"; - readonly field: "id"; - }; - }; - readonly title: { - readonly type: "string"; - readonly required: true; - }; - readonly titleEn: { - readonly type: "string"; - readonly required: true; - }; - readonly ownerId: { - readonly type: "string"; - }; - readonly description: { - readonly type: "string"; - readonly required: true; - }; - readonly descriptionEn: { - readonly type: "string"; - readonly required: true; - }; - readonly coverImageUrl: { - readonly type: "string"; - readonly required: true; - readonly defaultValue: ""; - }; - readonly previewUrl: { - readonly type: "string"; - readonly required: true; - readonly defaultValue: ""; - }; - readonly content: { - readonly type: "json"; - readonly required: true; - }; - readonly formSchema: { - readonly type: "json"; - }; - readonly uploadSapecifications: { - readonly type: "string"; - }; - readonly uploadSapecificationsEn: { - readonly type: "string"; - }; - readonly sortOrder: { - readonly type: "number"; - readonly required: true; - readonly defaultValue: 0; - }; - readonly costPrice: { - readonly type: "number"; - }; - readonly price: { - readonly type: "number"; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - readonly aspectRatio: { - readonly type: "string"; - readonly required: true; - readonly defaultValue: "9:16"; - }; - readonly status: { - readonly type: "string"; - readonly required: true; - readonly defaultValue: "AUDITING"; - }; - readonly isDeleted: { - readonly type: "boolean"; - readonly required: true; - readonly defaultValue: false; - }; - readonly deletedAt: { - readonly type: "date"; - }; - }; - }; - readonly recommendedTemplate: { - readonly fields: { - readonly templateId: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - readonly references: { - readonly model: "template"; - readonly field: "id"; - }; - }; - readonly sortOrder: { - readonly type: "number"; - readonly required: true; - readonly defaultValue: 0; - }; - readonly isActive: { - readonly type: "boolean"; - readonly required: true; - readonly defaultValue: true; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly tag: { - readonly fields: { - readonly ownerId: { - readonly type: "string"; - }; - readonly name: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly nameEn: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly description: { - readonly type: "string"; - readonly defaultValue: ""; - }; - readonly descriptionEn: { - readonly type: "string"; - readonly defaultValue: ""; - }; - readonly sortOrder: { - readonly type: "number"; - readonly required: true; - readonly defaultValue: 0; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly categoryTag: { - readonly fields: { - readonly categoryId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "category"; - readonly field: "id"; - }; - }; - readonly tagId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "tag"; - readonly field: "id"; - }; - }; - readonly sortOrder: { - readonly type: "number"; - readonly defaultValue: 0; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly categoryTagTemplate: { - readonly fields: { - readonly templateId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "template"; - readonly field: "id"; - }; - }; - readonly categoryTagId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "categoryTag"; - readonly field: "id"; - }; - }; - readonly sortOrder: { - readonly type: "number"; - readonly defaultValue: 0; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly activity: { - readonly fields: { - readonly title: { - readonly type: "string"; - readonly required: true; - }; - readonly titleEn: { - readonly type: "string"; - readonly required: true; - }; - readonly desc: { - readonly type: "string"; - readonly required: true; - }; - readonly descEn: { - readonly type: "string"; - readonly required: true; - }; - readonly coverUrl: { - readonly type: "string"; - readonly required: true; - }; - readonly videoUrl: { - readonly type: "string"; - }; - readonly ownerId: { - readonly type: "string"; - }; - readonly link: { - readonly type: "string"; - readonly required: true; - }; - readonly isActive: { - readonly type: "boolean"; - readonly defaultValue: true; - }; - readonly sortOrder: { - readonly type: "number"; - readonly defaultValue: 0; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly aigcBilling: { - readonly fields: { - readonly userId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "user"; - readonly field: "id"; - }; - }; - readonly taskId: { - readonly type: "string"; - readonly required: true; - readonly unique: true; - }; - readonly taskType: { - readonly type: "string"; - readonly required: true; - }; - readonly modelName: { - readonly type: "string"; - }; - readonly status: { - readonly type: "string"; - readonly defaultValue: "pending"; - }; - readonly input: { - readonly type: "json"; - }; - readonly output: { - readonly type: "json"; - }; - readonly price: { - readonly type: "number"; - }; - readonly usage: { - readonly type: "json"; - }; - readonly rating: { - readonly type: "number"; - }; - readonly errorMessage: { - readonly type: "string"; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - }; - }; - readonly templateGeneration: { - readonly fields: { - readonly userId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "user"; - readonly field: "id"; - }; - }; - readonly templateId: { - readonly type: "string"; - readonly required: true; - readonly references: { - readonly model: "template"; - readonly field: "id"; - }; - }; - readonly type: { - readonly type: "string"; - readonly required: true; - }; - readonly resultUrl: { - readonly type: "json"; - readonly required: true; - }; - readonly originalUrl: { - readonly type: "string"; - }; - readonly createdAt: { - readonly type: "date"; - readonly required: true; - }; - readonly updatedAt: { - readonly type: "date"; - readonly required: true; - }; - readonly status: { - readonly type: "string"; - readonly defaultValue: "pending"; - }; - readonly creditsCost: { - readonly type: "number"; - readonly defaultValue: 0; - }; - readonly creditsTransactionId: { - readonly type: "string"; - }; - }; - }; - }; - init(ctx: better_auth.AuthContext): { - options: { - databaseHooks: {}; - }; - }; - endpoints: { - generateRandomUsers: { - (inputCtx_0: { - body: { - count: number; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - users: GeneratedUser[]; - }; - } : { - users: GeneratedUser[]; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - count: zod.ZodNumber; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/random-users/generate"; - }; - createRandomUsers: { - (inputCtx_0: { - body: { - users: { - name: string; - email: string; - username: string; - displayUsername: string; - }[]; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - success: boolean; - created: number; - users: Array<{ - id: string; - name: string; - email: string; - }>; - errors: string[]; - }; - } : { - success: boolean; - created: number; - users: Array<{ - id: string; - name: string; - email: string; - }>; - errors: string[]; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - users: zod.ZodArray>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/random-users/create"; - }; - addUserBalance: { - (inputCtx_0: { - body: { - userId: string; - amount: number; - reason?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - success: boolean; - balance: { - userId: string; - customerId: any; - amount: number; - currentBalance: number; - }; - message: string; - }; - } : { - success: boolean; - balance: { - userId: string; - customerId: any; - amount: number; - currentBalance: number; - }; - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - userId: zod.ZodString; - amount: zod.ZodNumber; - reason: zod.ZodOptional; - }, better_auth.$strip>; - use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>)[]; - metadata: { - SERVER_ONLY: true; - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: { - type: "object"; - properties: { - success: { - type: string; - }; - balance: { - type: string; - properties: { - userId: { - type: string; - }; - customerId: { - type: string; - }; - amount: { - type: string; - }; - currentBalance: { - type: string; - }; - }; - }; - message: { - type: string; - }; - }; - }; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/admin-balance/add-user-balance"; - }; - deductUserBalance: { - (inputCtx_0: { - body: { - userId: string; - amount: number; - reason?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - success: boolean; - balance: { - userId: string; - customerId: any; - amount: number; - currentBalance: number; - }; - message: string; - }; - } : { - success: boolean; - balance: { - userId: string; - customerId: any; - amount: number; - currentBalance: number; - }; - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - userId: zod.ZodString; - amount: zod.ZodNumber; - reason: zod.ZodOptional; - }, better_auth.$strip>; - use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>)[]; - metadata: { - SERVER_ONLY: true; - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: { - type: "object"; - properties: { - success: { - type: string; - }; - balance: { - type: string; - properties: { - userId: { - type: string; - }; - customerId: { - type: string; - }; - amount: { - type: string; - }; - currentBalance: { - type: string; - }; - }; - }; - message: { - type: string; - }; - }; - }; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/admin-balance/deduct-user-balance"; - }; - getUserBalance: { - (inputCtx_0: { - body: { - userId: string; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - success: boolean; - balance: { - userId: string; - customerId: any; - currentBalance: number; - currency: string; - }; - }; - } : { - success: boolean; - balance: { - userId: string; - customerId: any; - currentBalance: number; - currency: string; - }; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - userId: zod.ZodString; - }, better_auth.$strip>; - use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>)[]; - metadata: { - SERVER_ONLY: true; - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: { - type: "object"; - properties: { - success: { - type: string; - }; - balance: { - type: string; - properties: { - userId: { - type: string; - }; - customerId: { - type: string; - }; - currentBalance: { - type: string; - }; - currency: { - type: string; - }; - }; - }; - }; - }; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/admin-balance/get-user-balance"; - }; - listAigcBillings: { - (inputCtx_0: { - body: { - page?: number | undefined; - limit?: number | undefined; - userId?: string | undefined; - taskType?: string | undefined; - status?: string | undefined; - modelName?: string | undefined; - startDate?: string | undefined; - endDate?: string | undefined; - orderBy?: string | undefined; - order?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - billings: { - userId: string; - taskId: string; - taskType: string; - createdAt: Date; - updatedAt: Date; - id: string; - modelName?: string | null | undefined; - status?: string | null | undefined; - input?: any; - output?: any; - price?: number | null | undefined; - usage?: any; - rating?: number | null | undefined; - errorMessage?: string | null | undefined; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }; - } : { - billings: { - userId: string; - taskId: string; - taskType: string; - createdAt: Date; - updatedAt: Date; - id: string; - modelName?: string | null | undefined; - status?: string | null | undefined; - input?: any; - output?: any; - price?: number | null | undefined; - usage?: any; - rating?: number | null | undefined; - errorMessage?: string | null | undefined; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }>; - options: { - method: "POST"; - use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>)[]; - body: zod.ZodObject<{ - page: zod.ZodDefault>; - limit: zod.ZodDefault>; - userId: zod.ZodOptional; - taskType: zod.ZodOptional; - status: zod.ZodOptional; - modelName: zod.ZodOptional; - startDate: zod.ZodOptional; - endDate: zod.ZodOptional; - orderBy: zod.ZodDefault>; - order: zod.ZodDefault>; - }, better_auth.$strip>; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/aigc-billings/list"; - }; - uploadS3: { - (inputCtx_0?: ({ - body?: any; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: FileUploadResponse; - } : FileUploadResponse>; - options: { - method: "POST"; - body: zod.ZodAny; - use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>)[]; - metadata: { - openapi: { - description: string; - tags: string[]; - requestBody: any; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/file/upload-s3"; - }; - compressVideo: { - (inputCtx_0: { - body: { - videoUrl: string; - quality?: "low" | "medium" | "high" | undefined; - format?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: VideoCompressResponse; - } : VideoCompressResponse>; - options: { - method: "POST"; - body: zod.ZodObject<{ - videoUrl: zod.ZodString; - quality: zod.ZodDefault>; - format: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/file/compress-video"; - }; - getAigcModels: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - category?: "image" | "video" | undefined; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - status: boolean; - data: AigcModelInfo[]; - msg: string; - }; - } : { - status: boolean; - data: AigcModelInfo[]; - msg: string; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - category: zod.ZodDefault>>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/aigc/models"; - }; - getAigcTaskStatus: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - taskId: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: AigcTaskStatus; - } : AigcTaskStatus>; - options: { - method: "GET"; - query: zod.ZodObject<{ - taskId: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/aigc/task/get"; - }; - submitTask: { - (inputCtx_0: { - body: { - model_name: string; - prompt: string; - mode?: string | undefined; - aspect_ratio?: string | undefined; - webhook_flag?: boolean | undefined; - watermark?: boolean | undefined; - extra?: string | undefined; - img_url?: string | undefined; - img_list?: any[] | undefined; - duration?: string | undefined; - resolution?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: AigcTaskResponse; - } : AigcTaskResponse>; - options: { - method: "POST"; - body: zod.ZodObject<{ - mode: zod.ZodOptional; - model_name: zod.ZodString; - prompt: zod.ZodString; - aspect_ratio: zod.ZodOptional; - webhook_flag: zod.ZodOptional; - watermark: zod.ZodOptional; - extra: zod.ZodOptional; - img_url: zod.ZodOptional; - img_list: zod.ZodOptional>; - duration: zod.ZodOptional; - resolution: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/aigc/task/submit"; - }; - concatVideos: { - (inputCtx_0: { - body: { - inputs: string[]; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - status: boolean; - data: { - taskId: string; - }; - msg: string; - }; - } : { - status: boolean; - data: { - taskId: string; - }; - msg: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - inputs: zod.ZodArray; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/ffmpeg/task/concat"; - }; - getFfmpegTaskStatus: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - taskId: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - status: boolean; - data: { - taskId: string; - status: string; - error: string; - code: number; - task_type: string; - results: any; - }; - msg: string; - }; - } : { - status: boolean; - data: { - taskId: string; - status: string; - error: string; - code: number; - task_type: string; - results: any; - }; - msg: string; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - taskId: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/ffmpeg/task/get"; - }; - chat: { - (inputCtx_0: { - body: { - prompt: string; - model_name: string; - img_list?: string[] | undefined; - stream?: boolean | undefined; - tools?: string | undefined; - tool_choice?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: Response | { - status: boolean; - msg: string; - data: string; - usage: { - [key: string]: unknown; - }; - }; - } : Response | { - status: boolean; - msg: string; - data: string; - usage: { - [key: string]: unknown; - }; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - prompt: zod.ZodString; - model_name: zod.ZodString; - img_list: zod.ZodOptional>; - stream: zod.ZodOptional; - tools: zod.ZodOptional; - tool_choice: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - 'text/event-stream': { - schema: { - type: string; - }; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/chat"; - }; - listChatModels: { - (inputCtx_0?: ({ - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - data: { - model_name: string; - desc: string; - extra: { - input_supported: string[]; - base_url: string; - }; - }[]; - status: boolean; - msg: string; - }; - } : { - data: { - model_name: string; - desc: string; - extra: { - input_supported: string[]; - base_url: string; - }; - }[]; - status: boolean; - msg: string; - }>; - options: { - method: "GET"; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/chat/models"; - }; - createTemplateGeneration: { - (inputCtx_0: { - body: { - templateId: string; - type: string; - resultUrl?: string[] | undefined; - originalUrl?: string | undefined; - status?: string | undefined; - creditsCost?: number | undefined; - creditsTransactionId?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - userId: string; - templateId: string; - type: string; - resultUrl: any; - createdAt: Date; - updatedAt: Date; - id: string; - originalUrl?: string | null | undefined; - status?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - }; - } : { - userId: string; - templateId: string; - type: string; - resultUrl: any; - createdAt: Date; - updatedAt: Date; - id: string; - originalUrl?: string | null | undefined; - status?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - templateId: zod.ZodString; - type: zod.ZodString; - resultUrl: zod.ZodOptional>; - originalUrl: zod.ZodOptional; - status: zod.ZodDefault; - creditsCost: zod.ZodDefault; - creditsTransactionId: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 201: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template-generation/create"; - }; - deleteTemplateGeneration: { - (inputCtx_0: { - body: { - id: string; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - }; - } : { - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template-generation/delete"; - }; - getTemplateGeneration: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - id: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - userId: string; - templateId: string; - type: string; - resultUrl: any; - createdAt: Date; - updatedAt: Date; - id: string; - originalUrl?: string | null | undefined; - status?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - }; - } : { - userId: string; - templateId: string; - type: string; - resultUrl: any; - createdAt: Date; - updatedAt: Date; - id: string; - originalUrl?: string | null | undefined; - status?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template-generation/get"; - }; - listTemplateGenerations: { - (inputCtx_0: { - body: { - page?: number | undefined; - limit?: number | undefined; - userId?: string | undefined; - templateId?: string | undefined; - status?: string | undefined; - search?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - data: { - user: { - id: string; - name: string; - email: string; - } | undefined; - template: { - id: string; - title: string; - titleEn: string; - coverImageUrl: string; - } | undefined; - userId: string; - templateId: string; - type: string; - resultUrl: any; - createdAt: Date; - updatedAt: Date; - id: string; - originalUrl?: string | null | undefined; - status?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }; - } : { - data: { - user: { - id: string; - name: string; - email: string; - } | undefined; - template: { - id: string; - title: string; - titleEn: string; - coverImageUrl: string; - } | undefined; - userId: string; - templateId: string; - type: string; - resultUrl: any; - createdAt: Date; - updatedAt: Date; - id: string; - originalUrl?: string | null | undefined; - status?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - page: zod.ZodDefault>; - limit: zod.ZodDefault>; - userId: zod.ZodOptional; - templateId: zod.ZodOptional; - status: zod.ZodOptional; - search: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template-generation/list"; - }; - updateTemplateGeneration: { - (inputCtx_0: { - body: { - id: string; - resultUrl?: any; - status?: string | null | undefined; - type?: string | undefined; - originalUrl?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - userId: string; - templateId: string; - type: string; - resultUrl: any; - createdAt: Date; - updatedAt: Date; - id: string; - originalUrl?: string | null | undefined; - status?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - } | null; - } : { - userId: string; - templateId: string; - type: string; - resultUrl: any; - createdAt: Date; - updatedAt: Date; - id: string; - originalUrl?: string | null | undefined; - status?: string | null | undefined; - creditsCost?: number | null | undefined; - creditsTransactionId?: string | null | undefined; - } | null>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly resultUrl: zod.ZodOptional; - readonly status: zod.ZodOptional>>; - readonly type: zod.ZodOptional; - readonly originalUrl: zod.ZodOptional>>; - readonly creditsCost: zod.ZodOptional>>; - readonly creditsTransactionId: zod.ZodOptional>>; - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template-generation/update"; - }; - batchDeleteTemplateGeneration: { - (inputCtx_0: { - body: { - ids: string[]; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - }; - } : { - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - ids: zod.ZodArray; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template-generation/batch-delete"; - }; - createRecommendedTemplate: { - (inputCtx_0: { - body: { - templateId: string; - sortOrder?: number | undefined; - isActive?: boolean | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - templateId: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - }; - } : { - templateId: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - templateId: zod.ZodString; - sortOrder: zod.ZodDefault; - isActive: zod.ZodDefault; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 201: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/recommended/create"; - }; - deleteRecommendedTemplate: { - (inputCtx_0: { - body: { - id: string; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - }; - } : { - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/recommended/delete"; - }; - listRecommendedTemplates: { - (inputCtx_0: { - body: { - page?: number | undefined; - limit?: number | undefined; - isActive?: boolean | undefined; - orderBy?: string | undefined; - order?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - recommendedTemplates: { - template: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - } | undefined; - templateId: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }; - } : { - recommendedTemplates: { - template: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - } | undefined; - templateId: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - page: zod.ZodDefault>; - limit: zod.ZodDefault>; - isActive: zod.ZodOptional; - orderBy: zod.ZodDefault>; - order: zod.ZodDefault>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/recommended/list"; - }; - listPublicRecommendedTemplates: { - (inputCtx_0: { - body: { - limit?: number | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - templates: any[]; - }; - } : { - templates: any[]; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - limit: zod.ZodDefault>; - }, better_auth.$strip>; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/recommended/list/public/"; - }; - updateRecommendedTemplate: { - (inputCtx_0: { - body: { - id: string; - sortOrder?: number | undefined; - isActive?: boolean | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - templateId: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - } | null; - } : { - templateId: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - } | null>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly sortOrder: zod.ZodOptional; - readonly isActive: zod.ZodOptional; - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/recommended/update"; - }; - createActivity: { - (inputCtx_0: { - body: { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - videoUrl?: string | undefined; - isActive?: boolean | undefined; - sortOrder?: number | undefined; - ownerId?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - createdAt: Date; - updatedAt: Date; - id: string; - videoUrl?: string | null | undefined; - ownerId?: string | null | undefined; - isActive?: boolean | null | undefined; - sortOrder?: number | null | undefined; - }; - } : { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - createdAt: Date; - updatedAt: Date; - id: string; - videoUrl?: string | null | undefined; - ownerId?: string | null | undefined; - isActive?: boolean | null | undefined; - sortOrder?: number | null | undefined; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - title: zod.ZodString; - titleEn: zod.ZodString; - desc: zod.ZodString; - descEn: zod.ZodString; - coverUrl: zod.ZodString; - videoUrl: zod.ZodOptional; - link: zod.ZodString; - isActive: zod.ZodDefault; - sortOrder: zod.ZodDefault; - ownerId: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 201: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/activity/create"; - }; - deleteActivity: { - (inputCtx_0: { - body: { - id: string; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - }; - } : { - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/activity/delete"; - }; - getActivity: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - id: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - createdAt: Date; - updatedAt: Date; - id: string; - videoUrl?: string | null | undefined; - ownerId?: string | null | undefined; - isActive?: boolean | null | undefined; - sortOrder?: number | null | undefined; - }; - } : { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - createdAt: Date; - updatedAt: Date; - id: string; - videoUrl?: string | null | undefined; - ownerId?: string | null | undefined; - isActive?: boolean | null | undefined; - sortOrder?: number | null | undefined; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/activity/get"; - }; - listActivities: { - (inputCtx_0: { - body: { - page?: number | undefined; - limit?: number | undefined; - isActive?: boolean | undefined; - orderBy?: string | undefined; - order?: string | undefined; - ownerId?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - activities: { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - createdAt: Date; - updatedAt: Date; - id: string; - videoUrl?: string | null | undefined; - ownerId?: string | null | undefined; - isActive?: boolean | null | undefined; - sortOrder?: number | null | undefined; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }; - } : { - activities: { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - createdAt: Date; - updatedAt: Date; - id: string; - videoUrl?: string | null | undefined; - ownerId?: string | null | undefined; - isActive?: boolean | null | undefined; - sortOrder?: number | null | undefined; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - page: zod.ZodDefault>; - limit: zod.ZodDefault>; - isActive: zod.ZodOptional; - orderBy: zod.ZodDefault>; - order: zod.ZodDefault>; - ownerId: zod.ZodOptional; - }, better_auth.$strip>; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/activities/list"; - }; - updateActivity: { - (inputCtx_0: { - body: { - id: string; - title?: string | undefined; - titleEn?: string | undefined; - ownerId?: string | null | undefined; - sortOrder?: number | null | undefined; - isActive?: boolean | null | undefined; - desc?: string | undefined; - descEn?: string | undefined; - coverUrl?: string | undefined; - videoUrl?: string | null | undefined; - link?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - createdAt: Date; - updatedAt: Date; - id: string; - videoUrl?: string | null | undefined; - ownerId?: string | null | undefined; - isActive?: boolean | null | undefined; - sortOrder?: number | null | undefined; - } | null; - } : { - title: string; - titleEn: string; - desc: string; - descEn: string; - coverUrl: string; - link: string; - createdAt: Date; - updatedAt: Date; - id: string; - videoUrl?: string | null | undefined; - ownerId?: string | null | undefined; - isActive?: boolean | null | undefined; - sortOrder?: number | null | undefined; - } | null>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly title: zod.ZodOptional; - readonly titleEn: zod.ZodOptional; - readonly ownerId: zod.ZodOptional>>; - readonly sortOrder: zod.ZodOptional>>; - readonly isActive: zod.ZodOptional>>; - readonly desc: zod.ZodOptional; - readonly descEn: zod.ZodOptional; - readonly coverUrl: zod.ZodOptional; - readonly videoUrl: zod.ZodOptional>>; - readonly link: zod.ZodOptional; - id: zod.ZodString; - }, better_auth.$strip>; - use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>)[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/activity/update"; - }; - createTag: { - (inputCtx_0: { - body: { - name: string; - nameEn: string; - description?: string | undefined; - descriptionEn?: string | undefined; - sortOrder?: number | undefined; - ownerId?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }; - } : { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - name: zod.ZodString; - nameEn: zod.ZodString; - description: zod.ZodOptional; - descriptionEn: zod.ZodOptional; - sortOrder: zod.ZodDefault>; - ownerId: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 201: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/tags/create"; - }; - deleteTag: { - (inputCtx_0: { - body: { - id: string; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - }; - } : { - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/tags/delete"; - }; - getTag: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - id: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - categories: ({ - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - } | null)[]; - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }; - } : { - categories: ({ - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - } | null)[]; - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/tags/get"; - }; - getTagByName: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - name: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - templates: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - }[]; - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }; - } : { - templates: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - }[]; - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - name: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/tags/get-by-name"; - }; - listTags: { - (inputCtx_0: { - body: { - page?: number | undefined; - limit?: number | undefined; - search?: string | undefined; - orderBy?: string | undefined; - order?: string | undefined; - ownerId?: string | undefined; - categoryIds?: string[] | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - tags: any[]; - total: number; - page: number; - limit: number; - totalPages: number; - }; - } : { - tags: any[]; - total: number; - page: number; - limit: number; - totalPages: number; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - page: zod.ZodDefault>; - limit: zod.ZodDefault>; - search: zod.ZodOptional; - orderBy: zod.ZodDefault>; - order: zod.ZodDefault>; - ownerId: zod.ZodOptional; - categoryIds: zod.ZodOptional>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/tags/list"; - }; - updateTag: { - (inputCtx_0: { - body: { - id: string; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - ownerId?: string | null | undefined; - name?: string | undefined; - nameEn?: string | undefined; - sortOrder?: number | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - } | null; - } : { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - } | null>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly description: zod.ZodOptional>>; - readonly descriptionEn: zod.ZodOptional>>; - readonly ownerId: zod.ZodOptional>>; - readonly name: zod.ZodOptional; - readonly nameEn: zod.ZodOptional; - readonly sortOrder: zod.ZodOptional; - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/tags/update"; - }; - updateCategoryTag: { - (inputCtx_0: { - body: { - id: string; - sortOrder: number; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: any; - } : any>; - options: { - method: "POST"; - body: zod.ZodObject<{ - id: zod.ZodString; - sortOrder: zod.ZodNumber; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/tags/update-category-tag"; - }; - createCategory: { - (inputCtx_0: { - body: { - name: string; - nameEn: string; - description?: string | undefined; - descriptionEn?: string | undefined; - sortOrder?: number | undefined; - isActive?: boolean | undefined; - tagIds?: string[] | undefined; - ownerId?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - tags: { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }[]; - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - }; - } : { - tags: { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }[]; - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - name: zod.ZodString; - nameEn: zod.ZodString; - description: zod.ZodDefault; - descriptionEn: zod.ZodDefault; - sortOrder: zod.ZodDefault; - isActive: zod.ZodDefault; - tagIds: zod.ZodOptional>; - ownerId: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 201: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/category/create"; - }; - deleteCategory: { - (inputCtx_0: { - body: { - id: string; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - }; - } : { - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/category/delete"; - }; - getCategory: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - id: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - tags: { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }[]; - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - }; - } : { - tags: { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }[]; - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/category/get"; - }; - getCategoryByName: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - name: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - tags: { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }[]; - templates: any[]; - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - }; - } : { - tags: { - name: string; - nameEn: string; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - description?: string | null | undefined; - descriptionEn?: string | null | undefined; - }[]; - templates: any[]; - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - name: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/category/get-by-name"; - }; - listCategories: { - (inputCtx_0: { - body: { - page?: number | undefined; - limit?: number | undefined; - isActive?: boolean | undefined; - orderBy?: string | undefined; - order?: string | undefined; - search?: string | undefined; - categoryIds?: string[] | undefined; - withChildren?: boolean | undefined; - ownerId?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - categories: any[]; - total: number; - page: number; - limit: number; - }; - } : { - categories: any[]; - total: number; - page: number; - limit: number; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - page: zod.ZodDefault>; - limit: zod.ZodDefault>; - isActive: zod.ZodOptional; - orderBy: zod.ZodDefault>; - order: zod.ZodDefault>; - search: zod.ZodOptional; - categoryIds: zod.ZodOptional>; - withChildren: zod.ZodOptional; - ownerId: zod.ZodOptional; - }, better_auth.$strip>; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/category/list"; - }; - updateCategory: { - (inputCtx_0: { - body: { - id: string; - description?: string | undefined; - descriptionEn?: string | undefined; - ownerId?: string | null | undefined; - name?: string | undefined; - nameEn?: string | undefined; - sortOrder?: number | undefined; - isActive?: boolean | undefined; - tagIds?: string[] | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - } | null; - } : { - name: string; - nameEn: string; - description: string; - descriptionEn: string; - sortOrder: number; - isActive: boolean; - createdAt: Date; - updatedAt: Date; - id: string; - ownerId?: string | null | undefined; - } | null>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly description: zod.ZodOptional; - readonly descriptionEn: zod.ZodOptional; - readonly ownerId: zod.ZodOptional>>; - readonly name: zod.ZodOptional; - readonly nameEn: zod.ZodOptional; - readonly sortOrder: zod.ZodOptional; - readonly isActive: zod.ZodOptional; - id: zod.ZodString; - tagIds: zod.ZodOptional>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/category/update"; - }; - createTemplate: { - (inputCtx_0: { - body: { - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - sortOrder: number; - coverImageUrl: string; - previewUrl: string; - aspectRatio: string; - status: string; - categoryTagSortOrders: { - categoryId: string; - tagId: string; - sortOrder: number; - }[]; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - }; - } : { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly title: zod.ZodString; - readonly titleEn: zod.ZodString; - readonly description: zod.ZodString; - readonly descriptionEn: zod.ZodString; - readonly content: zod.ZodAny; - readonly ownerId: zod.ZodNullable>; - readonly sortOrder: zod.ZodNumber; - readonly coverImageUrl: zod.ZodString; - readonly previewUrl: zod.ZodString; - readonly formSchema: zod.ZodNullable>; - readonly uploadSapecifications: zod.ZodNullable>; - readonly uploadSapecificationsEn: zod.ZodNullable>; - readonly costPrice: zod.ZodNullable>; - readonly price: zod.ZodNullable>; - readonly aspectRatio: zod.ZodString; - readonly status: zod.ZodString; - categoryTagSortOrders: zod.ZodArray>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 201: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/create"; - }; - deleteTemplate: { - (inputCtx_0: { - body: { - id: string; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - }; - } : { - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/delete"; - }; - getTemplate: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - id: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - category: undefined; - tags: any[]; - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - }; - } : { - category: undefined; - tags: any[]; - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/get"; - }; - listTemplates: { - (inputCtx_0: { - body: { - page?: number | undefined; - limit?: number | undefined; - search?: string | undefined; - categoryId?: string | undefined; - status?: string | undefined; - ownerId?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - templates: { - categoryTags: any[]; - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }; - } : { - templates: { - categoryTags: any[]; - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - }[]; - total: number; - page: number; - limit: number; - totalPages: number; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - page: zod.ZodDefault>; - limit: zod.ZodDefault>; - search: zod.ZodOptional; - categoryId: zod.ZodOptional; - status: zod.ZodOptional; - ownerId: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/list"; - }; - updateTemplate: { - (inputCtx_0: { - body: { - id: string; - title?: string | undefined; - titleEn?: string | undefined; - description?: string | undefined; - descriptionEn?: string | undefined; - content?: any; - sortOrder?: number | undefined; - coverImageUrl?: string | undefined; - previewUrl?: string | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - aspectRatio?: string | undefined; - status?: string | undefined; - categoryTagSortOrders?: { - categoryId: string; - tagId: string; - sortOrder: number; - }[] | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - } | null; - } : { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - coverImageUrl: string; - previewUrl: string; - content: any; - sortOrder: number; - createdAt: Date; - updatedAt: Date; - aspectRatio: string; - status: string; - isDeleted: boolean; - id: string; - ownerId?: string | null | undefined; - formSchema?: any; - uploadSapecifications?: string | null | undefined; - uploadSapecificationsEn?: string | null | undefined; - costPrice?: number | null | undefined; - price?: number | null | undefined; - deletedAt?: Date | null | undefined; - } | null>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly title: zod.ZodOptional; - readonly titleEn: zod.ZodOptional; - readonly description: zod.ZodOptional; - readonly descriptionEn: zod.ZodOptional; - readonly content: zod.ZodOptional; - readonly sortOrder: zod.ZodOptional; - readonly coverImageUrl: zod.ZodOptional; - readonly previewUrl: zod.ZodOptional; - readonly formSchema: zod.ZodOptional>>; - readonly uploadSapecifications: zod.ZodOptional>>; - readonly uploadSapecificationsEn: zod.ZodOptional>>; - readonly costPrice: zod.ZodOptional>>; - readonly price: zod.ZodOptional>>; - readonly aspectRatio: zod.ZodOptional; - readonly status: zod.ZodOptional; - id: zod.ZodString; - categoryTagSortOrders: zod.ZodOptional>>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/update"; - }; - runTemplate: { - (inputCtx_0: { - body: { - templateId: string; - data: any; - identifier?: string | undefined; - originalUrl?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - generationId: string; - }; - } : { - generationId: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - templateId: zod.ZodString; - data: zod.ZodAny; - identifier: zod.ZodOptional; - originalUrl: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/template/run"; - }; - getProjects: { - (inputCtx_0: { - body: { - page?: number | undefined; - limit?: number | undefined; - search?: string | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - projects: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - createdAt: Date; - updatedAt: Date; - id: string; - sourceTemplateId?: string | null | undefined; - resultUrl?: string | null | undefined; - }[]; - total: number; - page: number; - limit: number; - }; - } : { - projects: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - createdAt: Date; - updatedAt: Date; - id: string; - sourceTemplateId?: string | null | undefined; - resultUrl?: string | null | undefined; - }[]; - total: number; - page: number; - limit: number; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - page: zod.ZodDefault>; - limit: zod.ZodDefault>; - search: zod.ZodOptional; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/project/list"; - }; - createProject: { - (inputCtx_0: { - body: { - title: string; - content: any; - sourceTemplateId?: string | null | undefined; - titleEn?: string | undefined; - description?: string | undefined; - descriptionEn?: string | undefined; - resultUrl?: string | null | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - createdAt: Date; - updatedAt: Date; - id: string; - sourceTemplateId?: string | null | undefined; - resultUrl?: string | null | undefined; - }; - } : { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - createdAt: Date; - updatedAt: Date; - id: string; - sourceTemplateId?: string | null | undefined; - resultUrl?: string | null | undefined; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly title: zod.ZodString; - readonly content: zod.ZodAny; - readonly sourceTemplateId: zod.ZodOptional>>; - readonly titleEn: zod.ZodOptional; - readonly description: zod.ZodOptional; - readonly descriptionEn: zod.ZodOptional; - readonly resultUrl: zod.ZodOptional>>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 201: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/project/create"; - }; - getProject: { - (inputCtx_0: { - body?: undefined; - } & { - method?: "GET" | undefined; - } & { - query: { - id: string; - }; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - createdAt: Date; - updatedAt: Date; - id: string; - sourceTemplateId?: string | null | undefined; - resultUrl?: string | null | undefined; - }; - } : { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - createdAt: Date; - updatedAt: Date; - id: string; - sourceTemplateId?: string | null | undefined; - resultUrl?: string | null | undefined; - }>; - options: { - method: "GET"; - query: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/project/get"; - }; - updateProject: { - (inputCtx_0: { - body: { - id: string; - sourceTemplateId?: string | null | undefined; - title?: string | undefined; - titleEn?: string | undefined; - description?: string | undefined; - descriptionEn?: string | undefined; - resultUrl?: string | null | undefined; - content?: any; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - createdAt: Date; - updatedAt: Date; - id: string; - sourceTemplateId?: string | null | undefined; - resultUrl?: string | null | undefined; - } | null; - } : { - userId: string; - title: string; - titleEn: string; - description: string; - descriptionEn: string; - content: any; - createdAt: Date; - updatedAt: Date; - id: string; - sourceTemplateId?: string | null | undefined; - resultUrl?: string | null | undefined; - } | null>; - options: { - method: "POST"; - body: zod.ZodObject<{ - readonly sourceTemplateId: zod.ZodOptional>>; - readonly title: zod.ZodOptional; - readonly titleEn: zod.ZodOptional; - readonly description: zod.ZodOptional; - readonly descriptionEn: zod.ZodOptional; - readonly resultUrl: zod.ZodOptional>>; - readonly content: zod.ZodOptional; - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/project/update"; - }; - deleteProject: { - (inputCtx_0: { - body: { - id: string; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - }; - } : { - message: string; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - id: zod.ZodString; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/project/delete"; - }; - transferProject: { - (inputCtx_0: { - body: { - targetUserEmail: string; - projectIds: string[]; - mode?: "copy" | "transfer" | undefined; - }; - } & { - method?: "POST" | undefined; - } & { - query?: Record | undefined; - } & { - params?: Record; - } & { - request?: Request; - } & { - headers?: HeadersInit; - } & { - asResponse?: boolean; - returnHeaders?: boolean; - use?: better_call.Middleware[]; - path?: string; - } & { - asResponse?: AsResponse | undefined; - returnHeaders?: ReturnHeaders | undefined; - }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? { - headers: Headers; - response: { - message: string; - targetUserId: string; - targetUserEmail: string; - mode: "copy" | "transfer"; - processedCount: number; - projectIds: string[]; - }; - } : { - message: string; - targetUserId: string; - targetUserEmail: string; - mode: "copy" | "transfer"; - processedCount: number; - projectIds: string[]; - }>; - options: { - method: "POST"; - body: zod.ZodObject<{ - targetUserEmail: zod.ZodEmail; - projectIds: zod.ZodArray; - mode: zod.ZodDefault>>; - }, better_auth.$strip>; - use: (((inputContext: better_call.MiddlewareInputContext) => Promise<{ - session: { - session: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - userId: string; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; - }; - user: Record & { - id: string; - createdAt: Date; - updatedAt: Date; - email: string; - emailVerified: boolean; - name: string; - image?: string | null | undefined; - }; - }; - }>) | (>(inputContext: InputCtx) => Promise))[]; - metadata: { - openapi: { - description: string; - tags: string[]; - responses: { - 200: { - description: string; - content: { - 'application/json': { - schema: any; - }; - }; - }; - }; - }; - }; - } & { - use: any[]; - }; - path: "/loomart/project/transfer"; - }; - }; - $Infer: {}; -}; - -type LoomartType = ReturnType; -declare module 'better-auth' { - interface Context { - loomart?: LoomartOptions; - } -} - -export { ac, contentadmin, defaultStatements, editor, getLoomartOptions, getZodSchemaFromModel, loomart, roles, superadmin, user }; -export type { AigcModelInfo, AigcTaskResponse, AigcTaskStatus, FileUploadResponse, GeneratedUser, InferZodSchema, LoomartOptions, LoomartType, Statements, VideoCompressRequest, VideoCompressResponse }; diff --git a/lib/plugins/stripe-plugin.ts b/lib/plugins/stripe-plugin.ts new file mode 100644 index 0000000..50f604a --- /dev/null +++ b/lib/plugins/stripe-plugin.ts @@ -0,0 +1,37 @@ +import type { BetterAuthClientPlugin } from "better-auth"; +import type { stripe } from "./stripe"; + +export const stripeClient = < + O extends { + subscription: boolean; + }, +>( + options?: O, +) => { + return { + id: "stripe-client", + $InferServerPlugin: {} as ReturnType< + typeof stripe< + O["subscription"] extends true + ? { + stripeClient: any; + stripeWebhookSecret: string; + subscription: { + enabled: true; + plans: []; + }; + } + : { + stripeClient: any; + stripeWebhookSecret: string; + } + > + >, + pathMethods: { + "/subscription/restore": "POST", + "/subscription/billing-portal": "POST", + "/alipay/app-pay": "POST", + "/alipay/auth-info": "POST", + }, + } satisfies BetterAuthClientPlugin; +}; diff --git a/lib/plugins/stripe.d.ts b/lib/plugins/stripe.d.ts new file mode 100644 index 0000000..35850c6 --- /dev/null +++ b/lib/plugins/stripe.d.ts @@ -0,0 +1,422 @@ +import { GenericEndpointContext, User, Session, InferOptionSchema, BetterAuthPlugin } from 'better-auth'; +import Stripe from 'stripe'; + +declare const subscriptions: { + subscription: { + fields: { + plan: { + type: "string"; + required: true; + }; + referenceId: { + type: "string"; + required: true; + }; + stripeCustomerId: { + type: "string"; + required: false; + }; + stripeSubscriptionId: { + type: "string"; + required: false; + unique: true; + }; + status: { + type: "string"; + defaultValue: string; + }; + periodStart: { + type: "date"; + required: false; + }; + periodEnd: { + type: "date"; + required: false; + }; + trialStart: { + type: "date"; + required: false; + }; + trialEnd: { + type: "date"; + required: false; + }; + cancelAtPeriodEnd: { + type: "boolean"; + required: false; + defaultValue: false; + }; + seats: { + type: "number"; + required: false; + }; + }; + }; +}; +declare const user: { + user: { + fields: { + stripeCustomerId: { + type: "string"; + required: false; + }; + metadata: { + type: "json"; + required: false; + }; + }; + }; +}; + +type StripePlan = { + /** + * Monthly price id + */ + priceId?: string; + /** + * To use lookup key instead of price id + * + * https://docs.stripe.com/products-prices/ + * manage-prices#lookup-keys + */ + lookupKey?: string; + /** + * A yearly discount price id + * + * useful when you want to offer a discount for + * yearly subscription + */ + annualDiscountPriceId?: string; + /** + * To use lookup key instead of price id + * + * https://docs.stripe.com/products-prices/ + * manage-prices#lookup-keys + */ + annualDiscountLookupKey?: string; + /** + * Plan name + */ + name: string; + /** + * Limits for the plan + */ + limits?: Record; + /** + * Plan group name + * + * useful when you want to group plans or + * when a user can subscribe to multiple plans. + */ + group?: string; + /** + * Free trial days + */ + freeTrial?: { + /** + * Number of days + */ + days: number; + /** + * A function that will be called when the trial + * starts. + * + * @param subscription + * @returns + */ + onTrialStart?: (subscription: Subscription) => Promise; + /** + * A function that will be called when the trial + * ends + * + * @param subscription - Subscription + * @returns + */ + onTrialEnd?: (data: { + subscription: Subscription; + }, ctx: GenericEndpointContext) => Promise; + /** + * A function that will be called when the trial + * expired. + * @param subscription - Subscription + * @returns + */ + onTrialExpired?: (subscription: Subscription, ctx: GenericEndpointContext) => Promise; + }; +}; +type actionType = 'upgrade-subscription' | 'list-subscription' | 'cancel-subscription' | 'restore-subscription' | 'meter-event' | 'credit-topup' | 'adjust-meter-event' | 'meter-event-summary' | 'create-subscription' | 'get-pricing-table' | 'billing-portal'; +interface Subscription { + /** + * Database identifier + */ + id: string; + /** + * The plan name + */ + plan: string; + /** + * Stripe customer id + */ + stripeCustomerId?: string; + /** + * Stripe subscription id + */ + stripeSubscriptionId?: string; + /** + * Trial start date + */ + trialStart?: Date; + /** + * Trial end date + */ + trialEnd?: Date; + /** + * Price Id for the subscription + */ + priceId?: string; + /** + * To what reference id the subscription belongs to + * @example + * - userId for a user + * - workspace id for a saas platform + * - website id for a hosting platform + * + * @default - userId + */ + referenceId: string; + /** + * Subscription status + */ + status: 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'paused' | 'trialing' | 'unpaid'; + /** + * The billing cycle start date + */ + periodStart?: Date; + /** + * The billing cycle end date + */ + periodEnd?: Date; + /** + * Cancel at period end + */ + cancelAtPeriodEnd?: boolean; + /** + * A field to group subscriptions so you can have multiple subscriptions + * for one reference id + */ + groupId?: string; + /** + * Number of seats for the subscription (useful for team plans) + */ + seats?: number; +} +interface AlipayNotifyData { + notify_time: string; + notify_type: string; + notify_id: string; + app_id: string; + charset: string; + version: string; + sign_type: string; + sign: string; + trade_no: string; + out_trade_no: string; + out_biz_no?: string; + buyer_id?: string; + buyer_logon_id?: string; + seller_id?: string; + seller_email?: string; + trade_status: 'WAIT_BUYER_PAY' | 'TRADE_CLOSED' | 'TRADE_SUCCESS' | 'TRADE_FINISHED'; + total_amount: string; + receipt_amount?: string; + invoice_amount?: string; + buyer_pay_amount?: string; + point_amount?: string; + refund_fee?: string; + subject?: string; + body?: string; + gmt_create?: string; + gmt_payment?: string; + gmt_refund?: string; + gmt_close?: string; + fund_bill_list?: string; + passback_params?: string; + voucher_detail_list?: string; + [key: string]: any; +} +interface StripeOptions { + /** + * Stripe Client + */ + stripeClient: Stripe; + /** + * Stripe Webhook Secret + * + * @description Stripe webhook secret key + */ + stripeWebhookSecret: string; + /** + * Enable customer creation when a user signs up + */ + createCustomerOnSignUp?: boolean; + /** + * A callback to run after a customer has been created + * @param customer - Customer Data + * @param stripeCustomer - Stripe Customer Data + * @returns + */ + onCustomerCreate?: (data: { + stripeCustomer: Stripe.Customer; + user: User & { + stripeCustomerId: string; + }; + }, ctx: GenericEndpointContext) => Promise; + /** + * A custom function to get the customer create + * params + * @param data - data containing user and session + * @returns + */ + getCustomerCreateParams?: (user: User, ctx: GenericEndpointContext) => Promise>; + /** + * Subscriptions + */ + subscription?: { + enabled: boolean; + /** + * Subscription Configuration + */ + /** + * List of plan + */ + plans: StripePlan[] | (() => StripePlan[] | Promise); + /** + * Require email verification before a user is allowed to upgrade + * their subscriptions + * + * @default false + */ + requireEmailVerification?: boolean; + /** + * A callback to run after a user has subscribed to a package + * @param event - Stripe Event + * @param subscription - Subscription Data + * @returns + */ + onSubscriptionComplete?: (data: { + event: Stripe.Event; + stripeSubscription: Stripe.Subscription; + subscription: Subscription; + plan: StripePlan; + }, ctx: GenericEndpointContext) => Promise; + /** + * A callback to run after a user is about to cancel their subscription + * @returns + */ + onSubscriptionUpdate?: (data: { + event: Stripe.Event; + subscription: Subscription; + }) => Promise; + /** + * A callback to run after a user is about to cancel their subscription + * @returns + */ + onSubscriptionCancel?: (data: { + event?: Stripe.Event; + subscription: Subscription; + stripeSubscription: Stripe.Subscription; + cancellationDetails?: Stripe.Subscription.CancellationDetails | null; + }) => Promise; + /** + * A function to check if the reference id is valid + * and belongs to the user + * + * @param data - data containing user, session and referenceId + * @param ctx - the context object + * @returns + */ + authorizeReference?: (data: { + user: User & Record; + session: Session & Record; + referenceId: string; + action: actionType; + }, ctx: GenericEndpointContext) => Promise; + /** + * A callback to run after a user has deleted their subscription + * @returns + */ + onSubscriptionDeleted?: (data: { + event: Stripe.Event; + stripeSubscription: Stripe.Subscription; + subscription: Subscription; + }) => Promise; + /** + * parameters for session create params + * + * @param data - data containing user, session and plan + * @param ctx - the context object + */ + getCheckoutSessionParams?: (data: { + user: User & Record; + session: Session & Record; + plan: StripePlan; + subscription: Subscription; + }, ctx: GenericEndpointContext) => Promise<{ + params?: Stripe.Checkout.SessionCreateParams; + options?: Stripe.RequestOptions; + }> | { + params?: Stripe.Checkout.SessionCreateParams; + options?: Stripe.RequestOptions; + }; + /** + * Enable organization subscription + */ + organization?: { + enabled: boolean; + }; + }; + /** + * A callback to run after a stripe event is received + * @param event - Stripe Event + * @returns + */ + onEvent?: (event: Stripe.Event) => Promise; + /** + * A callback to run after a one-time payment checkout is completed + * (e.g., credit top-up) + * @param checkoutSession - Stripe Checkout Session + * @param ctx - Generic Endpoint Context + * @returns + */ + onCheckoutComplete?: (data: { + session: Stripe.Checkout.Session; + }, ctx: GenericEndpointContext) => Promise; + /** + * Schema for the stripe plugin + */ + schema?: InferOptionSchema; + /** + * Pricing table config + */ + pricingTable?: { + id: string; + key: string; + meteredPriceId: string; + }; + /** + * Alipay Configuration + */ + alipay?: { + endpoint: string; + /** + * Callback when Alipay sends a webhook notification + * @param data The notification parameters from Alipay + */ + beforeNotify?: (data: AlipayNotifyData, ctx: GenericEndpointContext) => Promise; + }; +} + +declare const stripe: (options: O) => BetterAuthPlugin; + +export { stripe }; +export type { StripePlan, Subscription }; diff --git a/lib/storage.native.ts b/lib/storage.native.ts new file mode 100644 index 0000000..3f1fa28 --- /dev/null +++ b/lib/storage.native.ts @@ -0,0 +1,15 @@ +import * as SecureStore from "expo-secure-store"; + +export const storage = { + async getItem(key: string): Promise { + return await SecureStore.getItemAsync(key); + }, + + async setItem(key: string, value: string): Promise { + await SecureStore.setItemAsync(key, value); + }, + + async removeItem(key: string): Promise { + await SecureStore.deleteItemAsync(key); + }, +}; diff --git a/lib/storage.ts b/lib/storage.ts new file mode 100644 index 0000000..73c788e --- /dev/null +++ b/lib/storage.ts @@ -0,0 +1,17 @@ +declare const window: any; +export const storage = { + async getItem(key: string): Promise { + if (typeof window === "undefined") return null; + return window.localStorage.getItem(key); + }, + + async setItem(key: string, value: string): Promise { + if (typeof window === "undefined") return; + window.localStorage.setItem(key, value); + }, + + async removeItem(key: string): Promise { + if (typeof window === "undefined") return; + window.localStorage.removeItem(key); + }, +};