@instockng/api-client 1.0.7 → 1.0.8
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/apps/backend/src/http-app.js +28 -0
- package/dist/apps/backend/src/lib/brand-response.d.ts +1 -1
- package/dist/apps/backend/src/lib/cart-helpers.d.ts +13 -11
- package/dist/apps/backend/src/lib/cart-helpers.js +28 -0
- package/dist/apps/backend/src/lib/cart-response.d.ts +5 -5
- package/dist/apps/backend/src/lib/clerk.js +23 -0
- package/dist/apps/backend/src/lib/delivery-zone-response.d.ts +6 -4
- package/dist/apps/backend/src/lib/discount-code-response.d.ts +2 -2
- package/dist/apps/backend/src/lib/meta-capi.d.ts +5 -0
- package/dist/apps/backend/src/lib/meta-capi.js +33 -2
- package/dist/apps/backend/src/lib/order-recovery.d.ts +30 -24
- package/dist/apps/backend/src/lib/order-response.d.ts +9 -7
- package/dist/apps/backend/src/lib/product-response.d.ts +4 -4
- package/dist/apps/backend/src/lib/sentry.d.ts +48 -0
- package/dist/apps/backend/src/lib/sentry.js +180 -0
- package/dist/apps/backend/src/notifications/producers/meta-capi-producer.js +18 -4
- package/dist/apps/backend/src/routes/admin/abandoned-carts.d.ts +10 -10
- package/dist/apps/backend/src/routes/admin/brands.d.ts +4 -4
- package/dist/apps/backend/src/routes/admin/customers.d.ts +9 -7
- package/dist/apps/backend/src/routes/admin/delivery-zones.d.ts +23 -15
- package/dist/apps/backend/src/routes/admin/discount-codes.d.ts +10 -10
- package/dist/apps/backend/src/routes/admin/inventory.js +10 -0
- package/dist/apps/backend/src/routes/admin/orders.d.ts +54 -42
- package/dist/apps/backend/src/routes/admin/orders.js +25 -0
- package/dist/apps/backend/src/routes/admin/products.d.ts +12 -12
- package/dist/apps/backend/src/routes/admin/products.js +34 -15
- package/dist/apps/backend/src/routes/admin/stats.d.ts +9 -7
- package/dist/apps/backend/src/routes/admin/variants.d.ts +5 -5
- package/dist/apps/backend/src/routes/admin/variants.js +42 -18
- package/dist/apps/backend/src/routes/admin/warehouses.d.ts +7 -7
- package/dist/apps/backend/src/routes/public/brands.d.ts +1 -1
- package/dist/apps/backend/src/routes/public/carts.d.ts +49 -47
- package/dist/apps/backend/src/routes/public/carts.js +148 -1
- package/dist/apps/backend/src/routes/public/delivery-zones.d.ts +2 -0
- package/dist/apps/backend/src/routes/public/delivery-zones.js +2 -0
- package/dist/apps/backend/src/routes/public/orders.d.ts +18 -14
- package/dist/apps/backend/src/routes/public/orders.js +24 -0
- package/dist/apps/backend/src/routes/public/products.d.ts +6 -6
- package/dist/apps/backend/src/types/index.d.ts +1 -0
- package/dist/apps/backend/src/validators/delivery-zone.d.ts +4 -0
- package/dist/apps/backend/src/validators/delivery-zone.js +4 -0
- package/dist/apps/backend/src/validators/discount-code.d.ts +3 -3
- package/dist/apps/backend/src/validators/order.d.ts +3 -1
- package/dist/apps/backend/src/validators/order.js +3 -1
- package/dist/packages/api-client/src/fetchers/brands.d.ts +1 -1
- package/dist/packages/api-client/src/fetchers/carts.d.ts +49 -47
- package/dist/packages/api-client/src/fetchers/delivery-zones.d.ts +2 -0
- package/dist/packages/api-client/src/fetchers/orders.d.ts +18 -14
- package/dist/packages/api-client/src/fetchers/products.d.ts +6 -6
- package/dist/packages/api-client/src/hooks/admin/abandoned-carts.d.ts +10 -10
- package/dist/packages/api-client/src/hooks/admin/brands.d.ts +4 -4
- package/dist/packages/api-client/src/hooks/admin/customers.d.ts +9 -7
- package/dist/packages/api-client/src/hooks/admin/delivery-zones.d.ts +23 -15
- package/dist/packages/api-client/src/hooks/admin/discount-codes.d.ts +10 -10
- package/dist/packages/api-client/src/hooks/admin/orders.d.ts +54 -42
- package/dist/packages/api-client/src/hooks/admin/products.d.ts +6 -6
- package/dist/packages/api-client/src/hooks/admin/stats.d.ts +9 -7
- package/dist/packages/api-client/src/hooks/admin/variants.d.ts +5 -5
- package/dist/packages/api-client/src/hooks/admin/warehouses.d.ts +7 -7
- package/dist/packages/api-client/src/hooks/public/brands.d.ts +1 -1
- package/dist/packages/api-client/src/hooks/public/carts.d.ts +49 -47
- package/dist/packages/api-client/src/hooks/public/delivery-zones.d.ts +2 -0
- package/dist/packages/api-client/src/hooks/public/orders.d.ts +18 -14
- package/dist/packages/api-client/src/hooks/public/products.d.ts +6 -6
- package/dist/packages/api-client/src/rpc-client.d.ts +219 -187
- package/package.json +1 -1
|
@@ -14,8 +14,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
14
14
|
createdAt: string;
|
|
15
15
|
updatedAt: string;
|
|
16
16
|
deletedAt: string;
|
|
17
|
-
name: string;
|
|
18
17
|
id: string;
|
|
18
|
+
name: string;
|
|
19
19
|
slug: string;
|
|
20
20
|
logoUrl: string | null;
|
|
21
21
|
siteUrl: string;
|
|
@@ -25,29 +25,31 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
25
25
|
stateName: string;
|
|
26
26
|
brandName: string;
|
|
27
27
|
state: {
|
|
28
|
-
name: string;
|
|
29
28
|
id: string;
|
|
29
|
+
name: string;
|
|
30
30
|
createdAt: string;
|
|
31
31
|
updatedAt: string;
|
|
32
32
|
deletedAt: string;
|
|
33
33
|
isActive: boolean;
|
|
34
34
|
};
|
|
35
|
-
name: string;
|
|
36
35
|
id: string;
|
|
36
|
+
name: string;
|
|
37
37
|
brandId: string | null;
|
|
38
38
|
stateId: string;
|
|
39
39
|
allowCOD: boolean;
|
|
40
40
|
allowOnline: boolean;
|
|
41
41
|
waybillOnly: boolean;
|
|
42
42
|
estimatedDays: number | null;
|
|
43
|
+
noteTitle: string | null;
|
|
44
|
+
noteContent: string | null;
|
|
43
45
|
isActive: boolean;
|
|
44
46
|
}[];
|
|
45
47
|
zonesCount: number;
|
|
46
48
|
createdAt: string;
|
|
47
49
|
updatedAt: string;
|
|
48
50
|
deletedAt: string;
|
|
49
|
-
name: string;
|
|
50
51
|
id: string;
|
|
52
|
+
name: string;
|
|
51
53
|
isActive: boolean;
|
|
52
54
|
}[];
|
|
53
55
|
outputFormat: "json";
|
|
@@ -83,8 +85,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
83
85
|
createdAt: string;
|
|
84
86
|
updatedAt: string;
|
|
85
87
|
deletedAt: string;
|
|
86
|
-
name: string;
|
|
87
88
|
id: string;
|
|
89
|
+
name: string;
|
|
88
90
|
isActive: boolean;
|
|
89
91
|
deliveryZones?: never;
|
|
90
92
|
};
|
|
@@ -143,8 +145,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
143
145
|
createdAt: string;
|
|
144
146
|
updatedAt: string;
|
|
145
147
|
deletedAt: string;
|
|
146
|
-
name: string;
|
|
147
148
|
id: string;
|
|
149
|
+
name: string;
|
|
148
150
|
isActive: boolean;
|
|
149
151
|
deliveryZones?: never;
|
|
150
152
|
};
|
|
@@ -202,8 +204,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
202
204
|
createdAt: string;
|
|
203
205
|
updatedAt: string;
|
|
204
206
|
deletedAt: string;
|
|
205
|
-
name: string;
|
|
206
207
|
id: string;
|
|
208
|
+
name: string;
|
|
207
209
|
slug: string;
|
|
208
210
|
logoUrl: string | null;
|
|
209
211
|
siteUrl: string;
|
|
@@ -213,21 +215,23 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
213
215
|
stateName: string;
|
|
214
216
|
brandName: string;
|
|
215
217
|
state: {
|
|
216
|
-
name: string;
|
|
217
218
|
id: string;
|
|
219
|
+
name: string;
|
|
218
220
|
createdAt: string;
|
|
219
221
|
updatedAt: string;
|
|
220
222
|
deletedAt: string;
|
|
221
223
|
isActive: boolean;
|
|
222
224
|
};
|
|
223
|
-
name: string;
|
|
224
225
|
id: string;
|
|
226
|
+
name: string;
|
|
225
227
|
brandId: string | null;
|
|
226
228
|
stateId: string;
|
|
227
229
|
allowCOD: boolean;
|
|
228
230
|
allowOnline: boolean;
|
|
229
231
|
waybillOnly: boolean;
|
|
230
232
|
estimatedDays: number | null;
|
|
233
|
+
noteTitle: string | null;
|
|
234
|
+
noteContent: string | null;
|
|
231
235
|
isActive: boolean;
|
|
232
236
|
}[];
|
|
233
237
|
outputFormat: "json";
|
|
@@ -278,8 +282,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
278
282
|
createdAt: string;
|
|
279
283
|
updatedAt: string;
|
|
280
284
|
deletedAt: string;
|
|
281
|
-
name: string;
|
|
282
285
|
id: string;
|
|
286
|
+
name: string;
|
|
283
287
|
slug: string;
|
|
284
288
|
logoUrl: string | null;
|
|
285
289
|
siteUrl: string;
|
|
@@ -289,21 +293,23 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
289
293
|
stateName: string;
|
|
290
294
|
brandName: string;
|
|
291
295
|
state: {
|
|
292
|
-
name: string;
|
|
293
296
|
id: string;
|
|
297
|
+
name: string;
|
|
294
298
|
createdAt: string;
|
|
295
299
|
updatedAt: string;
|
|
296
300
|
deletedAt: string;
|
|
297
301
|
isActive: boolean;
|
|
298
302
|
};
|
|
299
|
-
name: string;
|
|
300
303
|
id: string;
|
|
304
|
+
name: string;
|
|
301
305
|
brandId: string | null;
|
|
302
306
|
stateId: string;
|
|
303
307
|
allowCOD: boolean;
|
|
304
308
|
allowOnline: boolean;
|
|
305
309
|
waybillOnly: boolean;
|
|
306
310
|
estimatedDays: number | null;
|
|
311
|
+
noteTitle: string | null;
|
|
312
|
+
noteContent: string | null;
|
|
307
313
|
isActive: boolean;
|
|
308
314
|
};
|
|
309
315
|
outputFormat: "json";
|
|
@@ -366,8 +372,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
366
372
|
createdAt: string;
|
|
367
373
|
updatedAt: string;
|
|
368
374
|
deletedAt: string;
|
|
369
|
-
name: string;
|
|
370
375
|
id: string;
|
|
376
|
+
name: string;
|
|
371
377
|
slug: string;
|
|
372
378
|
logoUrl: string | null;
|
|
373
379
|
siteUrl: string;
|
|
@@ -377,21 +383,23 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
377
383
|
stateName: string;
|
|
378
384
|
brandName: string;
|
|
379
385
|
state: {
|
|
380
|
-
name: string;
|
|
381
386
|
id: string;
|
|
387
|
+
name: string;
|
|
382
388
|
createdAt: string;
|
|
383
389
|
updatedAt: string;
|
|
384
390
|
deletedAt: string;
|
|
385
391
|
isActive: boolean;
|
|
386
392
|
};
|
|
387
|
-
name: string;
|
|
388
393
|
id: string;
|
|
394
|
+
name: string;
|
|
389
395
|
brandId: string | null;
|
|
390
396
|
stateId: string;
|
|
391
397
|
allowCOD: boolean;
|
|
392
398
|
allowOnline: boolean;
|
|
393
399
|
waybillOnly: boolean;
|
|
394
400
|
estimatedDays: number | null;
|
|
401
|
+
noteTitle: string | null;
|
|
402
|
+
noteContent: string | null;
|
|
395
403
|
isActive: boolean;
|
|
396
404
|
};
|
|
397
405
|
outputFormat: "json";
|
|
@@ -15,8 +15,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
15
15
|
createdAt: string;
|
|
16
16
|
updatedAt: string;
|
|
17
17
|
deletedAt: string;
|
|
18
|
-
name: string;
|
|
19
18
|
id: string;
|
|
19
|
+
name: string;
|
|
20
20
|
slug: string;
|
|
21
21
|
logoUrl: string | null;
|
|
22
22
|
siteUrl: string;
|
|
@@ -26,10 +26,10 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
26
26
|
isExpired: boolean;
|
|
27
27
|
usagePercentage: number;
|
|
28
28
|
id: string;
|
|
29
|
+
type: string;
|
|
29
30
|
brandId: string | null;
|
|
30
31
|
isActive: boolean;
|
|
31
32
|
code: string;
|
|
32
|
-
type: string;
|
|
33
33
|
usageLimit: number | null;
|
|
34
34
|
usageCount: number;
|
|
35
35
|
perCustomerLimit: number | null;
|
|
@@ -98,8 +98,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
98
98
|
createdAt: string;
|
|
99
99
|
updatedAt: string;
|
|
100
100
|
deletedAt: string;
|
|
101
|
-
name: string;
|
|
102
101
|
id: string;
|
|
102
|
+
name: string;
|
|
103
103
|
slug: string;
|
|
104
104
|
logoUrl: string | null;
|
|
105
105
|
siteUrl: string;
|
|
@@ -109,10 +109,10 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
109
109
|
isExpired: boolean;
|
|
110
110
|
usagePercentage: number;
|
|
111
111
|
id: string;
|
|
112
|
+
type: string;
|
|
112
113
|
brandId: string | null;
|
|
113
114
|
isActive: boolean;
|
|
114
115
|
code: string;
|
|
115
|
-
type: string;
|
|
116
116
|
usageLimit: number | null;
|
|
117
117
|
usageCount: number;
|
|
118
118
|
perCustomerLimit: number | null;
|
|
@@ -176,8 +176,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
176
176
|
createdAt: string;
|
|
177
177
|
updatedAt: string;
|
|
178
178
|
deletedAt: string;
|
|
179
|
-
name: string;
|
|
180
179
|
id: string;
|
|
180
|
+
name: string;
|
|
181
181
|
slug: string;
|
|
182
182
|
logoUrl: string | null;
|
|
183
183
|
siteUrl: string;
|
|
@@ -187,10 +187,10 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
187
187
|
isExpired: boolean;
|
|
188
188
|
usagePercentage: number;
|
|
189
189
|
id: string;
|
|
190
|
+
type: string;
|
|
190
191
|
brandId: string | null;
|
|
191
192
|
isActive: boolean;
|
|
192
193
|
code: string;
|
|
193
|
-
type: string;
|
|
194
194
|
usageLimit: number | null;
|
|
195
195
|
usageCount: number;
|
|
196
196
|
perCustomerLimit: number | null;
|
|
@@ -262,8 +262,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
262
262
|
createdAt: string;
|
|
263
263
|
updatedAt: string;
|
|
264
264
|
deletedAt: string;
|
|
265
|
-
name: string;
|
|
266
265
|
id: string;
|
|
266
|
+
name: string;
|
|
267
267
|
slug: string;
|
|
268
268
|
logoUrl: string | null;
|
|
269
269
|
siteUrl: string;
|
|
@@ -273,10 +273,10 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
273
273
|
isExpired: boolean;
|
|
274
274
|
usagePercentage: number;
|
|
275
275
|
id: string;
|
|
276
|
+
type: string;
|
|
276
277
|
brandId: string | null;
|
|
277
278
|
isActive: boolean;
|
|
278
279
|
code: string;
|
|
279
|
-
type: string;
|
|
280
280
|
usageLimit: number | null;
|
|
281
281
|
usageCount: number;
|
|
282
282
|
perCustomerLimit: number | null;
|
|
@@ -381,8 +381,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
381
381
|
createdAt: string;
|
|
382
382
|
updatedAt: string;
|
|
383
383
|
deletedAt: string;
|
|
384
|
-
name: string;
|
|
385
384
|
id: string;
|
|
385
|
+
name: string;
|
|
386
386
|
slug: string;
|
|
387
387
|
logoUrl: string | null;
|
|
388
388
|
siteUrl: string;
|
|
@@ -391,10 +391,10 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
391
391
|
};
|
|
392
392
|
isExpired: boolean;
|
|
393
393
|
id: string;
|
|
394
|
+
type: string;
|
|
394
395
|
brandId: string | null;
|
|
395
396
|
isActive: boolean;
|
|
396
397
|
code: string;
|
|
397
|
-
type: string;
|
|
398
398
|
usageLimit: number | null;
|
|
399
399
|
usageCount: number;
|
|
400
400
|
perCustomerLimit: number | null;
|
|
@@ -3,6 +3,7 @@ import { adjustInventorySchema, transferInventorySchema } from '../../validators
|
|
|
3
3
|
import { getPrismaClient } from '../../lib/prisma';
|
|
4
4
|
import { getPaginationParams, createPaginatedResponse } from '../../lib/utils';
|
|
5
5
|
import { adjustInventory, transferInventory, getLowStockVariants } from '../../lib/inventory';
|
|
6
|
+
import { captureException } from '../../lib/sentry';
|
|
6
7
|
const app = new Hono()
|
|
7
8
|
// Get inventory overview
|
|
8
9
|
.get('/', async (c) => {
|
|
@@ -74,6 +75,15 @@ const app = new Hono()
|
|
|
74
75
|
return c.status(204);
|
|
75
76
|
}
|
|
76
77
|
catch (error) {
|
|
78
|
+
// CRITICAL: Inventory adjustments affect stock availability
|
|
79
|
+
captureException(error instanceof Error ? error : new Error(String(error)), {
|
|
80
|
+
level: 'fatal',
|
|
81
|
+
tags: {
|
|
82
|
+
error_code: 'INVENTORY_ADJUST_ERROR',
|
|
83
|
+
endpoint: 'POST /admin/inventory/adjust',
|
|
84
|
+
},
|
|
85
|
+
honoContext: c,
|
|
86
|
+
});
|
|
77
87
|
return c.json({
|
|
78
88
|
error: { code: 'INTERNAL_ERROR', message: error instanceof Error ? error.message : 'Failed to adjust inventory' },
|
|
79
89
|
}, 500);
|