@sales-planner/http-client 0.6.0 → 0.7.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/README.md +103 -4
- package/dist/client.d.ts +1 -1
- package/dist/clients/brands-client.d.ts +16 -0
- package/dist/clients/brands-client.d.ts.map +1 -0
- package/dist/clients/brands-client.js +36 -0
- package/dist/clients/sales-planner-client.d.ts +11 -0
- package/dist/clients/sales-planner-client.d.ts.map +1 -1
- package/dist/clients/sales-planner-client.js +12 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -47,6 +47,11 @@ const skus = await client.skus.getSkus({ tenantId, shopId });
|
|
|
47
47
|
await client.skus.importSkusJson(items, { tenantId, shopId });
|
|
48
48
|
const csv = await client.skus.exportSkusCsv({ tenantId, shopId });
|
|
49
49
|
|
|
50
|
+
// Brands with import/export
|
|
51
|
+
const brands = await client.brands.getBrands({ tenantId, shopId });
|
|
52
|
+
await client.brands.importBrandsJson(items, { tenantId, shopId });
|
|
53
|
+
const brandsCsv = await client.brands.exportBrandsCsv({ tenantId, shopId });
|
|
54
|
+
|
|
50
55
|
// Sales History
|
|
51
56
|
const history = await client.salesHistory.getSalesHistory(
|
|
52
57
|
{ tenantId, shopId },
|
|
@@ -75,7 +80,7 @@ const skus = await client.getSkus({ tenantId, shopId });
|
|
|
75
80
|
|
|
76
81
|
## Import/Export Pattern
|
|
77
82
|
|
|
78
|
-
Resources that support bulk operations (SKUs, Sales History, Marketplaces) follow a consistent pattern:
|
|
83
|
+
Resources that support bulk operations (SKUs, Brands, Sales History, Marketplaces) follow a consistent pattern:
|
|
79
84
|
|
|
80
85
|
```typescript
|
|
81
86
|
// Import from JSON
|
|
@@ -95,10 +100,95 @@ const result = await client.skus.importSkusCsv(csvContent, { tenantId, shopId })
|
|
|
95
100
|
// Export to CSV
|
|
96
101
|
const csv = await client.skus.exportSkusCsv({ tenantId, shopId });
|
|
97
102
|
|
|
98
|
-
// Get example templates
|
|
103
|
+
// Get example templates (no auth required)
|
|
99
104
|
const exampleCsv = await client.skus.getSkusExampleCsv();
|
|
105
|
+
|
|
106
|
+
// Same pattern works for brands
|
|
107
|
+
const brandResult = await client.brands.importBrandsJson(
|
|
108
|
+
[{ code: 'apple', title: 'Apple' }],
|
|
109
|
+
{ tenantId, shopId }
|
|
110
|
+
);
|
|
111
|
+
const brandsCsv = await client.brands.exportBrandsCsv({ tenantId, shopId });
|
|
112
|
+
const brandExample = await client.brands.getBrandsExampleCsv();
|
|
100
113
|
```
|
|
101
114
|
|
|
115
|
+
## Data Requirements
|
|
116
|
+
|
|
117
|
+
### SKUs
|
|
118
|
+
|
|
119
|
+
**Create/Import:**
|
|
120
|
+
- `code` (required): String, 1-100 characters, unique per shop
|
|
121
|
+
- `title` (required): String, 1-200 characters
|
|
122
|
+
|
|
123
|
+
**Update:**
|
|
124
|
+
- `code` (optional): String, 1-100 characters
|
|
125
|
+
- `title` (optional): String, 1-200 characters
|
|
126
|
+
|
|
127
|
+
### Brands
|
|
128
|
+
|
|
129
|
+
**Create/Import:**
|
|
130
|
+
- `code` (required): String, 1-100 characters, unique per shop
|
|
131
|
+
- `title` (required): String, 1-200 characters
|
|
132
|
+
|
|
133
|
+
**Update:**
|
|
134
|
+
- `code` (optional): String, 1-100 characters
|
|
135
|
+
- `title` (optional): String, 1-200 characters
|
|
136
|
+
|
|
137
|
+
### Sales History
|
|
138
|
+
|
|
139
|
+
**Create/Import:**
|
|
140
|
+
- `sku_code` (required): String, must match existing SKU or will be auto-created
|
|
141
|
+
- `period` (required): String, format `YYYY-MM` (e.g., "2026-01")
|
|
142
|
+
- `quantity` (required): Number, integer
|
|
143
|
+
- `marketplace` (required): String, must match existing marketplace ID or will be auto-created
|
|
144
|
+
|
|
145
|
+
**Update:**
|
|
146
|
+
- `sku_id` (optional): Number
|
|
147
|
+
- `period` (optional): String, format `YYYY-MM`
|
|
148
|
+
- `quantity` (optional): Number
|
|
149
|
+
- `marketplace` (optional): String
|
|
150
|
+
|
|
151
|
+
### Users
|
|
152
|
+
|
|
153
|
+
**Create:**
|
|
154
|
+
- `email` (required): String, valid email format, unique
|
|
155
|
+
- `name` (required): String, 1-200 characters
|
|
156
|
+
- `default_shop_id` (optional): Number
|
|
157
|
+
|
|
158
|
+
**Update:**
|
|
159
|
+
- `email` (optional): String, valid email format
|
|
160
|
+
- `name` (optional): String, 1-200 characters
|
|
161
|
+
- `default_shop_id` (optional): Number or null
|
|
162
|
+
|
|
163
|
+
### Tenants
|
|
164
|
+
|
|
165
|
+
**Create:**
|
|
166
|
+
- `title` (required): String, 1-200 characters
|
|
167
|
+
- `owner_id` (optional): Number, user ID
|
|
168
|
+
|
|
169
|
+
**Update:**
|
|
170
|
+
- `title` (optional): String, 1-200 characters
|
|
171
|
+
- `owner_id` (optional): Number or null
|
|
172
|
+
|
|
173
|
+
### Shops
|
|
174
|
+
|
|
175
|
+
**Create:**
|
|
176
|
+
- `title` (required): String, 1-200 characters
|
|
177
|
+
- `tenant_id` (required): Number
|
|
178
|
+
|
|
179
|
+
**Update:**
|
|
180
|
+
- `title` (optional): String, 1-200 characters
|
|
181
|
+
|
|
182
|
+
### Marketplaces
|
|
183
|
+
|
|
184
|
+
**Create:**
|
|
185
|
+
- `id` (required): String, 1-100 characters, unique (e.g., "amazon", "ebay")
|
|
186
|
+
- `title` (required): String, 1-200 characters
|
|
187
|
+
|
|
188
|
+
**Update:**
|
|
189
|
+
- `id` (optional): String, 1-100 characters
|
|
190
|
+
- `title` (optional): String, 1-200 characters
|
|
191
|
+
|
|
102
192
|
## Error Handling
|
|
103
193
|
|
|
104
194
|
```typescript
|
|
@@ -155,6 +245,13 @@ try {
|
|
|
155
245
|
- `exportSkusJson(ctx)`, `exportSkusCsv(ctx)` - Requires read access
|
|
156
246
|
- `getSkusExampleJson()`, `getSkusExampleCsv()` - Get import format examples (no auth required)
|
|
157
247
|
|
|
248
|
+
### Brands
|
|
249
|
+
- `getBrands(ctx)`, `getBrand(id, ctx)` - Requires read access (viewer or higher)
|
|
250
|
+
- `createBrand(dto, ctx)`, `updateBrand(id, dto, ctx)`, `deleteBrand(id, ctx)` - Requires write access (editor or higher)
|
|
251
|
+
- `importBrandsJson(items, ctx)`, `importBrandsCsv(csvContent, ctx)` - Requires write access (bulk upsert by code)
|
|
252
|
+
- `exportBrandsJson(ctx)`, `exportBrandsCsv(ctx)` - Requires read access
|
|
253
|
+
- `getBrandsExampleJson()`, `getBrandsExampleCsv()` - Get import format examples (no auth required)
|
|
254
|
+
|
|
158
255
|
### Sales History
|
|
159
256
|
- `getSalesHistory(ctx, query?)`, `getSalesHistoryItem(id, ctx)` - Requires read access (viewer or higher)
|
|
160
257
|
- `createSalesHistory(dto, ctx)`, `updateSalesHistory(id, dto, ctx)`, `deleteSalesHistory(id, ctx)` - Requires write access (editor or higher)
|
|
@@ -195,10 +292,12 @@ All entity types, DTOs, and response types are exported:
|
|
|
195
292
|
|
|
196
293
|
```typescript
|
|
197
294
|
import type {
|
|
198
|
-
User, Tenant, Shop, Sku, SalesHistory,
|
|
295
|
+
User, Tenant, Shop, Sku, Brand, SalesHistory,
|
|
199
296
|
CreateUserDto, CreateTenantDto, CreateShopDto,
|
|
297
|
+
CreateSkuRequest, CreateBrandRequest,
|
|
200
298
|
ShopContextParams, PeriodQuery,
|
|
201
|
-
UserWithRolesAndTenants, ImportResult
|
|
299
|
+
UserWithRolesAndTenants, ImportResult,
|
|
300
|
+
SkuExportItem, BrandExportItem
|
|
202
301
|
} from '@sales-planner/http-client';
|
|
203
302
|
```
|
|
204
303
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { SalesPlannerClient, ApiError, type ClientConfig } from './clients/index.js';
|
|
2
|
-
//# sourceMappingURL=client.d.ts.map
|
|
2
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Brand, CreateBrandRequest, UpdateBrandDto, ImportBrandItem, BrandExportItem, ImportResult, ShopContextParams } from '@sales-planner/shared';
|
|
2
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
3
|
+
export declare class BrandsClient extends ImportExportBaseClient {
|
|
4
|
+
getBrands(ctx: ShopContextParams): Promise<Brand[]>;
|
|
5
|
+
getBrand(id: number, ctx: ShopContextParams): Promise<Brand>;
|
|
6
|
+
createBrand(dto: CreateBrandRequest, ctx: ShopContextParams): Promise<Brand>;
|
|
7
|
+
updateBrand(id: number, dto: UpdateBrandDto, ctx: ShopContextParams): Promise<Brand>;
|
|
8
|
+
deleteBrand(id: number, ctx: ShopContextParams): Promise<void>;
|
|
9
|
+
importBrandsJson(items: ImportBrandItem[], ctx: ShopContextParams): Promise<ImportResult>;
|
|
10
|
+
importBrandsCsv(csvContent: string, ctx: ShopContextParams): Promise<ImportResult>;
|
|
11
|
+
exportBrandsJson(ctx: ShopContextParams): Promise<BrandExportItem[]>;
|
|
12
|
+
exportBrandsCsv(ctx: ShopContextParams): Promise<string>;
|
|
13
|
+
getBrandsExampleJson(): Promise<ImportBrandItem[]>;
|
|
14
|
+
getBrandsExampleCsv(): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=brands-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brands-client.d.ts","sourceRoot":"","sources":["../../src/clients/brands-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,qBAAa,YAAa,SAAQ,sBAAsB;IAChD,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAInD,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAI5D,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,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIzF,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIlF,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAIpE,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,oBAAoB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAIlD,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;CAG7C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
2
|
+
export class BrandsClient extends ImportExportBaseClient {
|
|
3
|
+
async getBrands(ctx) {
|
|
4
|
+
return this.request('GET', '/brands', { params: ctx });
|
|
5
|
+
}
|
|
6
|
+
async getBrand(id, ctx) {
|
|
7
|
+
return this.request('GET', `/brands/${id}`, { params: ctx });
|
|
8
|
+
}
|
|
9
|
+
async createBrand(dto, ctx) {
|
|
10
|
+
return this.request('POST', '/brands', { body: dto, params: ctx });
|
|
11
|
+
}
|
|
12
|
+
async updateBrand(id, dto, ctx) {
|
|
13
|
+
return this.request('PUT', `/brands/${id}`, { body: dto, params: ctx });
|
|
14
|
+
}
|
|
15
|
+
async deleteBrand(id, ctx) {
|
|
16
|
+
return this.request('DELETE', `/brands/${id}`, { params: ctx });
|
|
17
|
+
}
|
|
18
|
+
async importBrandsJson(items, ctx) {
|
|
19
|
+
return this.request('POST', '/brands/import/json', { body: items, params: ctx });
|
|
20
|
+
}
|
|
21
|
+
async importBrandsCsv(csvContent, ctx) {
|
|
22
|
+
return this.uploadCsv('/brands/import/csv', csvContent, ctx);
|
|
23
|
+
}
|
|
24
|
+
async exportBrandsJson(ctx) {
|
|
25
|
+
return this.request('GET', '/brands/export/json', { params: ctx });
|
|
26
|
+
}
|
|
27
|
+
async exportBrandsCsv(ctx) {
|
|
28
|
+
return this.requestText('GET', '/brands/export/csv', { params: ctx });
|
|
29
|
+
}
|
|
30
|
+
async getBrandsExampleJson() {
|
|
31
|
+
return this.requestPublic('GET', '/brands/examples/json');
|
|
32
|
+
}
|
|
33
|
+
async getBrandsExampleCsv() {
|
|
34
|
+
return this.requestTextPublic('GET', '/brands/examples/csv');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -4,6 +4,7 @@ import { UsersClient } from './users-client.js';
|
|
|
4
4
|
import { TenantsClient } from './tenants-client.js';
|
|
5
5
|
import { ShopsClient } from './shops-client.js';
|
|
6
6
|
import { SkusClient } from './skus-client.js';
|
|
7
|
+
import { BrandsClient } from './brands-client.js';
|
|
7
8
|
import { SalesHistoryClient } from './sales-history-client.js';
|
|
8
9
|
import { MarketplacesClient } from './marketplaces-client.js';
|
|
9
10
|
import { RolesClient } from './roles-client.js';
|
|
@@ -16,6 +17,7 @@ export declare class SalesPlannerClient {
|
|
|
16
17
|
readonly tenants: TenantsClient;
|
|
17
18
|
readonly shops: ShopsClient;
|
|
18
19
|
readonly skus: SkusClient;
|
|
20
|
+
readonly brands: BrandsClient;
|
|
19
21
|
readonly salesHistory: SalesHistoryClient;
|
|
20
22
|
readonly marketplaces: MarketplacesClient;
|
|
21
23
|
readonly roles: RolesClient;
|
|
@@ -50,6 +52,15 @@ export declare class SalesPlannerClient {
|
|
|
50
52
|
exportSkusCsv: (ctx: Parameters<SkusClient["exportSkusCsv"]>[0]) => Promise<string>;
|
|
51
53
|
getSkusExampleJson: () => Promise<import("@sales-planner/shared").ImportSkuItem[]>;
|
|
52
54
|
getSkusExampleCsv: () => Promise<string>;
|
|
55
|
+
getBrands: (ctx: Parameters<BrandsClient["getBrands"]>[0]) => Promise<import("@sales-planner/shared").Brand[]>;
|
|
56
|
+
getBrand: (id: number, ctx: Parameters<BrandsClient["getBrand"]>[1]) => Promise<import("@sales-planner/shared").Brand>;
|
|
57
|
+
createBrand: (dto: Parameters<BrandsClient["createBrand"]>[0], ctx: Parameters<BrandsClient["createBrand"]>[1]) => Promise<import("@sales-planner/shared").Brand>;
|
|
58
|
+
updateBrand: (id: number, dto: Parameters<BrandsClient["updateBrand"]>[1], ctx: Parameters<BrandsClient["updateBrand"]>[2]) => Promise<import("@sales-planner/shared").Brand>;
|
|
59
|
+
deleteBrand: (id: number, ctx: Parameters<BrandsClient["deleteBrand"]>[1]) => Promise<void>;
|
|
60
|
+
importBrandsJson: (items: Parameters<BrandsClient["importBrandsJson"]>[0], ctx: Parameters<BrandsClient["importBrandsJson"]>[1]) => Promise<import("@sales-planner/shared").ImportResult>;
|
|
61
|
+
importBrandsCsv: (csvContent: Parameters<BrandsClient["importBrandsCsv"]>[0], ctx: Parameters<BrandsClient["importBrandsCsv"]>[1]) => Promise<import("@sales-planner/shared").ImportResult>;
|
|
62
|
+
exportBrandsJson: (ctx: Parameters<BrandsClient["exportBrandsJson"]>[0]) => Promise<import("@sales-planner/shared").BrandExportItem[]>;
|
|
63
|
+
exportBrandsCsv: (ctx: Parameters<BrandsClient["exportBrandsCsv"]>[0]) => Promise<string>;
|
|
53
64
|
getSalesHistory: (ctx: Parameters<SalesHistoryClient["getSalesHistory"]>[0], query?: Parameters<SalesHistoryClient["getSalesHistory"]>[1]) => Promise<import("@sales-planner/shared").SalesHistory[]>;
|
|
54
65
|
getSalesHistoryItem: (id: number, ctx: Parameters<SalesHistoryClient["getSalesHistoryItem"]>[1]) => Promise<import("@sales-planner/shared").SalesHistory>;
|
|
55
66
|
createSalesHistory: (dto: Parameters<SalesHistoryClient["createSalesHistory"]>[0], ctx: Parameters<SalesHistoryClient["createSalesHistory"]>[1]) => Promise<import("@sales-planner/shared").SalesHistory>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sales-planner-client.d.ts","sourceRoot":"","sources":["../../src/clients/sales-planner-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAAS;IAGxB,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU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AC,CAAC,CAAC,CAAC,EACtE,KAAK,UAAU,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,2DACH;IAC9D,sBAAsB,GAAI,KAAK,UAAU,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,sEAC1C;IAChD,qBAAqB,GAAI,KAAK,UAAU,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,qBACzC;IAC/C,0BAA0B,yEAAwD;IAClF,yBAAyB,wBAAuD;IAChF,QAAQ,wDAA+B;IACvC,OAAO,GAAI,IAAI,MAAM,mDAA4B;IACjD,UAAU,GAAI,KAAK,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,mDAAgC;IAC3F,UAAU,GAAI,IAAI,MAAM,EAAE,KAAK,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,mDACtC;IACjC,UAAU,GAAI,IAAI,MAAM,mBAA+B;IACvD,cAAc,GAAI,KAAK,UAAU,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,mBAClC;IACrC,cAAc,GAAI,IAAI,MAAM,mBAAuC;IACnE,UAAU,GAAI,SAAS,MAAM,uDAAqC;IAClE,YAAY,GAAI,KAAK,UAAU,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,qDAChC;IACjC,YAAY,GAAI,IAAI,MAAM,mBAAmC;IAGvD,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAQ1B,SAAS,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAOhE"}
|
|
@@ -4,6 +4,7 @@ import { UsersClient } from './users-client.js';
|
|
|
4
4
|
import { TenantsClient } from './tenants-client.js';
|
|
5
5
|
import { ShopsClient } from './shops-client.js';
|
|
6
6
|
import { SkusClient } from './skus-client.js';
|
|
7
|
+
import { BrandsClient } from './brands-client.js';
|
|
7
8
|
import { SalesHistoryClient } from './sales-history-client.js';
|
|
8
9
|
import { MarketplacesClient } from './marketplaces-client.js';
|
|
9
10
|
import { RolesClient } from './roles-client.js';
|
|
@@ -17,6 +18,7 @@ export class SalesPlannerClient {
|
|
|
17
18
|
tenants;
|
|
18
19
|
shops;
|
|
19
20
|
skus;
|
|
21
|
+
brands;
|
|
20
22
|
salesHistory;
|
|
21
23
|
marketplaces;
|
|
22
24
|
roles;
|
|
@@ -29,6 +31,7 @@ export class SalesPlannerClient {
|
|
|
29
31
|
this.tenants = new TenantsClient(config);
|
|
30
32
|
this.shops = new ShopsClient(config);
|
|
31
33
|
this.skus = new SkusClient(config);
|
|
34
|
+
this.brands = new BrandsClient(config);
|
|
32
35
|
this.salesHistory = new SalesHistoryClient(config);
|
|
33
36
|
this.marketplaces = new MarketplacesClient(config);
|
|
34
37
|
this.roles = new RolesClient(config);
|
|
@@ -64,6 +67,15 @@ export class SalesPlannerClient {
|
|
|
64
67
|
exportSkusCsv = (ctx) => this.skus.exportSkusCsv(ctx);
|
|
65
68
|
getSkusExampleJson = () => this.skus.getSkusExampleJson();
|
|
66
69
|
getSkusExampleCsv = () => this.skus.getSkusExampleCsv();
|
|
70
|
+
getBrands = (ctx) => this.brands.getBrands(ctx);
|
|
71
|
+
getBrand = (id, ctx) => this.brands.getBrand(id, ctx);
|
|
72
|
+
createBrand = (dto, ctx) => this.brands.createBrand(dto, ctx);
|
|
73
|
+
updateBrand = (id, dto, ctx) => this.brands.updateBrand(id, dto, ctx);
|
|
74
|
+
deleteBrand = (id, ctx) => this.brands.deleteBrand(id, ctx);
|
|
75
|
+
importBrandsJson = (items, ctx) => this.brands.importBrandsJson(items, ctx);
|
|
76
|
+
importBrandsCsv = (csvContent, ctx) => this.brands.importBrandsCsv(csvContent, ctx);
|
|
77
|
+
exportBrandsJson = (ctx) => this.brands.exportBrandsJson(ctx);
|
|
78
|
+
exportBrandsCsv = (ctx) => this.brands.exportBrandsCsv(ctx);
|
|
67
79
|
getSalesHistory = (ctx, query) => this.salesHistory.getSalesHistory(ctx, query);
|
|
68
80
|
getSalesHistoryItem = (id, ctx) => this.salesHistory.getSalesHistoryItem(id, ctx);
|
|
69
81
|
createSalesHistory = (dto, ctx) => this.salesHistory.createSalesHistory(dto, ctx);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SalesPlannerClient, ApiError } from './
|
|
2
|
-
export type { ClientConfig } from './
|
|
1
|
+
export { SalesPlannerClient, ApiError } from './clients/index.js';
|
|
2
|
+
export type { ClientConfig } from './clients/index.js';
|
|
3
3
|
export type { User, Tenant, Shop, Sku, SalesHistory, Role, UserRole, ApiKey, Marketplace, CreateUserDto, CreateTenantDto, CreateTenantWithShopDto, CreateShopDto, CreateSkuDto, CreateSkuRequest, UpdateSkuDto, ImportSkuItem, CreateSalesHistoryDto, CreateSalesHistoryRequest, UpdateSalesHistoryDto, ImportSalesHistoryItem, CreateApiKeyDto, CreateRoleDto, CreateUserRoleDto, CreateMarketplaceDto, CreateMarketplaceRequest, ShopContextParams, PeriodQuery, UserWithRolesAndTenants, TenantWithShopAndApiKey, ImportResult, DeleteDataResult, SkuExportItem, SalesHistoryExportItem, } from '@sales-planner/shared';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,YAAY,EAEV,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,GAAG,EACH,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,WAAW,EAEX,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EAExB,iBAAiB,EACjB,WAAW,EAEX,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,sBAAsB,GACvB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Client
|
|
2
|
-
export { SalesPlannerClient, ApiError } from './
|
|
2
|
+
export { SalesPlannerClient, ApiError } from './clients/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sales-planner/http-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "HTTP client for Sales Planner API",
|
|
5
5
|
"author": "Damir Manapov",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@sales-planner/shared": "0.
|
|
27
|
+
"@sales-planner/shared": "0.6.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"typescript": "^5.7.3"
|