@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":["../../src/content-collections/generator.ts","../../src/content-collections/sync.ts","../../src/content-collections/schemas.ts"],"sourcesContent":["/**\n * Content Collections Generator\n *\n * Generates Astro Content Collections from AppSync data.\n * Fetches brands, accounts, and product instances and writes them as JSON files.\n */\n\nimport { writeFileSync, mkdirSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {\n\tfetchBrands,\n\tfetchAccounts,\n\tfetchProductInstances,\n\tfetchProducts,\n\ttype SyncOptions,\n} from \"./sync\";\nimport {\n\tbrandSchema,\n\taccountSchema,\n\tproductInstanceSchema,\n\tproductSchema,\n\ttype BrandData,\n\ttype AccountData,\n\ttype ProductInstanceData,\n\ttype ProductData,\n} from \"./schemas\";\n\nexport interface GeneratorOptions extends SyncOptions {\n\t/** Output directory for content collections (default: 'src/content') */\n\toutputDir?: string;\n\t/** Whether to validate data against schemas (default: true) */\n\tvalidate?: boolean;\n\t/** Whether to continue on errors (default: true) */\n\tcontinueOnError?: boolean;\n}\n\nexport interface GeneratorResult {\n\tbrands: {\n\t\tcount: number;\n\t\terrors: string[];\n\t};\n\taccounts: {\n\t\tcount: number;\n\t\terrors: string[];\n\t};\n\tproductInstances: {\n\t\tcount: number;\n\t\terrors: string[];\n\t};\n\tproducts: {\n\t\tcount: number;\n\t\terrors: string[];\n\t};\n}\n\n/**\n * Generate Content Collections from AppSync\n *\n * @example\n * ```typescript\n * import { generateContentCollections } from '@htlkg/data/content-collections';\n *\n * const result = await generateContentCollections({\n * apiConfig: {\n * endpoint: process.env.APPSYNC_ENDPOINT,\n * region: 'us-east-1',\n * apiKey: process.env.APPSYNC_API_KEY\n * },\n * outputDir: 'src/content'\n * });\n *\n * console.log(`Generated ${result.brands.count} brands`);\n * ```\n */\nexport async function generateContentCollections(\n\toptions: GeneratorOptions,\n): Promise<GeneratorResult> {\n\tconst {\n\t\toutputDir = \"src/content\",\n\t\tvalidate = true,\n\t\tcontinueOnError = true,\n\t} = options;\n\n\tconst result: GeneratorResult = {\n\t\tbrands: { count: 0, errors: [] },\n\t\taccounts: { count: 0, errors: [] },\n\t\tproductInstances: { count: 0, errors: [] },\n\t\tproducts: { count: 0, errors: [] },\n\t};\n\n\t// Ensure output directories exist\n\tconst brandsDir = join(outputDir, \"brands\");\n\tconst accountsDir = join(outputDir, \"accounts\");\n\tconst productInstancesDir = join(outputDir, \"product-instances\");\n\tconst productsDir = join(outputDir, \"products\");\n\n\tfor (const dir of [brandsDir, accountsDir, productInstancesDir, productsDir]) {\n\t\tif (!existsSync(dir)) {\n\t\t\tmkdirSync(dir, { recursive: true });\n\t\t}\n\t}\n\n\t// Fetch and generate brands\n\ttry {\n\t\tconsole.log(\"[generateContentCollections] Fetching brands...\");\n\t\tconst brandsResult = await fetchBrands(options);\n\n\t\tif (brandsResult.errors && !continueOnError) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to fetch brands: ${brandsResult.errors[0]?.message}`,\n\t\t\t);\n\t\t}\n\n\t\tif (brandsResult.errors) {\n\t\t\tresult.brands.errors.push(\n\t\t\t\t...brandsResult.errors.map((e) => e.message),\n\t\t\t);\n\t\t}\n\n\t\tfor (const brand of brandsResult.data) {\n\t\t\ttry {\n\t\t\t\t// Validate if enabled\n\t\t\t\tif (validate) {\n\t\t\t\t\tbrandSchema.parse(brand);\n\t\t\t\t}\n\n\t\t\t\t// Write JSON file\n\t\t\t\tconst filename = join(brandsDir, `${brand.id}.json`);\n\t\t\t\twriteFileSync(filename, JSON.stringify(brand, null, 2));\n\t\t\t\tresult.brands.count++;\n\t\t\t} catch (error) {\n\t\t\t\tconst errorMsg = `Failed to process brand ${brand.id}: ${(error as Error).message}`;\n\t\t\t\tconsole.error(`[generateContentCollections] ${errorMsg}`);\n\t\t\t\tresult.brands.errors.push(errorMsg);\n\n\t\t\t\tif (!continueOnError) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\n\t\t\t`[generateContentCollections] Generated ${result.brands.count} brands`,\n\t\t);\n\t} catch (error) {\n\t\tconst errorMsg = `Failed to generate brands: ${(error as Error).message}`;\n\t\tconsole.error(`[generateContentCollections] ${errorMsg}`);\n\t\tresult.brands.errors.push(errorMsg);\n\n\t\tif (!continueOnError) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t// Fetch and generate accounts\n\ttry {\n\t\tconsole.log(\"[generateContentCollections] Fetching accounts...\");\n\t\tconst accountsResult = await fetchAccounts(options);\n\n\t\tif (accountsResult.errors && !continueOnError) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to fetch accounts: ${accountsResult.errors[0]?.message}`,\n\t\t\t);\n\t\t}\n\n\t\tif (accountsResult.errors) {\n\t\t\tresult.accounts.errors.push(\n\t\t\t\t...accountsResult.errors.map((e) => e.message),\n\t\t\t);\n\t\t}\n\n\t\tfor (const account of accountsResult.data) {\n\t\t\ttry {\n\t\t\t\t// Validate if enabled\n\t\t\t\tif (validate) {\n\t\t\t\t\taccountSchema.parse(account);\n\t\t\t\t}\n\n\t\t\t\t// Write JSON file\n\t\t\t\tconst filename = join(accountsDir, `${account.id}.json`);\n\t\t\t\twriteFileSync(filename, JSON.stringify(account, null, 2));\n\t\t\t\tresult.accounts.count++;\n\t\t\t} catch (error) {\n\t\t\t\tconst errorMsg = `Failed to process account ${account.id}: ${(error as Error).message}`;\n\t\t\t\tconsole.error(`[generateContentCollections] ${errorMsg}`);\n\t\t\t\tresult.accounts.errors.push(errorMsg);\n\n\t\t\t\tif (!continueOnError) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\n\t\t\t`[generateContentCollections] Generated ${result.accounts.count} accounts`,\n\t\t);\n\t} catch (error) {\n\t\tconst errorMsg = `Failed to generate accounts: ${(error as Error).message}`;\n\t\tconsole.error(`[generateContentCollections] ${errorMsg}`);\n\t\tresult.accounts.errors.push(errorMsg);\n\n\t\tif (!continueOnError) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t// Fetch and generate product instances\n\ttry {\n\t\tconsole.log(\"[generateContentCollections] Fetching product instances...\");\n\t\tconst productInstancesResult = await fetchProductInstances(options);\n\n\t\tif (productInstancesResult.errors && !continueOnError) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to fetch product instances: ${productInstancesResult.errors[0]?.message}`,\n\t\t\t);\n\t\t}\n\n\t\tif (productInstancesResult.errors) {\n\t\t\tresult.productInstances.errors.push(\n\t\t\t\t...productInstancesResult.errors.map((e) => e.message),\n\t\t\t);\n\t\t}\n\n\t\tfor (const instance of productInstancesResult.data) {\n\t\t\ttry {\n\t\t\t\t// Validate if enabled\n\t\t\t\tif (validate) {\n\t\t\t\t\tproductInstanceSchema.parse(instance);\n\t\t\t\t}\n\n\t\t\t\t// Write JSON file\n\t\t\t\tconst filename = join(productInstancesDir, `${instance.id}.json`);\n\t\t\t\twriteFileSync(filename, JSON.stringify(instance, null, 2));\n\t\t\t\tresult.productInstances.count++;\n\t\t\t} catch (error) {\n\t\t\t\tconst errorMsg = `Failed to process product instance ${instance.id}: ${(error as Error).message}`;\n\t\t\t\tconsole.error(`[generateContentCollections] ${errorMsg}`);\n\t\t\t\tresult.productInstances.errors.push(errorMsg);\n\n\t\t\t\tif (!continueOnError) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\n\t\t\t`[generateContentCollections] Generated ${result.productInstances.count} product instances`,\n\t\t);\n\t} catch (error) {\n\t\tconst errorMsg = `Failed to generate product instances: ${(error as Error).message}`;\n\t\tconsole.error(`[generateContentCollections] ${errorMsg}`);\n\t\tresult.productInstances.errors.push(errorMsg);\n\n\t\tif (!continueOnError) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t// Fetch and generate products\n\ttry {\n\t\tconsole.log(\"[generateContentCollections] Fetching products...\");\n\t\tconst productsResult = await fetchProducts(options);\n\n\t\tif (productsResult.errors && !continueOnError) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to fetch products: ${productsResult.errors[0]?.message}`,\n\t\t\t);\n\t\t}\n\n\t\tif (productsResult.errors) {\n\t\t\tresult.products.errors.push(\n\t\t\t\t...productsResult.errors.map((e) => e.message),\n\t\t\t);\n\t\t}\n\n\t\tfor (const product of productsResult.data) {\n\t\t\ttry {\n\t\t\t\t// Validate if enabled\n\t\t\t\tif (validate) {\n\t\t\t\t\tproductSchema.parse(product);\n\t\t\t\t}\n\n\t\t\t\t// Write JSON file\n\t\t\t\tconst filename = join(productsDir, `${product.id}.json`);\n\t\t\t\twriteFileSync(filename, JSON.stringify(product, null, 2));\n\t\t\t\tresult.products.count++;\n\t\t\t} catch (error) {\n\t\t\t\tconst errorMsg = `Failed to process product ${product.id}: ${(error as Error).message}`;\n\t\t\t\tconsole.error(`[generateContentCollections] ${errorMsg}`);\n\t\t\t\tresult.products.errors.push(errorMsg);\n\n\t\t\t\tif (!continueOnError) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\n\t\t\t`[generateContentCollections] Generated ${result.products.count} products`,\n\t\t);\n\t} catch (error) {\n\t\tconst errorMsg = `Failed to generate products: ${(error as Error).message}`;\n\t\tconsole.error(`[generateContentCollections] ${errorMsg}`);\n\t\tresult.products.errors.push(errorMsg);\n\n\t\tif (!continueOnError) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Sync data from AppSync (alias for generateContentCollections)\n */\nexport const syncFromAppSync = generateContentCollections;\n","/**\n * AppSync Sync for Content Collections\n *\n * Fetches data from Admin's AppSync API for use in Content Collections.\n */\n\nimport { generateClient } from \"@aws-amplify/api\";\n\nexport interface SyncOptions {\n\t/** AppSync API configuration */\n\tapiConfig: {\n\t\tendpoint: string;\n\t\tregion: string;\n\t\tapiKey?: string;\n\t};\n\t/** Authorization mode (default: 'apiKey') */\n\tauthMode?: \"apiKey\" | \"userPool\" | \"iam\";\n\t/** Limit for list queries */\n\tlimit?: number;\n}\n\nexport interface SyncResult<T> {\n\tdata: T[];\n\terrors: Array<{ message: string }> | null;\n}\n\n/**\n * Fetch brands from AppSync\n */\nexport async function fetchBrands(\n\toptions: SyncOptions,\n): Promise<SyncResult<any>> {\n\ttry {\n\t\tconst client = generateClient({\n\t\t\tauthMode: options.authMode || \"apiKey\",\n\t\t});\n\n\t\tconst { data, errors } = await (client as any).models.Brand.list({\n\t\t\tlimit: options.limit || 1000,\n\t\t});\n\n\t\treturn {\n\t\t\tdata: data || [],\n\t\t\terrors: errors || null,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[fetchBrands] Error:\", error);\n\t\treturn {\n\t\t\tdata: [],\n\t\t\terrors: [{ message: (error as Error).message }],\n\t\t};\n\t}\n}\n\n/**\n * Fetch accounts from AppSync\n */\nexport async function fetchAccounts(\n\toptions: SyncOptions,\n): Promise<SyncResult<any>> {\n\ttry {\n\t\tconst client = generateClient({\n\t\t\tauthMode: options.authMode || \"apiKey\",\n\t\t});\n\n\t\tconst { data, errors } = await (client as any).models.Account.list({\n\t\t\tlimit: options.limit || 1000,\n\t\t});\n\n\t\treturn {\n\t\t\tdata: data || [],\n\t\t\terrors: errors || null,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[fetchAccounts] Error:\", error);\n\t\treturn {\n\t\t\tdata: [],\n\t\t\terrors: [{ message: (error as Error).message }],\n\t\t};\n\t}\n}\n\n/**\n * Fetch product instances from AppSync\n */\nexport async function fetchProductInstances(\n\toptions: SyncOptions,\n): Promise<SyncResult<any>> {\n\ttry {\n\t\tconst client = generateClient({\n\t\t\tauthMode: options.authMode || \"apiKey\",\n\t\t});\n\n\t\tconst { data, errors } = await (client as any).models.ProductInstance.list(\n\t\t\t{\n\t\t\t\tlimit: options.limit || 1000,\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\tdata: data || [],\n\t\t\terrors: errors || null,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[fetchProductInstances] Error:\", error);\n\t\treturn {\n\t\t\tdata: [],\n\t\t\terrors: [{ message: (error as Error).message }],\n\t\t};\n\t}\n}\n\n/**\n * Fetch products from AppSync\n */\nexport async function fetchProducts(\n\toptions: SyncOptions,\n): Promise<SyncResult<any>> {\n\ttry {\n\t\tconst client = generateClient({\n\t\t\tauthMode: options.authMode || \"apiKey\",\n\t\t});\n\n\t\tconst { data, errors } = await (client as any).models.Product.list({\n\t\t\tlimit: options.limit || 1000,\n\t\t});\n\n\t\treturn {\n\t\t\tdata: data || [],\n\t\t\terrors: errors || null,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"[fetchProducts] Error:\", error);\n\t\treturn {\n\t\t\tdata: [],\n\t\t\terrors: [{ message: (error as Error).message }],\n\t\t};\n\t}\n}\n","/**\n * Zod Schemas for Content Collections\n *\n * Defines validation schemas for brands, accounts, and product instances\n * that will be synced from AppSync to Astro Content Collections.\n */\n\nimport { z } from \"zod\";\n\n/**\n * Brand schema for content collections\n */\nexport const brandSchema = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\taccountId: z.string(),\n\tlogo: z.string().optional(),\n\ttimezone: z.string(),\n\tstatus: z.enum([\"active\", \"inactive\", \"maintenance\", \"suspended\"]),\n\tsettings: z.record(z.any()).optional().default({}),\n\tcreatedAt: z.string().optional(),\n\tupdatedAt: z.string().optional(),\n});\n\nexport type BrandData = z.infer<typeof brandSchema>;\n\n/**\n * Account schema for content collections\n */\nexport const accountSchema = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tlogo: z.string().optional(),\n\tsubscription: z.record(z.any()).optional().default({}),\n\tsettings: z.record(z.any()).optional().default({}),\n\tcreatedAt: z.string().optional(),\n\tupdatedAt: z.string().optional(),\n});\n\nexport type AccountData = z.infer<typeof accountSchema>;\n\n/**\n * Product Instance schema for content collections\n */\nexport const productInstanceSchema = z.object({\n\tid: z.string(),\n\tproductId: z.string(),\n\tproductName: z.string(),\n\tbrandId: z.string(),\n\taccountId: z.string(),\n\tenabled: z.boolean(),\n\tconfig: z.record(z.any()).optional().default({}),\n\tversion: z.string(),\n\tcreatedAt: z.string().optional(),\n\tupdatedAt: z.string().optional(),\n});\n\nexport type ProductInstanceData = z.infer<typeof productInstanceSchema>;\n\n/**\n * Product schema for content collections\n */\nexport const productSchema = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tversion: z.string(),\n\tschema: z.record(z.any()).optional().default({}),\n\tuiSchema: z.record(z.any()).optional().default({}),\n\tdefaultConfig: z.record(z.any()).optional().default({}),\n\tisActive: z.boolean(),\n\tcreatedAt: z.string().optional(),\n\tupdatedAt: z.string().optional(),\n});\n\nexport type ProductData = z.infer<typeof productSchema>;\n"],"mappings":";AAOA,SAAS,eAAe,WAAW,kBAAkB;AACrD,SAAS,YAAY;;;ACFrB,SAAS,sBAAsB;AAuB/B,eAAsB,YACrB,SAC2B;AAC3B,MAAI;AACH,UAAM,SAAS,eAAe;AAAA,MAC7B,UAAU,QAAQ,YAAY;AAAA,IAC/B,CAAC;AAED,UAAM,EAAE,MAAM,OAAO,IAAI,MAAO,OAAe,OAAO,M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200 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { Brand, Account, User, Product } from '@htlkg/core/types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* useBrands Hook
|
|
6
|
+
*
|
|
7
|
+
* Vue composable for fetching and managing brand data with reactive state.
|
|
8
|
+
* Provides loading states, error handling, and refetch capabilities.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
interface UseBrandsOptions {
|
|
12
|
+
/** Filter criteria for brands */
|
|
13
|
+
filter?: any;
|
|
14
|
+
/** Limit number of results */
|
|
15
|
+
limit?: number;
|
|
16
|
+
/** Auto-fetch on mount (default: true) */
|
|
17
|
+
autoFetch?: boolean;
|
|
18
|
+
/** Filter by account ID */
|
|
19
|
+
accountId?: string;
|
|
20
|
+
/** Only active brands */
|
|
21
|
+
activeOnly?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface UseBrandsReturn {
|
|
24
|
+
/** Reactive array of brands */
|
|
25
|
+
brands: Ref<Brand[]>;
|
|
26
|
+
/** Computed array of active brands only */
|
|
27
|
+
activeBrands: ComputedRef<Brand[]>;
|
|
28
|
+
/** Loading state */
|
|
29
|
+
loading: Ref<boolean>;
|
|
30
|
+
/** Error state */
|
|
31
|
+
error: Ref<Error | null>;
|
|
32
|
+
/** Refetch brands */
|
|
33
|
+
refetch: () => Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Composable for fetching and managing brands
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { useBrands } from '@htlkg/data/hooks';
|
|
41
|
+
*
|
|
42
|
+
* const { brands, loading, error, refetch } = useBrands();
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example With filters
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const { brands, loading } = useBrands({
|
|
48
|
+
* accountId: 'account-123',
|
|
49
|
+
* activeOnly: true,
|
|
50
|
+
* limit: 50
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare function useBrands(options?: UseBrandsOptions): UseBrandsReturn;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* useAccounts Hook
|
|
58
|
+
*
|
|
59
|
+
* Vue composable for fetching and managing account data with reactive state.
|
|
60
|
+
* Provides loading states, error handling, and refetch capabilities.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
interface UseAccountsOptions {
|
|
64
|
+
/** Filter criteria for accounts */
|
|
65
|
+
filter?: any;
|
|
66
|
+
/** Limit number of results */
|
|
67
|
+
limit?: number;
|
|
68
|
+
/** Auto-fetch on mount (default: true) */
|
|
69
|
+
autoFetch?: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface UseAccountsReturn {
|
|
72
|
+
/** Reactive array of accounts */
|
|
73
|
+
accounts: Ref<Account[]>;
|
|
74
|
+
/** Loading state */
|
|
75
|
+
loading: Ref<boolean>;
|
|
76
|
+
/** Error state */
|
|
77
|
+
error: Ref<Error | null>;
|
|
78
|
+
/** Refetch accounts */
|
|
79
|
+
refetch: () => Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Composable for fetching and managing accounts
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { useAccounts } from '@htlkg/data/hooks';
|
|
87
|
+
*
|
|
88
|
+
* const { accounts, loading, error, refetch } = useAccounts();
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example With filters
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const { accounts, loading } = useAccounts({
|
|
94
|
+
* filter: { status: { eq: 'active' } },
|
|
95
|
+
* limit: 50
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
declare function useAccounts(options?: UseAccountsOptions): UseAccountsReturn;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* useUsers Hook
|
|
103
|
+
*
|
|
104
|
+
* Vue composable for fetching and managing user data with reactive state.
|
|
105
|
+
* Provides loading states, error handling, and refetch capabilities.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
interface UseUsersOptions {
|
|
109
|
+
/** Filter criteria for users */
|
|
110
|
+
filter?: any;
|
|
111
|
+
/** Limit number of results */
|
|
112
|
+
limit?: number;
|
|
113
|
+
/** Auto-fetch on mount (default: true) */
|
|
114
|
+
autoFetch?: boolean;
|
|
115
|
+
/** Filter by brand ID */
|
|
116
|
+
brandId?: string;
|
|
117
|
+
/** Filter by account ID */
|
|
118
|
+
accountId?: string;
|
|
119
|
+
}
|
|
120
|
+
interface UseUsersReturn {
|
|
121
|
+
/** Reactive array of users */
|
|
122
|
+
users: Ref<User[]>;
|
|
123
|
+
/** Loading state */
|
|
124
|
+
loading: Ref<boolean>;
|
|
125
|
+
/** Error state */
|
|
126
|
+
error: Ref<Error | null>;
|
|
127
|
+
/** Refetch users */
|
|
128
|
+
refetch: () => Promise<void>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Composable for fetching and managing users
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* import { useUsers } from '@htlkg/data/hooks';
|
|
136
|
+
*
|
|
137
|
+
* const { users, loading, error, refetch } = useUsers();
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @example With filters
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const { users, loading } = useUsers({
|
|
143
|
+
* brandId: 'brand-123',
|
|
144
|
+
* accountId: 'account-456',
|
|
145
|
+
* limit: 50
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
declare function useUsers(options?: UseUsersOptions): UseUsersReturn;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* useProducts Hook
|
|
153
|
+
*
|
|
154
|
+
* Vue composable for fetching and managing product data with reactive state.
|
|
155
|
+
* Provides loading states, error handling, and refetch capabilities.
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
interface UseProductsOptions {
|
|
159
|
+
/** Filter criteria for products */
|
|
160
|
+
filter?: any;
|
|
161
|
+
/** Limit number of results */
|
|
162
|
+
limit?: number;
|
|
163
|
+
/** Auto-fetch on mount (default: true) */
|
|
164
|
+
autoFetch?: boolean;
|
|
165
|
+
/** Only active products */
|
|
166
|
+
activeOnly?: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface UseProductsReturn {
|
|
169
|
+
/** Reactive array of products */
|
|
170
|
+
products: Ref<Product[]>;
|
|
171
|
+
/** Computed array of active products only */
|
|
172
|
+
activeProducts: ComputedRef<Product[]>;
|
|
173
|
+
/** Loading state */
|
|
174
|
+
loading: Ref<boolean>;
|
|
175
|
+
/** Error state */
|
|
176
|
+
error: Ref<Error | null>;
|
|
177
|
+
/** Refetch products */
|
|
178
|
+
refetch: () => Promise<void>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Composable for fetching and managing products
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* import { useProducts } from '@htlkg/data/hooks';
|
|
186
|
+
*
|
|
187
|
+
* const { products, loading, error, refetch } = useProducts();
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* @example With filters
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const { products, loading } = useProducts({
|
|
193
|
+
* activeOnly: true,
|
|
194
|
+
* limit: 50
|
|
195
|
+
* });
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
declare function useProducts(options?: UseProductsOptions): UseProductsReturn;
|
|
199
|
+
|
|
200
|
+
export { type UseAccountsOptions, type UseAccountsReturn, type UseBrandsOptions, type UseBrandsReturn, type UseProductsOptions, type UseProductsReturn, type UseUsersOptions, type UseUsersReturn, useAccounts, useBrands, useProducts, useUsers };
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
|
|
15
|
+
// src/hooks/useBrands.ts
|
|
16
|
+
import { ref, computed, onMounted } from "vue";
|
|
17
|
+
|
|
18
|
+
// ../../node_modules/.pnpm/aws-amplify@6.15.8/node_modules/aws-amplify/dist/esm/api/index.mjs
|
|
19
|
+
var api_exports = {};
|
|
20
|
+
__reExport(api_exports, api_star);
|
|
21
|
+
import * as api_star from "@aws-amplify/api";
|
|
22
|
+
|
|
23
|
+
// src/client/index.ts
|
|
24
|
+
function generateClient() {
|
|
25
|
+
return (0, api_exports.generateClient)();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/hooks/useBrands.ts
|
|
29
|
+
function useBrands(options = {}) {
|
|
30
|
+
const {
|
|
31
|
+
filter: baseFilter,
|
|
32
|
+
limit,
|
|
33
|
+
autoFetch = true,
|
|
34
|
+
accountId,
|
|
35
|
+
activeOnly
|
|
36
|
+
} = options;
|
|
37
|
+
const brands = ref([]);
|
|
38
|
+
const loading = ref(false);
|
|
39
|
+
const error = ref(null);
|
|
40
|
+
let filter = baseFilter || {};
|
|
41
|
+
if (accountId) {
|
|
42
|
+
filter = { ...filter, accountId: { eq: accountId } };
|
|
43
|
+
}
|
|
44
|
+
if (activeOnly) {
|
|
45
|
+
filter = { ...filter, status: { eq: "active" } };
|
|
46
|
+
}
|
|
47
|
+
const activeBrands = computed(
|
|
48
|
+
() => brands.value.filter((b) => b.status === "active")
|
|
49
|
+
);
|
|
50
|
+
async function fetch() {
|
|
51
|
+
loading.value = true;
|
|
52
|
+
error.value = null;
|
|
53
|
+
try {
|
|
54
|
+
const client = generateClient();
|
|
55
|
+
const { data, errors } = await client.models.Brand.list({
|
|
56
|
+
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
57
|
+
limit
|
|
58
|
+
});
|
|
59
|
+
if (errors) {
|
|
60
|
+
throw new Error(errors[0]?.message || "Failed to fetch brands");
|
|
61
|
+
}
|
|
62
|
+
brands.value = data || [];
|
|
63
|
+
} catch (e) {
|
|
64
|
+
error.value = e;
|
|
65
|
+
console.error("[useBrands] Error fetching brands:", e);
|
|
66
|
+
} finally {
|
|
67
|
+
loading.value = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (autoFetch) {
|
|
71
|
+
onMounted(() => {
|
|
72
|
+
fetch();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
brands,
|
|
77
|
+
activeBrands,
|
|
78
|
+
loading,
|
|
79
|
+
error,
|
|
80
|
+
refetch: fetch
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/hooks/useAccounts.ts
|
|
85
|
+
import { ref as ref2, onMounted as onMounted2 } from "vue";
|
|
86
|
+
function useAccounts(options = {}) {
|
|
87
|
+
const { filter, limit, autoFetch = true } = options;
|
|
88
|
+
const accounts = ref2([]);
|
|
89
|
+
const loading = ref2(false);
|
|
90
|
+
const error = ref2(null);
|
|
91
|
+
async function fetch() {
|
|
92
|
+
loading.value = true;
|
|
93
|
+
error.value = null;
|
|
94
|
+
try {
|
|
95
|
+
const client = generateClient();
|
|
96
|
+
const { data, errors } = await client.models.Account.list({
|
|
97
|
+
filter,
|
|
98
|
+
limit
|
|
99
|
+
});
|
|
100
|
+
if (errors) {
|
|
101
|
+
throw new Error(errors[0]?.message || "Failed to fetch accounts");
|
|
102
|
+
}
|
|
103
|
+
accounts.value = data || [];
|
|
104
|
+
} catch (e) {
|
|
105
|
+
error.value = e;
|
|
106
|
+
console.error("[useAccounts] Error fetching accounts:", e);
|
|
107
|
+
} finally {
|
|
108
|
+
loading.value = false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (autoFetch) {
|
|
112
|
+
onMounted2(() => {
|
|
113
|
+
fetch();
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
accounts,
|
|
118
|
+
loading,
|
|
119
|
+
error,
|
|
120
|
+
refetch: fetch
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/hooks/useUsers.ts
|
|
125
|
+
import { ref as ref3, onMounted as onMounted3 } from "vue";
|
|
126
|
+
function useUsers(options = {}) {
|
|
127
|
+
const { filter: baseFilter, limit, autoFetch = true, brandId, accountId } = options;
|
|
128
|
+
const users = ref3([]);
|
|
129
|
+
const loading = ref3(false);
|
|
130
|
+
const error = ref3(null);
|
|
131
|
+
let filter = baseFilter || {};
|
|
132
|
+
if (brandId) {
|
|
133
|
+
filter = { ...filter, brandIds: { contains: brandId } };
|
|
134
|
+
}
|
|
135
|
+
if (accountId) {
|
|
136
|
+
filter = { ...filter, accountIds: { contains: accountId } };
|
|
137
|
+
}
|
|
138
|
+
async function fetch() {
|
|
139
|
+
loading.value = true;
|
|
140
|
+
error.value = null;
|
|
141
|
+
try {
|
|
142
|
+
const client = generateClient();
|
|
143
|
+
const { data, errors } = await client.models.User.list({
|
|
144
|
+
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
145
|
+
limit
|
|
146
|
+
});
|
|
147
|
+
if (errors) {
|
|
148
|
+
throw new Error(errors[0]?.message || "Failed to fetch users");
|
|
149
|
+
}
|
|
150
|
+
users.value = data || [];
|
|
151
|
+
} catch (e) {
|
|
152
|
+
error.value = e;
|
|
153
|
+
console.error("[useUsers] Error fetching users:", e);
|
|
154
|
+
} finally {
|
|
155
|
+
loading.value = false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (autoFetch) {
|
|
159
|
+
onMounted3(() => {
|
|
160
|
+
fetch();
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
users,
|
|
165
|
+
loading,
|
|
166
|
+
error,
|
|
167
|
+
refetch: fetch
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/hooks/useProducts.ts
|
|
172
|
+
import { ref as ref4, computed as computed2, onMounted as onMounted4 } from "vue";
|
|
173
|
+
function useProducts(options = {}) {
|
|
174
|
+
const { filter: baseFilter, limit, autoFetch = true, activeOnly } = options;
|
|
175
|
+
const products = ref4([]);
|
|
176
|
+
const loading = ref4(false);
|
|
177
|
+
const error = ref4(null);
|
|
178
|
+
let filter = baseFilter || {};
|
|
179
|
+
if (activeOnly) {
|
|
180
|
+
filter = { ...filter, isActive: { eq: true } };
|
|
181
|
+
}
|
|
182
|
+
const activeProducts = computed2(
|
|
183
|
+
() => products.value.filter((p) => p.isActive === true)
|
|
184
|
+
);
|
|
185
|
+
async function fetch() {
|
|
186
|
+
loading.value = true;
|
|
187
|
+
error.value = null;
|
|
188
|
+
try {
|
|
189
|
+
const client = generateClient();
|
|
190
|
+
const { data, errors } = await client.models.Product.list({
|
|
191
|
+
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
192
|
+
limit
|
|
193
|
+
});
|
|
194
|
+
if (errors) {
|
|
195
|
+
throw new Error(errors[0]?.message || "Failed to fetch products");
|
|
196
|
+
}
|
|
197
|
+
products.value = data || [];
|
|
198
|
+
} catch (e) {
|
|
199
|
+
error.value = e;
|
|
200
|
+
console.error("[useProducts] Error fetching products:", e);
|
|
201
|
+
} finally {
|
|
202
|
+
loading.value = false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (autoFetch) {
|
|
206
|
+
onMounted4(() => {
|
|
207
|
+
fetch();
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
products,
|
|
212
|
+
activeProducts,
|
|
213
|
+
loading,
|
|
214
|
+
error,
|
|
215
|
+
refetch: fetch
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
export {
|
|
219
|
+
useAccounts,
|
|
220
|
+
useBrands,
|
|
221
|
+
useProducts,
|
|
222
|
+
useUsers
|
|
223
|
+
};
|
|
224
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useBrands.ts","../../../../node_modules/.pnpm/aws-amplify@6.15.8/node_modules/aws-amplify/dist/esm/api/index.mjs","../../src/client/index.ts","../../src/hooks/useAccounts.ts","../../src/hooks/useUsers.ts","../../src/hooks/useProducts.ts"],"sourcesContent":["/**\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","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 * 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":";;;;;;;;;;;;;;;AAOA,SAAS,KAAK,UAAU,iBAA6C;;;ACPrE;AAAA;AAAA,0BAAc;;;ACuBP,SAAS,iBAEoC;AACnD,aAAO,YAAAA,gB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jD;AAGA,iBAAe,QAAQ;AACtB,YAAQ,QAAQ;AAChB,UAAM,QAAQ;AAEd,QAAI;AACH,YAAM,SAAS,eAAe;AAC9B,YAAM,EAAE,MAAM,OAAO,IAAI,MAAO,OAAe,OAAO,QAAQ,KAAK;AAAA,QAClE,QAAQ,OAAO,KAAK,MAAM,EAAE,SAAS,IAAI,SAAS;AAAA,QAClD;AAAA,MACD,CAAC;AAED,UAAI,QAAQ;AACX,cAAM,IAAI,MAAM,OAAO,CAAC,GAAG,WAAW,0BAA0B;AAAA,MACjE;AAEA,eAAS,QAAS,QAAQ,CAAC;AAAA,IAC5B,SAAS,GAAG;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"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { AstroAmplifyConfig, generateClient, generateServerClient } from './client/index.js';
|
|
2
|
+
export { getAccount, getAccountWithBrands, getBrand, getBrandWithProducts, getProduct, getProductInstance, getUser, getUserByCognitoId, getUserByEmail, listAccounts, listActiveBrands, listActiveProducts, listActiveUsers, listBrands, listBrandsByAccount, listEnabledProductInstancesByBrand, listProductInstancesByAccount, listProductInstancesByBrand, listProducts, listUsers, listUsersByAccount } from './queries/index.js';
|
|
3
|
+
export { CreateAccountInput, CreateBrandInput, CreateUserInput, UpdateAccountInput, UpdateBrandInput, UpdateUserInput, createAccount, createBrand, createUser, deleteAccount, deleteBrand, deleteUser, updateAccount, updateBrand, updateUser } from './mutations/index.js';
|
|
4
|
+
export { UseAccountsOptions, UseAccountsReturn, UseBrandsOptions, UseBrandsReturn, UseProductsOptions, UseProductsReturn, UseUsersOptions, UseUsersReturn, useAccounts, useBrands, useProducts, useUsers } from './hooks/index.js';
|
|
5
|
+
import 'astro';
|
|
6
|
+
import 'aws-amplify/data';
|
|
7
|
+
import '@htlkg/core/types';
|
|
8
|
+
import 'vue';
|