hvp-shared 6.76.0 → 6.78.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.
@@ -5,12 +5,29 @@
5
5
  * Sessions track physical inventory counts across multiple uploads
6
6
  * until closure is detected from QVET movements sync.
7
7
  */
8
- /** Lifecycle status of an inventory session */
8
+ /**
9
+ * Lifecycle status of an inventory session.
10
+ *
11
+ * counting → reviewing → validating → exported → closed
12
+ *
13
+ * - counting: Session created, physical counting in progress, no uploads yet
14
+ * - reviewing: First upload done, collaborator reviewing counts
15
+ * - validating: Collaborator done, manager validating/deciding
16
+ * - exported: Final sheet downloaded, data propagated to CatalogItem
17
+ * - closed: QVET import detected via movement sync
18
+ */
9
19
  export declare enum InventorySessionStatus {
10
- open = "open",
20
+ counting = "counting",
21
+ reviewing = "reviewing",
22
+ validating = "validating",
23
+ exported = "exported",
11
24
  closed = "closed"
12
25
  }
13
26
  export declare const INVENTORY_SESSION_STATUS_LABELS: Record<InventorySessionStatus, string>;
27
+ /** Statuses where editing (upload, count edits, collaborator actions) is allowed */
28
+ export declare const EDITABLE_SESSION_STATUSES: Set<InventorySessionStatus>;
29
+ /** Statuses where the session is still active (downloads, refresh, manager decisions) */
30
+ export declare const ACTIVE_SESSION_STATUSES: Set<InventorySessionStatus>;
14
31
  /**
15
32
  * Status of an individual item within a session.
16
33
  * This is THE field to display. No priority logic needed.
@@ -7,18 +7,45 @@
7
7
  * until closure is detected from QVET movements sync.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.COLLABORATOR_ACTION_LABELS = exports.CollaboratorAction = exports.MANAGER_DECISION_LABELS = exports.ManagerDecision = exports.TERMINAL_ITEM_STATUSES = exports.INVENTORY_ITEM_STATUS_LABELS = exports.InventoryItemStatus = exports.INVENTORY_SESSION_STATUS_LABELS = exports.InventorySessionStatus = void 0;
10
+ exports.COLLABORATOR_ACTION_LABELS = exports.CollaboratorAction = exports.MANAGER_DECISION_LABELS = exports.ManagerDecision = exports.TERMINAL_ITEM_STATUSES = exports.INVENTORY_ITEM_STATUS_LABELS = exports.InventoryItemStatus = exports.ACTIVE_SESSION_STATUSES = exports.EDITABLE_SESSION_STATUSES = exports.INVENTORY_SESSION_STATUS_LABELS = exports.InventorySessionStatus = void 0;
11
11
  // --- Session Status ---
12
- /** Lifecycle status of an inventory session */
12
+ /**
13
+ * Lifecycle status of an inventory session.
14
+ *
15
+ * counting → reviewing → validating → exported → closed
16
+ *
17
+ * - counting: Session created, physical counting in progress, no uploads yet
18
+ * - reviewing: First upload done, collaborator reviewing counts
19
+ * - validating: Collaborator done, manager validating/deciding
20
+ * - exported: Final sheet downloaded, data propagated to CatalogItem
21
+ * - closed: QVET import detected via movement sync
22
+ */
13
23
  var InventorySessionStatus;
14
24
  (function (InventorySessionStatus) {
15
- InventorySessionStatus["open"] = "open";
25
+ InventorySessionStatus["counting"] = "counting";
26
+ InventorySessionStatus["reviewing"] = "reviewing";
27
+ InventorySessionStatus["validating"] = "validating";
28
+ InventorySessionStatus["exported"] = "exported";
16
29
  InventorySessionStatus["closed"] = "closed";
17
30
  })(InventorySessionStatus || (exports.InventorySessionStatus = InventorySessionStatus = {}));
18
31
  exports.INVENTORY_SESSION_STATUS_LABELS = {
19
- [InventorySessionStatus.open]: "Abierta",
20
- [InventorySessionStatus.closed]: "Cerrada",
32
+ [InventorySessionStatus.counting]: "Contando",
33
+ [InventorySessionStatus.reviewing]: "En revisión",
34
+ [InventorySessionStatus.validating]: "Validando",
35
+ [InventorySessionStatus.exported]: "Exportado",
36
+ [InventorySessionStatus.closed]: "Cerrado",
21
37
  };
38
+ /** Statuses where editing (upload, count edits, collaborator actions) is allowed */
39
+ exports.EDITABLE_SESSION_STATUSES = new Set([
40
+ InventorySessionStatus.counting,
41
+ InventorySessionStatus.reviewing,
42
+ ]);
43
+ /** Statuses where the session is still active (downloads, refresh, manager decisions) */
44
+ exports.ACTIVE_SESSION_STATUSES = new Set([
45
+ InventorySessionStatus.counting,
46
+ InventorySessionStatus.reviewing,
47
+ InventorySessionStatus.validating,
48
+ ]);
22
49
  // --- Item Status (unified — single source of truth for display) ---
23
50
  /**
24
51
  * Status of an individual item within a session.
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { InventorySessionStatus } from '../../constants/inventory-session.enums';
7
7
  import { Warehouse } from '../../types/qvet.types';
8
- import { InventorySessionItem } from './types';
8
+ import { InventorySessionItem, SessionActivity } from './types';
9
9
  /**
10
10
  * Summary of an inventory session for list views.
11
11
  *
@@ -32,6 +32,7 @@ export interface InventorySessionSummaryResponse {
32
32
  createdAt: string;
33
33
  updatedAt: string;
34
34
  lastUploadAt?: string;
35
+ exportedAt?: string;
35
36
  closedAt?: string;
36
37
  }
37
38
  /**
@@ -42,6 +43,7 @@ export interface InventorySessionSummaryResponse {
42
43
  export interface InventorySessionDetailResponse extends InventorySessionSummaryResponse {
43
44
  createdById: string;
44
45
  items: InventorySessionItem[];
46
+ activityLog: SessionActivity[];
45
47
  }
46
48
  /**
47
49
  * Response after uploading a count Excel.
@@ -4,7 +4,7 @@
4
4
  * Shared type definitions for inventory session items.
5
5
  * Used by both requests and responses.
6
6
  */
7
- import { InventoryItemStatus, ManagerDecision, CollaboratorAction } from '../../constants/inventory-session.enums';
7
+ import { InventoryItemStatus, InventorySessionStatus, ManagerDecision, CollaboratorAction } from '../../constants/inventory-session.enums';
8
8
  /**
9
9
  * Item data within an inventory session.
10
10
  *
@@ -49,3 +49,39 @@ export interface InventorySessionItem {
49
49
  /** Name of the reviewer */
50
50
  reviewedByName?: string;
51
51
  }
52
+ export type SessionActivityAction = 'created' | 'uploaded' | 'reviewed' | 'downloaded' | 'refreshed' | 'exported' | 'bulk_loss';
53
+ export declare const SESSION_ACTIVITY_LABELS: Record<SessionActivityAction, string>;
54
+ /** Snapshot of session counts at a point in time */
55
+ export interface SessionActivitySnapshot {
56
+ pending: number;
57
+ resolved: number;
58
+ needsAttention: number;
59
+ inProgress: number;
60
+ sessionStatus: InventorySessionStatus;
61
+ }
62
+ /** Action-specific metrics */
63
+ export interface SessionActivityMetrics {
64
+ itemsUpdated?: number;
65
+ itemsNotFound?: number;
66
+ itemsSkipped?: number;
67
+ countChanges?: number;
68
+ confirmations?: number;
69
+ managerDecisions?: number;
70
+ autoAdjusted?: number;
71
+ resetToPending?: number;
72
+ itemsInSheet?: number;
73
+ filter?: 'pending' | 'all';
74
+ expirationsPropagated?: number;
75
+ totalLossMXN?: number;
76
+ totalSurplusMXN?: number;
77
+ }
78
+ /** Single entry in the session activity log */
79
+ export interface SessionActivity {
80
+ action: SessionActivityAction;
81
+ userName: string;
82
+ colCode: string;
83
+ timestamp: string;
84
+ snapshot: SessionActivitySnapshot;
85
+ metrics: SessionActivityMetrics;
86
+ details?: string;
87
+ }
@@ -6,3 +6,13 @@
6
6
  * Used by both requests and responses.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.SESSION_ACTIVITY_LABELS = void 0;
10
+ exports.SESSION_ACTIVITY_LABELS = {
11
+ created: 'Sesión creada',
12
+ uploaded: 'Conteo subido',
13
+ reviewed: 'Revisión aplicada',
14
+ downloaded: 'Hoja descargada',
15
+ refreshed: 'Stock actualizado',
16
+ exported: 'Hoja final exportada',
17
+ bulk_loss: 'Pérdidas aceptadas',
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.76.0",
3
+ "version": "6.78.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",