@managesome/eposmatic-toolkit 0.4.8 → 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 (336) hide show
  1. package/esm/constants/MATERIALIZED_REPORTS.js +448 -0
  2. package/esm/constants/enums/communications.js +1 -0
  3. package/esm/helpers/index.js +3 -0
  4. package/esm/helpers/materialized-reports/index.js +32 -0
  5. package/esm/helpers/materialized-reports/materialized-cash-accumulator-helpers.js +114 -0
  6. package/esm/helpers/materialized-reports/materialized-cash-classification-helpers.js +286 -0
  7. package/esm/helpers/materialized-reports/materialized-cash-close-day-helpers.js +396 -0
  8. package/esm/helpers/materialized-reports/materialized-cash-compile-helpers.js +244 -0
  9. package/esm/helpers/materialized-reports/materialized-delivery-accumulator-helpers.js +170 -0
  10. package/esm/helpers/materialized-reports/materialized-delivery-classification-helpers.js +426 -0
  11. package/esm/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +372 -0
  12. package/esm/helpers/materialized-reports/materialized-delivery-compile-helpers.js +214 -0
  13. package/esm/helpers/materialized-reports/materialized-discount-accumulator-helpers.js +318 -0
  14. package/esm/helpers/materialized-reports/materialized-discount-classification-helpers.js +213 -0
  15. package/esm/helpers/materialized-reports/materialized-discount-close-day-helpers.js +604 -0
  16. package/esm/helpers/materialized-reports/materialized-discount-compile-helpers.js +186 -0
  17. package/esm/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.js +155 -0
  18. package/esm/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.js +199 -0
  19. package/esm/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.js +111 -0
  20. package/esm/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.js +88 -0
  21. package/esm/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.js +394 -0
  22. package/esm/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.js +167 -0
  23. package/esm/helpers/materialized-reports/materialized-prep-time-classification-helpers.js +215 -0
  24. package/esm/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +476 -0
  25. package/esm/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +201 -0
  26. package/esm/helpers/materialized-reports/materialized-reports-selection-helpers.js +7 -0
  27. package/esm/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.js +189 -0
  28. package/esm/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.js +157 -0
  29. package/esm/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.js +588 -0
  30. package/esm/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.js +175 -0
  31. package/esm/helpers/materialized-reports/tenant-cash-in-out-formatter.js +156 -0
  32. package/esm/helpers/materialized-reports/tenant-delivery-formatter.js +230 -0
  33. package/esm/helpers/materialized-reports/tenant-discount-formatter.js +427 -0
  34. package/esm/helpers/materialized-reports/tenant-hourly-comparison-formatter.js +237 -0
  35. package/esm/helpers/materialized-reports/tenant-payments-comparison-formatter.js +279 -0
  36. package/esm/helpers/materialized-reports/tenant-prep-time-formatter.js +228 -0
  37. package/esm/helpers/materialized-reports/tenant-sales-comparison-formatter.js +343 -0
  38. package/esm/helpers/reporting-contract/index.js +2 -0
  39. package/esm/helpers/reporting-contract/overview-contract.js +122 -0
  40. package/esm/helpers/reporting-contract/report-contract.js +228 -0
  41. package/esm/helpers/rider-earnings/index.js +1 -0
  42. package/esm/helpers/rider-earnings/rider-earnings.js +59 -0
  43. package/esm/helpers/rider-reports/index.js +2 -0
  44. package/esm/helpers/rider-reports/rider-daily-report.js +90 -0
  45. package/esm/helpers/rider-reports/rider-report.js +67 -0
  46. package/esm/schemas/models/deliveries.js +75 -0
  47. package/esm/schemas/models/index.js +15 -0
  48. package/esm/schemas/models/materialized_rider_daily_reports.js +39 -0
  49. package/esm/schemas/models/materialized_tenant_cash_entries.js +95 -0
  50. package/esm/schemas/models/materialized_tenant_cash_reports.js +77 -0
  51. package/esm/schemas/models/materialized_tenant_delivery_entries.js +63 -0
  52. package/esm/schemas/models/materialized_tenant_delivery_reports.js +63 -0
  53. package/esm/schemas/models/materialized_tenant_discount_entries.js +156 -0
  54. package/esm/schemas/models/materialized_tenant_discount_reports.js +333 -0
  55. package/esm/schemas/models/materialized_tenant_hourly_comparison_entries.js +87 -0
  56. package/esm/schemas/models/materialized_tenant_hourly_comparison_reports.js +99 -0
  57. package/esm/schemas/models/materialized_tenant_payments_comparison_entries.js +71 -0
  58. package/esm/schemas/models/materialized_tenant_payments_comparison_reports.js +76 -0
  59. package/esm/schemas/models/materialized_tenant_prep_time_entries.js +130 -0
  60. package/esm/schemas/models/materialized_tenant_prep_time_reports.js +109 -0
  61. package/esm/schemas/models/materialized_tenant_sales_comparison_entries.js +130 -0
  62. package/esm/schemas/models/materialized_tenant_sales_comparison_reports.js +154 -0
  63. package/esm/schemas/types/index.js +15 -0
  64. package/esm/schemas/types/materialized_rider_daily_reports.js +1 -0
  65. package/esm/schemas/types/materialized_tenant_cash_entries.js +1 -0
  66. package/esm/schemas/types/materialized_tenant_cash_reports.js +1 -0
  67. package/esm/schemas/types/materialized_tenant_delivery_entries.js +1 -0
  68. package/esm/schemas/types/materialized_tenant_delivery_reports.js +1 -0
  69. package/esm/schemas/types/materialized_tenant_discount_entries.js +1 -0
  70. package/esm/schemas/types/materialized_tenant_discount_reports.js +2 -0
  71. package/esm/schemas/types/materialized_tenant_hourly_comparison_entries.js +1 -0
  72. package/esm/schemas/types/materialized_tenant_hourly_comparison_reports.js +1 -0
  73. package/esm/schemas/types/materialized_tenant_payments_comparison_entries.js +1 -0
  74. package/esm/schemas/types/materialized_tenant_payments_comparison_reports.js +11 -0
  75. package/esm/schemas/types/materialized_tenant_prep_time_entries.js +1 -0
  76. package/esm/schemas/types/materialized_tenant_prep_time_reports.js +1 -0
  77. package/esm/schemas/types/materialized_tenant_sales_comparison_entries.js +1 -0
  78. package/esm/schemas/types/materialized_tenant_sales_comparison_reports.js +14 -0
  79. package/lib/constants/MATERIALIZED_REPORTS.d.ts +339 -2
  80. package/lib/constants/MATERIALIZED_REPORTS.js +450 -1
  81. package/lib/constants/enums/communications.d.ts +1 -0
  82. package/lib/constants/enums/communications.js +2 -1
  83. package/lib/helpers/index.d.ts +3 -0
  84. package/lib/helpers/index.js +3 -0
  85. package/lib/helpers/materialized-reports/index.d.ts +32 -0
  86. package/lib/helpers/materialized-reports/index.js +32 -0
  87. package/lib/helpers/materialized-reports/materialized-cash-accumulator-helpers.d.ts +18 -0
  88. package/lib/helpers/materialized-reports/materialized-cash-accumulator-helpers.js +118 -0
  89. package/lib/helpers/materialized-reports/materialized-cash-classification-helpers.d.ts +90 -0
  90. package/lib/helpers/materialized-reports/materialized-cash-classification-helpers.js +295 -0
  91. package/lib/helpers/materialized-reports/materialized-cash-close-day-helpers.d.ts +102 -0
  92. package/lib/helpers/materialized-reports/materialized-cash-close-day-helpers.js +409 -0
  93. package/lib/helpers/materialized-reports/materialized-cash-compile-helpers.d.ts +72 -0
  94. package/lib/helpers/materialized-reports/materialized-cash-compile-helpers.js +251 -0
  95. package/lib/helpers/materialized-reports/materialized-delivery-accumulator-helpers.d.ts +7 -0
  96. package/lib/helpers/materialized-reports/materialized-delivery-accumulator-helpers.js +173 -0
  97. package/lib/helpers/materialized-reports/materialized-delivery-classification-helpers.d.ts +84 -0
  98. package/lib/helpers/materialized-reports/materialized-delivery-classification-helpers.js +438 -0
  99. package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.d.ts +97 -0
  100. package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +385 -0
  101. package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.d.ts +40 -0
  102. package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.js +218 -0
  103. package/lib/helpers/materialized-reports/materialized-discount-accumulator-helpers.d.ts +52 -0
  104. package/lib/helpers/materialized-reports/materialized-discount-accumulator-helpers.js +324 -0
  105. package/lib/helpers/materialized-reports/materialized-discount-classification-helpers.d.ts +50 -0
  106. package/lib/helpers/materialized-reports/materialized-discount-classification-helpers.js +222 -0
  107. package/lib/helpers/materialized-reports/materialized-discount-close-day-helpers.d.ts +182 -0
  108. package/lib/helpers/materialized-reports/materialized-discount-close-day-helpers.js +615 -0
  109. package/lib/helpers/materialized-reports/materialized-discount-compile-helpers.d.ts +47 -0
  110. package/lib/helpers/materialized-reports/materialized-discount-compile-helpers.js +193 -0
  111. package/lib/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.d.ts +64 -0
  112. package/lib/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.js +163 -0
  113. package/lib/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.d.ts +61 -0
  114. package/lib/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.js +207 -0
  115. package/lib/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.d.ts +23 -0
  116. package/lib/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.js +116 -0
  117. package/lib/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.d.ts +25 -0
  118. package/lib/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.js +98 -0
  119. package/lib/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.d.ts +79 -0
  120. package/lib/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.js +407 -0
  121. package/lib/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.d.ts +35 -0
  122. package/lib/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.js +173 -0
  123. package/lib/helpers/materialized-reports/materialized-prep-time-classification-helpers.d.ts +66 -0
  124. package/lib/helpers/materialized-reports/materialized-prep-time-classification-helpers.js +224 -0
  125. package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.d.ts +128 -0
  126. package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +490 -0
  127. package/lib/helpers/materialized-reports/materialized-prep-time-compile-helpers.d.ts +46 -0
  128. package/lib/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +208 -0
  129. package/lib/helpers/materialized-reports/materialized-reports-selection-helpers.d.ts +8 -0
  130. package/lib/helpers/materialized-reports/materialized-reports-selection-helpers.js +8 -1
  131. package/lib/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.d.ts +48 -0
  132. package/lib/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.js +204 -0
  133. package/lib/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.d.ts +22 -0
  134. package/lib/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.js +161 -0
  135. package/lib/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.d.ts +163 -0
  136. package/lib/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.js +603 -0
  137. package/lib/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.d.ts +68 -0
  138. package/lib/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.js +182 -0
  139. package/lib/helpers/materialized-reports/tenant-cash-in-out-formatter.d.ts +98 -0
  140. package/lib/helpers/materialized-reports/tenant-cash-in-out-formatter.js +159 -0
  141. package/lib/helpers/materialized-reports/tenant-delivery-formatter.d.ts +133 -0
  142. package/lib/helpers/materialized-reports/tenant-delivery-formatter.js +233 -0
  143. package/lib/helpers/materialized-reports/tenant-discount-formatter.d.ts +114 -0
  144. package/lib/helpers/materialized-reports/tenant-discount-formatter.js +431 -0
  145. package/lib/helpers/materialized-reports/tenant-hourly-comparison-formatter.d.ts +60 -0
  146. package/lib/helpers/materialized-reports/tenant-hourly-comparison-formatter.js +243 -0
  147. package/lib/helpers/materialized-reports/tenant-payments-comparison-formatter.d.ts +75 -0
  148. package/lib/helpers/materialized-reports/tenant-payments-comparison-formatter.js +286 -0
  149. package/lib/helpers/materialized-reports/tenant-prep-time-formatter.d.ts +97 -0
  150. package/lib/helpers/materialized-reports/tenant-prep-time-formatter.js +232 -0
  151. package/lib/helpers/materialized-reports/tenant-sales-comparison-formatter.d.ts +105 -0
  152. package/lib/helpers/materialized-reports/tenant-sales-comparison-formatter.js +349 -0
  153. package/lib/helpers/reporting-contract/index.d.ts +2 -0
  154. package/lib/helpers/reporting-contract/index.js +18 -0
  155. package/lib/helpers/reporting-contract/overview-contract.d.ts +55 -0
  156. package/lib/helpers/reporting-contract/overview-contract.js +126 -0
  157. package/lib/helpers/reporting-contract/report-contract.d.ts +159 -0
  158. package/lib/helpers/reporting-contract/report-contract.js +239 -0
  159. package/lib/helpers/rider-earnings/index.d.ts +1 -0
  160. package/lib/helpers/rider-earnings/index.js +17 -0
  161. package/lib/helpers/rider-earnings/rider-earnings.d.ts +58 -0
  162. package/lib/helpers/rider-earnings/rider-earnings.js +64 -0
  163. package/lib/helpers/rider-reports/index.d.ts +2 -0
  164. package/lib/helpers/rider-reports/index.js +18 -0
  165. package/lib/helpers/rider-reports/rider-daily-report.d.ts +26 -0
  166. package/lib/helpers/rider-reports/rider-daily-report.js +93 -0
  167. package/lib/helpers/rider-reports/rider-report.d.ts +49 -0
  168. package/lib/helpers/rider-reports/rider-report.js +70 -0
  169. package/lib/helpers/types/materialized-reports-apis.d.ts +297 -1
  170. package/lib/schemas/models/deliveries.d.ts +54 -0
  171. package/lib/schemas/models/deliveries.js +75 -0
  172. package/lib/schemas/models/expense_details.d.ts +3 -3
  173. package/lib/schemas/models/index.d.ts +15 -0
  174. package/lib/schemas/models/index.js +15 -0
  175. package/lib/schemas/models/materialized_rider_daily_reports.d.ts +27 -0
  176. package/lib/schemas/models/materialized_rider_daily_reports.js +42 -0
  177. package/lib/schemas/models/materialized_tenant_cash_entries.d.ts +181 -0
  178. package/lib/schemas/models/materialized_tenant_cash_entries.js +98 -0
  179. package/lib/schemas/models/materialized_tenant_cash_reports.d.ts +111 -0
  180. package/lib/schemas/models/materialized_tenant_cash_reports.js +80 -0
  181. package/lib/schemas/models/materialized_tenant_delivery_entries.d.ts +98 -0
  182. package/lib/schemas/models/materialized_tenant_delivery_entries.js +66 -0
  183. package/lib/schemas/models/materialized_tenant_delivery_reports.d.ts +98 -0
  184. package/lib/schemas/models/materialized_tenant_delivery_reports.js +66 -0
  185. package/lib/schemas/models/materialized_tenant_discount_entries.d.ts +199 -0
  186. package/lib/schemas/models/materialized_tenant_discount_entries.js +159 -0
  187. package/lib/schemas/models/materialized_tenant_discount_reports.d.ts +216 -0
  188. package/lib/schemas/models/materialized_tenant_discount_reports.js +336 -0
  189. package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.d.ts +95 -0
  190. package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.js +82 -0
  191. package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.d.ts +105 -0
  192. package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.js +91 -0
  193. package/lib/schemas/models/materialized_tenant_payments_comparison_entries.d.ts +91 -0
  194. package/lib/schemas/models/materialized_tenant_payments_comparison_entries.js +70 -0
  195. package/lib/schemas/models/materialized_tenant_payments_comparison_reports.d.ts +98 -0
  196. package/lib/schemas/models/materialized_tenant_payments_comparison_reports.js +71 -0
  197. package/lib/schemas/models/materialized_tenant_prep_time_entries.d.ts +181 -0
  198. package/lib/schemas/models/materialized_tenant_prep_time_entries.js +133 -0
  199. package/lib/schemas/models/materialized_tenant_prep_time_reports.d.ts +118 -0
  200. package/lib/schemas/models/materialized_tenant_prep_time_reports.js +112 -0
  201. package/lib/schemas/models/materialized_tenant_sales_comparison_entries.d.ts +139 -0
  202. package/lib/schemas/models/materialized_tenant_sales_comparison_entries.js +120 -0
  203. package/lib/schemas/models/materialized_tenant_sales_comparison_reports.d.ts +167 -0
  204. package/lib/schemas/models/materialized_tenant_sales_comparison_reports.js +137 -0
  205. package/lib/schemas/models/tenant_purchase_order_vendor_returns.d.ts +3 -3
  206. package/lib/schemas/models/warehouse_internal_movements.d.ts +6 -6
  207. package/lib/schemas/models/warehouse_purchase_order_receipts.d.ts +3 -3
  208. package/lib/schemas/models/warehouse_purchase_order_vendor_returns.d.ts +3 -3
  209. package/lib/schemas/models/warehouse_sale_deliveries.d.ts +6 -6
  210. package/lib/schemas/models/warehouse_sale_invoices.d.ts +3 -3
  211. package/lib/schemas/types/deliveries.d.ts +40 -1
  212. package/lib/schemas/types/index.d.ts +15 -0
  213. package/lib/schemas/types/index.js +15 -0
  214. package/lib/schemas/types/materialized_rider_daily_reports.d.ts +37 -0
  215. package/lib/schemas/types/materialized_rider_daily_reports.js +2 -0
  216. package/lib/schemas/types/materialized_tenant_cash_entries.d.ts +87 -0
  217. package/lib/schemas/types/materialized_tenant_cash_entries.js +2 -0
  218. package/lib/schemas/types/materialized_tenant_cash_reports.d.ts +144 -0
  219. package/lib/schemas/types/materialized_tenant_cash_reports.js +2 -0
  220. package/lib/schemas/types/materialized_tenant_delivery_entries.d.ts +98 -0
  221. package/lib/schemas/types/materialized_tenant_delivery_entries.js +2 -0
  222. package/lib/schemas/types/materialized_tenant_delivery_reports.d.ts +179 -0
  223. package/lib/schemas/types/materialized_tenant_delivery_reports.js +2 -0
  224. package/lib/schemas/types/materialized_tenant_discount_entries.d.ts +81 -0
  225. package/lib/schemas/types/materialized_tenant_discount_entries.js +2 -0
  226. package/lib/schemas/types/materialized_tenant_discount_reports.d.ts +209 -0
  227. package/lib/schemas/types/materialized_tenant_discount_reports.js +3 -0
  228. package/lib/schemas/types/materialized_tenant_hourly_comparison_entries.d.ts +33 -0
  229. package/lib/schemas/types/materialized_tenant_hourly_comparison_entries.js +2 -0
  230. package/lib/schemas/types/materialized_tenant_hourly_comparison_reports.d.ts +40 -0
  231. package/lib/schemas/types/materialized_tenant_hourly_comparison_reports.js +2 -0
  232. package/lib/schemas/types/materialized_tenant_payments_comparison_entries.d.ts +48 -0
  233. package/lib/schemas/types/materialized_tenant_payments_comparison_entries.js +2 -0
  234. package/lib/schemas/types/materialized_tenant_payments_comparison_reports.d.ts +51 -0
  235. package/lib/schemas/types/materialized_tenant_payments_comparison_reports.js +14 -0
  236. package/lib/schemas/types/materialized_tenant_prep_time_entries.d.ts +88 -0
  237. package/lib/schemas/types/materialized_tenant_prep_time_entries.js +2 -0
  238. package/lib/schemas/types/materialized_tenant_prep_time_reports.d.ts +132 -0
  239. package/lib/schemas/types/materialized_tenant_prep_time_reports.js +2 -0
  240. package/lib/schemas/types/materialized_tenant_sales_comparison_entries.d.ts +43 -0
  241. package/lib/schemas/types/materialized_tenant_sales_comparison_entries.js +2 -0
  242. package/lib/schemas/types/materialized_tenant_sales_comparison_reports.d.ts +74 -0
  243. package/lib/schemas/types/materialized_tenant_sales_comparison_reports.js +17 -0
  244. package/lib/tests/materialized-reports/analytics-growth-helpers.test.d.ts +1 -0
  245. package/lib/tests/materialized-reports/analytics-overview-helpers.test.d.ts +1 -0
  246. package/lib/tests/materialized-reports/analytics-performance-helpers.test.d.ts +1 -0
  247. package/lib/tests/materialized-reports/fixtures.d.ts +15 -1
  248. package/lib/tests/materialized-reports/fixtures.js +1 -0
  249. package/lib/tests/materialized-reports/materialized-cash-compile.test.d.ts +1 -0
  250. package/lib/tests/materialized-reports/materialized-cash-compile.test.js +196 -0
  251. package/lib/tests/materialized-reports/materialized-cash-fold.test.d.ts +1 -0
  252. package/lib/tests/materialized-reports/materialized-cash-fold.test.js +116 -0
  253. package/lib/tests/materialized-reports/materialized-cash-formatter.test.d.ts +1 -0
  254. package/lib/tests/materialized-reports/materialized-cash-formatter.test.js +152 -0
  255. package/lib/tests/materialized-reports/materialized-cash-plan.test.d.ts +1 -0
  256. package/lib/tests/materialized-reports/materialized-cash-plan.test.js +168 -0
  257. package/lib/tests/materialized-reports/materialized-cash-reconciliation.test.d.ts +1 -0
  258. package/lib/tests/materialized-reports/materialized-cash-reconciliation.test.js +267 -0
  259. package/lib/tests/materialized-reports/materialized-delivery-accumulation.test.d.ts +1 -0
  260. package/lib/tests/materialized-reports/materialized-delivery-accumulation.test.js +147 -0
  261. package/lib/tests/materialized-reports/materialized-delivery-compile.test.d.ts +1 -0
  262. package/lib/tests/materialized-reports/materialized-delivery-compile.test.js +241 -0
  263. package/lib/tests/materialized-reports/materialized-delivery-fold.test.d.ts +1 -0
  264. package/lib/tests/materialized-reports/materialized-delivery-fold.test.js +109 -0
  265. package/lib/tests/materialized-reports/materialized-delivery-formatter.test.d.ts +1 -0
  266. package/lib/tests/materialized-reports/materialized-delivery-formatter.test.js +141 -0
  267. package/lib/tests/materialized-reports/materialized-delivery-plan.test.d.ts +1 -0
  268. package/lib/tests/materialized-reports/materialized-delivery-plan.test.js +198 -0
  269. package/lib/tests/materialized-reports/materialized-discount-aggregated-formatter.test.d.ts +1 -0
  270. package/lib/tests/materialized-reports/materialized-discount-aggregated-formatter.test.js +173 -0
  271. package/lib/tests/materialized-reports/materialized-discount-classification.test.d.ts +1 -0
  272. package/lib/tests/materialized-reports/materialized-discount-classification.test.js +339 -0
  273. package/lib/tests/materialized-reports/materialized-discount-close-day.test.d.ts +1 -0
  274. package/lib/tests/materialized-reports/materialized-discount-close-day.test.js +506 -0
  275. package/lib/tests/materialized-reports/materialized-discount-compile.test.d.ts +1 -0
  276. package/lib/tests/materialized-reports/materialized-discount-compile.test.js +161 -0
  277. package/lib/tests/materialized-reports/materialized-discount-counter-rows.test.d.ts +1 -0
  278. package/lib/tests/materialized-reports/materialized-discount-counter-rows.test.js +107 -0
  279. package/lib/tests/materialized-reports/materialized-discount-entries-accumulation.test.d.ts +1 -0
  280. package/lib/tests/materialized-reports/materialized-discount-entries-accumulation.test.js +125 -0
  281. package/lib/tests/materialized-reports/materialized-hourly-comparison-compile.test.d.ts +1 -0
  282. package/lib/tests/materialized-reports/materialized-hourly-comparison-compile.test.js +146 -0
  283. package/lib/tests/materialized-reports/materialized-hourly-comparison-formatter.test.d.ts +1 -0
  284. package/lib/tests/materialized-reports/materialized-hourly-comparison-formatter.test.js +127 -0
  285. package/lib/tests/materialized-reports/materialized-hourly-comparison-plan.test.d.ts +1 -0
  286. package/lib/tests/materialized-reports/materialized-hourly-comparison-plan.test.js +138 -0
  287. package/lib/tests/materialized-reports/materialized-hourly-comparison-selection.test.d.ts +1 -0
  288. package/lib/tests/materialized-reports/materialized-hourly-comparison-selection.test.js +90 -0
  289. package/lib/tests/materialized-reports/materialized-payments-comparison-compile.test.d.ts +1 -0
  290. package/lib/tests/materialized-reports/materialized-payments-comparison-compile.test.js +164 -0
  291. package/lib/tests/materialized-reports/materialized-payments-comparison-formatter.test.d.ts +1 -0
  292. package/lib/tests/materialized-reports/materialized-payments-comparison-formatter.test.js +117 -0
  293. package/lib/tests/materialized-reports/materialized-payments-comparison-plan.test.d.ts +1 -0
  294. package/lib/tests/materialized-reports/materialized-payments-comparison-plan.test.js +149 -0
  295. package/lib/tests/materialized-reports/materialized-prep-time-classification.test.d.ts +1 -0
  296. package/lib/tests/materialized-reports/materialized-prep-time-classification.test.js +273 -0
  297. package/lib/tests/materialized-reports/materialized-prep-time-close-day.test.d.ts +1 -0
  298. package/lib/tests/materialized-reports/materialized-prep-time-close-day.test.js +270 -0
  299. package/lib/tests/materialized-reports/materialized-prep-time-compile.test.d.ts +1 -0
  300. package/lib/tests/materialized-reports/materialized-prep-time-compile.test.js +217 -0
  301. package/lib/tests/materialized-reports/materialized-prep-time-constants.test.d.ts +1 -0
  302. package/lib/tests/materialized-reports/materialized-prep-time-constants.test.js +84 -0
  303. package/lib/tests/materialized-reports/materialized-prep-time-plan.test.d.ts +1 -0
  304. package/lib/tests/materialized-reports/materialized-prep-time-plan.test.js +176 -0
  305. package/lib/tests/materialized-reports/materialized-sales-comparison-baseline.test.d.ts +1 -0
  306. package/lib/tests/materialized-reports/materialized-sales-comparison-baseline.test.js +126 -0
  307. package/lib/tests/materialized-reports/materialized-sales-comparison-compile.test.d.ts +1 -0
  308. package/lib/tests/materialized-reports/materialized-sales-comparison-compile.test.js +206 -0
  309. package/lib/tests/materialized-reports/materialized-sales-comparison-formatter.test.d.ts +1 -0
  310. package/lib/tests/materialized-reports/materialized-sales-comparison-formatter.test.js +179 -0
  311. package/lib/tests/materialized-reports/materialized-sales-comparison-parity.test.d.ts +1 -0
  312. package/lib/tests/materialized-reports/materialized-sales-comparison-parity.test.js +196 -0
  313. package/lib/tests/materialized-reports/materialized-sales-comparison-plan.test.d.ts +1 -0
  314. package/lib/tests/materialized-reports/materialized-sales-comparison-plan.test.js +241 -0
  315. package/lib/tests/materialized-reports/materialized-tenant-hourly-comparison-schema.test.d.ts +1 -0
  316. package/lib/tests/materialized-reports/materialized-tenant-hourly-comparison-schema.test.js +96 -0
  317. package/lib/tests/materialized-reports/materialized-tenant-payments-comparison-schema.test.d.ts +1 -0
  318. package/lib/tests/materialized-reports/materialized-tenant-payments-comparison-schema.test.js +112 -0
  319. package/lib/tests/materialized-reports/materialized-tenant-sales-comparison-schema.test.d.ts +1 -0
  320. package/lib/tests/materialized-reports/materialized-tenant-sales-comparison-schema.test.js +142 -0
  321. package/lib/tests/materialized-reports/materialized-tenant-sales-overview-reports-schema.test.js +8 -1
  322. package/lib/tests/materialized-reports/sales-comparison-reference.d.ts +55 -0
  323. package/lib/tests/materialized-reports/sales-comparison-reference.js +86 -0
  324. package/lib/tests/materialized-reports/tenant-discount-formatter.test.d.ts +1 -0
  325. package/lib/tests/materialized-reports/tenant-discount-formatter.test.js +289 -0
  326. package/lib/tests/materialized-reports/tenant-prep-time-formatter.test.d.ts +1 -0
  327. package/lib/tests/materialized-reports/tenant-prep-time-formatter.test.js +354 -0
  328. package/lib/tests/reporting-contract.test.d.ts +1 -0
  329. package/lib/tests/reporting-contract.test.js +267 -0
  330. package/lib/tests/rider-daily-report.test.d.ts +1 -0
  331. package/lib/tests/rider-daily-report.test.js +86 -0
  332. package/lib/tests/rider-earnings.test.d.ts +1 -0
  333. package/lib/tests/rider-earnings.test.js +65 -0
  334. package/lib/tests/rider-report.test.d.ts +1 -0
  335. package/lib/tests/rider-report.test.js +98 -0
  336. package/package.json +10 -1
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const materialized_sales_comparison_close_day_helpers_1 = require("../../helpers/materialized-reports/materialized-sales-comparison-close-day-helpers");
4
+ const materialized_sales_comparison_compile_helpers_1 = require("../../helpers/materialized-reports/materialized-sales-comparison-compile-helpers");
5
+ /**
6
+ * Sales Comparison close-day plan.
7
+ *
8
+ * This report RE-FOLDS its period documents from the day documents. The cases
9
+ * that matter are the ones the discount report got wrong before the handoff:
10
+ * an emptied day, a correction that REMOVES orders, and a period document that
11
+ * was never persisted (rebuilt from its sibling days).
12
+ */
13
+ const TENANT = 'tenant-1';
14
+ const BRAND = 'brand-1';
15
+ const DAY_ONE = '2026-09-14';
16
+ const DAY_TWO = '2026-09-15';
17
+ const order = (id, over = {}) => ({
18
+ _id: id,
19
+ tenant_id: TENANT,
20
+ platform: 'POS_DINE-IN',
21
+ order_status: 'COMPLETED',
22
+ order_number: 100,
23
+ price: 1000,
24
+ total_discount_applied: 0,
25
+ order_settled_at: new Date(`${DAY_ONE}T12:00:00.000Z`),
26
+ createdAt: new Date(`${DAY_ONE}T11:00:00.000Z`),
27
+ updatedAt: new Date(`${DAY_ONE}T12:00:00.000Z`),
28
+ localDate: DAY_ONE,
29
+ categories: [{ category_id: 'c', items: [{ _id: 'i', quantity: 1, subtotal: 1000, _gross_amount: 1000 }] }],
30
+ payments: [],
31
+ ...over,
32
+ });
33
+ const compileDay = (day, ids, stamp) => (0, materialized_sales_comparison_compile_helpers_1.compileTenantSalesComparisonReports)({
34
+ tenantId: TENANT,
35
+ brandId: BRAND,
36
+ localDate: day,
37
+ orders: ids.map((id) => order(id, {
38
+ order_settled_at: new Date(`${day}T12:00:00.000Z`),
39
+ createdAt: new Date(`${day}T11:00:00.000Z`),
40
+ updatedAt: new Date(`${day}T12:00:00.000Z`),
41
+ localDate: day,
42
+ })),
43
+ gmtOffset: 0,
44
+ computedAt: new Date(stamp),
45
+ });
46
+ const emptyState = () => ({ reports: [], entries: [] });
47
+ const planFor = (input) => (0, materialized_sales_comparison_close_day_helpers_1.buildTenantSalesComparisonCloseDayPlan)({
48
+ tenantId: TENANT,
49
+ localDate: input.localDate ?? undefined,
50
+ reports: input.compiled.reports,
51
+ entries: input.compiled.entries,
52
+ existing: input.state.reports,
53
+ existingEntries: input.state.entries,
54
+ reason: 'NEW_DAY',
55
+ computedAt: new Date(input.computedAt),
56
+ force: input.force,
57
+ });
58
+ const apply = (state, plan) => {
59
+ const reports = new Map(state.reports.map((doc) => [`${doc.scope_context}|${doc.scope_field}`, doc]));
60
+ const entries = new Map(state.entries.map((doc) => [`${doc.scope_context}|${doc.scope_field}`, doc]));
61
+ for (const write of plan.writes) {
62
+ reports.set(`${write.report.scope_context}|${write.report.scope_field}`, write.report);
63
+ }
64
+ for (const write of plan.entryWrites) {
65
+ entries.set(`${write.report.scope_context}|${write.report.scope_field}`, write.report);
66
+ }
67
+ for (const doc of plan.staleDocuments) {
68
+ reports.delete(`${doc.scope_context}|${doc.scope_field}`);
69
+ }
70
+ for (const doc of plan.staleEntryDocuments) {
71
+ entries.delete(`${doc.scope_context}|${doc.scope_field}`);
72
+ }
73
+ return { reports: [...reports.values()], entries: [...entries.values()] };
74
+ };
75
+ const monthOf = (state) => state.reports.find((doc) => doc.scope_context === 'localMonth' && doc.scope_field === '2026-09');
76
+ const dayOf = (state, day) => state.reports.find((doc) => doc.scope_context === 'localDate' && doc.scope_field === day);
77
+ describe('sales comparison close-day plan', () => {
78
+ it('writes the day plus every period it touches on the first close', () => {
79
+ const compiled = compileDay(DAY_ONE, ['a'], '2026-09-14T23:00:00.000Z');
80
+ const plan = planFor({ compiled, state: emptyState(), computedAt: '2026-09-14T23:00:00.000Z' });
81
+ const scopes = plan.writes.map((write) => String(write.report.scope_context)).sort();
82
+ expect(scopes).toEqual(['localDate', 'localMonth', 'localQuarter', 'localSemester', 'localWeek', 'localYear'].sort());
83
+ // No ISO-week scope: this report deliberately does not materialize it.
84
+ expect(scopes).not.toContain('localWeekOfYear');
85
+ expect(plan.createdPeriodDocuments).toHaveLength(5);
86
+ expect(plan.writes.every((write) => write.report.iteration === 1)).toBe(true);
87
+ const month = plan.writes.find((write) => write.report.scope_context === 'localMonth').report;
88
+ expect(month.sales_counters['COMPLETED:POS_DINE-IN'].order_count).toBe(1);
89
+ expect(month.sales_counter_rows[0].counters).toEqual(month.sales_counters['COMPLETED:POS_DINE-IN']);
90
+ });
91
+ it('RE-FOLDS the month from both days on the second close', () => {
92
+ const first = planFor({
93
+ compiled: compileDay(DAY_ONE, ['a'], '2026-09-14T23:00:00.000Z'),
94
+ state: emptyState(),
95
+ computedAt: '2026-09-14T23:00:00.000Z',
96
+ });
97
+ const stateOne = apply(emptyState(), first);
98
+ const second = planFor({
99
+ compiled: compileDay(DAY_TWO, ['b'], '2026-09-15T23:00:00.000Z'),
100
+ state: stateOne,
101
+ computedAt: '2026-09-15T23:00:00.000Z',
102
+ });
103
+ const stateTwo = apply(stateOne, second);
104
+ const month = monthOf(stateTwo);
105
+ expect(month.sales_counters['COMPLETED:POS_DINE-IN'].order_count).toBe(2);
106
+ expect(month.sales_counters['COMPLETED:POS_DINE-IN'].gross_amount).toBe(2000);
107
+ expect(month.source_watermark.getTime()).toBe(new Date('2026-09-15T12:00:00.000Z').getTime());
108
+ // the entries fold both days' rows
109
+ const monthEntries = stateTwo.entries.find((doc) => doc.scope_context === 'localMonth' && doc.scope_field === '2026-09');
110
+ expect(monthEntries.sales_entries['COMPLETED:POS_DINE-IN'].rows).toHaveLength(2);
111
+ });
112
+ it('corrects in place: a re-close that REMOVES an order does not leave residue', () => {
113
+ const first = planFor({
114
+ compiled: compileDay(DAY_ONE, ['a', 'b'], '2026-09-14T23:00:00.000Z'),
115
+ state: emptyState(),
116
+ computedAt: '2026-09-14T23:00:00.000Z',
117
+ });
118
+ const stateOne = apply(emptyState(), first);
119
+ expect(monthOf(stateOne).sales_counters['COMPLETED:POS_DINE-IN'].order_count).toBe(2);
120
+ const correction = planFor({
121
+ compiled: compileDay(DAY_ONE, ['a'], '2026-09-14T23:30:00.000Z'),
122
+ state: stateOne,
123
+ computedAt: '2026-09-14T23:30:00.000Z',
124
+ });
125
+ const stateTwo = apply(stateOne, correction);
126
+ expect(monthOf(stateTwo).sales_counters['COMPLETED:POS_DINE-IN'].order_count).toBe(1);
127
+ expect(monthOf(stateTwo).sales_counters['COMPLETED:POS_DINE-IN'].gross_amount).toBe(1000);
128
+ // and the drill-down reflects the same one order
129
+ const monthEntries = stateTwo.entries.find((doc) => doc.scope_context === 'localMonth' && doc.scope_field === '2026-09');
130
+ expect(monthEntries.sales_entries['COMPLETED:POS_DINE-IN'].rows.map((row) => row.order_id)).toEqual(['a']);
131
+ });
132
+ it('EMPTYING a day retires its day document and clears every period it was alone in', () => {
133
+ const first = planFor({
134
+ compiled: compileDay(DAY_ONE, ['a'], '2026-09-14T23:00:00.000Z'),
135
+ state: emptyState(),
136
+ computedAt: '2026-09-14T23:00:00.000Z',
137
+ });
138
+ const stateOne = apply(emptyState(), first);
139
+ const emptied = planFor({
140
+ compiled: compileDay(DAY_ONE, [], '2026-09-14T23:30:00.000Z'),
141
+ state: stateOne,
142
+ localDate: DAY_ONE,
143
+ computedAt: '2026-09-14T23:30:00.000Z',
144
+ force: true,
145
+ });
146
+ const stateTwo = apply(stateOne, emptied);
147
+ expect(emptied.staleDocuments.map((doc) => doc.scope_field)).toContain(DAY_ONE);
148
+ expect(emptied.staleEntryDocuments.map((doc) => doc.scope_field)).toContain(DAY_ONE);
149
+ expect(stateTwo.reports).toHaveLength(0);
150
+ expect(stateTwo.entries).toHaveLength(0);
151
+ });
152
+ it('REBUILDS a missing period document from the sibling days still on hand', () => {
153
+ const first = planFor({
154
+ compiled: compileDay(DAY_ONE, ['a'], '2026-09-14T23:00:00.000Z'),
155
+ state: emptyState(),
156
+ computedAt: '2026-09-14T23:00:00.000Z',
157
+ });
158
+ const stateOne = apply(emptyState(), first);
159
+ // Simulate the partial failure the fetch contract exists for: the DAY doc
160
+ // was persisted, the period docs were not.
161
+ const lostPeriods = {
162
+ reports: stateOne.reports.filter((doc) => doc.scope_context === 'localDate'),
163
+ entries: stateOne.entries.filter((doc) => doc.scope_context === 'localDate'),
164
+ };
165
+ const second = planFor({
166
+ compiled: compileDay(DAY_TWO, ['b'], '2026-09-15T23:00:00.000Z'),
167
+ state: lostPeriods,
168
+ computedAt: '2026-09-15T23:00:00.000Z',
169
+ });
170
+ const stateTwo = apply(lostPeriods, second);
171
+ const month = monthOf(stateTwo);
172
+ expect(month.sales_counters['COMPLETED:POS_DINE-IN'].order_count).toBe(2);
173
+ expect(second.createdPeriodDocuments.some((ref) => ref.scope_context === 'localMonth')).toBe(true);
174
+ });
175
+ it('does not double-count an unchanged re-close', () => {
176
+ const first = planFor({
177
+ compiled: compileDay(DAY_ONE, ['a'], '2026-09-14T23:00:00.000Z'),
178
+ state: emptyState(),
179
+ computedAt: '2026-09-14T23:00:00.000Z',
180
+ });
181
+ const stateOne = apply(emptyState(), first);
182
+ const replay = planFor({
183
+ compiled: compileDay(DAY_ONE, ['a'], '2026-09-14T23:00:00.000Z'),
184
+ state: stateOne,
185
+ computedAt: '2026-09-14T23:05:00.000Z',
186
+ });
187
+ expect(replay.writes).toHaveLength(0);
188
+ expect(replay.entryWrites).toHaveLength(0);
189
+ const stateTwo = apply(stateOne, replay);
190
+ expect(monthOf(stateTwo).sales_counters['COMPLETED:POS_DINE-IN'].order_count).toBe(1);
191
+ });
192
+ it('returns null on malformed input', () => {
193
+ expect((0, materialized_sales_comparison_close_day_helpers_1.buildTenantSalesComparisonCloseDayPlan)(null)).toBeNull();
194
+ expect((0, materialized_sales_comparison_close_day_helpers_1.buildTenantSalesComparisonCloseDayPlan)({
195
+ tenantId: '',
196
+ reports: [],
197
+ entries: [],
198
+ reason: 'NEW_DAY',
199
+ })).toBeNull();
200
+ expect((0, materialized_sales_comparison_close_day_helpers_1.buildTenantSalesComparisonCloseDayPlan)({
201
+ tenantId: TENANT,
202
+ reports: [],
203
+ entries: [],
204
+ reason: '',
205
+ })).toBeNull();
206
+ // nothing compiled and no day to retire
207
+ expect((0, materialized_sales_comparison_close_day_helpers_1.buildTenantSalesComparisonCloseDayPlan)({
208
+ tenantId: TENANT,
209
+ reports: [],
210
+ entries: [],
211
+ reason: 'NEW_DAY',
212
+ })).toBeNull();
213
+ });
214
+ });
215
+ describe('sales comparison fold + refs', () => {
216
+ it('folds only the day documents inside the period', () => {
217
+ const one = compileDay(DAY_ONE, ['a'], '2026-09-14T23:00:00.000Z');
218
+ const two = compileDay(DAY_TWO, ['b'], '2026-09-15T23:00:00.000Z');
219
+ const folded = (0, materialized_sales_comparison_close_day_helpers_1.foldMaterializedSalesComparisonPeriodCounters)({
220
+ periodScope: 'localWeek',
221
+ periodScopeField: '2026-09-13',
222
+ dayDocuments: [...one.reports, ...two.reports],
223
+ });
224
+ expect(folded['COMPLETED:POS_DINE-IN'].order_count).toBe(2);
225
+ });
226
+ it('lists the day + five period refs and every day of the touched year', () => {
227
+ const refs = (0, materialized_sales_comparison_close_day_helpers_1.getMaterializedSalesComparisonScopeRefsForDay)(DAY_ONE);
228
+ expect(refs.map((ref) => ref.scope_context)).toEqual([
229
+ 'localDate',
230
+ 'localWeek',
231
+ 'localMonth',
232
+ 'localQuarter',
233
+ 'localSemester',
234
+ 'localYear',
235
+ ]);
236
+ const days = (0, materialized_sales_comparison_close_day_helpers_1.getMaterializedSalesComparisonPeriodDayKeys)(DAY_ONE);
237
+ expect(days[0]).toBe('2026-01-01');
238
+ expect(days[days.length - 1]).toBe('2026-12-31');
239
+ expect(days).toHaveLength(365);
240
+ });
241
+ });
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const mongoose_1 = __importDefault(require("mongoose"));
7
+ const ENUMS_1 = require("../../constants/ENUMS");
8
+ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
9
+ const materialized_tenant_hourly_comparison_entries_1 = require("../../schemas/models/materialized_tenant_hourly_comparison_entries");
10
+ const materialized_tenant_hourly_comparison_reports_1 = require("../../schemas/models/materialized_tenant_hourly_comparison_reports");
11
+ /**
12
+ * Hourly Comparison schema contract: the pair, the ONE identity index, the hour
13
+ * scope, and the reused Sales Comparison counter shape.
14
+ */
15
+ const ReportModel = mongoose_1.default.models[MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_NAME] ??
16
+ mongoose_1.default.model(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_NAME, materialized_tenant_hourly_comparison_reports_1.MaterializedTenantHourlyComparisonReportSchema, MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_NAME);
17
+ const EntriesModel = mongoose_1.default.models[MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_NAME] ??
18
+ mongoose_1.default.model(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_NAME, materialized_tenant_hourly_comparison_entries_1.MaterializedTenantHourlyComparisonEntriesSchema, MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_NAME);
19
+ const reportDocument = (over = {}) => ({
20
+ _id: new mongoose_1.default.Types.ObjectId(),
21
+ tenant_id: 'tenant-1',
22
+ brand_id: 'brand-1',
23
+ scope_context: 'localHour',
24
+ scope_field: '2026-09-14 18',
25
+ day_index: ENUMS_1.DAY_INDEX_ENUM.MON,
26
+ sale_type_key_filters: [...MATERIALIZED_REPORTS_1.HOURLY_COMPARISON_KEY_FILTERS],
27
+ sales_counters: { 'COMPLETED:POS_DINE-IN': { order_count: 1 } },
28
+ sales_counter_rows: [{ key: 'COMPLETED:POS_DINE-IN', counters: { order_count: 1 } }],
29
+ schema_version: materialized_tenant_hourly_comparison_reports_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_SCHEMA_VERSION,
30
+ source_watermark: new Date('2026-09-14T13:00:00.000Z'),
31
+ computed_at: new Date('2026-09-14T23:00:00.000Z'),
32
+ createdAt: new Date('2026-09-14T23:00:00.000Z'),
33
+ updatedAt: new Date('2026-09-14T23:00:00.000Z'),
34
+ ...over,
35
+ });
36
+ const entriesDocument = (over = {}) => ({
37
+ _id: new mongoose_1.default.Types.ObjectId(),
38
+ tenant_id: 'tenant-1',
39
+ brand_id: 'brand-1',
40
+ scope_context: 'localHour',
41
+ scope_field: '2026-09-14 18',
42
+ day_index: ENUMS_1.DAY_INDEX_ENUM.MON,
43
+ sale_type_key_filters: [...MATERIALIZED_REPORTS_1.HOURLY_COMPARISON_KEY_FILTERS],
44
+ sales_entries: {
45
+ 'COMPLETED:POS_DINE-IN': {
46
+ rows: [
47
+ {
48
+ order_id: 'o1',
49
+ order_number: 1,
50
+ time: '2026-09-14T13:00:00.000Z',
51
+ order_status: 'COMPLETED',
52
+ platform: 'POS_DINE-IN',
53
+ net_amount: 1000,
54
+ discount_amount: 0,
55
+ item_count: 1,
56
+ },
57
+ ],
58
+ },
59
+ },
60
+ schema_version: materialized_tenant_hourly_comparison_entries_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_SCHEMA_VERSION,
61
+ source_watermark: new Date('2026-09-14T13:00:00.000Z'),
62
+ computed_at: new Date('2026-09-14T23:00:00.000Z'),
63
+ createdAt: new Date('2026-09-14T23:00:00.000Z'),
64
+ updatedAt: new Date('2026-09-14T23:00:00.000Z'),
65
+ ...over,
66
+ });
67
+ describe('materialized_tenant_hourly_comparison schema', () => {
68
+ it('exposes the agreed collection names', () => {
69
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_NAME).toBe('materialized_tenant_hourly_comparison_reports');
70
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_NAME).toBe('materialized_tenant_hourly_comparison_entries');
71
+ });
72
+ it('declares the ONE unique identity/read index on both collections', () => {
73
+ const expected = {
74
+ _id: { _id: 1 },
75
+ tenant_id__scope_context__scope_field__day_index: {
76
+ tenant_id: 1,
77
+ scope_context: 1,
78
+ scope_field: 1,
79
+ day_index: 1,
80
+ },
81
+ };
82
+ expect(materialized_tenant_hourly_comparison_reports_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_INDEXES).toEqual(expected);
83
+ expect(materialized_tenant_hourly_comparison_entries_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_INDEXES).toEqual(expected);
84
+ expect(materialized_tenant_hourly_comparison_reports_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_INDEX_OPTIONS[0].unique).toBe(true);
85
+ expect(materialized_tenant_hourly_comparison_entries_1.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_INDEX_OPTIONS[0].unique).toBe(true);
86
+ });
87
+ it('accepts an hour document and rejects a non-hour scope', () => {
88
+ expect(new ReportModel(reportDocument()).validateSync()).toBeUndefined();
89
+ expect(new ReportModel(reportDocument({ scope_context: 'localDate' })).validateSync()).toBeDefined();
90
+ expect(new EntriesModel(entriesDocument()).validateSync()).toBeUndefined();
91
+ });
92
+ it('materializes the hour scope only', () => {
93
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_HOURLY_COMPARISON_REPORT_SCOPES).toEqual(['localHour']);
94
+ expect(MATERIALIZED_REPORTS_1.HOURLY_COMPARISON_KEY_FILTERS).toEqual(['ORDER_STATUS', 'PLATFORM']);
95
+ });
96
+ });
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const mongoose_1 = __importDefault(require("mongoose"));
7
+ const ENUMS_1 = require("../../constants/ENUMS");
8
+ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
9
+ const materialized_tenant_payments_comparison_entries_1 = require("../../schemas/models/materialized_tenant_payments_comparison_entries");
10
+ const materialized_tenant_payments_comparison_reports_1 = require("../../schemas/models/materialized_tenant_payments_comparison_reports");
11
+ const materialized_tenant_payments_comparison_reports_2 = require("../../schemas/types/materialized_tenant_payments_comparison_reports");
12
+ const ReportModel = mongoose_1.default.models[MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_NAME] ??
13
+ mongoose_1.default.model(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_NAME, materialized_tenant_payments_comparison_reports_1.MaterializedTenantPaymentsComparisonReportSchema, MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_NAME);
14
+ const EntriesModel = mongoose_1.default.models[MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_NAME] ??
15
+ mongoose_1.default.model(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_NAME, materialized_tenant_payments_comparison_entries_1.MaterializedTenantPaymentsComparisonEntriesSchema, MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_NAME);
16
+ const reportDocument = (over = {}) => ({
17
+ _id: new mongoose_1.default.Types.ObjectId(),
18
+ tenant_id: 'tenant-1',
19
+ brand_id: 'brand-1',
20
+ scope_context: 'localDate',
21
+ scope_field: '2026-09-14',
22
+ day_index: ENUMS_1.DAY_INDEX_ENUM.MON,
23
+ sale_type_key_filters: [...MATERIALIZED_REPORTS_1.PAYMENTS_COMPARISON_KEY_FILTERS],
24
+ payment_counters: { 'CASH:COMPLETED': { payment_count: 1 } },
25
+ payment_counter_rows: [{ key: 'CASH:COMPLETED', counters: { payment_count: 1 } }],
26
+ schema_version: materialized_tenant_payments_comparison_reports_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_SCHEMA_VERSION,
27
+ source_watermark: new Date('2026-09-14T13:00:00.000Z'),
28
+ computed_at: new Date('2026-09-14T23:00:00.000Z'),
29
+ createdAt: new Date('2026-09-14T23:00:00.000Z'),
30
+ updatedAt: new Date('2026-09-14T23:00:00.000Z'),
31
+ ...over,
32
+ });
33
+ const entriesDocument = (over = {}) => ({
34
+ _id: new mongoose_1.default.Types.ObjectId(),
35
+ tenant_id: 'tenant-1',
36
+ brand_id: 'brand-1',
37
+ scope_context: 'localDate',
38
+ scope_field: '2026-09-14',
39
+ day_index: ENUMS_1.DAY_INDEX_ENUM.MON,
40
+ sale_type_key_filters: [...MATERIALIZED_REPORTS_1.PAYMENTS_COMPARISON_KEY_FILTERS],
41
+ payment_entries: {
42
+ 'CASH:COMPLETED': {
43
+ rows: [
44
+ {
45
+ order_id: 'o1',
46
+ order_number: 1,
47
+ payment_id: 'p1',
48
+ time: '2026-09-14T13:00:00.000Z',
49
+ payment_type: 'CASH',
50
+ order_status: 'COMPLETED',
51
+ payment_amount: 1000,
52
+ amount_due: 1000,
53
+ amount_paid: 1000,
54
+ amount_refunded: 0,
55
+ card_charges: 0,
56
+ },
57
+ ],
58
+ },
59
+ },
60
+ schema_version: materialized_tenant_payments_comparison_entries_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_SCHEMA_VERSION,
61
+ source_watermark: new Date('2026-09-14T13:00:00.000Z'),
62
+ computed_at: new Date('2026-09-14T23:00:00.000Z'),
63
+ createdAt: new Date('2026-09-14T23:00:00.000Z'),
64
+ updatedAt: new Date('2026-09-14T23:00:00.000Z'),
65
+ ...over,
66
+ });
67
+ describe('materialized_tenant_payments_comparison schema', () => {
68
+ it('exposes the collection names and the ONE identity index', () => {
69
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_NAME).toBe('materialized_tenant_payments_comparison_reports');
70
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_NAME).toBe('materialized_tenant_payments_comparison_entries');
71
+ const expected = {
72
+ _id: { _id: 1 },
73
+ tenant_id__scope_context__scope_field__day_index: {
74
+ tenant_id: 1,
75
+ scope_context: 1,
76
+ scope_field: 1,
77
+ day_index: 1,
78
+ },
79
+ };
80
+ expect(materialized_tenant_payments_comparison_reports_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_INDEXES).toEqual(expected);
81
+ expect(materialized_tenant_payments_comparison_entries_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_INDEXES).toEqual(expected);
82
+ expect(materialized_tenant_payments_comparison_reports_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_INDEX_OPTIONS[0].unique).toBe(true);
83
+ expect(materialized_tenant_payments_comparison_entries_1.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_INDEX_OPTIONS[0].unique).toBe(true);
84
+ });
85
+ it('accepts valid documents and rejects an hour scope', () => {
86
+ expect(new ReportModel(reportDocument()).validateSync()).toBeUndefined();
87
+ expect(new EntriesModel(entriesDocument()).validateSync()).toBeUndefined();
88
+ expect(new ReportModel(reportDocument({ scope_context: 'localHour' })).validateSync()).toBeDefined();
89
+ });
90
+ it('declares the six scopes, method+status key and the additive counter list', () => {
91
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_PAYMENTS_COMPARISON_REPORT_SCOPES).toEqual([
92
+ 'localDate',
93
+ 'localWeek',
94
+ 'localMonth',
95
+ 'localQuarter',
96
+ 'localSemester',
97
+ 'localYear',
98
+ ]);
99
+ expect(MATERIALIZED_REPORTS_1.PAYMENTS_COMPARISON_KEY_FILTERS).toEqual(['PAYMENT_METHOD', 'ORDER_STATUS']);
100
+ expect([...materialized_tenant_payments_comparison_reports_2.ALL_MATERIALIZED_PAYMENTS_COMPARISON_COUNTERS].sort()).toEqual([
101
+ 'payment_count',
102
+ 'payment_amount',
103
+ 'amount_due',
104
+ 'amount_paid',
105
+ 'amount_refunded',
106
+ 'card_charges',
107
+ 'refund_count',
108
+ 'unpaid_count',
109
+ ].sort());
110
+ expect(materialized_tenant_payments_comparison_reports_2.ALL_MATERIALIZED_PAYMENTS_COMPARISON_COUNTERS).not.toContain('average_payment');
111
+ });
112
+ });
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const mongoose_1 = __importDefault(require("mongoose"));
7
+ const ENUMS_1 = require("../../constants/ENUMS");
8
+ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
9
+ const materialized_tenant_sales_comparison_entries_1 = require("../../schemas/models/materialized_tenant_sales_comparison_entries");
10
+ const materialized_tenant_sales_comparison_reports_1 = require("../../schemas/models/materialized_tenant_sales_comparison_reports");
11
+ const materialized_tenant_sales_comparison_reports_2 = require("../../schemas/types/materialized_tenant_sales_comparison_reports");
12
+ const materialized_sales_comparison_accumulator_helpers_1 = require("../../helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers");
13
+ /**
14
+ * Sales Comparison schema contract.
15
+ *
16
+ * The collection name + the ONE unique identity index are what the read hint
17
+ * and the close-day upserts depend on; the counter shape is what the map/rows
18
+ * agreement depends on.
19
+ */
20
+ const ReportModel = mongoose_1.default.models[MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_NAME] ??
21
+ mongoose_1.default.model(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_NAME, materialized_tenant_sales_comparison_reports_1.MaterializedTenantSalesComparisonReportSchema, MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_NAME);
22
+ const EntriesModel = mongoose_1.default.models[MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_NAME] ??
23
+ mongoose_1.default.model(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_NAME, materialized_tenant_sales_comparison_entries_1.MaterializedTenantSalesComparisonEntriesSchema, MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_NAME);
24
+ const counters = () => (0, materialized_sales_comparison_accumulator_helpers_1.createEmptySalesComparisonCounters)();
25
+ const reportDocument = (over = {}) => ({
26
+ _id: new mongoose_1.default.Types.ObjectId(),
27
+ tenant_id: 'tenant-1',
28
+ brand_id: 'brand-1',
29
+ scope_context: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
30
+ scope_field: '2026-09-14',
31
+ day_index: ENUMS_1.DAY_INDEX_ENUM.MON,
32
+ sale_type_key_filters: [...MATERIALIZED_REPORTS_1.SALES_COMPARISON_KEY_FILTERS],
33
+ sales_counters: { 'COMPLETED:POS_DINE-IN': counters() },
34
+ sales_counter_rows: [{ key: 'COMPLETED:POS_DINE-IN', counters: counters() }],
35
+ schema_version: materialized_tenant_sales_comparison_reports_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_SCHEMA_VERSION,
36
+ source_watermark: new Date('2026-09-14T12:00:00.000Z'),
37
+ computed_at: new Date('2026-09-14T23:00:00.000Z'),
38
+ createdAt: new Date('2026-09-14T23:00:00.000Z'),
39
+ updatedAt: new Date('2026-09-14T23:00:00.000Z'),
40
+ ...over,
41
+ });
42
+ const entriesDocument = (over = {}) => ({
43
+ _id: new mongoose_1.default.Types.ObjectId(),
44
+ tenant_id: 'tenant-1',
45
+ brand_id: 'brand-1',
46
+ scope_context: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
47
+ scope_field: '2026-09-14',
48
+ day_index: ENUMS_1.DAY_INDEX_ENUM.MON,
49
+ sale_type_key_filters: [...MATERIALIZED_REPORTS_1.SALES_COMPARISON_KEY_FILTERS],
50
+ sales_entries: {
51
+ 'COMPLETED:POS_DINE-IN': {
52
+ rows: [
53
+ {
54
+ order_id: 'o1',
55
+ order_number: 1,
56
+ time: '2026-09-14T12:00:00.000Z',
57
+ order_status: 'COMPLETED',
58
+ platform: 'POS_DINE-IN',
59
+ net_amount: 1000,
60
+ discount_amount: 100,
61
+ item_count: 2,
62
+ },
63
+ ],
64
+ },
65
+ },
66
+ schema_version: materialized_tenant_sales_comparison_entries_1.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_SCHEMA_VERSION,
67
+ source_watermark: new Date('2026-09-14T12:00:00.000Z'),
68
+ computed_at: new Date('2026-09-14T23:00:00.000Z'),
69
+ createdAt: new Date('2026-09-14T23:00:00.000Z'),
70
+ updatedAt: new Date('2026-09-14T23:00:00.000Z'),
71
+ ...over,
72
+ });
73
+ describe('materialized_tenant_sales_comparison_reports schema', () => {
74
+ it('exposes the agreed collection names', () => {
75
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_NAME).toBe('materialized_tenant_sales_comparison_reports');
76
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_NAME).toBe('materialized_tenant_sales_comparison_entries');
77
+ });
78
+ it('declares the ONE unique identity/read index on both collections', () => {
79
+ expect(materialized_tenant_sales_comparison_reports_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_INDEXES).toEqual({
80
+ _id: { _id: 1 },
81
+ tenant_id__scope_context__scope_field__day_index: {
82
+ tenant_id: 1,
83
+ scope_context: 1,
84
+ scope_field: 1,
85
+ day_index: 1,
86
+ },
87
+ });
88
+ expect(materialized_tenant_sales_comparison_reports_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_INDEX_OPTIONS).toEqual([
89
+ {
90
+ key: { tenant_id: 1, scope_context: 1, scope_field: 1, day_index: 1 },
91
+ name: 'tenant_id__scope_context__scope_field__day_index',
92
+ unique: true,
93
+ },
94
+ ]);
95
+ expect(materialized_tenant_sales_comparison_entries_1.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_INDEXES).toEqual(materialized_tenant_sales_comparison_reports_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_INDEXES);
96
+ expect(materialized_tenant_sales_comparison_entries_1.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_INDEX_OPTIONS).toEqual(materialized_tenant_sales_comparison_reports_1.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_INDEX_OPTIONS);
97
+ });
98
+ it('accepts a valid document (map + read-path rows) and a null day_index on periods', () => {
99
+ const doc = new ReportModel(reportDocument({
100
+ day_index: null,
101
+ scope_context: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
102
+ scope_field: '2026-09',
103
+ }));
104
+ expect(doc.validateSync()).toBeUndefined();
105
+ });
106
+ it('has exactly the additive counter list, and no stored ratio', () => {
107
+ expect([...materialized_tenant_sales_comparison_reports_2.ALL_MATERIALIZED_SALES_COMPARISON_COUNTERS].sort()).toEqual(Object.keys((0, materialized_sales_comparison_accumulator_helpers_1.createEmptySalesComparisonCounters)()).sort());
108
+ expect(materialized_tenant_sales_comparison_reports_2.ALL_MATERIALIZED_SALES_COMPARISON_COUNTERS).not.toContain('average_ticket');
109
+ });
110
+ it('rejects an hour scope (this report has none) and an unknown key dimension', () => {
111
+ const hour = new ReportModel(reportDocument({ scope_context: 'localHour' }));
112
+ expect(hour.validateSync()).toBeDefined();
113
+ const badFilter = new ReportModel(reportDocument({ sale_type_key_filters: ['SALE_TYPE'] }));
114
+ expect(badFilter.validateSync()).toBeDefined();
115
+ const emptyFilters = new ReportModel(reportDocument({ sale_type_key_filters: [] }));
116
+ expect(emptyFilters.validateSync()).toBeDefined();
117
+ });
118
+ it('declares the six scopes and no ISO week', () => {
119
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_SALES_COMPARISON_REPORT_SCOPES).toEqual([
120
+ 'localDate',
121
+ 'localWeek',
122
+ 'localMonth',
123
+ 'localQuarter',
124
+ 'localSemester',
125
+ 'localYear',
126
+ ]);
127
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_SALES_COMPARISON_REPORT_SCOPES).not.toContain('localWeekOfYear');
128
+ expect(MATERIALIZED_REPORTS_1.MATERIALIZED_SALES_COMPARISON_REPORT_SCOPES).not.toContain('localHour');
129
+ });
130
+ it('declares ORDER_STATUS:PLATFORM and no sale-type dimension', () => {
131
+ expect(MATERIALIZED_REPORTS_1.SALES_COMPARISON_KEY_FILTERS).toEqual(['ORDER_STATUS', 'PLATFORM']);
132
+ expect(MATERIALIZED_REPORTS_1.SALES_COMPARISON_KEY_FILTERS.length).toBeLessThanOrEqual(MATERIALIZED_REPORTS_1.ALL_MATERIALIZED_REPORT_KEY_FILTERS.length);
133
+ });
134
+ });
135
+ describe('materialized_tenant_sales_comparison_entries schema', () => {
136
+ it('accepts an order row document', () => {
137
+ expect(new EntriesModel(entriesDocument()).validateSync()).toBeUndefined();
138
+ });
139
+ it('requires the entries map (a zero-row document is DELETED, never stored)', () => {
140
+ expect(new EntriesModel(entriesDocument({ sales_entries: null })).validateSync()).toBeDefined();
141
+ });
142
+ });
@@ -208,9 +208,16 @@ describe('materialized_tenant_sales_overview_reports schema', () => {
208
208
  expect(badDayIndex?.errors).toHaveProperty('day_index');
209
209
  });
210
210
  it('rejects unsupported key-filter dimensions', () => {
211
+ // NOTE: this test previously used 'CITY' as its unsupported example. The delivery
212
+ // report (M4) legitimately ADDED CITY as a real dimension - a key is <PLATFORM>:<CITY>
213
+ // - so the fixture silently stopped testing rejection. The sentinel is now a value
214
+ // that is deliberately not a dimension, and the guard below makes the test fail
215
+ // LOUDLY if that ever changes, instead of quietly passing on a valid value.
216
+ const unsupported = 'NOT_A_DIMENSION';
217
+ expect(MATERIALIZED_REPORTS_1.ALL_MATERIALIZED_REPORT_KEY_FILTERS).not.toContain(unsupported);
211
218
  const badFilters = new Model({
212
219
  ...validDocument(),
213
- sale_type_key_filters: ['ORDER_STATUS', 'CITY'],
220
+ sale_type_key_filters: ['ORDER_STATUS', unsupported],
214
221
  }).validateSync();
215
222
  expect(Object.keys(badFilters?.errors ?? {})).toContain('sale_type_key_filters.1');
216
223
  });