@instockng/api-client 1.0.9 → 1.0.11

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.
Files changed (117) hide show
  1. package/dist/apps/backend/src/lib/brand-response.d.ts +2 -0
  2. package/dist/apps/backend/src/lib/cart-helpers.d.ts +4 -0
  3. package/dist/apps/backend/src/lib/cart-response.d.ts +2 -0
  4. package/dist/apps/backend/src/lib/delivery-zone-response.d.ts +2 -0
  5. package/dist/apps/backend/src/lib/discount-code-response.d.ts +2 -0
  6. package/dist/apps/backend/src/lib/order-recovery.d.ts +6 -0
  7. package/dist/apps/backend/src/lib/order-response.d.ts +2 -0
  8. package/dist/apps/backend/src/lib/product-response.d.ts +2 -0
  9. package/dist/apps/backend/src/routes/admin/abandoned-carts.d.ts +4 -8
  10. package/dist/apps/backend/src/routes/admin/brands.d.ts +8 -0
  11. package/dist/apps/backend/src/routes/admin/customers.d.ts +2 -4
  12. package/dist/apps/backend/src/routes/admin/delivery-zones.d.ts +8 -0
  13. package/dist/apps/backend/src/routes/admin/discount-codes.d.ts +10 -0
  14. package/dist/apps/backend/src/routes/admin/inventory.d.ts +0 -4
  15. package/dist/apps/backend/src/routes/admin/orders.d.ts +12 -24
  16. package/dist/apps/backend/src/routes/admin/products.d.ts +8 -16
  17. package/dist/apps/backend/src/routes/admin/stats.d.ts +2 -4
  18. package/dist/apps/backend/src/routes/admin/warehouses.d.ts +2 -4
  19. package/dist/apps/backend/src/routes/public/brands.d.ts +1 -0
  20. package/dist/apps/backend/src/routes/public/brands.js +1 -0
  21. package/dist/apps/backend/src/routes/public/carts.d.ts +18 -36
  22. package/dist/apps/backend/src/routes/public/orders.d.ts +4 -8
  23. package/dist/apps/backend/src/routes/public/products.d.ts +4 -8
  24. package/dist/apps/backend/src/validators/brand.d.ts +4 -0
  25. package/dist/apps/backend/src/validators/brand.js +4 -0
  26. package/dist/packages/api-client/src/fetchers/brands.d.ts +1 -0
  27. package/dist/packages/api-client/src/fetchers/carts.d.ts +18 -36
  28. package/dist/packages/api-client/src/fetchers/orders.d.ts +4 -8
  29. package/dist/packages/api-client/src/fetchers/products.d.ts +4 -8
  30. package/dist/packages/api-client/src/hooks/admin/abandoned-carts.d.ts +4 -8
  31. package/dist/packages/api-client/src/hooks/admin/brands.d.ts +8 -0
  32. package/dist/packages/api-client/src/hooks/admin/customers.d.ts +2 -4
  33. package/dist/packages/api-client/src/hooks/admin/delivery-zones.d.ts +8 -0
  34. package/dist/packages/api-client/src/hooks/admin/discount-codes.d.ts +10 -0
  35. package/dist/packages/api-client/src/hooks/admin/inventory.d.ts +0 -4
  36. package/dist/packages/api-client/src/hooks/admin/orders.d.ts +12 -24
  37. package/dist/packages/api-client/src/hooks/admin/products.d.ts +4 -8
  38. package/dist/packages/api-client/src/hooks/admin/stats.d.ts +2 -4
  39. package/dist/packages/api-client/src/hooks/admin/warehouses.d.ts +2 -4
  40. package/dist/packages/api-client/src/hooks/public/brands.d.ts +1 -0
  41. package/dist/packages/api-client/src/hooks/public/carts.d.ts +18 -36
  42. package/dist/packages/api-client/src/hooks/public/orders.d.ts +4 -8
  43. package/dist/packages/api-client/src/hooks/public/products.d.ts +4 -8
  44. package/dist/packages/api-client/src/rpc-client.d.ts +83 -116
  45. package/package.json +1 -1
  46. package/dist/apps/backend/src/generated/zod/index.d.ts +0 -1114
  47. package/dist/apps/backend/src/generated/zod/index.js +0 -670
  48. package/dist/backend-types.d.ts +0 -10
  49. package/dist/backend-types.js +0 -10
  50. package/dist/client.d.ts +0 -20
  51. package/dist/client.js +0 -40
  52. package/dist/enum-types.d.ts +0 -8
  53. package/dist/enum-types.js +0 -5
  54. package/dist/fetchers/brands.d.ts +0 -25
  55. package/dist/fetchers/brands.js +0 -26
  56. package/dist/fetchers/carts.d.ts +0 -2335
  57. package/dist/fetchers/carts.js +0 -174
  58. package/dist/fetchers/delivery-zones.d.ts +0 -28
  59. package/dist/fetchers/delivery-zones.js +0 -26
  60. package/dist/fetchers/index.d.ts +0 -22
  61. package/dist/fetchers/index.js +0 -22
  62. package/dist/fetchers/orders.d.ts +0 -540
  63. package/dist/fetchers/orders.js +0 -44
  64. package/dist/fetchers/products.d.ts +0 -386
  65. package/dist/fetchers/products.js +0 -42
  66. package/dist/hooks/admin/abandoned-carts.d.ts +0 -535
  67. package/dist/hooks/admin/abandoned-carts.js +0 -83
  68. package/dist/hooks/admin/brands.d.ts +0 -79
  69. package/dist/hooks/admin/brands.js +0 -108
  70. package/dist/hooks/admin/customers.d.ts +0 -278
  71. package/dist/hooks/admin/customers.js +0 -26
  72. package/dist/hooks/admin/delivery-zones.d.ts +0 -270
  73. package/dist/hooks/admin/delivery-zones.js +0 -176
  74. package/dist/hooks/admin/discount-codes.d.ts +0 -299
  75. package/dist/hooks/admin/discount-codes.js +0 -165
  76. package/dist/hooks/admin/index.d.ts +0 -16
  77. package/dist/hooks/admin/index.js +0 -16
  78. package/dist/hooks/admin/inventory.d.ts +0 -224
  79. package/dist/hooks/admin/inventory.js +0 -107
  80. package/dist/hooks/admin/orders.d.ts +0 -1662
  81. package/dist/hooks/admin/orders.js +0 -178
  82. package/dist/hooks/admin/products.d.ts +0 -374
  83. package/dist/hooks/admin/products.js +0 -89
  84. package/dist/hooks/admin/stats.d.ts +0 -277
  85. package/dist/hooks/admin/stats.js +0 -25
  86. package/dist/hooks/admin/variants.d.ts +0 -115
  87. package/dist/hooks/admin/variants.js +0 -127
  88. package/dist/hooks/admin/warehouses.d.ts +0 -277
  89. package/dist/hooks/admin/warehouses.js +0 -108
  90. package/dist/hooks/public/brands.d.ts +0 -33
  91. package/dist/hooks/public/brands.js +0 -30
  92. package/dist/hooks/public/carts.d.ts +0 -2405
  93. package/dist/hooks/public/carts.js +0 -213
  94. package/dist/hooks/public/delivery-zones.d.ts +0 -34
  95. package/dist/hooks/public/delivery-zones.js +0 -28
  96. package/dist/hooks/public/index.d.ts +0 -10
  97. package/dist/hooks/public/index.js +0 -10
  98. package/dist/hooks/public/orders.d.ts +0 -559
  99. package/dist/hooks/public/orders.js +0 -50
  100. package/dist/hooks/public/products.d.ts +0 -398
  101. package/dist/hooks/public/products.js +0 -47
  102. package/dist/hooks/use-query-unwrapped.d.ts +0 -20
  103. package/dist/hooks/use-query-unwrapped.js +0 -22
  104. package/dist/hooks/useApiConfig.d.ts +0 -12
  105. package/dist/hooks/useApiConfig.js +0 -14
  106. package/dist/index.d.ts +0 -20
  107. package/dist/index.js +0 -25
  108. package/dist/provider.d.ts +0 -36
  109. package/dist/provider.js +0 -54
  110. package/dist/rpc-client.d.ts +0 -9607
  111. package/dist/rpc-client.js +0 -78
  112. package/dist/rpc-types.d.ts +0 -76
  113. package/dist/rpc-types.js +0 -7
  114. package/dist/types.d.ts +0 -34
  115. package/dist/types.js +0 -16
  116. package/dist/utils/query-keys.d.ts +0 -106
  117. package/dist/utils/query-keys.js +0 -108
@@ -1,277 +0,0 @@
1
- /**
2
- * Type-safe admin RPC hooks for warehouse management
3
- */
4
- import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
5
- import { createAdminRpcClients } from '../../rpc-client';
6
- /**
7
- * Hook to list all warehouses using admin RPC
8
- */
9
- export declare function useListWarehouses(options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['warehouses']['index']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
10
- name: string;
11
- id: string;
12
- createdAt: string;
13
- updatedAt: string;
14
- deletedAt: string;
15
- isActive: boolean;
16
- address: string | null;
17
- city: string | null;
18
- state: string | null;
19
- }[], Error>;
20
- /**
21
- * Hook to create a warehouse using admin RPC
22
- */
23
- export declare function useCreateWarehouse(options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['warehouses']['index']['$post']>>['json']>>, Error, any>): import("@tanstack/react-query").UseMutationResult<{
24
- name: string;
25
- id: string;
26
- createdAt: string;
27
- updatedAt: string;
28
- deletedAt: string;
29
- isActive: boolean;
30
- address: string | null;
31
- city: string | null;
32
- state: string | null;
33
- } | {
34
- error: {
35
- code: string;
36
- message: string;
37
- };
38
- }, Error, any, unknown>;
39
- /**
40
- * Hook to update a warehouse using admin RPC
41
- */
42
- export declare function useUpdateWarehouse(warehouseId: string, options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['warehouses'][':id']['$patch']>>['json']>>, Error, any>): import("@tanstack/react-query").UseMutationResult<{
43
- name: string;
44
- id: string;
45
- createdAt: string;
46
- updatedAt: string;
47
- deletedAt: string;
48
- isActive: boolean;
49
- address: string | null;
50
- city: string | null;
51
- state: string | null;
52
- } | {
53
- error: {
54
- code: string;
55
- message: string;
56
- };
57
- }, Error, any, unknown>;
58
- /**
59
- * Hook to get warehouse inventory using admin RPC
60
- */
61
- export declare function useGetWarehouseInventory(warehouseId: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['warehouses'][':id']['inventory']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
62
- warehouse: {
63
- inventories: {
64
- variant: {
65
- product: {
66
- brand: {
67
- name: string;
68
- id: string;
69
- slug: string;
70
- logoUrl: string | null;
71
- siteUrl: string;
72
- domain: string;
73
- metaPixelId: string | null;
74
- createdAt: string;
75
- updatedAt: string;
76
- deletedAt: string;
77
- };
78
- name: string;
79
- id: string;
80
- slug: string;
81
- createdAt: string;
82
- updatedAt: string;
83
- deletedAt: string;
84
- brandId: string;
85
- isActive: boolean;
86
- description: string | null;
87
- thumbnailUrl: string | null;
88
- quantityDiscounts: string | number | boolean | {
89
- [x: string]: string | number | boolean | /*elided*/ any | {
90
- [x: number]: string | number | boolean | /*elided*/ any | /*elided*/ any;
91
- length: number;
92
- toString: never;
93
- toLocaleString: never;
94
- pop: never;
95
- push: never;
96
- concat: never;
97
- join: never;
98
- reverse: never;
99
- shift: never;
100
- slice: never;
101
- sort: never;
102
- splice: never;
103
- unshift: never;
104
- indexOf: never;
105
- lastIndexOf: never;
106
- every: never;
107
- some: never;
108
- forEach: never;
109
- map: never;
110
- filter: never;
111
- reduce: never;
112
- reduceRight: never;
113
- find: never;
114
- findIndex: never;
115
- fill: never;
116
- copyWithin: never;
117
- entries: never;
118
- keys: never;
119
- values: never;
120
- includes: never;
121
- flatMap: never;
122
- flat: never;
123
- [Symbol.iterator]: never;
124
- readonly [Symbol.unscopables]: {
125
- [x: number]: boolean;
126
- length?: boolean;
127
- toString?: boolean;
128
- toLocaleString?: boolean;
129
- pop?: boolean;
130
- push?: boolean;
131
- concat?: boolean;
132
- join?: boolean;
133
- reverse?: boolean;
134
- shift?: boolean;
135
- slice?: boolean;
136
- sort?: boolean;
137
- splice?: boolean;
138
- unshift?: boolean;
139
- indexOf?: boolean;
140
- lastIndexOf?: boolean;
141
- every?: boolean;
142
- some?: boolean;
143
- forEach?: boolean;
144
- map?: boolean;
145
- filter?: boolean;
146
- reduce?: boolean;
147
- reduceRight?: boolean;
148
- find?: boolean;
149
- findIndex?: boolean;
150
- fill?: boolean;
151
- copyWithin?: boolean;
152
- entries?: boolean;
153
- keys?: boolean;
154
- values?: boolean;
155
- includes?: boolean;
156
- flatMap?: boolean;
157
- flat?: boolean;
158
- };
159
- };
160
- } | {
161
- [x: number]: string | number | boolean | {
162
- [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
163
- } | /*elided*/ any;
164
- length: number;
165
- toString: never;
166
- toLocaleString: never;
167
- pop: never;
168
- push: never;
169
- concat: never;
170
- join: never;
171
- reverse: never;
172
- shift: never;
173
- slice: never;
174
- sort: never;
175
- splice: never;
176
- unshift: never;
177
- indexOf: never;
178
- lastIndexOf: never;
179
- every: never;
180
- some: never;
181
- forEach: never;
182
- map: never;
183
- filter: never;
184
- reduce: never;
185
- reduceRight: never;
186
- find: never;
187
- findIndex: never;
188
- fill: never;
189
- copyWithin: never;
190
- entries: never;
191
- keys: never;
192
- values: never;
193
- includes: never;
194
- flatMap: never;
195
- flat: never;
196
- [Symbol.iterator]: never;
197
- readonly [Symbol.unscopables]: {
198
- [x: number]: boolean;
199
- length?: boolean;
200
- toString?: boolean;
201
- toLocaleString?: boolean;
202
- pop?: boolean;
203
- push?: boolean;
204
- concat?: boolean;
205
- join?: boolean;
206
- reverse?: boolean;
207
- shift?: boolean;
208
- slice?: boolean;
209
- sort?: boolean;
210
- splice?: boolean;
211
- unshift?: boolean;
212
- indexOf?: boolean;
213
- lastIndexOf?: boolean;
214
- every?: boolean;
215
- some?: boolean;
216
- forEach?: boolean;
217
- map?: boolean;
218
- filter?: boolean;
219
- reduce?: boolean;
220
- reduceRight?: boolean;
221
- find?: boolean;
222
- findIndex?: boolean;
223
- fill?: boolean;
224
- copyWithin?: boolean;
225
- entries?: boolean;
226
- keys?: boolean;
227
- values?: boolean;
228
- includes?: boolean;
229
- flatMap?: boolean;
230
- flat?: boolean;
231
- };
232
- };
233
- };
234
- name: string | null;
235
- id: string;
236
- createdAt: string;
237
- updatedAt: string;
238
- deletedAt: string;
239
- isActive: boolean;
240
- thumbnailUrl: string | null;
241
- productId: string;
242
- sku: string;
243
- price: string;
244
- trackInventory: boolean;
245
- lowStockThreshold: number | null;
246
- };
247
- id: string;
248
- updatedAt: string;
249
- variantId: string;
250
- warehouseId: string;
251
- inventoryCount: number;
252
- }[];
253
- name: string;
254
- id: string;
255
- createdAt: string;
256
- updatedAt: string;
257
- deletedAt: string;
258
- isActive: boolean;
259
- address: string | null;
260
- city: string | null;
261
- state: string | null;
262
- };
263
- inventory: {
264
- variantId: string;
265
- sku: string;
266
- productName: string;
267
- name: string;
268
- brandName: string;
269
- inventoryCount: number;
270
- lowStockThreshold: number;
271
- isLowStock: boolean;
272
- }[];
273
- }, Error>;
274
- /**
275
- * Hook to delete a warehouse using admin RPC
276
- */
277
- export declare function useDeleteWarehouse(warehouseId: string, options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['warehouses'][':id']['$delete']>>['json']>>, Error, void>): import("@tanstack/react-query").UseMutationResult<unknown, Error, void, unknown>;
@@ -1,108 +0,0 @@
1
- /**
2
- * Type-safe admin RPC hooks for warehouse management
3
- */
4
- import { useMutation, useQueryClient } from '@tanstack/react-query';
5
- import { useQueryUnwrapped } from '../use-query-unwrapped';
6
- import { createAdminRpcClients, authHeaders } from '../../rpc-client';
7
- import { queryKeys } from '../../utils/query-keys';
8
- import { useApiConfig } from '../useApiConfig';
9
- /**
10
- * Hook to list all warehouses using admin RPC
11
- */
12
- export function useListWarehouses(options) {
13
- const { baseURL, getAuthToken } = useApiConfig();
14
- return useQueryUnwrapped({
15
- queryKey: queryKeys.admin.warehouses.list(),
16
- queryFn: async () => {
17
- const token = await getAuthToken();
18
- const clients = createAdminRpcClients(baseURL);
19
- const res = await clients.warehouses.index.$get({}, authHeaders(token));
20
- if (!res.ok)
21
- throw new Error(`Failed to fetch warehouses: ${res.statusText}`);
22
- return res.json();
23
- },
24
- ...options,
25
- });
26
- }
27
- /**
28
- * Hook to create a warehouse using admin RPC
29
- */
30
- export function useCreateWarehouse(options) {
31
- const { baseURL, getAuthToken } = useApiConfig();
32
- const queryClient = useQueryClient();
33
- return useMutation({
34
- mutationFn: async (data) => {
35
- const token = await getAuthToken();
36
- const clients = createAdminRpcClients(baseURL);
37
- const res = await clients.warehouses.index.$post({ json: data }, authHeaders(token));
38
- if (!res.ok)
39
- throw new Error(`Failed to create warehouse: ${res.statusText}`);
40
- return res.json();
41
- },
42
- onSuccess: () => {
43
- queryClient.invalidateQueries({ queryKey: queryKeys.admin.warehouses.all });
44
- },
45
- ...options,
46
- });
47
- }
48
- /**
49
- * Hook to update a warehouse using admin RPC
50
- */
51
- export function useUpdateWarehouse(warehouseId, options) {
52
- const { baseURL, getAuthToken } = useApiConfig();
53
- const queryClient = useQueryClient();
54
- return useMutation({
55
- mutationFn: async (data) => {
56
- const token = await getAuthToken();
57
- const clients = createAdminRpcClients(baseURL);
58
- const res = await clients.warehouses[':id'].$patch({ json: data, param: { id: warehouseId } }, authHeaders(token));
59
- if (!res.ok)
60
- throw new Error(`Failed to update warehouse: ${res.statusText}`);
61
- return res.json();
62
- },
63
- onSuccess: () => {
64
- queryClient.invalidateQueries({ queryKey: queryKeys.admin.warehouses.detail(warehouseId) });
65
- queryClient.invalidateQueries({ queryKey: queryKeys.admin.warehouses.all });
66
- },
67
- ...options,
68
- });
69
- }
70
- /**
71
- * Hook to get warehouse inventory using admin RPC
72
- */
73
- export function useGetWarehouseInventory(warehouseId, options) {
74
- const { baseURL, getAuthToken } = useApiConfig();
75
- return useQueryUnwrapped({
76
- queryKey: queryKeys.admin.warehouses.inventory(warehouseId),
77
- queryFn: async () => {
78
- const token = await getAuthToken();
79
- const clients = createAdminRpcClients(baseURL);
80
- const res = await clients.warehouses[':id'].inventory.$get({ param: { id: warehouseId } }, authHeaders(token));
81
- if (!res.ok)
82
- throw new Error(`Failed to fetch warehouse inventory: ${res.statusText}`);
83
- return res.json();
84
- },
85
- ...options,
86
- });
87
- }
88
- /**
89
- * Hook to delete a warehouse using admin RPC
90
- */
91
- export function useDeleteWarehouse(warehouseId, options) {
92
- const { baseURL, getAuthToken } = useApiConfig();
93
- const queryClient = useQueryClient();
94
- return useMutation({
95
- mutationFn: async () => {
96
- const token = await getAuthToken();
97
- const clients = createAdminRpcClients(baseURL);
98
- const res = await clients.warehouses[':id'].$delete({ param: { id: warehouseId } }, authHeaders(token));
99
- if (!res.ok)
100
- throw new Error(`Failed to delete warehouse: ${res.statusText}`);
101
- return res.json();
102
- },
103
- onSuccess: () => {
104
- queryClient.invalidateQueries({ queryKey: queryKeys.admin.warehouses.all });
105
- },
106
- ...options,
107
- });
108
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * Type-safe RPC hooks for brand operations
3
- *
4
- * These hooks use Hono RPC client with types directly from the backend,
5
- * providing end-to-end type safety without code generation.
6
- */
7
- import { UseQueryOptions } from '@tanstack/react-query';
8
- import { fetchBrandBySlug } from '../../fetchers/brands';
9
- /**
10
- * Hook to get brand configuration by slug using RPC
11
- *
12
- * @param slug - Brand slug (e.g., 'my-brand')
13
- * @param options - React Query options
14
- *
15
- * @example
16
- * ```tsx
17
- * const { data: brand } = useGetBrand('my-brand');
18
- * if (brand?.metaPixelId) {
19
- * // Initialize Meta Pixel tracking
20
- * }
21
- * ```
22
- */
23
- export declare function useGetBrand(slug: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchBrandBySlug>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
24
- name: string;
25
- id: string;
26
- slug: string;
27
- logoUrl: string;
28
- siteUrl: string;
29
- domain: string;
30
- metaPixelId: string;
31
- createdAt: string;
32
- updatedAt: string;
33
- }, Error>;
@@ -1,30 +0,0 @@
1
- /**
2
- * Type-safe RPC hooks for brand operations
3
- *
4
- * These hooks use Hono RPC client with types directly from the backend,
5
- * providing end-to-end type safety without code generation.
6
- */
7
- import { useQueryUnwrapped } from '../use-query-unwrapped';
8
- import { queryKeys } from '../../utils/query-keys';
9
- import { fetchBrandBySlug } from '../../fetchers/brands';
10
- /**
11
- * Hook to get brand configuration by slug using RPC
12
- *
13
- * @param slug - Brand slug (e.g., 'my-brand')
14
- * @param options - React Query options
15
- *
16
- * @example
17
- * ```tsx
18
- * const { data: brand } = useGetBrand('my-brand');
19
- * if (brand?.metaPixelId) {
20
- * // Initialize Meta Pixel tracking
21
- * }
22
- * ```
23
- */
24
- export function useGetBrand(slug, options) {
25
- return useQueryUnwrapped({
26
- queryKey: queryKeys.public.brands.detail(slug),
27
- queryFn: () => fetchBrandBySlug(slug),
28
- ...options,
29
- });
30
- }