@sales-planner/shared 0.8.3 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dto.d.ts CHANGED
@@ -8,133 +8,133 @@
8
8
  * - UpdateXRequest: HTTP update request (typically same as DTO)
9
9
  */
10
10
  export interface CreateUserDto {
11
- email: string;
12
- name: string;
13
- default_shop_id?: number;
11
+ email: string;
12
+ name: string;
13
+ default_shop_id?: number;
14
14
  }
15
15
  export type CreateUserRequest = CreateUserDto;
16
16
  export interface UpdateUserDto {
17
- email?: string;
18
- name?: string;
19
- default_shop_id?: number | null;
17
+ email?: string;
18
+ name?: string;
19
+ default_shop_id?: number | null;
20
20
  }
21
21
  export type UpdateUserRequest = UpdateUserDto;
22
22
  export interface CreateTenantDto {
23
- title: string;
24
- owner_id?: number;
25
- created_by?: number;
23
+ title: string;
24
+ owner_id?: number;
25
+ created_by?: number;
26
26
  }
27
27
  export interface CreateTenantRequest {
28
- title: string;
29
- owner_id?: number;
28
+ title: string;
29
+ owner_id?: number;
30
30
  }
31
31
  export interface UpdateTenantDto {
32
- title?: string;
33
- owner_id?: number | null;
32
+ title?: string;
33
+ owner_id?: number | null;
34
34
  }
35
35
  export type UpdateTenantRequest = UpdateTenantDto;
36
36
  export interface CreateTenantWithShopDto {
37
- tenantTitle: string;
38
- shopTitle?: string;
39
- userEmail: string;
40
- userName: string;
37
+ tenantTitle: string;
38
+ shopTitle?: string;
39
+ userEmail: string;
40
+ userName: string;
41
41
  }
42
42
  export interface CreateShopDto {
43
- title: string;
44
- tenant_id: number;
43
+ title: string;
44
+ tenant_id: number;
45
45
  }
46
46
  export type CreateShopRequest = CreateShopDto;
47
47
  export interface UpdateShopDto {
48
- title?: string;
48
+ title?: string;
49
49
  }
50
50
  export type UpdateShopRequest = UpdateShopDto;
51
51
  export interface CreateSkuRequest {
52
- code: string;
53
- title: string;
52
+ code: string;
53
+ title: string;
54
54
  }
55
55
  export interface CreateSkuDto {
56
- code: string;
57
- title: string;
58
- shop_id: number;
59
- tenant_id: number;
56
+ code: string;
57
+ title: string;
58
+ shop_id: number;
59
+ tenant_id: number;
60
60
  }
61
61
  export interface UpdateSkuDto {
62
- code?: string;
63
- title?: string;
62
+ code?: string;
63
+ title?: string;
64
64
  }
65
65
  export type UpdateSkuRequest = UpdateSkuDto;
66
66
  export interface CreateSalesHistoryRequest {
67
- sku_id: number;
68
- period: string;
69
- quantity: number;
70
- marketplace_id: number;
67
+ sku_id: number;
68
+ period: string;
69
+ quantity: number;
70
+ marketplace_id: number;
71
71
  }
72
72
  export interface CreateSalesHistoryDto {
73
- sku_id: number;
74
- shop_id: number;
75
- tenant_id: number;
76
- period: string;
77
- quantity: number;
78
- marketplace_id: number;
73
+ sku_id: number;
74
+ shop_id: number;
75
+ tenant_id: number;
76
+ period: string;
77
+ quantity: number;
78
+ marketplace_id: number;
79
79
  }
80
80
  export interface UpdateSalesHistoryDto {
81
- quantity?: number;
81
+ quantity?: number;
82
82
  }
83
83
  export type UpdateSalesHistoryRequest = UpdateSalesHistoryDto;
84
84
  export interface CreateMarketplaceRequest {
85
- id: string;
86
- title: string;
85
+ id: string;
86
+ title: string;
87
87
  }
88
88
  export interface CreateMarketplaceDto {
89
- id: string;
90
- title: string;
91
- shop_id: number;
92
- tenant_id: number;
89
+ id: string;
90
+ title: string;
91
+ shop_id: number;
92
+ tenant_id: number;
93
93
  }
94
94
  export interface UpdateMarketplaceDto {
95
- title?: string;
95
+ title?: string;
96
96
  }
97
97
  export type UpdateMarketplaceRequest = UpdateMarketplaceDto;
98
98
  export interface CreateApiKeyDto {
99
- user_id: number;
100
- name?: string;
101
- expires_at?: string;
99
+ user_id: number;
100
+ name?: string;
101
+ expires_at?: string;
102
102
  }
103
103
  export type CreateApiKeyRequest = CreateApiKeyDto;
104
104
  export interface UpdateApiKeyDto {
105
- name?: string | null;
106
- expires_at?: string | null;
105
+ name?: string | null;
106
+ expires_at?: string | null;
107
107
  }
108
108
  export type UpdateApiKeyRequest = UpdateApiKeyDto;
109
109
  export interface CreateRoleDto {
110
- name: string;
111
- description?: string;
110
+ name: string;
111
+ description?: string;
112
112
  }
113
113
  export type CreateRoleRequest = CreateRoleDto;
114
114
  export interface UpdateRoleDto {
115
- name?: string;
116
- description?: string | null;
115
+ name?: string;
116
+ description?: string | null;
117
117
  }
118
118
  export type UpdateRoleRequest = UpdateRoleDto;
119
119
  export interface CreateUserRoleDto {
120
- user_id: number;
121
- role_id: number;
122
- tenant_id?: number;
123
- shop_id?: number;
120
+ user_id: number;
121
+ role_id: number;
122
+ tenant_id?: number;
123
+ shop_id?: number;
124
124
  }
125
125
  export type CreateUserRoleRequest = CreateUserRoleDto;
126
126
  export interface ImportSkuItem {
127
- code: string;
128
- title: string;
127
+ code: string;
128
+ title: string;
129
129
  }
130
130
  export interface ImportSalesHistoryItem {
131
- sku_code: string;
132
- period: string;
133
- quantity: number;
134
- marketplace: string;
131
+ sku_code: string;
132
+ period: string;
133
+ quantity: number;
134
+ marketplace: string;
135
135
  }
136
136
  export interface ImportMarketplaceItem {
137
- id: string;
138
- title: string;
137
+ id: string;
138
+ title: string;
139
139
  }
140
- //# sourceMappingURL=dto.d.ts.map
140
+ //# sourceMappingURL=dto.d.ts.map
@@ -6,76 +6,74 @@
6
6
  * (e.g., SKUs, Brands, Marketplaces)
7
7
  */
8
8
  export interface ShopScopedEntity {
9
- id: number;
10
- code: string;
11
- title: string;
12
- shop_id: number;
13
- tenant_id: number;
14
- created_at: Date;
15
- updated_at: Date;
9
+ id: number;
10
+ code: string;
11
+ title: string;
12
+ shop_id: number;
13
+ tenant_id: number;
14
+ created_at: Date;
15
+ updated_at: Date;
16
16
  }
17
17
  export interface User {
18
- id: number;
19
- email: string;
20
- name: string;
21
- default_shop_id: number | null;
22
- created_at: Date;
23
- updated_at: Date;
18
+ id: number;
19
+ email: string;
20
+ name: string;
21
+ default_shop_id: number | null;
22
+ created_at: Date;
23
+ updated_at: Date;
24
24
  }
25
25
  export interface Tenant {
26
- id: number;
27
- title: string;
28
- owner_id: number | null;
29
- created_by: number;
30
- created_at: Date;
31
- updated_at: Date;
26
+ id: number;
27
+ title: string;
28
+ owner_id: number | null;
29
+ created_by: number;
30
+ created_at: Date;
31
+ updated_at: Date;
32
32
  }
33
33
  export interface Shop {
34
- id: number;
35
- title: string;
36
- tenant_id: number;
37
- created_at: Date;
38
- updated_at: Date;
39
- }
40
- export interface Sku extends ShopScopedEntity {
41
- }
42
- export interface Brand extends ShopScopedEntity {
34
+ id: number;
35
+ title: string;
36
+ tenant_id: number;
37
+ created_at: Date;
38
+ updated_at: Date;
43
39
  }
40
+ export interface Sku extends ShopScopedEntity {}
41
+ export interface Brand extends ShopScopedEntity {}
44
42
  export interface SalesHistory {
45
- id: number;
46
- sku_id: number;
47
- shop_id: number;
48
- tenant_id: number;
49
- period: string;
50
- quantity: number;
51
- marketplace_id: number;
52
- created_at: Date;
53
- updated_at: Date;
43
+ id: number;
44
+ sku_id: number;
45
+ shop_id: number;
46
+ tenant_id: number;
47
+ period: string;
48
+ quantity: number;
49
+ marketplace_id: number;
50
+ created_at: Date;
51
+ updated_at: Date;
54
52
  }
55
53
  export interface Role {
56
- id: number;
57
- name: string;
58
- description: string | null;
59
- created_at: Date;
60
- updated_at: Date;
54
+ id: number;
55
+ name: string;
56
+ description: string | null;
57
+ created_at: Date;
58
+ updated_at: Date;
61
59
  }
62
60
  export interface ApiKey {
63
- id: number;
64
- user_id: number;
65
- key: string;
66
- name: string | null;
67
- expires_at: Date | null;
68
- last_used_at: Date | null;
69
- created_at: Date;
70
- updated_at: Date;
61
+ id: number;
62
+ user_id: number;
63
+ key: string;
64
+ name: string | null;
65
+ expires_at: Date | null;
66
+ last_used_at: Date | null;
67
+ created_at: Date;
68
+ updated_at: Date;
71
69
  }
72
70
  export interface Marketplace {
73
- id: number;
74
- code: string;
75
- title: string;
76
- shop_id: number;
77
- tenant_id: number;
78
- created_at: Date;
79
- updated_at: Date;
71
+ id: number;
72
+ code: string;
73
+ title: string;
74
+ shop_id: number;
75
+ tenant_id: number;
76
+ created_at: Date;
77
+ updated_at: Date;
80
78
  }
81
- //# sourceMappingURL=entities.d.ts.map
79
+ //# sourceMappingURL=entities.d.ts.map
package/dist/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export * from './entities/index.js';
2
2
  export * from './dto/index.js';
3
3
  export * from './responses/index.js';
4
4
  export * from './query.js';
5
+ export * from './metadata.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,qBAAqB,CAAC;AAGpC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,sBAAsB,CAAC;AAGrC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AAGpC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,sBAAsB,CAAC;AAGrC,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -6,3 +6,5 @@ export * from './dto/index.js';
6
6
  export * from './responses/index.js';
7
7
  // Query types
8
8
  export * from './query.js';
9
+ // Metadata
10
+ export * from './metadata.js';
@@ -0,0 +1,21 @@
1
+ export type FieldType = 'string' | 'number' | 'date' | 'period';
2
+ export interface EntityFieldMetadata {
3
+ name: string;
4
+ type: FieldType;
5
+ description: string;
6
+ required: boolean;
7
+ example?: string;
8
+ }
9
+ export interface EntityMetadata {
10
+ name: string;
11
+ description: string;
12
+ fields: EntityFieldMetadata[];
13
+ }
14
+ export interface EntitiesMetadata {
15
+ brands: EntityMetadata;
16
+ marketplaces: EntityMetadata;
17
+ skus: EntityMetadata;
18
+ salesHistory: EntityMetadata;
19
+ }
20
+ export declare const ENTITIES_METADATA: EntitiesMetadata;
21
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,YAAY,EAAE,cAAc,CAAC;IAC7B,IAAI,EAAE,cAAc,CAAC;IACrB,YAAY,EAAE,cAAc,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB,EAAE,gBA+F/B,CAAC"}
@@ -0,0 +1,96 @@
1
+ export const ENTITIES_METADATA = {
2
+ brands: {
3
+ name: 'Brands',
4
+ description: 'Product brands managed by your shop',
5
+ fields: [
6
+ {
7
+ name: 'code',
8
+ type: 'string',
9
+ description: 'Unique brand identifier',
10
+ required: true,
11
+ example: 'apple',
12
+ },
13
+ {
14
+ name: 'title',
15
+ type: 'string',
16
+ description: 'Brand display name',
17
+ required: true,
18
+ example: 'Apple Inc.',
19
+ },
20
+ ],
21
+ },
22
+ marketplaces: {
23
+ name: 'Marketplaces',
24
+ description: 'Sales channels where products are sold',
25
+ fields: [
26
+ {
27
+ name: 'code',
28
+ type: 'string',
29
+ description: 'Unique marketplace identifier',
30
+ required: true,
31
+ example: 'amazon',
32
+ },
33
+ {
34
+ name: 'title',
35
+ type: 'string',
36
+ description: 'Marketplace display name',
37
+ required: true,
38
+ example: 'Amazon',
39
+ },
40
+ ],
41
+ },
42
+ skus: {
43
+ name: 'Products',
44
+ description: 'Product catalog items (SKUs)',
45
+ fields: [
46
+ {
47
+ name: 'code',
48
+ type: 'string',
49
+ description: 'Unique product SKU code',
50
+ required: true,
51
+ example: 'IPHONE-15-PRO',
52
+ },
53
+ {
54
+ name: 'title',
55
+ type: 'string',
56
+ description: 'Product display name',
57
+ required: true,
58
+ example: 'iPhone 15 Pro',
59
+ },
60
+ ],
61
+ },
62
+ salesHistory: {
63
+ name: 'Sales History',
64
+ description: 'Historical sales data by SKU, period, and marketplace',
65
+ fields: [
66
+ {
67
+ name: 'sku_code',
68
+ type: 'string',
69
+ description: 'Product SKU code',
70
+ required: true,
71
+ example: 'IPHONE-15-PRO',
72
+ },
73
+ {
74
+ name: 'period',
75
+ type: 'period',
76
+ description: 'Sales period in YYYY-MM format',
77
+ required: true,
78
+ example: '2024-01',
79
+ },
80
+ {
81
+ name: 'quantity',
82
+ type: 'number',
83
+ description: 'Number of units sold',
84
+ required: true,
85
+ example: '150',
86
+ },
87
+ {
88
+ name: 'marketplace',
89
+ type: 'string',
90
+ description: 'Marketplace code where sales occurred',
91
+ required: true,
92
+ example: 'amazon',
93
+ },
94
+ ],
95
+ },
96
+ };
@@ -3,69 +3,69 @@
3
3
  */
4
4
  import type { Tenant, User } from './entities.js';
5
5
  export interface UserRole {
6
- id: number;
7
- role_name: string;
8
- tenant_id: number | null;
9
- tenant_title: string | null;
10
- shop_id: number | null;
11
- shop_title: string | null;
6
+ id: number;
7
+ role_name: string;
8
+ tenant_id: number | null;
9
+ tenant_title: string | null;
10
+ shop_id: number | null;
11
+ shop_title: string | null;
12
12
  }
13
13
  export interface ShopInfo {
14
- id: number;
15
- title: string;
14
+ id: number;
15
+ title: string;
16
16
  }
17
17
  export interface TenantInfo {
18
- id: number;
19
- title: string;
20
- is_owner: boolean;
21
- shops: ShopInfo[];
18
+ id: number;
19
+ title: string;
20
+ is_owner: boolean;
21
+ shops: ShopInfo[];
22
22
  }
23
23
  export interface UserWithRolesAndTenants extends User {
24
- roles: UserRole[];
25
- tenants: TenantInfo[];
24
+ roles: UserRole[];
25
+ tenants: TenantInfo[];
26
26
  }
27
27
  export interface TenantWithShopAndApiKey {
28
- tenant: Tenant;
29
- shop: {
30
- id: number;
31
- title: string;
32
- tenant_id: number;
33
- };
34
- user: {
35
- id: number;
36
- email: string;
37
- name: string;
38
- };
39
- apiKey: string;
28
+ tenant: Tenant;
29
+ shop: {
30
+ id: number;
31
+ title: string;
32
+ tenant_id: number;
33
+ };
34
+ user: {
35
+ id: number;
36
+ email: string;
37
+ name: string;
38
+ };
39
+ apiKey: string;
40
40
  }
41
41
  export interface ImportResult {
42
- created: number;
43
- updated: number;
44
- skus_created?: number;
45
- marketplaces_created?: number;
46
- errors: string[];
42
+ created: number;
43
+ updated: number;
44
+ skus_created?: number;
45
+ marketplaces_created?: number;
46
+ errors: string[];
47
47
  }
48
48
  export interface DeleteDataResult {
49
- skusDeleted: number;
50
- salesHistoryDeleted: number;
51
- marketplacesDeleted: number;
49
+ skusDeleted: number;
50
+ salesHistoryDeleted: number;
51
+ marketplacesDeleted: number;
52
52
  }
53
53
  export interface SalesHistoryExportItem {
54
- sku_code: string;
55
- period: string;
56
- quantity: number;
57
- marketplace: string;
54
+ sku_code: string;
55
+ period: string;
56
+ quantity: number;
57
+ marketplace: string;
58
58
  }
59
59
  export interface SkuExportItem {
60
- code: string;
61
- title: string;
60
+ code: string;
61
+ title: string;
62
62
  }
63
63
  export interface BrandExportItem {
64
- code: string;
65
- title: string;
64
+ code: string;
65
+ title: string;
66
66
  }
67
67
  export interface MarketplaceExportItem {
68
- code: string;
69
- title: string;
68
+ code: string;
69
+ title: string;
70
70
  }
71
- //# sourceMappingURL=responses.d.ts.map
71
+ //# sourceMappingURL=responses.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sales-planner/shared",
3
- "version": "0.8.3",
3
+ "version": "0.9.2",
4
4
  "description": "Shared types and DTOs for Sales Planner API",
5
5
  "author": "Damir Manapov",
6
6
  "license": "MIT",
@@ -15,7 +15,9 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "types": "./dist/index.d.ts",
18
- "import": "./dist/index.js"
18
+ "import": "./dist/index.js",
19
+ "require": "./dist/index.js",
20
+ "default": "./dist/index.js"
19
21
  }
20
22
  },
21
23
  "files": [