@managesome/eposmatic-toolkit 0.4.62 → 0.4.63

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 (94) hide show
  1. package/esm/constants/MATERIALIZED_SCHEMA_VERSIONS.js +17 -0
  2. package/esm/constants/WORKER_ENDPOINTS.js +2 -2
  3. package/esm/helpers/materialized-reports/index.js +3 -0
  4. package/esm/helpers/materialized-reports/materialized-credit-bills-helpers.js +3 -3
  5. package/esm/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +5 -5
  6. package/esm/helpers/materialized-reports/materialized-delivery-compile-helpers.js +2 -2
  7. package/esm/helpers/materialized-reports/materialized-dialer-close-day-helpers.js +5 -5
  8. package/esm/helpers/materialized-reports/materialized-dialer-compile-helpers.js +2 -2
  9. package/esm/helpers/materialized-reports/materialized-dinein-close-day-helpers.js +5 -5
  10. package/esm/helpers/materialized-reports/materialized-dinein-compile-helpers.js +2 -2
  11. package/esm/helpers/materialized-reports/materialized-discount-compile-helpers.js +3 -3
  12. package/esm/helpers/materialized-reports/materialized-document-size.js +2 -2
  13. package/esm/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +3 -3
  14. package/esm/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +3 -3
  15. package/esm/helpers/materialized-reports/report-compile.js +38 -0
  16. package/esm/helpers/materialized-reports/tenant-sales-overview-bson.js +27 -0
  17. package/esm/helpers/materialized-reports/tenant-sales-overview-helpers.js +3 -22
  18. package/esm/schemas/models/materialized_credit_bills.js +2 -1
  19. package/esm/schemas/models/materialized_tenant_delivery_entries.js +2 -1
  20. package/esm/schemas/models/materialized_tenant_delivery_reports.js +2 -1
  21. package/esm/schemas/models/materialized_tenant_dialer_entries.js +2 -1
  22. package/esm/schemas/models/materialized_tenant_dialer_reports.js +2 -1
  23. package/esm/schemas/models/materialized_tenant_dinein_entries.js +2 -1
  24. package/esm/schemas/models/materialized_tenant_dinein_reports.js +2 -1
  25. package/esm/schemas/models/materialized_tenant_sales_overview_reports.js +2 -1
  26. package/lib/constants/MATERIALIZED_SCHEMA_VERSIONS.d.ts +17 -0
  27. package/lib/constants/MATERIALIZED_SCHEMA_VERSIONS.js +20 -0
  28. package/lib/constants/WORKER_ENDPOINTS.d.ts +0 -2
  29. package/lib/constants/WORKER_ENDPOINTS.js +2 -2
  30. package/lib/helpers/materialized-reports/index.d.ts +2 -0
  31. package/lib/helpers/materialized-reports/index.js +26 -0
  32. package/lib/helpers/materialized-reports/materialized-credit-bills-helpers.js +4 -4
  33. package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +6 -6
  34. package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.js +4 -4
  35. package/lib/helpers/materialized-reports/materialized-dialer-close-day-helpers.js +6 -6
  36. package/lib/helpers/materialized-reports/materialized-dialer-compile-helpers.js +6 -6
  37. package/lib/helpers/materialized-reports/materialized-dinein-close-day-helpers.js +6 -6
  38. package/lib/helpers/materialized-reports/materialized-dinein-compile-helpers.js +6 -6
  39. package/lib/helpers/materialized-reports/materialized-discount-compile-helpers.js +3 -3
  40. package/lib/helpers/materialized-reports/materialized-document-size.js +2 -5
  41. package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +3 -3
  42. package/lib/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +3 -3
  43. package/lib/helpers/materialized-reports/report-compile.d.ts +38 -0
  44. package/lib/helpers/materialized-reports/report-compile.js +87 -0
  45. package/lib/helpers/materialized-reports/tenant-sales-overview-bson.d.ts +12 -0
  46. package/lib/helpers/materialized-reports/tenant-sales-overview-bson.js +33 -0
  47. package/lib/helpers/materialized-reports/tenant-sales-overview-helpers.d.ts +1 -12
  48. package/lib/helpers/materialized-reports/tenant-sales-overview-helpers.js +4 -24
  49. package/lib/schemas/models/materialized_credit_bills.d.ts +29 -46
  50. package/lib/schemas/models/materialized_credit_bills.js +3 -2
  51. package/lib/schemas/models/materialized_tenant_cash_entries.d.ts +9 -9
  52. package/lib/schemas/models/materialized_tenant_cash_reports.d.ts +9 -9
  53. package/lib/schemas/models/materialized_tenant_delivery_entries.d.ts +11 -10
  54. package/lib/schemas/models/materialized_tenant_delivery_entries.js +3 -2
  55. package/lib/schemas/models/materialized_tenant_delivery_geo_cells.d.ts +9 -9
  56. package/lib/schemas/models/materialized_tenant_delivery_geo_scopes.d.ts +6 -6
  57. package/lib/schemas/models/materialized_tenant_delivery_reports.d.ts +11 -10
  58. package/lib/schemas/models/materialized_tenant_delivery_reports.js +3 -2
  59. package/lib/schemas/models/materialized_tenant_dialer_entries.d.ts +8 -7
  60. package/lib/schemas/models/materialized_tenant_dialer_entries.js +3 -2
  61. package/lib/schemas/models/materialized_tenant_dialer_reports.d.ts +11 -10
  62. package/lib/schemas/models/materialized_tenant_dialer_reports.js +3 -2
  63. package/lib/schemas/models/materialized_tenant_dinein_entries.d.ts +8 -7
  64. package/lib/schemas/models/materialized_tenant_dinein_entries.js +3 -2
  65. package/lib/schemas/models/materialized_tenant_dinein_reports.d.ts +11 -10
  66. package/lib/schemas/models/materialized_tenant_dinein_reports.js +3 -2
  67. package/lib/schemas/models/materialized_tenant_discount_entries.d.ts +9 -9
  68. package/lib/schemas/models/materialized_tenant_discount_reports.d.ts +9 -9
  69. package/lib/schemas/models/materialized_tenant_discount_sources.d.ts +9 -9
  70. package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.d.ts +9 -9
  71. package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.d.ts +9 -9
  72. package/lib/schemas/models/materialized_tenant_payments_comparison_entries.d.ts +9 -9
  73. package/lib/schemas/models/materialized_tenant_payments_comparison_reports.d.ts +9 -9
  74. package/lib/schemas/models/materialized_tenant_prep_time_entries.d.ts +9 -9
  75. package/lib/schemas/models/materialized_tenant_prep_time_reports.d.ts +9 -9
  76. package/lib/schemas/models/materialized_tenant_sales_comparison_entries.d.ts +9 -9
  77. package/lib/schemas/models/materialized_tenant_sales_comparison_reports.d.ts +9 -9
  78. package/lib/schemas/models/materialized_tenant_sales_overview_reports.d.ts +11 -35
  79. package/lib/schemas/models/materialized_tenant_sales_overview_reports.js +3 -2
  80. package/lib/tests/materialized-reports/tenant-sales-overview-close-day-helpers.test.js +2 -1
  81. package/lib/tests/materialized-reports/tenant-sales-overview-helpers.test.js +5 -4
  82. package/lib/tests/reporting-contract/no-live-transport.test.js +106 -0
  83. package/package.json +2 -1
  84. package/lib/helpers/order/payment-collection.d.ts +0 -25
  85. package/lib/helpers/order/payment-collection.js +0 -51
  86. package/lib/schemas/models/applied_order_discounts.d.ts +0 -80
  87. package/lib/schemas/models/applied_order_discounts.js +0 -106
  88. package/lib/schemas/types/applied_order_discounts.d.ts +0 -22
  89. package/lib/schemas/types/applied_order_discounts.js +0 -2
  90. package/lib/tests/materialized-reports/analytics-overview-helpers.test.d.ts +0 -1
  91. package/lib/tests/materialized-reports/analytics-performance-helpers.test.d.ts +0 -1
  92. package/lib/tests/payment-collection-timestamps.test.d.ts +0 -1
  93. package/lib/tests/payment-collection-timestamps.test.js +0 -71
  94. /package/lib/tests/{materialized-reports/analytics-growth-helpers.test.d.ts → reporting-contract/no-live-transport.test.d.ts} +0 -0
@@ -1,5 +1,4 @@
1
- import mongoose from 'mongoose';
2
- import { IOrder, IOrderPayment } from '../../schemas';
1
+ import type { IOrder, IOrderPayment } from '../../schemas/types/orders';
3
2
  import { IMaterializedReportKeyMetrics, IMaterializedTenantSalesOverviewReport } from '../../schemas/types/materialized_tenant_sales_overview_reports';
4
3
  import { ICreditBillEventCandidate, ICreditBillIssuedCandidate, isMaterializedCreditBillPayment } from './materialized-credit-bills-helpers';
5
4
  /**
@@ -133,16 +132,6 @@ export declare function normalizeMaterializedSaleTypeMetrics(metrics: IMateriali
133
132
  * missing or containing reserved characters) — `null` means a data issue.
134
133
  */
135
134
  export declare function convertOrdersToMaterializedTenantSalesOverviewReports(localDate: string, orders: IOrder[], options?: IConvertOrdersToMaterializedReportsOptions): IConvertOrdersToMaterializedReportsResult | null;
136
- /**
137
- * Casts a JSON materialized report through the collection's mongoose schema,
138
- * returning a hydrated document ready to be saved / bulk-written (the
139
- * `sale_type_metrics` plain object becomes a `Map`, date strings become
140
- * `Date` instances, etc.).
141
- *
142
- * The document is NOT validated here — `save()` / `Model.validate()` still
143
- * runs the schema validators.
144
- */
145
- export declare function convertMaterializedTenantSalesOverviewReportJsonToBson(report: IMaterializedTenantSalesOverviewReport): mongoose.HydratedDocument<IMaterializedTenantSalesOverviewReport>;
146
135
  /**
147
136
  * Sums materialized reports that share the same tenant, brand, key filters and
148
137
  * `schema_version` — the period accumulation path. The scope MAY differ: pass
@@ -9,14 +9,13 @@ exports.isPaymentIncludedInMaterializedSalesOverview = isPaymentIncludedInMateri
9
9
  exports.getMaterializedPaymentGross = getMaterializedPaymentGross;
10
10
  exports.normalizeMaterializedSaleTypeMetrics = normalizeMaterializedSaleTypeMetrics;
11
11
  exports.convertOrdersToMaterializedTenantSalesOverviewReports = convertOrdersToMaterializedTenantSalesOverviewReports;
12
- exports.convertMaterializedTenantSalesOverviewReportJsonToBson = convertMaterializedTenantSalesOverviewReportJsonToBson;
13
12
  exports.sumMaterializedTenantSalesOverviewReports = sumMaterializedTenantSalesOverviewReports;
14
13
  exports.subtractMaterializedTenantSalesOverviewReports = subtractMaterializedTenantSalesOverviewReports;
15
14
  exports.updateMaterializedTenantSalesOverviewReport = updateMaterializedTenantSalesOverviewReport;
16
- const mongoose_1 = __importDefault(require("mongoose"));
15
+ const bson_objectid_1 = __importDefault(require("bson-objectid"));
16
+ const MATERIALIZED_SCHEMA_VERSIONS_1 = require("../../constants/MATERIALIZED_SCHEMA_VERSIONS");
17
17
  const constants_1 = require("../../constants");
18
18
  const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
19
- const materialized_tenant_sales_overview_reports_1 = require("../../schemas/models/materialized_tenant_sales_overview_reports");
20
19
  const key_helpers_1 = require("./key-helpers");
21
20
  const materialized_day_input_signature_1 = require("./materialized-day-input-signature");
22
21
  const materialized_credit_bills_helpers_1 = require("./materialized-credit-bills-helpers");
@@ -341,7 +340,7 @@ const createEmptyReportDocument = (args) => {
341
340
  ? (0, scope_helpers_1.getDayIndexFromLocalDate)(scopeField.split(' ')[0])
342
341
  : null;
343
342
  return {
344
- _id: new mongoose_1.default.Types.ObjectId().toString(),
343
+ _id: new bson_objectid_1.default().toHexString(),
345
344
  tenant_id: tenantId,
346
345
  brand_id: brandId,
347
346
  scope_context: scopeContext,
@@ -353,7 +352,7 @@ const createEmptyReportDocument = (args) => {
353
352
  // does not run mongoose defaults) persists a schema-conformant document
354
353
  // matching its history row.
355
354
  iteration: 1,
356
- schema_version: materialized_tenant_sales_overview_reports_1.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION,
355
+ schema_version: MATERIALIZED_SCHEMA_VERSIONS_1.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION,
357
356
  source_watermark: now,
358
357
  computed_at: now,
359
358
  createdAt: now,
@@ -546,25 +545,6 @@ function convertOrdersToMaterializedTenantSalesOverviewReports(localDate, orders
546
545
  return { materializedReports, credit_bill_issues: creditBillIssues, credit_bill_events: creditEventCandidates };
547
546
  }
548
547
  /* ------------------------------------------------------------------------ */
549
- /* 2. JSON → BSON (mongoose document) */
550
- /* ------------------------------------------------------------------------ */
551
- function getMaterializedTenantSalesOverviewReportModel() {
552
- return (mongoose_1.default.models[materialized_tenant_sales_overview_reports_1.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_COLLECTION_NAME] ??
553
- mongoose_1.default.model(materialized_tenant_sales_overview_reports_1.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_COLLECTION_NAME, materialized_tenant_sales_overview_reports_1.MaterializedTenantSalesOverviewReportSchema, materialized_tenant_sales_overview_reports_1.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_COLLECTION_NAME));
554
- }
555
- /**
556
- * Casts a JSON materialized report through the collection's mongoose schema,
557
- * returning a hydrated document ready to be saved / bulk-written (the
558
- * `sale_type_metrics` plain object becomes a `Map`, date strings become
559
- * `Date` instances, etc.).
560
- *
561
- * The document is NOT validated here — `save()` / `Model.validate()` still
562
- * runs the schema validators.
563
- */
564
- function convertMaterializedTenantSalesOverviewReportJsonToBson(report) {
565
- return new (getMaterializedTenantSalesOverviewReportModel())(report);
566
- }
567
- /* ------------------------------------------------------------------------ */
568
548
  /* 3. Summing documents (period accumulation) */
569
549
  /* ------------------------------------------------------------------------ */
570
550
  const sumOrderMetrics = (target, source) => {
@@ -1,23 +1,6 @@
1
+ import { MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION } from '../../constants/MATERIALIZED_SCHEMA_VERSIONS';
2
+ export { MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION };
1
3
  import { Schema } from 'mongoose';
2
- /**
3
- * Mongoose schema for `materialized_tenant_credit_bills` — the SHARED
4
- * credit-bill ledger of the materialized reports (see `MATERIALIZED_REPORTS.md`).
5
- *
6
- * ONE document per (tenant, scope context, scope value), scopes CAPPED AT
7
- * `LOCAL_MONTH` (`MATERIALIZED_CREDIT_BILLS_SCOPES`) so a document can never
8
- * grow unboundedly: a month bounds its bill volume by construction. Each
9
- * document carries a per-key `credit_bills` map of slim `issued` / `received`
10
- * entries (ids + credit facts — the order document stays the single source of
11
- * the sale). See the type module `schemas/types/materialized_credit_bills.ts`
12
- * for the entry contract. Amounts are CENTS; reads pin `schema_version`.
13
- */
14
- /**
15
- * Version of the credit-entry rules of this collection. Bump when entry
16
- * semantics change (e.g. signed REFUND / WRITE_OFF deltas) — historical
17
- * documents must then be re-materialized. PRE-RELEASE: the collection has no
18
- * live tenants/consumers yet, so every change so far folds into version `1`.
19
- */
20
- export declare const MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION = 1;
21
4
  export declare const MaterializedTenantCreditBillsReportSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
22
5
  timestamps: true;
23
6
  versionKey: false;
@@ -33,42 +16,39 @@ export declare const MaterializedTenantCreditBillsReportSchema: Schema<any, impo
33
16
  tenant_id: string;
34
17
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
35
18
  iteration: number;
36
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
37
- scope_field: string;
38
- sale_type_key_filters: string[];
39
19
  credit_bills: Map<string, {
40
20
  issued: import("mongoose").Types.DocumentArray<{
41
21
  payment_id: string;
42
22
  order_id: string;
43
23
  amount: number;
24
+ settled_at: NativeDate;
25
+ settled_local_date: string;
44
26
  issued_at: NativeDate;
45
27
  issued_local_hour: string;
46
28
  received_at_issue: number;
47
29
  received_amount: number;
48
- settled_at: NativeDate;
49
- settled_local_date: string;
50
30
  credit_note: string;
51
31
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
52
32
  payment_id: string;
53
33
  order_id: string;
54
34
  amount: number;
35
+ settled_at: NativeDate;
36
+ settled_local_date: string;
55
37
  issued_at: NativeDate;
56
38
  issued_local_hour: string;
57
39
  received_at_issue: number;
58
40
  received_amount: number;
59
- settled_at: NativeDate;
60
- settled_local_date: string;
61
41
  credit_note: string;
62
42
  }> & {
63
43
  payment_id: string;
64
44
  order_id: string;
65
45
  amount: number;
46
+ settled_at: NativeDate;
47
+ settled_local_date: string;
66
48
  issued_at: NativeDate;
67
49
  issued_local_hour: string;
68
50
  received_at_issue: number;
69
51
  received_amount: number;
70
- settled_at: NativeDate;
71
- settled_local_date: string;
72
52
  credit_note: string;
73
53
  }>;
74
54
  received: import("mongoose").Types.DocumentArray<{
@@ -109,6 +89,9 @@ export declare const MaterializedTenantCreditBillsReportSchema: Schema<any, impo
109
89
  schema_version: number;
110
90
  source_watermark: NativeDate;
111
91
  computed_at: NativeDate;
92
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
93
+ scope_field: string;
94
+ sale_type_key_filters: string[];
112
95
  source_input_signature?: string | null | undefined;
113
96
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
114
97
  createdAt: NativeDate;
@@ -121,42 +104,39 @@ export declare const MaterializedTenantCreditBillsReportSchema: Schema<any, impo
121
104
  tenant_id: string;
122
105
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
123
106
  iteration: number;
124
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
125
- scope_field: string;
126
- sale_type_key_filters: string[];
127
107
  credit_bills: Map<string, {
128
108
  issued: import("mongoose").Types.DocumentArray<{
129
109
  payment_id: string;
130
110
  order_id: string;
131
111
  amount: number;
112
+ settled_at: NativeDate;
113
+ settled_local_date: string;
132
114
  issued_at: NativeDate;
133
115
  issued_local_hour: string;
134
116
  received_at_issue: number;
135
117
  received_amount: number;
136
- settled_at: NativeDate;
137
- settled_local_date: string;
138
118
  credit_note: string;
139
119
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
140
120
  payment_id: string;
141
121
  order_id: string;
142
122
  amount: number;
123
+ settled_at: NativeDate;
124
+ settled_local_date: string;
143
125
  issued_at: NativeDate;
144
126
  issued_local_hour: string;
145
127
  received_at_issue: number;
146
128
  received_amount: number;
147
- settled_at: NativeDate;
148
- settled_local_date: string;
149
129
  credit_note: string;
150
130
  }> & {
151
131
  payment_id: string;
152
132
  order_id: string;
153
133
  amount: number;
134
+ settled_at: NativeDate;
135
+ settled_local_date: string;
154
136
  issued_at: NativeDate;
155
137
  issued_local_hour: string;
156
138
  received_at_issue: number;
157
139
  received_amount: number;
158
- settled_at: NativeDate;
159
- settled_local_date: string;
160
140
  credit_note: string;
161
141
  }>;
162
142
  received: import("mongoose").Types.DocumentArray<{
@@ -197,6 +177,9 @@ export declare const MaterializedTenantCreditBillsReportSchema: Schema<any, impo
197
177
  schema_version: number;
198
178
  source_watermark: NativeDate;
199
179
  computed_at: NativeDate;
180
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
181
+ scope_field: string;
182
+ sale_type_key_filters: string[];
200
183
  source_input_signature?: string | null | undefined;
201
184
  }>> & import("mongoose").FlatRecord<{
202
185
  createdAt: NativeDate;
@@ -209,42 +192,39 @@ export declare const MaterializedTenantCreditBillsReportSchema: Schema<any, impo
209
192
  tenant_id: string;
210
193
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
211
194
  iteration: number;
212
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
213
- scope_field: string;
214
- sale_type_key_filters: string[];
215
195
  credit_bills: Map<string, {
216
196
  issued: import("mongoose").Types.DocumentArray<{
217
197
  payment_id: string;
218
198
  order_id: string;
219
199
  amount: number;
200
+ settled_at: NativeDate;
201
+ settled_local_date: string;
220
202
  issued_at: NativeDate;
221
203
  issued_local_hour: string;
222
204
  received_at_issue: number;
223
205
  received_amount: number;
224
- settled_at: NativeDate;
225
- settled_local_date: string;
226
206
  credit_note: string;
227
207
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
228
208
  payment_id: string;
229
209
  order_id: string;
230
210
  amount: number;
211
+ settled_at: NativeDate;
212
+ settled_local_date: string;
231
213
  issued_at: NativeDate;
232
214
  issued_local_hour: string;
233
215
  received_at_issue: number;
234
216
  received_amount: number;
235
- settled_at: NativeDate;
236
- settled_local_date: string;
237
217
  credit_note: string;
238
218
  }> & {
239
219
  payment_id: string;
240
220
  order_id: string;
241
221
  amount: number;
222
+ settled_at: NativeDate;
223
+ settled_local_date: string;
242
224
  issued_at: NativeDate;
243
225
  issued_local_hour: string;
244
226
  received_at_issue: number;
245
227
  received_amount: number;
246
- settled_at: NativeDate;
247
- settled_local_date: string;
248
228
  credit_note: string;
249
229
  }>;
250
230
  received: import("mongoose").Types.DocumentArray<{
@@ -285,6 +265,9 @@ export declare const MaterializedTenantCreditBillsReportSchema: Schema<any, impo
285
265
  schema_version: number;
286
266
  source_watermark: NativeDate;
287
267
  computed_at: NativeDate;
268
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
269
+ scope_field: string;
270
+ sale_type_key_filters: string[];
288
271
  source_input_signature?: string | null | undefined;
289
272
  }> & Required<{
290
273
  _id: import("mongoose").Types.ObjectId;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATERIALIZED_TENANT_CREDIT_BILLS_INDEX_OPTIONS = exports.MATERIALIZED_TENANT_CREDIT_BILLS_COLLECTION_INDEXES = exports.MATERIALIZED_TENANT_CREDIT_BILLS_COLLECTION_NAME = exports.MaterializedTenantCreditBillsReportSchema = exports.MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION = void 0;
4
+ const MATERIALIZED_SCHEMA_VERSIONS_1 = require("../../constants/MATERIALIZED_SCHEMA_VERSIONS");
5
+ Object.defineProperty(exports, "MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION", { enumerable: true, get: function () { return MATERIALIZED_SCHEMA_VERSIONS_1.MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION; } });
4
6
  const mongoose_1 = require("mongoose");
5
7
  const ENUMS_1 = require("../../constants/ENUMS");
6
8
  const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
@@ -22,7 +24,6 @@ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
22
24
  * documents must then be re-materialized. PRE-RELEASE: the collection has no
23
25
  * live tenants/consumers yet, so every change so far folds into version `1`.
24
26
  */
25
- exports.MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION = 1;
26
27
  const CreditBillIssuedEntrySchema = new mongoose_1.Schema({
27
28
  order_id: {
28
29
  type: String,
@@ -198,7 +199,7 @@ exports.MaterializedTenantCreditBillsReportSchema = new mongoose_1.Schema({
198
199
  type: Number,
199
200
  required: true,
200
201
  immutable: true,
201
- default: exports.MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION,
202
+ default: MATERIALIZED_SCHEMA_VERSIONS_1.MATERIALIZED_CREDIT_BILLS_SCHEMA_VERSION,
202
203
  },
203
204
  source_watermark: {
204
205
  type: mongoose_1.Schema.Types.Date,
@@ -106,12 +106,12 @@ export declare const MaterializedTenantCashEntriesSchema: Schema<any, import("mo
106
106
  tenant_id: string;
107
107
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
108
108
  iteration: number;
109
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
110
- scope_field: string;
111
- sale_type_key_filters: string[];
112
109
  schema_version: number;
113
110
  source_watermark: NativeDate;
114
111
  computed_at: NativeDate;
112
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
113
+ scope_field: string;
114
+ sale_type_key_filters: string[];
115
115
  cash_entries: any;
116
116
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
117
117
  createdAt: NativeDate;
@@ -123,12 +123,12 @@ export declare const MaterializedTenantCashEntriesSchema: Schema<any, import("mo
123
123
  tenant_id: string;
124
124
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
125
125
  iteration: number;
126
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
127
- scope_field: string;
128
- sale_type_key_filters: string[];
129
126
  schema_version: number;
130
127
  source_watermark: NativeDate;
131
128
  computed_at: NativeDate;
129
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
130
+ scope_field: string;
131
+ sale_type_key_filters: string[];
132
132
  cash_entries: any;
133
133
  }>> & import("mongoose").FlatRecord<{
134
134
  createdAt: NativeDate;
@@ -140,12 +140,12 @@ export declare const MaterializedTenantCashEntriesSchema: Schema<any, import("mo
140
140
  tenant_id: string;
141
141
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
142
142
  iteration: number;
143
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
144
- scope_field: string;
145
- sale_type_key_filters: string[];
146
143
  schema_version: number;
147
144
  source_watermark: NativeDate;
148
145
  computed_at: NativeDate;
146
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
147
+ scope_field: string;
148
+ sale_type_key_filters: string[];
149
149
  cash_entries: any;
150
150
  }> & {
151
151
  _id: import("mongoose").Types.ObjectId;
@@ -33,12 +33,12 @@ export declare const MaterializedTenantCashReportSchema: Schema<any, import("mon
33
33
  tenant_id: string;
34
34
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
35
35
  iteration: number;
36
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
37
- scope_field: string;
38
- sale_type_key_filters: string[];
39
36
  schema_version: number;
40
37
  source_watermark: NativeDate;
41
38
  computed_at: NativeDate;
39
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
40
+ scope_field: string;
41
+ sale_type_key_filters: string[];
42
42
  cash_counters: any;
43
43
  cash_counter_rows: any;
44
44
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
@@ -51,12 +51,12 @@ export declare const MaterializedTenantCashReportSchema: Schema<any, import("mon
51
51
  tenant_id: string;
52
52
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
53
53
  iteration: number;
54
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
55
- scope_field: string;
56
- sale_type_key_filters: string[];
57
54
  schema_version: number;
58
55
  source_watermark: NativeDate;
59
56
  computed_at: NativeDate;
57
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
58
+ scope_field: string;
59
+ sale_type_key_filters: string[];
60
60
  cash_counters: any;
61
61
  cash_counter_rows: any;
62
62
  }>> & import("mongoose").FlatRecord<{
@@ -69,12 +69,12 @@ export declare const MaterializedTenantCashReportSchema: Schema<any, import("mon
69
69
  tenant_id: string;
70
70
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
71
71
  iteration: number;
72
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
73
- scope_field: string;
74
- sale_type_key_filters: string[];
75
72
  schema_version: number;
76
73
  source_watermark: NativeDate;
77
74
  computed_at: NativeDate;
75
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
76
+ scope_field: string;
77
+ sale_type_key_filters: string[];
78
78
  cash_counters: any;
79
79
  cash_counter_rows: any;
80
80
  }> & {
@@ -1,3 +1,5 @@
1
+ import { MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION } from '../../constants/MATERIALIZED_SCHEMA_VERSIONS';
2
+ export { MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION };
1
3
  import { Schema } from 'mongoose';
2
4
  /**
3
5
  * Mongoose schema for `materialized_tenant_delivery_entries` (M4).
@@ -17,7 +19,6 @@ import { Schema } from 'mongoose';
17
19
  * pre-launch contract. Schema versioning will be reintroduced only when a
18
20
  * future stored-shape change requires an explicit migration.
19
21
  */
20
- export declare const MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION = 1;
21
22
  export declare const MaterializedTenantDeliveryEntriesSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
22
23
  timestamps: true;
23
24
  versionKey: false;
@@ -32,12 +33,12 @@ export declare const MaterializedTenantDeliveryEntriesSchema: Schema<any, import
32
33
  tenant_id: string;
33
34
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
34
35
  iteration: number;
35
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
36
- scope_field: string;
37
- sale_type_key_filters: string[];
38
36
  schema_version: number;
39
37
  source_watermark: NativeDate;
40
38
  computed_at: NativeDate;
39
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
40
+ scope_field: string;
41
+ sale_type_key_filters: string[];
41
42
  off_app_order_count: number;
42
43
  page: string;
43
44
  delivery_entries?: any;
@@ -51,12 +52,12 @@ export declare const MaterializedTenantDeliveryEntriesSchema: Schema<any, import
51
52
  tenant_id: string;
52
53
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
53
54
  iteration: number;
54
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
55
- scope_field: string;
56
- sale_type_key_filters: string[];
57
55
  schema_version: number;
58
56
  source_watermark: NativeDate;
59
57
  computed_at: NativeDate;
58
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
59
+ scope_field: string;
60
+ sale_type_key_filters: string[];
60
61
  off_app_order_count: number;
61
62
  page: string;
62
63
  delivery_entries?: any;
@@ -70,12 +71,12 @@ export declare const MaterializedTenantDeliveryEntriesSchema: Schema<any, import
70
71
  tenant_id: string;
71
72
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
72
73
  iteration: number;
73
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
74
- scope_field: string;
75
- sale_type_key_filters: string[];
76
74
  schema_version: number;
77
75
  source_watermark: NativeDate;
78
76
  computed_at: NativeDate;
77
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
78
+ scope_field: string;
79
+ sale_type_key_filters: string[];
79
80
  off_app_order_count: number;
80
81
  page: string;
81
82
  delivery_entries?: any;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATERIALIZED_TENANT_DELIVERY_ENTRIES_INDEX_OPTIONS = exports.MATERIALIZED_TENANT_DELIVERY_ENTRIES_COLLECTION_INDEXES = exports.MATERIALIZED_TENANT_DELIVERY_ENTRIES_COLLECTION_NAME = exports.MaterializedTenantDeliveryEntriesSchema = exports.MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION = void 0;
4
+ const MATERIALIZED_SCHEMA_VERSIONS_1 = require("../../constants/MATERIALIZED_SCHEMA_VERSIONS");
5
+ Object.defineProperty(exports, "MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION", { enumerable: true, get: function () { return MATERIALIZED_SCHEMA_VERSIONS_1.MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION; } });
4
6
  const mongoose_1 = require("mongoose");
5
7
  const ENUMS_1 = require("../../constants/ENUMS");
6
8
  const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
@@ -22,7 +24,6 @@ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
22
24
  * pre-launch contract. Schema versioning will be reintroduced only when a
23
25
  * future stored-shape change requires an explicit migration.
24
26
  */
25
- exports.MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION = 1;
26
27
  exports.MaterializedTenantDeliveryEntriesSchema = new mongoose_1.Schema({
27
28
  tenant_id: { type: String, required: true },
28
29
  brand_id: { type: String, required: true },
@@ -49,7 +50,7 @@ exports.MaterializedTenantDeliveryEntriesSchema = new mongoose_1.Schema({
49
50
  type: Number,
50
51
  required: true,
51
52
  immutable: true,
52
- default: exports.MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION,
53
+ default: MATERIALIZED_SCHEMA_VERSIONS_1.MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION,
53
54
  },
54
55
  source_watermark: { type: mongoose_1.Schema.Types.Date, required: true },
55
56
  computed_at: { type: mongoose_1.Schema.Types.Date, required: true },
@@ -24,11 +24,11 @@ export declare const MaterializedTenantDeliveryGeoCellSchema: Schema<any, import
24
24
  tenant_id: string;
25
25
  city: string;
26
26
  orders: number;
27
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
28
- scope_field: string;
27
+ resolution: number;
29
28
  schema_version: number;
30
29
  computed_at: NativeDate;
31
- resolution: number;
30
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
31
+ scope_field: string;
32
32
  h3_cell: string;
33
33
  app_orders: number;
34
34
  delivery_records: number;
@@ -49,11 +49,11 @@ export declare const MaterializedTenantDeliveryGeoCellSchema: Schema<any, import
49
49
  tenant_id: string;
50
50
  city: string;
51
51
  orders: number;
52
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
53
- scope_field: string;
52
+ resolution: number;
54
53
  schema_version: number;
55
54
  computed_at: NativeDate;
56
- resolution: number;
55
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
56
+ scope_field: string;
57
57
  h3_cell: string;
58
58
  app_orders: number;
59
59
  delivery_records: number;
@@ -74,11 +74,11 @@ export declare const MaterializedTenantDeliveryGeoCellSchema: Schema<any, import
74
74
  tenant_id: string;
75
75
  city: string;
76
76
  orders: number;
77
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
78
- scope_field: string;
77
+ resolution: number;
79
78
  schema_version: number;
80
79
  computed_at: NativeDate;
81
- resolution: number;
80
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
81
+ scope_field: string;
82
82
  h3_cell: string;
83
83
  app_orders: number;
84
84
  delivery_records: number;
@@ -11,10 +11,10 @@ export declare const MaterializedTenantDeliveryGeoScopeSchema: Schema<any, impor
11
11
  updatedAt: NativeDate;
12
12
  brand_id: string;
13
13
  tenant_id: string;
14
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
15
- scope_field: string;
16
14
  schema_version: number;
17
15
  computed_at: NativeDate;
16
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
17
+ scope_field: string;
18
18
  capped_cell_count: number;
19
19
  capped_order_count: number;
20
20
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
@@ -25,10 +25,10 @@ export declare const MaterializedTenantDeliveryGeoScopeSchema: Schema<any, impor
25
25
  updatedAt: NativeDate;
26
26
  brand_id: string;
27
27
  tenant_id: string;
28
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
29
- scope_field: string;
30
28
  schema_version: number;
31
29
  computed_at: NativeDate;
30
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
31
+ scope_field: string;
32
32
  capped_cell_count: number;
33
33
  capped_order_count: number;
34
34
  }>> & import("mongoose").FlatRecord<{
@@ -39,10 +39,10 @@ export declare const MaterializedTenantDeliveryGeoScopeSchema: Schema<any, impor
39
39
  updatedAt: NativeDate;
40
40
  brand_id: string;
41
41
  tenant_id: string;
42
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
43
- scope_field: string;
44
42
  schema_version: number;
45
43
  computed_at: NativeDate;
44
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
45
+ scope_field: string;
46
46
  capped_cell_count: number;
47
47
  capped_order_count: number;
48
48
  }> & {
@@ -1,3 +1,5 @@
1
+ import { MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION } from '../../constants/MATERIALIZED_SCHEMA_VERSIONS';
2
+ export { MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION };
1
3
  import { Schema } from 'mongoose';
2
4
  /**
3
5
  * Mongoose schema for `materialized_tenant_delivery_reports` (M4).
@@ -15,7 +17,6 @@ import { Schema } from 'mongoose';
15
17
  * rows as the refund source. Schema versioning is reset to 1 across all
16
18
  * materialized collections for this pre-launch contract.
17
19
  */
18
- export declare const MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION = 1;
19
20
  export declare const MaterializedTenantDeliveryReportSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
20
21
  timestamps: true;
21
22
  versionKey: false;
@@ -30,12 +31,12 @@ export declare const MaterializedTenantDeliveryReportSchema: Schema<any, import(
30
31
  tenant_id: string;
31
32
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
32
33
  iteration: number;
33
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
34
- scope_field: string;
35
- sale_type_key_filters: string[];
36
34
  schema_version: number;
37
35
  source_watermark: NativeDate;
38
36
  computed_at: NativeDate;
37
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
38
+ scope_field: string;
39
+ sale_type_key_filters: string[];
39
40
  delivery_counters: any;
40
41
  delivery_counter_rows: any;
41
42
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
@@ -48,12 +49,12 @@ export declare const MaterializedTenantDeliveryReportSchema: Schema<any, import(
48
49
  tenant_id: string;
49
50
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
50
51
  iteration: number;
51
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
52
- scope_field: string;
53
- sale_type_key_filters: string[];
54
52
  schema_version: number;
55
53
  source_watermark: NativeDate;
56
54
  computed_at: NativeDate;
55
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
56
+ scope_field: string;
57
+ sale_type_key_filters: string[];
57
58
  delivery_counters: any;
58
59
  delivery_counter_rows: any;
59
60
  }>> & import("mongoose").FlatRecord<{
@@ -66,12 +67,12 @@ export declare const MaterializedTenantDeliveryReportSchema: Schema<any, import(
66
67
  tenant_id: string;
67
68
  day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
68
69
  iteration: number;
69
- scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
70
- scope_field: string;
71
- sale_type_key_filters: string[];
72
70
  schema_version: number;
73
71
  source_watermark: NativeDate;
74
72
  computed_at: NativeDate;
73
+ scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
74
+ scope_field: string;
75
+ sale_type_key_filters: string[];
75
76
  delivery_counters: any;
76
77
  delivery_counter_rows: any;
77
78
  }> & {