@managesome/eposmatic-toolkit 0.4.14 → 0.4.16
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/index.js +1 -0
- package/esm/helpers/materialized-reports/materialized-report-drilldown-rows.js +162 -0
- package/esm/helpers/reporting-contract/report-contract.js +1 -0
- package/esm/schemas/models/index.js +1 -1
- package/esm/schemas/models/materialized_report_drilldown_rows.js +155 -0
- package/esm/schemas/types/index.js +1 -1
- package/esm/schemas/types/materialized_report_drilldown_rows.js +10 -0
- package/lib/helpers/materialized-reports/index.d.ts +1 -0
- package/lib/helpers/materialized-reports/index.js +1 -0
- package/lib/helpers/materialized-reports/materialized-report-drilldown-rows.d.ts +40 -0
- package/lib/helpers/materialized-reports/materialized-report-drilldown-rows.js +169 -0
- package/lib/helpers/reporting-contract/report-contract.d.ts +3 -0
- package/lib/helpers/reporting-contract/report-contract.js +1 -0
- package/lib/schemas/models/brands.d.ts +6 -6
- package/lib/schemas/models/categories.d.ts +6 -6
- package/lib/schemas/models/close_dates.d.ts +3 -3
- package/lib/schemas/models/courses.d.ts +3 -3
- package/lib/schemas/models/customer_redemptions.d.ts +3 -3
- package/lib/schemas/models/customers.d.ts +6 -6
- package/lib/schemas/models/deliveries.d.ts +9 -9
- package/lib/schemas/models/delivery_areas.d.ts +3 -3
- package/lib/schemas/models/dinein_floors.d.ts +3 -3
- package/lib/schemas/models/dinein_tables.d.ts +6 -6
- package/lib/schemas/models/dinein_tables_fingerprints.d.ts +9 -9
- package/lib/schemas/models/discounts.d.ts +27 -27
- package/lib/schemas/models/expense_categories.d.ts +3 -3
- package/lib/schemas/models/expense_details.d.ts +12 -12
- package/lib/schemas/models/gift_cards.d.ts +3 -3
- package/lib/schemas/models/halfhalf_setup.d.ts +153 -153
- package/lib/schemas/models/index.d.ts +1 -1
- package/lib/schemas/models/index.js +1 -1
- package/lib/schemas/models/internal_invoices.d.ts +3 -3
- package/lib/schemas/models/internal_staffs.d.ts +3 -3
- package/lib/schemas/models/inventories.d.ts +6 -6
- package/lib/schemas/models/inventory_categories.d.ts +3 -3
- package/lib/schemas/models/inventory_transactions.d.ts +9 -9
- package/lib/schemas/models/item_transactions.d.ts +9 -9
- package/lib/schemas/models/items.d.ts +216 -216
- package/lib/schemas/models/marketing_fingerprints.d.ts +9 -9
- package/lib/schemas/models/materialized_credit_bills.d.ts +21 -21
- package/lib/schemas/models/materialized_report_drilldown_rows.d.ts +130 -0
- package/lib/schemas/models/materialized_report_drilldown_rows.js +158 -0
- package/lib/schemas/models/materialized_tenant_cash_entries.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_cash_reports.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_delivery_entries.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_delivery_reports.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_discount_entries.d.ts +24 -24
- package/lib/schemas/models/materialized_tenant_discount_reports.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_payments_comparison_entries.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_payments_comparison_reports.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_prep_time_entries.d.ts +12 -12
- package/lib/schemas/models/materialized_tenant_prep_time_reports.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_reports_iterations.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_sales_comparison_entries.d.ts +9 -9
- package/lib/schemas/models/materialized_tenant_sales_comparison_reports.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_sales_overview_reports.d.ts +3 -3
- package/lib/schemas/models/menus.d.ts +21 -21
- package/lib/schemas/models/modifier_extras.d.ts +3 -3
- package/lib/schemas/models/offers.d.ts +24 -24
- package/lib/schemas/models/offers_fingerprints.d.ts +9 -9
- package/lib/schemas/models/operational_roles.d.ts +3 -3
- package/lib/schemas/models/orders.d.ts +18 -18
- package/lib/schemas/models/printer_settings.d.ts +3 -3
- package/lib/schemas/models/public_holidays.d.ts +3 -3
- package/lib/schemas/models/reservations.d.ts +6 -6
- package/lib/schemas/models/reviews.d.ts +12 -12
- package/lib/schemas/models/riders.d.ts +3 -3
- package/lib/schemas/models/specials.d.ts +48 -48
- package/lib/schemas/models/staff_shifts.d.ts +9 -9
- package/lib/schemas/models/tenant-activity-logs.d.ts +3 -3
- package/lib/schemas/models/tenant_active_jobs.d.ts +3 -3
- package/lib/schemas/models/tenant_calendar.d.ts +3 -3
- package/lib/schemas/models/tenant_cash_drawer_sessions.d.ts +36 -36
- package/lib/schemas/models/tenant_cash_drawers.d.ts +3 -3
- package/lib/schemas/models/tenant_cash_in_hand_transactions.d.ts +9 -9
- package/lib/schemas/models/tenant_cash_in_out.d.ts +9 -9
- package/lib/schemas/models/tenant_clients.d.ts +3 -3
- package/lib/schemas/models/tenant_day_sessions.d.ts +36 -36
- package/lib/schemas/models/tenant_hr_attendance_records.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_biometric_enrollments.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_departments.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_documents.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_employees.d.ts +24 -24
- package/lib/schemas/models/tenant_hr_leave_requests.d.ts +6 -6
- package/lib/schemas/models/tenant_hr_payrolls.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_performance_reviews.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_policies.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_positions.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_shift_schedules.d.ts +3 -3
- package/lib/schemas/models/tenant_hr_shifts.d.ts +3 -3
- package/lib/schemas/models/tenant_instore_shift_sessions.d.ts +36 -36
- package/lib/schemas/models/tenant_instore_shifts.d.ts +3 -3
- package/lib/schemas/models/tenant_inventory_department_transactions.d.ts +9 -9
- package/lib/schemas/models/tenant_inventory_department_utilities.d.ts +6 -6
- package/lib/schemas/models/tenant_inventory_departments.d.ts +6 -6
- package/lib/schemas/models/tenant_inventory_entries.d.ts +3 -3
- package/lib/schemas/models/tenant_metadata.d.ts +3 -3
- package/lib/schemas/models/tenant_order_item_instructions.d.ts +3 -3
- package/lib/schemas/models/tenant_purchase_order_vendor_returns.d.ts +6 -6
- package/lib/schemas/models/tenant_purchase_orders.d.ts +6 -6
- package/lib/schemas/models/tenant_shifts.d.ts +3 -3
- package/lib/schemas/models/tenant_staffs.d.ts +24 -24
- package/lib/schemas/models/tenant_vendors.d.ts +3 -3
- package/lib/schemas/models/tenants.d.ts +3 -3
- package/lib/schemas/models/terminal_devices.d.ts +3 -3
- package/lib/schemas/models/tokens.d.ts +9 -9
- package/lib/schemas/models/void_order_items.d.ts +27 -27
- package/lib/schemas/models/vouchers.d.ts +3 -3
- package/lib/schemas/models/wallet_transactions.d.ts +9 -9
- package/lib/schemas/models/wallets.d.ts +3 -3
- package/lib/schemas/models/warehouse_categories.d.ts +3 -3
- package/lib/schemas/models/warehouse_communications.d.ts +3 -3
- package/lib/schemas/models/warehouse_inventory_transactions.d.ts +6 -6
- package/lib/schemas/models/warehouse_item_transactions.d.ts +6 -6
- package/lib/schemas/models/warehouse_items.d.ts +3 -3
- package/lib/schemas/models/warehouse_purchase_order_receipts.d.ts +3 -3
- package/lib/schemas/models/warehouse_purchase_order_rfqs.d.ts +3 -3
- package/lib/schemas/models/warehouse_purchase_order_vendor_returns.d.ts +3 -3
- package/lib/schemas/models/warehouse_purchase_orders.d.ts +3 -3
- package/lib/schemas/models/warehouse_sale_deliveries.d.ts +3 -3
- package/lib/schemas/models/warehouse_sale_invoices.d.ts +3 -3
- package/lib/schemas/models/warehouse_sale_order_rfqs.d.ts +3 -3
- package/lib/schemas/models/warehouse_sale_orders.d.ts +3 -3
- package/lib/schemas/models/warehouse_staffs.d.ts +3 -3
- package/lib/schemas/models/warehouse_void_purchase_order_items.d.ts +21 -21
- package/lib/schemas/models/warehouse_void_sale_order_items.d.ts +21 -21
- package/lib/schemas/models/warehouses.d.ts +3 -3
- package/lib/schemas/types/index.d.ts +1 -1
- package/lib/schemas/types/index.js +1 -1
- package/lib/schemas/types/materialized_report_drilldown_rows.d.ts +64 -0
- package/lib/schemas/types/materialized_report_drilldown_rows.js +13 -0
- package/lib/tests/materialized-reports/materialized-report-drilldown-rows.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-report-drilldown-rows.test.js +143 -0
- package/lib/tests/reporting-contract.test.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DAY_INDEX_ENUM } from '../../constants/ENUMS';
|
|
2
|
+
import { MATERIALIZED_REPORT_SCOPE_ENUM, MATERIALIZED_REPORT_TYPE_ENUM } from '../../constants/MATERIALIZED_REPORTS';
|
|
3
|
+
/**
|
|
4
|
+
* Types for the FLAT drill-down row collections.
|
|
5
|
+
*
|
|
6
|
+
* The nested `*_entries` collections remain the write-side materialization
|
|
7
|
+
* output. These collections are the read-side projection: ONE document per
|
|
8
|
+
* itemized row, so a drill-down can be sorted and paged inside MongoDB instead
|
|
9
|
+
* of loading every entry document and every row into Node.
|
|
10
|
+
*
|
|
11
|
+
* `data` is the original row payload (Mixed) so the API response stays
|
|
12
|
+
* byte-for-byte compatible with the nested path. The top-level fields are the
|
|
13
|
+
* fields a page query needs: selection identity, sort anchor, and cursor
|
|
14
|
+
* tie-break.
|
|
15
|
+
*/
|
|
16
|
+
export type TDrilldownReportType = MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DISCOUNT_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PREP_TIME_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_CASH_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DELIVERY_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_SALES_COMPARISON_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_HOURLY_COMPARISON_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PAYMENTS_COMPARISON_ENTRIES;
|
|
17
|
+
export declare const ALL_DRILLDOWN_REPORT_TYPES: TDrilldownReportType[];
|
|
18
|
+
/** One flattened itemized row. */
|
|
19
|
+
export interface IMaterializedReportDrilldownRow {
|
|
20
|
+
_id?: string;
|
|
21
|
+
tenant_id: string;
|
|
22
|
+
brand_id: string;
|
|
23
|
+
report_type: TDrilldownReportType;
|
|
24
|
+
scope_context: MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
25
|
+
scope_field: string;
|
|
26
|
+
day_index?: DAY_INDEX_ENUM | null;
|
|
27
|
+
/** The sale-type key the row was stored under (`ORDER_STATUS:PLATFORM`). */
|
|
28
|
+
key: string;
|
|
29
|
+
/** The order this row belongs to (empty for a ledger-only row, e.g. cash). */
|
|
30
|
+
order_id: string;
|
|
31
|
+
/**
|
|
32
|
+
* The cursor tie-break inside the report's existing `(time, order_id, id)`
|
|
33
|
+
* contract: entry_key / item_id / cash_in_out_id / delivery_id / order_id /
|
|
34
|
+
* payment_id.
|
|
35
|
+
*/
|
|
36
|
+
cursor_id: string;
|
|
37
|
+
/** Sort anchor; always a Date so Mongo can order and range-scan it. */
|
|
38
|
+
time: Date;
|
|
39
|
+
/** The original row payload, unchanged. */
|
|
40
|
+
data: Record<string, unknown>;
|
|
41
|
+
schema_version: number;
|
|
42
|
+
computed_at: Date;
|
|
43
|
+
createdAt?: Date;
|
|
44
|
+
updatedAt?: Date;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Scope-level metadata for a flat drill-down. Delivery is the only report that
|
|
48
|
+
* needs a value that is not a row (`off_app_order_count`), but `row_count` is
|
|
49
|
+
* useful for backfill/verification for every report.
|
|
50
|
+
*/
|
|
51
|
+
export interface IMaterializedReportDrilldownScope {
|
|
52
|
+
_id?: string;
|
|
53
|
+
tenant_id: string;
|
|
54
|
+
brand_id: string;
|
|
55
|
+
report_type: TDrilldownReportType;
|
|
56
|
+
scope_context: MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
57
|
+
scope_field: string;
|
|
58
|
+
row_count: number;
|
|
59
|
+
off_app_order_count: number;
|
|
60
|
+
schema_version: number;
|
|
61
|
+
computed_at: Date;
|
|
62
|
+
createdAt?: Date;
|
|
63
|
+
updatedAt?: Date;
|
|
64
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ALL_DRILLDOWN_REPORT_TYPES = void 0;
|
|
4
|
+
const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
|
|
5
|
+
exports.ALL_DRILLDOWN_REPORT_TYPES = [
|
|
6
|
+
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DISCOUNT_ENTRIES,
|
|
7
|
+
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PREP_TIME_ENTRIES,
|
|
8
|
+
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_CASH_ENTRIES,
|
|
9
|
+
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DELIVERY_ENTRIES,
|
|
10
|
+
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_SALES_COMPARISON_ENTRIES,
|
|
11
|
+
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_HOURLY_COMPARISON_ENTRIES,
|
|
12
|
+
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PAYMENTS_COMPARISON_ENTRIES,
|
|
13
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
|
|
4
|
+
const materialized_report_drilldown_rows_1 = require("../../helpers/materialized-reports/materialized-report-drilldown-rows");
|
|
5
|
+
const base = {
|
|
6
|
+
tenant_id: 'tenant-a',
|
|
7
|
+
brand_id: 'brand-a',
|
|
8
|
+
scope_context: 'localDate',
|
|
9
|
+
scope_field: '2026-09-14',
|
|
10
|
+
day_index: 'MON',
|
|
11
|
+
computed_at: new Date('2026-09-14T23:00:00.000Z'),
|
|
12
|
+
};
|
|
13
|
+
const row = (over) => ({
|
|
14
|
+
order_id: 'order-1',
|
|
15
|
+
created_at: new Date('2026-09-14T10:00:00.000Z'),
|
|
16
|
+
...over,
|
|
17
|
+
});
|
|
18
|
+
describe('flat drill-down row projection', () => {
|
|
19
|
+
test('projects discounts with entry_key as the cursor tie-break', () => {
|
|
20
|
+
const result = (0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownRows)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DISCOUNT_ENTRIES, {
|
|
21
|
+
...base,
|
|
22
|
+
discount_entries: {
|
|
23
|
+
'COMPLETED:POS': { rows: [row({ entry_key: 'discount:1', kind: 'DISCOUNT' })] },
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
expect(result.rows).toHaveLength(1);
|
|
27
|
+
expect(result.rows[0]).toMatchObject({
|
|
28
|
+
tenant_id: 'tenant-a',
|
|
29
|
+
report_type: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DISCOUNT_ENTRIES,
|
|
30
|
+
key: 'COMPLETED:POS',
|
|
31
|
+
order_id: 'order-1',
|
|
32
|
+
cursor_id: 'discount:1',
|
|
33
|
+
});
|
|
34
|
+
expect(result.rows[0].time).toEqual(new Date('2026-09-14T10:00:00.000Z'));
|
|
35
|
+
expect(result.rows[0].data).toMatchObject({ kind: 'DISCOUNT' });
|
|
36
|
+
});
|
|
37
|
+
test('projects prep rows with item_id as the cursor tie-break', () => {
|
|
38
|
+
const result = (0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownRows)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PREP_TIME_ENTRIES, {
|
|
39
|
+
...base,
|
|
40
|
+
prep_time_entries: {
|
|
41
|
+
K: { rows: [row({ item_id: 'item-1', entry_key: 'prep:1' })] },
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
expect(result.rows[0].cursor_id).toBe('item-1');
|
|
45
|
+
});
|
|
46
|
+
test('projects cash rows as drawer-ledger rows (no order id)', () => {
|
|
47
|
+
const result = (0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownRows)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_CASH_ENTRIES, {
|
|
48
|
+
...base,
|
|
49
|
+
cash_entries: {
|
|
50
|
+
K: { rows: [row({ cash_in_out_id: 'cash-1', entry_key: 'cash:1' })] },
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
expect(result.rows[0]).toMatchObject({ order_id: '', cursor_id: 'cash-1' });
|
|
54
|
+
});
|
|
55
|
+
test('projects delivery rows and carries the off-app scope count', () => {
|
|
56
|
+
const document = {
|
|
57
|
+
...base,
|
|
58
|
+
off_app_order_count: 4,
|
|
59
|
+
delivery_entries: {
|
|
60
|
+
K: {
|
|
61
|
+
rows: [
|
|
62
|
+
row({
|
|
63
|
+
delivery_id: 'delivery-1',
|
|
64
|
+
entry_key: 'delivery:1',
|
|
65
|
+
delivered_at: new Date('2026-09-14T10:30:00.000Z'),
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const result = (0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownRows)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DELIVERY_ENTRIES, document);
|
|
72
|
+
expect(result.rows[0]).toMatchObject({
|
|
73
|
+
cursor_id: 'delivery-1',
|
|
74
|
+
order_id: 'order-1',
|
|
75
|
+
});
|
|
76
|
+
expect(result.rows[0].time).toEqual(new Date('2026-09-14T10:30:00.000Z'));
|
|
77
|
+
expect((0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownScope)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DELIVERY_ENTRIES, document, result.rows)).toMatchObject({ row_count: 1, off_app_order_count: 4 });
|
|
78
|
+
});
|
|
79
|
+
test('projects sales/hourly/payments comparison rows from ISO time', () => {
|
|
80
|
+
const sales = (0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownRows)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_SALES_COMPARISON_ENTRIES, {
|
|
81
|
+
...base,
|
|
82
|
+
sales_entries: {
|
|
83
|
+
K: {
|
|
84
|
+
rows: [
|
|
85
|
+
{
|
|
86
|
+
order_id: 'order-1',
|
|
87
|
+
time: '2026-09-14T10:00:00.000Z',
|
|
88
|
+
platform: 'POS',
|
|
89
|
+
order_status: 'COMPLETED',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
expect(sales.rows[0]).toMatchObject({
|
|
96
|
+
order_id: 'order-1',
|
|
97
|
+
cursor_id: 'order-1',
|
|
98
|
+
});
|
|
99
|
+
const hourly = (0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownRows)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_HOURLY_COMPARISON_ENTRIES, {
|
|
100
|
+
...base,
|
|
101
|
+
scope_context: 'localHour',
|
|
102
|
+
scope_field: '2026-09-14 10',
|
|
103
|
+
sales_entries: {
|
|
104
|
+
K: { rows: [{ order_id: 'order-2', time: '2026-09-14T10:00:00.000Z' }] },
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
expect(hourly.rows[0].scope_context).toBe('localHour');
|
|
108
|
+
const payments = (0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownRows)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PAYMENTS_COMPARISON_ENTRIES, {
|
|
109
|
+
...base,
|
|
110
|
+
payment_entries: {
|
|
111
|
+
K: {
|
|
112
|
+
rows: [
|
|
113
|
+
{
|
|
114
|
+
order_id: 'order-3',
|
|
115
|
+
payment_id: 'payment-3',
|
|
116
|
+
time: '2026-09-14T10:00:00.000Z',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
expect(payments.rows[0]).toMatchObject({
|
|
123
|
+
order_id: 'order-3',
|
|
124
|
+
cursor_id: 'payment-3',
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
test('skips a row without a usable time or identity', () => {
|
|
128
|
+
const result = (0, materialized_report_drilldown_rows_1.buildMaterializedDrilldownRows)(MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DISCOUNT_ENTRIES, {
|
|
129
|
+
...base,
|
|
130
|
+
discount_entries: {
|
|
131
|
+
K: {
|
|
132
|
+
rows: [
|
|
133
|
+
row({ entry_key: 'ok', kind: 'DISCOUNT' }),
|
|
134
|
+
row({ entry_key: 'no-time', created_at: null }),
|
|
135
|
+
row({ entry_key: '' }),
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
expect(result.rows).toHaveLength(1);
|
|
141
|
+
expect(result.skipped).toBe(2);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -129,6 +129,13 @@ describe('report response builders', () => {
|
|
|
129
129
|
});
|
|
130
130
|
expect(details.rows).toHaveLength(1);
|
|
131
131
|
expect(details.next_cursor).not.toBeNull();
|
|
132
|
+
const deliveryDetails = (0, reporting_contract_1.buildReportDetailsResponse)({
|
|
133
|
+
report: reporting_contract_1.REPORT_KEY_ENUM.DELIVERY,
|
|
134
|
+
meta: historicalMeta(),
|
|
135
|
+
rows: [],
|
|
136
|
+
offAppOrderCount: 7,
|
|
137
|
+
});
|
|
138
|
+
expect(deliveryDetails.off_app_order_count).toBe(7);
|
|
132
139
|
const analytics = (0, reporting_contract_1.buildReportAnalyticsResponse)({
|
|
133
140
|
analytics: 'OVERVIEW',
|
|
134
141
|
meta: liveMeta(),
|