@sales-planner/shared 0.1.0 → 0.2.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,103 +1,109 @@
1
- # @sales-planner/shared
1
+ be for project ot rep package?# @sales-planner/shared
2
2
 
3
- Shared TypeScript types for the Sales Planner platform.
3
+ Shared types and HTTP client for the Sales Planner API.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
+ npm install @sales-planner/shared
9
+ # or
8
10
  pnpm add @sales-planner/shared
9
11
  ```
10
12
 
11
13
  ## Usage
12
14
 
15
+ ### HTTP Client
16
+
13
17
  ```typescript
14
- import type {
15
- User,
16
- Tenant,
17
- Shop,
18
- Sku,
19
- SalesHistory,
20
- CreateUserDto,
21
- CreateTenantDto,
22
- UserWithRolesAndTenants,
23
- } from '@sales-planner/shared';
18
+ import { SalesPlannerClient } from '@sales-planner/shared';
19
+
20
+ const client = new SalesPlannerClient({
21
+ baseUrl: 'https://sales-planner-back.vercel.app',
22
+ apiKey: 'your-api-key'
23
+ });
24
+
25
+ // Get current user
26
+ const me = await client.getMe();
27
+
28
+ // Get shops
29
+ const shops = await client.getShops();
30
+
31
+ // Get SKUs for a shop
32
+ const skus = await client.getSkus({ shop_id: 1, tenant_id: 1 });
33
+
34
+ // Import sales history
35
+ const result = await client.importSalesHistoryJson([
36
+ { sku_code: 'SKU-001', period: '2026-01', quantity: 100 }
37
+ ], { shop_id: 1, tenant_id: 1 });
24
38
  ```
25
39
 
26
- ## Types
27
-
28
- ### Entities
29
-
30
- Core database entities:
31
-
32
- | Type | Description |
33
- |------|-------------|
34
- | `User` | User account |
35
- | `Tenant` | Tenant (organization) |
36
- | `Shop` | Shop within a tenant |
37
- | `Sku` | SKU (product) in a shop |
38
- | `SalesHistory` | Monthly sales data for a SKU |
39
- | `Role` | Role definition (viewer, editor, etc.) |
40
- | `ApiKey` | API key for authentication |
41
- | `Marketplace` | Marketplace reference |
42
-
43
- ### DTOs (Data Transfer Objects)
44
-
45
- Request payloads for creating/updating entities:
46
-
47
- | Type | Description |
48
- |------|-------------|
49
- | `CreateUserDto` | Create a new user |
50
- | `CreateTenantDto` | Create a new tenant |
51
- | `CreateTenantWithShopDto` | Create tenant with shop and API key |
52
- | `CreateShopDto` | Create a new shop |
53
- | `CreateSkuDto` | Create a new SKU |
54
- | `UpdateSkuDto` | Update a SKU |
55
- | `CreateSalesHistoryDto` | Create sales history entry |
56
- | `UpdateSalesHistoryDto` | Update sales history |
57
- | `CreateRoleDto` | Create a new role |
58
- | `CreateApiKeyDto` | Create a new API key |
59
- | `CreateUserRoleDto` | Assign role to user |
60
- | `ImportSkuItem` | SKU item for bulk import |
61
- | `ImportSalesHistoryItem` | Sales history item for bulk import |
62
-
63
- ### Response Types
64
-
65
- API response structures:
66
-
67
- | Type | Description |
68
- |------|-------------|
69
- | `UserWithRolesAndTenants` | User with their roles and tenant access |
70
- | `UserRole` | Role assignment with role details |
71
- | `TenantInfo` | Tenant info with shops |
72
- | `ShopInfo` | Shop info with user's role |
73
- | `TenantWithShopAndApiKey` | Result of tenant creation with shop |
74
- | `ImportResult` | Bulk import result (created/updated counts) |
75
- | `DeleteDataResult` | Data deletion result |
76
- | `SkuExportItem` | SKU export format |
77
- | `SalesHistoryExportItem` | Sales history export format |
78
-
79
- ### Query Types
80
-
81
- Request parameters:
82
-
83
- | Type | Description |
84
- |------|-------------|
85
- | `ShopContextParams` | Shop context (`tenant_id`, `shop_id`) |
86
- | `PeriodQuery` | Period filter (`periodFrom`, `periodTo`) |
87
-
88
- ## Package Structure
40
+ ### Available Methods
41
+
42
+ #### Authentication
43
+ - `getMe()` - Get current user with roles and tenants
44
+
45
+ #### Users
46
+ - `getUsers()`, `getUser(id)`, `createUser(dto)`, `deleteUser(id)`
47
+
48
+ #### Tenants
49
+ - `getTenants()`, `getTenant(id)`, `createTenant(dto)`, `updateTenant(id, dto)`, `deleteTenant(id)`
50
+ - `createTenantWithShopAndUser(dto)` - Create tenant with shop and user in one call
51
+
52
+ #### Shops
53
+ - `getShops(tenantId?)`, `getShop(id)`, `createShop(dto)`, `updateShop(id, dto)`, `deleteShop(id)`
54
+ - `deleteShopData(id)` - Delete all data (SKUs, sales history) for a shop
55
+
56
+ #### SKUs
57
+ - `getSkus(ctx)`, `getSku(id, ctx)`, `createSku(dto, ctx)`, `updateSku(id, dto, ctx)`, `deleteSku(id, ctx)`
58
+ - `importSkusJson(items, ctx)`, `importSkusCsv(csvContent, ctx)`
59
+ - `exportSkusJson(ctx)`, `exportSkusCsv(ctx)`
60
+ - `getSkusExampleJson()`, `getSkusExampleCsv()` - Get import format examples
89
61
 
62
+ #### Sales History
63
+ - `getSalesHistory(ctx, query?)`, `getSalesHistoryItem(id, ctx)`
64
+ - `createSalesHistory(dto, ctx)`, `updateSalesHistory(id, dto, ctx)`, `deleteSalesHistory(id, ctx)`
65
+ - `importSalesHistoryJson(items, ctx)`, `importSalesHistoryCsv(csvContent, ctx)`
66
+ - `exportSalesHistoryJson(ctx, query?)`, `exportSalesHistoryCsv(ctx, query?)`
67
+ - `getSalesHistoryExampleJson()`, `getSalesHistoryExampleCsv()` - Get import format examples
68
+
69
+ #### Roles & User Roles
70
+ - `getRoles()`, `getRole(id)`, `createRole(dto)`, `updateRole(id, dto)`, `deleteRole(id)`
71
+ - `createUserRole(dto)`, `deleteUserRole(id)`
72
+
73
+ #### API Keys
74
+ - `getApiKeys()`, `createApiKey(dto)`, `deleteApiKey(id)`
75
+
76
+ #### Marketplaces
77
+ - `getMarketplaces()`, `getMarketplace(id)`, `createMarketplace(dto)`, `updateMarketplace(id, dto)`, `deleteMarketplace(id)`
78
+
79
+ ### Types
80
+
81
+ All entity types, DTOs, and response types are exported:
82
+
83
+ ```typescript
84
+ import type {
85
+ User, Tenant, Shop, Sku, SalesHistory,
86
+ CreateUserDto, CreateTenantDto, CreateShopDto,
87
+ ShopContextParams, PeriodQuery,
88
+ UserWithRolesAndTenants, ImportResult
89
+ } from '@sales-planner/shared';
90
90
  ```
91
- src/
92
- ├── entities.ts # Core entity types
93
- ├── dto.ts # Data transfer objects
94
- ├── responses.ts # API response types
95
- ├── query.ts # Query parameter types
96
- └── index.ts # Re-exports all types
91
+
92
+ ### Error Handling
93
+
94
+ ```typescript
95
+ import { SalesPlannerClient, ApiError } from '@sales-planner/shared';
96
+
97
+ try {
98
+ const user = await client.getUser(999);
99
+ } catch (error) {
100
+ if (error instanceof ApiError) {
101
+ console.log(error.status); // 404
102
+ console.log(error.message); // "User not found"
103
+ }
104
+ }
97
105
  ```
98
106
 
99
- ## Design Principles
107
+ ## License
100
108
 
101
- - **Types only** - No runtime code, fully tree-shakeable
102
- - **Single source of truth** - Used by both API and client packages
103
- - **ESM** - Native ES modules with `.js` extensions
109
+ MIT
@@ -0,0 +1,77 @@
1
+ import type { ApiKey, Marketplace, Role, SalesHistory, Shop, Sku, Tenant, User } from './entities.js';
2
+ import type { CreateApiKeyDto, CreateMarketplaceDto, CreateRoleDto, CreateSalesHistoryDto, CreateShopDto, CreateSkuDto, CreateTenantDto, CreateTenantWithShopDto, CreateUserDto, CreateUserRoleDto, ImportSalesHistoryItem, ImportSkuItem, UpdateSalesHistoryDto, UpdateSkuDto } from './dto.js';
3
+ import type { DeleteDataResult, ImportResult, SalesHistoryExportItem, SkuExportItem, TenantWithShopAndApiKey, UserWithRolesAndTenants } from './responses.js';
4
+ import type { PeriodQuery, ShopContextParams } from './query.js';
5
+ export interface ClientConfig {
6
+ baseUrl: string;
7
+ apiKey: string;
8
+ }
9
+ export declare class SalesPlannerClient {
10
+ private baseUrl;
11
+ private apiKey;
12
+ constructor(config: ClientConfig);
13
+ private request;
14
+ private requestText;
15
+ private uploadCsv;
16
+ private requestPublic;
17
+ private requestTextPublic;
18
+ getMe(): Promise<UserWithRolesAndTenants>;
19
+ getUsers(): Promise<User[]>;
20
+ getUser(id: number): Promise<User>;
21
+ createUser(dto: CreateUserDto): Promise<User>;
22
+ deleteUser(id: number): Promise<void>;
23
+ getTenants(): Promise<Tenant[]>;
24
+ getTenant(id: number): Promise<Tenant>;
25
+ createTenant(dto: CreateTenantDto): Promise<Tenant>;
26
+ createTenantWithShopAndUser(dto: CreateTenantWithShopDto): Promise<TenantWithShopAndApiKey>;
27
+ updateTenant(id: number, dto: Partial<CreateTenantDto>): Promise<Tenant>;
28
+ deleteTenant(id: number): Promise<void>;
29
+ getShops(tenantId?: number): Promise<Shop[]>;
30
+ getShop(id: number): Promise<Shop>;
31
+ createShop(dto: CreateShopDto): Promise<Shop>;
32
+ updateShop(id: number, dto: Partial<CreateShopDto>): Promise<Shop>;
33
+ deleteShop(id: number): Promise<void>;
34
+ deleteShopData(id: number): Promise<DeleteDataResult>;
35
+ getSkus(ctx: ShopContextParams): Promise<Sku[]>;
36
+ getSku(id: number, ctx: ShopContextParams): Promise<Sku>;
37
+ createSku(dto: Omit<CreateSkuDto, 'shop_id' | 'tenant_id'>, ctx: ShopContextParams): Promise<Sku>;
38
+ updateSku(id: number, dto: UpdateSkuDto, ctx: ShopContextParams): Promise<Sku>;
39
+ deleteSku(id: number, ctx: ShopContextParams): Promise<void>;
40
+ importSkusJson(items: ImportSkuItem[], ctx: ShopContextParams): Promise<ImportResult>;
41
+ importSkusCsv(csvContent: string, ctx: ShopContextParams): Promise<ImportResult>;
42
+ exportSkusJson(ctx: ShopContextParams): Promise<SkuExportItem[]>;
43
+ exportSkusCsv(ctx: ShopContextParams): Promise<string>;
44
+ getSkusExampleJson(): Promise<ImportSkuItem[]>;
45
+ getSkusExampleCsv(): Promise<string>;
46
+ getSalesHistory(ctx: ShopContextParams, query?: PeriodQuery): Promise<SalesHistory[]>;
47
+ getSalesHistoryItem(id: number, ctx: ShopContextParams): Promise<SalesHistory>;
48
+ createSalesHistory(dto: Omit<CreateSalesHistoryDto, 'shop_id' | 'tenant_id'>, ctx: ShopContextParams): Promise<SalesHistory>;
49
+ updateSalesHistory(id: number, dto: UpdateSalesHistoryDto, ctx: ShopContextParams): Promise<SalesHistory>;
50
+ deleteSalesHistory(id: number, ctx: ShopContextParams): Promise<void>;
51
+ importSalesHistoryJson(items: ImportSalesHistoryItem[], ctx: ShopContextParams): Promise<ImportResult>;
52
+ importSalesHistoryCsv(csvContent: string, ctx: ShopContextParams): Promise<ImportResult>;
53
+ exportSalesHistoryJson(ctx: ShopContextParams, query?: PeriodQuery): Promise<SalesHistoryExportItem[]>;
54
+ exportSalesHistoryCsv(ctx: ShopContextParams, query?: PeriodQuery): Promise<string>;
55
+ getSalesHistoryExampleJson(): Promise<ImportSalesHistoryItem[]>;
56
+ getSalesHistoryExampleCsv(): Promise<string>;
57
+ getRoles(): Promise<Role[]>;
58
+ getRole(id: number): Promise<Role>;
59
+ createRole(dto: CreateRoleDto): Promise<Role>;
60
+ updateRole(id: number, dto: Partial<CreateRoleDto>): Promise<Role>;
61
+ deleteRole(id: number): Promise<void>;
62
+ createUserRole(dto: CreateUserRoleDto): Promise<void>;
63
+ deleteUserRole(id: number): Promise<void>;
64
+ getApiKeys(): Promise<ApiKey[]>;
65
+ createApiKey(dto: CreateApiKeyDto): Promise<ApiKey>;
66
+ deleteApiKey(id: number): Promise<void>;
67
+ getMarketplaces(): Promise<Marketplace[]>;
68
+ getMarketplace(id: string): Promise<Marketplace>;
69
+ createMarketplace(dto: CreateMarketplaceDto): Promise<Marketplace>;
70
+ updateMarketplace(id: string, dto: Partial<CreateMarketplaceDto>): Promise<Marketplace>;
71
+ deleteMarketplace(id: string): Promise<void>;
72
+ }
73
+ export declare class ApiError extends Error {
74
+ status: number;
75
+ constructor(status: number, message: string);
76
+ }
77
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,GAAG,EACH,MAAM,EACN,IAAI,EACL,MAAM,eAAe,CAAC;AACvB,OAAO,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,CAAC,IAAI,CAAC;CAGnD;AAED,qBAAa,QAAS,SAAQ,KAAK;IAExB,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAKlB"}
package/dist/client.js ADDED
@@ -0,0 +1,301 @@
1
+ export class SalesPlannerClient {
2
+ baseUrl;
3
+ apiKey;
4
+ constructor(config) {
5
+ this.baseUrl = config.baseUrl.replace(/\/$/, '');
6
+ this.apiKey = config.apiKey;
7
+ }
8
+ async request(method, path, options) {
9
+ const url = new URL(this.baseUrl + path);
10
+ if (options?.params) {
11
+ for (const [key, value] of Object.entries(options.params)) {
12
+ if (value !== undefined) {
13
+ url.searchParams.set(key, String(value));
14
+ }
15
+ }
16
+ }
17
+ const response = await fetch(url.toString(), {
18
+ method,
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ 'X-API-Key': this.apiKey,
22
+ },
23
+ body: options?.body ? JSON.stringify(options.body) : undefined,
24
+ });
25
+ if (!response.ok) {
26
+ const error = await response.json().catch(() => ({ message: response.statusText }));
27
+ throw new ApiError(response.status, error.message || 'Request failed');
28
+ }
29
+ if (response.status === 204) {
30
+ return undefined;
31
+ }
32
+ return response.json();
33
+ }
34
+ async requestText(method, path, options) {
35
+ const url = new URL(this.baseUrl + path);
36
+ if (options?.params) {
37
+ for (const [key, value] of Object.entries(options.params)) {
38
+ if (value !== undefined) {
39
+ url.searchParams.set(key, String(value));
40
+ }
41
+ }
42
+ }
43
+ const response = await fetch(url.toString(), {
44
+ method,
45
+ headers: {
46
+ 'X-API-Key': this.apiKey,
47
+ },
48
+ });
49
+ if (!response.ok) {
50
+ const error = await response.json().catch(() => ({ message: response.statusText }));
51
+ throw new ApiError(response.status, error.message || 'Request failed');
52
+ }
53
+ return response.text();
54
+ }
55
+ async uploadCsv(path, csvContent, params) {
56
+ const url = new URL(this.baseUrl + path);
57
+ for (const [key, value] of Object.entries(params)) {
58
+ if (value !== undefined) {
59
+ url.searchParams.set(key, String(value));
60
+ }
61
+ }
62
+ const formData = new FormData();
63
+ const blob = new Blob([csvContent], { type: 'text/csv' });
64
+ formData.append('file', blob, 'upload.csv');
65
+ const response = await fetch(url.toString(), {
66
+ method: 'POST',
67
+ headers: {
68
+ 'X-API-Key': this.apiKey,
69
+ },
70
+ body: formData,
71
+ });
72
+ if (!response.ok) {
73
+ const error = await response.json().catch(() => ({ message: response.statusText }));
74
+ throw new ApiError(response.status, error.message || 'Request failed');
75
+ }
76
+ return response.json();
77
+ }
78
+ async requestPublic(method, path) {
79
+ const url = new URL(this.baseUrl + path);
80
+ const response = await fetch(url.toString(), {
81
+ method,
82
+ headers: {
83
+ 'Content-Type': 'application/json',
84
+ },
85
+ });
86
+ if (!response.ok) {
87
+ const error = await response.json().catch(() => ({ message: response.statusText }));
88
+ throw new ApiError(response.status, error.message || 'Request failed');
89
+ }
90
+ return response.json();
91
+ }
92
+ async requestTextPublic(method, path) {
93
+ const url = new URL(this.baseUrl + path);
94
+ const response = await fetch(url.toString(), { method });
95
+ if (!response.ok) {
96
+ const error = await response.json().catch(() => ({ message: response.statusText }));
97
+ throw new ApiError(response.status, error.message || 'Request failed');
98
+ }
99
+ return response.text();
100
+ }
101
+ // ============================================================
102
+ // Me
103
+ // ============================================================
104
+ async getMe() {
105
+ return this.request('GET', '/me');
106
+ }
107
+ // ============================================================
108
+ // Users
109
+ // ============================================================
110
+ async getUsers() {
111
+ return this.request('GET', '/users');
112
+ }
113
+ async getUser(id) {
114
+ return this.request('GET', `/users/${id}`);
115
+ }
116
+ async createUser(dto) {
117
+ return this.request('POST', '/users', { body: dto });
118
+ }
119
+ async deleteUser(id) {
120
+ return this.request('DELETE', `/users/${id}`);
121
+ }
122
+ // ============================================================
123
+ // Tenants
124
+ // ============================================================
125
+ async getTenants() {
126
+ return this.request('GET', '/tenants');
127
+ }
128
+ async getTenant(id) {
129
+ return this.request('GET', `/tenants/${id}`);
130
+ }
131
+ async createTenant(dto) {
132
+ return this.request('POST', '/tenants', { body: dto });
133
+ }
134
+ async createTenantWithShopAndUser(dto) {
135
+ return this.request('POST', '/tenants/with-shop-and-user', { body: dto });
136
+ }
137
+ async updateTenant(id, dto) {
138
+ return this.request('PUT', `/tenants/${id}`, { body: dto });
139
+ }
140
+ async deleteTenant(id) {
141
+ return this.request('DELETE', `/tenants/${id}`);
142
+ }
143
+ // ============================================================
144
+ // Shops
145
+ // ============================================================
146
+ async getShops(tenantId) {
147
+ return this.request('GET', '/shops', { params: { tenantId } });
148
+ }
149
+ async getShop(id) {
150
+ return this.request('GET', `/shops/${id}`);
151
+ }
152
+ async createShop(dto) {
153
+ return this.request('POST', '/shops', { body: dto });
154
+ }
155
+ async updateShop(id, dto) {
156
+ return this.request('PUT', `/shops/${id}`, { body: dto });
157
+ }
158
+ async deleteShop(id) {
159
+ return this.request('DELETE', `/shops/${id}`);
160
+ }
161
+ async deleteShopData(id) {
162
+ return this.request('DELETE', `/shops/${id}/data`);
163
+ }
164
+ // ============================================================
165
+ // SKUs
166
+ // ============================================================
167
+ async getSkus(ctx) {
168
+ return this.request('GET', '/skus', { params: ctx });
169
+ }
170
+ async getSku(id, ctx) {
171
+ return this.request('GET', `/skus/${id}`, { params: ctx });
172
+ }
173
+ async createSku(dto, ctx) {
174
+ return this.request('POST', '/skus', { body: dto, params: ctx });
175
+ }
176
+ async updateSku(id, dto, ctx) {
177
+ return this.request('PUT', `/skus/${id}`, { body: dto, params: ctx });
178
+ }
179
+ async deleteSku(id, ctx) {
180
+ return this.request('DELETE', `/skus/${id}`, { params: ctx });
181
+ }
182
+ async importSkusJson(items, ctx) {
183
+ return this.request('POST', '/skus/import/json', { body: items, params: ctx });
184
+ }
185
+ async importSkusCsv(csvContent, ctx) {
186
+ return this.uploadCsv('/skus/import/csv', csvContent, ctx);
187
+ }
188
+ async exportSkusJson(ctx) {
189
+ return this.request('GET', '/skus/export/json', { params: ctx });
190
+ }
191
+ async exportSkusCsv(ctx) {
192
+ return this.requestText('GET', '/skus/export/csv', { params: ctx });
193
+ }
194
+ async getSkusExampleJson() {
195
+ return this.requestPublic('GET', '/skus/examples/json');
196
+ }
197
+ async getSkusExampleCsv() {
198
+ return this.requestTextPublic('GET', '/skus/examples/csv');
199
+ }
200
+ // ============================================================
201
+ // Sales History
202
+ // ============================================================
203
+ async getSalesHistory(ctx, query) {
204
+ return this.request('GET', '/sales-history', { params: { ...ctx, ...query } });
205
+ }
206
+ async getSalesHistoryItem(id, ctx) {
207
+ return this.request('GET', `/sales-history/${id}`, { params: ctx });
208
+ }
209
+ async createSalesHistory(dto, ctx) {
210
+ return this.request('POST', '/sales-history', { body: dto, params: ctx });
211
+ }
212
+ async updateSalesHistory(id, dto, ctx) {
213
+ return this.request('PUT', `/sales-history/${id}`, { body: dto, params: ctx });
214
+ }
215
+ async deleteSalesHistory(id, ctx) {
216
+ return this.request('DELETE', `/sales-history/${id}`, { params: ctx });
217
+ }
218
+ async importSalesHistoryJson(items, ctx) {
219
+ return this.request('POST', '/sales-history/import/json', { body: items, params: ctx });
220
+ }
221
+ async importSalesHistoryCsv(csvContent, ctx) {
222
+ return this.uploadCsv('/sales-history/import/csv', csvContent, ctx);
223
+ }
224
+ async exportSalesHistoryJson(ctx, query) {
225
+ return this.request('GET', '/sales-history/export/json', { params: { ...ctx, ...query } });
226
+ }
227
+ async exportSalesHistoryCsv(ctx, query) {
228
+ return this.requestText('GET', '/sales-history/export/csv', { params: { ...ctx, ...query } });
229
+ }
230
+ async getSalesHistoryExampleJson() {
231
+ return this.requestPublic('GET', '/sales-history/examples/json');
232
+ }
233
+ async getSalesHistoryExampleCsv() {
234
+ return this.requestTextPublic('GET', '/sales-history/examples/csv');
235
+ }
236
+ // ============================================================
237
+ // Roles
238
+ // ============================================================
239
+ async getRoles() {
240
+ return this.request('GET', '/roles');
241
+ }
242
+ async getRole(id) {
243
+ return this.request('GET', `/roles/${id}`);
244
+ }
245
+ async createRole(dto) {
246
+ return this.request('POST', '/roles', { body: dto });
247
+ }
248
+ async updateRole(id, dto) {
249
+ return this.request('PUT', `/roles/${id}`, { body: dto });
250
+ }
251
+ async deleteRole(id) {
252
+ return this.request('DELETE', `/roles/${id}`);
253
+ }
254
+ // ============================================================
255
+ // User Roles
256
+ // ============================================================
257
+ async createUserRole(dto) {
258
+ return this.request('POST', '/user-roles', { body: dto });
259
+ }
260
+ async deleteUserRole(id) {
261
+ return this.request('DELETE', `/user-roles/${id}`);
262
+ }
263
+ // ============================================================
264
+ // API Keys
265
+ // ============================================================
266
+ async getApiKeys() {
267
+ return this.request('GET', '/api-keys');
268
+ }
269
+ async createApiKey(dto) {
270
+ return this.request('POST', '/api-keys', { body: dto });
271
+ }
272
+ async deleteApiKey(id) {
273
+ return this.request('DELETE', `/api-keys/${id}`);
274
+ }
275
+ // ============================================================
276
+ // Marketplaces
277
+ // ============================================================
278
+ async getMarketplaces() {
279
+ return this.request('GET', '/marketplaces');
280
+ }
281
+ async getMarketplace(id) {
282
+ return this.request('GET', `/marketplaces/${id}`);
283
+ }
284
+ async createMarketplace(dto) {
285
+ return this.request('POST', '/marketplaces', { body: dto });
286
+ }
287
+ async updateMarketplace(id, dto) {
288
+ return this.request('PUT', `/marketplaces/${id}`, { body: dto });
289
+ }
290
+ async deleteMarketplace(id) {
291
+ return this.request('DELETE', `/marketplaces/${id}`);
292
+ }
293
+ }
294
+ export class ApiError extends Error {
295
+ status;
296
+ constructor(status, message) {
297
+ super(message);
298
+ this.status = status;
299
+ this.name = 'ApiError';
300
+ }
301
+ }
package/dist/dto.d.ts CHANGED
@@ -65,4 +65,8 @@ export interface CreateUserRoleDto {
65
65
  tenant_id?: number;
66
66
  shop_id?: number;
67
67
  }
68
+ export interface CreateMarketplaceDto {
69
+ id: string;
70
+ title: string;
71
+ }
68
72
  //# sourceMappingURL=dto.d.ts.map
package/dist/dto.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../src/dto.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAA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AC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -38,7 +38,7 @@ export interface SalesHistory {
38
38
  sku_id: number;
39
39
  shop_id: number;
40
40
  tenant_id: number;
41
- period: string;
41
+ period: Date;
42
42
  quantity: number;
43
43
  created_at: Date;
44
44
  updated_at: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI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,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB"}
package/dist/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export * from './entities.js';
2
2
  export * from './dto.js';
3
3
  export * from './responses.js';
4
4
  export * from './query.js';
5
+ export { SalesPlannerClient, ApiError, type ClientConfig } from './client.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAG9B,cAAc,UAAU,CAAC;AAGzB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAG9B,cAAc,UAAU,CAAC;AAGzB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -6,3 +6,5 @@ export * from './dto.js';
6
6
  export * from './responses.js';
7
7
  // Query types
8
8
  export * from './query.js';
9
+ // Client
10
+ export { SalesPlannerClient, ApiError } from './client.js';
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@sales-planner/shared",
3
- "version": "0.1.0",
4
- "description": "Shared types and DTOs for Sales Planner API",
3
+ "version": "0.2.0",
4
+ "description": "Shared types and HTTP client for Sales Planner API",
5
5
  "author": "Damir Manapov",
6
6
  "license": "MIT",
7
+ "keywords": [
8
+ "sales-planner",
9
+ "api-client",
10
+ "typescript"
11
+ ],
7
12
  "type": "module",
8
13
  "main": "./dist/index.js",
9
14
  "types": "./dist/index.d.ts",
@@ -17,13 +22,10 @@
17
22
  "dist",
18
23
  "README.md"
19
24
  ],
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
25
  "scripts": {
24
26
  "build": "tsc",
25
27
  "typecheck": "tsc --noEmit",
26
- "prepublishOnly": "pnpm run build"
28
+ "lint": "biome lint ."
27
29
  },
28
30
  "devDependencies": {
29
31
  "typescript": "^5.7.3"