@managesome/eposmatic-toolkit 0.4.56 → 0.4.58
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.
- package/esm/helpers/materialized-reports/report-platform/definition.js +2 -2
- package/esm/schemas/models/materialized_tenant_delivery_entries.js +5 -5
- package/esm/schemas/models/materialized_tenant_delivery_reports.js +7 -7
- package/esm/schemas/models/tenants.js +3 -8
- package/lib/helpers/materialized-reports/report-platform/definition.js +2 -2
- package/lib/schemas/models/materialized_tenant_delivery_entries.d.ts +5 -5
- package/lib/schemas/models/materialized_tenant_delivery_entries.js +5 -5
- package/lib/schemas/models/materialized_tenant_delivery_reports.d.ts +7 -7
- package/lib/schemas/models/materialized_tenant_delivery_reports.js +7 -7
- package/lib/schemas/models/tenants.js +3 -8
- package/lib/tests/materialized-reports/materialized-delivery-plan.test.js +1 -1
- package/lib/tests/materialized-reports/materialized-delivery-practical.test.js +1 -1
- package/package.json +1 -1
|
@@ -321,7 +321,7 @@ const DELIVERY_DEFINITION = {
|
|
|
321
321
|
status: REPORT_DEFINITION_STATUS.PRODUCTION,
|
|
322
322
|
report: {
|
|
323
323
|
name: 'materialized_tenant_delivery_reports',
|
|
324
|
-
schemaVersion:
|
|
324
|
+
schemaVersion: 1,
|
|
325
325
|
budgetBytes: MATERIALIZED_DELIVERY_REPORT_MAX_BSON_BYTES,
|
|
326
326
|
enforced: true,
|
|
327
327
|
validatorFile: 'materialized_tenant_delivery_reports.bson',
|
|
@@ -330,7 +330,7 @@ const DELIVERY_DEFINITION = {
|
|
|
330
330
|
},
|
|
331
331
|
entries: {
|
|
332
332
|
name: 'materialized_tenant_delivery_entries',
|
|
333
|
-
schemaVersion:
|
|
333
|
+
schemaVersion: 1,
|
|
334
334
|
budgetBytes: MATERIALIZED_DELIVERY_ENTRY_MAX_BSON_BYTES,
|
|
335
335
|
enforced: true,
|
|
336
336
|
validatorFile: 'materialized_tenant_delivery_entries.bson',
|
|
@@ -14,12 +14,12 @@ import { ALL_MATERIALIZED_REPORT_KEY_FILTERS, DELIVERY_KEY_FILTERS, MATERIALIZED
|
|
|
14
14
|
* a fixed key set - the keys ARE the data.
|
|
15
15
|
*/
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* `localMonth`).
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* v1 - PAGE-PARTITIONED entry documents (one page per source day, max scope
|
|
18
|
+
* `localMonth`). All materialized collections use schema_version 1 for this
|
|
19
|
+
* pre-launch contract. Schema versioning will be reintroduced only when a
|
|
20
|
+
* future stored-shape change requires an explicit migration.
|
|
21
21
|
*/
|
|
22
|
-
export const MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION =
|
|
22
|
+
export const MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION = 1;
|
|
23
23
|
export const MaterializedTenantDeliveryEntriesSchema = new Schema({
|
|
24
24
|
tenant_id: { type: String, required: true },
|
|
25
25
|
brand_id: { type: String, required: true },
|
|
@@ -9,15 +9,15 @@ import { ALL_MATERIALIZED_REPORT_KEY_FILTERS, DELIVERY_KEY_FILTERS, MATERIALIZED
|
|
|
9
9
|
* cannot type precisely without a fixed key set - the keys ARE the data.
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* v1 - the current production day-close writer.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* The stored shape splits the AREA row into the ORDER-side (`delivery_orders`,
|
|
15
|
+
* net sale, fees) and the APP-side (`delivery_records`, payout) populations,
|
|
16
|
+
* keys the demand heat on the joined ORDER's `localHour`, and uses the payment
|
|
17
|
+
* rows as the refund source. Schema versioning is reset to 1 across all
|
|
18
|
+
* materialized collections for this pre-launch contract.
|
|
19
19
|
*/
|
|
20
|
-
export const MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION =
|
|
20
|
+
export const MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION = 1;
|
|
21
21
|
export const MaterializedTenantDeliveryReportSchema = new Schema({
|
|
22
22
|
tenant_id: { type: String, required: true },
|
|
23
23
|
brand_id: { type: String, required: true },
|
|
@@ -402,7 +402,7 @@ export const TenantSchema = new Schema({
|
|
|
402
402
|
order_number_grouping_type: {
|
|
403
403
|
type: String,
|
|
404
404
|
enum: ALL_ORDER_NUMBER_GROUPING_TYPES,
|
|
405
|
-
default: ORDER_NUMBER_GROUPING_TYPE_ENUM.
|
|
405
|
+
default: ORDER_NUMBER_GROUPING_TYPE_ENUM.COMBINED,
|
|
406
406
|
},
|
|
407
407
|
public_phone_numbers: {
|
|
408
408
|
type: [String],
|
|
@@ -529,7 +529,7 @@ export const TenantSchema = new Schema({
|
|
|
529
529
|
// ====><====
|
|
530
530
|
send_sms_on_order_status: {
|
|
531
531
|
type: [OrderStatusSchema],
|
|
532
|
-
default: [
|
|
532
|
+
default: [],
|
|
533
533
|
},
|
|
534
534
|
send_email_on_order_status: {
|
|
535
535
|
type: [OrderStatusSchema],
|
|
@@ -542,12 +542,7 @@ export const TenantSchema = new Schema({
|
|
|
542
542
|
},
|
|
543
543
|
auto_sms_platforms: {
|
|
544
544
|
type: [PlatformsSchema],
|
|
545
|
-
default: [
|
|
546
|
-
PLATFORMS_ENUM.WEB_DELIVERY,
|
|
547
|
-
PLATFORMS_ENUM.WEB_TAKE_AWAY,
|
|
548
|
-
PLATFORMS_ENUM.APP_DELIVERY,
|
|
549
|
-
PLATFORMS_ENUM.APP_TAKE_AWAY,
|
|
550
|
-
],
|
|
545
|
+
default: [],
|
|
551
546
|
},
|
|
552
547
|
auto_email_platforms: {
|
|
553
548
|
type: [PlatformsSchema],
|
|
@@ -324,7 +324,7 @@ const DELIVERY_DEFINITION = {
|
|
|
324
324
|
status: REPORT_DEFINITION_STATUS.PRODUCTION,
|
|
325
325
|
report: {
|
|
326
326
|
name: 'materialized_tenant_delivery_reports',
|
|
327
|
-
schemaVersion:
|
|
327
|
+
schemaVersion: 1,
|
|
328
328
|
budgetBytes: MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_REPORT_MAX_BSON_BYTES,
|
|
329
329
|
enforced: true,
|
|
330
330
|
validatorFile: 'materialized_tenant_delivery_reports.bson',
|
|
@@ -333,7 +333,7 @@ const DELIVERY_DEFINITION = {
|
|
|
333
333
|
},
|
|
334
334
|
entries: {
|
|
335
335
|
name: 'materialized_tenant_delivery_entries',
|
|
336
|
-
schemaVersion:
|
|
336
|
+
schemaVersion: 1,
|
|
337
337
|
budgetBytes: MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_ENTRY_MAX_BSON_BYTES,
|
|
338
338
|
enforced: true,
|
|
339
339
|
validatorFile: 'materialized_tenant_delivery_entries.bson',
|
|
@@ -12,12 +12,12 @@ import { Schema } from 'mongoose';
|
|
|
12
12
|
* a fixed key set - the keys ARE the data.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* `localMonth`).
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* v1 - PAGE-PARTITIONED entry documents (one page per source day, max scope
|
|
16
|
+
* `localMonth`). All materialized collections use schema_version 1 for this
|
|
17
|
+
* pre-launch contract. Schema versioning will be reintroduced only when a
|
|
18
|
+
* future stored-shape change requires an explicit migration.
|
|
19
19
|
*/
|
|
20
|
-
export declare const MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION =
|
|
20
|
+
export declare const MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION = 1;
|
|
21
21
|
export declare const MaterializedTenantDeliveryEntriesSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
22
22
|
timestamps: true;
|
|
23
23
|
versionKey: false;
|
|
@@ -17,12 +17,12 @@ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
|
|
|
17
17
|
* a fixed key set - the keys ARE the data.
|
|
18
18
|
*/
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
* `localMonth`).
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* v1 - PAGE-PARTITIONED entry documents (one page per source day, max scope
|
|
21
|
+
* `localMonth`). All materialized collections use schema_version 1 for this
|
|
22
|
+
* pre-launch contract. Schema versioning will be reintroduced only when a
|
|
23
|
+
* future stored-shape change requires an explicit migration.
|
|
24
24
|
*/
|
|
25
|
-
exports.MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION =
|
|
25
|
+
exports.MATERIALIZED_TENANT_DELIVERY_ENTRIES_SCHEMA_VERSION = 1;
|
|
26
26
|
exports.MaterializedTenantDeliveryEntriesSchema = new mongoose_1.Schema({
|
|
27
27
|
tenant_id: { type: String, required: true },
|
|
28
28
|
brand_id: { type: String, required: true },
|
|
@@ -7,15 +7,15 @@ import { Schema } from 'mongoose';
|
|
|
7
7
|
* cannot type precisely without a fixed key set - the keys ARE the data.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* v1 - the current production day-close writer.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* The stored shape splits the AREA row into the ORDER-side (`delivery_orders`,
|
|
13
|
+
* net sale, fees) and the APP-side (`delivery_records`, payout) populations,
|
|
14
|
+
* keys the demand heat on the joined ORDER's `localHour`, and uses the payment
|
|
15
|
+
* rows as the refund source. Schema versioning is reset to 1 across all
|
|
16
|
+
* materialized collections for this pre-launch contract.
|
|
17
17
|
*/
|
|
18
|
-
export declare const MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION =
|
|
18
|
+
export declare const MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION = 1;
|
|
19
19
|
export declare const MaterializedTenantDeliveryReportSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
20
20
|
timestamps: true;
|
|
21
21
|
versionKey: false;
|
|
@@ -12,15 +12,15 @@ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
|
|
|
12
12
|
* cannot type precisely without a fixed key set - the keys ARE the data.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* v1 - the current production day-close writer.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* The stored shape splits the AREA row into the ORDER-side (`delivery_orders`,
|
|
18
|
+
* net sale, fees) and the APP-side (`delivery_records`, payout) populations,
|
|
19
|
+
* keys the demand heat on the joined ORDER's `localHour`, and uses the payment
|
|
20
|
+
* rows as the refund source. Schema versioning is reset to 1 across all
|
|
21
|
+
* materialized collections for this pre-launch contract.
|
|
22
22
|
*/
|
|
23
|
-
exports.MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION =
|
|
23
|
+
exports.MATERIALIZED_TENANT_DELIVERY_REPORTS_SCHEMA_VERSION = 1;
|
|
24
24
|
exports.MaterializedTenantDeliveryReportSchema = new mongoose_1.Schema({
|
|
25
25
|
tenant_id: { type: String, required: true },
|
|
26
26
|
brand_id: { type: String, required: true },
|
|
@@ -405,7 +405,7 @@ exports.TenantSchema = new mongoose_1.Schema({
|
|
|
405
405
|
order_number_grouping_type: {
|
|
406
406
|
type: String,
|
|
407
407
|
enum: constants_1.ALL_ORDER_NUMBER_GROUPING_TYPES,
|
|
408
|
-
default: constants_1.ORDER_NUMBER_GROUPING_TYPE_ENUM.
|
|
408
|
+
default: constants_1.ORDER_NUMBER_GROUPING_TYPE_ENUM.COMBINED,
|
|
409
409
|
},
|
|
410
410
|
public_phone_numbers: {
|
|
411
411
|
type: [String],
|
|
@@ -532,7 +532,7 @@ exports.TenantSchema = new mongoose_1.Schema({
|
|
|
532
532
|
// ====><====
|
|
533
533
|
send_sms_on_order_status: {
|
|
534
534
|
type: [OrderStatusSchema],
|
|
535
|
-
default: [
|
|
535
|
+
default: [],
|
|
536
536
|
},
|
|
537
537
|
send_email_on_order_status: {
|
|
538
538
|
type: [OrderStatusSchema],
|
|
@@ -545,12 +545,7 @@ exports.TenantSchema = new mongoose_1.Schema({
|
|
|
545
545
|
},
|
|
546
546
|
auto_sms_platforms: {
|
|
547
547
|
type: [items_1.PlatformsSchema],
|
|
548
|
-
default: [
|
|
549
|
-
constants_1.PLATFORMS_ENUM.WEB_DELIVERY,
|
|
550
|
-
constants_1.PLATFORMS_ENUM.WEB_TAKE_AWAY,
|
|
551
|
-
constants_1.PLATFORMS_ENUM.APP_DELIVERY,
|
|
552
|
-
constants_1.PLATFORMS_ENUM.APP_TAKE_AWAY,
|
|
553
|
-
],
|
|
548
|
+
default: [],
|
|
554
549
|
},
|
|
555
550
|
auto_email_platforms: {
|
|
556
551
|
type: [items_1.PlatformsSchema],
|
|
@@ -120,7 +120,7 @@ describe('M4 close-day plan', () => {
|
|
|
120
120
|
expect(monthAfter.report.source_watermark.getTime()).toBeGreaterThan(new Date(monthBefore.source_watermark).getTime());
|
|
121
121
|
const key = 'COMPLETED:POS_WALK-IN:Istanbul';
|
|
122
122
|
expect(monthAfter.report.delivery_counters[key].deliveries.count).toBe(2);
|
|
123
|
-
expect(monthAfter.report.schema_version).toBe(
|
|
123
|
+
expect(monthAfter.report.schema_version).toBe(1);
|
|
124
124
|
});
|
|
125
125
|
it('EMPTYING a day removes it and its contribution from every period', () => {
|
|
126
126
|
const dayOne = linkedDay('2026-09-14T23:00:00.000Z');
|
|
@@ -281,7 +281,7 @@ describe('delivery practical-scale correctness', () => {
|
|
|
281
281
|
sale_type_key_filters: ['ORDER_STATUS', 'PLATFORM', 'CITY'],
|
|
282
282
|
delivery_entries: { 'COMPLETED:POS_DELIVERY': { rows } },
|
|
283
283
|
off_app_order_count: 3,
|
|
284
|
-
schema_version:
|
|
284
|
+
schema_version: 1,
|
|
285
285
|
source_watermark: new Date(DAY + 'T23:00:00.000Z'),
|
|
286
286
|
computed_at: new Date(DAY + 'T23:00:00.000Z'),
|
|
287
287
|
createdAt: new Date(DAY + 'T23:00:00.000Z'),
|