@managesome/eposmatic-toolkit 0.2.592 → 0.2.594

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.
@@ -436,3 +436,63 @@ export interface IWorker_PostWarehouseActivityLogs {
436
436
  severity?: WAREHOUSE_ACTIVITY_LOG_SEVERITY_ENUM;
437
437
  }[];
438
438
  }
439
+ export interface IWorker_StartInstoreShift {
440
+ tenant_id: string;
441
+ /** The business day (tenant_day_sessions doc id). */
442
+ day_id: string;
443
+ /** The shift session doc id created by the open. */
444
+ shift_session_id: string;
445
+ /** The shift TEMPLATE id. */
446
+ shift_id: string;
447
+ }
448
+ export interface IWorker_EndInstoreShift {
449
+ tenant_id: string;
450
+ /** The business day (tenant_day_sessions doc id). */
451
+ day_id: string;
452
+ /** The shift session doc id being closed. */
453
+ shift_session_id: string;
454
+ /** The shift TEMPLATE id. */
455
+ shift_id: string;
456
+ }
457
+ export interface IWorker_ReopenInstoreShift {
458
+ tenant_id: string;
459
+ /** The business day (tenant_day_sessions doc id). */
460
+ day_id: string;
461
+ /** The shift session doc id being reopened. */
462
+ shift_session_id: string;
463
+ /** The shift TEMPLATE id. */
464
+ shift_id: string;
465
+ }
466
+ export interface IWorker_StartTenantDay {
467
+ tenant_id: string;
468
+ /** The newly opened business day (tenant_day_sessions doc id). */
469
+ day_session_id: string;
470
+ }
471
+ export interface IWorker_EndTenantDay {
472
+ tenant_id: string;
473
+ /** The business day being closed (tenant_day_sessions doc id). */
474
+ day_session_id: string;
475
+ }
476
+ export interface IWorker_ReopenTenantDay {
477
+ tenant_id: string;
478
+ /** The business day being reopened (tenant_day_sessions doc id). */
479
+ day_session_id: string;
480
+ }
481
+ export interface IWorker_OpenCashDrawerSession {
482
+ tenant_id: string;
483
+ /** The business day (tenant_day_sessions doc id). */
484
+ day_id: string;
485
+ /** The cash drawer doc id. */
486
+ drawer_id: string;
487
+ /** The drawer session doc id created/reopened by the open. */
488
+ drawer_session_id: string;
489
+ }
490
+ export interface IWorker_CloseCashDrawerSession {
491
+ tenant_id: string;
492
+ /** The business day (tenant_day_sessions doc id). */
493
+ day_id: string;
494
+ /** The cash drawer doc id. */
495
+ drawer_id: string;
496
+ /** The drawer session doc id being closed. */
497
+ drawer_session_id: string;
498
+ }
@@ -76,12 +76,21 @@ function getWarehouseCatalogFetchedData(categories, items) {
76
76
  items: [],
77
77
  },
78
78
  }), {});
79
+ // Secondary lookup by category _id: synced categories carry a fresh per-target
80
+ // _id (≠ ref_id) while items store that category _id, so a ref_id-only lookup
81
+ // would silently drop those items from the catalog.
82
+ const categoriesByItemId = categories.reduce((acc, category) => {
83
+ if (category._id != null) {
84
+ acc[category._id] = categoriesObj[category.ref_id];
85
+ }
86
+ return acc;
87
+ }, {});
79
88
  const uncategorizedItems = [];
80
89
  for (let i = 0; i < items.length; i++) {
81
90
  const item = items[i];
82
91
  const sortedItem = getPartialWarehouseItemWithPrice(item);
83
92
  if (item.category_id) {
84
- categoriesObj[item.category_id]?.items.push(sortedItem);
93
+ (categoriesObj[item.category_id] ?? categoriesByItemId[item.category_id])?.items.push(sortedItem);
85
94
  }
86
95
  else {
87
96
  uncategorizedItems.push(sortedItem);
@@ -90,72 +90,3 @@ export interface ICloseCashDrawerSessionRequestBody {
90
90
  cash_amount: number;
91
91
  denominations: Record<string, number>;
92
92
  }
93
- /**
94
- * Worker compile payloads for the business day / instore shift lifecycle.
95
- *
96
- * items-service fires these (fire-and-forget) AFTER it completes the
97
- * corresponding lifecycle write; workers-service recompiles derived aggregates
98
- * (shift totals, drawer running balances, day totals + reports) from the
99
- * ledger. The ids are the session/document ids needed to scope the recompile —
100
- * the worker does NOT create or close any lifecycle state.
101
- */
102
- export interface IStartInstoreShiftWorkerBody {
103
- tenant_id: string;
104
- /** The business day (tenant_day_sessions doc id) the shift belongs to. */
105
- day_id: string;
106
- /** The shift session doc id created by the open. */
107
- shift_session_id: string;
108
- /** The shift TEMPLATE id. */
109
- shift_id: string;
110
- }
111
- export interface IEndInstoreShiftWorkerBody {
112
- tenant_id: string;
113
- /** The business day (tenant_day_sessions doc id). */
114
- day_id: string;
115
- /** The shift session doc id being closed. */
116
- shift_session_id: string;
117
- /** The shift TEMPLATE id. */
118
- shift_id: string;
119
- }
120
- export interface IReopenInstoreShiftWorkerBody {
121
- tenant_id: string;
122
- /** The business day (tenant_day_sessions doc id). */
123
- day_id: string;
124
- /** The shift session doc id being reopened. */
125
- shift_session_id: string;
126
- /** The shift TEMPLATE id. */
127
- shift_id: string;
128
- }
129
- export interface IStartTenantDayWorkerBody {
130
- tenant_id: string;
131
- /** The newly opened business day (tenant_day_sessions doc id). */
132
- day_session_id: string;
133
- }
134
- export interface IEndTenantDayWorkerBody {
135
- tenant_id: string;
136
- /** The business day being closed (tenant_day_sessions doc id). */
137
- day_session_id: string;
138
- }
139
- export interface IReopenTenantDayWorkerBody {
140
- tenant_id: string;
141
- /** The business day being reopened (tenant_day_sessions doc id). */
142
- day_session_id: string;
143
- }
144
- export interface IOpenCashDrawerSessionWorkerBody {
145
- tenant_id: string;
146
- /** The business day (tenant_day_sessions doc id). */
147
- day_id: string;
148
- /** The cash drawer doc id. */
149
- drawer_id: string;
150
- /** The drawer session doc id created/reopened by the open. */
151
- drawer_session_id: string;
152
- }
153
- export interface ICloseCashDrawerSessionWorkerBody {
154
- tenant_id: string;
155
- /** The business day (tenant_day_sessions doc id). */
156
- day_id: string;
157
- /** The cash drawer doc id. */
158
- drawer_id: string;
159
- /** The drawer session doc id being closed. */
160
- drawer_session_id: string;
161
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.592",
3
+ "version": "0.2.594",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",