@managesome/eposmatic-toolkit 0.4.9 → 0.4.10

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 (333) hide show
  1. package/esm/constants/MATERIALIZED_REPORTS.js +448 -0
  2. package/esm/helpers/index.js +3 -0
  3. package/esm/helpers/materialized-reports/index.js +32 -0
  4. package/esm/helpers/materialized-reports/materialized-cash-accumulator-helpers.js +114 -0
  5. package/esm/helpers/materialized-reports/materialized-cash-classification-helpers.js +286 -0
  6. package/esm/helpers/materialized-reports/materialized-cash-close-day-helpers.js +396 -0
  7. package/esm/helpers/materialized-reports/materialized-cash-compile-helpers.js +244 -0
  8. package/esm/helpers/materialized-reports/materialized-delivery-accumulator-helpers.js +170 -0
  9. package/esm/helpers/materialized-reports/materialized-delivery-classification-helpers.js +426 -0
  10. package/esm/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +372 -0
  11. package/esm/helpers/materialized-reports/materialized-delivery-compile-helpers.js +214 -0
  12. package/esm/helpers/materialized-reports/materialized-discount-accumulator-helpers.js +318 -0
  13. package/esm/helpers/materialized-reports/materialized-discount-classification-helpers.js +213 -0
  14. package/esm/helpers/materialized-reports/materialized-discount-close-day-helpers.js +604 -0
  15. package/esm/helpers/materialized-reports/materialized-discount-compile-helpers.js +186 -0
  16. package/esm/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.js +155 -0
  17. package/esm/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.js +199 -0
  18. package/esm/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.js +111 -0
  19. package/esm/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.js +88 -0
  20. package/esm/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.js +394 -0
  21. package/esm/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.js +167 -0
  22. package/esm/helpers/materialized-reports/materialized-prep-time-classification-helpers.js +215 -0
  23. package/esm/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +476 -0
  24. package/esm/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +201 -0
  25. package/esm/helpers/materialized-reports/materialized-reports-selection-helpers.js +7 -0
  26. package/esm/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.js +189 -0
  27. package/esm/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.js +157 -0
  28. package/esm/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.js +588 -0
  29. package/esm/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.js +175 -0
  30. package/esm/helpers/materialized-reports/tenant-cash-in-out-formatter.js +156 -0
  31. package/esm/helpers/materialized-reports/tenant-delivery-formatter.js +230 -0
  32. package/esm/helpers/materialized-reports/tenant-discount-formatter.js +427 -0
  33. package/esm/helpers/materialized-reports/tenant-hourly-comparison-formatter.js +237 -0
  34. package/esm/helpers/materialized-reports/tenant-payments-comparison-formatter.js +279 -0
  35. package/esm/helpers/materialized-reports/tenant-prep-time-formatter.js +228 -0
  36. package/esm/helpers/materialized-reports/tenant-sales-comparison-formatter.js +343 -0
  37. package/esm/helpers/reporting-contract/index.js +2 -0
  38. package/esm/helpers/reporting-contract/overview-contract.js +122 -0
  39. package/esm/helpers/reporting-contract/report-contract.js +228 -0
  40. package/esm/helpers/rider-earnings/index.js +1 -0
  41. package/esm/helpers/rider-earnings/rider-earnings.js +59 -0
  42. package/esm/helpers/rider-reports/index.js +2 -0
  43. package/esm/helpers/rider-reports/rider-daily-report.js +90 -0
  44. package/esm/helpers/rider-reports/rider-report.js +67 -0
  45. package/esm/schemas/models/deliveries.js +75 -0
  46. package/esm/schemas/models/index.js +15 -0
  47. package/esm/schemas/models/materialized_rider_daily_reports.js +39 -0
  48. package/esm/schemas/models/materialized_tenant_cash_entries.js +95 -0
  49. package/esm/schemas/models/materialized_tenant_cash_reports.js +77 -0
  50. package/esm/schemas/models/materialized_tenant_delivery_entries.js +63 -0
  51. package/esm/schemas/models/materialized_tenant_delivery_reports.js +63 -0
  52. package/esm/schemas/models/materialized_tenant_discount_entries.js +156 -0
  53. package/esm/schemas/models/materialized_tenant_discount_reports.js +333 -0
  54. package/esm/schemas/models/materialized_tenant_hourly_comparison_entries.js +87 -0
  55. package/esm/schemas/models/materialized_tenant_hourly_comparison_reports.js +99 -0
  56. package/esm/schemas/models/materialized_tenant_payments_comparison_entries.js +71 -0
  57. package/esm/schemas/models/materialized_tenant_payments_comparison_reports.js +76 -0
  58. package/esm/schemas/models/materialized_tenant_prep_time_entries.js +130 -0
  59. package/esm/schemas/models/materialized_tenant_prep_time_reports.js +109 -0
  60. package/esm/schemas/models/materialized_tenant_sales_comparison_entries.js +130 -0
  61. package/esm/schemas/models/materialized_tenant_sales_comparison_reports.js +154 -0
  62. package/esm/schemas/types/index.js +15 -0
  63. package/esm/schemas/types/materialized_rider_daily_reports.js +1 -0
  64. package/esm/schemas/types/materialized_tenant_cash_entries.js +1 -0
  65. package/esm/schemas/types/materialized_tenant_cash_reports.js +1 -0
  66. package/esm/schemas/types/materialized_tenant_delivery_entries.js +1 -0
  67. package/esm/schemas/types/materialized_tenant_delivery_reports.js +1 -0
  68. package/esm/schemas/types/materialized_tenant_discount_entries.js +1 -0
  69. package/esm/schemas/types/materialized_tenant_discount_reports.js +2 -0
  70. package/esm/schemas/types/materialized_tenant_hourly_comparison_entries.js +1 -0
  71. package/esm/schemas/types/materialized_tenant_hourly_comparison_reports.js +1 -0
  72. package/esm/schemas/types/materialized_tenant_payments_comparison_entries.js +1 -0
  73. package/esm/schemas/types/materialized_tenant_payments_comparison_reports.js +11 -0
  74. package/esm/schemas/types/materialized_tenant_prep_time_entries.js +1 -0
  75. package/esm/schemas/types/materialized_tenant_prep_time_reports.js +1 -0
  76. package/esm/schemas/types/materialized_tenant_sales_comparison_entries.js +1 -0
  77. package/esm/schemas/types/materialized_tenant_sales_comparison_reports.js +14 -0
  78. package/lib/constants/MATERIALIZED_REPORTS.d.ts +339 -2
  79. package/lib/constants/MATERIALIZED_REPORTS.js +450 -1
  80. package/lib/helpers/index.d.ts +3 -0
  81. package/lib/helpers/index.js +3 -0
  82. package/lib/helpers/materialized-reports/index.d.ts +32 -0
  83. package/lib/helpers/materialized-reports/index.js +32 -0
  84. package/lib/helpers/materialized-reports/materialized-cash-accumulator-helpers.d.ts +18 -0
  85. package/lib/helpers/materialized-reports/materialized-cash-accumulator-helpers.js +118 -0
  86. package/lib/helpers/materialized-reports/materialized-cash-classification-helpers.d.ts +90 -0
  87. package/lib/helpers/materialized-reports/materialized-cash-classification-helpers.js +295 -0
  88. package/lib/helpers/materialized-reports/materialized-cash-close-day-helpers.d.ts +102 -0
  89. package/lib/helpers/materialized-reports/materialized-cash-close-day-helpers.js +409 -0
  90. package/lib/helpers/materialized-reports/materialized-cash-compile-helpers.d.ts +72 -0
  91. package/lib/helpers/materialized-reports/materialized-cash-compile-helpers.js +251 -0
  92. package/lib/helpers/materialized-reports/materialized-delivery-accumulator-helpers.d.ts +7 -0
  93. package/lib/helpers/materialized-reports/materialized-delivery-accumulator-helpers.js +173 -0
  94. package/lib/helpers/materialized-reports/materialized-delivery-classification-helpers.d.ts +84 -0
  95. package/lib/helpers/materialized-reports/materialized-delivery-classification-helpers.js +438 -0
  96. package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.d.ts +97 -0
  97. package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +385 -0
  98. package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.d.ts +40 -0
  99. package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.js +218 -0
  100. package/lib/helpers/materialized-reports/materialized-discount-accumulator-helpers.d.ts +52 -0
  101. package/lib/helpers/materialized-reports/materialized-discount-accumulator-helpers.js +324 -0
  102. package/lib/helpers/materialized-reports/materialized-discount-classification-helpers.d.ts +50 -0
  103. package/lib/helpers/materialized-reports/materialized-discount-classification-helpers.js +222 -0
  104. package/lib/helpers/materialized-reports/materialized-discount-close-day-helpers.d.ts +182 -0
  105. package/lib/helpers/materialized-reports/materialized-discount-close-day-helpers.js +615 -0
  106. package/lib/helpers/materialized-reports/materialized-discount-compile-helpers.d.ts +47 -0
  107. package/lib/helpers/materialized-reports/materialized-discount-compile-helpers.js +193 -0
  108. package/lib/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.d.ts +64 -0
  109. package/lib/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.js +163 -0
  110. package/lib/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.d.ts +61 -0
  111. package/lib/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.js +207 -0
  112. package/lib/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.d.ts +23 -0
  113. package/lib/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.js +116 -0
  114. package/lib/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.d.ts +25 -0
  115. package/lib/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.js +98 -0
  116. package/lib/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.d.ts +79 -0
  117. package/lib/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.js +407 -0
  118. package/lib/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.d.ts +35 -0
  119. package/lib/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.js +173 -0
  120. package/lib/helpers/materialized-reports/materialized-prep-time-classification-helpers.d.ts +66 -0
  121. package/lib/helpers/materialized-reports/materialized-prep-time-classification-helpers.js +224 -0
  122. package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.d.ts +128 -0
  123. package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +490 -0
  124. package/lib/helpers/materialized-reports/materialized-prep-time-compile-helpers.d.ts +46 -0
  125. package/lib/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +208 -0
  126. package/lib/helpers/materialized-reports/materialized-reports-selection-helpers.d.ts +8 -0
  127. package/lib/helpers/materialized-reports/materialized-reports-selection-helpers.js +8 -1
  128. package/lib/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.d.ts +48 -0
  129. package/lib/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.js +204 -0
  130. package/lib/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.d.ts +22 -0
  131. package/lib/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.js +161 -0
  132. package/lib/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.d.ts +163 -0
  133. package/lib/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.js +603 -0
  134. package/lib/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.d.ts +68 -0
  135. package/lib/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.js +182 -0
  136. package/lib/helpers/materialized-reports/tenant-cash-in-out-formatter.d.ts +98 -0
  137. package/lib/helpers/materialized-reports/tenant-cash-in-out-formatter.js +159 -0
  138. package/lib/helpers/materialized-reports/tenant-delivery-formatter.d.ts +133 -0
  139. package/lib/helpers/materialized-reports/tenant-delivery-formatter.js +233 -0
  140. package/lib/helpers/materialized-reports/tenant-discount-formatter.d.ts +114 -0
  141. package/lib/helpers/materialized-reports/tenant-discount-formatter.js +431 -0
  142. package/lib/helpers/materialized-reports/tenant-hourly-comparison-formatter.d.ts +60 -0
  143. package/lib/helpers/materialized-reports/tenant-hourly-comparison-formatter.js +243 -0
  144. package/lib/helpers/materialized-reports/tenant-payments-comparison-formatter.d.ts +75 -0
  145. package/lib/helpers/materialized-reports/tenant-payments-comparison-formatter.js +286 -0
  146. package/lib/helpers/materialized-reports/tenant-prep-time-formatter.d.ts +97 -0
  147. package/lib/helpers/materialized-reports/tenant-prep-time-formatter.js +232 -0
  148. package/lib/helpers/materialized-reports/tenant-sales-comparison-formatter.d.ts +105 -0
  149. package/lib/helpers/materialized-reports/tenant-sales-comparison-formatter.js +349 -0
  150. package/lib/helpers/reporting-contract/index.d.ts +2 -0
  151. package/lib/helpers/reporting-contract/index.js +18 -0
  152. package/lib/helpers/reporting-contract/overview-contract.d.ts +55 -0
  153. package/lib/helpers/reporting-contract/overview-contract.js +126 -0
  154. package/lib/helpers/reporting-contract/report-contract.d.ts +159 -0
  155. package/lib/helpers/reporting-contract/report-contract.js +239 -0
  156. package/lib/helpers/rider-earnings/index.d.ts +1 -0
  157. package/lib/helpers/rider-earnings/index.js +17 -0
  158. package/lib/helpers/rider-earnings/rider-earnings.d.ts +58 -0
  159. package/lib/helpers/rider-earnings/rider-earnings.js +64 -0
  160. package/lib/helpers/rider-reports/index.d.ts +2 -0
  161. package/lib/helpers/rider-reports/index.js +18 -0
  162. package/lib/helpers/rider-reports/rider-daily-report.d.ts +26 -0
  163. package/lib/helpers/rider-reports/rider-daily-report.js +93 -0
  164. package/lib/helpers/rider-reports/rider-report.d.ts +49 -0
  165. package/lib/helpers/rider-reports/rider-report.js +70 -0
  166. package/lib/helpers/types/materialized-reports-apis.d.ts +297 -1
  167. package/lib/schemas/models/deliveries.d.ts +54 -0
  168. package/lib/schemas/models/deliveries.js +75 -0
  169. package/lib/schemas/models/expense_details.d.ts +3 -3
  170. package/lib/schemas/models/index.d.ts +15 -0
  171. package/lib/schemas/models/index.js +15 -0
  172. package/lib/schemas/models/materialized_rider_daily_reports.d.ts +27 -0
  173. package/lib/schemas/models/materialized_rider_daily_reports.js +42 -0
  174. package/lib/schemas/models/materialized_tenant_cash_entries.d.ts +181 -0
  175. package/lib/schemas/models/materialized_tenant_cash_entries.js +98 -0
  176. package/lib/schemas/models/materialized_tenant_cash_reports.d.ts +111 -0
  177. package/lib/schemas/models/materialized_tenant_cash_reports.js +80 -0
  178. package/lib/schemas/models/materialized_tenant_delivery_entries.d.ts +98 -0
  179. package/lib/schemas/models/materialized_tenant_delivery_entries.js +66 -0
  180. package/lib/schemas/models/materialized_tenant_delivery_reports.d.ts +98 -0
  181. package/lib/schemas/models/materialized_tenant_delivery_reports.js +66 -0
  182. package/lib/schemas/models/materialized_tenant_discount_entries.d.ts +199 -0
  183. package/lib/schemas/models/materialized_tenant_discount_entries.js +159 -0
  184. package/lib/schemas/models/materialized_tenant_discount_reports.d.ts +216 -0
  185. package/lib/schemas/models/materialized_tenant_discount_reports.js +336 -0
  186. package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.d.ts +95 -0
  187. package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.js +82 -0
  188. package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.d.ts +105 -0
  189. package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.js +91 -0
  190. package/lib/schemas/models/materialized_tenant_payments_comparison_entries.d.ts +91 -0
  191. package/lib/schemas/models/materialized_tenant_payments_comparison_entries.js +70 -0
  192. package/lib/schemas/models/materialized_tenant_payments_comparison_reports.d.ts +98 -0
  193. package/lib/schemas/models/materialized_tenant_payments_comparison_reports.js +71 -0
  194. package/lib/schemas/models/materialized_tenant_prep_time_entries.d.ts +181 -0
  195. package/lib/schemas/models/materialized_tenant_prep_time_entries.js +133 -0
  196. package/lib/schemas/models/materialized_tenant_prep_time_reports.d.ts +118 -0
  197. package/lib/schemas/models/materialized_tenant_prep_time_reports.js +112 -0
  198. package/lib/schemas/models/materialized_tenant_sales_comparison_entries.d.ts +139 -0
  199. package/lib/schemas/models/materialized_tenant_sales_comparison_entries.js +120 -0
  200. package/lib/schemas/models/materialized_tenant_sales_comparison_reports.d.ts +167 -0
  201. package/lib/schemas/models/materialized_tenant_sales_comparison_reports.js +137 -0
  202. package/lib/schemas/models/tenant_purchase_order_vendor_returns.d.ts +3 -3
  203. package/lib/schemas/models/warehouse_internal_movements.d.ts +6 -6
  204. package/lib/schemas/models/warehouse_purchase_order_receipts.d.ts +3 -3
  205. package/lib/schemas/models/warehouse_purchase_order_vendor_returns.d.ts +3 -3
  206. package/lib/schemas/models/warehouse_sale_deliveries.d.ts +6 -6
  207. package/lib/schemas/models/warehouse_sale_invoices.d.ts +3 -3
  208. package/lib/schemas/types/deliveries.d.ts +40 -1
  209. package/lib/schemas/types/index.d.ts +15 -0
  210. package/lib/schemas/types/index.js +15 -0
  211. package/lib/schemas/types/materialized_rider_daily_reports.d.ts +37 -0
  212. package/lib/schemas/types/materialized_rider_daily_reports.js +2 -0
  213. package/lib/schemas/types/materialized_tenant_cash_entries.d.ts +87 -0
  214. package/lib/schemas/types/materialized_tenant_cash_entries.js +2 -0
  215. package/lib/schemas/types/materialized_tenant_cash_reports.d.ts +144 -0
  216. package/lib/schemas/types/materialized_tenant_cash_reports.js +2 -0
  217. package/lib/schemas/types/materialized_tenant_delivery_entries.d.ts +98 -0
  218. package/lib/schemas/types/materialized_tenant_delivery_entries.js +2 -0
  219. package/lib/schemas/types/materialized_tenant_delivery_reports.d.ts +179 -0
  220. package/lib/schemas/types/materialized_tenant_delivery_reports.js +2 -0
  221. package/lib/schemas/types/materialized_tenant_discount_entries.d.ts +81 -0
  222. package/lib/schemas/types/materialized_tenant_discount_entries.js +2 -0
  223. package/lib/schemas/types/materialized_tenant_discount_reports.d.ts +209 -0
  224. package/lib/schemas/types/materialized_tenant_discount_reports.js +3 -0
  225. package/lib/schemas/types/materialized_tenant_hourly_comparison_entries.d.ts +33 -0
  226. package/lib/schemas/types/materialized_tenant_hourly_comparison_entries.js +2 -0
  227. package/lib/schemas/types/materialized_tenant_hourly_comparison_reports.d.ts +40 -0
  228. package/lib/schemas/types/materialized_tenant_hourly_comparison_reports.js +2 -0
  229. package/lib/schemas/types/materialized_tenant_payments_comparison_entries.d.ts +48 -0
  230. package/lib/schemas/types/materialized_tenant_payments_comparison_entries.js +2 -0
  231. package/lib/schemas/types/materialized_tenant_payments_comparison_reports.d.ts +51 -0
  232. package/lib/schemas/types/materialized_tenant_payments_comparison_reports.js +14 -0
  233. package/lib/schemas/types/materialized_tenant_prep_time_entries.d.ts +88 -0
  234. package/lib/schemas/types/materialized_tenant_prep_time_entries.js +2 -0
  235. package/lib/schemas/types/materialized_tenant_prep_time_reports.d.ts +132 -0
  236. package/lib/schemas/types/materialized_tenant_prep_time_reports.js +2 -0
  237. package/lib/schemas/types/materialized_tenant_sales_comparison_entries.d.ts +43 -0
  238. package/lib/schemas/types/materialized_tenant_sales_comparison_entries.js +2 -0
  239. package/lib/schemas/types/materialized_tenant_sales_comparison_reports.d.ts +74 -0
  240. package/lib/schemas/types/materialized_tenant_sales_comparison_reports.js +17 -0
  241. package/lib/tests/materialized-reports/analytics-growth-helpers.test.d.ts +1 -0
  242. package/lib/tests/materialized-reports/analytics-overview-helpers.test.d.ts +1 -0
  243. package/lib/tests/materialized-reports/analytics-performance-helpers.test.d.ts +1 -0
  244. package/lib/tests/materialized-reports/fixtures.d.ts +15 -1
  245. package/lib/tests/materialized-reports/fixtures.js +1 -0
  246. package/lib/tests/materialized-reports/materialized-cash-compile.test.d.ts +1 -0
  247. package/lib/tests/materialized-reports/materialized-cash-compile.test.js +196 -0
  248. package/lib/tests/materialized-reports/materialized-cash-fold.test.d.ts +1 -0
  249. package/lib/tests/materialized-reports/materialized-cash-fold.test.js +116 -0
  250. package/lib/tests/materialized-reports/materialized-cash-formatter.test.d.ts +1 -0
  251. package/lib/tests/materialized-reports/materialized-cash-formatter.test.js +152 -0
  252. package/lib/tests/materialized-reports/materialized-cash-plan.test.d.ts +1 -0
  253. package/lib/tests/materialized-reports/materialized-cash-plan.test.js +168 -0
  254. package/lib/tests/materialized-reports/materialized-cash-reconciliation.test.d.ts +1 -0
  255. package/lib/tests/materialized-reports/materialized-cash-reconciliation.test.js +267 -0
  256. package/lib/tests/materialized-reports/materialized-delivery-accumulation.test.d.ts +1 -0
  257. package/lib/tests/materialized-reports/materialized-delivery-accumulation.test.js +147 -0
  258. package/lib/tests/materialized-reports/materialized-delivery-compile.test.d.ts +1 -0
  259. package/lib/tests/materialized-reports/materialized-delivery-compile.test.js +241 -0
  260. package/lib/tests/materialized-reports/materialized-delivery-fold.test.d.ts +1 -0
  261. package/lib/tests/materialized-reports/materialized-delivery-fold.test.js +109 -0
  262. package/lib/tests/materialized-reports/materialized-delivery-formatter.test.d.ts +1 -0
  263. package/lib/tests/materialized-reports/materialized-delivery-formatter.test.js +141 -0
  264. package/lib/tests/materialized-reports/materialized-delivery-plan.test.d.ts +1 -0
  265. package/lib/tests/materialized-reports/materialized-delivery-plan.test.js +198 -0
  266. package/lib/tests/materialized-reports/materialized-discount-aggregated-formatter.test.d.ts +1 -0
  267. package/lib/tests/materialized-reports/materialized-discount-aggregated-formatter.test.js +173 -0
  268. package/lib/tests/materialized-reports/materialized-discount-classification.test.d.ts +1 -0
  269. package/lib/tests/materialized-reports/materialized-discount-classification.test.js +339 -0
  270. package/lib/tests/materialized-reports/materialized-discount-close-day.test.d.ts +1 -0
  271. package/lib/tests/materialized-reports/materialized-discount-close-day.test.js +506 -0
  272. package/lib/tests/materialized-reports/materialized-discount-compile.test.d.ts +1 -0
  273. package/lib/tests/materialized-reports/materialized-discount-compile.test.js +161 -0
  274. package/lib/tests/materialized-reports/materialized-discount-counter-rows.test.d.ts +1 -0
  275. package/lib/tests/materialized-reports/materialized-discount-counter-rows.test.js +107 -0
  276. package/lib/tests/materialized-reports/materialized-discount-entries-accumulation.test.d.ts +1 -0
  277. package/lib/tests/materialized-reports/materialized-discount-entries-accumulation.test.js +125 -0
  278. package/lib/tests/materialized-reports/materialized-hourly-comparison-compile.test.d.ts +1 -0
  279. package/lib/tests/materialized-reports/materialized-hourly-comparison-compile.test.js +146 -0
  280. package/lib/tests/materialized-reports/materialized-hourly-comparison-formatter.test.d.ts +1 -0
  281. package/lib/tests/materialized-reports/materialized-hourly-comparison-formatter.test.js +127 -0
  282. package/lib/tests/materialized-reports/materialized-hourly-comparison-plan.test.d.ts +1 -0
  283. package/lib/tests/materialized-reports/materialized-hourly-comparison-plan.test.js +138 -0
  284. package/lib/tests/materialized-reports/materialized-hourly-comparison-selection.test.d.ts +1 -0
  285. package/lib/tests/materialized-reports/materialized-hourly-comparison-selection.test.js +90 -0
  286. package/lib/tests/materialized-reports/materialized-payments-comparison-compile.test.d.ts +1 -0
  287. package/lib/tests/materialized-reports/materialized-payments-comparison-compile.test.js +164 -0
  288. package/lib/tests/materialized-reports/materialized-payments-comparison-formatter.test.d.ts +1 -0
  289. package/lib/tests/materialized-reports/materialized-payments-comparison-formatter.test.js +117 -0
  290. package/lib/tests/materialized-reports/materialized-payments-comparison-plan.test.d.ts +1 -0
  291. package/lib/tests/materialized-reports/materialized-payments-comparison-plan.test.js +149 -0
  292. package/lib/tests/materialized-reports/materialized-prep-time-classification.test.d.ts +1 -0
  293. package/lib/tests/materialized-reports/materialized-prep-time-classification.test.js +273 -0
  294. package/lib/tests/materialized-reports/materialized-prep-time-close-day.test.d.ts +1 -0
  295. package/lib/tests/materialized-reports/materialized-prep-time-close-day.test.js +270 -0
  296. package/lib/tests/materialized-reports/materialized-prep-time-compile.test.d.ts +1 -0
  297. package/lib/tests/materialized-reports/materialized-prep-time-compile.test.js +217 -0
  298. package/lib/tests/materialized-reports/materialized-prep-time-constants.test.d.ts +1 -0
  299. package/lib/tests/materialized-reports/materialized-prep-time-constants.test.js +84 -0
  300. package/lib/tests/materialized-reports/materialized-prep-time-plan.test.d.ts +1 -0
  301. package/lib/tests/materialized-reports/materialized-prep-time-plan.test.js +176 -0
  302. package/lib/tests/materialized-reports/materialized-sales-comparison-baseline.test.d.ts +1 -0
  303. package/lib/tests/materialized-reports/materialized-sales-comparison-baseline.test.js +126 -0
  304. package/lib/tests/materialized-reports/materialized-sales-comparison-compile.test.d.ts +1 -0
  305. package/lib/tests/materialized-reports/materialized-sales-comparison-compile.test.js +206 -0
  306. package/lib/tests/materialized-reports/materialized-sales-comparison-formatter.test.d.ts +1 -0
  307. package/lib/tests/materialized-reports/materialized-sales-comparison-formatter.test.js +179 -0
  308. package/lib/tests/materialized-reports/materialized-sales-comparison-parity.test.d.ts +1 -0
  309. package/lib/tests/materialized-reports/materialized-sales-comparison-parity.test.js +196 -0
  310. package/lib/tests/materialized-reports/materialized-sales-comparison-plan.test.d.ts +1 -0
  311. package/lib/tests/materialized-reports/materialized-sales-comparison-plan.test.js +241 -0
  312. package/lib/tests/materialized-reports/materialized-tenant-hourly-comparison-schema.test.d.ts +1 -0
  313. package/lib/tests/materialized-reports/materialized-tenant-hourly-comparison-schema.test.js +96 -0
  314. package/lib/tests/materialized-reports/materialized-tenant-payments-comparison-schema.test.d.ts +1 -0
  315. package/lib/tests/materialized-reports/materialized-tenant-payments-comparison-schema.test.js +112 -0
  316. package/lib/tests/materialized-reports/materialized-tenant-sales-comparison-schema.test.d.ts +1 -0
  317. package/lib/tests/materialized-reports/materialized-tenant-sales-comparison-schema.test.js +142 -0
  318. package/lib/tests/materialized-reports/materialized-tenant-sales-overview-reports-schema.test.js +8 -1
  319. package/lib/tests/materialized-reports/sales-comparison-reference.d.ts +55 -0
  320. package/lib/tests/materialized-reports/sales-comparison-reference.js +86 -0
  321. package/lib/tests/materialized-reports/tenant-discount-formatter.test.d.ts +1 -0
  322. package/lib/tests/materialized-reports/tenant-discount-formatter.test.js +289 -0
  323. package/lib/tests/materialized-reports/tenant-prep-time-formatter.test.d.ts +1 -0
  324. package/lib/tests/materialized-reports/tenant-prep-time-formatter.test.js +354 -0
  325. package/lib/tests/reporting-contract.test.d.ts +1 -0
  326. package/lib/tests/reporting-contract.test.js +267 -0
  327. package/lib/tests/rider-daily-report.test.d.ts +1 -0
  328. package/lib/tests/rider-daily-report.test.js +86 -0
  329. package/lib/tests/rider-earnings.test.d.ts +1 -0
  330. package/lib/tests/rider-earnings.test.js +65 -0
  331. package/lib/tests/rider-report.test.d.ts +1 -0
  332. package/lib/tests/rider-report.test.js +98 -0
  333. package/package.json +10 -1
@@ -10,7 +10,8 @@
10
10
  * explicitly-enabled step.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.ALL_MATERIALIZED_REPORT_TYPES = exports.MATERIALIZED_REPORT_TYPE_ENUM = exports.ALL_MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPES = exports.MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM = exports.MATERIALIZED_CREDIT_SETTLEMENT_PAYMENT_TYPE = exports.SALES_OVERVIEW_KEY_FILTERS = exports.ALL_MATERIALIZED_REPORT_KEY_FILTERS = exports.MATERIALIZED_REPORT_KEY_FILTER_ENUM = exports.MATERIALIZED_CREDIT_BILLS_SCOPES = exports.MATERIALIZED_REPORT_SCOPES_WITH_DAY_INDEX = exports.ALL_MATERIALIZED_REPORT_SCOPES = exports.MATERIALIZED_REPORT_SCOPE_ENUM = void 0;
13
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_SCHEMA_VERSION = exports.SALES_COMPARISON_KEY_FILTERS = exports.MATERIALIZED_SALES_COMPARISON_REPORT_SCOPES = exports.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_NAME = exports.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_NAME = exports.ALL_MATERIALIZED_REPORT_TYPES = exports.MATERIALIZED_REPORT_TYPE_ENUM = exports.ALL_MATERIALIZED_PREP_TIME_TARGETS = exports.MATERIALIZED_PREP_TIME_TARGET_ENUM = exports.MATERIALIZED_PREP_TIME_ON_TIME_MAX_DELTA = exports.MATERIALIZED_PREP_TIME_TOP_BUCKET = exports.MATERIALIZED_PREP_TIME_MAX_MINUTES = exports.ALL_MATERIALIZED_PREP_TIME_BUCKET_LABELS = exports.MATERIALIZED_PREP_TIME_BUCKETS = exports.ALL_MATERIALIZED_PREP_TIME_ANCHORS = exports.MATERIALIZED_PREP_TIME_ANCHOR_ENUM = exports.PREP_TIME_KEY_FILTERS = exports.MATERIALIZED_PREP_TIME_REPORT_SCOPES = exports.MATERIALIZED_DELIVERY_AREA_LIMIT = exports.MATERIALIZED_DELIVERY_RIDER_LIMIT = exports.MATERIALIZED_DELIVERY_DISTANCE_BUCKETS = exports.DELIVERY_KEY_FILTERS = exports.MATERIALIZED_DELIVERY_REPORT_SCOPES = exports.MATERIALIZED_CASH_SOURCE_LIMIT = exports.CASH_KEY_FILTERS = exports.MATERIALIZED_CASH_REPORT_SCOPES = exports.ALL_MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPES = exports.MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM = exports.MATERIALIZED_CREDIT_SETTLEMENT_PAYMENT_TYPE = exports.MATERIALIZED_DISCOUNT_PRICE_OVERRIDE_PREFIX = exports.MATERIALIZED_DISCOUNT_MANUAL_PREFIX = exports.MATERIALIZED_DISCOUNT_SPECIAL_DISCOUNT_ID = exports.MATERIALIZED_DISCOUNT_SOURCE_LIMIT = exports.ALL_MATERIALIZED_DISCOUNT_LEVELS = exports.MATERIALIZED_DISCOUNT_LEVEL_ENUM = exports.ALL_MATERIALIZED_DISCOUNT_ENTRY_KINDS = exports.MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM = exports.ALL_MATERIALIZED_DISCOUNT_SUB_KINDS = exports.MATERIALIZED_DISCOUNT_SUB_KIND_ENUM = exports.ALL_MATERIALIZED_DISCOUNT_SLOTS = exports.MATERIALIZED_DISCOUNT_SLOT_ENUM = exports.DISCOUNTS_KEY_FILTERS = exports.MATERIALIZED_DISCOUNT_REPORT_SCOPES = exports.SALES_OVERVIEW_KEY_FILTERS = exports.ALL_MATERIALIZED_REPORT_KEY_FILTERS = exports.MATERIALIZED_REPORT_KEY_FILTER_ENUM = exports.MATERIALIZED_CREDIT_BILLS_SCOPES = exports.MATERIALIZED_REPORT_SCOPES_WITH_DAY_INDEX = exports.ALL_MATERIALIZED_REPORT_SCOPES = exports.MATERIALIZED_REPORT_SCOPE_ENUM = void 0;
14
+ exports.ALL_PAYMENTS_COMPARISON_METRICS = exports.PAYMENTS_COMPARISON_METRIC_ENUM = exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_SCHEMA_VERSION = exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_SCHEMA_VERSION = exports.PAYMENTS_COMPARISON_KEY_FILTERS = exports.MATERIALIZED_PAYMENTS_COMPARISON_REPORT_SCOPES = exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_NAME = exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_NAME = exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_SCHEMA_VERSION = exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_SCHEMA_VERSION = exports.HOURLY_COMPARISON_KEY_FILTERS = exports.MATERIALIZED_HOURLY_COMPARISON_REPORT_SCOPES = exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_NAME = exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_NAME = exports.ALL_SALES_COMPARISON_METRICS = exports.SALES_COMPARISON_METRIC_ENUM = exports.ALL_SALES_COMPARISON_BASELINES = exports.SALES_COMPARISON_BASELINE_ENUM = exports.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_SCHEMA_VERSION = void 0;
14
15
  /**
15
16
  * Time-scope of a materialized report document. Every document covers exactly
16
17
  * one tenant × one scope context × one scope value (`scope_field`), and the
@@ -92,6 +93,20 @@ var MATERIALIZED_REPORT_KEY_FILTER_ENUM;
92
93
  (function (MATERIALIZED_REPORT_KEY_FILTER_ENUM) {
93
94
  MATERIALIZED_REPORT_KEY_FILTER_ENUM["ORDER_STATUS"] = "ORDER_STATUS";
94
95
  MATERIALIZED_REPORT_KEY_FILTER_ENUM["PLATFORM"] = "PLATFORM";
96
+ // Cash in/out (M3) has neither an order status nor a platform - its two
97
+ // operator questions are "which drawer" and "what kind of movement", so the
98
+ // cash report encodes <DRAWER_ID>:<REF_TYPE> instead. Adding members here is
99
+ // additive: the envelope merely declares which dimensions a key encodes.
100
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM["DRAWER_ID"] = "DRAWER_ID";
101
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM["REF_TYPE"] = "REF_TYPE";
102
+ // Delivery (M4) encodes <PLATFORM>:<CITY>, both joined from the ORDER - a delivery
103
+ // document carries neither, so the report joins by order_id and keys on the
104
+ // order's dimensions. CITY is a new dimension here.
105
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM["CITY"] = "CITY";
106
+ // Payments Comparison encodes <PAYMENT_METHOD>:<ORDER_STATUS>. The method is an
107
+ // OPEN string (live stores carry values outside the enum) and is normalized only
108
+ // for the PAY_LATER -> UNPAID remap.
109
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM["PAYMENT_METHOD"] = "PAYMENT_METHOD";
95
110
  })(MATERIALIZED_REPORT_KEY_FILTER_ENUM || (exports.MATERIALIZED_REPORT_KEY_FILTER_ENUM = MATERIALIZED_REPORT_KEY_FILTER_ENUM = {}));
96
111
  exports.ALL_MATERIALIZED_REPORT_KEY_FILTERS = Object.values(MATERIALIZED_REPORT_KEY_FILTER_ENUM);
97
112
  /** Ordered key filters of the tenant sales overview report (`PLACED:POS_WALK-IN`). */
@@ -99,6 +114,112 @@ exports.SALES_OVERVIEW_KEY_FILTERS = [
99
114
  MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
100
115
  MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
101
116
  ];
117
+ /* ======================================================================== */
118
+ /* Discounts report (M1) */
119
+ /* ======================================================================== */
120
+ /**
121
+ * Scopes materialized by `materialized_tenant_discount_reports` — the same
122
+ * month-capped set as the credit ledger, for the same reason: the itemized
123
+ * discount rows live in the SIBLING entries collection
124
+ * (`materialized_tenant_discount_entries`), capped at `LOCAL_MONTH` so a
125
+ * document can never grow unboundedly.
126
+ *
127
+ * The report documents themselves are COUNTERS ONLY (see
128
+ * `schemas/types/materialized_tenant_discount_reports.ts`).
129
+ */
130
+ exports.MATERIALIZED_DISCOUNT_REPORT_SCOPES = [
131
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_HOUR,
132
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
133
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
134
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK_OF_YEAR,
135
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
136
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
137
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
138
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
139
+ ];
140
+ /** Ordered key filters of the discounts report (`COMPLETED:POS_WALK-IN`). */
141
+ exports.DISCOUNTS_KEY_FILTERS = [
142
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
143
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
144
+ ];
145
+ /**
146
+ * Discount SLOT of one row — mirrors the three slots of the order/item
147
+ * `IDiscountDetails` (`special_`, `loyalty_`, `voucher_`).
148
+ */
149
+ var MATERIALIZED_DISCOUNT_SLOT_ENUM;
150
+ (function (MATERIALIZED_DISCOUNT_SLOT_ENUM) {
151
+ MATERIALIZED_DISCOUNT_SLOT_ENUM["SPECIAL"] = "SPECIAL";
152
+ MATERIALIZED_DISCOUNT_SLOT_ENUM["LOYALTY"] = "LOYALTY";
153
+ MATERIALIZED_DISCOUNT_SLOT_ENUM["VOUCHER"] = "VOUCHER";
154
+ })(MATERIALIZED_DISCOUNT_SLOT_ENUM || (exports.MATERIALIZED_DISCOUNT_SLOT_ENUM = MATERIALIZED_DISCOUNT_SLOT_ENUM = {}));
155
+ exports.ALL_MATERIALIZED_DISCOUNT_SLOTS = Object.values(MATERIALIZED_DISCOUNT_SLOT_ENUM);
156
+ /**
157
+ * Sub-kind of a discount row, derived from the slot's ID SHAPE (the only
158
+ * discriminator the write path stores — verified against live fixtures):
159
+ *
160
+ * - `COLLECTION` — `special_discount_id` is a 24-hex ObjectId (a
161
+ * `discounts` collection document).
162
+ * - `MANUAL` — id starts `MANUAL_` (quick % / custom amount /
163
+ * payment-type discounts). NOT `MANUAL_SINGLE_`.
164
+ * - `PRICE_OVERRIDE` — id starts `MANUAL_SINGLE_` (item price override).
165
+ * - `CATALOG_ITEM` — id is an item id or `SPECIAL_DISCOUNT` (a catalog
166
+ * item's own configured discount).
167
+ * - `OFFER` — loyalty/voucher slot whose id is an offer ObjectId.
168
+ * - `GIFT_CARD` — loyalty slot whose id is a gift-card ObjectId (the
169
+ * reference number carries the code).
170
+ * - `WALLET_CASHBACK` — the sentinel id `wallet_cashback_redemption`.
171
+ * - `UNATTRIBUTED` — no usable slot id, or order-level money the slots
172
+ * cannot explain (see the counter type).
173
+ */
174
+ var MATERIALIZED_DISCOUNT_SUB_KIND_ENUM;
175
+ (function (MATERIALIZED_DISCOUNT_SUB_KIND_ENUM) {
176
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["COLLECTION"] = "COLLECTION";
177
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["MANUAL"] = "MANUAL";
178
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["PRICE_OVERRIDE"] = "PRICE_OVERRIDE";
179
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["CATALOG_ITEM"] = "CATALOG_ITEM";
180
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["OFFER"] = "OFFER";
181
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["GIFT_CARD"] = "GIFT_CARD";
182
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["WALLET_CASHBACK"] = "WALLET_CASHBACK";
183
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["UNATTRIBUTED"] = "UNATTRIBUTED";
184
+ })(MATERIALIZED_DISCOUNT_SUB_KIND_ENUM || (exports.MATERIALIZED_DISCOUNT_SUB_KIND_ENUM = MATERIALIZED_DISCOUNT_SUB_KIND_ENUM = {}));
185
+ exports.ALL_MATERIALIZED_DISCOUNT_SUB_KINDS = Object.values(MATERIALIZED_DISCOUNT_SUB_KIND_ENUM);
186
+ /**
187
+ * Kind of one itemized discount row in
188
+ * `materialized_tenant_discount_entries`.
189
+ *
190
+ * - `DISCOUNT` — a slot on the order or on one item.
191
+ * - `FREE_ITEM` — a 100 % item row (also present as a `DISCOUNT` row; the
192
+ * drill-down decides which view lists it).
193
+ * - `COMPLIMENTARY` — a `COMPLIMENTARY` payment (no discount slot required).
194
+ */
195
+ var MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM;
196
+ (function (MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM) {
197
+ MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM["DISCOUNT"] = "DISCOUNT";
198
+ MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM["FREE_ITEM"] = "FREE_ITEM";
199
+ MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM["COMPLIMENTARY"] = "COMPLIMENTARY";
200
+ })(MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM || (exports.MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM = MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM = {}));
201
+ exports.ALL_MATERIALIZED_DISCOUNT_ENTRY_KINDS = Object.values(MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM);
202
+ /** Level a discount applies at — the order, one item, or a payment. */
203
+ var MATERIALIZED_DISCOUNT_LEVEL_ENUM;
204
+ (function (MATERIALIZED_DISCOUNT_LEVEL_ENUM) {
205
+ MATERIALIZED_DISCOUNT_LEVEL_ENUM["ORDER"] = "ORDER";
206
+ MATERIALIZED_DISCOUNT_LEVEL_ENUM["ITEM"] = "ITEM";
207
+ MATERIALIZED_DISCOUNT_LEVEL_ENUM["PAYMENT"] = "PAYMENT";
208
+ })(MATERIALIZED_DISCOUNT_LEVEL_ENUM || (exports.MATERIALIZED_DISCOUNT_LEVEL_ENUM = MATERIALIZED_DISCOUNT_LEVEL_ENUM = {}));
209
+ exports.ALL_MATERIALIZED_DISCOUNT_LEVELS = Object.values(MATERIALIZED_DISCOUNT_LEVEL_ENUM);
210
+ /**
211
+ * Cap of a discount report document's `top_sources` leaderboard. Display-only:
212
+ * every number in that list is also derivable from `discount_counters`, so a
213
+ * truncated list can never change a total.
214
+ */
215
+ exports.MATERIALIZED_DISCOUNT_SOURCE_LIMIT = 12;
216
+ /**
217
+ * The gift-card / wallet sentinel ids the toolkit writes into discount slots.
218
+ * Kept here so the classifier and the writers cannot drift apart.
219
+ */
220
+ exports.MATERIALIZED_DISCOUNT_SPECIAL_DISCOUNT_ID = 'SPECIAL_DISCOUNT';
221
+ exports.MATERIALIZED_DISCOUNT_MANUAL_PREFIX = 'MANUAL_';
222
+ exports.MATERIALIZED_DISCOUNT_PRICE_OVERRIDE_PREFIX = 'MANUAL_SINGLE_';
102
223
  /**
103
224
  * Payment-type label used by the frontend report formatter for the derived
104
225
  * credit-settlement line in a collection day's payments breakdown (a
@@ -125,6 +246,189 @@ var MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM;
125
246
  MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM["WRITE_OFF"] = "WRITE_OFF";
126
247
  })(MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM || (exports.MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM = MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM = {}));
127
248
  exports.ALL_MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPES = Object.values(MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM);
249
+ /* ======================================================================== */
250
+ /* Cash in/out report (M3) */
251
+ /* ======================================================================== */
252
+ /**
253
+ * Scopes materialized by `materialized_tenant_cash_in_out_reports`.
254
+ *
255
+ * NO `localHour`: cash is a close-of-shift concern, the same reasoning that keeps
256
+ * the hour scope out of the prep time report. Day + periods, capped at
257
+ * `LOCAL_MONTH` because the statement rows live in the SIBLING entries collection
258
+ * (`materialized_tenant_cash_in_out_entries`).
259
+ */
260
+ exports.MATERIALIZED_CASH_REPORT_SCOPES = [
261
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
262
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
263
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK_OF_YEAR,
264
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
265
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
266
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
267
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
268
+ ];
269
+ /**
270
+ * Ordered key filters of the cash report - `<DRAWER_ID>:<REF_TYPE>` (decision
271
+ * (b3)). Shift ids are deliberately NOT a key dimension: they are
272
+ * high-cardinality and belong in a breakdown table, not in the key.
273
+ */
274
+ exports.CASH_KEY_FILTERS = [
275
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.DRAWER_ID,
276
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.REF_TYPE,
277
+ ];
278
+ /** Cap of the per-document drawer leaderboard (bounded, display-only). */
279
+ exports.MATERIALIZED_CASH_SOURCE_LIMIT = 12;
280
+ /* ======================================================================== */
281
+ /* Delivery report (M4) */
282
+ /* ======================================================================== */
283
+ /**
284
+ * Scopes materialized by `materialized_tenant_delivery_reports`.
285
+ *
286
+ * NO `localHour`: the hour dimension appears as an AREA HEAT MAP inside the document
287
+ * (`areas[city].by_hour`), which is the shape the page actually renders. Materializing
288
+ * a full hour scope as well would multiply documents for a view nobody opens.
289
+ */
290
+ exports.MATERIALIZED_DELIVERY_REPORT_SCOPES = [
291
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
292
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
293
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK_OF_YEAR,
294
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
295
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
296
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
297
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
298
+ ];
299
+ /**
300
+ * Ordered key filters of the delivery report - `<PLATFORM>:<CITY>` (decision (b4)).
301
+ *
302
+ * Rider is deliberately NOT a key dimension: rider ids are high-cardinality, so rider
303
+ * analysis is a bounded `riders` map INSIDE each document rather than a partition of
304
+ * the key space.
305
+ */
306
+ exports.DELIVERY_KEY_FILTERS = [
307
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
308
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.CITY,
309
+ ];
310
+ /**
311
+ * Distance histogram of the delivery report, in METRES: inclusive lower, EXCLUSIVE
312
+ * upper, with an open-ended top bucket.
313
+ *
314
+ * Fixed buckets rather than a raw array, for the same reason as the prep time report: a
315
+ * bounded shape keeps a document small and makes a period fold exact.
316
+ */
317
+ exports.MATERIALIZED_DELIVERY_DISTANCE_BUCKETS = [
318
+ { key: 'under_2km', min: 0, max: 2000 },
319
+ { key: 'between_2_5km', min: 2000, max: 5000 },
320
+ { key: 'between_5_10km', min: 5000, max: 10000 },
321
+ { key: 'between_10_15km', min: 10000, max: 15000 },
322
+ { key: 'between_15_25km', min: 15000, max: 25000 },
323
+ { key: 'over_25km', min: 25000, max: null },
324
+ ];
325
+ /** Cap of the per-document rider leaderboard (bounded, display-only). */
326
+ exports.MATERIALIZED_DELIVERY_RIDER_LIMIT = 50;
327
+ /** Cap of the per-document area leaderboard (bounded, display-only). */
328
+ exports.MATERIALIZED_DELIVERY_AREA_LIMIT = 50;
329
+ /* ======================================================================== */
330
+ /* Prep time report (M2) */
331
+ /* ======================================================================== */
332
+ /**
333
+ * Scopes materialized by `materialized_tenant_prep_time_reports`.
334
+ *
335
+ * NO `localHour` (decision h2): the tracked population per hour is 2-3 items in
336
+ * the dev stores, so an hourly prep time would be noise. Day + periods only,
337
+ * capped at `LOCAL_MONTH` because the itemized rows live in the SIBLING entries
338
+ * collection (`materialized_tenant_prep_time_entries`).
339
+ */
340
+ exports.MATERIALIZED_PREP_TIME_REPORT_SCOPES = [
341
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
342
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
343
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK_OF_YEAR,
344
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
345
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
346
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
347
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
348
+ ];
349
+ /** Ordered key filters of the prep time report (`COMPLETED:POS_WALK-IN`). */
350
+ exports.PREP_TIME_KEY_FILTERS = [
351
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
352
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
353
+ ];
354
+ /**
355
+ * ANCHOR PROVENANCE of one tracked item - the split that makes this report
356
+ * correct (decision b2, section 3.2.1 of the concept doc).
357
+ *
358
+ * `ready_minutes` is written from the chain
359
+ * `prep_started_at ?? order_status_updated_at ?? createdAt`, and the two
360
+ * populations behave completely differently:
361
+ *
362
+ * - MEASURED - `prep_started_at` AND `ready_minutes` both present. The item owns
363
+ * its prep clock, so the ready instant is reconstructible
364
+ * (`prep_started_at + ready_minutes`). Two independent stores AGREE here
365
+ * (avg ~9.3 min, median 5-8, p90 23, ~30% instant).
366
+ * - UNMEASURED - everything else, including `ready_minutes` with NO
367
+ * `prep_started_at`: the anchor fell back to the order stage and the value is
368
+ * degenerate (bruzo: avg 0.0, 99.8% zeros). Counted in COVERAGE only.
369
+ *
370
+ * Blending them under-reports the average by ~13x in the store with the MOST
371
+ * data (0.7 vs 9.2 min) - the single mistake this design exists to prevent.
372
+ */
373
+ var MATERIALIZED_PREP_TIME_ANCHOR_ENUM;
374
+ (function (MATERIALIZED_PREP_TIME_ANCHOR_ENUM) {
375
+ MATERIALIZED_PREP_TIME_ANCHOR_ENUM["MEASURED"] = "MEASURED";
376
+ MATERIALIZED_PREP_TIME_ANCHOR_ENUM["UNMEASURED"] = "UNMEASURED";
377
+ })(MATERIALIZED_PREP_TIME_ANCHOR_ENUM || (exports.MATERIALIZED_PREP_TIME_ANCHOR_ENUM = MATERIALIZED_PREP_TIME_ANCHOR_ENUM = {}));
378
+ exports.ALL_MATERIALIZED_PREP_TIME_ANCHORS = Object.values(MATERIALIZED_PREP_TIME_ANCHOR_ENUM);
379
+ /**
380
+ * Fixed duration histogram of the MEASURED bucket, in minutes.
381
+ *
382
+ * A fixed histogram (decision d2) keeps documents small and is exactly what the
383
+ * UI renders; `median` / `p90` are derived from it and are therefore
384
+ * BUCKET-APPROXIMATE (the exact `avg` comes from `sum / count`). Storing every
385
+ * duration to get exact percentiles is the expensive option this avoids.
386
+ */
387
+ exports.MATERIALIZED_PREP_TIME_BUCKETS = [
388
+ { label: '0', min: 0, max: 0 },
389
+ { label: '1-5', min: 1, max: 5 },
390
+ { label: '6-10', min: 6, max: 10 },
391
+ { label: '11-15', min: 11, max: 15 },
392
+ { label: '16-30', min: 16, max: 30 },
393
+ { label: '31-60', min: 31, max: 60 },
394
+ { label: '60+', min: 61, max: null },
395
+ ];
396
+ exports.ALL_MATERIALIZED_PREP_TIME_BUCKET_LABELS = exports.MATERIALIZED_PREP_TIME_BUCKETS.map((bucket) => bucket.label);
397
+ /**
398
+ * Longest prep duration (minutes) trusted as a real prep time. A stored
399
+ * `ready_minutes` beyond this is a clock/backfill artefact rather than a prep
400
+ * time, so it still lands in the top bucket (the counts stay honest) but is kept
401
+ * out of `sum` / `min` / `max` - the same defensive posture the other reports
402
+ * take with outlier inputs.
403
+ */
404
+ exports.MATERIALIZED_PREP_TIME_MAX_MINUTES = 60 * 24;
405
+ /** Label of the top histogram bucket (everything at or above its `min`). */
406
+ exports.MATERIALIZED_PREP_TIME_TOP_BUCKET = '60+';
407
+ /**
408
+ * On-time tolerance (decision f2): ready instant <= target counts as ON TIME
409
+ * (`delta <= 0`) for v1. The signed `delta_sum` is kept so a grace window can be
410
+ * applied later WITHOUT re-materializing.
411
+ */
412
+ exports.MATERIALIZED_PREP_TIME_ON_TIME_MAX_DELTA = 0;
413
+ /**
414
+ * WHERE an item's on-time target came from (decision e2).
415
+ *
416
+ * Promise-only grading would leave 63-97% of items ungraded (measured: only
417
+ * 2.7% / 36.2% of orders carry an explicit estimate), so an item with no promise
418
+ * is graded against the TENANT DEFAULT - the documented
419
+ * `getDeliveryExpectedTime` fallback chain. The baseline is labelled per row so
420
+ * a reader can always tell the two apart.
421
+ */
422
+ var MATERIALIZED_PREP_TIME_TARGET_ENUM;
423
+ (function (MATERIALIZED_PREP_TIME_TARGET_ENUM) {
424
+ /** The order carried an explicit estimate. */
425
+ MATERIALIZED_PREP_TIME_TARGET_ENUM["PROMISE"] = "PROMISE";
426
+ /** The order was ASAP and is graded against the tenant default. */
427
+ MATERIALIZED_PREP_TIME_TARGET_ENUM["TENANT_DEFAULT"] = "TENANT_DEFAULT";
428
+ /** Neither exists - the row cannot be graded. */
429
+ MATERIALIZED_PREP_TIME_TARGET_ENUM["NONE"] = "NONE";
430
+ })(MATERIALIZED_PREP_TIME_TARGET_ENUM || (exports.MATERIALIZED_PREP_TIME_TARGET_ENUM = MATERIALIZED_PREP_TIME_TARGET_ENUM = {}));
431
+ exports.ALL_MATERIALIZED_PREP_TIME_TARGETS = Object.values(MATERIALIZED_PREP_TIME_TARGET_ENUM);
128
432
  /**
129
433
  * Materialized report kinds — the discriminator stored on
130
434
  * `materialized_tenant_reports_iterations` rows. A single shared history collection records
@@ -137,5 +441,150 @@ var MATERIALIZED_REPORT_TYPE_ENUM;
137
441
  (function (MATERIALIZED_REPORT_TYPE_ENUM) {
138
442
  MATERIALIZED_REPORT_TYPE_ENUM["TENANT_SALES_OVERVIEW"] = "TENANT_SALES_OVERVIEW";
139
443
  MATERIALIZED_REPORT_TYPE_ENUM["TENANT_CREDIT_BILLS"] = "TENANT_CREDIT_BILLS";
444
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_DISCOUNT_REPORTS"] = "TENANT_DISCOUNT_REPORTS";
445
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_DISCOUNT_ENTRIES"] = "TENANT_DISCOUNT_ENTRIES";
446
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_PREP_TIME_REPORTS"] = "TENANT_PREP_TIME_REPORTS";
447
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_PREP_TIME_ENTRIES"] = "TENANT_PREP_TIME_ENTRIES";
448
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_CASH_REPORTS"] = "TENANT_CASH_REPORTS";
449
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_CASH_ENTRIES"] = "TENANT_CASH_ENTRIES";
450
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_DELIVERY_REPORTS"] = "TENANT_DELIVERY_REPORTS";
451
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_DELIVERY_ENTRIES"] = "TENANT_DELIVERY_ENTRIES";
452
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_SALES_COMPARISON_REPORTS"] = "TENANT_SALES_COMPARISON_REPORTS";
453
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_SALES_COMPARISON_ENTRIES"] = "TENANT_SALES_COMPARISON_ENTRIES";
454
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_HOURLY_COMPARISON_REPORTS"] = "TENANT_HOURLY_COMPARISON_REPORTS";
455
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_HOURLY_COMPARISON_ENTRIES"] = "TENANT_HOURLY_COMPARISON_ENTRIES";
456
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_PAYMENTS_COMPARISON_REPORTS"] = "TENANT_PAYMENTS_COMPARISON_REPORTS";
457
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_PAYMENTS_COMPARISON_ENTRIES"] = "TENANT_PAYMENTS_COMPARISON_ENTRIES";
140
458
  })(MATERIALIZED_REPORT_TYPE_ENUM || (exports.MATERIALIZED_REPORT_TYPE_ENUM = MATERIALIZED_REPORT_TYPE_ENUM = {}));
141
459
  exports.ALL_MATERIALIZED_REPORT_TYPES = Object.values(MATERIALIZED_REPORT_TYPE_ENUM);
460
+ /* =====================> Sales Comparison report <===================== */
461
+ /**
462
+ * Sales Comparison (see console/admin-panel/docs/report-sales-comparison-concept.md).
463
+ *
464
+ * A REPORT, not Analytics: it lives under Reports - New -> Comparisons and its numbers are
465
+ * decimal-exact. The comparison itself is never stored - `current` and `comparison` are two
466
+ * ordinary reads, subtracted in the formatter.
467
+ *
468
+ * Fixes no time bias: a complete business day (localDate) is the anchor, because the day
469
+ * close defines it. A range-based bias is meaningless once the business day exists.
470
+ */
471
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_NAME = 'materialized_tenant_sales_comparison_reports';
472
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_NAME = 'materialized_tenant_sales_comparison_entries';
473
+ /** Six grains. NO ISO week (owner decision) and NO hour - this is not the hourly report. */
474
+ exports.MATERIALIZED_SALES_COMPARISON_REPORT_SCOPES = [
475
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
476
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
477
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
478
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
479
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
480
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
481
+ ];
482
+ /** Key grammar: `COMPLETED:POS_DINE-IN`. No sale-type dimension (owner decision). */
483
+ exports.SALES_COMPARISON_KEY_FILTERS = [
484
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
485
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
486
+ ];
487
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_SCHEMA_VERSION = 1;
488
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_SCHEMA_VERSION = 1;
489
+ /**
490
+ * The baseline a Sales Comparison read is compared against (owner decision:
491
+ * Toast/Square behaviour). The user picks ONE range; the comparison range is
492
+ * DERIVED server-side:
493
+ * - `NONE` — no comparison series;
494
+ * - `PREVIOUS_PERIOD` — an EQUAL-LENGTH range immediately preceding the primary
495
+ * range (never "the previous calendar month" — that is the classic
496
+ * off-by-one-day bug);
497
+ * - `PREVIOUS_YEAR` — the primary range shifted back 12 months, same length.
498
+ */
499
+ var SALES_COMPARISON_BASELINE_ENUM;
500
+ (function (SALES_COMPARISON_BASELINE_ENUM) {
501
+ SALES_COMPARISON_BASELINE_ENUM["NONE"] = "NONE";
502
+ SALES_COMPARISON_BASELINE_ENUM["PREVIOUS_PERIOD"] = "PREVIOUS_PERIOD";
503
+ SALES_COMPARISON_BASELINE_ENUM["PREVIOUS_YEAR"] = "PREVIOUS_YEAR";
504
+ })(SALES_COMPARISON_BASELINE_ENUM || (exports.SALES_COMPARISON_BASELINE_ENUM = SALES_COMPARISON_BASELINE_ENUM = {}));
505
+ exports.ALL_SALES_COMPARISON_BASELINES = Object.values(SALES_COMPARISON_BASELINE_ENUM);
506
+ /**
507
+ * The metric the page charts / headlines (concept §9, `Select Field`).
508
+ *
509
+ * CLIENT-SIDE ONLY: the document already carries every additive counter, so
510
+ * changing this selection must NOT refetch. `AVERAGE_TICKET` is DERIVED
511
+ * (`net_amount / order_count`) and is never stored.
512
+ */
513
+ var SALES_COMPARISON_METRIC_ENUM;
514
+ (function (SALES_COMPARISON_METRIC_ENUM) {
515
+ SALES_COMPARISON_METRIC_ENUM["NET_SALES"] = "NET_SALES";
516
+ SALES_COMPARISON_METRIC_ENUM["GROSS_SALES"] = "GROSS_SALES";
517
+ SALES_COMPARISON_METRIC_ENUM["DISCOUNTS"] = "DISCOUNTS";
518
+ SALES_COMPARISON_METRIC_ENUM["ORDER_COUNT"] = "ORDER_COUNT";
519
+ SALES_COMPARISON_METRIC_ENUM["AVERAGE_TICKET"] = "AVERAGE_TICKET";
520
+ SALES_COMPARISON_METRIC_ENUM["ITEMS_SOLD"] = "ITEMS_SOLD";
521
+ })(SALES_COMPARISON_METRIC_ENUM || (exports.SALES_COMPARISON_METRIC_ENUM = SALES_COMPARISON_METRIC_ENUM = {}));
522
+ exports.ALL_SALES_COMPARISON_METRICS = Object.values(SALES_COMPARISON_METRIC_ENUM);
523
+ /* =====================> Hourly Comparison report <===================== */
524
+ /**
525
+ * Hourly Comparison (see console/admin-panel/docs/report-hourly-comparison-concept.md).
526
+ *
527
+ * ONE hourly PROFILE compared against the same profile in a derived baseline range
528
+ * (decision A: one profile pair, not a per-day matrix). The comparison is never stored -
529
+ * `current` and `comparison` are two ordinary reads of HOUR documents, aligned and
530
+ * subtracted in the formatter.
531
+ *
532
+ * Anchor: `order_settled_at` -> the tenant-local settled day AND hour. No time bias.
533
+ *
534
+ * No period documents are written: the profile read only needs hour buckets. The period
535
+ * comparison report already owns the day/period materialization.
536
+ */
537
+ exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_NAME = 'materialized_tenant_hourly_comparison_reports';
538
+ exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_NAME = 'materialized_tenant_hourly_comparison_entries';
539
+ /** Hour documents only. This is an HOURLY report; no day or period documents. */
540
+ exports.MATERIALIZED_HOURLY_COMPARISON_REPORT_SCOPES = [
541
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_HOUR,
542
+ ];
543
+ /** The same key grammar as Sales Comparison: `COMPLETED:POS_DINE-IN`. */
544
+ exports.HOURLY_COMPARISON_KEY_FILTERS = [
545
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
546
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
547
+ ];
548
+ exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_SCHEMA_VERSION = 1;
549
+ exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_SCHEMA_VERSION = 1;
550
+ /* =====================> Payments Comparison report <===================== */
551
+ /**
552
+ * Payments Comparison (see console/admin-panel/docs/report-payments-comparison-concept.md).
553
+ *
554
+ * Payment ROWS, not orders: a split order contributes one row per payment, so this
555
+ * report can never be merged with Sales Comparison (which sums orders). The key is
556
+ * `<PAYMENT_METHOD>:<ORDER_STATUS>` (decision B); the method is the normalized,
557
+ * OPEN-string payment type.
558
+ */
559
+ exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_NAME = 'materialized_tenant_payments_comparison_reports';
560
+ exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_NAME = 'materialized_tenant_payments_comparison_entries';
561
+ /** The same six comparison grains; no hour / ISO week. */
562
+ exports.MATERIALIZED_PAYMENTS_COMPARISON_REPORT_SCOPES = [
563
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
564
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
565
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
566
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
567
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
568
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
569
+ ];
570
+ /** Ordered key filters: `<PAYMENT_METHOD>:<ORDER_STATUS>`. */
571
+ exports.PAYMENTS_COMPARISON_KEY_FILTERS = [
572
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PAYMENT_METHOD,
573
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
574
+ ];
575
+ exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_SCHEMA_VERSION = 1;
576
+ exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_SCHEMA_VERSION = 1;
577
+ /**
578
+ * The metric the Payments Comparison page charts (client-side).
579
+ * `AVERAGE_PAYMENT` is derived (`payment_amount / payment_count`), never stored.
580
+ */
581
+ var PAYMENTS_COMPARISON_METRIC_ENUM;
582
+ (function (PAYMENTS_COMPARISON_METRIC_ENUM) {
583
+ PAYMENTS_COMPARISON_METRIC_ENUM["PAYMENT_AMOUNT"] = "PAYMENT_AMOUNT";
584
+ PAYMENTS_COMPARISON_METRIC_ENUM["PAYMENT_COUNT"] = "PAYMENT_COUNT";
585
+ PAYMENTS_COMPARISON_METRIC_ENUM["AVERAGE_PAYMENT"] = "AVERAGE_PAYMENT";
586
+ PAYMENTS_COMPARISON_METRIC_ENUM["CARD_CHARGES"] = "CARD_CHARGES";
587
+ PAYMENTS_COMPARISON_METRIC_ENUM["REFUNDED_AMOUNT"] = "REFUNDED_AMOUNT";
588
+ PAYMENTS_COMPARISON_METRIC_ENUM["AMOUNT_DUE"] = "AMOUNT_DUE";
589
+ })(PAYMENTS_COMPARISON_METRIC_ENUM || (exports.PAYMENTS_COMPARISON_METRIC_ENUM = PAYMENTS_COMPARISON_METRIC_ENUM = {}));
590
+ exports.ALL_PAYMENTS_COMPARISON_METRICS = Object.values(PAYMENTS_COMPARISON_METRIC_ENUM);
@@ -2,6 +2,9 @@ export * from './fbr';
2
2
  export * from './hubrise';
3
3
  export * from './kpra';
4
4
  export * from './materialized-reports';
5
+ export * from './reporting-contract';
6
+ export * from './rider-earnings';
7
+ export * from './rider-reports';
5
8
  export * from './order';
6
9
  export * from './pra';
7
10
  export * from './srb';
@@ -18,6 +18,9 @@ __exportStar(require("./fbr"), exports);
18
18
  __exportStar(require("./hubrise"), exports);
19
19
  __exportStar(require("./kpra"), exports);
20
20
  __exportStar(require("./materialized-reports"), exports);
21
+ __exportStar(require("./reporting-contract"), exports);
22
+ __exportStar(require("./rider-earnings"), exports);
23
+ __exportStar(require("./rider-reports"), exports);
21
24
  __exportStar(require("./order"), exports);
22
25
  __exportStar(require("./pra"), exports);
23
26
  __exportStar(require("./srb"), exports);
@@ -1,10 +1,42 @@
1
1
  export * from './key-helpers';
2
2
  export * from './materialized-credit-bills-helpers';
3
+ export * from './materialized-discount-accumulator-helpers';
4
+ export * from './materialized-discount-classification-helpers';
5
+ export * from './materialized-discount-close-day-helpers';
6
+ export * from './materialized-discount-compile-helpers';
7
+ export * from './materialized-hourly-comparison-close-day-helpers';
8
+ export * from './materialized-hourly-comparison-compile-helpers';
9
+ export * from './materialized-hourly-comparison-selection-helpers';
10
+ export * from './materialized-payments-comparison-accumulator-helpers';
11
+ export * from './materialized-payments-comparison-close-day-helpers';
12
+ export * from './materialized-payments-comparison-compile-helpers';
13
+ export * from './materialized-cash-accumulator-helpers';
14
+ export * from './materialized-delivery-accumulator-helpers';
15
+ export * from './materialized-delivery-compile-helpers';
16
+ export * from './materialized-delivery-classification-helpers';
17
+ export * from './materialized-delivery-close-day-helpers';
18
+ export * from './materialized-cash-classification-helpers';
19
+ export * from './materialized-cash-close-day-helpers';
20
+ export * from './materialized-cash-compile-helpers';
21
+ export * from './materialized-prep-time-classification-helpers';
22
+ export * from './materialized-prep-time-close-day-helpers';
23
+ export * from './materialized-prep-time-compile-helpers';
3
24
  export * from './materialized-reports-read-helpers';
4
25
  export * from './materialized-reports-scope-group-helpers';
5
26
  export * from './materialized-reports-selection-helpers';
27
+ export * from './materialized-sales-comparison-accumulator-helpers';
28
+ export * from './materialized-sales-comparison-baseline-helpers';
29
+ export * from './materialized-sales-comparison-close-day-helpers';
30
+ export * from './materialized-sales-comparison-compile-helpers';
6
31
  export * from './materialized-tenant-reports-iterations-helpers';
7
32
  export * from './scope-helpers';
33
+ export * from './tenant-hourly-comparison-formatter';
34
+ export * from './tenant-payments-comparison-formatter';
35
+ export * from './tenant-sales-comparison-formatter';
8
36
  export * from './tenant-sales-overview-close-day-helpers';
37
+ export * from './tenant-discount-formatter';
38
+ export * from './tenant-cash-in-out-formatter';
39
+ export * from './tenant-delivery-formatter';
40
+ export * from './tenant-prep-time-formatter';
9
41
  export * from './tenant-sales-overview-formatter';
10
42
  export * from './tenant-sales-overview-helpers';
@@ -16,11 +16,43 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./key-helpers"), exports);
18
18
  __exportStar(require("./materialized-credit-bills-helpers"), exports);
19
+ __exportStar(require("./materialized-discount-accumulator-helpers"), exports);
20
+ __exportStar(require("./materialized-discount-classification-helpers"), exports);
21
+ __exportStar(require("./materialized-discount-close-day-helpers"), exports);
22
+ __exportStar(require("./materialized-discount-compile-helpers"), exports);
23
+ __exportStar(require("./materialized-hourly-comparison-close-day-helpers"), exports);
24
+ __exportStar(require("./materialized-hourly-comparison-compile-helpers"), exports);
25
+ __exportStar(require("./materialized-hourly-comparison-selection-helpers"), exports);
26
+ __exportStar(require("./materialized-payments-comparison-accumulator-helpers"), exports);
27
+ __exportStar(require("./materialized-payments-comparison-close-day-helpers"), exports);
28
+ __exportStar(require("./materialized-payments-comparison-compile-helpers"), exports);
29
+ __exportStar(require("./materialized-cash-accumulator-helpers"), exports);
30
+ __exportStar(require("./materialized-delivery-accumulator-helpers"), exports);
31
+ __exportStar(require("./materialized-delivery-compile-helpers"), exports);
32
+ __exportStar(require("./materialized-delivery-classification-helpers"), exports);
33
+ __exportStar(require("./materialized-delivery-close-day-helpers"), exports);
34
+ __exportStar(require("./materialized-cash-classification-helpers"), exports);
35
+ __exportStar(require("./materialized-cash-close-day-helpers"), exports);
36
+ __exportStar(require("./materialized-cash-compile-helpers"), exports);
37
+ __exportStar(require("./materialized-prep-time-classification-helpers"), exports);
38
+ __exportStar(require("./materialized-prep-time-close-day-helpers"), exports);
39
+ __exportStar(require("./materialized-prep-time-compile-helpers"), exports);
19
40
  __exportStar(require("./materialized-reports-read-helpers"), exports);
20
41
  __exportStar(require("./materialized-reports-scope-group-helpers"), exports);
21
42
  __exportStar(require("./materialized-reports-selection-helpers"), exports);
43
+ __exportStar(require("./materialized-sales-comparison-accumulator-helpers"), exports);
44
+ __exportStar(require("./materialized-sales-comparison-baseline-helpers"), exports);
45
+ __exportStar(require("./materialized-sales-comparison-close-day-helpers"), exports);
46
+ __exportStar(require("./materialized-sales-comparison-compile-helpers"), exports);
22
47
  __exportStar(require("./materialized-tenant-reports-iterations-helpers"), exports);
23
48
  __exportStar(require("./scope-helpers"), exports);
49
+ __exportStar(require("./tenant-hourly-comparison-formatter"), exports);
50
+ __exportStar(require("./tenant-payments-comparison-formatter"), exports);
51
+ __exportStar(require("./tenant-sales-comparison-formatter"), exports);
24
52
  __exportStar(require("./tenant-sales-overview-close-day-helpers"), exports);
53
+ __exportStar(require("./tenant-discount-formatter"), exports);
54
+ __exportStar(require("./tenant-cash-in-out-formatter"), exports);
55
+ __exportStar(require("./tenant-delivery-formatter"), exports);
56
+ __exportStar(require("./tenant-prep-time-formatter"), exports);
25
57
  __exportStar(require("./tenant-sales-overview-formatter"), exports);
26
58
  __exportStar(require("./tenant-sales-overview-helpers"), exports);
@@ -0,0 +1,18 @@
1
+ import { IMaterializedCashCounters } from '../../schemas/types/materialized_tenant_cash_reports';
2
+ import { freshCashCounters } from './materialized-cash-classification-helpers';
3
+ /**
4
+ * Merges `source` into `target`, IN PLACE. Used to fold day counters into a period.
5
+ *
6
+ * Null-safe: a source block missing a sub-object is treated as zeroes rather than
7
+ * throwing, so one malformed historical document cannot break a whole fold.
8
+ */
9
+ export declare function mergeMaterializedCashCounters(target: IMaterializedCashCounters, source: IMaterializedCashCounters): IMaterializedCashCounters;
10
+ /**
11
+ * Recomputes every DERIVED value from the summed components, in place.
12
+ *
13
+ * This is what makes a folded document self-consistent: the nets and the `by_ref`
14
+ * totals are always a function of the counts and amounts beside them.
15
+ */
16
+ export declare function recalculateCashDerived(counters: IMaterializedCashCounters): void;
17
+ /** A fresh zeroed block - re-exported so callers fold from the same seed. */
18
+ export { freshCashCounters };