@managesome/eposmatic-toolkit 0.4.47 → 0.4.50
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/esm/constants/WORKER_ENDPOINTS.js +1 -0
- package/esm/helpers/utils/inventory.js +18 -0
- package/esm/helpers/utils/warehouse-inventory.js +21 -0
- package/lib/constants/WORKER_ENDPOINTS.d.ts +1 -0
- package/lib/constants/WORKER_ENDPOINTS.js +1 -0
- package/lib/helpers/types/workers.d.ts +15 -1
- package/lib/helpers/utils/inventory.js +18 -0
- package/lib/helpers/utils/warehouse-inventory.js +21 -0
- package/lib/schemas/types/inventories.d.ts +6 -0
- package/lib/schemas/types/inventory_department_utilities.d.ts +6 -0
- package/lib/schemas/types/warehouse_items.d.ts +7 -0
- package/lib/tests/leave-request-notification.test.d.ts +1 -0
- package/lib/tests/leave-request-notification.test.js +12 -0
- package/lib/tests/materialized-reports/materialized-prep-time-classification.test.js +1 -1
- package/lib/tests/materialized-reports/materialized-write-paths-inventory.test.js +19 -2
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ export const WORKER_ENDPOINTS = {
|
|
|
12
12
|
SEND_WA_ORDER_NOTIFICATION: '/send-wa-order-notification',
|
|
13
13
|
SEND_EMAIL_ORDER_NOTIFICATION: '/send-email-order-notification',
|
|
14
14
|
SEND_APP_ORDER_NOTIFICATION: '/send-app-order-notification',
|
|
15
|
+
SEND_LEAVE_REQUEST_STATUS_NOTIFICATION: '/send-leave-request-status-notification',
|
|
15
16
|
NOTIFY_TO_RATE_ORDER: '/notify-to-rate-order',
|
|
16
17
|
CREATE_VOID_ORDER_ITEMS: '/create-void-order-items',
|
|
17
18
|
CREATE_VOID_ORDER_ITEMS_ON_OFFLINE_SYNC: '/create-void-order-items-on-offline-sync',
|
|
@@ -104,6 +104,24 @@ export function getKitchenInventoryWithDecimal(inventory) {
|
|
|
104
104
|
...(typeof inventory.new_stock_price === 'number'
|
|
105
105
|
? { new_stock_price: convertIntToDecimal(inventory.new_stock_price) }
|
|
106
106
|
: {}),
|
|
107
|
+
...(typeof inventory.consumed_stock_price === 'number'
|
|
108
|
+
? { consumed_stock_price: convertIntToDecimal(inventory.consumed_stock_price) }
|
|
109
|
+
: {}),
|
|
110
|
+
...(typeof inventory.transfer_stock_price === 'number'
|
|
111
|
+
? { transfer_stock_price: convertIntToDecimal(inventory.transfer_stock_price) }
|
|
112
|
+
: {}),
|
|
113
|
+
...(typeof inventory.return_stock_price === 'number'
|
|
114
|
+
? { return_stock_price: convertIntToDecimal(inventory.return_stock_price) }
|
|
115
|
+
: {}),
|
|
116
|
+
...(typeof inventory.wasted_stock_price === 'number'
|
|
117
|
+
? { wasted_stock_price: convertIntToDecimal(inventory.wasted_stock_price) }
|
|
118
|
+
: {}),
|
|
119
|
+
...(typeof inventory.short_stock_price === 'number'
|
|
120
|
+
? { short_stock_price: convertIntToDecimal(inventory.short_stock_price) }
|
|
121
|
+
: {}),
|
|
122
|
+
...(typeof inventory.variance_stock_price === 'number'
|
|
123
|
+
? { variance_stock_price: convertIntToDecimal(inventory.variance_stock_price) }
|
|
124
|
+
: {}),
|
|
107
125
|
...(typeof inventory.previous_unit_price === 'number'
|
|
108
126
|
? { previous_unit_price: convertIntToDecimal(inventory.previous_unit_price) }
|
|
109
127
|
: {}),
|
|
@@ -49,6 +49,27 @@ export function getWarehouseInventoryWithDecimal(inventory) {
|
|
|
49
49
|
...(typeof inventory.new_stock_price === 'number'
|
|
50
50
|
? { new_stock_price: convertIntToDecimal(inventory.new_stock_price) }
|
|
51
51
|
: {}),
|
|
52
|
+
...(typeof inventory.consumed_stock_price === 'number'
|
|
53
|
+
? { consumed_stock_price: convertIntToDecimal(inventory.consumed_stock_price) }
|
|
54
|
+
: {}),
|
|
55
|
+
...(typeof inventory.transfer_stock_price === 'number'
|
|
56
|
+
? { transfer_stock_price: convertIntToDecimal(inventory.transfer_stock_price) }
|
|
57
|
+
: {}),
|
|
58
|
+
...(typeof inventory.return_stock_price === 'number'
|
|
59
|
+
? { return_stock_price: convertIntToDecimal(inventory.return_stock_price) }
|
|
60
|
+
: {}),
|
|
61
|
+
...(typeof inventory.wasted_stock_price === 'number'
|
|
62
|
+
? { wasted_stock_price: convertIntToDecimal(inventory.wasted_stock_price) }
|
|
63
|
+
: {}),
|
|
64
|
+
...(typeof inventory.short_stock_price === 'number'
|
|
65
|
+
? { short_stock_price: convertIntToDecimal(inventory.short_stock_price) }
|
|
66
|
+
: {}),
|
|
67
|
+
...(typeof inventory.variance_stock_price === 'number'
|
|
68
|
+
? { variance_stock_price: convertIntToDecimal(inventory.variance_stock_price) }
|
|
69
|
+
: {}),
|
|
70
|
+
...(typeof inventory.sale_stock_price === 'number'
|
|
71
|
+
? { sale_stock_price: convertIntToDecimal(inventory.sale_stock_price) }
|
|
72
|
+
: {}),
|
|
52
73
|
...(typeof inventory.previous_unit_price === 'number'
|
|
53
74
|
? { previous_unit_price: convertIntToDecimal(inventory.previous_unit_price) }
|
|
54
75
|
: {}),
|
|
@@ -11,6 +11,7 @@ export declare const WORKER_ENDPOINTS: {
|
|
|
11
11
|
readonly SEND_WA_ORDER_NOTIFICATION: "/send-wa-order-notification";
|
|
12
12
|
readonly SEND_EMAIL_ORDER_NOTIFICATION: "/send-email-order-notification";
|
|
13
13
|
readonly SEND_APP_ORDER_NOTIFICATION: "/send-app-order-notification";
|
|
14
|
+
readonly SEND_LEAVE_REQUEST_STATUS_NOTIFICATION: "/send-leave-request-status-notification";
|
|
14
15
|
readonly NOTIFY_TO_RATE_ORDER: "/notify-to-rate-order";
|
|
15
16
|
readonly CREATE_VOID_ORDER_ITEMS: "/create-void-order-items";
|
|
16
17
|
readonly CREATE_VOID_ORDER_ITEMS_ON_OFFLINE_SYNC: "/create-void-order-items-on-offline-sync";
|
|
@@ -15,6 +15,7 @@ exports.WORKER_ENDPOINTS = {
|
|
|
15
15
|
SEND_WA_ORDER_NOTIFICATION: '/send-wa-order-notification',
|
|
16
16
|
SEND_EMAIL_ORDER_NOTIFICATION: '/send-email-order-notification',
|
|
17
17
|
SEND_APP_ORDER_NOTIFICATION: '/send-app-order-notification',
|
|
18
|
+
SEND_LEAVE_REQUEST_STATUS_NOTIFICATION: '/send-leave-request-status-notification',
|
|
18
19
|
NOTIFY_TO_RATE_ORDER: '/notify-to-rate-order',
|
|
19
20
|
CREATE_VOID_ORDER_ITEMS: '/create-void-order-items',
|
|
20
21
|
CREATE_VOID_ORDER_ITEMS_ON_OFFLINE_SYNC: '/create-void-order-items-on-offline-sync',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CARD_PROCESSING_PROVIDERS_ENUM, CURRENCY_SYMBOL_ENUM, DELIVERY_STATUS_ENUM, ORDER_STATUS_ENUM, PLATFORM_TYPE_ENUM, PLATFORMS_ENUM, VOID_ORDER_ITEM_TYPE_ENUM, WALLET_ASSET_TYPE_ENUM, WALLET_ASSIGNMENT_BEHAVIOR_ENUM, WAREHOUSE_ACTIVITY_LOG_ACTION_ENUM, WAREHOUSE_ACTIVITY_LOG_ENTITY_TYPE_ENUM, WAREHOUSE_ACTIVITY_LOG_SEVERITY_ENUM, WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM, WAREHOUSE_TRACKING_MODE_ENUM } from '../../constants';
|
|
1
|
+
import { CARD_PROCESSING_PROVIDERS_ENUM, CURRENCY_SYMBOL_ENUM, DELIVERY_STATUS_ENUM, HR_LEAVE_STATUS_ENUM, HR_LEAVE_TYPE_ENUM, ORDER_STATUS_ENUM, PLATFORM_TYPE_ENUM, PLATFORMS_ENUM, VOID_ORDER_ITEM_TYPE_ENUM, WALLET_ASSET_TYPE_ENUM, WALLET_ASSIGNMENT_BEHAVIOR_ENUM, WAREHOUSE_ACTIVITY_LOG_ACTION_ENUM, WAREHOUSE_ACTIVITY_LOG_ENTITY_TYPE_ENUM, WAREHOUSE_ACTIVITY_LOG_SEVERITY_ENUM, WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM, WAREHOUSE_TRACKING_MODE_ENUM } from '../../constants';
|
|
2
2
|
import { IDineinTableFingerprint, IInternalLead, IModifierExtra, IOrder, IOrderItem, IOrderPayment, ITenantPurchaseOrder, ITenantPurchaseOrderVendorReturn, IWarehouseInternalMovement, IWarehousePurchaseOrder, IWarehousePurchaseOrderReceipt, IWarehousePurchaseOrderVendorReturn, IWarehouseSaleOrder, IWarehouseSaleOrderDelivery } from '../../schemas';
|
|
3
3
|
import { IWarehouseActivityLogChange } from '../../schemas/types/warehouse-activity-logs';
|
|
4
4
|
import { ISwitchPayEWalletRequestBody, ISwitchPayRefundRequestBody } from './switchpay';
|
|
@@ -93,6 +93,20 @@ export interface IWorker_SendAppOrderNotification {
|
|
|
93
93
|
order_number: number | null;
|
|
94
94
|
estimated_time: Date | null;
|
|
95
95
|
}
|
|
96
|
+
export interface IWorker_SendLeaveRequestStatusNotification {
|
|
97
|
+
tenant_id: string;
|
|
98
|
+
leave_request_id: string;
|
|
99
|
+
employee_uid: string;
|
|
100
|
+
employee_name: string;
|
|
101
|
+
employee_phone: string;
|
|
102
|
+
leave_type: HR_LEAVE_TYPE_ENUM;
|
|
103
|
+
start_date: string;
|
|
104
|
+
end_date: string;
|
|
105
|
+
total_days: number;
|
|
106
|
+
is_half_day: boolean;
|
|
107
|
+
status: HR_LEAVE_STATUS_ENUM;
|
|
108
|
+
rejection_reason?: string | null;
|
|
109
|
+
}
|
|
96
110
|
export interface IWorker_NotifyToRateOrder {
|
|
97
111
|
order_id: string;
|
|
98
112
|
order_number: number | null;
|
|
@@ -109,6 +109,24 @@ function getKitchenInventoryWithDecimal(inventory) {
|
|
|
109
109
|
...(typeof inventory.new_stock_price === 'number'
|
|
110
110
|
? { new_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.new_stock_price) }
|
|
111
111
|
: {}),
|
|
112
|
+
...(typeof inventory.consumed_stock_price === 'number'
|
|
113
|
+
? { consumed_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.consumed_stock_price) }
|
|
114
|
+
: {}),
|
|
115
|
+
...(typeof inventory.transfer_stock_price === 'number'
|
|
116
|
+
? { transfer_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.transfer_stock_price) }
|
|
117
|
+
: {}),
|
|
118
|
+
...(typeof inventory.return_stock_price === 'number'
|
|
119
|
+
? { return_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.return_stock_price) }
|
|
120
|
+
: {}),
|
|
121
|
+
...(typeof inventory.wasted_stock_price === 'number'
|
|
122
|
+
? { wasted_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.wasted_stock_price) }
|
|
123
|
+
: {}),
|
|
124
|
+
...(typeof inventory.short_stock_price === 'number'
|
|
125
|
+
? { short_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.short_stock_price) }
|
|
126
|
+
: {}),
|
|
127
|
+
...(typeof inventory.variance_stock_price === 'number'
|
|
128
|
+
? { variance_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.variance_stock_price) }
|
|
129
|
+
: {}),
|
|
112
130
|
...(typeof inventory.previous_unit_price === 'number'
|
|
113
131
|
? { previous_unit_price: (0, price_conversion_1.convertIntToDecimal)(inventory.previous_unit_price) }
|
|
114
132
|
: {}),
|
|
@@ -52,6 +52,27 @@ function getWarehouseInventoryWithDecimal(inventory) {
|
|
|
52
52
|
...(typeof inventory.new_stock_price === 'number'
|
|
53
53
|
? { new_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.new_stock_price) }
|
|
54
54
|
: {}),
|
|
55
|
+
...(typeof inventory.consumed_stock_price === 'number'
|
|
56
|
+
? { consumed_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.consumed_stock_price) }
|
|
57
|
+
: {}),
|
|
58
|
+
...(typeof inventory.transfer_stock_price === 'number'
|
|
59
|
+
? { transfer_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.transfer_stock_price) }
|
|
60
|
+
: {}),
|
|
61
|
+
...(typeof inventory.return_stock_price === 'number'
|
|
62
|
+
? { return_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.return_stock_price) }
|
|
63
|
+
: {}),
|
|
64
|
+
...(typeof inventory.wasted_stock_price === 'number'
|
|
65
|
+
? { wasted_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.wasted_stock_price) }
|
|
66
|
+
: {}),
|
|
67
|
+
...(typeof inventory.short_stock_price === 'number'
|
|
68
|
+
? { short_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.short_stock_price) }
|
|
69
|
+
: {}),
|
|
70
|
+
...(typeof inventory.variance_stock_price === 'number'
|
|
71
|
+
? { variance_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.variance_stock_price) }
|
|
72
|
+
: {}),
|
|
73
|
+
...(typeof inventory.sale_stock_price === 'number'
|
|
74
|
+
? { sale_stock_price: (0, price_conversion_1.convertIntToDecimal)(inventory.sale_stock_price) }
|
|
75
|
+
: {}),
|
|
55
76
|
...(typeof inventory.previous_unit_price === 'number'
|
|
56
77
|
? { previous_unit_price: (0, price_conversion_1.convertIntToDecimal)(inventory.previous_unit_price) }
|
|
57
78
|
: {}),
|
|
@@ -47,4 +47,10 @@ export interface IKitchenInventory {
|
|
|
47
47
|
return_quantity: number;
|
|
48
48
|
total_transactions: number;
|
|
49
49
|
new_stock_price: number;
|
|
50
|
+
consumed_stock_price: number;
|
|
51
|
+
transfer_stock_price: number;
|
|
52
|
+
return_stock_price: number;
|
|
53
|
+
wasted_stock_price: number;
|
|
54
|
+
short_stock_price: number;
|
|
55
|
+
variance_stock_price: number;
|
|
50
56
|
}
|
|
@@ -47,4 +47,10 @@ export interface IKitchenInventoryDepartment {
|
|
|
47
47
|
return_quantity: number;
|
|
48
48
|
total_transactions: number;
|
|
49
49
|
new_stock_price: number;
|
|
50
|
+
consumed_stock_price: number;
|
|
51
|
+
transfer_stock_price: number;
|
|
52
|
+
return_stock_price: number;
|
|
53
|
+
wasted_stock_price: number;
|
|
54
|
+
short_stock_price: number;
|
|
55
|
+
variance_stock_price: number;
|
|
50
56
|
}
|
|
@@ -60,6 +60,13 @@ export interface IWarehouseInventory {
|
|
|
60
60
|
sale_quantity: number;
|
|
61
61
|
total_transactions: number;
|
|
62
62
|
new_stock_price: number;
|
|
63
|
+
consumed_stock_price: number;
|
|
64
|
+
transfer_stock_price: number;
|
|
65
|
+
return_stock_price: number;
|
|
66
|
+
wasted_stock_price: number;
|
|
67
|
+
short_stock_price: number;
|
|
68
|
+
variance_stock_price: number;
|
|
69
|
+
sale_stock_price: number;
|
|
63
70
|
}
|
|
64
71
|
export interface IWarehouseItemCosting {
|
|
65
72
|
_id: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../constants");
|
|
4
|
+
describe('leave request notification contract', () => {
|
|
5
|
+
it('exposes a dedicated worker endpoint', () => {
|
|
6
|
+
expect(constants_1.WORKER_ENDPOINTS.SEND_LEAVE_REQUEST_STATUS_NOTIFICATION).toBe('/send-leave-request-status-notification');
|
|
7
|
+
});
|
|
8
|
+
it('keeps every worker endpoint unique', () => {
|
|
9
|
+
const paths = Object.values(constants_1.WORKER_ENDPOINTS);
|
|
10
|
+
expect(new Set(paths).size).toBe(paths.length);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -345,7 +345,7 @@ describe('accumulateOrderPrepTime - target grading', () => {
|
|
|
345
345
|
expect(result.counters.late_items.count).toBe(0);
|
|
346
346
|
expect(result.counters.target.default_baseline_count).toBe(0);
|
|
347
347
|
});
|
|
348
|
-
it('counts a DEFAULT baseline
|
|
348
|
+
it('counts a DEFAULT baseline as a target (decision e2)', () => {
|
|
349
349
|
const result = (0, materialized_prep_time_classification_helpers_1.accumulateOrderPrepTime)({
|
|
350
350
|
order: order({ categories: [{ name: 'Mains', items: [item({ ready_minutes: 5 })] }] }),
|
|
351
351
|
context,
|
|
@@ -20,7 +20,15 @@ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
|
|
|
20
20
|
*
|
|
21
21
|
* A `deleteMany` carries no document, so it is not a gated write.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Resolved from THIS test file, never from a machine-specific absolute path.
|
|
25
|
+
*
|
|
26
|
+
* `simulations/*` is gitignored (see .gitignore): the demo generators/uploaders
|
|
27
|
+
* are LOCAL-ONLY tooling, so a fresh clone or CI checkout does not contain them.
|
|
28
|
+
* Each script is therefore checked only when present, keeping the suite
|
|
29
|
+
* portable instead of failing with ENOENT on another machine.
|
|
30
|
+
*/
|
|
31
|
+
const SIMULATIONS_DIR = path_1.default.resolve(__dirname, '..', '..', '..', 'simulations');
|
|
24
32
|
/** The materialized write paths of the demo/simulation scripts. */
|
|
25
33
|
const WRITE_PATHS = [
|
|
26
34
|
'generate-demo-materialized-data.ts',
|
|
@@ -42,8 +50,17 @@ const countOccurrences = (source, needles) => needles.reduce((total, needle) =>
|
|
|
42
50
|
}, 0);
|
|
43
51
|
describe('every materialized write path is gated', () => {
|
|
44
52
|
for (const fileName of WRITE_PATHS) {
|
|
53
|
+
const filePath = path_1.default.join(SIMULATIONS_DIR, fileName);
|
|
54
|
+
if (!fs_1.default.existsSync(filePath)) {
|
|
55
|
+
// The script is local-only and absent (gitignored `simulations/*`).
|
|
56
|
+
// Skip explicitly rather than fail with ENOENT on a clean checkout.
|
|
57
|
+
it.skip(`${fileName} gates every document-carrying write (local-only script not present)`, () => {
|
|
58
|
+
// Unreachable: the suite skips when the script is absent.
|
|
59
|
+
});
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
45
62
|
it(`${fileName} gates every document-carrying write`, () => {
|
|
46
|
-
const source = fs_1.default.readFileSync(
|
|
63
|
+
const source = fs_1.default.readFileSync(filePath, 'utf8');
|
|
47
64
|
const writes = countOccurrences(source, DOCUMENT_WRITES);
|
|
48
65
|
const gates = countOccurrences(source, GATES);
|
|
49
66
|
expect(writes).toBeGreaterThan(0);
|