@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,386 @@
|
|
|
1
|
+
import { Brand, Account, User, Product, ProductInstance } from '@htlkg/core/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Brand Query Functions
|
|
5
|
+
*
|
|
6
|
+
* Provides query functions for fetching brand data from the GraphQL API.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get a single brand by ID
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { getBrand } from '@htlkg/data/queries';
|
|
15
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
16
|
+
*
|
|
17
|
+
* const client = generateClient<Schema>();
|
|
18
|
+
* const brand = await getBrand(client, 'brand-123');
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function getBrand<TClient = any>(client: TClient, id: string): Promise<Brand | null>;
|
|
22
|
+
/**
|
|
23
|
+
* List all brands with optional filtering
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { listBrands } from '@htlkg/data/queries';
|
|
28
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
29
|
+
*
|
|
30
|
+
* const client = generateClient<Schema>();
|
|
31
|
+
* const brands = await listBrands(client, {
|
|
32
|
+
* filter: { status: { eq: 'active' } }
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function listBrands<TClient = any>(client: TClient, options?: {
|
|
37
|
+
filter?: any;
|
|
38
|
+
limit?: number;
|
|
39
|
+
nextToken?: string;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
items: Brand[];
|
|
42
|
+
nextToken?: string;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Get a brand with its product instances
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { getBrandWithProducts } from '@htlkg/data/queries';
|
|
50
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
51
|
+
*
|
|
52
|
+
* const client = generateClient<Schema>();
|
|
53
|
+
* const brand = await getBrandWithProducts(client, 'brand-123');
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function getBrandWithProducts<TClient = any>(client: TClient, id: string): Promise<Brand | null>;
|
|
57
|
+
/**
|
|
58
|
+
* List brands by account ID
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* import { listBrandsByAccount } from '@htlkg/data/queries';
|
|
63
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
64
|
+
*
|
|
65
|
+
* const client = generateClient<Schema>();
|
|
66
|
+
* const brands = await listBrandsByAccount(client, 'account-123');
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function listBrandsByAccount<TClient = any>(client: TClient, accountId: string, options?: {
|
|
70
|
+
limit?: number;
|
|
71
|
+
nextToken?: string;
|
|
72
|
+
}): Promise<{
|
|
73
|
+
items: Brand[];
|
|
74
|
+
nextToken?: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* List active brands
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* import { listActiveBrands } from '@htlkg/data/queries';
|
|
82
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
83
|
+
*
|
|
84
|
+
* const client = generateClient<Schema>();
|
|
85
|
+
* const brands = await listActiveBrands(client);
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
declare function listActiveBrands<TClient = any>(client: TClient, options?: {
|
|
89
|
+
limit?: number;
|
|
90
|
+
nextToken?: string;
|
|
91
|
+
}): Promise<{
|
|
92
|
+
items: Brand[];
|
|
93
|
+
nextToken?: string;
|
|
94
|
+
}>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Account Query Functions
|
|
98
|
+
*
|
|
99
|
+
* Provides query functions for fetching account data from the GraphQL API.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get a single account by ID
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* import { getAccount } from '@htlkg/data/queries';
|
|
108
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
109
|
+
*
|
|
110
|
+
* const client = generateClient<Schema>();
|
|
111
|
+
* const account = await getAccount(client, 'account-123');
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
declare function getAccount<TClient = any>(client: TClient, id: string): Promise<Account | null>;
|
|
115
|
+
/**
|
|
116
|
+
* List all accounts with optional filtering
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* import { listAccounts } from '@htlkg/data/queries';
|
|
121
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
122
|
+
*
|
|
123
|
+
* const client = generateClient<Schema>();
|
|
124
|
+
* const accounts = await listAccounts(client);
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare function listAccounts<TClient = any>(client: TClient, options?: {
|
|
128
|
+
filter?: any;
|
|
129
|
+
limit?: number;
|
|
130
|
+
nextToken?: string;
|
|
131
|
+
}): Promise<{
|
|
132
|
+
items: Account[];
|
|
133
|
+
nextToken?: string;
|
|
134
|
+
}>;
|
|
135
|
+
/**
|
|
136
|
+
* Get an account with its brands
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* import { getAccountWithBrands } from '@htlkg/data/queries';
|
|
141
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
142
|
+
*
|
|
143
|
+
* const client = generateClient<Schema>();
|
|
144
|
+
* const account = await getAccountWithBrands(client, 'account-123');
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare function getAccountWithBrands<TClient = any>(client: TClient, id: string): Promise<Account | null>;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* User Query Functions
|
|
151
|
+
*
|
|
152
|
+
* Provides query functions for fetching user data from the GraphQL API.
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Get a single user by ID
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* import { getUser } from '@htlkg/data/queries';
|
|
161
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
162
|
+
*
|
|
163
|
+
* const client = generateClient<Schema>();
|
|
164
|
+
* const user = await getUser(client, 'user-123');
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
declare function getUser<TClient = any>(client: TClient, id: string): Promise<User | null>;
|
|
168
|
+
/**
|
|
169
|
+
* Get a user by Cognito ID
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* import { getUserByCognitoId } from '@htlkg/data/queries';
|
|
174
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
175
|
+
*
|
|
176
|
+
* const client = generateClient<Schema>();
|
|
177
|
+
* const user = await getUserByCognitoId(client, 'cognito-id-123');
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
declare function getUserByCognitoId<TClient = any>(client: TClient, cognitoId: string): Promise<User | null>;
|
|
181
|
+
/**
|
|
182
|
+
* Get a user by email
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* import { getUserByEmail } from '@htlkg/data/queries';
|
|
187
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
188
|
+
*
|
|
189
|
+
* const client = generateClient<Schema>();
|
|
190
|
+
* const user = await getUserByEmail(client, 'user@example.com');
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
declare function getUserByEmail<TClient = any>(client: TClient, email: string): Promise<User | null>;
|
|
194
|
+
/**
|
|
195
|
+
* List all users with optional filtering
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* import { listUsers } from '@htlkg/data/queries';
|
|
200
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
201
|
+
*
|
|
202
|
+
* const client = generateClient<Schema>();
|
|
203
|
+
* const users = await listUsers(client, {
|
|
204
|
+
* filter: { status: { eq: 'active' } }
|
|
205
|
+
* });
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
declare function listUsers<TClient = any>(client: TClient, options?: {
|
|
209
|
+
filter?: any;
|
|
210
|
+
limit?: number;
|
|
211
|
+
nextToken?: string;
|
|
212
|
+
}): Promise<{
|
|
213
|
+
items: User[];
|
|
214
|
+
nextToken?: string;
|
|
215
|
+
}>;
|
|
216
|
+
/**
|
|
217
|
+
* List users by account ID
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* import { listUsersByAccount } from '@htlkg/data/queries';
|
|
222
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
223
|
+
*
|
|
224
|
+
* const client = generateClient<Schema>();
|
|
225
|
+
* const users = await listUsersByAccount(client, 'account-123');
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare function listUsersByAccount<TClient = any>(client: TClient, accountId: string, options?: {
|
|
229
|
+
limit?: number;
|
|
230
|
+
nextToken?: string;
|
|
231
|
+
}): Promise<{
|
|
232
|
+
items: User[];
|
|
233
|
+
nextToken?: string;
|
|
234
|
+
}>;
|
|
235
|
+
/**
|
|
236
|
+
* List active users
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```typescript
|
|
240
|
+
* import { listActiveUsers } from '@htlkg/data/queries';
|
|
241
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
242
|
+
*
|
|
243
|
+
* const client = generateClient<Schema>();
|
|
244
|
+
* const users = await listActiveUsers(client);
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
declare function listActiveUsers<TClient = any>(client: TClient, options?: {
|
|
248
|
+
limit?: number;
|
|
249
|
+
nextToken?: string;
|
|
250
|
+
}): Promise<{
|
|
251
|
+
items: User[];
|
|
252
|
+
nextToken?: string;
|
|
253
|
+
}>;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Product Query Functions
|
|
257
|
+
*
|
|
258
|
+
* Provides query functions for fetching product and product instance data from the GraphQL API.
|
|
259
|
+
*/
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Get a single product by ID
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* import { getProduct } from '@htlkg/data/queries';
|
|
267
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
268
|
+
*
|
|
269
|
+
* const client = generateClient<Schema>();
|
|
270
|
+
* const product = await getProduct(client, 'product-123');
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
declare function getProduct<TClient = any>(client: TClient, id: string): Promise<Product | null>;
|
|
274
|
+
/**
|
|
275
|
+
* List all products with optional filtering
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* import { listProducts } from '@htlkg/data/queries';
|
|
280
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
281
|
+
*
|
|
282
|
+
* const client = generateClient<Schema>();
|
|
283
|
+
* const products = await listProducts(client, {
|
|
284
|
+
* filter: { isActive: { eq: true } }
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
declare function listProducts<TClient = any>(client: TClient, options?: {
|
|
289
|
+
filter?: any;
|
|
290
|
+
limit?: number;
|
|
291
|
+
nextToken?: string;
|
|
292
|
+
}): Promise<{
|
|
293
|
+
items: Product[];
|
|
294
|
+
nextToken?: string;
|
|
295
|
+
}>;
|
|
296
|
+
/**
|
|
297
|
+
* List active products
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* import { listActiveProducts } from '@htlkg/data/queries';
|
|
302
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
303
|
+
*
|
|
304
|
+
* const client = generateClient<Schema>();
|
|
305
|
+
* const products = await listActiveProducts(client);
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
declare function listActiveProducts<TClient = any>(client: TClient, options?: {
|
|
309
|
+
limit?: number;
|
|
310
|
+
nextToken?: string;
|
|
311
|
+
}): Promise<{
|
|
312
|
+
items: Product[];
|
|
313
|
+
nextToken?: string;
|
|
314
|
+
}>;
|
|
315
|
+
/**
|
|
316
|
+
* Get a single product instance by ID
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```typescript
|
|
320
|
+
* import { getProductInstance } from '@htlkg/data/queries';
|
|
321
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
322
|
+
*
|
|
323
|
+
* const client = generateClient<Schema>();
|
|
324
|
+
* const instance = await getProductInstance(client, 'instance-123');
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
declare function getProductInstance<TClient = any>(client: TClient, id: string): Promise<ProductInstance | null>;
|
|
328
|
+
/**
|
|
329
|
+
* List product instances by brand ID
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```typescript
|
|
333
|
+
* import { listProductInstancesByBrand } from '@htlkg/data/queries';
|
|
334
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
335
|
+
*
|
|
336
|
+
* const client = generateClient<Schema>();
|
|
337
|
+
* const instances = await listProductInstancesByBrand(client, 'brand-123');
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
declare function listProductInstancesByBrand<TClient = any>(client: TClient, brandId: string, options?: {
|
|
341
|
+
limit?: number;
|
|
342
|
+
nextToken?: string;
|
|
343
|
+
}): Promise<{
|
|
344
|
+
items: ProductInstance[];
|
|
345
|
+
nextToken?: string;
|
|
346
|
+
}>;
|
|
347
|
+
/**
|
|
348
|
+
* List product instances by account ID
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* import { listProductInstancesByAccount } from '@htlkg/data/queries';
|
|
353
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
354
|
+
*
|
|
355
|
+
* const client = generateClient<Schema>();
|
|
356
|
+
* const instances = await listProductInstancesByAccount(client, 'account-123');
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
declare function listProductInstancesByAccount<TClient = any>(client: TClient, accountId: string, options?: {
|
|
360
|
+
limit?: number;
|
|
361
|
+
nextToken?: string;
|
|
362
|
+
}): Promise<{
|
|
363
|
+
items: ProductInstance[];
|
|
364
|
+
nextToken?: string;
|
|
365
|
+
}>;
|
|
366
|
+
/**
|
|
367
|
+
* List enabled product instances by brand ID
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* import { listEnabledProductInstancesByBrand } from '@htlkg/data/queries';
|
|
372
|
+
* import { generateClient } from '@htlkg/data/client';
|
|
373
|
+
*
|
|
374
|
+
* const client = generateClient<Schema>();
|
|
375
|
+
* const instances = await listEnabledProductInstancesByBrand(client, 'brand-123');
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
declare function listEnabledProductInstancesByBrand<TClient = any>(client: TClient, brandId: string, options?: {
|
|
379
|
+
limit?: number;
|
|
380
|
+
nextToken?: string;
|
|
381
|
+
}): Promise<{
|
|
382
|
+
items: ProductInstance[];
|
|
383
|
+
nextToken?: string;
|
|
384
|
+
}>;
|
|
385
|
+
|
|
386
|
+
export { getAccount, getAccountWithBrands, getBrand, getBrandWithProducts, getProduct, getProductInstance, getUser, getUserByCognitoId, getUserByEmail, listAccounts, listActiveBrands, listActiveProducts, listActiveUsers, listBrands, listBrandsByAccount, listEnabledProductInstancesByBrand, listProductInstancesByAccount, listProductInstancesByBrand, listProducts, listUsers, listUsersByAccount };
|