@managesome/eposmatic-toolkit 0.4.36 → 0.4.38

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.
Files changed (53) hide show
  1. package/esm/constants/accounting-templates.js +431 -0
  2. package/esm/constants/index.js +1 -0
  3. package/esm/helpers/materialized-reports/materialized-prep-time-classification-helpers.js +1 -3
  4. package/esm/helpers/materialized-reports/materialized-prep-time-read-helpers.js +5 -14
  5. package/lib/constants/accounting-templates.d.ts +8 -0
  6. package/lib/constants/accounting-templates.js +434 -0
  7. package/lib/constants/index.d.ts +1 -0
  8. package/lib/constants/index.js +1 -0
  9. package/lib/helpers/materialized-reports/materialized-prep-time-classification-helpers.js +1 -3
  10. package/lib/helpers/materialized-reports/materialized-prep-time-read-helpers.js +5 -14
  11. package/lib/schemas/models/expense_categories.d.ts +3 -3
  12. package/lib/schemas/models/expense_details.d.ts +3 -3
  13. package/lib/schemas/models/gift_cards.d.ts +3 -3
  14. package/lib/schemas/models/halfhalf_setup.d.ts +3 -3
  15. package/lib/schemas/models/internal_invoices.d.ts +3 -3
  16. package/lib/schemas/models/items.d.ts +12 -12
  17. package/lib/schemas/models/marketing_fingerprints.d.ts +3 -3
  18. package/lib/schemas/models/modifier_extras.d.ts +3 -3
  19. package/lib/schemas/models/offers.d.ts +3 -3
  20. package/lib/schemas/models/public_holidays.d.ts +3 -3
  21. package/lib/schemas/models/specials.d.ts +3 -3
  22. package/lib/schemas/models/tenant_chart_of_accounts.d.ts +3 -3
  23. package/lib/schemas/models/tenant_hr_departments.d.ts +3 -3
  24. package/lib/schemas/models/tenant_hr_documents.d.ts +3 -3
  25. package/lib/schemas/models/tenant_hr_policies.d.ts +3 -3
  26. package/lib/schemas/models/tenant_hr_positions.d.ts +3 -3
  27. package/lib/schemas/models/tenant_journal_entries.d.ts +3 -3
  28. package/lib/schemas/models/void_order_items.d.ts +3 -3
  29. package/lib/schemas/models/vouchers.d.ts +3 -3
  30. package/lib/schemas/models/warehouse_communications.d.ts +3 -3
  31. package/lib/schemas/models/warehouse_items.d.ts +3 -3
  32. package/lib/schemas/models/warehouse_void_purchase_order_items.d.ts +3 -3
  33. package/lib/schemas/models/warehouse_void_sale_order_items.d.ts +3 -3
  34. package/lib/schemas/types/tenant_chart_of_accounts.d.ts +7 -0
  35. package/lib/tests/cart-helpers-edit-item-refs.test.d.ts +1 -0
  36. package/lib/tests/cart-helpers-edit-item-refs.test.js +96 -0
  37. package/lib/tests/code-redemption-helpers.test.d.ts +1 -0
  38. package/lib/tests/code-redemption-helpers.test.js +205 -0
  39. package/lib/tests/gift-card-helpers.test.d.ts +1 -0
  40. package/lib/tests/gift-card-helpers.test.js +100 -0
  41. package/lib/tests/materialized-reports/materialized-prep-time-close-day.test.js +1 -5
  42. package/lib/tests/materialized-reports/materialized-prep-time-duration-consistency.test.js +7 -5
  43. package/lib/tests/materialized-reports/materialized-prep-time-identity.test.js +2 -10
  44. package/lib/tests/materialized-reports/materialized-prep-time-read-helpers.test.js +8 -13
  45. package/lib/tests/materialized-reports/materialized-report-drilldown-rows.test.js +1 -4
  46. package/lib/tests/offer-claim-regressions.test.d.ts +1 -0
  47. package/lib/tests/offer-claim-regressions.test.js +299 -0
  48. package/lib/tests/offers-matrix.test.js +53 -14
  49. package/lib/tests/ref-exclusion-matching.test.d.ts +1 -0
  50. package/lib/tests/ref-exclusion-matching.test.js +150 -0
  51. package/lib/tests/wallet-cashback-helpers.test.d.ts +1 -0
  52. package/lib/tests/wallet-cashback-helpers.test.js +95 -0
  53. package/package.json +1 -1
@@ -0,0 +1,434 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESTAURANT_ACCOUNTS_TEMPLATE = void 0;
4
+ const accounting_1 = require("./enums/accounting");
5
+ /**
6
+ * Default restaurant chart of accounts (Pakistan-first, PKR) — the seed used by
7
+ * `POST /tenant-chart-of-accounts/seed-template` and the admin panel's
8
+ * "Load Restaurant Template" action. Entries are flat posting accounts; tenants
9
+ * nest their own sub-accounts afterwards, and seeding never overwrites existing codes.
10
+ */
11
+ exports.RESTAURANT_ACCOUNTS_TEMPLATE = [
12
+ // ===================== Assets =====================
13
+ {
14
+ code: '1001',
15
+ name: 'Cash on Hand',
16
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
17
+ description: 'Physical cash held in cash drawers.',
18
+ },
19
+ {
20
+ code: '1011',
21
+ name: 'Bank – Main Operating Account',
22
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
23
+ },
24
+ {
25
+ code: '1012',
26
+ name: 'Bank – Payouts / Settlement Account',
27
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
28
+ },
29
+ {
30
+ code: '1021',
31
+ name: 'Card Settlement Clearing',
32
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
33
+ },
34
+ {
35
+ code: '1022',
36
+ name: 'JazzCash Clearing',
37
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
38
+ },
39
+ {
40
+ code: '1023',
41
+ name: 'EasyPaisa Clearing',
42
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
43
+ },
44
+ {
45
+ code: '1024',
46
+ name: 'Raast Clearing',
47
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
48
+ },
49
+ {
50
+ code: '1025',
51
+ name: 'Terminal Devices Clearing',
52
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
53
+ },
54
+ {
55
+ code: '1031',
56
+ name: 'Foodpanda Receivable',
57
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
58
+ },
59
+ {
60
+ code: '1032',
61
+ name: 'Own App / Web Receivable',
62
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
63
+ },
64
+ {
65
+ code: '1040',
66
+ name: 'Accounts Receivable – Customers',
67
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
68
+ description: 'Credit bills / pay-later orders and B2B clients.',
69
+ },
70
+ {
71
+ code: '1051',
72
+ name: 'Inventory – Raw Materials',
73
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
74
+ },
75
+ {
76
+ code: '1052',
77
+ name: 'Inventory – Packed / Retail Items',
78
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
79
+ },
80
+ {
81
+ code: '1053',
82
+ name: 'Inventory – Packaging & Consumables',
83
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
84
+ },
85
+ {
86
+ code: '1060',
87
+ name: 'Input Tax Receivable (GST)',
88
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
89
+ description: 'GST paid on purchases, claimable as credit.',
90
+ },
91
+ {
92
+ code: '1070',
93
+ name: 'Prepaid Expenses',
94
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
95
+ },
96
+ {
97
+ code: '1081',
98
+ name: 'Kitchen Equipment',
99
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
100
+ },
101
+ {
102
+ code: '1082',
103
+ name: 'Furniture & Fittings',
104
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
105
+ },
106
+ {
107
+ code: '1083',
108
+ name: 'Computers & POS Hardware',
109
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
110
+ },
111
+ {
112
+ code: '1085',
113
+ name: 'Accumulated Depreciation',
114
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
115
+ description: 'Depreciation charged to date (a contra-asset account).',
116
+ },
117
+ {
118
+ code: '1090',
119
+ name: 'Security Deposits',
120
+ type: accounting_1.ACCOUNT_TYPE_ENUM.ASSET,
121
+ },
122
+ // ===================== Liabilities =====================
123
+ {
124
+ code: '2001',
125
+ name: 'Accounts Payable – Vendors',
126
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
127
+ },
128
+ {
129
+ code: '2011',
130
+ name: 'Accrued Salaries & Wages',
131
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
132
+ },
133
+ {
134
+ code: '2012',
135
+ name: 'Accrued Utilities',
136
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
137
+ },
138
+ {
139
+ code: '2021',
140
+ name: 'Net Wages Payable',
141
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
142
+ },
143
+ {
144
+ code: '2022',
145
+ name: 'Salary Tax Withheld Payable',
146
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
147
+ },
148
+ {
149
+ code: '2023',
150
+ name: 'EOBI / Social Security Payable',
151
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
152
+ },
153
+ {
154
+ code: '2030',
155
+ name: 'Tips Payable',
156
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
157
+ description: 'Tips collected but not yet distributed to staff.',
158
+ },
159
+ {
160
+ code: '2041',
161
+ name: 'GST Payable – Card Sales',
162
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
163
+ },
164
+ {
165
+ code: '2042',
166
+ name: 'GST Payable – Cash Sales',
167
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
168
+ },
169
+ {
170
+ code: '2043',
171
+ name: 'Provincial Services Tax Payable',
172
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
173
+ description: 'PRA / SRB / KPRA services tax collected.',
174
+ },
175
+ {
176
+ code: '2044',
177
+ name: 'FBR POS Invoice Tax Payable',
178
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
179
+ },
180
+ {
181
+ code: '2050',
182
+ name: 'Gift Card & Voucher Liability',
183
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
184
+ description: 'Prepaid gift cards / vouchers not yet redeemed.',
185
+ },
186
+ {
187
+ code: '2060',
188
+ name: 'Customer Advances / Deposits',
189
+ type: accounting_1.ACCOUNT_TYPE_ENUM.LIABILITY,
190
+ },
191
+ // ===================== Equity =====================
192
+ {
193
+ code: '3001',
194
+ name: "Owner's Capital",
195
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EQUITY,
196
+ },
197
+ {
198
+ code: '3002',
199
+ name: "Owner's Drawings",
200
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EQUITY,
201
+ },
202
+ {
203
+ code: '3003',
204
+ name: 'Retained Earnings',
205
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EQUITY,
206
+ },
207
+ {
208
+ code: '3099',
209
+ name: 'Opening Balance Equity',
210
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EQUITY,
211
+ description: 'Balancing account used by opening balances entry.',
212
+ },
213
+ // ===================== Revenue =====================
214
+ {
215
+ code: '4001',
216
+ name: 'Food Sales',
217
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
218
+ },
219
+ {
220
+ code: '4002',
221
+ name: 'Beverage Sales',
222
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
223
+ },
224
+ {
225
+ code: '4003',
226
+ name: 'Delivery Sales – Own',
227
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
228
+ },
229
+ {
230
+ code: '4004',
231
+ name: 'Delivery Sales – Platforms',
232
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
233
+ },
234
+ {
235
+ code: '4005',
236
+ name: 'Catering & Events Sales',
237
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
238
+ },
239
+ {
240
+ code: '4010',
241
+ name: 'Service Fee Income',
242
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
243
+ },
244
+ {
245
+ code: '4011',
246
+ name: 'Delivery & Rider Income',
247
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
248
+ },
249
+ {
250
+ code: '4012',
251
+ name: 'Surcharge Income',
252
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
253
+ },
254
+ {
255
+ code: '4090',
256
+ name: 'Sales Discounts',
257
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
258
+ description: 'Discounts given — a contra-revenue account.',
259
+ },
260
+ {
261
+ code: '4091',
262
+ name: 'Complimentary / Comps',
263
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
264
+ description: 'Complimentary meals — a contra-revenue account.',
265
+ },
266
+ {
267
+ code: '4092',
268
+ name: 'Sales Returns & Refunds',
269
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
270
+ description: 'Refunds and returns — a contra-revenue account.',
271
+ },
272
+ // ===================== Cost of Sales =====================
273
+ {
274
+ code: '5001',
275
+ name: 'Food Cost',
276
+ type: accounting_1.ACCOUNT_TYPE_ENUM.COGS,
277
+ },
278
+ {
279
+ code: '5002',
280
+ name: 'Beverage Cost',
281
+ type: accounting_1.ACCOUNT_TYPE_ENUM.COGS,
282
+ },
283
+ {
284
+ code: '5003',
285
+ name: 'Packaging Cost',
286
+ type: accounting_1.ACCOUNT_TYPE_ENUM.COGS,
287
+ },
288
+ {
289
+ code: '5010',
290
+ name: 'Inventory Wastage & Spoilage',
291
+ type: accounting_1.ACCOUNT_TYPE_ENUM.COGS,
292
+ },
293
+ {
294
+ code: '5011',
295
+ name: 'Inventory Shrinkage',
296
+ type: accounting_1.ACCOUNT_TYPE_ENUM.COGS,
297
+ },
298
+ {
299
+ code: '5012',
300
+ name: 'Inventory Adjustment Gain / Loss',
301
+ type: accounting_1.ACCOUNT_TYPE_ENUM.COGS,
302
+ },
303
+ // ===================== Expenses =====================
304
+ {
305
+ code: '6001',
306
+ name: 'Salaries & Wages',
307
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
308
+ },
309
+ {
310
+ code: '6002',
311
+ name: 'Overtime',
312
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
313
+ },
314
+ {
315
+ code: '6003',
316
+ name: 'Staff Meals & Amenities',
317
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
318
+ },
319
+ {
320
+ code: '6010',
321
+ name: 'Rent & Rentals',
322
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
323
+ },
324
+ {
325
+ code: '6020',
326
+ name: 'Utilities',
327
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
328
+ description: 'Electricity, gas, water, internet.',
329
+ },
330
+ {
331
+ code: '6031',
332
+ name: 'Platform Commissions',
333
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
334
+ description: 'Commissions deducted by delivery platforms.',
335
+ },
336
+ {
337
+ code: '6032',
338
+ name: 'Ads & Social Media',
339
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
340
+ },
341
+ {
342
+ code: '6033',
343
+ name: 'Promotions & Campaigns',
344
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
345
+ },
346
+ {
347
+ code: '6034',
348
+ name: 'Loyalty & Rewards Cost',
349
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
350
+ },
351
+ {
352
+ code: '6041',
353
+ name: 'Rider Payouts',
354
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
355
+ },
356
+ {
357
+ code: '6042',
358
+ name: 'Fuel & Vehicle',
359
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
360
+ },
361
+ {
362
+ code: '6050',
363
+ name: 'Repairs & Maintenance',
364
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
365
+ },
366
+ {
367
+ code: '6060',
368
+ name: 'Cleaning & Housekeeping Supplies',
369
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
370
+ },
371
+ {
372
+ code: '6070',
373
+ name: 'Licenses, Permits & Government Fees',
374
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
375
+ },
376
+ {
377
+ code: '6080',
378
+ name: 'Insurance',
379
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
380
+ },
381
+ {
382
+ code: '6091',
383
+ name: 'Payment Processing Fees',
384
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
385
+ },
386
+ {
387
+ code: '6092',
388
+ name: 'Bank Charges',
389
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
390
+ },
391
+ {
392
+ code: '6100',
393
+ name: 'Software & Subscriptions',
394
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
395
+ },
396
+ {
397
+ code: '6110',
398
+ name: 'Professional Fees',
399
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
400
+ description: 'Accounting, legal and consultancy fees.',
401
+ },
402
+ {
403
+ code: '6120',
404
+ name: 'Training & Recruitment',
405
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
406
+ },
407
+ {
408
+ code: '6130',
409
+ name: 'Office & Miscellaneous Expenses',
410
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
411
+ },
412
+ {
413
+ code: '6140',
414
+ name: 'Depreciation Expense',
415
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
416
+ },
417
+ // ================ Other Income & Expenses ================
418
+ {
419
+ code: '7001',
420
+ name: 'Cash Over / Short',
421
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
422
+ description: 'Day-close cash drawer variances.',
423
+ },
424
+ {
425
+ code: '7002',
426
+ name: 'Interest Expense',
427
+ type: accounting_1.ACCOUNT_TYPE_ENUM.EXPENSE,
428
+ },
429
+ {
430
+ code: '7003',
431
+ name: 'Other Income',
432
+ type: accounting_1.ACCOUNT_TYPE_ENUM.INCOME,
433
+ },
434
+ ];
@@ -1,3 +1,4 @@
1
+ export * from './accounting-templates';
1
2
  export * from './ANALYTICS';
2
3
  export * from './API_ERRORS';
3
4
  export * from './COMMON';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./accounting-templates"), exports);
17
18
  __exportStar(require("./ANALYTICS"), exports);
18
19
  __exportStar(require("./API_ERRORS"), exports);
19
20
  __exportStar(require("./COMMON"), exports);
@@ -217,9 +217,7 @@ function accumulateOrderPrepTime({ order, context, tenantDefaultMinutes = null,
217
217
  // order-line id is a DIFFERENT identity and is preserved as line_id, so
218
218
  // two lines of one menu item remain two served events.
219
219
  const lineId = item?._id != null ? String(item._id) : null;
220
- const catalogueItemId = item?.item_id != null && String(item.item_id) !== ''
221
- ? String(item.item_id)
222
- : lineId;
220
+ const catalogueItemId = item?.item_id != null && String(item.item_id) !== '' ? String(item.item_id) : lineId;
223
221
  const row = {
224
222
  entry_key: (0, exports.buildMaterializedPrepTimeEntryKey)(catalogueItemId, lineId),
225
223
  order_id: orderId,
@@ -205,9 +205,7 @@ function matchesMaterializedPrepTimeReadFilters(row, filters) {
205
205
  if (platforms != null && platforms.length > 0 && !platforms.includes(asString(row.platform))) {
206
206
  return false;
207
207
  }
208
- if (orderStatuses != null &&
209
- orderStatuses.length > 0 &&
210
- !orderStatuses.includes(asString(row.order_status))) {
208
+ if (orderStatuses != null && orderStatuses.length > 0 && !orderStatuses.includes(asString(row.order_status))) {
211
209
  return false;
212
210
  }
213
211
  if (categoryNames != null && categoryNames.length > 0) {
@@ -448,8 +446,7 @@ function groupMaterializedPrepTimeItemRows(rows, filters) {
448
446
  }
449
447
  /** True when `value` is one of the frozen item sort modes. */
450
448
  function isMaterializedPrepTimeItemSort(value) {
451
- return (typeof value === 'string' &&
452
- materialized_reports_apis_1.ALL_MATERIALIZED_PREP_TIME_ITEM_SORTS.includes(value));
449
+ return typeof value === 'string' && materialized_reports_apis_1.ALL_MATERIALIZED_PREP_TIME_ITEM_SORTS.includes(value);
453
450
  }
454
451
  /** The sort value of one item row (the cursor stores it verbatim). */
455
452
  function getMaterializedPrepTimeItemSortValue(row, sort) {
@@ -506,9 +503,7 @@ function compareMaterializedPrepTimeItemRows(a, b, sort) {
506
503
  }
507
504
  /** Stable sort (never mutates the input array). */
508
505
  function sortMaterializedPrepTimeItemRows(rows, sort) {
509
- const mode = isMaterializedPrepTimeItemSort(sort)
510
- ? sort
511
- : materialized_reports_apis_1.DEFAULT_MATERIALIZED_PREP_TIME_ITEM_SORT;
506
+ const mode = isMaterializedPrepTimeItemSort(sort) ? sort : materialized_reports_apis_1.DEFAULT_MATERIALIZED_PREP_TIME_ITEM_SORT;
512
507
  return (Array.isArray(rows) ? rows : []).slice().sort((a, b) => {
513
508
  const compared = compareSortValues(getMaterializedPrepTimeItemSortValue(a, mode), getMaterializedPrepTimeItemSortValue(b, mode), mode);
514
509
  if (compared !== 0)
@@ -527,9 +522,7 @@ const compareItemToCursor = (row, sort, cursor) => {
527
522
  * row can be duplicated or skipped between pages.
528
523
  */
529
524
  function getMaterializedPrepTimeItemPage(rows, sort, cursor, limit = 25) {
530
- const mode = isMaterializedPrepTimeItemSort(sort)
531
- ? sort
532
- : materialized_reports_apis_1.DEFAULT_MATERIALIZED_PREP_TIME_ITEM_SORT;
525
+ const mode = isMaterializedPrepTimeItemSort(sort) ? sort : materialized_reports_apis_1.DEFAULT_MATERIALIZED_PREP_TIME_ITEM_SORT;
533
526
  const size = Number.isFinite(limit) && limit > 0 ? Math.floor(limit) : 0;
534
527
  const all = Array.isArray(rows) ? rows : [];
535
528
  const remaining = cursor == null ? all.slice() : all.filter((row) => compareItemToCursor(row, mode, cursor) > 0);
@@ -553,9 +546,7 @@ function getMaterializedPrepTimeItemPage(rows, sort, cursor, limit = 25) {
553
546
  function buildMaterializedPrepTimeItemsPage(args) {
554
547
  const filtered = applyMaterializedPrepTimeReadFilters(args.rows, args.filters);
555
548
  const coverage = buildMaterializedPrepTimeCoverage(applyMaterializedPrepTimeReadFilters(args.rows, (0, exports.withoutMaterializedPrepTimeAnchorFilter)(args.filters)));
556
- const sort = isMaterializedPrepTimeItemSort(args.sort)
557
- ? args.sort
558
- : materialized_reports_apis_1.DEFAULT_MATERIALIZED_PREP_TIME_ITEM_SORT;
549
+ const sort = isMaterializedPrepTimeItemSort(args.sort) ? args.sort : materialized_reports_apis_1.DEFAULT_MATERIALIZED_PREP_TIME_ITEM_SORT;
559
550
  const grouped = groupMaterializedPrepTimeItemRows(filtered);
560
551
  const sorted = sortMaterializedPrepTimeItemRows(grouped, sort);
561
552
  const page = getMaterializedPrepTimeItemPage(sorted, sort, args.cursor ?? null, args.limit ?? 25);
@@ -7,12 +7,12 @@ export declare const ExpenseCategorySchema: Schema<any, import("mongoose").Model
7
7
  createdAt: NativeDate;
8
8
  updatedAt: NativeDate;
9
9
  } & {
10
+ description: string;
10
11
  _id: import("mongoose").Types.ObjectId;
11
12
  name: string;
12
13
  createdAt: NativeDate;
13
14
  updatedAt: NativeDate;
14
15
  sort_id: number;
15
- description: string;
16
16
  tenant_id: string;
17
17
  sub_categories: import("mongoose").Types.DocumentArray<{
18
18
  _id: import("mongoose").Types.ObjectId;
@@ -31,12 +31,12 @@ export declare const ExpenseCategorySchema: Schema<any, import("mongoose").Model
31
31
  createdAt: NativeDate;
32
32
  updatedAt: NativeDate;
33
33
  } & {
34
+ description: string;
34
35
  _id: import("mongoose").Types.ObjectId;
35
36
  name: string;
36
37
  createdAt: NativeDate;
37
38
  updatedAt: NativeDate;
38
39
  sort_id: number;
39
- description: string;
40
40
  tenant_id: string;
41
41
  sub_categories: import("mongoose").Types.DocumentArray<{
42
42
  _id: import("mongoose").Types.ObjectId;
@@ -55,12 +55,12 @@ export declare const ExpenseCategorySchema: Schema<any, import("mongoose").Model
55
55
  createdAt: NativeDate;
56
56
  updatedAt: NativeDate;
57
57
  } & {
58
+ description: string;
58
59
  _id: import("mongoose").Types.ObjectId;
59
60
  name: string;
60
61
  createdAt: NativeDate;
61
62
  updatedAt: NativeDate;
62
63
  sort_id: number;
63
- description: string;
64
64
  tenant_id: string;
65
65
  sub_categories: import("mongoose").Types.DocumentArray<{
66
66
  _id: import("mongoose").Types.ObjectId;
@@ -7,10 +7,10 @@ export declare const ExpenseDetailsSchema: Schema<any, import("mongoose").Model<
7
7
  createdAt: NativeDate;
8
8
  updatedAt: NativeDate;
9
9
  } & {
10
+ description: string;
10
11
  _id: import("mongoose").Types.ObjectId;
11
12
  createdAt: NativeDate;
12
13
  updatedAt: NativeDate;
13
- description: string;
14
14
  tenant_id: string;
15
15
  createdAt_mins: number;
16
16
  amount: number;
@@ -31,10 +31,10 @@ export declare const ExpenseDetailsSchema: Schema<any, import("mongoose").Model<
31
31
  createdAt: NativeDate;
32
32
  updatedAt: NativeDate;
33
33
  } & {
34
+ description: string;
34
35
  _id: import("mongoose").Types.ObjectId;
35
36
  createdAt: NativeDate;
36
37
  updatedAt: NativeDate;
37
- description: string;
38
38
  tenant_id: string;
39
39
  createdAt_mins: number;
40
40
  amount: number;
@@ -55,10 +55,10 @@ export declare const ExpenseDetailsSchema: Schema<any, import("mongoose").Model<
55
55
  createdAt: NativeDate;
56
56
  updatedAt: NativeDate;
57
57
  } & {
58
+ description: string;
58
59
  _id: import("mongoose").Types.ObjectId;
59
60
  createdAt: NativeDate;
60
61
  updatedAt: NativeDate;
61
- description: string;
62
62
  tenant_id: string;
63
63
  createdAt_mins: number;
64
64
  amount: number;
@@ -8,6 +8,7 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
8
8
  createdAt: NativeDate;
9
9
  updatedAt: NativeDate;
10
10
  } & {
11
+ description: string;
11
12
  code: string;
12
13
  _id: import("mongoose").Types.ObjectId;
13
14
  name: string;
@@ -16,7 +17,6 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
16
17
  brand_id: string;
17
18
  tenants: string[];
18
19
  active: boolean;
19
- description: string;
20
20
  reward_type: GIFT_CARD_REWARD_TYPE_ENUM;
21
21
  used_count: number;
22
22
  assigned_count: number;
@@ -142,6 +142,7 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
142
142
  createdAt: NativeDate;
143
143
  updatedAt: NativeDate;
144
144
  } & {
145
+ description: string;
145
146
  code: string;
146
147
  _id: import("mongoose").Types.ObjectId;
147
148
  name: string;
@@ -150,7 +151,6 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
150
151
  brand_id: string;
151
152
  tenants: string[];
152
153
  active: boolean;
153
- description: string;
154
154
  reward_type: GIFT_CARD_REWARD_TYPE_ENUM;
155
155
  used_count: number;
156
156
  assigned_count: number;
@@ -276,6 +276,7 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
276
276
  createdAt: NativeDate;
277
277
  updatedAt: NativeDate;
278
278
  } & {
279
+ description: string;
279
280
  code: string;
280
281
  _id: import("mongoose").Types.ObjectId;
281
282
  name: string;
@@ -284,7 +285,6 @@ export declare const GiftCardsSchema: Schema<any, import("mongoose").Model<any,
284
285
  brand_id: string;
285
286
  tenants: string[];
286
287
  active: boolean;
287
- description: string;
288
288
  reward_type: GIFT_CARD_REWARD_TYPE_ENUM;
289
289
  used_count: number;
290
290
  assigned_count: number;
@@ -26,6 +26,7 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
26
26
  createdAt: NativeDate;
27
27
  updatedAt: NativeDate;
28
28
  } & {
29
+ description: string;
29
30
  _id: import("mongoose").Types.ObjectId;
30
31
  name: string;
31
32
  image_url: string;
@@ -175,7 +176,6 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
175
176
  BASE_PRICE: number;
176
177
  };
177
178
  }>;
178
- description: string;
179
179
  discount_amount: {
180
180
  "POS_WALK-IN": number;
181
181
  "POS_TAKE-AWAY": number;
@@ -571,6 +571,7 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
571
571
  createdAt: NativeDate;
572
572
  updatedAt: NativeDate;
573
573
  } & {
574
+ description: string;
574
575
  _id: import("mongoose").Types.ObjectId;
575
576
  name: string;
576
577
  image_url: string;
@@ -720,7 +721,6 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
720
721
  BASE_PRICE: number;
721
722
  };
722
723
  }>;
723
- description: string;
724
724
  discount_amount: {
725
725
  "POS_WALK-IN": number;
726
726
  "POS_TAKE-AWAY": number;
@@ -1116,6 +1116,7 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
1116
1116
  createdAt: NativeDate;
1117
1117
  updatedAt: NativeDate;
1118
1118
  } & {
1119
+ description: string;
1119
1120
  _id: import("mongoose").Types.ObjectId;
1120
1121
  name: string;
1121
1122
  image_url: string;
@@ -1265,7 +1266,6 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
1265
1266
  BASE_PRICE: number;
1266
1267
  };
1267
1268
  }>;
1268
- description: string;
1269
1269
  discount_amount: {
1270
1270
  "POS_WALK-IN": number;
1271
1271
  "POS_TAKE-AWAY": number;