@managesome/eposmatic-toolkit 0.4.60 → 0.4.62

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 (96) hide show
  1. package/esm/constants/MATERIALIZED_REPORTS.js +254 -4
  2. package/esm/constants/TENANT_ENUMS.js +15 -0
  3. package/esm/constants/WORKER_ENDPOINTS.js +12 -0
  4. package/esm/helpers/materialized-reports/index.js +8 -0
  5. package/esm/helpers/materialized-reports/materialized-day-readiness.js +2 -2
  6. package/esm/helpers/materialized-reports/materialized-dinein-accumulator-helpers.js +557 -0
  7. package/esm/helpers/materialized-reports/materialized-dinein-classification-helpers.js +447 -0
  8. package/esm/helpers/materialized-reports/materialized-dinein-close-day-helpers.js +372 -0
  9. package/esm/helpers/materialized-reports/materialized-dinein-compile-helpers.js +500 -0
  10. package/esm/helpers/materialized-reports/materialized-dinein-entry-pages.js +218 -0
  11. package/esm/helpers/materialized-reports/materialized-dinein-key-helpers.js +87 -0
  12. package/esm/helpers/materialized-reports/materialized-index-bootstrap.js +7 -1
  13. package/esm/helpers/materialized-reports/materialized-report-drilldown-rows.js +8 -0
  14. package/esm/helpers/materialized-reports/materialized-report-runs.js +143 -0
  15. package/esm/helpers/materialized-reports/report-platform/definition.js +93 -1
  16. package/esm/helpers/materialized-reports/tenant-dinein-formatter.js +240 -0
  17. package/esm/helpers/reporting-contract/report-contract.js +3 -0
  18. package/esm/schemas/models/index.js +3 -0
  19. package/esm/schemas/models/materialized_tenant_dinein_entries.js +57 -0
  20. package/esm/schemas/models/materialized_tenant_dinein_reports.js +73 -0
  21. package/esm/schemas/models/materialized_tenant_report_runs.js +105 -0
  22. package/esm/schemas/models/tenant_active_jobs.js +19 -1
  23. package/esm/schemas/types/index.js +3 -0
  24. package/esm/schemas/types/materialized_report_drilldown_rows.js +1 -0
  25. package/esm/schemas/types/materialized_tenant_dinein_entries.js +1 -0
  26. package/esm/schemas/types/materialized_tenant_dinein_reports.js +6 -0
  27. package/esm/schemas/types/materialized_tenant_report_runs.js +1 -0
  28. package/lib/constants/MATERIALIZED_REPORTS.d.ts +229 -4
  29. package/lib/constants/MATERIALIZED_REPORTS.js +255 -5
  30. package/lib/constants/TENANT_ENUMS.d.ts +14 -0
  31. package/lib/constants/TENANT_ENUMS.js +16 -1
  32. package/lib/constants/WORKER_ENDPOINTS.d.ts +12 -0
  33. package/lib/constants/WORKER_ENDPOINTS.js +12 -0
  34. package/lib/helpers/materialized-reports/index.d.ts +8 -0
  35. package/lib/helpers/materialized-reports/index.js +8 -0
  36. package/lib/helpers/materialized-reports/materialized-day-readiness.d.ts +1 -1
  37. package/lib/helpers/materialized-reports/materialized-day-readiness.js +2 -2
  38. package/lib/helpers/materialized-reports/materialized-dinein-accumulator-helpers.d.ts +67 -0
  39. package/lib/helpers/materialized-reports/materialized-dinein-accumulator-helpers.js +582 -0
  40. package/lib/helpers/materialized-reports/materialized-dinein-classification-helpers.d.ts +245 -0
  41. package/lib/helpers/materialized-reports/materialized-dinein-classification-helpers.js +469 -0
  42. package/lib/helpers/materialized-reports/materialized-dinein-close-day-helpers.d.ts +110 -0
  43. package/lib/helpers/materialized-reports/materialized-dinein-close-day-helpers.js +384 -0
  44. package/lib/helpers/materialized-reports/materialized-dinein-compile-helpers.d.ts +73 -0
  45. package/lib/helpers/materialized-reports/materialized-dinein-compile-helpers.js +504 -0
  46. package/lib/helpers/materialized-reports/materialized-dinein-entry-pages.d.ts +69 -0
  47. package/lib/helpers/materialized-reports/materialized-dinein-entry-pages.js +231 -0
  48. package/lib/helpers/materialized-reports/materialized-dinein-key-helpers.d.ts +44 -0
  49. package/lib/helpers/materialized-reports/materialized-dinein-key-helpers.js +96 -0
  50. package/lib/helpers/materialized-reports/materialized-index-bootstrap.js +6 -0
  51. package/lib/helpers/materialized-reports/materialized-report-drilldown-rows.js +8 -0
  52. package/lib/helpers/materialized-reports/materialized-report-runs.d.ts +105 -0
  53. package/lib/helpers/materialized-reports/materialized-report-runs.js +156 -0
  54. package/lib/helpers/materialized-reports/report-platform/definition.js +92 -0
  55. package/lib/helpers/materialized-reports/tenant-dinein-formatter.d.ts +225 -0
  56. package/lib/helpers/materialized-reports/tenant-dinein-formatter.js +243 -0
  57. package/lib/helpers/reporting-contract/report-contract.d.ts +1 -0
  58. package/lib/helpers/reporting-contract/report-contract.js +3 -0
  59. package/lib/helpers/types/workers.d.ts +65 -0
  60. package/lib/schemas/models/index.d.ts +3 -0
  61. package/lib/schemas/models/index.js +3 -0
  62. package/lib/schemas/models/materialized_tenant_day_readiness.d.ts +3 -3
  63. package/lib/schemas/models/materialized_tenant_dinein_entries.d.ts +100 -0
  64. package/lib/schemas/models/materialized_tenant_dinein_entries.js +60 -0
  65. package/lib/schemas/models/materialized_tenant_dinein_reports.d.ts +111 -0
  66. package/lib/schemas/models/materialized_tenant_dinein_reports.js +76 -0
  67. package/lib/schemas/models/materialized_tenant_report_runs.d.ts +97 -0
  68. package/lib/schemas/models/materialized_tenant_report_runs.js +108 -0
  69. package/lib/schemas/models/tenant_active_jobs.d.ts +12 -3
  70. package/lib/schemas/models/tenant_active_jobs.js +18 -0
  71. package/lib/schemas/types/index.d.ts +3 -0
  72. package/lib/schemas/types/index.js +3 -0
  73. package/lib/schemas/types/materialized_report_drilldown_rows.d.ts +1 -1
  74. package/lib/schemas/types/materialized_report_drilldown_rows.js +1 -0
  75. package/lib/schemas/types/materialized_tenant_dinein_entries.d.ts +127 -0
  76. package/lib/schemas/types/materialized_tenant_dinein_entries.js +2 -0
  77. package/lib/schemas/types/materialized_tenant_dinein_reports.d.ts +326 -0
  78. package/lib/schemas/types/materialized_tenant_dinein_reports.js +9 -0
  79. package/lib/schemas/types/materialized_tenant_report_runs.d.ts +55 -0
  80. package/lib/schemas/types/materialized_tenant_report_runs.js +2 -0
  81. package/lib/schemas/types/tenant_active_jobs.d.ts +15 -1
  82. package/lib/tests/materialized-reports/dinein-fixtures.d.ts +29 -0
  83. package/lib/tests/materialized-reports/dinein-fixtures.js +130 -0
  84. package/lib/tests/materialized-reports/materialized-day-readiness.test.js +3 -2
  85. package/lib/tests/materialized-reports/materialized-dinein-compile.test.d.ts +1 -0
  86. package/lib/tests/materialized-reports/materialized-dinein-compile.test.js +807 -0
  87. package/lib/tests/materialized-reports/materialized-dinein-plan.test.d.ts +1 -0
  88. package/lib/tests/materialized-reports/materialized-dinein-plan.test.js +419 -0
  89. package/lib/tests/materialized-reports/materialized-report-runs.test.d.ts +1 -0
  90. package/lib/tests/materialized-reports/materialized-report-runs.test.js +116 -0
  91. package/lib/tests/materialized-reports/materialized-tenant-dinein-schema.test.d.ts +1 -0
  92. package/lib/tests/materialized-reports/materialized-tenant-dinein-schema.test.js +185 -0
  93. package/lib/tests/materialized-reports/report-platform/registry-conformance.test.js +15 -2
  94. package/lib/tests/materialized-reports/tenant-dinein-formatter.test.d.ts +1 -0
  95. package/lib/tests/materialized-reports/tenant-dinein-formatter.test.js +458 -0
  96. package/package.json +1 -1
@@ -0,0 +1,218 @@
1
+ import { MATERIALIZED_DINEIN_ENTRY_MAX_BSON_BYTES, MATERIALIZED_DINEIN_ENTRY_PAGE_ALL, MATERIALIZED_DINEIN_ENTRY_SCOPES, MATERIALIZED_REPORT_SCOPE_ENUM, } from '../../constants/MATERIALIZED_REPORTS';
2
+ import { materializedDocumentBsonBytes } from './materialized-document-size';
3
+ import { getMaterializedPeriodScopeFields } from './scope-helpers';
4
+ /**
5
+ * Dinein ENTRY PAGES — the page identity of
6
+ * `materialized_tenant_dinein_entries`.
7
+ *
8
+ * ## One page per source day
9
+ *
10
+ * | scope | page |
11
+ * | --- | --- |
12
+ * | `localDate` | `'all'` (the scope is already one day) |
13
+ * | `localWeek` | `<source localDate>` |
14
+ * | `localWeekOfYear` | `<source localDate>` |
15
+ * | `localMonth` | `<source localDate>` |
16
+ *
17
+ * There is NO quarter / semester / year entry document. A month is covered by
18
+ * its 28-31 pages, and a broad details selection is served from the month pages
19
+ * it touches (`buildMaterializedDineinDetailsScopeGroups`).
20
+ *
21
+ * ## Deterministic `#N` sub-pages, only when needed
22
+ *
23
+ * An oversized page splits into `page#0`, `page#1`, … . A page that fits keeps
24
+ * its ORIGINAL identity (no suffix), so existing pages are untouched until they
25
+ * actually grow. The sub-pages are disjoint — every check appears exactly once —
26
+ * and the reader unions them.
27
+ */
28
+ const SUB_PAGE_PATTERN = /^(.*)#(\d+)$/;
29
+ /** True when a scope context carries entry pages (day + the three period scopes). */
30
+ export function isMaterializedDineinEntryScope(scope) {
31
+ return MATERIALIZED_DINEIN_ENTRY_SCOPES.includes(String(scope));
32
+ }
33
+ /** The `page` value a compiled entry document of `scopeContext` must carry. */
34
+ export function dineinEntryPageOf(scopeContext, localDate) {
35
+ const scope = String(scopeContext);
36
+ if (!isMaterializedDineinEntryScope(scope))
37
+ return null;
38
+ if (scope === MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE) {
39
+ return MATERIALIZED_DINEIN_ENTRY_PAGE_ALL;
40
+ }
41
+ if (typeof localDate !== 'string' || localDate === '')
42
+ return null;
43
+ return localDate;
44
+ }
45
+ /** The unsuffixed source-day page (`all` / `YYYY-MM-DD`). */
46
+ export function dineinEntryPageBase(page) {
47
+ const text = String(page ?? '');
48
+ const match = SUB_PAGE_PATTERN.exec(text);
49
+ return match == null ? text : match[1];
50
+ }
51
+ /** True when a stored page belongs to the source day (`all` / `YYYY-MM-DD` + `#N`). */
52
+ export function isDineinEntryPageForSourceDay(scopeContext, page, localDate) {
53
+ const base = dineinEntryPageOf(scopeContext, localDate);
54
+ if (base == null)
55
+ return false;
56
+ return dineinEntryPageBase(page) === base;
57
+ }
58
+ /** The deterministic identity of one chunk. */
59
+ export function materializedDineinEntrySubPage(basePage, index) {
60
+ return `${basePage}#${Math.max(0, Math.floor(index))}`;
61
+ }
62
+ /** Stable identity string of one entry page (tests / diagnostics / map keys). */
63
+ export function materializedDineinEntryPageKey(ref) {
64
+ return `${String(ref?.scope_context)}|${String(ref?.scope_field)}|${String(ref?.page)}`;
65
+ }
66
+ const countRows = (sections) => {
67
+ let rows = 0;
68
+ for (const section of Object.values(sections ?? {}))
69
+ rows += section?.rows?.length ?? 0;
70
+ return rows;
71
+ };
72
+ /**
73
+ * Splits ONE source-day entry page when it exceeds the budget.
74
+ *
75
+ * Rows are walked in their stored (deterministic) key/row order and packed until
76
+ * the next row would cross the budget. A page that fits keeps its original
77
+ * identity. Throws when a single row cannot fit, because silently dropping a
78
+ * check would understate the statement.
79
+ */
80
+ export function splitMaterializedDineinEntryPage(doc, maxBytes = MATERIALIZED_DINEIN_ENTRY_MAX_BSON_BYTES) {
81
+ if (doc == null)
82
+ return [];
83
+ if (materializedDocumentBsonBytes(doc) <= maxBytes)
84
+ return [doc];
85
+ const sections = doc.dinein_entries ?? null;
86
+ if (sections == null || countRows(sections) === 0)
87
+ return [doc];
88
+ const basePage = dineinEntryPageBase(doc.page);
89
+ const envelope = { ...doc, page: basePage, dinein_entries: {} };
90
+ const envelopeBytes = materializedDocumentBsonBytes(envelope);
91
+ const chunks = [];
92
+ let current = {};
93
+ let currentBytes = envelopeBytes;
94
+ let currentRows = 0;
95
+ const flush = () => {
96
+ if (currentRows > 0)
97
+ chunks.push(current);
98
+ current = {};
99
+ currentBytes = envelopeBytes;
100
+ currentRows = 0;
101
+ };
102
+ for (const key of Object.keys(sections)) {
103
+ for (const row of sections[key]?.rows ?? []) {
104
+ const rowBytes = materializedDocumentBsonBytes(row) + key.length + 24;
105
+ if (currentRows > 0 && currentBytes + rowBytes > maxBytes - 512)
106
+ flush();
107
+ if (current[key] == null)
108
+ current[key] = { rows: [] };
109
+ current[key].rows.push(row);
110
+ currentBytes += rowBytes;
111
+ currentRows += 1;
112
+ if (currentBytes > maxBytes) {
113
+ throw new Error(`Dinein entry page ${String(doc.scope_context)}:${String(doc.scope_field)}:${basePage} ` +
114
+ 'cannot split below the budget (one row is too large)');
115
+ }
116
+ }
117
+ }
118
+ flush();
119
+ return chunks.map((chunk, index) => {
120
+ const page = {
121
+ ...doc,
122
+ page: materializedDineinEntrySubPage(basePage, index),
123
+ dinein_entries: chunk,
124
+ };
125
+ if (materializedDocumentBsonBytes(page) > maxBytes) {
126
+ throw new Error(`Dinein entry sub-page ${String(doc.scope_context)}:${String(doc.scope_field)}:${page.page} ` +
127
+ 'exceeds the entry-page budget');
128
+ }
129
+ return page;
130
+ });
131
+ }
132
+ /**
133
+ * Unions all pages of ONE source day (the base page or its `#N` sub-pages) into
134
+ * one logical document. Rows are disjoint by construction; the `order_id`
135
+ * dedupe makes a duplicated page harmless instead of doubling a check.
136
+ */
137
+ export function mergeMaterializedDineinEntryPages(pages, identity) {
138
+ const list = (pages ?? []).filter((page) => page != null);
139
+ if (list.length === 0)
140
+ return null;
141
+ const sections = {};
142
+ const seen = new Set();
143
+ for (const page of list) {
144
+ for (const [key, section] of Object.entries(page.dinein_entries ?? {})) {
145
+ for (const row of section?.rows ?? []) {
146
+ const rowIdentity = String(row.order_id ?? '');
147
+ if (rowIdentity !== '') {
148
+ if (seen.has(rowIdentity))
149
+ continue;
150
+ seen.add(rowIdentity);
151
+ }
152
+ if (sections[key] == null)
153
+ sections[key] = { rows: [] };
154
+ sections[key].rows.push(row);
155
+ }
156
+ }
157
+ }
158
+ const first = list[0];
159
+ return {
160
+ ...first,
161
+ ...(identity ?? {}),
162
+ dinein_entries: Object.keys(sections).length === 0 ? null : sections,
163
+ };
164
+ }
165
+ /**
166
+ * The BASE page refs belonging to ONE source day. The close reader expands each
167
+ * ref to the base plus any deterministic `#N` sub-pages; no other day's page is
168
+ * ever fetched.
169
+ *
170
+ * Returns `null` for a malformed date.
171
+ */
172
+ export function buildMaterializedDineinEntryPageRefs(localDate) {
173
+ const fields = getMaterializedPeriodScopeFields(localDate);
174
+ if (fields == null)
175
+ return null;
176
+ const refs = [];
177
+ for (const scope of MATERIALIZED_DINEIN_ENTRY_SCOPES) {
178
+ const scopeField = fields[String(scope)];
179
+ const page = dineinEntryPageOf(scope, localDate);
180
+ if (typeof scopeField !== 'string' || scopeField === '' || page == null)
181
+ return null;
182
+ refs.push({ scope_context: scope, scope_field: scopeField, page });
183
+ }
184
+ return refs;
185
+ }
186
+ /** The distinct `YYYY-MM` scope values of a day set, ascending. */
187
+ export function dineinMonthScopeFieldsOfDays(days) {
188
+ const months = new Set();
189
+ for (const day of days ?? []) {
190
+ const match = /^(\d{4})-(\d{2})-\d{2}$/.exec(String(day));
191
+ if (match == null)
192
+ continue;
193
+ months.add(`${match[1]}-${match[2]}`);
194
+ }
195
+ return [...months].sort();
196
+ }
197
+ /**
198
+ * Resolves the EXACT selected days into the scope groups a DINEIN DETAILS read
199
+ * uses:
200
+ *
201
+ * - one day → the `localDate` page (`page='all'`) — the direct path;
202
+ * - many days → the `localMonth` groups that contain them. The reader scans the
203
+ * pages of those months and filters rows to the EXACT days via
204
+ * `source_local_date`, so a quarter / semester / year / custom multi-month
205
+ * range is served, never refused.
206
+ */
207
+ export function buildMaterializedDineinDetailsScopeGroups(days) {
208
+ const unique = [...new Set((days ?? []).map((day) => String(day)))].sort();
209
+ if (unique.length === 0)
210
+ return null;
211
+ if (unique.length === 1) {
212
+ return [{ scope_context: MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE, scope_field: [unique[0]] }];
213
+ }
214
+ const months = dineinMonthScopeFieldsOfDays(unique);
215
+ if (months.length === 0)
216
+ return null;
217
+ return [{ scope_context: MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH, scope_field: months }];
218
+ }
@@ -0,0 +1,87 @@
1
+ import { MATERIALIZED_DINEIN_KEY_SEPARATOR, MATERIALIZED_DINEIN_UNKNOWN_TOKEN, } from '../../constants/MATERIALIZED_REPORTS';
2
+ /** Normalizes one key component: blank/missing -> `UNKNOWN`, `:` -> `-`. */
3
+ export function normalizeMaterializedDineinDimension(value) {
4
+ if (value == null)
5
+ return MATERIALIZED_DINEIN_UNKNOWN_TOKEN;
6
+ const text = String(value).trim();
7
+ if (text === '')
8
+ return MATERIALIZED_DINEIN_UNKNOWN_TOKEN;
9
+ // The separator must never appear inside a component, or the key is ambiguous.
10
+ return text.split(MATERIALIZED_DINEIN_KEY_SEPARATOR).join('-');
11
+ }
12
+ /** Builds `<ORDER_STATUS>:<PLATFORM>`. */
13
+ export function buildMaterializedDineinKey(orderStatus, platform) {
14
+ return (normalizeMaterializedDineinDimension(orderStatus) +
15
+ MATERIALIZED_DINEIN_KEY_SEPARATOR +
16
+ normalizeMaterializedDineinDimension(platform));
17
+ }
18
+ /** Splits a key back into its components, or null when it is malformed. */
19
+ export function parseMaterializedDineinKey(key) {
20
+ if (key == null)
21
+ return null;
22
+ const parts = String(key).split(MATERIALIZED_DINEIN_KEY_SEPARATOR);
23
+ if (parts.length !== 2)
24
+ return null;
25
+ const [order_status, platform] = parts;
26
+ if (order_status === '' || platform === '')
27
+ return null;
28
+ return { order_status, platform };
29
+ }
30
+ /**
31
+ * Whether one compiled KEY passes the request filters.
32
+ *
33
+ * Only whole key components are compared, so this is exactly the predicate the
34
+ * historical aggregation applies. `UNKNOWN` means "the source carried no
35
+ * value", never "everything the filter excluded".
36
+ */
37
+ export function dineinKeyPassesFilters(key, filters) {
38
+ if (filters == null)
39
+ return true;
40
+ const parsed = parseMaterializedDineinKey(key);
41
+ if (parsed == null)
42
+ return false;
43
+ const orderStatuses = (filters.order_statuses ?? []).map((value) => String(value));
44
+ if (orderStatuses.length > 0 && !orderStatuses.includes(parsed.order_status))
45
+ return false;
46
+ const platforms = (filters.platforms ?? []).map((value) => String(value));
47
+ if (platforms.length > 0 && !platforms.includes(parsed.platform))
48
+ return false;
49
+ return true;
50
+ }
51
+ const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
52
+ /** True when the filter object selects no key component. */
53
+ export function isDineinKeyFilterEmpty(filters) {
54
+ if (filters == null)
55
+ return true;
56
+ const orderStatuses = filters.order_statuses ?? [];
57
+ const platforms = filters.platforms ?? [];
58
+ return orderStatuses.length === 0 && platforms.length === 0;
59
+ }
60
+ /**
61
+ * The Mongo key regex for the `<ORDER_STATUS>:<PLATFORM>` grammar.
62
+ *
63
+ * Used by the historical aggregation so a filtered read never sums excluded
64
+ * keys. Returns null when the filters select nothing (no regex constraint).
65
+ */
66
+ export function buildDineinKeyFilterRegex(filters) {
67
+ if (isDineinKeyFilterEmpty(filters))
68
+ return null;
69
+ const component = (values) => {
70
+ if (values == null || values.length === 0)
71
+ return '[^:]+';
72
+ return '(?:' + values.map((value) => escapeRegExp(String(value))).join('|') + ')';
73
+ };
74
+ return new RegExp('^' + component(filters?.order_statuses) + ':' + component(filters?.platforms) + '$');
75
+ }
76
+ /** Restricts a counter map to the keys the filters accept. */
77
+ export function filterMaterializedDineinCounters(counters, filters) {
78
+ const source = counters ?? {};
79
+ if (filters == null)
80
+ return source;
81
+ const filtered = {};
82
+ for (const [key, block] of Object.entries(source)) {
83
+ if (dineinKeyPassesFilters(key, filters))
84
+ filtered[key] = block;
85
+ }
86
+ return filtered;
87
+ }
@@ -5,15 +5,18 @@ import { MATERIALIZED_TENANT_DELIVERY_ENTRIES_COLLECTION_NAME, MATERIALIZED_TENA
5
5
  import { MATERIALIZED_TENANT_DELIVERY_GEO_CELLS_COLLECTION_NAME, MATERIALIZED_TENANT_DELIVERY_GEO_CELLS_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_delivery_geo_cells';
6
6
  import { MATERIALIZED_TENANT_DELIVERY_GEO_SCOPES_INDEX_OPTIONS } from '../../schemas/models/materialized_tenant_delivery_geo_scopes';
7
7
  import { MATERIALIZED_TENANT_DELIVERY_REPORTS_COLLECTION_NAME, MATERIALIZED_TENANT_DELIVERY_REPORTS_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_delivery_reports';
8
- import { MATERIALIZED_TENANT_DAY_READINESS_COLLECTION_NAME } from '../../constants/MATERIALIZED_REPORTS';
8
+ import { MATERIALIZED_TENANT_DAY_READINESS_COLLECTION_NAME, MATERIALIZED_TENANT_REPORT_RUNS_COLLECTION_NAME, } from '../../constants/MATERIALIZED_REPORTS';
9
9
  import { MATERIALIZED_TENANT_DAY_READINESS_INDEX_OPTIONS } from '../../schemas/models/materialized_tenant_day_readiness';
10
10
  import { MATERIALIZED_TENANT_DIALER_ENTRIES_COLLECTION_NAME, MATERIALIZED_TENANT_DIALER_ENTRIES_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_dialer_entries';
11
11
  import { MATERIALIZED_TENANT_DIALER_REPORTS_COLLECTION_NAME, MATERIALIZED_TENANT_DIALER_REPORTS_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_dialer_reports';
12
+ import { MATERIALIZED_TENANT_DINEIN_ENTRIES_COLLECTION_NAME, MATERIALIZED_TENANT_DINEIN_ENTRIES_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_dinein_entries';
13
+ import { MATERIALIZED_TENANT_DINEIN_REPORTS_COLLECTION_NAME, MATERIALIZED_TENANT_DINEIN_REPORTS_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_dinein_reports';
12
14
  import { MATERIALIZED_TENANT_DISCOUNT_ENTRIES_COLLECTION_NAME, MATERIALIZED_TENANT_DISCOUNT_ENTRIES_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_discount_entries';
13
15
  import { MATERIALIZED_TENANT_DISCOUNT_REPORTS_COLLECTION_NAME, MATERIALIZED_TENANT_DISCOUNT_REPORTS_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_discount_reports';
14
16
  import { MATERIALIZED_TENANT_DISCOUNT_SOURCES_COLLECTION_NAME, MATERIALIZED_TENANT_DISCOUNT_SOURCES_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_discount_sources';
15
17
  import { MATERIALIZED_TENANT_PREP_TIME_ENTRIES_COLLECTION_NAME, MATERIALIZED_TENANT_PREP_TIME_ENTRIES_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_prep_time_entries';
16
18
  import { MATERIALIZED_TENANT_PREP_TIME_REPORTS_COLLECTION_NAME, MATERIALIZED_TENANT_PREP_TIME_REPORTS_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_prep_time_reports';
19
+ import { MATERIALIZED_TENANT_REPORT_RUNS_INDEX_OPTIONS } from '../../schemas/models/materialized_tenant_report_runs';
17
20
  import { MATERIALIZED_TENANT_REPORTS_ITERATIONS_COLLECTION_NAME, MATERIALIZED_TENANT_REPORTS_ITERATIONS_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_reports_iterations';
18
21
  import { MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_COLLECTION_NAME, MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_INDEX_OPTIONS, } from '../../schemas/models/materialized_tenant_sales_overview_reports';
19
22
  import { TENANT_ACTIVE_JOBS_COLLECTION_NAME, TENANT_ACTIVE_JOBS_INDEX_OPTIONS, } from '../../schemas/models/tenant_active_jobs';
@@ -41,6 +44,7 @@ const INDEXES = {
41
44
  [MATERIALIZED_TENANT_DISCOUNT_SOURCES_COLLECTION_NAME]: MATERIALIZED_TENANT_DISCOUNT_SOURCES_INDEX_OPTIONS,
42
45
  [MATERIALIZED_TENANT_PREP_TIME_REPORTS_COLLECTION_NAME]: MATERIALIZED_TENANT_PREP_TIME_REPORTS_INDEX_OPTIONS,
43
46
  [MATERIALIZED_TENANT_PREP_TIME_ENTRIES_COLLECTION_NAME]: MATERIALIZED_TENANT_PREP_TIME_ENTRIES_INDEX_OPTIONS,
47
+ [MATERIALIZED_TENANT_REPORT_RUNS_COLLECTION_NAME]: MATERIALIZED_TENANT_REPORT_RUNS_INDEX_OPTIONS,
44
48
  [MATERIALIZED_TENANT_REPORTS_ITERATIONS_COLLECTION_NAME]: MATERIALIZED_TENANT_REPORTS_ITERATIONS_INDEX_OPTIONS,
45
49
  [MATERIALIZED_TENANT_DELIVERY_GEO_CELLS_COLLECTION_NAME]: MATERIALIZED_TENANT_DELIVERY_GEO_CELLS_INDEX_OPTIONS,
46
50
  [MATERIALIZED_TENANT_DELIVERY_GEO_SCOPES_COLLECTION_NAME]: MATERIALIZED_TENANT_DELIVERY_GEO_SCOPES_INDEX_OPTIONS,
@@ -49,6 +53,8 @@ const INDEXES = {
49
53
  [MATERIALIZED_TENANT_DAY_READINESS_COLLECTION_NAME]: MATERIALIZED_TENANT_DAY_READINESS_INDEX_OPTIONS,
50
54
  [MATERIALIZED_TENANT_DIALER_REPORTS_COLLECTION_NAME]: MATERIALIZED_TENANT_DIALER_REPORTS_INDEX_OPTIONS,
51
55
  [MATERIALIZED_TENANT_DIALER_ENTRIES_COLLECTION_NAME]: MATERIALIZED_TENANT_DIALER_ENTRIES_INDEX_OPTIONS,
56
+ [MATERIALIZED_TENANT_DINEIN_REPORTS_COLLECTION_NAME]: MATERIALIZED_TENANT_DINEIN_REPORTS_INDEX_OPTIONS,
57
+ [MATERIALIZED_TENANT_DINEIN_ENTRIES_COLLECTION_NAME]: MATERIALIZED_TENANT_DINEIN_ENTRIES_INDEX_OPTIONS,
52
58
  [MATERIALIZED_REPORT_DRILLDOWN_ROWS_COLLECTION_NAME]: MATERIALIZED_REPORT_DRILLDOWN_ROWS_INDEX_OPTIONS,
53
59
  [MATERIALIZED_REPORT_DRILLDOWN_SCOPES_COLLECTION_NAME]: MATERIALIZED_REPORT_DRILLDOWN_SCOPES_INDEX_OPTIONS,
54
60
  [TENANT_CALENDAR_COLLECTION_NAME]: TENANT_CALENDAR_INDEX_OPTIONS,
@@ -68,6 +68,14 @@ const ROW_SPECS = {
68
68
  orderId: () => '',
69
69
  cursorId: (row) => row.event_id,
70
70
  },
71
+ [MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DINEIN_ENTRIES]: {
72
+ rowsKey: 'dinein_entries',
73
+ // `time` is an ISO string on the check row; `toDate` accepts both.
74
+ time: (row) => row.time,
75
+ orderId: (row) => row.order_id,
76
+ // One row per collectable check, so the order itself is the row identity.
77
+ cursorId: (row) => row.order_id,
78
+ },
71
79
  };
72
80
  /** The nested map key an entry collection uses for its row sections. */
73
81
  export const getDrilldownRowsKey = (reportType) => ROW_SPECS[reportType].rowsKey;
@@ -0,0 +1,143 @@
1
+ import { MATERIALIZED_REPORT_RUN_COMMIT_OUTCOME_UNKNOWN_ERROR, MATERIALIZED_TENANT_REPORT_RUN_ERROR_MAX_LENGTH, MATERIALIZED_TENANT_REPORT_RUN_STALE_MS, MATERIALIZED_TENANT_REPORT_RUN_STATUS_ENUM, MATERIALIZED_TENANT_REPORT_RUNS_SCHEMA_VERSION, } from '../../constants/MATERIALIZED_REPORTS';
2
+ /** Stable string key of one run row (Map keys / log correlation). */
3
+ export function materializedReportRunKey(parts) {
4
+ return [
5
+ String(parts.tenantId),
6
+ String(parts.localDate),
7
+ String(parts.reportKey),
8
+ String(parts.schemaVersion ?? MATERIALIZED_TENANT_REPORT_RUNS_SCHEMA_VERSION),
9
+ ].join('|');
10
+ }
11
+ /** The Mongo filter of the ONE run row of a report. */
12
+ export function buildMaterializedReportRunFilter(parts) {
13
+ return {
14
+ tenant_id: String(parts.tenantId),
15
+ localDate: String(parts.localDate),
16
+ report_key: String(parts.reportKey),
17
+ schema_version: parts.schemaVersion ?? MATERIALIZED_TENANT_REPORT_RUNS_SCHEMA_VERSION,
18
+ };
19
+ }
20
+ export function isMaterializedReportRunStatus(value) {
21
+ return Object.values(MATERIALIZED_TENANT_REPORT_RUN_STATUS_ENUM).includes(value);
22
+ }
23
+ /**
24
+ * Is the report CURRENTLY being executed?
25
+ *
26
+ * Only a run that owns the report may be in this state; the retry API refuses
27
+ * it (409) instead of racing the executor.
28
+ */
29
+ export function isMaterializedReportRunInFlight(status) {
30
+ return (status === MATERIALIZED_TENANT_REPORT_RUN_STATUS_ENUM.PENDING ||
31
+ status === MATERIALIZED_TENANT_REPORT_RUN_STATUS_ENUM.RUNNING ||
32
+ status === MATERIALIZED_TENANT_REPORT_RUN_STATUS_ENUM.RETRYING);
33
+ }
34
+ /**
35
+ * Does this run carry the UNKNOWN-COMMIT marker?
36
+ *
37
+ * Such a run MUST stay non-terminal until recovery settles it from
38
+ * ownership-checked readiness (a ledger error alone must never decide it).
39
+ */
40
+ export function isMaterializedReportRunCommitOutcomeUnknown(run) {
41
+ return String(run?.last_error ?? '') === MATERIALIZED_REPORT_RUN_COMMIT_OUTCOME_UNKNOWN_ERROR;
42
+ }
43
+ /**
44
+ * Proves that a readiness row belongs to the run that owns this report.
45
+ *
46
+ * The row identity is the tenant/day/report/schema; ownership is the RUN
47
+ * identity. A row written by an OLDER close/re-close carries a DIFFERENT
48
+ * `run_id` and therefore proves nothing about the current run: it must keep the
49
+ * old report readable while the current run is recorded as FAILED
50
+ * (`INTERRUPTED_RUN`) and stays retryable. Never delete that older row.
51
+ */
52
+ export function isMaterializedReadinessOwnedByRun(args) {
53
+ const readinessRun = args.readiness?.run_id;
54
+ const currentRun = args.run?.run_id;
55
+ return readinessRun != null && currentRun != null && String(readinessRun) === String(currentRun);
56
+ }
57
+ /** COMMITTED / FAILED: the execution reached a terminal state. */
58
+ export function isMaterializedReportRunTerminal(status) {
59
+ return (status === MATERIALIZED_TENANT_REPORT_RUN_STATUS_ENUM.COMMITTED ||
60
+ status === MATERIALIZED_TENANT_REPORT_RUN_STATUS_ENUM.FAILED);
61
+ }
62
+ /**
63
+ * The instant a run started (its `started_at`, or `updatedAt` when a legacy /
64
+ * partial row has none).
65
+ */
66
+ export function materializedReportRunStartedAt(run) {
67
+ const candidate = run.started_at ?? run.updatedAt ?? null;
68
+ if (candidate == null)
69
+ return null;
70
+ const date = candidate instanceof Date ? candidate : new Date(candidate);
71
+ return Number.isNaN(date.getTime()) ? null : date;
72
+ }
73
+ /**
74
+ * Is an IN-FLIGHT run old enough that an interruption is plausible?
75
+ *
76
+ * AGE ALONE IS NEVER ENOUGH: recovery must also observe a STALE
77
+ * `tenant_active_jobs` heartbeat, otherwise a healthy long-running report would
78
+ * be taken over. This helper only answers the age question.
79
+ */
80
+ export function isMaterializedReportRunStale(args) {
81
+ if (!isMaterializedReportRunInFlight(args.run?.status))
82
+ return false;
83
+ const startedAt = materializedReportRunStartedAt(args.run);
84
+ if (startedAt == null)
85
+ return false;
86
+ const now = args.now ?? new Date();
87
+ const staleAfterMs = Number.isFinite(args.staleAfterMs) && args.staleAfterMs > 0
88
+ ? args.staleAfterMs
89
+ : MATERIALIZED_TENANT_REPORT_RUN_STALE_MS;
90
+ return now.getTime() - startedAt.getTime() >= staleAfterMs;
91
+ }
92
+ /**
93
+ * May this report be retried?
94
+ *
95
+ * A MISSING row is retryable (the report never ran: a failed day, a crash
96
+ * before the first attempt, or a pre-ledger day). A FAILED row is retryable.
97
+ * A COMMITTED row is NOT (the retry would be a no-op), and an in-flight row is
98
+ * NOT (the executor owns it).
99
+ */
100
+ export function canRetryMaterializedReportRun(status) {
101
+ if (status == null)
102
+ return true;
103
+ return status === MATERIALIZED_TENANT_REPORT_RUN_STATUS_ENUM.FAILED;
104
+ }
105
+ /* ------------------------------ PII safety ------------------------------ */
106
+ /**
107
+ * Patterns that must NEVER reach `last_error` (operator-visible, may be logged
108
+ * or exported): e-mail addresses, long digit runs (phone numbers / card-like
109
+ * values) and bearer/basic credentials.
110
+ */
111
+ const PII_PATTERNS = [
112
+ [/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, '[redacted-email]'],
113
+ // 7+ digits with common separators (phone numbers, card fragments).
114
+ [/(?:\+?\d[\s().-]?){7,}\d/g, '[redacted-number]'],
115
+ [/\b(?:bearer|basic)\s+[A-Za-z0-9._~+/-]+=*/gi, '[redacted-credential]'],
116
+ [/\b(?:password|secret|token|api[_-]?key)\s*[:=]\s*\S+/gi, '[redacted-credential]'],
117
+ ];
118
+ /**
119
+ * Sanitizes an execution error for durable storage / API output.
120
+ *
121
+ * Deliberately conservative: the message is single-lined, PII-redacted and
122
+ * bounded. The ERROR STACK and raw driver payload are never stored.
123
+ */
124
+ export function sanitizeMaterializedReportRunError(error) {
125
+ if (error == null)
126
+ return null;
127
+ const raw = typeof error === 'string'
128
+ ? error
129
+ : typeof error.message === 'string'
130
+ ? String(error.message)
131
+ : '';
132
+ let message = raw.replace(/\s+/g, ' ').trim();
133
+ if (message === '') {
134
+ message =
135
+ typeof error.name === 'string'
136
+ ? String(error.name)
137
+ : 'UNKNOWN_ERROR';
138
+ }
139
+ for (const [pattern, replacement] of PII_PATTERNS) {
140
+ message = message.replace(pattern, replacement);
141
+ }
142
+ return message.slice(0, MATERIALIZED_TENANT_REPORT_RUN_ERROR_MAX_LENGTH);
143
+ }
@@ -1,4 +1,4 @@
1
- import { MATERIALIZED_DELIVERY_ENTRY_MAX_BSON_BYTES, MATERIALIZED_DELIVERY_ENTRY_SCOPES, MATERIALIZED_DELIVERY_GEO_CELL_MAX_BSON_BYTES, MATERIALIZED_DELIVERY_REPORT_MAX_BSON_BYTES, MATERIALIZED_DELIVERY_REPORT_SCOPES, MATERIALIZED_DIALER_ENTRY_MAX_BSON_BYTES, MATERIALIZED_DIALER_ENTRY_SCOPES, MATERIALIZED_DIALER_REPORT_MAX_BSON_BYTES, MATERIALIZED_DIALER_REPORT_SCOPES, MATERIALIZED_DISCOUNT_REPORT_SCOPES, MATERIALIZED_PREP_TIME_ITEM_SCOPES, MATERIALIZED_PREP_TIME_REPORT_SCOPES, MATERIALIZED_REPORT_KEY_FILTER_ENUM, MATERIALIZED_REPORT_SCOPE_ENUM, MATERIALIZED_REPORT_TYPE_ENUM, ALL_MATERIALIZED_REPORT_SCOPES, } from '../../../constants/MATERIALIZED_REPORTS';
1
+ import { MATERIALIZED_DELIVERY_ENTRY_MAX_BSON_BYTES, MATERIALIZED_DELIVERY_ENTRY_SCOPES, MATERIALIZED_DELIVERY_GEO_CELL_MAX_BSON_BYTES, MATERIALIZED_DELIVERY_REPORT_MAX_BSON_BYTES, MATERIALIZED_DELIVERY_REPORT_SCOPES, MATERIALIZED_DIALER_ENTRY_MAX_BSON_BYTES, MATERIALIZED_DIALER_ENTRY_SCOPES, MATERIALIZED_DIALER_REPORT_MAX_BSON_BYTES, MATERIALIZED_DIALER_REPORT_SCOPES, MATERIALIZED_DINEIN_ENTRY_MAX_BSON_BYTES, MATERIALIZED_DINEIN_ENTRY_SCOPES, MATERIALIZED_DINEIN_REPORT_MAX_BSON_BYTES, MATERIALIZED_DINEIN_REPORT_SCOPES, MATERIALIZED_DISCOUNT_REPORT_SCOPES, MATERIALIZED_PREP_TIME_ITEM_SCOPES, MATERIALIZED_PREP_TIME_REPORT_SCOPES, MATERIALIZED_REPORT_KEY_FILTER_ENUM, MATERIALIZED_REPORT_SCOPE_ENUM, MATERIALIZED_REPORT_TYPE_ENUM, ALL_MATERIALIZED_REPORT_SCOPES, } from '../../../constants/MATERIALIZED_REPORTS';
2
2
  import { REPORT_KEY_ENUM } from '../../reporting-contract/report-contract';
3
3
  /**
4
4
  * PHASE 2 — DECLARATIVE REPORT DEFINITIONS.
@@ -519,12 +519,103 @@ const DIALER_DEFINITION = {
519
519
  'Writes a COMMITTED materialized_tenant_day_readiness row in the SAME transaction.',
520
520
  ],
521
521
  };
522
+ const DINEIN_DEFINITION = {
523
+ key: REPORT_KEY_ENUM.DINEIN,
524
+ segment: 'dinein',
525
+ reportType: MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DINEIN_REPORTS,
526
+ capabilities: { live: true, historical: true, details: true },
527
+ status: REPORT_DEFINITION_STATUS.PRODUCTION,
528
+ report: {
529
+ name: 'materialized_tenant_dinein_reports',
530
+ schemaVersion: 1,
531
+ budgetBytes: MATERIALIZED_DINEIN_REPORT_MAX_BSON_BYTES,
532
+ enforced: true,
533
+ validatorFile: null,
534
+ validatorDebt: 'No schema validator exists for the dinein report collection yet.',
535
+ indexOwner: 'toolkit:MATERIALIZED_TENANT_DINEIN_REPORTS_INDEX_OPTIONS',
536
+ migrationId: null,
537
+ },
538
+ entries: {
539
+ name: 'materialized_tenant_dinein_entries',
540
+ schemaVersion: 1,
541
+ budgetBytes: MATERIALIZED_DINEIN_ENTRY_MAX_BSON_BYTES,
542
+ enforced: true,
543
+ validatorFile: null,
544
+ validatorDebt: 'No schema validator exists for the dinein entry collection yet.',
545
+ indexOwner: 'toolkit:MATERIALIZED_TENANT_DINEIN_ENTRIES_INDEX_OPTIONS',
546
+ migrationId: null,
547
+ },
548
+ sideCollections: [FLAT_ROWS, FLAT_SCOPES],
549
+ reportScopes: [...MATERIALIZED_DINEIN_REPORT_SCOPES],
550
+ entryScopes: [...MATERIALIZED_DINEIN_ENTRY_SCOPES],
551
+ entryStorage: REPORT_ENTRY_STORAGE.PAGE_PER_SOURCE_DAY,
552
+ entrySplit: REPORT_ENTRY_SPLIT.DETERMINISTIC_SUBPAGES,
553
+ maxReportScope: MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
554
+ maxEntryScope: MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
555
+ projections: [REPORT_PROJECTION.FLAT_DRILLDOWN],
556
+ budgets: {
557
+ materialized_tenant_dinein_reports: MATERIALIZED_DINEIN_REPORT_MAX_BSON_BYTES,
558
+ materialized_tenant_dinein_entries: MATERIALIZED_DINEIN_ENTRY_MAX_BSON_BYTES,
559
+ materialized_report_drilldown_rows: DOCUMENT_BUDGET,
560
+ materialized_report_drilldown_scopes: DOCUMENT_BUDGET,
561
+ },
562
+ retention: [],
563
+ writeGuard: REPORT_WRITE_GUARD.WATERMARK,
564
+ liveSource: REPORT_LIVE_SOURCE.RAW,
565
+ historicalLens: REPORT_HISTORICAL_LENS.COUNTER_ROWS,
566
+ completeness: { summary: 'NONE', details: 'FLAT_PROJECTION' },
567
+ filters: [
568
+ {
569
+ id: MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
570
+ kind: 'KEY_COMPONENT',
571
+ mode: 'SERVER',
572
+ appliesTo: 'BOTH',
573
+ },
574
+ {
575
+ id: MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
576
+ kind: 'KEY_COMPONENT',
577
+ mode: 'SERVER',
578
+ appliesTo: 'BOTH',
579
+ },
580
+ // Origin / table / floor / split / offline are ROW filters: the SUMMARY
581
+ // cannot answer them exactly (the counters are keyed only by
582
+ // ORDER_STATUS:PLATFORM), so a summary request that sends one is REJECTED
583
+ // with 400 INVALID_REQUEST + details.unsupported_filters - never silently
584
+ // answered unfiltered.
585
+ { id: 'origins', kind: 'ROW', mode: 'SERVER', appliesTo: 'DETAILS' },
586
+ { id: 'table_ids', kind: 'ROW', mode: 'SERVER', appliesTo: 'DETAILS' },
587
+ { id: 'floor_ids', kind: 'ROW', mode: 'SERVER', appliesTo: 'DETAILS' },
588
+ { id: 'split_types', kind: 'ROW', mode: 'SERVER', appliesTo: 'DETAILS' },
589
+ { id: 'offline', kind: 'ROW', mode: 'SERVER', appliesTo: 'DETAILS' },
590
+ { id: 'DETAILS_VIEW', kind: 'REQUEST', mode: 'SERVER', appliesTo: 'DETAILS' },
591
+ ],
592
+ cursor: REPORT_CURSOR_KIND.KEYSET_STRUCTURED,
593
+ adapters: {
594
+ writer: 'materializeDineinReport',
595
+ live: 'getLiveTenantDineinReports',
596
+ historical: 'getMaterializedTenantDineinReports',
597
+ details: 'getMaterializedDineinDetailsPage',
598
+ },
599
+ owner: 'reporting-platform',
600
+ notes: [
601
+ 'Source day is order.localDate; a fingerprint never moves a check to the day its table closed.',
602
+ 'Deleted split parents are excluded from sales/order counts and read only for rating discovery.',
603
+ 'Covers come from the table-close fingerprint of the check, never from num_of_guests.',
604
+ 'Sales = amount_earned, which already includes the service charge; the charge is a component.',
605
+ 'Courses are current-state counts only: the order stores no call history or call timestamp.',
606
+ 'Reservations are a document-level block with no order link and no seated/no-show state.',
607
+ 'Origin / table / floor / split / offline are DETAILS row filters; the summary rejects them.',
608
+ 'Page entries split deterministically into #N sub-pages; no quarter/semester/year entry scope.',
609
+ 'Writes a COMMITTED materialized_tenant_day_readiness row in the SAME transaction.',
610
+ ],
611
+ };
522
612
  export const REPORT_DEFINITIONS = {
523
613
  [OVERVIEW_DEFINITION.key]: OVERVIEW_DEFINITION,
524
614
  [DISCOUNTS_DEFINITION.key]: DISCOUNTS_DEFINITION,
525
615
  [PREP_TIME_DEFINITION.key]: PREP_TIME_DEFINITION,
526
616
  [DELIVERY_DEFINITION.key]: DELIVERY_DEFINITION,
527
617
  [DIALER_DEFINITION.key]: DIALER_DEFINITION,
618
+ [DINEIN_DEFINITION.key]: DINEIN_DEFINITION,
528
619
  };
529
620
  export const PRODUCTION_REPORT_DEFINITIONS = [
530
621
  OVERVIEW_DEFINITION,
@@ -532,6 +623,7 @@ export const PRODUCTION_REPORT_DEFINITIONS = [
532
623
  PREP_TIME_DEFINITION,
533
624
  DELIVERY_DEFINITION,
534
625
  DIALER_DEFINITION,
626
+ DINEIN_DEFINITION,
535
627
  ];
536
628
  export const REPORT_REGISTRY_EXEMPTIONS = {
537
629
  [REPORT_KEY_ENUM.CASH_IN_OUT]: {