@managesome/eposmatic-toolkit 0.4.56 → 0.4.57

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.
@@ -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: 2,
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: 3,
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
- * v3 - PAGE-PARTITIONED entry documents (one page per source day, max scope
18
- * `localMonth`). v2 was one document per period scope, which made a month an unbounded
19
- * document. Historical v2 documents are not readable by the page-aware read layer and
20
- * must be re-materialized (re-close the days); the writer deletes the pages it owns.
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 = 3;
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
- * v2 - the production day-close writer.
12
+ * v1 - the current production day-close writer.
13
13
  *
14
- * v1 was the pre-production shape. v2 splits the AREA row into the ORDER-side
15
- * (`delivery_orders`, net sale, fees) and the APP-side (`delivery_records`, payout)
16
- * populations, keys the demand heat on the joined ORDER's `localHour`, and fixes the
17
- * refund source to the payment rows. A v1 document is still readable: the formatter
18
- * falls back to the old `count` field for the record total.
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 = 2;
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 },
@@ -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: 2,
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: 3,
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
- * v3 - PAGE-PARTITIONED entry documents (one page per source day, max scope
16
- * `localMonth`). v2 was one document per period scope, which made a month an unbounded
17
- * document. Historical v2 documents are not readable by the page-aware read layer and
18
- * must be re-materialized (re-close the days); the writer deletes the pages it owns.
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 = 3;
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
- * v3 - PAGE-PARTITIONED entry documents (one page per source day, max scope
21
- * `localMonth`). v2 was one document per period scope, which made a month an unbounded
22
- * document. Historical v2 documents are not readable by the page-aware read layer and
23
- * must be re-materialized (re-close the days); the writer deletes the pages it owns.
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 = 3;
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
- * v2 - the production day-close writer.
10
+ * v1 - the current production day-close writer.
11
11
  *
12
- * v1 was the pre-production shape. v2 splits the AREA row into the ORDER-side
13
- * (`delivery_orders`, net sale, fees) and the APP-side (`delivery_records`, payout)
14
- * populations, keys the demand heat on the joined ORDER's `localHour`, and fixes the
15
- * refund source to the payment rows. A v1 document is still readable: the formatter
16
- * falls back to the old `count` field for the record total.
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 = 2;
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
- * v2 - the production day-close writer.
15
+ * v1 - the current production day-close writer.
16
16
  *
17
- * v1 was the pre-production shape. v2 splits the AREA row into the ORDER-side
18
- * (`delivery_orders`, net sale, fees) and the APP-side (`delivery_records`, payout)
19
- * populations, keys the demand heat on the joined ORDER's `localHour`, and fixes the
20
- * refund source to the payment rows. A v1 document is still readable: the formatter
21
- * falls back to the old `count` field for the record total.
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 = 2;
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 },
@@ -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(2);
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: 3,
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'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.4.56",
3
+ "version": "0.4.57",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",