@managesome/eposmatic-toolkit 0.4.62 → 0.4.64
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/constants/MATERIALIZED_SCHEMA_VERSIONS.js +17 -0
- package/esm/constants/WORKER_ENDPOINTS.js +2 -2
- package/esm/helpers/materialized-reports/index.js +3 -0
- package/esm/helpers/materialized-reports/materialized-credit-bills-helpers.js +3 -3
- package/esm/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +5 -5
- package/esm/helpers/materialized-reports/materialized-delivery-compile-helpers.js +2 -2
- package/esm/helpers/materialized-reports/materialized-dialer-close-day-helpers.js +5 -5
- package/esm/helpers/materialized-reports/materialized-dialer-compile-helpers.js +2 -2
- package/esm/helpers/materialized-reports/materialized-dinein-close-day-helpers.js +5 -5
- package/esm/helpers/materialized-reports/materialized-dinein-compile-helpers.js +2 -2
- package/esm/helpers/materialized-reports/materialized-discount-compile-helpers.js +3 -3
- package/esm/helpers/materialized-reports/materialized-document-size.js +2 -2
- package/esm/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +3 -3
- package/esm/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +3 -3
- package/esm/helpers/materialized-reports/report-compile.js +38 -0
- package/esm/helpers/materialized-reports/tenant-sales-overview-bson.js +27 -0
- package/esm/helpers/materialized-reports/tenant-sales-overview-helpers.js +3 -22
- package/esm/helpers/store/common-tenant-purchase-order-actions.js +12 -0
- package/esm/helpers/store/common-warehouse-purchase-order-actions.js +20 -0
- package/esm/helpers/store/tenant-purchase-orders-cart-actions.js +24 -7
- package/esm/helpers/store/warehouse-purchase-orders-cart-actions.js +23 -10
- package/esm/helpers/utils/index.js +1 -0
- package/esm/helpers/utils/tenant-purchase-order-engine.js +47 -0
- package/esm/helpers/utils/warehouse-purchase-order-engine.js +63 -4
- package/esm/schemas/models/materialized_credit_bills.js +2 -1
- package/esm/schemas/models/materialized_tenant_delivery_entries.js +2 -1
- package/esm/schemas/models/materialized_tenant_delivery_reports.js +2 -1
- package/esm/schemas/models/materialized_tenant_dialer_entries.js +2 -1
- package/esm/schemas/models/materialized_tenant_dialer_reports.js +2 -1
- package/esm/schemas/models/materialized_tenant_dinein_entries.js +2 -1
- package/esm/schemas/models/materialized_tenant_dinein_reports.js +2 -1
- package/esm/schemas/models/materialized_tenant_sales_overview_reports.js +2 -1
- package/esm/schemas/models/tenant_purchase_orders.js +4 -0
- package/esm/schemas/models/warehouse_purchase_orders.js +4 -0
- package/lib/constants/MATERIALIZED_SCHEMA_VERSIONS.d.ts +17 -0
- package/lib/constants/MATERIALIZED_SCHEMA_VERSIONS.js +20 -0
- package/lib/constants/WORKER_ENDPOINTS.d.ts +0 -2
- package/lib/constants/WORKER_ENDPOINTS.js +2 -2
- package/lib/helpers/materialized-reports/index.d.ts +2 -0
- package/lib/helpers/materialized-reports/index.js +26 -0
- package/lib/helpers/materialized-reports/materialized-credit-bills-helpers.js +4 -4
- package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +6 -6
- package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.js +4 -4
- package/lib/helpers/materialized-reports/materialized-dialer-close-day-helpers.js +6 -6
- package/lib/helpers/materialized-reports/materialized-dialer-compile-helpers.js +6 -6
- package/lib/helpers/materialized-reports/materialized-dinein-close-day-helpers.js +6 -6
- package/lib/helpers/materialized-reports/materialized-dinein-compile-helpers.js +6 -6
- package/lib/helpers/materialized-reports/materialized-discount-compile-helpers.js +3 -3
- package/lib/helpers/materialized-reports/materialized-document-size.js +2 -5
- package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +3 -3
- package/lib/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +3 -3
- package/lib/helpers/materialized-reports/report-compile.d.ts +38 -0
- package/lib/helpers/materialized-reports/report-compile.js +87 -0
- package/lib/helpers/materialized-reports/tenant-sales-overview-bson.d.ts +12 -0
- package/lib/helpers/materialized-reports/tenant-sales-overview-bson.js +33 -0
- package/lib/helpers/materialized-reports/tenant-sales-overview-helpers.d.ts +1 -12
- package/lib/helpers/materialized-reports/tenant-sales-overview-helpers.js +4 -24
- package/lib/helpers/store/common-tenant-purchase-order-actions.d.ts +6 -1
- package/lib/helpers/store/common-tenant-purchase-order-actions.js +13 -0
- package/lib/helpers/store/common-warehouse-purchase-order-actions.js +20 -0
- package/lib/helpers/store/tenant-purchase-orders-cart-actions.js +23 -6
- package/lib/helpers/store/warehouse-purchase-orders-cart-actions.js +23 -10
- package/lib/helpers/utils/index.d.ts +1 -0
- package/lib/helpers/utils/index.js +1 -0
- package/lib/helpers/utils/tenant-purchase-order-engine.d.ts +24 -0
- package/lib/helpers/utils/tenant-purchase-order-engine.js +51 -0
- package/lib/helpers/utils/warehouse-purchase-order-engine.d.ts +23 -1
- package/lib/helpers/utils/warehouse-purchase-order-engine.js +65 -4
- package/lib/schemas/models/materialized_credit_bills.d.ts +29 -46
- package/lib/schemas/models/materialized_credit_bills.js +3 -2
- package/lib/schemas/models/materialized_tenant_cash_entries.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_cash_reports.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_delivery_entries.d.ts +11 -10
- package/lib/schemas/models/materialized_tenant_delivery_entries.js +3 -2
- package/lib/schemas/models/materialized_tenant_delivery_geo_cells.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_delivery_geo_scopes.d.ts +6 -6
- package/lib/schemas/models/materialized_tenant_delivery_reports.d.ts +11 -10
- package/lib/schemas/models/materialized_tenant_delivery_reports.js +3 -2
- package/lib/schemas/models/materialized_tenant_dialer_entries.d.ts +8 -7
- package/lib/schemas/models/materialized_tenant_dialer_entries.js +3 -2
- package/lib/schemas/models/materialized_tenant_dialer_reports.d.ts +11 -10
- package/lib/schemas/models/materialized_tenant_dialer_reports.js +3 -2
- package/lib/schemas/models/materialized_tenant_dinein_entries.d.ts +8 -7
- package/lib/schemas/models/materialized_tenant_dinein_entries.js +3 -2
- package/lib/schemas/models/materialized_tenant_dinein_reports.d.ts +11 -10
- package/lib/schemas/models/materialized_tenant_dinein_reports.js +3 -2
- package/lib/schemas/models/materialized_tenant_discount_entries.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_discount_reports.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_discount_sources.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_payments_comparison_entries.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_payments_comparison_reports.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_prep_time_entries.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_prep_time_reports.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_sales_comparison_entries.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_sales_comparison_reports.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_sales_overview_reports.d.ts +11 -35
- package/lib/schemas/models/materialized_tenant_sales_overview_reports.js +3 -2
- package/lib/schemas/models/tenant_purchase_orders.d.ts +972 -0
- package/lib/schemas/models/tenant_purchase_orders.js +4 -0
- package/lib/schemas/models/warehouse_purchase_orders.d.ts +972 -0
- package/lib/schemas/models/warehouse_purchase_orders.js +4 -0
- package/lib/schemas/types/tenant_purchase_orders.d.ts +2 -1
- package/lib/schemas/types/warehouse_purchase_orders.d.ts +2 -1
- package/lib/tests/materialized-reports/tenant-sales-overview-close-day-helpers.test.js +2 -1
- package/lib/tests/materialized-reports/tenant-sales-overview-helpers.test.js +5 -4
- package/lib/tests/reporting-contract/no-live-transport.test.js +106 -0
- package/package.json +2 -1
- package/lib/helpers/order/payment-collection.d.ts +0 -25
- package/lib/helpers/order/payment-collection.js +0 -51
- package/lib/schemas/models/applied_order_discounts.d.ts +0 -80
- package/lib/schemas/models/applied_order_discounts.js +0 -106
- package/lib/schemas/types/applied_order_discounts.d.ts +0 -22
- package/lib/schemas/types/applied_order_discounts.js +0 -2
- package/lib/tests/materialized-reports/analytics-overview-helpers.test.d.ts +0 -1
- package/lib/tests/materialized-reports/analytics-performance-helpers.test.d.ts +0 -1
- package/lib/tests/payment-collection-timestamps.test.d.ts +0 -1
- package/lib/tests/payment-collection-timestamps.test.js +0 -71
- /package/lib/tests/{materialized-reports/analytics-growth-helpers.test.d.ts → reporting-contract/no-live-transport.test.d.ts} +0 -0
|
@@ -1,30 +1,6 @@
|
|
|
1
|
+
import { MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION } from '../../constants/MATERIALIZED_SCHEMA_VERSIONS';
|
|
2
|
+
export { MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION };
|
|
1
3
|
import { Schema } from 'mongoose';
|
|
2
|
-
/**
|
|
3
|
-
* Mongoose schema for `materialized_tenant_sales_overview_reports` — the
|
|
4
|
-
* materialized Reports > Overview data (one document per tenant × scope
|
|
5
|
-
* context × scope value), maintained by the day-end materialization job and
|
|
6
|
-
* read by the analytics API. Scope slices are stamped from the order's
|
|
7
|
-
* business day (`order.localDate`); hour buckets use the punch hour for sales
|
|
8
|
-
* and the settlement hour for credit-bill collections (see
|
|
9
|
-
* `MATERIALIZED_REPORTS.md`). The report's time-bias toggle (Punched At /
|
|
10
|
-
* `createdAt`) is out of scope. `scope_field` formats are documented on
|
|
11
|
-
* `MATERIALIZED_REPORT_SCOPE_ENUM` and in `MATERIALIZED_REPORTS.md`.
|
|
12
|
-
* NUMBERS ONLY: credit-bill COUNTERS (issued / settled / received) live in
|
|
13
|
-
* each `sale_type_metrics` key's `CREDIT_BILLS` slot — constant-size numbers.
|
|
14
|
-
* The ITEMIZED ledger (one row per bill + its receipt events) lives in the
|
|
15
|
-
* SHARED `materialized_tenant_credit_bills` collection, so these documents carry no
|
|
16
|
-
* bill rows/ids and their size no longer grows with the ledger over time.
|
|
17
|
-
* Iteration history (every structural write's full post-write snapshot)
|
|
18
|
-
* lives in the shared `materialized_tenant_reports_iterations` collection.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Version of the key grammar + metric rules of this collection. Bump when
|
|
22
|
-
* `sale_type_key_filters`, their order, or metric semantics change —
|
|
23
|
-
* historical documents must then be re-materialized (readers may branch on
|
|
24
|
-
* this value during a rollout). PRE-RELEASE: the collection has no live
|
|
25
|
-
* tenants/consumers yet, so every change so far folds into version `1`.
|
|
26
|
-
*/
|
|
27
|
-
export declare const MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION = 1;
|
|
28
4
|
export declare const MaterializedTenantSalesOverviewReportSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
29
5
|
timestamps: true;
|
|
30
6
|
versionKey: false;
|
|
@@ -40,12 +16,12 @@ export declare const MaterializedTenantSalesOverviewReportSchema: Schema<any, im
|
|
|
40
16
|
tenant_id: string;
|
|
41
17
|
day_index: import("../../constants").DAY_INDEX_ENUM | null;
|
|
42
18
|
iteration: number;
|
|
43
|
-
scope_context: import("../../constants").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
44
|
-
scope_field: string;
|
|
45
|
-
sale_type_key_filters: string[];
|
|
46
19
|
schema_version: number;
|
|
47
20
|
source_watermark: NativeDate;
|
|
48
21
|
computed_at: NativeDate;
|
|
22
|
+
scope_context: import("../../constants").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
23
|
+
scope_field: string;
|
|
24
|
+
sale_type_key_filters: string[];
|
|
49
25
|
sale_type_metrics: Map<string, {
|
|
50
26
|
TOTAL_SALES: {
|
|
51
27
|
orders: {
|
|
@@ -156,12 +132,12 @@ export declare const MaterializedTenantSalesOverviewReportSchema: Schema<any, im
|
|
|
156
132
|
tenant_id: string;
|
|
157
133
|
day_index: import("../../constants").DAY_INDEX_ENUM | null;
|
|
158
134
|
iteration: number;
|
|
159
|
-
scope_context: import("../../constants").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
160
|
-
scope_field: string;
|
|
161
|
-
sale_type_key_filters: string[];
|
|
162
135
|
schema_version: number;
|
|
163
136
|
source_watermark: NativeDate;
|
|
164
137
|
computed_at: NativeDate;
|
|
138
|
+
scope_context: import("../../constants").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
139
|
+
scope_field: string;
|
|
140
|
+
sale_type_key_filters: string[];
|
|
165
141
|
sale_type_metrics: Map<string, {
|
|
166
142
|
TOTAL_SALES: {
|
|
167
143
|
orders: {
|
|
@@ -272,12 +248,12 @@ export declare const MaterializedTenantSalesOverviewReportSchema: Schema<any, im
|
|
|
272
248
|
tenant_id: string;
|
|
273
249
|
day_index: import("../../constants").DAY_INDEX_ENUM | null;
|
|
274
250
|
iteration: number;
|
|
275
|
-
scope_context: import("../../constants").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
276
|
-
scope_field: string;
|
|
277
|
-
sale_type_key_filters: string[];
|
|
278
251
|
schema_version: number;
|
|
279
252
|
source_watermark: NativeDate;
|
|
280
253
|
computed_at: NativeDate;
|
|
254
|
+
scope_context: import("../../constants").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
255
|
+
scope_field: string;
|
|
256
|
+
sale_type_key_filters: string[];
|
|
281
257
|
sale_type_metrics: Map<string, {
|
|
282
258
|
TOTAL_SALES: {
|
|
283
259
|
orders: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_INDEX_OPTIONS = exports.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_COLLECTION_INDEXES = exports.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_COLLECTION_NAME = exports.MaterializedTenantSalesOverviewReportSchema = exports.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION = void 0;
|
|
4
|
+
const MATERIALIZED_SCHEMA_VERSIONS_1 = require("../../constants/MATERIALIZED_SCHEMA_VERSIONS");
|
|
5
|
+
Object.defineProperty(exports, "MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION", { enumerable: true, get: function () { return MATERIALIZED_SCHEMA_VERSIONS_1.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION; } });
|
|
4
6
|
const mongoose_1 = require("mongoose");
|
|
5
7
|
const constants_1 = require("../../constants");
|
|
6
8
|
const ENUMS_1 = require("../../constants/ENUMS");
|
|
@@ -30,7 +32,6 @@ const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
|
|
|
30
32
|
* this value during a rollout). PRE-RELEASE: the collection has no live
|
|
31
33
|
* tenants/consumers yet, so every change so far folds into version `1`.
|
|
32
34
|
*/
|
|
33
|
-
exports.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION = 1;
|
|
34
35
|
const ReportDiscountByTypeSchema = new mongoose_1.Schema({
|
|
35
36
|
special_discount: {
|
|
36
37
|
type: Number, // cents — Σ order_discount_details.special_discount
|
|
@@ -261,7 +262,7 @@ exports.MaterializedTenantSalesOverviewReportSchema = new mongoose_1.Schema({
|
|
|
261
262
|
type: Number,
|
|
262
263
|
required: true,
|
|
263
264
|
immutable: true,
|
|
264
|
-
default:
|
|
265
|
+
default: MATERIALIZED_SCHEMA_VERSIONS_1.MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_SCHEMA_VERSION,
|
|
265
266
|
},
|
|
266
267
|
source_watermark: {
|
|
267
268
|
type: mongoose_1.Schema.Types.Date,
|