hvp-shared 6.25.0 → 6.28.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.
@@ -198,3 +198,94 @@ export interface CatalogSyncTriggerResponse {
198
198
  /** Estimated items to process */
199
199
  estimatedItems?: number;
200
200
  }
201
+ /**
202
+ * Naming validation issue severity
203
+ */
204
+ export type NamingIssueSeverity = 'error' | 'warning' | 'info';
205
+ /**
206
+ * Single naming validation issue
207
+ *
208
+ * Represents a specific problem found in a catalog item name.
209
+ *
210
+ * @example { ruleId: 'NV001', severity: 'error', message: 'Double spaces found' }
211
+ */
212
+ export interface CatalogNamingIssue {
213
+ /** Rule identifier (NV001, NV002, etc.) */
214
+ ruleId: string;
215
+ /** Issue severity */
216
+ severity: NamingIssueSeverity;
217
+ /** Human-readable message (Spanish) */
218
+ message: string;
219
+ /** Suggested fix if available */
220
+ suggestion?: string;
221
+ }
222
+ /**
223
+ * Validation result for a single catalog item
224
+ *
225
+ * Contains all issues found and recommendations for a specific item.
226
+ *
227
+ * @example GET /api/catalog-items/validate-names
228
+ */
229
+ export interface CatalogItemNamingValidationResult {
230
+ /** QVET code */
231
+ qvetCode: number;
232
+ /** Current item name */
233
+ currentName: string;
234
+ /** Item section */
235
+ section: string;
236
+ /** Item family */
237
+ family: string;
238
+ /** Item brand */
239
+ brand: string;
240
+ /** Stock control type */
241
+ stockControlType: string;
242
+ /** Purchase unit */
243
+ purchaseUnit: string;
244
+ /** Sale unit */
245
+ saleUnit: string;
246
+ /** Conversion factor */
247
+ conversionFactor: number;
248
+ /** List of issues found */
249
+ issues: CatalogNamingIssue[];
250
+ /** Suggested corrected name if applicable */
251
+ suggestedName?: string;
252
+ /** Validation score (0-100, 100 = no issues) */
253
+ validationScore: number;
254
+ }
255
+ /**
256
+ * Summary statistics for naming validation
257
+ */
258
+ export interface CatalogNamingValidationSummary {
259
+ /** Total items analyzed */
260
+ totalItems: number;
261
+ /** Items with at least one issue */
262
+ itemsWithIssues: number;
263
+ /** Total error count */
264
+ errorCount: number;
265
+ /** Total warning count */
266
+ warningCount: number;
267
+ /** Total info count */
268
+ infoCount: number;
269
+ /** Breakdown by section */
270
+ bySection: Record<string, {
271
+ total: number;
272
+ withIssues: number;
273
+ }>;
274
+ /** Breakdown by rule ID */
275
+ byRuleId: Record<string, number>;
276
+ }
277
+ /**
278
+ * Complete naming analysis response
279
+ *
280
+ * Full validation results with summary and individual item details.
281
+ *
282
+ * @example GET /api/catalog-items/validate-names
283
+ */
284
+ export interface CatalogNamingAnalysisResponse {
285
+ /** Summary statistics */
286
+ summary: CatalogNamingValidationSummary;
287
+ /** Individual item results (only items with issues) */
288
+ items: CatalogItemNamingValidationResult[];
289
+ /** Timestamp when analysis was generated */
290
+ generatedAt: string;
291
+ }
@@ -94,13 +94,17 @@ export interface ProductAnalysis {
94
94
  export interface StockFlow {
95
95
  /** Initial stock at period start */
96
96
  initialStock: number;
97
- /** Purchases during period */
97
+ /** Purchases adjusted by conversion factor (qty × factor) */
98
98
  purchases: number;
99
+ /** Purchase distortion adjustment (based on price ratio analysis) */
100
+ purchasesDist: number;
101
+ /** Total purchases = purchases + purchasesDist (for display) */
102
+ purchasesTotal: number;
99
103
  /** Transfers in (received) */
100
104
  transfersIn: number;
101
105
  /** Transfers out (sent) */
102
106
  transfersOut: number;
103
- /** Available = initial + purchases + transfersIn - transfersOut */
107
+ /** Available = initial + purchasesTotal + transfersIn - transfersOut */
104
108
  available: number;
105
109
  /** Units sold */
106
110
  sold: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.25.0",
3
+ "version": "6.28.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",