@sales-planner/http-client 0.10.0 → 0.12.0
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/README.md +170 -96
- package/dist/clients/brands-client.d.ts +7 -6
- package/dist/clients/brands-client.d.ts.map +1 -1
- package/dist/clients/brands-client.js +9 -6
- package/dist/clients/categories-client.d.ts +17 -0
- package/dist/clients/categories-client.d.ts.map +1 -0
- package/dist/clients/categories-client.js +40 -0
- package/dist/clients/groups-client.d.ts +17 -0
- package/dist/clients/groups-client.d.ts.map +1 -0
- package/dist/clients/groups-client.js +40 -0
- package/dist/clients/marketplaces-client.d.ts +7 -6
- package/dist/clients/marketplaces-client.d.ts.map +1 -1
- package/dist/clients/marketplaces-client.js +9 -6
- package/dist/clients/sales-history-client.d.ts +7 -7
- package/dist/clients/sales-history-client.d.ts.map +1 -1
- package/dist/clients/sales-history-client.js +6 -6
- package/dist/clients/sales-planner-client.d.ts +82 -17
- package/dist/clients/sales-planner-client.d.ts.map +1 -1
- package/dist/clients/sales-planner-client.js +89 -22
- package/dist/clients/skus-client.d.ts +8 -7
- package/dist/clients/skus-client.d.ts.map +1 -1
- package/dist/clients/skus-client.js +9 -6
- package/dist/clients/statuses-client.d.ts +17 -0
- package/dist/clients/statuses-client.d.ts.map +1 -0
- package/dist/clients/statuses-client.js +40 -0
- package/dist/clients/suppliers-client.d.ts +43 -0
- package/dist/clients/suppliers-client.d.ts.map +1 -0
- package/dist/clients/suppliers-client.js +39 -0
- package/dist/clients/user-roles-client.d.ts +4 -2
- package/dist/clients/user-roles-client.d.ts.map +1 -1
- package/dist/clients/user-roles-client.js +14 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,11 +25,7 @@ const health = await client.getHealth();
|
|
|
25
25
|
console.log(health); // { status: 'ok', version: '1.0.0' }
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
The client supports two complementary API styles:
|
|
31
|
-
|
|
32
|
-
#### 1. **Namespaced API** (Recommended)
|
|
28
|
+
### Namespaced Sub-Clients
|
|
33
29
|
|
|
34
30
|
Access resources through domain-specific sub-clients:
|
|
35
31
|
|
|
@@ -44,13 +40,30 @@ const shops = await client.shops.getShops(tenantId);
|
|
|
44
40
|
|
|
45
41
|
// SKUs with import/export
|
|
46
42
|
const skus = await client.skus.getSkus({ tenantId, shopId });
|
|
47
|
-
await client.skus.
|
|
48
|
-
const csv = await client.skus.
|
|
43
|
+
await client.skus.importJson(items, { tenantId, shopId });
|
|
44
|
+
const csv = await client.skus.exportCsv({ tenantId, shopId });
|
|
49
45
|
|
|
50
46
|
// Brands with import/export
|
|
51
47
|
const brands = await client.brands.getBrands({ tenantId, shopId });
|
|
52
|
-
await client.brands.
|
|
53
|
-
const brandsCsv = await client.brands.
|
|
48
|
+
await client.brands.importJson(items, { tenantId, shopId });
|
|
49
|
+
const brandsCsv = await client.brands.exportCsv({ tenantId, shopId });
|
|
50
|
+
|
|
51
|
+
// Categories with import/export
|
|
52
|
+
const categories = await client.categories.getCategories({ tenantId, shopId });
|
|
53
|
+
await client.categories.importJson(items, { tenantId, shopId });
|
|
54
|
+
|
|
55
|
+
// Groups with import/export
|
|
56
|
+
const groups = await client.groups.getGroups({ tenantId, shopId });
|
|
57
|
+
await client.groups.importJson(items, { tenantId, shopId });
|
|
58
|
+
|
|
59
|
+
// Statuses with import/export
|
|
60
|
+
const statuses = await client.statuses.getStatuses({ tenantId, shopId });
|
|
61
|
+
await client.statuses.importJson(items, { tenantId, shopId });
|
|
62
|
+
|
|
63
|
+
// Suppliers with import/export
|
|
64
|
+
const suppliers = await client.suppliers.getSuppliers({ tenantId, shopId });
|
|
65
|
+
await client.suppliers.importJson(items, { tenantId, shopId });
|
|
66
|
+
const suppliersCsv = await client.suppliers.exportCsv({ tenantId, shopId });
|
|
54
67
|
|
|
55
68
|
// Sales History
|
|
56
69
|
const history = await client.salesHistory.getSalesHistory(
|
|
@@ -63,57 +76,54 @@ const marketplaces = await client.marketplaces.getMarketplaces({ tenantId });
|
|
|
63
76
|
|
|
64
77
|
// Entity Metadata (for UI documentation)
|
|
65
78
|
const metadata = await client.metadata.getEntitiesMetadata();
|
|
66
|
-
// Returns field definitions for brands, marketplaces, skus, sales history
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Benefits:**
|
|
70
|
-
- Clear domain separation
|
|
71
|
-
- IDE autocomplete by domain
|
|
72
|
-
- Easier to discover related methods
|
|
73
|
-
|
|
74
|
-
#### 2. **Flat API** (Backward Compatible)
|
|
75
|
-
|
|
76
|
-
Access all methods directly on the client:
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
// Backward compatible with existing code
|
|
80
|
-
const users = await client.getUsers();
|
|
81
|
-
const user = await client.getUser(1);
|
|
82
|
-
const skus = await client.getSkus({ tenantId, shopId });
|
|
79
|
+
// Returns field definitions for brands, categories, groups, statuses, suppliers, marketplaces, skus, sales history
|
|
83
80
|
```
|
|
84
81
|
|
|
85
82
|
## Import/Export Pattern
|
|
86
83
|
|
|
87
|
-
Resources that support bulk operations (SKUs, Brands, Sales History, Marketplaces) follow a consistent pattern:
|
|
84
|
+
Resources that support bulk operations (SKUs, Brands, Categories, Groups, Statuses, Suppliers, Sales History, Marketplaces) follow a consistent pattern:
|
|
88
85
|
|
|
89
86
|
```typescript
|
|
90
87
|
// Import from JSON
|
|
91
|
-
const result = await client.skus.
|
|
88
|
+
const result = await client.skus.importJson(
|
|
92
89
|
[
|
|
93
90
|
{ code: 'SKU-001', title: 'Product 1' },
|
|
94
91
|
{ code: 'SKU-002', title: 'Product 2' },
|
|
95
92
|
],
|
|
96
93
|
{ tenantId, shopId }
|
|
97
94
|
);
|
|
98
|
-
// Returns: {
|
|
95
|
+
// Returns: { created: 2, updated: 0, errors: [] }
|
|
99
96
|
|
|
100
97
|
// Import from CSV file
|
|
101
98
|
const csvContent = await fs.readFile('skus.csv', 'utf-8');
|
|
102
|
-
const result = await client.skus.
|
|
99
|
+
const result = await client.skus.importCsv(csvContent, { tenantId, shopId });
|
|
103
100
|
|
|
104
101
|
// Export to CSV
|
|
105
|
-
const csv = await client.skus.
|
|
102
|
+
const csv = await client.skus.exportCsv({ tenantId, shopId });
|
|
106
103
|
|
|
107
104
|
// Get example templates (no auth required)
|
|
108
|
-
const exampleCsv = await client.skus.
|
|
105
|
+
const exampleCsv = await client.skus.getExampleCsv();
|
|
109
106
|
|
|
110
|
-
// Same pattern works for brands
|
|
111
|
-
const brandResult = await client.brands.
|
|
107
|
+
// Same pattern works for brands, categories, groups, statuses
|
|
108
|
+
const brandResult = await client.brands.importJson(
|
|
112
109
|
[{ code: 'apple', title: 'Apple' }],
|
|
113
110
|
{ tenantId, shopId }
|
|
114
111
|
);
|
|
115
|
-
|
|
116
|
-
const
|
|
112
|
+
|
|
113
|
+
const categoryResult = await client.categories.importJson(
|
|
114
|
+
[{ code: 'electronics', title: 'Electronics' }],
|
|
115
|
+
{ tenantId, shopId }
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const groupResult = await client.groups.importJson(
|
|
119
|
+
[{ code: 'smartphones', title: 'Smartphones' }],
|
|
120
|
+
{ tenantId, shopId }
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const statusResult = await client.statuses.importJson(
|
|
124
|
+
[{ code: 'active', title: 'Active' }],
|
|
125
|
+
{ tenantId, shopId }
|
|
126
|
+
);
|
|
117
127
|
```
|
|
118
128
|
|
|
119
129
|
## Data Requirements
|
|
@@ -138,6 +148,46 @@ const brandExample = await client.brands.getBrandsExampleCsv();
|
|
|
138
148
|
- `code` (optional): String, 1-100 characters
|
|
139
149
|
- `title` (optional): String, 1-200 characters
|
|
140
150
|
|
|
151
|
+
### Categories
|
|
152
|
+
|
|
153
|
+
**Create/Import:**
|
|
154
|
+
- `code` (required): String, 1-100 characters, unique per shop
|
|
155
|
+
- `title` (required): String, 1-200 characters
|
|
156
|
+
|
|
157
|
+
**Update:**
|
|
158
|
+
- `code` (optional): String, 1-100 characters
|
|
159
|
+
- `title` (optional): String, 1-200 characters
|
|
160
|
+
|
|
161
|
+
### Groups
|
|
162
|
+
|
|
163
|
+
**Create/Import:**
|
|
164
|
+
- `code` (required): String, 1-100 characters, unique per shop
|
|
165
|
+
- `title` (required): String, 1-200 characters
|
|
166
|
+
|
|
167
|
+
**Update:**
|
|
168
|
+
- `code` (optional): String, 1-100 characters
|
|
169
|
+
- `title` (optional): String, 1-200 characters
|
|
170
|
+
|
|
171
|
+
### Statuses
|
|
172
|
+
|
|
173
|
+
**Create/Import:**
|
|
174
|
+
- `code` (required): String, 1-100 characters, unique per shop
|
|
175
|
+
- `title` (required): String, 1-200 characters
|
|
176
|
+
|
|
177
|
+
**Update:**
|
|
178
|
+
- `code` (optional): String, 1-100 characters
|
|
179
|
+
- `title` (optional): String, 1-200 characters
|
|
180
|
+
|
|
181
|
+
### Suppliers
|
|
182
|
+
|
|
183
|
+
**Create/Import:**
|
|
184
|
+
- `code` (required): String, 1-100 characters, unique per shop
|
|
185
|
+
- `title` (required): String, 1-200 characters
|
|
186
|
+
|
|
187
|
+
**Update:**
|
|
188
|
+
- `code` (optional): String, 1-100 characters
|
|
189
|
+
- `title` (optional): String, 1-200 characters
|
|
190
|
+
|
|
141
191
|
### Sales History
|
|
142
192
|
|
|
143
193
|
**Create:**
|
|
@@ -201,87 +251,95 @@ Note: Import endpoints accept marketplace codes for convenience, but the API int
|
|
|
201
251
|
- `code` (optional): String, 1-100 characters
|
|
202
252
|
- `title` (optional): String, 1-200 characters
|
|
203
253
|
|
|
204
|
-
##
|
|
205
|
-
|
|
206
|
-
```typescript
|
|
207
|
-
import { ApiError } from '@sales-planner/http-client';
|
|
208
|
-
|
|
209
|
-
try {
|
|
210
|
-
await client.users.getUser(999);
|
|
211
|
-
} catch (error) {
|
|
212
|
-
if (error instanceof ApiError) {
|
|
213
|
-
console.error(`API Error ${error.status}: ${error.message}`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
Common HTTP status codes:
|
|
219
|
-
- `409 Conflict` - Duplicate resource (email, SKU code, sales period)
|
|
220
|
-
- `404 Not Found` - Resource not found
|
|
221
|
-
- `403 Forbidden` - Insufficient permissions
|
|
222
|
-
- `400 Bad Request` - Validation error
|
|
223
|
-
|
|
224
|
-
```typescript
|
|
225
|
-
try {
|
|
226
|
-
await client.createUser({ email: 'user@example.com', name: 'John' });
|
|
227
|
-
} catch (error) {
|
|
228
|
-
if (error.response?.status === 409) {
|
|
229
|
-
console.error('User with this email already exists');
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
```
|
|
254
|
+
## Available Sub-Clients
|
|
233
255
|
|
|
234
|
-
|
|
256
|
+
Each sub-client is accessed via `client.<subClient>.<method>()`.
|
|
235
257
|
|
|
236
|
-
###
|
|
258
|
+
### `client.me`
|
|
237
259
|
- `getMe()` - Get current user with roles and tenants
|
|
238
260
|
|
|
239
|
-
###
|
|
261
|
+
### `client.users`
|
|
240
262
|
- `getUsers()`, `getUser(id)` - System admin or tenant admin (filtered by their tenants)
|
|
241
263
|
- `createUser(dto)`, `deleteUser(id)` - Tenant admin or higher
|
|
242
264
|
|
|
243
|
-
###
|
|
265
|
+
### `client.tenants`
|
|
244
266
|
- `getTenants()`, `getTenant(id)` - All authenticated users
|
|
245
267
|
- `createTenant(dto)` - System admin only
|
|
246
268
|
- `updateTenant(id, dto)`, `deleteTenant(id)` - Authenticated users (validation happens server-side)
|
|
247
269
|
- `createTenantWithShopAndUser(dto)` - System admin only
|
|
248
270
|
|
|
249
|
-
###
|
|
271
|
+
### `client.shops`
|
|
250
272
|
- `getShops(tenantId?)`, `getShop(id)`, `createShop(dto)`, `updateShop(id, dto)`, `deleteShop(id)` - Requires tenant access
|
|
251
273
|
- `deleteShopData(id)` - Delete all data (SKUs, sales history) for a shop
|
|
252
274
|
|
|
253
|
-
###
|
|
254
|
-
- `getSkus(ctx)`, `getSku(id, ctx)` - Requires read access (viewer or higher)
|
|
275
|
+
### `client.skus`
|
|
276
|
+
- `getSkus(ctx)`, `getSku(id, ctx)`, `getSkuByCode(code, ctx)` - Requires read access (viewer or higher)
|
|
255
277
|
- `createSku(dto, ctx)`, `updateSku(id, dto, ctx)`, `deleteSku(id, ctx)` - Requires write access (editor or higher)
|
|
256
|
-
- `
|
|
257
|
-
- `
|
|
258
|
-
- `
|
|
278
|
+
- `importJson(items, ctx)`, `importCsv(csvContent, ctx)` - Requires write access
|
|
279
|
+
- `exportJson(ctx)`, `exportCsv(ctx)` - Requires read access
|
|
280
|
+
- `getExampleJson()`, `getExampleCsv()` - Get import format examples (no auth required)
|
|
259
281
|
|
|
260
|
-
###
|
|
261
|
-
- `getBrands(ctx)`, `getBrand(id, ctx)` - Requires read access (viewer or higher)
|
|
282
|
+
### `client.brands`
|
|
283
|
+
- `getBrands(ctx)`, `getBrand(id, ctx)`, `getBrandByCode(code, ctx)` - Requires read access (viewer or higher)
|
|
262
284
|
- `createBrand(dto, ctx)`, `updateBrand(id, dto, ctx)`, `deleteBrand(id, ctx)` - Requires write access (editor or higher)
|
|
263
|
-
- `
|
|
264
|
-
- `
|
|
265
|
-
- `
|
|
266
|
-
|
|
267
|
-
###
|
|
285
|
+
- `importJson(items, ctx)`, `importCsv(csvContent, ctx)` - Requires write access (bulk upsert by code)
|
|
286
|
+
- `exportJson(ctx)`, `exportCsv(ctx)` - Requires read access
|
|
287
|
+
- `getExampleJson()`, `getExampleCsv()` - Get import format examples (no auth required)
|
|
288
|
+
|
|
289
|
+
### `client.categories`
|
|
290
|
+
- `getCategories(ctx)`, `getCategory(id, ctx)`, `getCategoryByCode(code, ctx)` - Requires read access (viewer or higher)
|
|
291
|
+
- `createCategory(dto, ctx)`, `updateCategory(id, dto, ctx)`, `deleteCategory(id, ctx)` - Requires write access (editor or higher)
|
|
292
|
+
- `importJson(items, ctx)`, `importCsv(csvContent, ctx)` - Requires write access (bulk upsert by code)
|
|
293
|
+
- `exportJson(ctx)`, `exportCsv(ctx)` - Requires read access
|
|
294
|
+
- `getExampleJson()`, `getExampleCsv()` - Get import format examples (no auth required)
|
|
295
|
+
|
|
296
|
+
### `client.groups`
|
|
297
|
+
- `getGroups(ctx)`, `getGroup(id, ctx)`, `getGroupByCode(code, ctx)` - Requires read access (viewer or higher)
|
|
298
|
+
- `createGroup(dto, ctx)`, `updateGroup(id, dto, ctx)`, `deleteGroup(id, ctx)` - Requires write access (editor or higher)
|
|
299
|
+
- `importJson(items, ctx)`, `importCsv(csvContent, ctx)` - Requires write access (bulk upsert by code)
|
|
300
|
+
- `exportJson(ctx)`, `exportCsv(ctx)` - Requires read access
|
|
301
|
+
- `getExampleJson()`, `getExampleCsv()` - Get import format examples (no auth required)
|
|
302
|
+
|
|
303
|
+
### `client.statuses`
|
|
304
|
+
- `getStatuses(ctx)`, `getStatus(id, ctx)`, `getStatusByCode(code, ctx)` - Requires read access (viewer or higher)
|
|
305
|
+
- `createStatus(dto, ctx)`, `updateStatus(id, dto, ctx)`, `deleteStatus(id, ctx)` - Requires write access (editor or higher)
|
|
306
|
+
- `importJson(items, ctx)`, `importCsv(csvContent, ctx)` - Requires write access (bulk upsert by code)
|
|
307
|
+
- `exportJson(ctx)`, `exportCsv(ctx)` - Requires read access
|
|
308
|
+
- `getExampleJson()`, `getExampleCsv()` - Get import format examples (no auth required)
|
|
309
|
+
|
|
310
|
+
### `client.suppliers`
|
|
311
|
+
- `getSuppliers(ctx)`, `getSupplier(id, ctx)`, `getSupplierByCode(code, ctx)` - Requires read access (viewer or higher)
|
|
312
|
+
- `createSupplier(dto, ctx)`, `updateSupplier(id, dto, ctx)`, `deleteSupplier(id, ctx)` - Requires write access (editor or higher)
|
|
313
|
+
- `importJson(items, ctx)`, `importCsv(csvContent, ctx)` - Requires write access (bulk upsert by code)
|
|
314
|
+
- `exportJson(ctx)`, `exportCsv(ctx)` - Requires read access
|
|
315
|
+
- `getExampleJson()`, `getExampleCsv()` - Get import format examples (no auth required)
|
|
316
|
+
|
|
317
|
+
### `client.salesHistory`
|
|
268
318
|
- `getSalesHistory(ctx, query?)`, `getSalesHistoryItem(id, ctx)` - Requires read access (viewer or higher)
|
|
269
319
|
- `createSalesHistory(dto, ctx)`, `updateSalesHistory(id, dto, ctx)`, `deleteSalesHistory(id, ctx)` - Requires write access (editor or higher)
|
|
270
|
-
- `
|
|
271
|
-
- `
|
|
272
|
-
- `
|
|
320
|
+
- `importJson(items, ctx)`, `importCsv(csvContent, ctx)` - Requires write access
|
|
321
|
+
- `exportJson(ctx, query?)`, `exportCsv(ctx, query?)` - Requires read access
|
|
322
|
+
- `getExampleJson()`, `getExampleCsv()` - Get import format examples (no auth required)
|
|
273
323
|
|
|
274
|
-
###
|
|
324
|
+
### `client.roles`
|
|
275
325
|
- `getRoles()`, `getRole(id)` - System admin only
|
|
276
326
|
- `createRole(dto)`, `updateRole(id, dto)`, `deleteRole(id)` - System admin only
|
|
327
|
+
|
|
328
|
+
### `client.userRoles`
|
|
329
|
+
- `getUserRoles(query)`, `getUserRole(id)` - View roles for tenant
|
|
277
330
|
- `createUserRole(dto)`, `deleteUserRole(id)` - Tenant admin or higher for their tenant
|
|
278
331
|
|
|
279
|
-
###
|
|
332
|
+
### `client.apiKeys`
|
|
280
333
|
- `getApiKeys()`, `createApiKey(dto)`, `deleteApiKey(id)` - System admin only
|
|
281
334
|
|
|
282
|
-
###
|
|
283
|
-
- `getMarketplaces()`, `getMarketplace(id)` -
|
|
284
|
-
- `createMarketplace(dto)`, `updateMarketplace(id, dto)`, `deleteMarketplace(id)` - Requires write access (editor or higher)
|
|
335
|
+
### `client.marketplaces`
|
|
336
|
+
- `getMarketplaces(ctx)`, `getMarketplace(id, ctx)`, `getMarketplaceByCode(code, ctx)` - Requires read access
|
|
337
|
+
- `createMarketplace(dto, ctx)`, `updateMarketplace(id, dto, ctx)`, `deleteMarketplace(id, ctx)` - Requires write access (editor or higher)
|
|
338
|
+
- `importJson(items, ctx)`, `importCsv(csvContent, ctx)` - Requires write access
|
|
339
|
+
- `exportJson(ctx)`, `exportCsv(ctx)` - Requires read access
|
|
340
|
+
|
|
341
|
+
### `client.metadata`
|
|
342
|
+
- `getEntitiesMetadata()` - Get field definitions for all entities (no auth required)
|
|
285
343
|
|
|
286
344
|
## Error Handling
|
|
287
345
|
|
|
@@ -289,7 +347,7 @@ try {
|
|
|
289
347
|
import { SalesPlannerClient, ApiError } from '@sales-planner/http-client';
|
|
290
348
|
|
|
291
349
|
try {
|
|
292
|
-
const user = await client.getUser(999);
|
|
350
|
+
const user = await client.users.getUser(999);
|
|
293
351
|
} catch (error) {
|
|
294
352
|
if (error instanceof ApiError) {
|
|
295
353
|
console.log(error.status); // 404
|
|
@@ -298,19 +356,35 @@ try {
|
|
|
298
356
|
}
|
|
299
357
|
```
|
|
300
358
|
|
|
359
|
+
Common HTTP status codes:
|
|
360
|
+
- `409 Conflict` - Duplicate resource (email, SKU code, sales period)
|
|
361
|
+
- `404 Not Found` - Resource not found
|
|
362
|
+
- `403 Forbidden` - Insufficient permissions
|
|
363
|
+
- `400 Bad Request` - Validation error
|
|
364
|
+
|
|
301
365
|
## Types
|
|
302
366
|
|
|
303
|
-
|
|
367
|
+
Common types are re-exported from `@sales-planner/shared` for convenience:
|
|
304
368
|
|
|
305
369
|
```typescript
|
|
306
370
|
import type {
|
|
307
|
-
|
|
371
|
+
// Entities
|
|
372
|
+
User, Tenant, Shop, Sku, SalesHistory, Role, UserRole, ApiKey, Marketplace,
|
|
373
|
+
// DTOs
|
|
308
374
|
CreateUserDto, CreateTenantDto, CreateShopDto,
|
|
309
|
-
CreateSkuRequest,
|
|
375
|
+
CreateSkuDto, CreateSkuRequest, CreateSalesHistoryDto, CreateSalesHistoryRequest,
|
|
376
|
+
CreateMarketplaceDto, CreateMarketplaceRequest,
|
|
377
|
+
// Query types
|
|
310
378
|
ShopContextParams, PeriodQuery,
|
|
311
|
-
|
|
312
|
-
|
|
379
|
+
// Response types
|
|
380
|
+
UserWithRolesAndTenants, TenantWithShopAndApiKey,
|
|
381
|
+
ImportResult, DeleteDataResult,
|
|
382
|
+
SkuExportItem, SalesHistoryExportItem,
|
|
313
383
|
} from '@sales-planner/http-client';
|
|
384
|
+
|
|
385
|
+
// For additional types (Brand, Category, Group, Status, Supplier, etc.)
|
|
386
|
+
// import directly from @sales-planner/shared
|
|
387
|
+
import type { Brand, Category, Group, Status, Supplier } from '@sales-planner/shared';
|
|
314
388
|
```
|
|
315
389
|
|
|
316
390
|
## License
|
|
@@ -3,14 +3,15 @@ import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
|
3
3
|
export declare class BrandsClient extends ImportExportBaseClient {
|
|
4
4
|
getBrands(ctx: ShopContextParams): Promise<Brand[]>;
|
|
5
5
|
getBrand(id: number, ctx: ShopContextParams): Promise<Brand>;
|
|
6
|
+
getBrandByCode(code: string, ctx: ShopContextParams): Promise<Brand>;
|
|
6
7
|
createBrand(dto: CreateBrandRequest, ctx: ShopContextParams): Promise<Brand>;
|
|
7
8
|
updateBrand(id: number, dto: UpdateBrandDto, ctx: ShopContextParams): Promise<Brand>;
|
|
8
9
|
deleteBrand(id: number, ctx: ShopContextParams): Promise<void>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
importJson(items: ImportBrandItem[], ctx: ShopContextParams): Promise<ImportResult>;
|
|
11
|
+
importCsv(csvContent: string, ctx: ShopContextParams): Promise<ImportResult>;
|
|
12
|
+
exportJson(ctx: ShopContextParams): Promise<BrandExportItem[]>;
|
|
13
|
+
exportCsv(ctx: ShopContextParams): Promise<string>;
|
|
14
|
+
getExampleJson(): Promise<ImportBrandItem[]>;
|
|
15
|
+
getExampleCsv(): Promise<string>;
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=brands-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brands-client.d.ts","sourceRoot":"","sources":["../../src/clients/brands-client.ts"],"names":[],"mappings":"AAAA,OAAO,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O,CAAC,KAAK,CAAC;IAIpE,WAAW,CAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAI5E,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAIpF,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAInF,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAI5E,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAI9D,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAI5C,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvC"}
|
|
@@ -6,6 +6,9 @@ export class BrandsClient extends ImportExportBaseClient {
|
|
|
6
6
|
async getBrand(id, ctx) {
|
|
7
7
|
return this.request('GET', `/brands/${id}`, { params: ctx });
|
|
8
8
|
}
|
|
9
|
+
async getBrandByCode(code, ctx) {
|
|
10
|
+
return this.request('GET', `/brands/code/${encodeURIComponent(code)}`, { params: ctx });
|
|
11
|
+
}
|
|
9
12
|
async createBrand(dto, ctx) {
|
|
10
13
|
return this.request('POST', '/brands', { body: dto, params: ctx });
|
|
11
14
|
}
|
|
@@ -15,22 +18,22 @@ export class BrandsClient extends ImportExportBaseClient {
|
|
|
15
18
|
async deleteBrand(id, ctx) {
|
|
16
19
|
return this.request('DELETE', `/brands/${id}`, { params: ctx });
|
|
17
20
|
}
|
|
18
|
-
async
|
|
21
|
+
async importJson(items, ctx) {
|
|
19
22
|
return this.request('POST', '/brands/import/json', { body: items, params: ctx });
|
|
20
23
|
}
|
|
21
|
-
async
|
|
24
|
+
async importCsv(csvContent, ctx) {
|
|
22
25
|
return this.uploadCsv('/brands/import/csv', csvContent, ctx);
|
|
23
26
|
}
|
|
24
|
-
async
|
|
27
|
+
async exportJson(ctx) {
|
|
25
28
|
return this.request('GET', '/brands/export/json', { params: ctx });
|
|
26
29
|
}
|
|
27
|
-
async
|
|
30
|
+
async exportCsv(ctx) {
|
|
28
31
|
return this.requestText('GET', '/brands/export/csv', { params: ctx });
|
|
29
32
|
}
|
|
30
|
-
async
|
|
33
|
+
async getExampleJson() {
|
|
31
34
|
return this.requestPublic('GET', '/brands/examples/json');
|
|
32
35
|
}
|
|
33
|
-
async
|
|
36
|
+
async getExampleCsv() {
|
|
34
37
|
return this.requestTextPublic('GET', '/brands/examples/csv');
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Category, CreateCategoryRequest, UpdateCategoryDto, ImportCategoryItem, CategoryExportItem, ImportResult, ShopContextParams } from '@sales-planner/shared';
|
|
2
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
3
|
+
export declare class CategoriesClient extends ImportExportBaseClient {
|
|
4
|
+
getCategories(ctx: ShopContextParams): Promise<Category[]>;
|
|
5
|
+
getCategory(id: number, ctx: ShopContextParams): Promise<Category>;
|
|
6
|
+
getCategoryByCode(code: string, ctx: ShopContextParams): Promise<Category>;
|
|
7
|
+
createCategory(dto: CreateCategoryRequest, ctx: ShopContextParams): Promise<Category>;
|
|
8
|
+
updateCategory(id: number, dto: UpdateCategoryDto, ctx: ShopContextParams): Promise<Category>;
|
|
9
|
+
deleteCategory(id: number, ctx: ShopContextParams): Promise<void>;
|
|
10
|
+
importJson(items: ImportCategoryItem[], ctx: ShopContextParams): Promise<ImportResult>;
|
|
11
|
+
importCsv(csvContent: string, ctx: ShopContextParams): Promise<ImportResult>;
|
|
12
|
+
exportJson(ctx: ShopContextParams): Promise<CategoryExportItem[]>;
|
|
13
|
+
exportCsv(ctx: ShopContextParams): Promise<string>;
|
|
14
|
+
getExampleJson(): Promise<CategoryExportItem[]>;
|
|
15
|
+
getExampleCsv(): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=categories-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories-client.d.ts","sourceRoot":"","sources":["../../src/clients/categories-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,qBAAa,gBAAiB,SAAQ,sBAAsB;IACpD,aAAa,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAI1D,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIlE,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1E,cAAc,CAAC,GAAG,EAAE,qBAAqB,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIrF,cAAc,CAClB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,iBAAiB,EACtB,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,CAAC;IAId,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjE,UAAU,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAItF,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAI5E,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAIjE,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD,cAAc,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAI/C,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
2
|
+
export class CategoriesClient extends ImportExportBaseClient {
|
|
3
|
+
async getCategories(ctx) {
|
|
4
|
+
return this.request('GET', '/categories', { params: ctx });
|
|
5
|
+
}
|
|
6
|
+
async getCategory(id, ctx) {
|
|
7
|
+
return this.request('GET', `/categories/${id}`, { params: ctx });
|
|
8
|
+
}
|
|
9
|
+
async getCategoryByCode(code, ctx) {
|
|
10
|
+
return this.request('GET', `/categories/code/${encodeURIComponent(code)}`, { params: ctx });
|
|
11
|
+
}
|
|
12
|
+
async createCategory(dto, ctx) {
|
|
13
|
+
return this.request('POST', '/categories', { body: dto, params: ctx });
|
|
14
|
+
}
|
|
15
|
+
async updateCategory(id, dto, ctx) {
|
|
16
|
+
return this.request('PUT', `/categories/${id}`, { body: dto, params: ctx });
|
|
17
|
+
}
|
|
18
|
+
async deleteCategory(id, ctx) {
|
|
19
|
+
return this.request('DELETE', `/categories/${id}`, { params: ctx });
|
|
20
|
+
}
|
|
21
|
+
// Import/Export methods
|
|
22
|
+
async importJson(items, ctx) {
|
|
23
|
+
return this.request('POST', '/categories/import/json', { body: items, params: ctx });
|
|
24
|
+
}
|
|
25
|
+
async importCsv(csvContent, ctx) {
|
|
26
|
+
return this.uploadCsv('/categories/import/csv', csvContent, ctx);
|
|
27
|
+
}
|
|
28
|
+
async exportJson(ctx) {
|
|
29
|
+
return this.request('GET', '/categories/export/json', { params: ctx });
|
|
30
|
+
}
|
|
31
|
+
async exportCsv(ctx) {
|
|
32
|
+
return this.requestText('GET', '/categories/export/csv', { params: ctx });
|
|
33
|
+
}
|
|
34
|
+
async getExampleJson() {
|
|
35
|
+
return this.requestPublic('GET', '/categories/examples/json');
|
|
36
|
+
}
|
|
37
|
+
async getExampleCsv() {
|
|
38
|
+
return this.requestTextPublic('GET', '/categories/examples/csv');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Group, CreateGroupRequest, UpdateGroupDto, ImportGroupItem, GroupExportItem, ImportResult, ShopContextParams } from '@sales-planner/shared';
|
|
2
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
3
|
+
export declare class GroupsClient extends ImportExportBaseClient {
|
|
4
|
+
getGroups(ctx: ShopContextParams): Promise<Group[]>;
|
|
5
|
+
getGroup(id: number, ctx: ShopContextParams): Promise<Group>;
|
|
6
|
+
getGroupByCode(code: string, ctx: ShopContextParams): Promise<Group>;
|
|
7
|
+
createGroup(dto: CreateGroupRequest, ctx: ShopContextParams): Promise<Group>;
|
|
8
|
+
updateGroup(id: number, dto: UpdateGroupDto, ctx: ShopContextParams): Promise<Group>;
|
|
9
|
+
deleteGroup(id: number, ctx: ShopContextParams): Promise<void>;
|
|
10
|
+
importJson(items: ImportGroupItem[], ctx: ShopContextParams): Promise<ImportResult>;
|
|
11
|
+
importCsv(csvContent: string, ctx: ShopContextParams): Promise<ImportResult>;
|
|
12
|
+
exportJson(ctx: ShopContextParams): Promise<GroupExportItem[]>;
|
|
13
|
+
exportCsv(ctx: ShopContextParams): Promise<string>;
|
|
14
|
+
getExampleJson(): Promise<GroupExportItem[]>;
|
|
15
|
+
getExampleCsv(): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingUR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CAAC,MAAM,CAAC;IAIlD,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAI5C,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
2
|
+
export class GroupsClient extends ImportExportBaseClient {
|
|
3
|
+
async getGroups(ctx) {
|
|
4
|
+
return this.request('GET', '/groups', { params: ctx });
|
|
5
|
+
}
|
|
6
|
+
async getGroup(id, ctx) {
|
|
7
|
+
return this.request('GET', `/groups/${id}`, { params: ctx });
|
|
8
|
+
}
|
|
9
|
+
async getGroupByCode(code, ctx) {
|
|
10
|
+
return this.request('GET', `/groups/code/${encodeURIComponent(code)}`, { params: ctx });
|
|
11
|
+
}
|
|
12
|
+
async createGroup(dto, ctx) {
|
|
13
|
+
return this.request('POST', '/groups', { body: dto, params: ctx });
|
|
14
|
+
}
|
|
15
|
+
async updateGroup(id, dto, ctx) {
|
|
16
|
+
return this.request('PUT', `/groups/${id}`, { body: dto, params: ctx });
|
|
17
|
+
}
|
|
18
|
+
async deleteGroup(id, ctx) {
|
|
19
|
+
return this.request('DELETE', `/groups/${id}`, { params: ctx });
|
|
20
|
+
}
|
|
21
|
+
// Import/Export methods
|
|
22
|
+
async importJson(items, ctx) {
|
|
23
|
+
return this.request('POST', '/groups/import/json', { body: items, params: ctx });
|
|
24
|
+
}
|
|
25
|
+
async importCsv(csvContent, ctx) {
|
|
26
|
+
return this.uploadCsv('/groups/import/csv', csvContent, ctx);
|
|
27
|
+
}
|
|
28
|
+
async exportJson(ctx) {
|
|
29
|
+
return this.request('GET', '/groups/export/json', { params: ctx });
|
|
30
|
+
}
|
|
31
|
+
async exportCsv(ctx) {
|
|
32
|
+
return this.requestText('GET', '/groups/export/csv', { params: ctx });
|
|
33
|
+
}
|
|
34
|
+
async getExampleJson() {
|
|
35
|
+
return this.requestPublic('GET', '/groups/examples/json');
|
|
36
|
+
}
|
|
37
|
+
async getExampleCsv() {
|
|
38
|
+
return this.requestTextPublic('GET', '/groups/examples/csv');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -3,14 +3,15 @@ import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
|
3
3
|
export declare class MarketplacesClient extends ImportExportBaseClient {
|
|
4
4
|
getMarketplaces(ctx: ShopContextParams): Promise<Marketplace[]>;
|
|
5
5
|
getMarketplace(id: number, ctx: ShopContextParams): Promise<Marketplace>;
|
|
6
|
+
getMarketplaceByCode(code: string, ctx: ShopContextParams): Promise<Marketplace>;
|
|
6
7
|
createMarketplace(dto: CreateMarketplaceRequest, ctx: ShopContextParams): Promise<Marketplace>;
|
|
7
8
|
updateMarketplace(id: number, dto: Partial<CreateMarketplaceRequest>, ctx: ShopContextParams): Promise<Marketplace>;
|
|
8
9
|
deleteMarketplace(id: number, ctx: ShopContextParams): Promise<void>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
importJson(items: ImportMarketplaceItem[], ctx: ShopContextParams): Promise<ImportResult>;
|
|
11
|
+
importCsv(csvContent: string, ctx: ShopContextParams): Promise<ImportResult>;
|
|
12
|
+
exportJson(ctx: ShopContextParams): Promise<MarketplaceExportItem[]>;
|
|
13
|
+
exportCsv(ctx: ShopContextParams): Promise<string>;
|
|
14
|
+
getExampleJson(): Promise<ImportMarketplaceItem[]>;
|
|
15
|
+
getExampleCsv(): Promise<string>;
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=marketplaces-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketplaces-client.d.ts","sourceRoot":"","sources":["../../src/clients/marketplaces-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/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iBAAiB,GACrB,OAAO,CAAC,WAAW,CAAC;IAIjB,iBAAiB,CACrB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,OAAO,CAAC,wBAAwB,CAAC,EACtC,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,WAAW,CAAC;IAIjB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE,UAAU,CAAC,KAAK,EAAE,qBAAqB,EAAE,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIzF,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAI5E,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAIpE,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD,cAAc,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAIlD,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvC"}
|
|
@@ -6,6 +6,9 @@ export class MarketplacesClient extends ImportExportBaseClient {
|
|
|
6
6
|
async getMarketplace(id, ctx) {
|
|
7
7
|
return this.request('GET', `/marketplaces/${id}`, { params: ctx });
|
|
8
8
|
}
|
|
9
|
+
async getMarketplaceByCode(code, ctx) {
|
|
10
|
+
return this.request('GET', `/marketplaces/code/${encodeURIComponent(code)}`, { params: ctx });
|
|
11
|
+
}
|
|
9
12
|
async createMarketplace(dto, ctx) {
|
|
10
13
|
return this.request('POST', '/marketplaces', { body: dto, params: ctx });
|
|
11
14
|
}
|
|
@@ -15,22 +18,22 @@ export class MarketplacesClient extends ImportExportBaseClient {
|
|
|
15
18
|
async deleteMarketplace(id, ctx) {
|
|
16
19
|
return this.request('DELETE', `/marketplaces/${id}`, { params: ctx });
|
|
17
20
|
}
|
|
18
|
-
async
|
|
21
|
+
async importJson(items, ctx) {
|
|
19
22
|
return this.request('POST', '/marketplaces/import/json', { body: items, params: ctx });
|
|
20
23
|
}
|
|
21
|
-
async
|
|
24
|
+
async importCsv(csvContent, ctx) {
|
|
22
25
|
return this.uploadCsv('/marketplaces/import/csv', csvContent, ctx);
|
|
23
26
|
}
|
|
24
|
-
async
|
|
27
|
+
async exportJson(ctx) {
|
|
25
28
|
return this.request('GET', '/marketplaces/export/json', { params: ctx });
|
|
26
29
|
}
|
|
27
|
-
async
|
|
30
|
+
async exportCsv(ctx) {
|
|
28
31
|
return this.requestText('GET', '/marketplaces/export/csv', { params: ctx });
|
|
29
32
|
}
|
|
30
|
-
async
|
|
33
|
+
async getExampleJson() {
|
|
31
34
|
return this.requestPublic('GET', '/marketplaces/examples/json');
|
|
32
35
|
}
|
|
33
|
-
async
|
|
36
|
+
async getExampleCsv() {
|
|
34
37
|
return this.requestTextPublic('GET', '/marketplaces/examples/csv');
|
|
35
38
|
}
|
|
36
39
|
}
|