@sales-planner/http-client 0.5.1 → 0.7.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 CHANGED
@@ -1,51 +1,133 @@
1
1
  # @sales-planner/http-client
2
2
 
3
- Type-safe HTTP client for the Sales Planner API.
3
+ TypeScript HTTP client for the Sales Planner API with full type safety.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @sales-planner/http-client
9
- # or
10
8
  pnpm add @sales-planner/http-client
11
9
  ```
12
10
 
13
11
  ## Usage
14
12
 
13
+ ### Quick Start
14
+
15
15
  ```typescript
16
16
  import { SalesPlannerClient } from '@sales-planner/http-client';
17
17
 
18
18
  const client = new SalesPlannerClient({
19
19
  baseUrl: 'https://sales-planner-back.vercel.app',
20
- apiKey: 'your-api-key'
20
+ getAuthToken: () => 'your-api-key',
21
21
  });
22
22
 
23
- // Get current user
24
- const me = await client.getMe();
23
+ // Check if API is healthy
24
+ const health = await client.getHealth();
25
+ console.log(health); // { status: 'ok', version: '1.0.0' }
26
+ ```
27
+
28
+ ### API Styles
25
29
 
26
- // Get shops
27
- const shops = await client.getShops();
30
+ The client supports two complementary API styles:
28
31
 
29
- // Get SKUs for a shop
30
- const skus = await client.getSkus({ shop_id: 1, tenant_id: 1 });
32
+ #### 1. **Namespaced API** (Recommended)
31
33
 
32
- // Create API key (key is auto-generated)
33
- const apiKey = await client.createApiKey({
34
- user_id: 1,
35
- name: 'Production Key',
36
- expires_at: '2026-12-31T23:59:59Z'
37
- });
34
+ Access resources through domain-specific sub-clients:
35
+
36
+ ```typescript
37
+ // Users
38
+ const users = await client.users.getUsers();
39
+ const user = await client.users.getUser(1);
40
+
41
+ // Tenants & Shops
42
+ const tenants = await client.tenants.getTenants();
43
+ const shops = await client.shops.getShops(tenantId);
44
+
45
+ // SKUs with import/export
46
+ const skus = await client.skus.getSkus({ tenantId, shopId });
47
+ await client.skus.importSkusJson(items, { tenantId, shopId });
48
+ const csv = await client.skus.exportSkusCsv({ tenantId, shopId });
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
+
55
+ // Sales History
56
+ const history = await client.salesHistory.getSalesHistory(
57
+ { tenantId, shopId },
58
+ { start: '2024-01', end: '2024-12' }
59
+ );
60
+
61
+ // Marketplaces
62
+ const marketplaces = await client.marketplaces.getMarketplaces({ tenantId });
63
+ ```
64
+
65
+ **Benefits:**
66
+ - Clear domain separation
67
+ - IDE autocomplete by domain
68
+ - Easier to discover related methods
69
+
70
+ #### 2. **Flat API** (Backward Compatible)
71
+
72
+ Access all methods directly on the client:
73
+
74
+ ```typescript
75
+ // Backward compatible with existing code
76
+ const users = await client.getUsers();
77
+ const user = await client.getUser(1);
78
+ const skus = await client.getSkus({ tenantId, shopId });
79
+ ```
38
80
 
39
- // Import sales history (marketplace field required)
40
- const result = await client.importSalesHistoryJson([
41
- { sku_code: 'SKU-001', period: '2026-01', quantity: 100, marketplace: 'WB' }
42
- ], { shop_id: 1, tenant_id: 1 });
81
+ ## Import/Export Pattern
82
+
83
+ Resources that support bulk operations (SKUs, Brands, Sales History, Marketplaces) follow a consistent pattern:
84
+
85
+ ```typescript
86
+ // Import from JSON
87
+ const result = await client.skus.importSkusJson(
88
+ [
89
+ { code: 'SKU-001', title: 'Product 1' },
90
+ { code: 'SKU-002', title: 'Product 2' },
91
+ ],
92
+ { tenantId, shopId }
93
+ );
94
+ // Returns: { inserted: 2, updated: 0, errors: [] }
95
+
96
+ // Import from CSV file
97
+ const csvContent = await fs.readFile('skus.csv', 'utf-8');
98
+ const result = await client.skus.importSkusCsv(csvContent, { tenantId, shopId });
99
+
100
+ // Export to CSV
101
+ const csv = await client.skus.exportSkusCsv({ tenantId, shopId });
102
+
103
+ // Get example templates (no auth required)
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();
43
113
  ```
44
114
 
45
115
  ## Error Handling
46
116
 
47
- The API returns standard HTTP status codes:
48
- - `409 Conflict` - Duplicate resource (e.g., duplicate email, SKU code, sales period)
117
+ ```typescript
118
+ import { ApiError } from '@sales-planner/http-client';
119
+
120
+ try {
121
+ await client.users.getUser(999);
122
+ } catch (error) {
123
+ if (error instanceof ApiError) {
124
+ console.error(`API Error ${error.status}: ${error.message}`);
125
+ }
126
+ }
127
+ ```
128
+
129
+ Common HTTP status codes:
130
+ - `409 Conflict` - Duplicate resource (email, SKU code, sales period)
49
131
  - `404 Not Found` - Resource not found
50
132
  - `403 Forbidden` - Insufficient permissions
51
133
  - `400 Bad Request` - Validation error
@@ -86,6 +168,13 @@ try {
86
168
  - `exportSkusJson(ctx)`, `exportSkusCsv(ctx)` - Requires read access
87
169
  - `getSkusExampleJson()`, `getSkusExampleCsv()` - Get import format examples (no auth required)
88
170
 
171
+ ### Brands
172
+ - `getBrands(ctx)`, `getBrand(id, ctx)` - Requires read access (viewer or higher)
173
+ - `createBrand(dto, ctx)`, `updateBrand(id, dto, ctx)`, `deleteBrand(id, ctx)` - Requires write access (editor or higher)
174
+ - `importBrandsJson(items, ctx)`, `importBrandsCsv(csvContent, ctx)` - Requires write access (bulk upsert by code)
175
+ - `exportBrandsJson(ctx)`, `exportBrandsCsv(ctx)` - Requires read access
176
+ - `getBrandsExampleJson()`, `getBrandsExampleCsv()` - Get import format examples (no auth required)
177
+
89
178
  ### Sales History
90
179
  - `getSalesHistory(ctx, query?)`, `getSalesHistoryItem(id, ctx)` - Requires read access (viewer or higher)
91
180
  - `createSalesHistory(dto, ctx)`, `updateSalesHistory(id, dto, ctx)`, `deleteSalesHistory(id, ctx)` - Requires write access (editor or higher)
@@ -126,10 +215,12 @@ All entity types, DTOs, and response types are exported:
126
215
 
127
216
  ```typescript
128
217
  import type {
129
- User, Tenant, Shop, Sku, SalesHistory,
218
+ User, Tenant, Shop, Sku, Brand, SalesHistory,
130
219
  CreateUserDto, CreateTenantDto, CreateShopDto,
220
+ CreateSkuRequest, CreateBrandRequest,
131
221
  ShopContextParams, PeriodQuery,
132
- UserWithRolesAndTenants, ImportResult
222
+ UserWithRolesAndTenants, ImportResult,
223
+ SkuExportItem, BrandExportItem
133
224
  } from '@sales-planner/http-client';
134
225
  ```
135
226
 
@@ -0,0 +1,22 @@
1
+ import type { Brand, CreateBrandRequest, UpdateBrandDto, ImportResult, ShopContextParams } from '@sales-planner/shared';
2
+ import { ImportExportBaseClient } from './import-export-base-client.js';
3
+ export interface ImportBrandItem {
4
+ code: string;
5
+ title: string;
6
+ }
7
+ export interface BrandExportItem {
8
+ code: string;
9
+ title: string;
10
+ }
11
+ export declare class BrandsClient extends ImportExportBaseClient {
12
+ getBrands(ctx: ShopContextParams): Promise<Brand[]>;
13
+ getBrand(id: number, ctx: ShopContextParams): Promise<Brand>;
14
+ createBrand(dto: CreateBrandRequest, ctx: ShopContextParams): Promise<Brand>;
15
+ updateBrand(id: number, dto: UpdateBrandDto, ctx: ShopContextParams): Promise<Brand>;
16
+ deleteBrand(id: number, ctx: ShopContextParams): Promise<void>;
17
+ importBrandsJson(items: ImportBrandItem[], ctx: ShopContextParams): Promise<ImportResult>;
18
+ importBrandsCsv(csvContent: string, ctx: ShopContextParams): Promise<ImportResult>;
19
+ exportBrandsJson(ctx: ShopContextParams): Promise<BrandExportItem[]>;
20
+ exportBrandsCsv(ctx: ShopContextParams): Promise<string>;
21
+ }
22
+ //# 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,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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
+ }
@@ -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';
@@ -11,77 +12,87 @@ import { UserRolesClient } from './user-roles-client.js';
11
12
  import { ApiKeysClient } from './api-keys-client.js';
12
13
  export declare class SalesPlannerClient {
13
14
  private baseUrl;
14
- private meClient;
15
- private usersClient;
16
- private tenantsClient;
17
- private shopsClient;
18
- private skusClient;
19
- private salesHistoryClient;
20
- private marketplacesClient;
21
- private rolesClient;
22
- private userRolesClient;
23
- private apiKeysClient;
24
- getMe: MeClient['getMe'];
25
- getUsers: UsersClient['getUsers'];
26
- getUser: UsersClient['getUser'];
27
- createUser: UsersClient['createUser'];
28
- deleteUser: UsersClient['deleteUser'];
29
- getTenants: TenantsClient['getTenants'];
30
- getTenant: TenantsClient['getTenant'];
31
- createTenant: TenantsClient['createTenant'];
32
- createTenantWithShopAndUser: TenantsClient['createTenantWithShopAndUser'];
33
- updateTenant: TenantsClient['updateTenant'];
34
- deleteTenant: TenantsClient['deleteTenant'];
35
- getShops: ShopsClient['getShops'];
36
- getShop: ShopsClient['getShop'];
37
- createShop: ShopsClient['createShop'];
38
- updateShop: ShopsClient['updateShop'];
39
- deleteShop: ShopsClient['deleteShop'];
40
- deleteShopData: ShopsClient['deleteShopData'];
41
- getSkus: SkusClient['getSkus'];
42
- getSku: SkusClient['getSku'];
43
- createSku: SkusClient['createSku'];
44
- updateSku: SkusClient['updateSku'];
45
- deleteSku: SkusClient['deleteSku'];
46
- importSkusJson: SkusClient['importSkusJson'];
47
- importSkusCsv: SkusClient['importSkusCsv'];
48
- exportSkusJson: SkusClient['exportSkusJson'];
49
- exportSkusCsv: SkusClient['exportSkusCsv'];
50
- getSkusExampleJson: SkusClient['getSkusExampleJson'];
51
- getSkusExampleCsv: SkusClient['getSkusExampleCsv'];
52
- getSalesHistory: SalesHistoryClient['getSalesHistory'];
53
- getSalesHistoryItem: SalesHistoryClient['getSalesHistoryItem'];
54
- createSalesHistory: SalesHistoryClient['createSalesHistory'];
55
- updateSalesHistory: SalesHistoryClient['updateSalesHistory'];
56
- deleteSalesHistory: SalesHistoryClient['deleteSalesHistory'];
57
- importSalesHistoryJson: SalesHistoryClient['importSalesHistoryJson'];
58
- importSalesHistoryCsv: SalesHistoryClient['importSalesHistoryCsv'];
59
- exportSalesHistoryJson: SalesHistoryClient['exportSalesHistoryJson'];
60
- exportSalesHistoryCsv: SalesHistoryClient['exportSalesHistoryCsv'];
61
- getSalesHistoryExampleJson: SalesHistoryClient['getSalesHistoryExampleJson'];
62
- getSalesHistoryExampleCsv: SalesHistoryClient['getSalesHistoryExampleCsv'];
63
- getMarketplaces: MarketplacesClient['getMarketplaces'];
64
- getMarketplace: MarketplacesClient['getMarketplace'];
65
- createMarketplace: MarketplacesClient['createMarketplace'];
66
- updateMarketplace: MarketplacesClient['updateMarketplace'];
67
- deleteMarketplace: MarketplacesClient['deleteMarketplace'];
68
- importMarketplacesJson: MarketplacesClient['importMarketplacesJson'];
69
- importMarketplacesCsv: MarketplacesClient['importMarketplacesCsv'];
70
- exportMarketplacesJson: MarketplacesClient['exportMarketplacesJson'];
71
- exportMarketplacesCsv: MarketplacesClient['exportMarketplacesCsv'];
72
- getMarketplaceExamplesJson: MarketplacesClient['getMarketplaceExamplesJson'];
73
- getMarketplaceExamplesCsv: MarketplacesClient['getMarketplaceExamplesCsv'];
74
- getRoles: RolesClient['getRoles'];
75
- getRole: RolesClient['getRole'];
76
- createRole: RolesClient['createRole'];
77
- updateRole: RolesClient['updateRole'];
78
- deleteRole: RolesClient['deleteRole'];
79
- createUserRole: UserRolesClient['createUserRole'];
80
- deleteUserRole: UserRolesClient['deleteUserRole'];
81
- getApiKeys: ApiKeysClient['getApiKeys'];
82
- createApiKey: ApiKeysClient['createApiKey'];
83
- deleteApiKey: ApiKeysClient['deleteApiKey'];
15
+ readonly me: MeClient;
16
+ readonly users: UsersClient;
17
+ readonly tenants: TenantsClient;
18
+ readonly shops: ShopsClient;
19
+ readonly skus: SkusClient;
20
+ readonly brands: BrandsClient;
21
+ readonly salesHistory: SalesHistoryClient;
22
+ readonly marketplaces: MarketplacesClient;
23
+ readonly roles: RolesClient;
24
+ readonly userRoles: UserRolesClient;
25
+ readonly apiKeys: ApiKeysClient;
84
26
  constructor(config: ClientConfig);
27
+ getMe: () => Promise<import("@sales-planner/shared").UserWithRolesAndTenants>;
28
+ getUsers: () => Promise<import("@sales-planner/shared").User[]>;
29
+ getUser: (id: number) => Promise<import("@sales-planner/shared").User>;
30
+ createUser: (dto: Parameters<UsersClient["createUser"]>[0]) => Promise<import("@sales-planner/shared").User>;
31
+ deleteUser: (id: number) => Promise<void>;
32
+ getTenants: () => Promise<import("@sales-planner/shared").Tenant[]>;
33
+ getTenant: (id: number) => Promise<import("@sales-planner/shared").Tenant>;
34
+ createTenant: (dto: Parameters<TenantsClient["createTenant"]>[0]) => Promise<import("@sales-planner/shared").Tenant>;
35
+ createTenantWithShopAndUser: (dto: Parameters<TenantsClient["createTenantWithShopAndUser"]>[0]) => Promise<import("@sales-planner/shared").TenantWithShopAndApiKey>;
36
+ updateTenant: (id: number, dto: Parameters<TenantsClient["updateTenant"]>[1]) => Promise<import("@sales-planner/shared").Tenant>;
37
+ deleteTenant: (id: number) => Promise<void>;
38
+ getShops: (tenantId?: number) => Promise<import("@sales-planner/shared").Shop[]>;
39
+ getShop: (id: number) => Promise<import("@sales-planner/shared").Shop>;
40
+ createShop: (dto: Parameters<ShopsClient["createShop"]>[0]) => Promise<import("@sales-planner/shared").Shop>;
41
+ updateShop: (id: number, dto: Parameters<ShopsClient["updateShop"]>[1]) => Promise<import("@sales-planner/shared").Shop>;
42
+ deleteShop: (id: number) => Promise<void>;
43
+ deleteShopData: (id: number) => Promise<import("@sales-planner/shared").DeleteDataResult>;
44
+ getSkus: (ctx: Parameters<SkusClient["getSkus"]>[0]) => Promise<import("@sales-planner/shared").Sku[]>;
45
+ getSku: (id: number, ctx: Parameters<SkusClient["getSku"]>[1]) => Promise<import("@sales-planner/shared").Sku>;
46
+ createSku: (dto: Parameters<SkusClient["createSku"]>[0], ctx: Parameters<SkusClient["createSku"]>[1]) => Promise<import("@sales-planner/shared").Sku>;
47
+ updateSku: (id: number, dto: Parameters<SkusClient["updateSku"]>[1], ctx: Parameters<SkusClient["updateSku"]>[2]) => Promise<import("@sales-planner/shared").Sku>;
48
+ deleteSku: (id: number, ctx: Parameters<SkusClient["deleteSku"]>[1]) => Promise<void>;
49
+ importSkusJson: (items: Parameters<SkusClient["importSkusJson"]>[0], ctx: Parameters<SkusClient["importSkusJson"]>[1]) => Promise<import("@sales-planner/shared").ImportResult>;
50
+ importSkusCsv: (csvContent: Parameters<SkusClient["importSkusCsv"]>[0], ctx: Parameters<SkusClient["importSkusCsv"]>[1]) => Promise<import("@sales-planner/shared").ImportResult>;
51
+ exportSkusJson: (ctx: Parameters<SkusClient["exportSkusJson"]>[0]) => Promise<import("@sales-planner/shared").SkuExportItem[]>;
52
+ exportSkusCsv: (ctx: Parameters<SkusClient["exportSkusCsv"]>[0]) => Promise<string>;
53
+ getSkusExampleJson: () => Promise<import("@sales-planner/shared").ImportSkuItem[]>;
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("./brands-client.js").BrandExportItem[]>;
63
+ exportBrandsCsv: (ctx: Parameters<BrandsClient["exportBrandsCsv"]>[0]) => Promise<string>;
64
+ getSalesHistory: (ctx: Parameters<SalesHistoryClient["getSalesHistory"]>[0], query?: Parameters<SalesHistoryClient["getSalesHistory"]>[1]) => Promise<import("@sales-planner/shared").SalesHistory[]>;
65
+ getSalesHistoryItem: (id: number, ctx: Parameters<SalesHistoryClient["getSalesHistoryItem"]>[1]) => Promise<import("@sales-planner/shared").SalesHistory>;
66
+ createSalesHistory: (dto: Parameters<SalesHistoryClient["createSalesHistory"]>[0], ctx: Parameters<SalesHistoryClient["createSalesHistory"]>[1]) => Promise<import("@sales-planner/shared").SalesHistory>;
67
+ updateSalesHistory: (id: number, dto: Parameters<SalesHistoryClient["updateSalesHistory"]>[1], ctx: Parameters<SalesHistoryClient["updateSalesHistory"]>[2]) => Promise<import("@sales-planner/shared").SalesHistory>;
68
+ deleteSalesHistory: (id: number, ctx: Parameters<SalesHistoryClient["deleteSalesHistory"]>[1]) => Promise<void>;
69
+ importSalesHistoryJson: (items: Parameters<SalesHistoryClient["importSalesHistoryJson"]>[0], ctx: Parameters<SalesHistoryClient["importSalesHistoryJson"]>[1]) => Promise<import("@sales-planner/shared").ImportResult>;
70
+ importSalesHistoryCsv: (csvContent: Parameters<SalesHistoryClient["importSalesHistoryCsv"]>[0], ctx: Parameters<SalesHistoryClient["importSalesHistoryCsv"]>[1]) => Promise<import("@sales-planner/shared").ImportResult>;
71
+ exportSalesHistoryJson: (ctx: Parameters<SalesHistoryClient["exportSalesHistoryJson"]>[0], query?: Parameters<SalesHistoryClient["exportSalesHistoryJson"]>[1]) => Promise<import("@sales-planner/shared").SalesHistoryExportItem[]>;
72
+ exportSalesHistoryCsv: (ctx: Parameters<SalesHistoryClient["exportSalesHistoryCsv"]>[0], query?: Parameters<SalesHistoryClient["exportSalesHistoryCsv"]>[1]) => Promise<string>;
73
+ getSalesHistoryExampleJson: () => Promise<import("@sales-planner/shared").ImportSalesHistoryItem[]>;
74
+ getSalesHistoryExampleCsv: () => Promise<string>;
75
+ getMarketplaces: (ctx: Parameters<MarketplacesClient["getMarketplaces"]>[0]) => Promise<import("@sales-planner/shared").Marketplace[]>;
76
+ getMarketplace: (id: string, ctx: Parameters<MarketplacesClient["getMarketplace"]>[1]) => Promise<import("@sales-planner/shared").Marketplace>;
77
+ createMarketplace: (dto: Parameters<MarketplacesClient["createMarketplace"]>[0], ctx: Parameters<MarketplacesClient["createMarketplace"]>[1]) => Promise<import("@sales-planner/shared").Marketplace>;
78
+ updateMarketplace: (id: string, dto: Parameters<MarketplacesClient["updateMarketplace"]>[1], ctx: Parameters<MarketplacesClient["updateMarketplace"]>[2]) => Promise<import("@sales-planner/shared").Marketplace>;
79
+ deleteMarketplace: (id: string, ctx: Parameters<MarketplacesClient["deleteMarketplace"]>[1]) => Promise<void>;
80
+ importMarketplacesJson: (items: Parameters<MarketplacesClient["importMarketplacesJson"]>[0], ctx: Parameters<MarketplacesClient["importMarketplacesJson"]>[1]) => Promise<import("@sales-planner/shared").ImportResult>;
81
+ importMarketplacesCsv: (csvContent: Parameters<MarketplacesClient["importMarketplacesCsv"]>[0], ctx: Parameters<MarketplacesClient["importMarketplacesCsv"]>[1]) => Promise<import("@sales-planner/shared").ImportResult>;
82
+ exportMarketplacesJson: (ctx: Parameters<MarketplacesClient["exportMarketplacesJson"]>[0]) => Promise<import("@sales-planner/shared").MarketplaceExportItem[]>;
83
+ exportMarketplacesCsv: (ctx: Parameters<MarketplacesClient["exportMarketplacesCsv"]>[0]) => Promise<string>;
84
+ getMarketplaceExamplesJson: () => Promise<import("@sales-planner/shared").ImportMarketplaceItem[]>;
85
+ getMarketplaceExamplesCsv: () => Promise<string>;
86
+ getRoles: () => Promise<import("@sales-planner/shared").Role[]>;
87
+ getRole: (id: number) => Promise<import("@sales-planner/shared").Role>;
88
+ createRole: (dto: Parameters<RolesClient["createRole"]>[0]) => Promise<import("@sales-planner/shared").Role>;
89
+ updateRole: (id: number, dto: Parameters<RolesClient["updateRole"]>[1]) => Promise<import("@sales-planner/shared").Role>;
90
+ deleteRole: (id: number) => Promise<void>;
91
+ createUserRole: (dto: Parameters<UserRolesClient["createUserRole"]>[0]) => Promise<void>;
92
+ deleteUserRole: (id: number) => Promise<void>;
93
+ getApiKeys: (userId?: number) => Promise<import("@sales-planner/shared").ApiKey[]>;
94
+ createApiKey: (dto: Parameters<ApiKeysClient["createApiKey"]>[0]) => Promise<import("@sales-planner/shared").ApiKey>;
95
+ deleteApiKey: (id: number) => Promise<void>;
85
96
  getRoot(): Promise<string>;
86
97
  getHealth(): Promise<{
87
98
  status: string;
@@ -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;IACxB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAA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,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';
@@ -11,151 +12,102 @@ import { UserRolesClient } from './user-roles-client.js';
11
12
  import { ApiKeysClient } from './api-keys-client.js';
12
13
  export class SalesPlannerClient {
13
14
  baseUrl;
14
- meClient;
15
- usersClient;
16
- tenantsClient;
17
- shopsClient;
18
- skusClient;
19
- salesHistoryClient;
20
- marketplacesClient;
21
- rolesClient;
22
- userRolesClient;
23
- apiKeysClient;
24
- // Delegated methods
25
- getMe;
26
- getUsers;
27
- getUser;
28
- createUser;
29
- deleteUser;
30
- getTenants;
31
- getTenant;
32
- createTenant;
33
- createTenantWithShopAndUser;
34
- updateTenant;
35
- deleteTenant;
36
- getShops;
37
- getShop;
38
- createShop;
39
- updateShop;
40
- deleteShop;
41
- deleteShopData;
42
- getSkus;
43
- getSku;
44
- createSku;
45
- updateSku;
46
- deleteSku;
47
- importSkusJson;
48
- importSkusCsv;
49
- exportSkusJson;
50
- exportSkusCsv;
51
- getSkusExampleJson;
52
- getSkusExampleCsv;
53
- getSalesHistory;
54
- getSalesHistoryItem;
55
- createSalesHistory;
56
- updateSalesHistory;
57
- deleteSalesHistory;
58
- importSalesHistoryJson;
59
- importSalesHistoryCsv;
60
- exportSalesHistoryJson;
61
- exportSalesHistoryCsv;
62
- getSalesHistoryExampleJson;
63
- getSalesHistoryExampleCsv;
64
- getMarketplaces;
65
- getMarketplace;
66
- createMarketplace;
67
- updateMarketplace;
68
- deleteMarketplace;
69
- importMarketplacesJson;
70
- importMarketplacesCsv;
71
- exportMarketplacesJson;
72
- exportMarketplacesCsv;
73
- getMarketplaceExamplesJson;
74
- getMarketplaceExamplesCsv;
75
- getRoles;
76
- getRole;
77
- createRole;
78
- updateRole;
79
- deleteRole;
80
- createUserRole;
81
- deleteUserRole;
82
- getApiKeys;
83
- createApiKey;
84
- deleteApiKey;
15
+ // Sub-clients exposed as public properties
16
+ me;
17
+ users;
18
+ tenants;
19
+ shops;
20
+ skus;
21
+ brands;
22
+ salesHistory;
23
+ marketplaces;
24
+ roles;
25
+ userRoles;
26
+ apiKeys;
85
27
  constructor(config) {
86
28
  this.baseUrl = config.baseUrl.replace(/\/$/, '');
87
- this.meClient = new MeClient(config);
88
- this.usersClient = new UsersClient(config);
89
- this.tenantsClient = new TenantsClient(config);
90
- this.shopsClient = new ShopsClient(config);
91
- this.skusClient = new SkusClient(config);
92
- this.salesHistoryClient = new SalesHistoryClient(config);
93
- this.marketplacesClient = new MarketplacesClient(config);
94
- this.rolesClient = new RolesClient(config);
95
- this.userRolesClient = new UserRolesClient(config);
96
- this.apiKeysClient = new ApiKeysClient(config);
97
- // Bind methods after initialization
98
- this.getMe = this.meClient.getMe.bind(this.meClient);
99
- this.getUsers = this.usersClient.getUsers.bind(this.usersClient);
100
- this.getUser = this.usersClient.getUser.bind(this.usersClient);
101
- this.createUser = this.usersClient.createUser.bind(this.usersClient);
102
- this.deleteUser = this.usersClient.deleteUser.bind(this.usersClient);
103
- this.getTenants = this.tenantsClient.getTenants.bind(this.tenantsClient);
104
- this.getTenant = this.tenantsClient.getTenant.bind(this.tenantsClient);
105
- this.createTenant = this.tenantsClient.createTenant.bind(this.tenantsClient);
106
- this.createTenantWithShopAndUser = this.tenantsClient.createTenantWithShopAndUser.bind(this.tenantsClient);
107
- this.updateTenant = this.tenantsClient.updateTenant.bind(this.tenantsClient);
108
- this.deleteTenant = this.tenantsClient.deleteTenant.bind(this.tenantsClient);
109
- this.getShops = this.shopsClient.getShops.bind(this.shopsClient);
110
- this.getShop = this.shopsClient.getShop.bind(this.shopsClient);
111
- this.createShop = this.shopsClient.createShop.bind(this.shopsClient);
112
- this.updateShop = this.shopsClient.updateShop.bind(this.shopsClient);
113
- this.deleteShop = this.shopsClient.deleteShop.bind(this.shopsClient);
114
- this.deleteShopData = this.shopsClient.deleteShopData.bind(this.shopsClient);
115
- this.getSkus = this.skusClient.getSkus.bind(this.skusClient);
116
- this.getSku = this.skusClient.getSku.bind(this.skusClient);
117
- this.createSku = this.skusClient.createSku.bind(this.skusClient);
118
- this.updateSku = this.skusClient.updateSku.bind(this.skusClient);
119
- this.deleteSku = this.skusClient.deleteSku.bind(this.skusClient);
120
- this.importSkusJson = this.skusClient.importSkusJson.bind(this.skusClient);
121
- this.importSkusCsv = this.skusClient.importSkusCsv.bind(this.skusClient);
122
- this.exportSkusJson = this.skusClient.exportSkusJson.bind(this.skusClient);
123
- this.exportSkusCsv = this.skusClient.exportSkusCsv.bind(this.skusClient);
124
- this.getSkusExampleJson = this.skusClient.getSkusExampleJson.bind(this.skusClient);
125
- this.getSkusExampleCsv = this.skusClient.getSkusExampleCsv.bind(this.skusClient);
126
- this.getSalesHistory = this.salesHistoryClient.getSalesHistory.bind(this.salesHistoryClient);
127
- this.getSalesHistoryItem = this.salesHistoryClient.getSalesHistoryItem.bind(this.salesHistoryClient);
128
- this.createSalesHistory = this.salesHistoryClient.createSalesHistory.bind(this.salesHistoryClient);
129
- this.updateSalesHistory = this.salesHistoryClient.updateSalesHistory.bind(this.salesHistoryClient);
130
- this.deleteSalesHistory = this.salesHistoryClient.deleteSalesHistory.bind(this.salesHistoryClient);
131
- this.importSalesHistoryJson = this.salesHistoryClient.importSalesHistoryJson.bind(this.salesHistoryClient);
132
- this.importSalesHistoryCsv = this.salesHistoryClient.importSalesHistoryCsv.bind(this.salesHistoryClient);
133
- this.exportSalesHistoryJson = this.salesHistoryClient.exportSalesHistoryJson.bind(this.salesHistoryClient);
134
- this.exportSalesHistoryCsv = this.salesHistoryClient.exportSalesHistoryCsv.bind(this.salesHistoryClient);
135
- this.getSalesHistoryExampleJson = this.salesHistoryClient.getSalesHistoryExampleJson.bind(this.salesHistoryClient);
136
- this.getSalesHistoryExampleCsv = this.salesHistoryClient.getSalesHistoryExampleCsv.bind(this.salesHistoryClient);
137
- this.getMarketplaces = this.marketplacesClient.getMarketplaces.bind(this.marketplacesClient);
138
- this.getMarketplace = this.marketplacesClient.getMarketplace.bind(this.marketplacesClient);
139
- this.createMarketplace = this.marketplacesClient.createMarketplace.bind(this.marketplacesClient);
140
- this.updateMarketplace = this.marketplacesClient.updateMarketplace.bind(this.marketplacesClient);
141
- this.deleteMarketplace = this.marketplacesClient.deleteMarketplace.bind(this.marketplacesClient);
142
- this.importMarketplacesJson = this.marketplacesClient.importMarketplacesJson.bind(this.marketplacesClient);
143
- this.importMarketplacesCsv = this.marketplacesClient.importMarketplacesCsv.bind(this.marketplacesClient);
144
- this.exportMarketplacesJson = this.marketplacesClient.exportMarketplacesJson.bind(this.marketplacesClient);
145
- this.exportMarketplacesCsv = this.marketplacesClient.exportMarketplacesCsv.bind(this.marketplacesClient);
146
- this.getMarketplaceExamplesJson = this.marketplacesClient.getMarketplaceExamplesJson.bind(this.marketplacesClient);
147
- this.getMarketplaceExamplesCsv = this.marketplacesClient.getMarketplaceExamplesCsv.bind(this.marketplacesClient);
148
- this.getRoles = this.rolesClient.getRoles.bind(this.rolesClient);
149
- this.getRole = this.rolesClient.getRole.bind(this.rolesClient);
150
- this.createRole = this.rolesClient.createRole.bind(this.rolesClient);
151
- this.updateRole = this.rolesClient.updateRole.bind(this.rolesClient);
152
- this.deleteRole = this.rolesClient.deleteRole.bind(this.rolesClient);
153
- this.createUserRole = this.userRolesClient.createUserRole.bind(this.userRolesClient);
154
- this.deleteUserRole = this.userRolesClient.deleteUserRole.bind(this.userRolesClient);
155
- this.getApiKeys = this.apiKeysClient.getApiKeys.bind(this.apiKeysClient);
156
- this.createApiKey = this.apiKeysClient.createApiKey.bind(this.apiKeysClient);
157
- this.deleteApiKey = this.apiKeysClient.deleteApiKey.bind(this.apiKeysClient);
29
+ this.me = new MeClient(config);
30
+ this.users = new UsersClient(config);
31
+ this.tenants = new TenantsClient(config);
32
+ this.shops = new ShopsClient(config);
33
+ this.skus = new SkusClient(config);
34
+ this.brands = new BrandsClient(config);
35
+ this.salesHistory = new SalesHistoryClient(config);
36
+ this.marketplaces = new MarketplacesClient(config);
37
+ this.roles = new RolesClient(config);
38
+ this.userRoles = new UserRolesClient(config);
39
+ this.apiKeys = new ApiKeysClient(config);
158
40
  }
41
+ // Backward compatibility - delegate to sub-clients
42
+ getMe = () => this.me.getMe();
43
+ getUsers = () => this.users.getUsers();
44
+ getUser = (id) => this.users.getUser(id);
45
+ createUser = (dto) => this.users.createUser(dto);
46
+ deleteUser = (id) => this.users.deleteUser(id);
47
+ getTenants = () => this.tenants.getTenants();
48
+ getTenant = (id) => this.tenants.getTenant(id);
49
+ createTenant = (dto) => this.tenants.createTenant(dto);
50
+ createTenantWithShopAndUser = (dto) => this.tenants.createTenantWithShopAndUser(dto);
51
+ updateTenant = (id, dto) => this.tenants.updateTenant(id, dto);
52
+ deleteTenant = (id) => this.tenants.deleteTenant(id);
53
+ getShops = (tenantId) => this.shops.getShops(tenantId);
54
+ getShop = (id) => this.shops.getShop(id);
55
+ createShop = (dto) => this.shops.createShop(dto);
56
+ updateShop = (id, dto) => this.shops.updateShop(id, dto);
57
+ deleteShop = (id) => this.shops.deleteShop(id);
58
+ deleteShopData = (id) => this.shops.deleteShopData(id);
59
+ getSkus = (ctx) => this.skus.getSkus(ctx);
60
+ getSku = (id, ctx) => this.skus.getSku(id, ctx);
61
+ createSku = (dto, ctx) => this.skus.createSku(dto, ctx);
62
+ updateSku = (id, dto, ctx) => this.skus.updateSku(id, dto, ctx);
63
+ deleteSku = (id, ctx) => this.skus.deleteSku(id, ctx);
64
+ importSkusJson = (items, ctx) => this.skus.importSkusJson(items, ctx);
65
+ importSkusCsv = (csvContent, ctx) => this.skus.importSkusCsv(csvContent, ctx);
66
+ exportSkusJson = (ctx) => this.skus.exportSkusJson(ctx);
67
+ exportSkusCsv = (ctx) => this.skus.exportSkusCsv(ctx);
68
+ getSkusExampleJson = () => this.skus.getSkusExampleJson();
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);
79
+ getSalesHistory = (ctx, query) => this.salesHistory.getSalesHistory(ctx, query);
80
+ getSalesHistoryItem = (id, ctx) => this.salesHistory.getSalesHistoryItem(id, ctx);
81
+ createSalesHistory = (dto, ctx) => this.salesHistory.createSalesHistory(dto, ctx);
82
+ updateSalesHistory = (id, dto, ctx) => this.salesHistory.updateSalesHistory(id, dto, ctx);
83
+ deleteSalesHistory = (id, ctx) => this.salesHistory.deleteSalesHistory(id, ctx);
84
+ importSalesHistoryJson = (items, ctx) => this.salesHistory.importSalesHistoryJson(items, ctx);
85
+ importSalesHistoryCsv = (csvContent, ctx) => this.salesHistory.importSalesHistoryCsv(csvContent, ctx);
86
+ exportSalesHistoryJson = (ctx, query) => this.salesHistory.exportSalesHistoryJson(ctx, query);
87
+ exportSalesHistoryCsv = (ctx, query) => this.salesHistory.exportSalesHistoryCsv(ctx, query);
88
+ getSalesHistoryExampleJson = () => this.salesHistory.getSalesHistoryExampleJson();
89
+ getSalesHistoryExampleCsv = () => this.salesHistory.getSalesHistoryExampleCsv();
90
+ getMarketplaces = (ctx) => this.marketplaces.getMarketplaces(ctx);
91
+ getMarketplace = (id, ctx) => this.marketplaces.getMarketplace(id, ctx);
92
+ createMarketplace = (dto, ctx) => this.marketplaces.createMarketplace(dto, ctx);
93
+ updateMarketplace = (id, dto, ctx) => this.marketplaces.updateMarketplace(id, dto, ctx);
94
+ deleteMarketplace = (id, ctx) => this.marketplaces.deleteMarketplace(id, ctx);
95
+ importMarketplacesJson = (items, ctx) => this.marketplaces.importMarketplacesJson(items, ctx);
96
+ importMarketplacesCsv = (csvContent, ctx) => this.marketplaces.importMarketplacesCsv(csvContent, ctx);
97
+ exportMarketplacesJson = (ctx) => this.marketplaces.exportMarketplacesJson(ctx);
98
+ exportMarketplacesCsv = (ctx) => this.marketplaces.exportMarketplacesCsv(ctx);
99
+ getMarketplaceExamplesJson = () => this.marketplaces.getMarketplaceExamplesJson();
100
+ getMarketplaceExamplesCsv = () => this.marketplaces.getMarketplaceExamplesCsv();
101
+ getRoles = () => this.roles.getRoles();
102
+ getRole = (id) => this.roles.getRole(id);
103
+ createRole = (dto) => this.roles.createRole(dto);
104
+ updateRole = (id, dto) => this.roles.updateRole(id, dto);
105
+ deleteRole = (id) => this.roles.deleteRole(id);
106
+ createUserRole = (dto) => this.userRoles.createUserRole(dto);
107
+ deleteUserRole = (id) => this.userRoles.deleteUserRole(id);
108
+ getApiKeys = (userId) => this.apiKeys.getApiKeys(userId);
109
+ createApiKey = (dto) => this.apiKeys.createApiKey(dto);
110
+ deleteApiKey = (id) => this.apiKeys.deleteApiKey(id);
159
111
  // Health & Info (unauthenticated)
160
112
  async getRoot() {
161
113
  const response = await fetch(`${this.baseUrl}/`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sales-planner/http-client",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
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.5.1"
27
+ "@sales-planner/shared": "0.6.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "typescript": "^5.7.3"