@htlkg/data 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.ts +70 -0
- package/dist/client/index.js +33 -0
- package/dist/client/index.js.map +1 -0
- package/dist/content-collections/index.d.ts +246 -0
- package/dist/content-collections/index.js +337 -0
- package/dist/content-collections/index.js.map +1 -0
- package/dist/hooks/index.d.ts +200 -0
- package/dist/hooks/index.js +224 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +711 -0
- package/dist/index.js.map +1 -0
- package/dist/mutations/index.d.ts +231 -0
- package/dist/mutations/index.js +134 -0
- package/dist/mutations/index.js.map +1 -0
- package/dist/queries/index.d.ts +386 -0
- package/dist/queries/index.js +352 -0
- package/dist/queries/index.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/aws-amplify@6.15.8/node_modules/aws-amplify/dist/esm/api/index.mjs","../src/client/index.ts","../src/queries/brands.ts","../src/queries/accounts.ts","../src/queries/users.ts","../src/queries/products.ts","../src/mutations/brands.ts","../src/mutations/accounts.ts","../src/mutations/users.ts","../src/hooks/useBrands.ts","../src/hooks/useAccounts.ts","../src/hooks/useUsers.ts","../src/hooks/useProducts.ts"],"sourcesContent":["export * from '@aws-amplify/api';\n//# sourceMappingURL=index.mjs.map\n","/**\n * GraphQL Client for @htlkg/data\n *\n * Provides both client-side and server-side GraphQL capabilities using AWS Amplify Data.\n * The server-side functions use the Amplify Astro adapter for proper SSR support.\n */\n\nimport type { AstroCookies } from \"astro\";\nimport { generateClient as generateDataClient } from \"aws-amplify/data\";\n\n/**\n * Generate a client-side GraphQL client for use in Vue components and browser contexts\n * This is SSR-safe and should be called within a component's setup function or after hydration\n *\n * @example\n * ```typescript\n * import type { Schema } from '@backend/data/resource';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const { data: brands } = await client.models.Brand.list();\n * ```\n */\nexport function generateClient<\n\tTSchema extends Record<string, unknown> = Record<string, unknown>,\n>(): ReturnType<typeof generateDataClient<TSchema>> {\n\treturn generateDataClient<TSchema>();\n}\n\n/**\n * Configuration for Amplify Astro adapter\n */\nexport interface AstroAmplifyConfig {\n\tAPI?: {\n\t\tGraphQL?: {\n\t\t\tendpoint: string;\n\t\t\tregion: string;\n\t\t\tdefaultAuthMode: string;\n\t\t};\n\t};\n\tAuth?: {\n\t\tCognito?: {\n\t\t\tuserPoolId: string;\n\t\t\tuserPoolClientId: string;\n\t\t\tidentityPoolId?: string;\n\t\t};\n\t};\n}\n\n/**\n * Generate a server-side GraphQL client with cookie-based authentication\n * Use this in Astro pages and API routes for server-side GraphQL operations\n *\n * Note: This is a placeholder that will be properly implemented once the\n * Amplify Astro adapter is migrated to the modular architecture.\n * For now, import generateServerClient from @htlkg/shared/lib/graphql directly.\n *\n * @example\n * ```typescript\n * import type { Schema } from '../amplify/data/resource';\n * import { generateServerClient } from '@htlkg/data/client';\n * import outputs from '../amplify_outputs.json';\n *\n * const client = generateServerClient<Schema>({\n * cookies: Astro.cookies,\n * config: outputs\n * });\n * const { data: brands } = await client.models.Brand.list();\n * ```\n */\nexport function generateServerClient<\n\tTSchema extends Record<string, unknown> = Record<string, unknown>,\n>(options: { cookies: AstroCookies; config: AstroAmplifyConfig }): any {\n\tthrow new Error(\n\t\t\"[generateServerClient] Not yet implemented in modular architecture. \" +\n\t\t\"Please use generateServerClient from @htlkg/shared/lib/graphql for now. \" +\n\t\t\"This will be properly implemented when the Amplify Astro adapter is migrated.\",\n\t);\n}\n","/**\n * Brand Query Functions\n *\n * Provides query functions for fetching brand data from the GraphQL API.\n */\n\nimport type { Brand } from \"@htlkg/core/types\";\n\n/**\n * Get a single brand by ID\n *\n * @example\n * ```typescript\n * import { getBrand } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brand = await getBrand(client, 'brand-123');\n * ```\n */\nexport async function getBrand<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<Brand | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Brand.get({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getBrand] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Brand;\n\t} catch (error) {\n\t\tconsole.error(\"[getBrand] Error fetching brand:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List all brands with optional filtering\n *\n * @example\n * ```typescript\n * import { listBrands } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brands = await listBrands(client, {\n * filter: { status: { eq: 'active' } }\n * });\n * ```\n */\nexport async function listBrands<TClient = any>(\n\tclient: TClient,\n\toptions?: {\n\t\tfilter?: any;\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: Brand[]; nextToken?: string }> {\n\ttry {\n\t\tconst { data, errors, nextToken } = await (client as any).models.Brand.list(\n\t\t\toptions,\n\t\t);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[listBrands] GraphQL errors:\", errors);\n\t\t\treturn { items: [], nextToken: undefined };\n\t\t}\n\n\t\treturn {\n\t\t\titems: (data || []) as Brand[],\n\t\t\tnextToken,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[listBrands] Error fetching brands:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Get a brand with its product instances\n *\n * @example\n * ```typescript\n * import { getBrandWithProducts } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brand = await getBrandWithProducts(client, 'brand-123');\n * ```\n */\nexport async function getBrandWithProducts<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<Brand | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Brand.get(\n\t\t\t{ id },\n\t\t\t{\n\t\t\t\tselectionSet: [\n\t\t\t\t\t\"id\",\n\t\t\t\t\t\"name\",\n\t\t\t\t\t\"accountId\",\n\t\t\t\t\t\"logo\",\n\t\t\t\t\t\"timezone\",\n\t\t\t\t\t\"status\",\n\t\t\t\t\t\"settings\",\n\t\t\t\t\t\"productInstances.*\",\n\t\t\t\t],\n\t\t\t},\n\t\t);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getBrandWithProducts] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Brand;\n\t} catch (error) {\n\t\tconsole.error(\"[getBrandWithProducts] Error fetching brand:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List brands by account ID\n *\n * @example\n * ```typescript\n * import { listBrandsByAccount } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brands = await listBrandsByAccount(client, 'account-123');\n * ```\n */\nexport async function listBrandsByAccount<TClient = any>(\n\tclient: TClient,\n\taccountId: string,\n\toptions?: {\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: Brand[]; nextToken?: string }> {\n\treturn listBrands(client, {\n\t\tfilter: { accountId: { eq: accountId } },\n\t\t...options,\n\t});\n}\n\n/**\n * List active brands\n *\n * @example\n * ```typescript\n * import { listActiveBrands } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brands = await listActiveBrands(client);\n * ```\n */\nexport async function listActiveBrands<TClient = any>(\n\tclient: TClient,\n\toptions?: {\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: Brand[]; nextToken?: string }> {\n\treturn listBrands(client, {\n\t\tfilter: { status: { eq: \"active\" } },\n\t\t...options,\n\t});\n}\n","/**\n * Account Query Functions\n *\n * Provides query functions for fetching account data from the GraphQL API.\n */\n\nimport type { Account } from \"@htlkg/core/types\";\n\n/**\n * Get a single account by ID\n *\n * @example\n * ```typescript\n * import { getAccount } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const account = await getAccount(client, 'account-123');\n * ```\n */\nexport async function getAccount<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<Account | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Account.get({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getAccount] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Account;\n\t} catch (error) {\n\t\tconsole.error(\"[getAccount] Error fetching account:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List all accounts with optional filtering\n *\n * @example\n * ```typescript\n * import { listAccounts } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const accounts = await listAccounts(client);\n * ```\n */\nexport async function listAccounts<TClient = any>(\n\tclient: TClient,\n\toptions?: {\n\t\tfilter?: any;\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: Account[]; nextToken?: string }> {\n\ttry {\n\t\tconst { data, errors, nextToken } = await (\n\t\t\tclient as any\n\t\t).models.Account.list(options);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[listAccounts] GraphQL errors:\", errors);\n\t\t\treturn { items: [], nextToken: undefined };\n\t\t}\n\n\t\treturn {\n\t\t\titems: (data || []) as Account[],\n\t\t\tnextToken,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[listAccounts] Error fetching accounts:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Get an account with its brands\n *\n * @example\n * ```typescript\n * import { getAccountWithBrands } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const account = await getAccountWithBrands(client, 'account-123');\n * ```\n */\nexport async function getAccountWithBrands<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<Account | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Account.get(\n\t\t\t{ id },\n\t\t\t{\n\t\t\t\tselectionSet: [\n\t\t\t\t\t\"id\",\n\t\t\t\t\t\"name\",\n\t\t\t\t\t\"logo\",\n\t\t\t\t\t\"subscription\",\n\t\t\t\t\t\"settings\",\n\t\t\t\t\t\"brands.*\",\n\t\t\t\t],\n\t\t\t},\n\t\t);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getAccountWithBrands] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Account;\n\t} catch (error) {\n\t\tconsole.error(\"[getAccountWithBrands] Error fetching account:\", error);\n\t\tthrow error;\n\t}\n}\n","/**\n * User Query Functions\n *\n * Provides query functions for fetching user data from the GraphQL API.\n */\n\nimport type { User } from \"@htlkg/core/types\";\n\n/**\n * Get a single user by ID\n *\n * @example\n * ```typescript\n * import { getUser } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const user = await getUser(client, 'user-123');\n * ```\n */\nexport async function getUser<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<User | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.User.get({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getUser] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as User;\n\t} catch (error) {\n\t\tconsole.error(\"[getUser] Error fetching user:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Get a user by Cognito ID\n *\n * @example\n * ```typescript\n * import { getUserByCognitoId } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const user = await getUserByCognitoId(client, 'cognito-id-123');\n * ```\n */\nexport async function getUserByCognitoId<TClient = any>(\n\tclient: TClient,\n\tcognitoId: string,\n): Promise<User | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.User.list({\n\t\t\tfilter: { cognitoId: { eq: cognitoId } },\n\t\t\tlimit: 1,\n\t\t});\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getUserByCognitoId] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data?.[0] as User | null;\n\t} catch (error) {\n\t\tconsole.error(\"[getUserByCognitoId] Error fetching user:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Get a user by email\n *\n * @example\n * ```typescript\n * import { getUserByEmail } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const user = await getUserByEmail(client, 'user@example.com');\n * ```\n */\nexport async function getUserByEmail<TClient = any>(\n\tclient: TClient,\n\temail: string,\n): Promise<User | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.User.list({\n\t\t\tfilter: { email: { eq: email } },\n\t\t\tlimit: 1,\n\t\t});\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getUserByEmail] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data?.[0] as User | null;\n\t} catch (error) {\n\t\tconsole.error(\"[getUserByEmail] Error fetching user:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List all users with optional filtering\n *\n * @example\n * ```typescript\n * import { listUsers } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const users = await listUsers(client, {\n * filter: { status: { eq: 'active' } }\n * });\n * ```\n */\nexport async function listUsers<TClient = any>(\n\tclient: TClient,\n\toptions?: {\n\t\tfilter?: any;\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: User[]; nextToken?: string }> {\n\ttry {\n\t\tconst { data, errors, nextToken } = await (client as any).models.User.list(\n\t\t\toptions,\n\t\t);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[listUsers] GraphQL errors:\", errors);\n\t\t\treturn { items: [], nextToken: undefined };\n\t\t}\n\n\t\treturn {\n\t\t\titems: (data || []) as User[],\n\t\t\tnextToken,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[listUsers] Error fetching users:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List users by account ID\n *\n * @example\n * ```typescript\n * import { listUsersByAccount } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const users = await listUsersByAccount(client, 'account-123');\n * ```\n */\nexport async function listUsersByAccount<TClient = any>(\n\tclient: TClient,\n\taccountId: string,\n\toptions?: {\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: User[]; nextToken?: string }> {\n\treturn listUsers(client, {\n\t\tfilter: { accountId: { eq: accountId } },\n\t\t...options,\n\t});\n}\n\n/**\n * List active users\n *\n * @example\n * ```typescript\n * import { listActiveUsers } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const users = await listActiveUsers(client);\n * ```\n */\nexport async function listActiveUsers<TClient = any>(\n\tclient: TClient,\n\toptions?: {\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: User[]; nextToken?: string }> {\n\treturn listUsers(client, {\n\t\tfilter: { status: { eq: \"active\" } },\n\t\t...options,\n\t});\n}\n","/**\n * Product Query Functions\n *\n * Provides query functions for fetching product and product instance data from the GraphQL API.\n */\n\nimport type { Product, ProductInstance } from \"@htlkg/core/types\";\n\n/**\n * Get a single product by ID\n *\n * @example\n * ```typescript\n * import { getProduct } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const product = await getProduct(client, 'product-123');\n * ```\n */\nexport async function getProduct<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<Product | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Product.get({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getProduct] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Product;\n\t} catch (error) {\n\t\tconsole.error(\"[getProduct] Error fetching product:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List all products with optional filtering\n *\n * @example\n * ```typescript\n * import { listProducts } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const products = await listProducts(client, {\n * filter: { isActive: { eq: true } }\n * });\n * ```\n */\nexport async function listProducts<TClient = any>(\n\tclient: TClient,\n\toptions?: {\n\t\tfilter?: any;\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: Product[]; nextToken?: string }> {\n\ttry {\n\t\tconst { data, errors, nextToken } = await (\n\t\t\tclient as any\n\t\t).models.Product.list(options);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[listProducts] GraphQL errors:\", errors);\n\t\t\treturn { items: [], nextToken: undefined };\n\t\t}\n\n\t\treturn {\n\t\t\titems: (data || []) as Product[],\n\t\t\tnextToken,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[listProducts] Error fetching products:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List active products\n *\n * @example\n * ```typescript\n * import { listActiveProducts } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const products = await listActiveProducts(client);\n * ```\n */\nexport async function listActiveProducts<TClient = any>(\n\tclient: TClient,\n\toptions?: {\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: Product[]; nextToken?: string }> {\n\treturn listProducts(client, {\n\t\tfilter: { isActive: { eq: true } },\n\t\t...options,\n\t});\n}\n\n/**\n * Get a single product instance by ID\n *\n * @example\n * ```typescript\n * import { getProductInstance } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const instance = await getProductInstance(client, 'instance-123');\n * ```\n */\nexport async function getProductInstance<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<ProductInstance | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.ProductInstance.get({\n\t\t\tid,\n\t\t});\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[getProductInstance] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as ProductInstance;\n\t} catch (error) {\n\t\tconsole.error(\"[getProductInstance] Error fetching product instance:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List product instances by brand ID\n *\n * @example\n * ```typescript\n * import { listProductInstancesByBrand } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const instances = await listProductInstancesByBrand(client, 'brand-123');\n * ```\n */\nexport async function listProductInstancesByBrand<TClient = any>(\n\tclient: TClient,\n\tbrandId: string,\n\toptions?: {\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: ProductInstance[]; nextToken?: string }> {\n\ttry {\n\t\tconst { data, errors, nextToken } = await (\n\t\t\tclient as any\n\t\t).models.ProductInstance.list({\n\t\t\tfilter: { brandId: { eq: brandId } },\n\t\t\t...options,\n\t\t});\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[listProductInstancesByBrand] GraphQL errors:\", errors);\n\t\t\treturn { items: [], nextToken: undefined };\n\t\t}\n\n\t\treturn {\n\t\t\titems: (data || []) as ProductInstance[],\n\t\t\tnextToken,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t\"[listProductInstancesByBrand] Error fetching product instances:\",\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List product instances by account ID\n *\n * @example\n * ```typescript\n * import { listProductInstancesByAccount } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const instances = await listProductInstancesByAccount(client, 'account-123');\n * ```\n */\nexport async function listProductInstancesByAccount<TClient = any>(\n\tclient: TClient,\n\taccountId: string,\n\toptions?: {\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: ProductInstance[]; nextToken?: string }> {\n\ttry {\n\t\tconst { data, errors, nextToken } = await (\n\t\t\tclient as any\n\t\t).models.ProductInstance.list({\n\t\t\tfilter: { accountId: { eq: accountId } },\n\t\t\t...options,\n\t\t});\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[listProductInstancesByAccount] GraphQL errors:\", errors);\n\t\t\treturn { items: [], nextToken: undefined };\n\t\t}\n\n\t\treturn {\n\t\t\titems: (data || []) as ProductInstance[],\n\t\t\tnextToken,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t\"[listProductInstancesByAccount] Error fetching product instances:\",\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n}\n\n/**\n * List enabled product instances by brand ID\n *\n * @example\n * ```typescript\n * import { listEnabledProductInstancesByBrand } from '@htlkg/data/queries';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const instances = await listEnabledProductInstancesByBrand(client, 'brand-123');\n * ```\n */\nexport async function listEnabledProductInstancesByBrand<TClient = any>(\n\tclient: TClient,\n\tbrandId: string,\n\toptions?: {\n\t\tlimit?: number;\n\t\tnextToken?: string;\n\t},\n): Promise<{ items: ProductInstance[]; nextToken?: string }> {\n\ttry {\n\t\tconst { data, errors, nextToken } = await (\n\t\t\tclient as any\n\t\t).models.ProductInstance.list({\n\t\t\tfilter: {\n\t\t\t\tbrandId: { eq: brandId },\n\t\t\t\tenabled: { eq: true },\n\t\t\t},\n\t\t\t...options,\n\t\t});\n\n\t\tif (errors) {\n\t\t\tconsole.error(\n\t\t\t\t\"[listEnabledProductInstancesByBrand] GraphQL errors:\",\n\t\t\t\terrors,\n\t\t\t);\n\t\t\treturn { items: [], nextToken: undefined };\n\t\t}\n\n\t\treturn {\n\t\t\titems: (data || []) as ProductInstance[],\n\t\t\tnextToken,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t\"[listEnabledProductInstancesByBrand] Error fetching product instances:\",\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n}\n","/**\n * Brand Mutation Functions\n *\n * Provides mutation functions for creating, updating, and deleting brands.\n */\n\nimport type { Brand } from \"@htlkg/core/types\";\n\n/**\n * Input type for creating a brand\n */\nexport interface CreateBrandInput {\n\taccountId: string;\n\tname: string;\n\tlogo?: string;\n\ttimezone?: string;\n\tstatus?: \"active\" | \"inactive\" | \"maintenance\" | \"suspended\";\n\tsettings?: Record<string, any>;\n}\n\n/**\n * Input type for updating a brand\n */\nexport interface UpdateBrandInput {\n\tid: string;\n\tname?: string;\n\tlogo?: string;\n\ttimezone?: string;\n\tstatus?: \"active\" | \"inactive\" | \"maintenance\" | \"suspended\";\n\tsettings?: Record<string, any>;\n}\n\n/**\n * Create a new brand\n *\n * @example\n * ```typescript\n * import { createBrand } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brand = await createBrand(client, {\n * accountId: 'account-123',\n * name: 'My Brand',\n * timezone: 'America/New_York',\n * status: 'active'\n * });\n * ```\n */\nexport async function createBrand<TClient = any>(\n\tclient: TClient,\n\tinput: CreateBrandInput,\n): Promise<Brand | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Brand.create(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[createBrand] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Brand;\n\t} catch (error) {\n\t\tconsole.error(\"[createBrand] Error creating brand:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Update an existing brand\n *\n * @example\n * ```typescript\n * import { updateBrand } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brand = await updateBrand(client, {\n * id: 'brand-123',\n * name: 'Updated Brand Name',\n * status: 'maintenance'\n * });\n * ```\n */\nexport async function updateBrand<TClient = any>(\n\tclient: TClient,\n\tinput: UpdateBrandInput,\n): Promise<Brand | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Brand.update(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[updateBrand] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Brand;\n\t} catch (error) {\n\t\tconsole.error(\"[updateBrand] Error updating brand:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Delete a brand\n *\n * @example\n * ```typescript\n * import { deleteBrand } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * await deleteBrand(client, 'brand-123');\n * ```\n */\nexport async function deleteBrand<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<boolean> {\n\ttry {\n\t\tconst { errors } = await (client as any).models.Brand.delete({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[deleteBrand] GraphQL errors:\", errors);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(\"[deleteBrand] Error deleting brand:\", error);\n\t\tthrow error;\n\t}\n}\n","/**\n * Account Mutation Functions\n *\n * Provides mutation functions for creating, updating, and deleting accounts.\n */\n\nimport type { Account } from \"@htlkg/core/types\";\n\n/**\n * Input type for creating an account\n */\nexport interface CreateAccountInput {\n\tname: string;\n\tlogo?: string;\n\tsubscription?: Record<string, any>;\n\tsettings?: Record<string, any>;\n}\n\n/**\n * Input type for updating an account\n */\nexport interface UpdateAccountInput {\n\tid: string;\n\tname?: string;\n\tlogo?: string;\n\tsubscription?: Record<string, any>;\n\tsettings?: Record<string, any>;\n}\n\n/**\n * Create a new account\n *\n * @example\n * ```typescript\n * import { createAccount } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const account = await createAccount(client, {\n * name: 'My Account',\n * subscription: { plan: 'premium' }\n * });\n * ```\n */\nexport async function createAccount<TClient = any>(\n\tclient: TClient,\n\tinput: CreateAccountInput,\n): Promise<Account | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Account.create(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[createAccount] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Account;\n\t} catch (error) {\n\t\tconsole.error(\"[createAccount] Error creating account:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Update an existing account\n *\n * @example\n * ```typescript\n * import { updateAccount } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const account = await updateAccount(client, {\n * id: 'account-123',\n * name: 'Updated Account Name'\n * });\n * ```\n */\nexport async function updateAccount<TClient = any>(\n\tclient: TClient,\n\tinput: UpdateAccountInput,\n): Promise<Account | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Account.update(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[updateAccount] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Account;\n\t} catch (error) {\n\t\tconsole.error(\"[updateAccount] Error updating account:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Delete an account\n *\n * @example\n * ```typescript\n * import { deleteAccount } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * await deleteAccount(client, 'account-123');\n * ```\n */\nexport async function deleteAccount<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<boolean> {\n\ttry {\n\t\tconst { errors } = await (client as any).models.Account.delete({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[deleteAccount] GraphQL errors:\", errors);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(\"[deleteAccount] Error deleting account:\", error);\n\t\tthrow error;\n\t}\n}\n","/**\n * User Mutation Functions\n *\n * Provides mutation functions for creating, updating, and deleting users.\n */\n\nimport type { User } from \"@htlkg/core/types\";\n\n/**\n * Input type for creating a user\n */\nexport interface CreateUserInput {\n\tcognitoId: string;\n\temail: string;\n\taccountId: string;\n\tbrandIds?: string[];\n\troles?: string[];\n\tpermissions?: Record<string, any>;\n\tstatus?: \"active\" | \"inactive\" | \"pending\" | \"suspended\";\n}\n\n/**\n * Input type for updating a user\n */\nexport interface UpdateUserInput {\n\tid: string;\n\temail?: string;\n\tbrandIds?: string[];\n\troles?: string[];\n\tpermissions?: Record<string, any>;\n\tlastLogin?: string;\n\tstatus?: \"active\" | \"inactive\" | \"pending\" | \"suspended\";\n}\n\n/**\n * Create a new user\n *\n * @example\n * ```typescript\n * import { createUser } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const user = await createUser(client, {\n * cognitoId: 'cognito-123',\n * email: 'user@example.com',\n * accountId: 'account-123',\n * roles: ['BRAND_ADMIN'],\n * status: 'active'\n * });\n * ```\n */\nexport async function createUser<TClient = any>(\n\tclient: TClient,\n\tinput: CreateUserInput,\n): Promise<User | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.User.create(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[createUser] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as User;\n\t} catch (error) {\n\t\tconsole.error(\"[createUser] Error creating user:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Update an existing user\n *\n * @example\n * ```typescript\n * import { updateUser } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const user = await updateUser(client, {\n * id: 'user-123',\n * roles: ['BRAND_ADMIN', 'ACCOUNT_ADMIN'],\n * status: 'active'\n * });\n * ```\n */\nexport async function updateUser<TClient = any>(\n\tclient: TClient,\n\tinput: UpdateUserInput,\n): Promise<User | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.User.update(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[updateUser] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as User;\n\t} catch (error) {\n\t\tconsole.error(\"[updateUser] Error updating user:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Delete a user\n *\n * @example\n * ```typescript\n * import { deleteUser } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * await deleteUser(client, 'user-123');\n * ```\n */\nexport async function deleteUser<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<boolean> {\n\ttry {\n\t\tconst { errors } = await (client as any).models.User.delete({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[deleteUser] GraphQL errors:\", errors);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(\"[deleteUser] Error deleting user:\", error);\n\t\tthrow error;\n\t}\n}\n","/**\n * useBrands Hook\n *\n * Vue composable for fetching and managing brand data with reactive state.\n * Provides loading states, error handling, and refetch capabilities.\n */\n\nimport { ref, computed, onMounted, type Ref, type ComputedRef } from \"vue\";\nimport { generateClient } from \"../client\";\nimport type { Brand } from \"@htlkg/core/types\";\n\nexport interface UseBrandsOptions {\n\t/** Filter criteria for brands */\n\tfilter?: any;\n\t/** Limit number of results */\n\tlimit?: number;\n\t/** Auto-fetch on mount (default: true) */\n\tautoFetch?: boolean;\n\t/** Filter by account ID */\n\taccountId?: string;\n\t/** Only active brands */\n\tactiveOnly?: boolean;\n}\n\nexport interface UseBrandsReturn {\n\t/** Reactive array of brands */\n\tbrands: Ref<Brand[]>;\n\t/** Computed array of active brands only */\n\tactiveBrands: ComputedRef<Brand[]>;\n\t/** Loading state */\n\tloading: Ref<boolean>;\n\t/** Error state */\n\terror: Ref<Error | null>;\n\t/** Refetch brands */\n\trefetch: () => Promise<void>;\n}\n\n/**\n * Composable for fetching and managing brands\n *\n * @example\n * ```typescript\n * import { useBrands } from '@htlkg/data/hooks';\n *\n * const { brands, loading, error, refetch } = useBrands();\n * ```\n *\n * @example With filters\n * ```typescript\n * const { brands, loading } = useBrands({\n * accountId: 'account-123',\n * activeOnly: true,\n * limit: 50\n * });\n * ```\n */\nexport function useBrands(\n\toptions: UseBrandsOptions = {},\n): UseBrandsReturn {\n\tconst {\n\t\tfilter: baseFilter,\n\t\tlimit,\n\t\tautoFetch = true,\n\t\taccountId,\n\t\tactiveOnly,\n\t} = options;\n\n\t// State\n\tconst brands = ref<Brand[]>([]);\n\tconst loading = ref(false);\n\tconst error = ref<Error | null>(null);\n\n\t// Build filter\n\tlet filter: any = baseFilter || {};\n\n\tif (accountId) {\n\t\tfilter = { ...filter, accountId: { eq: accountId } };\n\t}\n\n\tif (activeOnly) {\n\t\tfilter = { ...filter, status: { eq: \"active\" } };\n\t}\n\n\t// Computed\n\tconst activeBrands = computed(() =>\n\t\tbrands.value.filter((b) => b.status === \"active\"),\n\t);\n\n\t// Fetch function\n\tasync function fetch() {\n\t\tloading.value = true;\n\t\terror.value = null;\n\n\t\ttry {\n\t\t\tconst client = generateClient();\n\t\t\tconst { data, errors } = await (client as any).models.Brand.list({\n\t\t\t\tfilter: Object.keys(filter).length > 0 ? filter : undefined,\n\t\t\t\tlimit,\n\t\t\t});\n\n\t\t\tif (errors) {\n\t\t\t\tthrow new Error(errors[0]?.message || \"Failed to fetch brands\");\n\t\t\t}\n\n\t\t\tbrands.value = (data || []) as Brand[];\n\t\t} catch (e) {\n\t\t\terror.value = e as Error;\n\t\t\tconsole.error(\"[useBrands] Error fetching brands:\", e);\n\t\t} finally {\n\t\t\tloading.value = false;\n\t\t}\n\t}\n\n\t// Auto-fetch on mount if enabled\n\tif (autoFetch) {\n\t\tonMounted(() => {\n\t\t\tfetch();\n\t\t});\n\t}\n\n\treturn {\n\t\tbrands,\n\t\tactiveBrands,\n\t\tloading,\n\t\terror,\n\t\trefetch: fetch,\n\t};\n}\n","/**\n * useAccounts Hook\n *\n * Vue composable for fetching and managing account data with reactive state.\n * Provides loading states, error handling, and refetch capabilities.\n */\n\nimport { ref, onMounted, type Ref } from \"vue\";\nimport { generateClient } from \"../client\";\nimport type { Account } from \"@htlkg/core/types\";\n\nexport interface UseAccountsOptions {\n\t/** Filter criteria for accounts */\n\tfilter?: any;\n\t/** Limit number of results */\n\tlimit?: number;\n\t/** Auto-fetch on mount (default: true) */\n\tautoFetch?: boolean;\n}\n\nexport interface UseAccountsReturn {\n\t/** Reactive array of accounts */\n\taccounts: Ref<Account[]>;\n\t/** Loading state */\n\tloading: Ref<boolean>;\n\t/** Error state */\n\terror: Ref<Error | null>;\n\t/** Refetch accounts */\n\trefetch: () => Promise<void>;\n}\n\n/**\n * Composable for fetching and managing accounts\n *\n * @example\n * ```typescript\n * import { useAccounts } from '@htlkg/data/hooks';\n *\n * const { accounts, loading, error, refetch } = useAccounts();\n * ```\n *\n * @example With filters\n * ```typescript\n * const { accounts, loading } = useAccounts({\n * filter: { status: { eq: 'active' } },\n * limit: 50\n * });\n * ```\n */\nexport function useAccounts(\n\toptions: UseAccountsOptions = {},\n): UseAccountsReturn {\n\tconst { filter, limit, autoFetch = true } = options;\n\n\t// State\n\tconst accounts = ref<Account[]>([]);\n\tconst loading = ref(false);\n\tconst error = ref<Error | null>(null);\n\n\t// Fetch function\n\tasync function fetch() {\n\t\tloading.value = true;\n\t\terror.value = null;\n\n\t\ttry {\n\t\t\tconst client = generateClient();\n\t\t\tconst { data, errors } = await (client as any).models.Account.list({\n\t\t\t\tfilter,\n\t\t\t\tlimit,\n\t\t\t});\n\n\t\t\tif (errors) {\n\t\t\t\tthrow new Error(errors[0]?.message || \"Failed to fetch accounts\");\n\t\t\t}\n\n\t\t\taccounts.value = (data || []) as Account[];\n\t\t} catch (e) {\n\t\t\terror.value = e as Error;\n\t\t\tconsole.error(\"[useAccounts] Error fetching accounts:\", e);\n\t\t} finally {\n\t\t\tloading.value = false;\n\t\t}\n\t}\n\n\t// Auto-fetch on mount if enabled\n\tif (autoFetch) {\n\t\tonMounted(() => {\n\t\t\tfetch();\n\t\t});\n\t}\n\n\treturn {\n\t\taccounts,\n\t\tloading,\n\t\terror,\n\t\trefetch: fetch,\n\t};\n}\n","/**\n * useUsers Hook\n *\n * Vue composable for fetching and managing user data with reactive state.\n * Provides loading states, error handling, and refetch capabilities.\n */\n\nimport { ref, onMounted, type Ref } from \"vue\";\nimport { generateClient } from \"../client\";\nimport type { User } from \"@htlkg/core/types\";\n\nexport interface UseUsersOptions {\n\t/** Filter criteria for users */\n\tfilter?: any;\n\t/** Limit number of results */\n\tlimit?: number;\n\t/** Auto-fetch on mount (default: true) */\n\tautoFetch?: boolean;\n\t/** Filter by brand ID */\n\tbrandId?: string;\n\t/** Filter by account ID */\n\taccountId?: string;\n}\n\nexport interface UseUsersReturn {\n\t/** Reactive array of users */\n\tusers: Ref<User[]>;\n\t/** Loading state */\n\tloading: Ref<boolean>;\n\t/** Error state */\n\terror: Ref<Error | null>;\n\t/** Refetch users */\n\trefetch: () => Promise<void>;\n}\n\n/**\n * Composable for fetching and managing users\n *\n * @example\n * ```typescript\n * import { useUsers } from '@htlkg/data/hooks';\n *\n * const { users, loading, error, refetch } = useUsers();\n * ```\n *\n * @example With filters\n * ```typescript\n * const { users, loading } = useUsers({\n * brandId: 'brand-123',\n * accountId: 'account-456',\n * limit: 50\n * });\n * ```\n */\nexport function useUsers(options: UseUsersOptions = {}): UseUsersReturn {\n\tconst { filter: baseFilter, limit, autoFetch = true, brandId, accountId } = options;\n\n\t// State\n\tconst users = ref<User[]>([]);\n\tconst loading = ref(false);\n\tconst error = ref<Error | null>(null);\n\n\t// Build filter\n\tlet filter: any = baseFilter || {};\n\n\tif (brandId) {\n\t\tfilter = { ...filter, brandIds: { contains: brandId } };\n\t}\n\n\tif (accountId) {\n\t\tfilter = { ...filter, accountIds: { contains: accountId } };\n\t}\n\n\t// Fetch function\n\tasync function fetch() {\n\t\tloading.value = true;\n\t\terror.value = null;\n\n\t\ttry {\n\t\t\tconst client = generateClient();\n\t\t\tconst { data, errors } = await (client as any).models.User.list({\n\t\t\t\tfilter: Object.keys(filter).length > 0 ? filter : undefined,\n\t\t\t\tlimit,\n\t\t\t});\n\n\t\t\tif (errors) {\n\t\t\t\tthrow new Error(errors[0]?.message || \"Failed to fetch users\");\n\t\t\t}\n\n\t\t\tusers.value = (data || []) as User[];\n\t\t} catch (e) {\n\t\t\terror.value = e as Error;\n\t\t\tconsole.error(\"[useUsers] Error fetching users:\", e);\n\t\t} finally {\n\t\t\tloading.value = false;\n\t\t}\n\t}\n\n\t// Auto-fetch on mount if enabled\n\tif (autoFetch) {\n\t\tonMounted(() => {\n\t\t\tfetch();\n\t\t});\n\t}\n\n\treturn {\n\t\tusers,\n\t\tloading,\n\t\terror,\n\t\trefetch: fetch,\n\t};\n}\n","/**\n * useProducts Hook\n *\n * Vue composable for fetching and managing product data with reactive state.\n * Provides loading states, error handling, and refetch capabilities.\n */\n\nimport { ref, computed, onMounted, type Ref, type ComputedRef } from \"vue\";\nimport { generateClient } from \"../client\";\nimport type { Product } from \"@htlkg/core/types\";\n\nexport interface UseProductsOptions {\n\t/** Filter criteria for products */\n\tfilter?: any;\n\t/** Limit number of results */\n\tlimit?: number;\n\t/** Auto-fetch on mount (default: true) */\n\tautoFetch?: boolean;\n\t/** Only active products */\n\tactiveOnly?: boolean;\n}\n\nexport interface UseProductsReturn {\n\t/** Reactive array of products */\n\tproducts: Ref<Product[]>;\n\t/** Computed array of active products only */\n\tactiveProducts: ComputedRef<Product[]>;\n\t/** Loading state */\n\tloading: Ref<boolean>;\n\t/** Error state */\n\terror: Ref<Error | null>;\n\t/** Refetch products */\n\trefetch: () => Promise<void>;\n}\n\n/**\n * Composable for fetching and managing products\n *\n * @example\n * ```typescript\n * import { useProducts } from '@htlkg/data/hooks';\n *\n * const { products, loading, error, refetch } = useProducts();\n * ```\n *\n * @example With filters\n * ```typescript\n * const { products, loading } = useProducts({\n * activeOnly: true,\n * limit: 50\n * });\n * ```\n */\nexport function useProducts(\n\toptions: UseProductsOptions = {},\n): UseProductsReturn {\n\tconst { filter: baseFilter, limit, autoFetch = true, activeOnly } = options;\n\n\t// State\n\tconst products = ref<Product[]>([]);\n\tconst loading = ref(false);\n\tconst error = ref<Error | null>(null);\n\n\t// Build filter\n\tlet filter: any = baseFilter || {};\n\n\tif (activeOnly) {\n\t\tfilter = { ...filter, isActive: { eq: true } };\n\t}\n\n\t// Computed\n\tconst activeProducts = computed(() =>\n\t\tproducts.value.filter((p) => p.isActive === true),\n\t);\n\n\t// Fetch function\n\tasync function fetch() {\n\t\tloading.value = true;\n\t\terror.value = null;\n\n\t\ttry {\n\t\t\tconst client = generateClient();\n\t\t\tconst { data, errors } = await (client as any).models.Product.list({\n\t\t\t\tfilter: Object.keys(filter).length > 0 ? filter : undefined,\n\t\t\t\tlimit,\n\t\t\t});\n\n\t\t\tif (errors) {\n\t\t\t\tthrow new Error(errors[0]?.message || \"Failed to fetch products\");\n\t\t\t}\n\n\t\t\tproducts.value = (data || []) as Product[];\n\t\t} catch (e) {\n\t\t\terror.value = e as Error;\n\t\t\tconsole.error(\"[useProducts] Error fetching products:\", e);\n\t\t} finally {\n\t\t\tloading.value = false;\n\t\t}\n\t}\n\n\t// Auto-fetch on mount if enabled\n\tif (autoFetch) {\n\t\tonMounted(() => {\n\t\t\tfetch();\n\t\t});\n\t}\n\n\treturn {\n\t\tproducts,\n\t\tactiveProducts,\n\t\tloading,\n\t\terror,\n\t\trefetch: fetch,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc;;;ACuBP,SAAS,iBAEoC;AACnD,aAAO,YAAAA,gBAA4B;AACpC;AA2CO,SAAS,qBAEd,SAAqE;AACtE,QAAM,IAAI;AAAA,IACT;AAAA,EAGD;AACD;;;AC1DA,eAAsB,SACrB,QACA,IACwB;AACxB,MAAI;AACH,UAAM,EAAE,MAAM,OAAO,IAAI,MAAO,OAAe,OAAO,MAAM,IAAI,EAAE,GAAG,CAAC;AAEtE,QAAI,QAAQ;AACX,cAAQ,MAAM,8BAA8B,MAAM;AACl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AG;AACX,YAAM,QAAQ;AACd,cAAQ,MAAM,0CAA0C,CAAC;AAAA,IAC1D,UAAE;AACD,cAAQ,QAAQ;AAAA,IACjB;AAAA,EACD;AAGA,MAAI,WAAW;AACd,IAAAC,WAAU,MAAM;AACf,YAAM;AAAA,IACP,CAAC;AAAA,EACF;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,EACV;AACD;","names":["generateDataClient","ref","onMounted","ref","onMounted","ref","onMounted","ref","onMounted","ref","computed","onMounted","ref","computed","onMounted"]}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { Brand, Account, User } from '@htlkg/core/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Brand Mutation Functions
|
|
5
|
+
*
|
|
6
|
+
* Provides mutation functions for creating, updating, and deleting brands.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Input type for creating a brand
|
|
11
|
+
*/
|
|
12
|
+
interface CreateBrandInput {
|
|
13
|
+
accountId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
logo?: string;
|
|
16
|
+
timezone?: string;
|
|
17
|
+
status?: "active" | "inactive" | "maintenance" | "suspended";
|
|
18
|
+
settings?: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Input type for updating a brand
|
|
22
|
+
*/
|
|
23
|
+
interface UpdateBrandInput {
|
|
24
|
+
id: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
logo?: string;
|
|
27
|
+
timezone?: string;
|
|
28
|
+
status?: "active" | "inactive" | "maintenance" | "suspended";
|
|
29
|
+
settings?: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a new brand
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { createBrand } from '@htlkg/data/mutations';
|
|
37
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
38
|
+
*
|
|
39
|
+
* const client = generateClient<Schema>();
|
|
40
|
+
* const brand = await createBrand(client, {
|
|
41
|
+
* accountId: 'account-123',
|
|
42
|
+
* name: 'My Brand',
|
|
43
|
+
* timezone: 'America/New_York',
|
|
44
|
+
* status: 'active'
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare function createBrand<TClient = any>(client: TClient, input: CreateBrandInput): Promise<Brand | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Update an existing brand
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import { updateBrand } from '@htlkg/data/mutations';
|
|
55
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
56
|
+
*
|
|
57
|
+
* const client = generateClient<Schema>();
|
|
58
|
+
* const brand = await updateBrand(client, {
|
|
59
|
+
* id: 'brand-123',
|
|
60
|
+
* name: 'Updated Brand Name',
|
|
61
|
+
* status: 'maintenance'
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare function updateBrand<TClient = any>(client: TClient, input: UpdateBrandInput): Promise<Brand | null>;
|
|
66
|
+
/**
|
|
67
|
+
* Delete a brand
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* import { deleteBrand } from '@htlkg/data/mutations';
|
|
72
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
73
|
+
*
|
|
74
|
+
* const client = generateClient<Schema>();
|
|
75
|
+
* await deleteBrand(client, 'brand-123');
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare function deleteBrand<TClient = any>(client: TClient, id: string): Promise<boolean>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Account Mutation Functions
|
|
82
|
+
*
|
|
83
|
+
* Provides mutation functions for creating, updating, and deleting accounts.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Input type for creating an account
|
|
88
|
+
*/
|
|
89
|
+
interface CreateAccountInput {
|
|
90
|
+
name: string;
|
|
91
|
+
logo?: string;
|
|
92
|
+
subscription?: Record<string, any>;
|
|
93
|
+
settings?: Record<string, any>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Input type for updating an account
|
|
97
|
+
*/
|
|
98
|
+
interface UpdateAccountInput {
|
|
99
|
+
id: string;
|
|
100
|
+
name?: string;
|
|
101
|
+
logo?: string;
|
|
102
|
+
subscription?: Record<string, any>;
|
|
103
|
+
settings?: Record<string, any>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create a new account
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* import { createAccount } from '@htlkg/data/mutations';
|
|
111
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
112
|
+
*
|
|
113
|
+
* const client = generateClient<Schema>();
|
|
114
|
+
* const account = await createAccount(client, {
|
|
115
|
+
* name: 'My Account',
|
|
116
|
+
* subscription: { plan: 'premium' }
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
declare function createAccount<TClient = any>(client: TClient, input: CreateAccountInput): Promise<Account | null>;
|
|
121
|
+
/**
|
|
122
|
+
* Update an existing account
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* import { updateAccount } from '@htlkg/data/mutations';
|
|
127
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
128
|
+
*
|
|
129
|
+
* const client = generateClient<Schema>();
|
|
130
|
+
* const account = await updateAccount(client, {
|
|
131
|
+
* id: 'account-123',
|
|
132
|
+
* name: 'Updated Account Name'
|
|
133
|
+
* });
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
declare function updateAccount<TClient = any>(client: TClient, input: UpdateAccountInput): Promise<Account | null>;
|
|
137
|
+
/**
|
|
138
|
+
* Delete an account
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* import { deleteAccount } from '@htlkg/data/mutations';
|
|
143
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
144
|
+
*
|
|
145
|
+
* const client = generateClient<Schema>();
|
|
146
|
+
* await deleteAccount(client, 'account-123');
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
declare function deleteAccount<TClient = any>(client: TClient, id: string): Promise<boolean>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* User Mutation Functions
|
|
153
|
+
*
|
|
154
|
+
* Provides mutation functions for creating, updating, and deleting users.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Input type for creating a user
|
|
159
|
+
*/
|
|
160
|
+
interface CreateUserInput {
|
|
161
|
+
cognitoId: string;
|
|
162
|
+
email: string;
|
|
163
|
+
accountId: string;
|
|
164
|
+
brandIds?: string[];
|
|
165
|
+
roles?: string[];
|
|
166
|
+
permissions?: Record<string, any>;
|
|
167
|
+
status?: "active" | "inactive" | "pending" | "suspended";
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Input type for updating a user
|
|
171
|
+
*/
|
|
172
|
+
interface UpdateUserInput {
|
|
173
|
+
id: string;
|
|
174
|
+
email?: string;
|
|
175
|
+
brandIds?: string[];
|
|
176
|
+
roles?: string[];
|
|
177
|
+
permissions?: Record<string, any>;
|
|
178
|
+
lastLogin?: string;
|
|
179
|
+
status?: "active" | "inactive" | "pending" | "suspended";
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Create a new user
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* import { createUser } from '@htlkg/data/mutations';
|
|
187
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
188
|
+
*
|
|
189
|
+
* const client = generateClient<Schema>();
|
|
190
|
+
* const user = await createUser(client, {
|
|
191
|
+
* cognitoId: 'cognito-123',
|
|
192
|
+
* email: 'user@example.com',
|
|
193
|
+
* accountId: 'account-123',
|
|
194
|
+
* roles: ['BRAND_ADMIN'],
|
|
195
|
+
* status: 'active'
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
declare function createUser<TClient = any>(client: TClient, input: CreateUserInput): Promise<User | null>;
|
|
200
|
+
/**
|
|
201
|
+
* Update an existing user
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* import { updateUser } from '@htlkg/data/mutations';
|
|
206
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
207
|
+
*
|
|
208
|
+
* const client = generateClient<Schema>();
|
|
209
|
+
* const user = await updateUser(client, {
|
|
210
|
+
* id: 'user-123',
|
|
211
|
+
* roles: ['BRAND_ADMIN', 'ACCOUNT_ADMIN'],
|
|
212
|
+
* status: 'active'
|
|
213
|
+
* });
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare function updateUser<TClient = any>(client: TClient, input: UpdateUserInput): Promise<User | null>;
|
|
217
|
+
/**
|
|
218
|
+
* Delete a user
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* import { deleteUser } from '@htlkg/data/mutations';
|
|
223
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
224
|
+
*
|
|
225
|
+
* const client = generateClient<Schema>();
|
|
226
|
+
* await deleteUser(client, 'user-123');
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
declare function deleteUser<TClient = any>(client: TClient, id: string): Promise<boolean>;
|
|
230
|
+
|
|
231
|
+
export { type CreateAccountInput, type CreateBrandInput, type CreateUserInput, type UpdateAccountInput, type UpdateBrandInput, type UpdateUserInput, createAccount, createBrand, createUser, deleteAccount, deleteBrand, deleteUser, updateAccount, updateBrand, updateUser };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// src/mutations/brands.ts
|
|
2
|
+
async function createBrand(client, input) {
|
|
3
|
+
try {
|
|
4
|
+
const { data, errors } = await client.models.Brand.create(input);
|
|
5
|
+
if (errors) {
|
|
6
|
+
console.error("[createBrand] GraphQL errors:", errors);
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return data;
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error("[createBrand] Error creating brand:", error);
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function updateBrand(client, input) {
|
|
16
|
+
try {
|
|
17
|
+
const { data, errors } = await client.models.Brand.update(input);
|
|
18
|
+
if (errors) {
|
|
19
|
+
console.error("[updateBrand] GraphQL errors:", errors);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return data;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error("[updateBrand] Error updating brand:", error);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function deleteBrand(client, id) {
|
|
29
|
+
try {
|
|
30
|
+
const { errors } = await client.models.Brand.delete({ id });
|
|
31
|
+
if (errors) {
|
|
32
|
+
console.error("[deleteBrand] GraphQL errors:", errors);
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error("[deleteBrand] Error deleting brand:", error);
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/mutations/accounts.ts
|
|
43
|
+
async function createAccount(client, input) {
|
|
44
|
+
try {
|
|
45
|
+
const { data, errors } = await client.models.Account.create(input);
|
|
46
|
+
if (errors) {
|
|
47
|
+
console.error("[createAccount] GraphQL errors:", errors);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return data;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error("[createAccount] Error creating account:", error);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function updateAccount(client, input) {
|
|
57
|
+
try {
|
|
58
|
+
const { data, errors } = await client.models.Account.update(input);
|
|
59
|
+
if (errors) {
|
|
60
|
+
console.error("[updateAccount] GraphQL errors:", errors);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return data;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error("[updateAccount] Error updating account:", error);
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function deleteAccount(client, id) {
|
|
70
|
+
try {
|
|
71
|
+
const { errors } = await client.models.Account.delete({ id });
|
|
72
|
+
if (errors) {
|
|
73
|
+
console.error("[deleteAccount] GraphQL errors:", errors);
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error("[deleteAccount] Error deleting account:", error);
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/mutations/users.ts
|
|
84
|
+
async function createUser(client, input) {
|
|
85
|
+
try {
|
|
86
|
+
const { data, errors } = await client.models.User.create(input);
|
|
87
|
+
if (errors) {
|
|
88
|
+
console.error("[createUser] GraphQL errors:", errors);
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return data;
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error("[createUser] Error creating user:", error);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function updateUser(client, input) {
|
|
98
|
+
try {
|
|
99
|
+
const { data, errors } = await client.models.User.update(input);
|
|
100
|
+
if (errors) {
|
|
101
|
+
console.error("[updateUser] GraphQL errors:", errors);
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return data;
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error("[updateUser] Error updating user:", error);
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function deleteUser(client, id) {
|
|
111
|
+
try {
|
|
112
|
+
const { errors } = await client.models.User.delete({ id });
|
|
113
|
+
if (errors) {
|
|
114
|
+
console.error("[deleteUser] GraphQL errors:", errors);
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error("[deleteUser] Error deleting user:", error);
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
createAccount,
|
|
125
|
+
createBrand,
|
|
126
|
+
createUser,
|
|
127
|
+
deleteAccount,
|
|
128
|
+
deleteBrand,
|
|
129
|
+
deleteUser,
|
|
130
|
+
updateAccount,
|
|
131
|
+
updateBrand,
|
|
132
|
+
updateUser
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/mutations/brands.ts","../../src/mutations/accounts.ts","../../src/mutations/users.ts"],"sourcesContent":["/**\n * Brand Mutation Functions\n *\n * Provides mutation functions for creating, updating, and deleting brands.\n */\n\nimport type { Brand } from \"@htlkg/core/types\";\n\n/**\n * Input type for creating a brand\n */\nexport interface CreateBrandInput {\n\taccountId: string;\n\tname: string;\n\tlogo?: string;\n\ttimezone?: string;\n\tstatus?: \"active\" | \"inactive\" | \"maintenance\" | \"suspended\";\n\tsettings?: Record<string, any>;\n}\n\n/**\n * Input type for updating a brand\n */\nexport interface UpdateBrandInput {\n\tid: string;\n\tname?: string;\n\tlogo?: string;\n\ttimezone?: string;\n\tstatus?: \"active\" | \"inactive\" | \"maintenance\" | \"suspended\";\n\tsettings?: Record<string, any>;\n}\n\n/**\n * Create a new brand\n *\n * @example\n * ```typescript\n * import { createBrand } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brand = await createBrand(client, {\n * accountId: 'account-123',\n * name: 'My Brand',\n * timezone: 'America/New_York',\n * status: 'active'\n * });\n * ```\n */\nexport async function createBrand<TClient = any>(\n\tclient: TClient,\n\tinput: CreateBrandInput,\n): Promise<Brand | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Brand.create(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[createBrand] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Brand;\n\t} catch (error) {\n\t\tconsole.error(\"[createBrand] Error creating brand:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Update an existing brand\n *\n * @example\n * ```typescript\n * import { updateBrand } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const brand = await updateBrand(client, {\n * id: 'brand-123',\n * name: 'Updated Brand Name',\n * status: 'maintenance'\n * });\n * ```\n */\nexport async function updateBrand<TClient = any>(\n\tclient: TClient,\n\tinput: UpdateBrandInput,\n): Promise<Brand | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Brand.update(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[updateBrand] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Brand;\n\t} catch (error) {\n\t\tconsole.error(\"[updateBrand] Error updating brand:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Delete a brand\n *\n * @example\n * ```typescript\n * import { deleteBrand } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * await deleteBrand(client, 'brand-123');\n * ```\n */\nexport async function deleteBrand<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<boolean> {\n\ttry {\n\t\tconst { errors } = await (client as any).models.Brand.delete({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[deleteBrand] GraphQL errors:\", errors);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(\"[deleteBrand] Error deleting brand:\", error);\n\t\tthrow error;\n\t}\n}\n","/**\n * Account Mutation Functions\n *\n * Provides mutation functions for creating, updating, and deleting accounts.\n */\n\nimport type { Account } from \"@htlkg/core/types\";\n\n/**\n * Input type for creating an account\n */\nexport interface CreateAccountInput {\n\tname: string;\n\tlogo?: string;\n\tsubscription?: Record<string, any>;\n\tsettings?: Record<string, any>;\n}\n\n/**\n * Input type for updating an account\n */\nexport interface UpdateAccountInput {\n\tid: string;\n\tname?: string;\n\tlogo?: string;\n\tsubscription?: Record<string, any>;\n\tsettings?: Record<string, any>;\n}\n\n/**\n * Create a new account\n *\n * @example\n * ```typescript\n * import { createAccount } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const account = await createAccount(client, {\n * name: 'My Account',\n * subscription: { plan: 'premium' }\n * });\n * ```\n */\nexport async function createAccount<TClient = any>(\n\tclient: TClient,\n\tinput: CreateAccountInput,\n): Promise<Account | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Account.create(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[createAccount] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Account;\n\t} catch (error) {\n\t\tconsole.error(\"[createAccount] Error creating account:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Update an existing account\n *\n * @example\n * ```typescript\n * import { updateAccount } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const account = await updateAccount(client, {\n * id: 'account-123',\n * name: 'Updated Account Name'\n * });\n * ```\n */\nexport async function updateAccount<TClient = any>(\n\tclient: TClient,\n\tinput: UpdateAccountInput,\n): Promise<Account | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.Account.update(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[updateAccount] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as Account;\n\t} catch (error) {\n\t\tconsole.error(\"[updateAccount] Error updating account:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Delete an account\n *\n * @example\n * ```typescript\n * import { deleteAccount } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * await deleteAccount(client, 'account-123');\n * ```\n */\nexport async function deleteAccount<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<boolean> {\n\ttry {\n\t\tconst { errors } = await (client as any).models.Account.delete({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[deleteAccount] GraphQL errors:\", errors);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(\"[deleteAccount] Error deleting account:\", error);\n\t\tthrow error;\n\t}\n}\n","/**\n * User Mutation Functions\n *\n * Provides mutation functions for creating, updating, and deleting users.\n */\n\nimport type { User } from \"@htlkg/core/types\";\n\n/**\n * Input type for creating a user\n */\nexport interface CreateUserInput {\n\tcognitoId: string;\n\temail: string;\n\taccountId: string;\n\tbrandIds?: string[];\n\troles?: string[];\n\tpermissions?: Record<string, any>;\n\tstatus?: \"active\" | \"inactive\" | \"pending\" | \"suspended\";\n}\n\n/**\n * Input type for updating a user\n */\nexport interface UpdateUserInput {\n\tid: string;\n\temail?: string;\n\tbrandIds?: string[];\n\troles?: string[];\n\tpermissions?: Record<string, any>;\n\tlastLogin?: string;\n\tstatus?: \"active\" | \"inactive\" | \"pending\" | \"suspended\";\n}\n\n/**\n * Create a new user\n *\n * @example\n * ```typescript\n * import { createUser } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const user = await createUser(client, {\n * cognitoId: 'cognito-123',\n * email: 'user@example.com',\n * accountId: 'account-123',\n * roles: ['BRAND_ADMIN'],\n * status: 'active'\n * });\n * ```\n */\nexport async function createUser<TClient = any>(\n\tclient: TClient,\n\tinput: CreateUserInput,\n): Promise<User | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.User.create(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[createUser] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as User;\n\t} catch (error) {\n\t\tconsole.error(\"[createUser] Error creating user:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Update an existing user\n *\n * @example\n * ```typescript\n * import { updateUser } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * const user = await updateUser(client, {\n * id: 'user-123',\n * roles: ['BRAND_ADMIN', 'ACCOUNT_ADMIN'],\n * status: 'active'\n * });\n * ```\n */\nexport async function updateUser<TClient = any>(\n\tclient: TClient,\n\tinput: UpdateUserInput,\n): Promise<User | null> {\n\ttry {\n\t\tconst { data, errors } = await (client as any).models.User.update(input);\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[updateUser] GraphQL errors:\", errors);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn data as User;\n\t} catch (error) {\n\t\tconsole.error(\"[updateUser] Error updating user:\", error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Delete a user\n *\n * @example\n * ```typescript\n * import { deleteUser } from '@htlkg/data/mutations';\n * import { generateClient } from '@htlkg/data/client';\n *\n * const client = generateClient<Schema>();\n * await deleteUser(client, 'user-123');\n * ```\n */\nexport async function deleteUser<TClient = any>(\n\tclient: TClient,\n\tid: string,\n): Promise<boolean> {\n\ttry {\n\t\tconst { errors } = await (client as any).models.User.delete({ id });\n\n\t\tif (errors) {\n\t\t\tconsole.error(\"[deleteUser] GraphQL errors:\", errors);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(\"[deleteUser] Error deleting user:\", error);\n\t\tthrow error;\n\t}\n}\n"],"mappings":";AAiDA,eAAsB,YACrB,QACA,OACwB;AACxB,MAAI;AACH,UAAM,EAAE,MAAM,OAAO,IAAI,MAAO,OAAe,OAAO,MAAM,OAAO,KAAK;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