hvp-shared 6.23.0 → 6.25.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.
@@ -4,5 +4,6 @@
4
4
  */
5
5
  export * from './collaborator';
6
6
  export * from './catalog-item';
7
- export * from './inventory-analysis';
7
+ export * from './order-planning';
8
8
  export * from './qvet';
9
+ export * from './stock-calculation';
@@ -20,5 +20,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  __exportStar(require("./collaborator"), exports);
22
22
  __exportStar(require("./catalog-item"), exports);
23
- __exportStar(require("./inventory-analysis"), exports);
23
+ __exportStar(require("./order-planning"), exports);
24
24
  __exportStar(require("./qvet"), exports);
25
+ __exportStar(require("./stock-calculation"), exports);
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Order Planning API Contracts
3
+ *
4
+ * Request and response types for order planning and inventory optimization.
5
+ */
6
+ export * from './requests';
7
+ export * from './responses';
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /**
3
- * Inventory Analysis API Contracts
3
+ * Order Planning API Contracts
4
4
  *
5
- * Request and response types for inventory analysis and order optimization.
5
+ * Request and response types for order planning and inventory optimization.
6
6
  */
7
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
8
  if (k2 === undefined) k2 = k;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Inventory Analysis Request Types
2
+ * Order Planning Request Types
3
3
  *
4
- * Request DTOs for inventory analysis and order optimization endpoints.
4
+ * Request DTOs for order planning and inventory optimization endpoints.
5
5
  */
6
6
  /**
7
7
  * Request to refresh inventory data from QVET
@@ -9,22 +9,30 @@
9
9
  * Triggers batch sync for Purchase Orders and Transfers reports.
10
10
  * If dates not provided, syncs from last sync date to today.
11
11
  *
12
- * @example POST /api/inventory/refresh-data
12
+ * @example POST /api/inventory/order-planning/refresh-data
13
13
  */
14
- export interface RefreshInventoryDataRequest {
14
+ export interface RefreshOrderPlanningDataRequest {
15
15
  /** Start date for sync (ISO 8601). If omitted, uses last sync date */
16
16
  fromDate?: string;
17
17
  /** End date for sync (ISO 8601). If omitted, defaults to today */
18
18
  toDate?: string;
19
19
  }
20
20
  /**
21
- * Request to run inventory analysis
21
+ * Request to run order planning analysis
22
22
  *
23
- * @example POST /api/inventory/analyze
23
+ * @example POST /api/inventory/order-planning/analyze
24
24
  */
25
- export interface RunInventoryAnalysisRequest {
25
+ export interface RunOrderPlanningRequest {
26
26
  /** Filter by specific warehouses. If omitted, analyzes all warehouses */
27
27
  warehouses?: string[];
28
28
  /** Include items with status OK in the response. Default: false */
29
29
  includeOkItems?: boolean;
30
30
  }
31
+ /**
32
+ * @deprecated Use RefreshOrderPlanningDataRequest instead
33
+ */
34
+ export type RefreshInventoryDataRequest = RefreshOrderPlanningDataRequest;
35
+ /**
36
+ * @deprecated Use RunOrderPlanningRequest instead
37
+ */
38
+ export type RunInventoryAnalysisRequest = RunOrderPlanningRequest;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Order Planning Request Types
4
+ *
5
+ * Request DTOs for order planning and inventory optimization endpoints.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +1,17 @@
1
1
  /**
2
- * Inventory Analysis Response Types
2
+ * Order Planning Response Types
3
3
  *
4
- * Response DTOs for inventory analysis and order optimization endpoints.
4
+ * Response DTOs for order planning and inventory optimization endpoints.
5
5
  */
6
6
  /**
7
- * Response after triggering inventory data refresh
7
+ * Response after triggering order planning data refresh
8
8
  *
9
9
  * Returns a job ID that can be polled for progress.
10
- * Backend wraps with: ApiSingleSuccessResponse<RefreshInventoryDataResponse>
10
+ * Backend wraps with: ApiSingleSuccessResponse<RefreshOrderPlanningDataResponse>
11
11
  *
12
- * @example POST /api/inventory/refresh-data
12
+ * @example POST /api/inventory/order-planning/refresh-data
13
13
  */
14
- export interface RefreshInventoryDataResponse {
14
+ export interface RefreshOrderPlanningDataResponse {
15
15
  /** Background job ID for polling progress */
16
16
  jobId: string;
17
17
  /** Human-readable message */
@@ -23,12 +23,12 @@ export interface RefreshInventoryDataResponse {
23
23
  };
24
24
  }
25
25
  /**
26
- * Last sync status for inventory data
27
- * Backend wraps with: ApiSingleSuccessResponse<InventorySyncStatusResponse>
26
+ * Last sync status for order planning data
27
+ * Backend wraps with: ApiSingleSuccessResponse<OrderPlanningSyncStatusResponse>
28
28
  *
29
- * @example GET /api/inventory/sync-status
29
+ * @example GET /api/inventory/order-planning/sync-status
30
30
  */
31
- export interface InventorySyncStatusResponse {
31
+ export interface OrderPlanningSyncStatusResponse {
32
32
  /** Last sync date for Purchase Orders report */
33
33
  purchaseOrdersLastSync?: string;
34
34
  /** Last sync date for Transfers report */
@@ -143,14 +143,14 @@ export interface PurchaseInstruction {
143
143
  relatedPendingTransfers?: number[];
144
144
  }
145
145
  /**
146
- * Complete inventory analysis response
146
+ * Complete order planning analysis response
147
147
  *
148
148
  * Contains all analyzed items, suggested transfers, and purchase instructions.
149
- * Backend wraps with: ApiSingleSuccessResponse<InventoryAnalysisResponse>
149
+ * Backend wraps with: ApiSingleSuccessResponse<OrderPlanningResponse>
150
150
  *
151
- * @example POST /api/inventory/analyze
151
+ * @example POST /api/inventory/order-planning/analyze
152
152
  */
153
- export interface InventoryAnalysisResponse {
153
+ export interface OrderPlanningResponse {
154
154
  /** Analysis timestamp */
155
155
  analyzedAt: string;
156
156
  /** Warehouses included in analysis */
@@ -205,7 +205,7 @@ export interface PendingPurchaseOrder {
205
205
  * Response for pending orders list
206
206
  * Backend wraps with: ApiSingleSuccessResponse<PendingPurchaseOrdersResponse>
207
207
  *
208
- * @example GET /api/qvet/purchase-orders/pending
208
+ * @example GET /api/inventory/order-planning/pending-orders
209
209
  */
210
210
  export interface PendingPurchaseOrdersResponse {
211
211
  /** List of pending orders */
@@ -218,3 +218,15 @@ export interface PendingPurchaseOrdersResponse {
218
218
  staleOrders: number;
219
219
  };
220
220
  }
221
+ /**
222
+ * @deprecated Use RefreshOrderPlanningDataResponse instead
223
+ */
224
+ export type RefreshInventoryDataResponse = RefreshOrderPlanningDataResponse;
225
+ /**
226
+ * @deprecated Use OrderPlanningSyncStatusResponse instead
227
+ */
228
+ export type InventorySyncStatusResponse = OrderPlanningSyncStatusResponse;
229
+ /**
230
+ * @deprecated Use OrderPlanningResponse instead
231
+ */
232
+ export type InventoryAnalysisResponse = OrderPlanningResponse;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Order Planning Response Types
4
+ *
5
+ * Response DTOs for order planning and inventory optimization endpoints.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Stock Calculation API Contracts
3
+ *
4
+ * Types, request and response definitions for stock calculation endpoints.
5
+ */
6
+ export * from './types';
7
+ export * from './requests';
8
+ export * from './responses';
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  /**
3
- * Inventory Analysis Module
3
+ * Stock Calculation API Contracts
4
4
  *
5
- * API contracts for inventory analysis endpoints.
6
- * Calculation logic lives in hvp-backend domain layer.
5
+ * Types, request and response definitions for stock calculation endpoints.
7
6
  */
8
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
8
  if (k2 === undefined) k2 = k;
@@ -21,3 +20,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
20
  };
22
21
  Object.defineProperty(exports, "__esModule", { value: true });
23
22
  __exportStar(require("./types"), exports);
23
+ __exportStar(require("./requests"), exports);
24
+ __exportStar(require("./responses"), exports);
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Stock Calculation Request Types
3
+ *
4
+ * Request DTOs for stock calculation endpoints.
5
+ */
6
+ /**
7
+ * Request for stock proposal calculation
8
+ *
9
+ * @example POST /api/inventory/stock-calculation/proposal
10
+ */
11
+ export interface StockProposalRequest {
12
+ /** Start date for consumption analysis (ISO 8601) */
13
+ fromDate: string;
14
+ /** End date for consumption analysis (ISO 8601) */
15
+ toDate: string;
16
+ /** Start date for recent period (e.g., Q4 start) - ISO 8601 */
17
+ recentPeriodStart?: string;
18
+ /** Filter by branch */
19
+ branch?: string;
20
+ /** Filter by section */
21
+ section?: string;
22
+ /** Filter by specific product codes */
23
+ qvetCodes?: number[];
24
+ /** Output format */
25
+ format?: 'json' | 'excel';
26
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Stock Calculation Request Types
4
+ *
5
+ * Request DTOs for stock calculation endpoints.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Stock Calculation Response Types
3
+ *
4
+ * Response DTOs for stock calculation endpoints.
5
+ */
6
+ import { UsageType } from '../../constants/catalog-item.constants';
7
+ import { TrendType } from './types';
8
+ /**
9
+ * Response for stock proposal calculation
10
+ *
11
+ * Backend wraps with: ApiSingleSuccessResponse<StockProposalResponse>
12
+ *
13
+ * @example POST /api/inventory/stock-calculation/proposal
14
+ */
15
+ export interface StockProposalResponse {
16
+ /** Metadata about the calculation */
17
+ metadata: {
18
+ /** Analysis date range */
19
+ dateRange: {
20
+ from: string;
21
+ to: string;
22
+ };
23
+ /** Recent period date range */
24
+ recentPeriod: {
25
+ from: string;
26
+ to: string;
27
+ };
28
+ /** Total products analyzed */
29
+ totalProducts: number;
30
+ /** Timestamp of calculation */
31
+ calculatedAt: string;
32
+ };
33
+ /** Product analysis results */
34
+ products: ProductAnalysisResponse[];
35
+ /** Summary statistics */
36
+ summary: {
37
+ /** Count by trend type */
38
+ byTrend: Record<TrendType, number>;
39
+ /** Count by usage type */
40
+ byUsageType: Record<UsageType, number>;
41
+ };
42
+ }
43
+ /**
44
+ * Product analysis for API response (flattened)
45
+ */
46
+ export interface ProductAnalysisResponse {
47
+ qvetCode: number;
48
+ description: string;
49
+ section: string;
50
+ usageType: UsageType;
51
+ dailyConsumption: number;
52
+ dailyConsumptionRecent: number;
53
+ monthlyConsumption: number;
54
+ qyRatio: number;
55
+ trend: TrendType;
56
+ referenceConsumption: number;
57
+ currentStock: {
58
+ warehouse: string;
59
+ stock: number;
60
+ }[];
61
+ totalStock: number;
62
+ minStock: number;
63
+ optimalStock: number;
64
+ minDays: number;
65
+ optimalDays: number;
66
+ roundingIncrement: number;
67
+ unitCost: number;
68
+ proposedMinValue: number;
69
+ proposedOptValue: number;
70
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Stock Calculation Response Types
4
+ *
5
+ * Response DTOs for stock calculation endpoints.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Inventory Analysis Types
2
+ * Stock Calculation Types
3
3
  *
4
- * Type definitions for inventory analysis calculations.
5
- * Used by StockProposalService, ConsumptionAnalysisService, etc.
4
+ * Domain types for stock calculation (min/max/optimal).
5
+ * Used by StockCalculationService, ConsumptionAnalysisService, etc.
6
6
  */
7
- import { UsageType } from '../constants/catalog-item.constants';
7
+ import { UsageType } from '../../constants/catalog-item.constants';
8
8
  /**
9
9
  * TrendType - Classification of consumption trend
10
10
  *
@@ -88,84 +88,6 @@ export interface ProductAnalysis {
88
88
  /** Stock proposal */
89
89
  proposal: StockProposal;
90
90
  }
91
- /**
92
- * Request for stock proposal calculation
93
- */
94
- export interface StockProposalRequest {
95
- /** Start date for consumption analysis (ISO 8601) */
96
- fromDate: string;
97
- /** End date for consumption analysis (ISO 8601) */
98
- toDate: string;
99
- /** Start date for recent period (e.g., Q4 start) - ISO 8601 */
100
- recentPeriodStart?: string;
101
- /** Filter by branch */
102
- branch?: string;
103
- /** Filter by section */
104
- section?: string;
105
- /** Filter by specific product codes */
106
- qvetCodes?: number[];
107
- /** Output format */
108
- format?: 'json' | 'excel';
109
- }
110
- /**
111
- * Response for stock proposal calculation
112
- */
113
- export interface StockProposalResponse {
114
- /** Metadata about the calculation */
115
- metadata: {
116
- /** Analysis date range */
117
- dateRange: {
118
- from: string;
119
- to: string;
120
- };
121
- /** Recent period date range */
122
- recentPeriod: {
123
- from: string;
124
- to: string;
125
- };
126
- /** Total products analyzed */
127
- totalProducts: number;
128
- /** Timestamp of calculation */
129
- calculatedAt: string;
130
- };
131
- /** Product analysis results */
132
- products: ProductAnalysisResponse[];
133
- /** Summary statistics */
134
- summary: {
135
- /** Count by trend type */
136
- byTrend: Record<TrendType, number>;
137
- /** Count by usage type */
138
- byUsageType: Record<UsageType, number>;
139
- };
140
- }
141
- /**
142
- * Product analysis for API response (flattened)
143
- */
144
- export interface ProductAnalysisResponse {
145
- qvetCode: number;
146
- description: string;
147
- section: string;
148
- usageType: UsageType;
149
- dailyConsumption: number;
150
- dailyConsumptionRecent: number;
151
- monthlyConsumption: number;
152
- qyRatio: number;
153
- trend: TrendType;
154
- referenceConsumption: number;
155
- currentStock: {
156
- warehouse: string;
157
- stock: number;
158
- }[];
159
- totalStock: number;
160
- minStock: number;
161
- optimalStock: number;
162
- minDays: number;
163
- optimalDays: number;
164
- roundingIncrement: number;
165
- unitCost: number;
166
- proposedMinValue: number;
167
- proposedOptValue: number;
168
- }
169
91
  /**
170
92
  * Stock flow data for a product
171
93
  */
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * Inventory Analysis Types
3
+ * Stock Calculation Types
4
4
  *
5
- * Type definitions for inventory analysis calculations.
6
- * Used by StockProposalService, ConsumptionAnalysisService, etc.
5
+ * Domain types for stock calculation (min/max/optimal).
6
+ * Used by StockCalculationService, ConsumptionAnalysisService, etc.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.TrendType = void 0;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './types';
6
6
  export * from './constants';
7
7
  export * from './contracts';
8
8
  export * from './validation';
9
- export * from './inventory-analysis';
10
9
  export { debugLog } from './utils/debug-logger';
11
10
  export * from './utils/sync-field.helpers';
12
11
  export * from './utils/qvet-catalog.helpers';
package/dist/index.js CHANGED
@@ -23,7 +23,6 @@ __exportStar(require("./types"), exports);
23
23
  __exportStar(require("./constants"), exports);
24
24
  __exportStar(require("./contracts"), exports);
25
25
  __exportStar(require("./validation"), exports);
26
- __exportStar(require("./inventory-analysis"), exports);
27
26
  var debug_logger_1 = require("./utils/debug-logger");
28
27
  Object.defineProperty(exports, "debugLog", { enumerable: true, get: function () { return debug_logger_1.debugLog; } });
29
28
  __exportStar(require("./utils/sync-field.helpers"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.23.0",
3
+ "version": "6.25.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,7 +0,0 @@
1
- /**
2
- * Inventory Analysis API Contracts
3
- *
4
- * Request and response types for inventory analysis and order optimization.
5
- */
6
- export * from './requests';
7
- export * from './responses';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * Inventory Analysis Request Types
4
- *
5
- * Request DTOs for inventory analysis and order optimization endpoints.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * Inventory Analysis Response Types
4
- *
5
- * Response DTOs for inventory analysis and order optimization endpoints.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- /**
2
- * Inventory Analysis Module
3
- *
4
- * API contracts for inventory analysis endpoints.
5
- * Calculation logic lives in hvp-backend domain layer.
6
- */
7
- export * from './types';