@managesome/eposmatic-toolkit 0.4.52 → 0.4.54
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_REPORTS.js +106 -2
- package/esm/constants/enums/delivery.js +13 -0
- package/esm/helpers/materialized-reports/index.js +6 -0
- package/esm/helpers/materialized-reports/materialized-delivery-accumulator-helpers.js +8 -62
- package/esm/helpers/materialized-reports/materialized-delivery-classification-helpers.js +95 -73
- package/esm/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +118 -146
- package/esm/helpers/materialized-reports/materialized-delivery-compile-helpers.js +304 -71
- package/esm/helpers/materialized-reports/materialized-delivery-entry-pages.js +307 -0
- package/esm/helpers/materialized-reports/materialized-delivery-index-migration.js +103 -0
- package/esm/helpers/materialized-reports/materialized-delivery-rows.js +109 -0
- package/esm/helpers/materialized-reports/materialized-delivery-wipe-targets.js +32 -0
- package/esm/helpers/materialized-reports/materialized-document-size.js +65 -0
- package/esm/helpers/materialized-reports/materialized-index-bootstrap.js +31 -16
- package/esm/helpers/materialized-reports/materialized-integer-contract.js +10 -1
- package/esm/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +3 -91
- package/esm/helpers/materialized-reports/materialized-tenant-delivery-geo-helpers.js +597 -0
- package/esm/helpers/materialized-reports/report-platform/definition.js +508 -0
- package/esm/helpers/materialized-reports/report-platform/index.js +4 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/budget.js +27 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/cap-metadata.js +12 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/entry-pages.js +121 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/flat-projection.js +14 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/index.js +8 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/iteration-row.js +10 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/run-stats.js +42 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/scope-refs.js +28 -0
- package/esm/helpers/materialized-reports/report-platform/lifecycle/top-n.js +24 -0
- package/esm/helpers/materialized-reports/report-platform/registry.js +23 -0
- package/esm/helpers/materialized-reports/report-platform/validate-report-registry.js +214 -0
- package/esm/helpers/materialized-reports/scope-helpers.js +98 -0
- package/esm/helpers/materialized-reports/tenant-delivery-formatter.js +70 -20
- package/esm/schemas/models/applied_order_discounts.js +103 -0
- package/esm/schemas/models/index.js +12 -10
- package/esm/schemas/models/materialized_tenant_delivery_entries.js +33 -12
- package/esm/schemas/models/materialized_tenant_delivery_geo_cells.js +83 -0
- package/esm/schemas/models/materialized_tenant_delivery_geo_scopes.js +35 -0
- package/esm/schemas/models/materialized_tenant_delivery_reports.js +10 -1
- package/esm/schemas/types/applied_order_discounts.js +1 -0
- package/esm/schemas/types/index.js +14 -12
- package/esm/schemas/types/materialized_tenant_delivery_geo_cells.js +1 -0
- package/esm/schemas/types/materialized_tenant_delivery_geo_scopes.js +1 -0
- package/lib/constants/MATERIALIZED_REPORTS.d.ts +95 -1
- package/lib/constants/MATERIALIZED_REPORTS.js +108 -4
- package/lib/constants/enums/delivery.d.ts +9 -0
- package/lib/constants/enums/delivery.js +14 -1
- package/lib/helpers/materialized-reports/index.d.ts +6 -0
- package/lib/helpers/materialized-reports/index.js +6 -0
- package/lib/helpers/materialized-reports/materialized-delivery-accumulator-helpers.js +8 -62
- package/lib/helpers/materialized-reports/materialized-delivery-classification-helpers.d.ts +36 -9
- package/lib/helpers/materialized-reports/materialized-delivery-classification-helpers.js +94 -72
- package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.d.ts +23 -26
- package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +121 -150
- package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.d.ts +44 -5
- package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.js +306 -69
- package/lib/helpers/materialized-reports/materialized-delivery-entry-pages.d.ts +128 -0
- package/lib/helpers/materialized-reports/materialized-delivery-entry-pages.js +322 -0
- package/lib/helpers/materialized-reports/materialized-delivery-index-migration.d.ts +48 -0
- package/lib/helpers/materialized-reports/materialized-delivery-index-migration.js +108 -0
- package/lib/helpers/materialized-reports/materialized-delivery-rows.d.ts +15 -0
- package/lib/helpers/materialized-reports/materialized-delivery-rows.js +115 -0
- package/lib/helpers/materialized-reports/materialized-delivery-wipe-targets.d.ts +17 -0
- package/lib/helpers/materialized-reports/materialized-delivery-wipe-targets.js +35 -0
- package/lib/helpers/materialized-reports/materialized-document-size.d.ts +47 -0
- package/lib/helpers/materialized-reports/materialized-document-size.js +73 -0
- package/lib/helpers/materialized-reports/materialized-index-bootstrap.js +28 -13
- package/lib/helpers/materialized-reports/materialized-integer-contract.js +10 -1
- package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +2 -90
- package/lib/helpers/materialized-reports/materialized-tenant-delivery-geo-helpers.d.ts +186 -0
- package/lib/helpers/materialized-reports/materialized-tenant-delivery-geo-helpers.js +620 -0
- package/lib/helpers/materialized-reports/report-platform/definition.d.ts +133 -0
- package/lib/helpers/materialized-reports/report-platform/definition.js +511 -0
- package/lib/helpers/materialized-reports/report-platform/index.d.ts +4 -0
- package/lib/helpers/materialized-reports/report-platform/index.js +20 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/budget.d.ts +8 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/budget.js +31 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/cap-metadata.d.ts +8 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/cap-metadata.js +16 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/entry-pages.d.ts +40 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/entry-pages.js +130 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/flat-projection.d.ts +22 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/flat-projection.js +17 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/index.d.ts +8 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/index.js +24 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/iteration-row.d.ts +13 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/iteration-row.js +13 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/run-stats.d.ts +20 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/run-stats.js +47 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/scope-refs.d.ts +13 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/scope-refs.js +31 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/top-n.d.ts +16 -0
- package/lib/helpers/materialized-reports/report-platform/lifecycle/top-n.js +29 -0
- package/lib/helpers/materialized-reports/report-platform/registry.d.ts +13 -0
- package/lib/helpers/materialized-reports/report-platform/registry.js +31 -0
- package/lib/helpers/materialized-reports/report-platform/validate-report-registry.d.ts +20 -0
- package/lib/helpers/materialized-reports/report-platform/validate-report-registry.js +218 -0
- package/lib/helpers/materialized-reports/scope-helpers.d.ts +8 -0
- package/lib/helpers/materialized-reports/scope-helpers.js +99 -0
- package/lib/helpers/materialized-reports/tenant-delivery-formatter.d.ts +41 -0
- package/lib/helpers/materialized-reports/tenant-delivery-formatter.js +70 -20
- package/lib/helpers/order/payment-collection.d.ts +25 -0
- package/lib/helpers/order/payment-collection.js +51 -0
- package/lib/schemas/models/applied_order_discounts.d.ts +80 -0
- package/lib/schemas/models/applied_order_discounts.js +106 -0
- package/lib/schemas/models/index.d.ts +12 -10
- package/lib/schemas/models/index.js +12 -10
- package/lib/schemas/models/materialized_tenant_delivery_entries.d.ts +31 -9
- package/lib/schemas/models/materialized_tenant_delivery_entries.js +32 -11
- package/lib/schemas/models/materialized_tenant_delivery_geo_cells.d.ts +129 -0
- package/lib/schemas/models/materialized_tenant_delivery_geo_cells.js +86 -0
- package/lib/schemas/models/materialized_tenant_delivery_geo_scopes.d.ts +71 -0
- package/lib/schemas/models/materialized_tenant_delivery_geo_scopes.js +38 -0
- package/lib/schemas/models/materialized_tenant_delivery_reports.d.ts +10 -1
- package/lib/schemas/models/materialized_tenant_delivery_reports.js +10 -1
- package/lib/schemas/models/materialized_tenant_discount_sources.d.ts +15 -15
- package/lib/schemas/types/applied_order_discounts.d.ts +22 -0
- package/lib/schemas/types/applied_order_discounts.js +2 -0
- package/lib/schemas/types/index.d.ts +14 -12
- package/lib/schemas/types/index.js +14 -12
- package/lib/schemas/types/materialized_tenant_delivery_entries.d.ts +36 -4
- package/lib/schemas/types/materialized_tenant_delivery_geo_cells.d.ts +178 -0
- package/lib/schemas/types/materialized_tenant_delivery_geo_cells.js +2 -0
- package/lib/schemas/types/materialized_tenant_delivery_geo_scopes.d.ts +21 -0
- package/lib/schemas/types/materialized_tenant_delivery_geo_scopes.js +2 -0
- package/lib/schemas/types/materialized_tenant_delivery_reports.d.ts +49 -7
- package/lib/tests/materialized-reports/analytics-growth-helpers.test.d.ts +1 -0
- package/lib/tests/materialized-reports/analytics-overview-helpers.test.d.ts +1 -0
- package/lib/tests/materialized-reports/analytics-performance-helpers.test.d.ts +1 -0
- package/lib/tests/materialized-reports/characterization/delivery.characterization.test.d.ts +1 -0
- package/lib/tests/materialized-reports/characterization/delivery.characterization.test.js +229 -0
- package/lib/tests/materialized-reports/characterization/discount.characterization.test.d.ts +1 -0
- package/lib/tests/materialized-reports/characterization/discount.characterization.test.js +99 -0
- package/lib/tests/materialized-reports/characterization/fixtures.d.ts +30 -0
- package/lib/tests/materialized-reports/characterization/fixtures.js +402 -0
- package/lib/tests/materialized-reports/characterization/golden.d.ts +18 -0
- package/lib/tests/materialized-reports/characterization/golden.js +127 -0
- package/lib/tests/materialized-reports/characterization/overview.characterization.test.d.ts +1 -0
- package/lib/tests/materialized-reports/characterization/overview.characterization.test.js +69 -0
- package/lib/tests/materialized-reports/characterization/prep-time.characterization.test.d.ts +1 -0
- package/lib/tests/materialized-reports/characterization/prep-time.characterization.test.js +102 -0
- package/lib/tests/materialized-reports/materialized-delivery-accumulation.test.js +56 -19
- package/lib/tests/materialized-reports/materialized-delivery-budgets.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-delivery-budgets.test.js +91 -0
- package/lib/tests/materialized-reports/materialized-delivery-compile.test.js +271 -15
- package/lib/tests/materialized-reports/materialized-delivery-final-audit.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-delivery-final-audit.test.js +128 -0
- package/lib/tests/materialized-reports/materialized-delivery-fold.test.js +42 -5
- package/lib/tests/materialized-reports/materialized-delivery-formatter.test.js +13 -1
- package/lib/tests/materialized-reports/materialized-delivery-geo.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-delivery-geo.test.js +446 -0
- package/lib/tests/materialized-reports/materialized-delivery-plan.test.js +117 -25
- package/lib/tests/materialized-reports/materialized-delivery-practical.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-delivery-practical.test.js +344 -0
- package/lib/tests/materialized-reports/materialized-integer-contract.test.js +14 -0
- package/lib/tests/materialized-reports/materialized-tenant-sales-overview-reports-schema.test.js +1 -1
- package/lib/tests/materialized-reports/report-platform/lifecycle-primitives.test.d.ts +1 -0
- package/lib/tests/materialized-reports/report-platform/lifecycle-primitives.test.js +177 -0
- package/lib/tests/materialized-reports/report-platform/registry-conformance.test.d.ts +1 -0
- package/lib/tests/materialized-reports/report-platform/registry-conformance.test.js +214 -0
- package/lib/tests/materialized-reports/report-platform/registry-validation.test.d.ts +1 -0
- package/lib/tests/materialized-reports/report-platform/registry-validation.test.js +103 -0
- package/lib/tests/offer-item-resolution.test.js +1 -4
- package/lib/tests/payment-collection-timestamps.test.d.ts +1 -0
- package/lib/tests/payment-collection-timestamps.test.js +71 -0
- package/package.json +6 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { MATERIALIZED_REPORT_SCOPE_ENUM, MATERIALIZED_REPORT_TYPE_ENUM } from '../../../constants/MATERIALIZED_REPORTS';
|
|
2
|
+
import { REPORT_KEY_ENUM, type IReportCapabilities } from '../../reporting-contract/report-contract';
|
|
3
|
+
/**
|
|
4
|
+
* PHASE 2 — DECLARATIVE REPORT DEFINITIONS.
|
|
5
|
+
*
|
|
6
|
+
* This module is METADATA ONLY. It must not import Mongoose, Express, database
|
|
7
|
+
* code, workers-service or operations-service. Metric compilation, document
|
|
8
|
+
* schemas and formatters stay report-specific.
|
|
9
|
+
*
|
|
10
|
+
* Schema versions are declared as literals here so this module stays free of
|
|
11
|
+
* schema/model imports. The conformance suite compares every literal with the
|
|
12
|
+
* exported model constant; drift fails the build.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum REPORT_DEFINITION_STATUS {
|
|
15
|
+
PRODUCTION = "PRODUCTION",
|
|
16
|
+
READ_ONLY = "READ_ONLY",
|
|
17
|
+
PLANNED = "PLANNED"
|
|
18
|
+
}
|
|
19
|
+
export declare enum REPORT_ENTRY_STORAGE {
|
|
20
|
+
/** No itemized collection. */
|
|
21
|
+
NONE = "NONE",
|
|
22
|
+
/** One entry document per (tenant, scope, field); Prep Time today. */
|
|
23
|
+
ONE_PER_SCOPE = "ONE_PER_SCOPE",
|
|
24
|
+
/** One entry document per source day; Discounts and Delivery today. */
|
|
25
|
+
PAGE_PER_SOURCE_DAY = "PAGE_PER_SOURCE_DAY"
|
|
26
|
+
}
|
|
27
|
+
export declare enum REPORT_ENTRY_SPLIT {
|
|
28
|
+
NONE = "NONE",
|
|
29
|
+
/** Deterministic `page#0`, `page#1`, ... when one page exceeds its budget. */
|
|
30
|
+
DETERMINISTIC_SUBPAGES = "DETERMINISTIC_SUBPAGES"
|
|
31
|
+
}
|
|
32
|
+
export declare enum REPORT_WRITE_GUARD {
|
|
33
|
+
NONE = "NONE",
|
|
34
|
+
WATERMARK = "WATERMARK",
|
|
35
|
+
WATERMARK_AND_DIGEST = "WATERMARK_AND_DIGEST"
|
|
36
|
+
}
|
|
37
|
+
export declare enum REPORT_LIVE_SOURCE {
|
|
38
|
+
RAW = "RAW",
|
|
39
|
+
RAW_PLUS_MATERIALIZED = "RAW_PLUS_MATERIALIZED"
|
|
40
|
+
}
|
|
41
|
+
export declare enum REPORT_HISTORICAL_LENS {
|
|
42
|
+
DOCUMENT_FOLD = "DOCUMENT_FOLD",
|
|
43
|
+
COUNTER_ROWS = "COUNTER_ROWS"
|
|
44
|
+
}
|
|
45
|
+
export declare enum REPORT_CURSOR_KIND {
|
|
46
|
+
NONE = "NONE",
|
|
47
|
+
KEYSET_STRUCTURED = "KEYSET_STRUCTURED",
|
|
48
|
+
SIGNED_QUERY = "SIGNED_QUERY"
|
|
49
|
+
}
|
|
50
|
+
export declare enum REPORT_PROJECTION {
|
|
51
|
+
FLAT_DRILLDOWN = "FLAT_DRILLDOWN",
|
|
52
|
+
DISCOUNT_SOURCES = "DISCOUNT_SOURCES",
|
|
53
|
+
DELIVERY_GEO = "DELIVERY_GEO"
|
|
54
|
+
}
|
|
55
|
+
export declare enum REPORT_RETENTION_UNIT {
|
|
56
|
+
DAY = "DAY",
|
|
57
|
+
MONTH = "MONTH"
|
|
58
|
+
}
|
|
59
|
+
export type TReportFilterMode = 'CLIENT' | 'SERVER';
|
|
60
|
+
export type TReportFilterKind = 'KEY_COMPONENT' | 'REQUEST' | 'ROW';
|
|
61
|
+
export interface IReportFilterDefinition {
|
|
62
|
+
id: string;
|
|
63
|
+
kind: TReportFilterKind;
|
|
64
|
+
mode: TReportFilterMode;
|
|
65
|
+
appliesTo: 'SUMMARY' | 'DETAILS' | 'BOTH';
|
|
66
|
+
}
|
|
67
|
+
export interface IReportCompletenessDefinition {
|
|
68
|
+
summary: 'NONE' | 'ALL_SCOPES';
|
|
69
|
+
details: 'NONE' | 'FLAT_PROJECTION';
|
|
70
|
+
}
|
|
71
|
+
export interface IReportCollectionDefinition {
|
|
72
|
+
name: string;
|
|
73
|
+
schemaVersion: number;
|
|
74
|
+
/** Declared budget; `enforced: false` means the CURRENT writer does not assert it yet. */
|
|
75
|
+
budgetBytes: number;
|
|
76
|
+
enforced: boolean;
|
|
77
|
+
/** Validator file in the schema repository, or null with an explicit debt note. */
|
|
78
|
+
validatorFile: string | null;
|
|
79
|
+
validatorDebt?: string;
|
|
80
|
+
indexOwner: string;
|
|
81
|
+
migrationId: string | null;
|
|
82
|
+
}
|
|
83
|
+
export interface IReportRetentionRule {
|
|
84
|
+
collection: string;
|
|
85
|
+
unit: REPORT_RETENTION_UNIT;
|
|
86
|
+
amount: number;
|
|
87
|
+
}
|
|
88
|
+
export interface IReportAdapterIds {
|
|
89
|
+
/** Workers close-day materializer. */
|
|
90
|
+
writer: string;
|
|
91
|
+
/** Operations live read adapter. */
|
|
92
|
+
live: string;
|
|
93
|
+
/** Operations historical read adapter. */
|
|
94
|
+
historical: string;
|
|
95
|
+
/** Operations details read adapter (only when capabilities.details). */
|
|
96
|
+
details?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface IReportDefinition {
|
|
99
|
+
key: REPORT_KEY_ENUM;
|
|
100
|
+
segment: string;
|
|
101
|
+
reportType: MATERIALIZED_REPORT_TYPE_ENUM;
|
|
102
|
+
capabilities: IReportCapabilities;
|
|
103
|
+
status: REPORT_DEFINITION_STATUS;
|
|
104
|
+
report: IReportCollectionDefinition;
|
|
105
|
+
entries?: IReportCollectionDefinition;
|
|
106
|
+
sideCollections: IReportCollectionDefinition[];
|
|
107
|
+
reportScopes: MATERIALIZED_REPORT_SCOPE_ENUM[];
|
|
108
|
+
entryScopes: MATERIALIZED_REPORT_SCOPE_ENUM[];
|
|
109
|
+
entryStorage: REPORT_ENTRY_STORAGE;
|
|
110
|
+
entrySplit: REPORT_ENTRY_SPLIT;
|
|
111
|
+
maxReportScope: MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
112
|
+
maxEntryScope: MATERIALIZED_REPORT_SCOPE_ENUM | null;
|
|
113
|
+
projections: REPORT_PROJECTION[];
|
|
114
|
+
budgets: Record<string, number>;
|
|
115
|
+
retention: IReportRetentionRule[];
|
|
116
|
+
writeGuard: REPORT_WRITE_GUARD;
|
|
117
|
+
liveSource: REPORT_LIVE_SOURCE;
|
|
118
|
+
historicalLens: REPORT_HISTORICAL_LENS;
|
|
119
|
+
completeness: IReportCompletenessDefinition;
|
|
120
|
+
filters: IReportFilterDefinition[];
|
|
121
|
+
cursor: REPORT_CURSOR_KIND;
|
|
122
|
+
adapters: IReportAdapterIds;
|
|
123
|
+
owner: string;
|
|
124
|
+
notes?: string[];
|
|
125
|
+
}
|
|
126
|
+
export declare const REPORT_DEFINITIONS: Record<string, IReportDefinition>;
|
|
127
|
+
export declare const PRODUCTION_REPORT_DEFINITIONS: IReportDefinition[];
|
|
128
|
+
export interface IReportRegistryExemption {
|
|
129
|
+
key: REPORT_KEY_ENUM;
|
|
130
|
+
status: REPORT_DEFINITION_STATUS.READ_ONLY | REPORT_DEFINITION_STATUS.PLANNED;
|
|
131
|
+
reason: string;
|
|
132
|
+
}
|
|
133
|
+
export declare const REPORT_REGISTRY_EXEMPTIONS: Record<string, IReportRegistryExemption>;
|
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REPORT_REGISTRY_EXEMPTIONS = exports.PRODUCTION_REPORT_DEFINITIONS = exports.REPORT_DEFINITIONS = exports.REPORT_RETENTION_UNIT = exports.REPORT_PROJECTION = exports.REPORT_CURSOR_KIND = exports.REPORT_HISTORICAL_LENS = exports.REPORT_LIVE_SOURCE = exports.REPORT_WRITE_GUARD = exports.REPORT_ENTRY_SPLIT = exports.REPORT_ENTRY_STORAGE = exports.REPORT_DEFINITION_STATUS = void 0;
|
|
4
|
+
const MATERIALIZED_REPORTS_1 = require("../../../constants/MATERIALIZED_REPORTS");
|
|
5
|
+
const report_contract_1 = require("../../reporting-contract/report-contract");
|
|
6
|
+
/**
|
|
7
|
+
* PHASE 2 — DECLARATIVE REPORT DEFINITIONS.
|
|
8
|
+
*
|
|
9
|
+
* This module is METADATA ONLY. It must not import Mongoose, Express, database
|
|
10
|
+
* code, workers-service or operations-service. Metric compilation, document
|
|
11
|
+
* schemas and formatters stay report-specific.
|
|
12
|
+
*
|
|
13
|
+
* Schema versions are declared as literals here so this module stays free of
|
|
14
|
+
* schema/model imports. The conformance suite compares every literal with the
|
|
15
|
+
* exported model constant; drift fails the build.
|
|
16
|
+
*/
|
|
17
|
+
var REPORT_DEFINITION_STATUS;
|
|
18
|
+
(function (REPORT_DEFINITION_STATUS) {
|
|
19
|
+
REPORT_DEFINITION_STATUS["PRODUCTION"] = "PRODUCTION";
|
|
20
|
+
REPORT_DEFINITION_STATUS["READ_ONLY"] = "READ_ONLY";
|
|
21
|
+
REPORT_DEFINITION_STATUS["PLANNED"] = "PLANNED";
|
|
22
|
+
})(REPORT_DEFINITION_STATUS || (exports.REPORT_DEFINITION_STATUS = REPORT_DEFINITION_STATUS = {}));
|
|
23
|
+
var REPORT_ENTRY_STORAGE;
|
|
24
|
+
(function (REPORT_ENTRY_STORAGE) {
|
|
25
|
+
/** No itemized collection. */
|
|
26
|
+
REPORT_ENTRY_STORAGE["NONE"] = "NONE";
|
|
27
|
+
/** One entry document per (tenant, scope, field); Prep Time today. */
|
|
28
|
+
REPORT_ENTRY_STORAGE["ONE_PER_SCOPE"] = "ONE_PER_SCOPE";
|
|
29
|
+
/** One entry document per source day; Discounts and Delivery today. */
|
|
30
|
+
REPORT_ENTRY_STORAGE["PAGE_PER_SOURCE_DAY"] = "PAGE_PER_SOURCE_DAY";
|
|
31
|
+
})(REPORT_ENTRY_STORAGE || (exports.REPORT_ENTRY_STORAGE = REPORT_ENTRY_STORAGE = {}));
|
|
32
|
+
var REPORT_ENTRY_SPLIT;
|
|
33
|
+
(function (REPORT_ENTRY_SPLIT) {
|
|
34
|
+
REPORT_ENTRY_SPLIT["NONE"] = "NONE";
|
|
35
|
+
/** Deterministic `page#0`, `page#1`, ... when one page exceeds its budget. */
|
|
36
|
+
REPORT_ENTRY_SPLIT["DETERMINISTIC_SUBPAGES"] = "DETERMINISTIC_SUBPAGES";
|
|
37
|
+
})(REPORT_ENTRY_SPLIT || (exports.REPORT_ENTRY_SPLIT = REPORT_ENTRY_SPLIT = {}));
|
|
38
|
+
var REPORT_WRITE_GUARD;
|
|
39
|
+
(function (REPORT_WRITE_GUARD) {
|
|
40
|
+
REPORT_WRITE_GUARD["NONE"] = "NONE";
|
|
41
|
+
REPORT_WRITE_GUARD["WATERMARK"] = "WATERMARK";
|
|
42
|
+
REPORT_WRITE_GUARD["WATERMARK_AND_DIGEST"] = "WATERMARK_AND_DIGEST";
|
|
43
|
+
})(REPORT_WRITE_GUARD || (exports.REPORT_WRITE_GUARD = REPORT_WRITE_GUARD = {}));
|
|
44
|
+
var REPORT_LIVE_SOURCE;
|
|
45
|
+
(function (REPORT_LIVE_SOURCE) {
|
|
46
|
+
REPORT_LIVE_SOURCE["RAW"] = "RAW";
|
|
47
|
+
REPORT_LIVE_SOURCE["RAW_PLUS_MATERIALIZED"] = "RAW_PLUS_MATERIALIZED";
|
|
48
|
+
})(REPORT_LIVE_SOURCE || (exports.REPORT_LIVE_SOURCE = REPORT_LIVE_SOURCE = {}));
|
|
49
|
+
var REPORT_HISTORICAL_LENS;
|
|
50
|
+
(function (REPORT_HISTORICAL_LENS) {
|
|
51
|
+
REPORT_HISTORICAL_LENS["DOCUMENT_FOLD"] = "DOCUMENT_FOLD";
|
|
52
|
+
REPORT_HISTORICAL_LENS["COUNTER_ROWS"] = "COUNTER_ROWS";
|
|
53
|
+
})(REPORT_HISTORICAL_LENS || (exports.REPORT_HISTORICAL_LENS = REPORT_HISTORICAL_LENS = {}));
|
|
54
|
+
var REPORT_CURSOR_KIND;
|
|
55
|
+
(function (REPORT_CURSOR_KIND) {
|
|
56
|
+
REPORT_CURSOR_KIND["NONE"] = "NONE";
|
|
57
|
+
REPORT_CURSOR_KIND["KEYSET_STRUCTURED"] = "KEYSET_STRUCTURED";
|
|
58
|
+
REPORT_CURSOR_KIND["SIGNED_QUERY"] = "SIGNED_QUERY";
|
|
59
|
+
})(REPORT_CURSOR_KIND || (exports.REPORT_CURSOR_KIND = REPORT_CURSOR_KIND = {}));
|
|
60
|
+
var REPORT_PROJECTION;
|
|
61
|
+
(function (REPORT_PROJECTION) {
|
|
62
|
+
REPORT_PROJECTION["FLAT_DRILLDOWN"] = "FLAT_DRILLDOWN";
|
|
63
|
+
REPORT_PROJECTION["DISCOUNT_SOURCES"] = "DISCOUNT_SOURCES";
|
|
64
|
+
REPORT_PROJECTION["DELIVERY_GEO"] = "DELIVERY_GEO";
|
|
65
|
+
})(REPORT_PROJECTION || (exports.REPORT_PROJECTION = REPORT_PROJECTION = {}));
|
|
66
|
+
var REPORT_RETENTION_UNIT;
|
|
67
|
+
(function (REPORT_RETENTION_UNIT) {
|
|
68
|
+
REPORT_RETENTION_UNIT["DAY"] = "DAY";
|
|
69
|
+
REPORT_RETENTION_UNIT["MONTH"] = "MONTH";
|
|
70
|
+
})(REPORT_RETENTION_UNIT || (exports.REPORT_RETENTION_UNIT = REPORT_RETENTION_UNIT = {}));
|
|
71
|
+
const DOCUMENT_BUDGET = 15 * 1024 * 1024;
|
|
72
|
+
const GEO_SCOPE_BUDGET = 2 * 1024 * 1024;
|
|
73
|
+
const FLAT_ROWS = {
|
|
74
|
+
name: 'materialized_report_drilldown_rows',
|
|
75
|
+
schemaVersion: 1,
|
|
76
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
77
|
+
enforced: false,
|
|
78
|
+
validatorFile: null,
|
|
79
|
+
validatorDebt: 'No schema validator exists for the flat drill-down rows yet.',
|
|
80
|
+
indexOwner: 'toolkit:MATERIALIZED_REPORT_DRILLDOWN_ROWS_INDEX_OPTIONS',
|
|
81
|
+
migrationId: null,
|
|
82
|
+
};
|
|
83
|
+
const FLAT_SCOPES = {
|
|
84
|
+
name: 'materialized_report_drilldown_scopes',
|
|
85
|
+
schemaVersion: 1,
|
|
86
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
87
|
+
enforced: false,
|
|
88
|
+
validatorFile: null,
|
|
89
|
+
validatorDebt: 'No schema validator exists for the flat drill-down scopes yet.',
|
|
90
|
+
indexOwner: 'toolkit:MATERIALIZED_REPORT_DRILLDOWN_SCOPES_INDEX_OPTIONS',
|
|
91
|
+
migrationId: null,
|
|
92
|
+
};
|
|
93
|
+
const CLIENT_KEY_FILTERS = [
|
|
94
|
+
{
|
|
95
|
+
id: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
|
|
96
|
+
kind: 'KEY_COMPONENT',
|
|
97
|
+
mode: 'CLIENT',
|
|
98
|
+
appliesTo: 'BOTH',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
|
|
102
|
+
kind: 'KEY_COMPONENT',
|
|
103
|
+
mode: 'CLIENT',
|
|
104
|
+
appliesTo: 'BOTH',
|
|
105
|
+
},
|
|
106
|
+
{ id: 'DAY_INDEX', kind: 'ROW', mode: 'CLIENT', appliesTo: 'SUMMARY' },
|
|
107
|
+
];
|
|
108
|
+
const OVERVIEW_DEFINITION = {
|
|
109
|
+
key: report_contract_1.REPORT_KEY_ENUM.OVERVIEW,
|
|
110
|
+
segment: 'overview',
|
|
111
|
+
reportType: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_SALES_OVERVIEW,
|
|
112
|
+
capabilities: { live: true, historical: true, details: false },
|
|
113
|
+
status: REPORT_DEFINITION_STATUS.PRODUCTION,
|
|
114
|
+
report: {
|
|
115
|
+
name: 'materialized_tenant_sales_overview_reports',
|
|
116
|
+
schemaVersion: 1,
|
|
117
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
118
|
+
enforced: false,
|
|
119
|
+
validatorFile: 'materialized_tenant_sales_overview_reports.bson',
|
|
120
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_SALES_OVERVIEW_REPORTS_INDEX_OPTIONS',
|
|
121
|
+
migrationId: null,
|
|
122
|
+
},
|
|
123
|
+
sideCollections: [
|
|
124
|
+
{
|
|
125
|
+
name: 'materialized_tenant_credit_bills',
|
|
126
|
+
schemaVersion: 1,
|
|
127
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
128
|
+
enforced: false,
|
|
129
|
+
validatorFile: 'materialized_tenant_credit_bills.bson',
|
|
130
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_CREDIT_BILLS_INDEX_OPTIONS',
|
|
131
|
+
migrationId: null,
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
reportScopes: [...MATERIALIZED_REPORTS_1.ALL_MATERIALIZED_REPORT_SCOPES],
|
|
135
|
+
entryScopes: [],
|
|
136
|
+
entryStorage: REPORT_ENTRY_STORAGE.NONE,
|
|
137
|
+
entrySplit: REPORT_ENTRY_SPLIT.NONE,
|
|
138
|
+
maxReportScope: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
|
|
139
|
+
maxEntryScope: null,
|
|
140
|
+
projections: [],
|
|
141
|
+
budgets: {
|
|
142
|
+
materialized_tenant_sales_overview_reports: DOCUMENT_BUDGET,
|
|
143
|
+
materialized_tenant_credit_bills: DOCUMENT_BUDGET,
|
|
144
|
+
},
|
|
145
|
+
retention: [],
|
|
146
|
+
writeGuard: REPORT_WRITE_GUARD.WATERMARK_AND_DIGEST,
|
|
147
|
+
liveSource: REPORT_LIVE_SOURCE.RAW_PLUS_MATERIALIZED,
|
|
148
|
+
historicalLens: REPORT_HISTORICAL_LENS.DOCUMENT_FOLD,
|
|
149
|
+
completeness: { summary: 'ALL_SCOPES', details: 'NONE' },
|
|
150
|
+
filters: CLIENT_KEY_FILTERS,
|
|
151
|
+
cursor: REPORT_CURSOR_KIND.NONE,
|
|
152
|
+
adapters: {
|
|
153
|
+
writer: 'materializeOverviewReport',
|
|
154
|
+
live: 'getLiveTenantSalesOverviewReports',
|
|
155
|
+
historical: 'getMaterializedTenantSalesOverviewReports',
|
|
156
|
+
},
|
|
157
|
+
owner: 'reporting-platform',
|
|
158
|
+
notes: [
|
|
159
|
+
'Map-only counters: no sales_overview_counter_rows.',
|
|
160
|
+
'LIVE is raw + stored credit ledger and resolves the running day server-side.',
|
|
161
|
+
'Writes the credit ledger and may patch prior issue-day counters.',
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
const DISCOUNTS_DEFINITION = {
|
|
165
|
+
key: report_contract_1.REPORT_KEY_ENUM.DISCOUNTS,
|
|
166
|
+
segment: 'discounts',
|
|
167
|
+
reportType: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DISCOUNT_REPORTS,
|
|
168
|
+
capabilities: { live: true, historical: true, details: true },
|
|
169
|
+
status: REPORT_DEFINITION_STATUS.PRODUCTION,
|
|
170
|
+
report: {
|
|
171
|
+
name: 'materialized_tenant_discount_reports',
|
|
172
|
+
schemaVersion: 1,
|
|
173
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
174
|
+
enforced: false,
|
|
175
|
+
validatorFile: 'materialized_tenant_discount_reports.bson',
|
|
176
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_DISCOUNT_REPORTS_INDEX_OPTIONS',
|
|
177
|
+
migrationId: 'discount-entry-page-index',
|
|
178
|
+
},
|
|
179
|
+
entries: {
|
|
180
|
+
name: 'materialized_tenant_discount_entries',
|
|
181
|
+
schemaVersion: 1,
|
|
182
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
183
|
+
enforced: false,
|
|
184
|
+
validatorFile: 'materialized_tenant_discount_entries.bson',
|
|
185
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_DISCOUNT_ENTRIES_INDEX_OPTIONS',
|
|
186
|
+
migrationId: 'discount-entry-page-index',
|
|
187
|
+
},
|
|
188
|
+
sideCollections: [
|
|
189
|
+
{
|
|
190
|
+
name: 'materialized_tenant_discount_sources',
|
|
191
|
+
schemaVersion: 1,
|
|
192
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
193
|
+
enforced: false,
|
|
194
|
+
validatorFile: null,
|
|
195
|
+
validatorDebt: 'No schema validator exists for the discount source projection yet.',
|
|
196
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_DISCOUNT_SOURCES_INDEX_OPTIONS',
|
|
197
|
+
migrationId: null,
|
|
198
|
+
},
|
|
199
|
+
FLAT_ROWS,
|
|
200
|
+
FLAT_SCOPES,
|
|
201
|
+
],
|
|
202
|
+
reportScopes: [...MATERIALIZED_REPORTS_1.MATERIALIZED_DISCOUNT_REPORT_SCOPES],
|
|
203
|
+
entryScopes: [...MATERIALIZED_REPORTS_1.MATERIALIZED_DISCOUNT_REPORT_SCOPES],
|
|
204
|
+
entryStorage: REPORT_ENTRY_STORAGE.PAGE_PER_SOURCE_DAY,
|
|
205
|
+
entrySplit: REPORT_ENTRY_SPLIT.NONE,
|
|
206
|
+
maxReportScope: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
|
|
207
|
+
maxEntryScope: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
|
|
208
|
+
projections: [REPORT_PROJECTION.DISCOUNT_SOURCES, REPORT_PROJECTION.FLAT_DRILLDOWN],
|
|
209
|
+
budgets: {
|
|
210
|
+
materialized_tenant_discount_reports: DOCUMENT_BUDGET,
|
|
211
|
+
materialized_tenant_discount_entries: DOCUMENT_BUDGET,
|
|
212
|
+
materialized_tenant_discount_sources: DOCUMENT_BUDGET,
|
|
213
|
+
materialized_report_drilldown_rows: DOCUMENT_BUDGET,
|
|
214
|
+
materialized_report_drilldown_scopes: DOCUMENT_BUDGET,
|
|
215
|
+
},
|
|
216
|
+
retention: [],
|
|
217
|
+
writeGuard: REPORT_WRITE_GUARD.WATERMARK_AND_DIGEST,
|
|
218
|
+
liveSource: REPORT_LIVE_SOURCE.RAW,
|
|
219
|
+
historicalLens: REPORT_HISTORICAL_LENS.COUNTER_ROWS,
|
|
220
|
+
completeness: { summary: 'NONE', details: 'FLAT_PROJECTION' },
|
|
221
|
+
filters: [
|
|
222
|
+
...CLIENT_KEY_FILTERS,
|
|
223
|
+
{
|
|
224
|
+
id: 'DETAILS_VIEW',
|
|
225
|
+
kind: 'REQUEST',
|
|
226
|
+
mode: 'SERVER',
|
|
227
|
+
appliesTo: 'DETAILS',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
id: 'SOURCE_KEY_LEVEL',
|
|
231
|
+
kind: 'REQUEST',
|
|
232
|
+
mode: 'SERVER',
|
|
233
|
+
appliesTo: 'DETAILS',
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
cursor: REPORT_CURSOR_KIND.KEYSET_STRUCTURED,
|
|
237
|
+
adapters: {
|
|
238
|
+
writer: 'materializeDiscountReport',
|
|
239
|
+
live: 'getLiveTenantDiscountReports',
|
|
240
|
+
historical: 'getMaterializedTenantDiscountReports',
|
|
241
|
+
details: 'getMaterializedDiscountDetailsPage',
|
|
242
|
+
},
|
|
243
|
+
owner: 'reporting-platform',
|
|
244
|
+
notes: [
|
|
245
|
+
'Month-capped scope set; a wider selection is refused, never narrowed.',
|
|
246
|
+
'Page-partitioned entries; no #N splitter and no budget assertion today.',
|
|
247
|
+
'Derived source projection has no independent iteration history.',
|
|
248
|
+
],
|
|
249
|
+
};
|
|
250
|
+
const PREP_TIME_DEFINITION = {
|
|
251
|
+
key: report_contract_1.REPORT_KEY_ENUM.PREP_TIME,
|
|
252
|
+
segment: 'prep-time',
|
|
253
|
+
reportType: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PREP_TIME_REPORTS,
|
|
254
|
+
capabilities: { live: true, historical: true, details: true },
|
|
255
|
+
status: REPORT_DEFINITION_STATUS.PRODUCTION,
|
|
256
|
+
report: {
|
|
257
|
+
name: 'materialized_tenant_prep_time_reports',
|
|
258
|
+
schemaVersion: 1,
|
|
259
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
260
|
+
enforced: false,
|
|
261
|
+
validatorFile: 'materialized_tenant_prep_time_reports.bson',
|
|
262
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_PREP_TIME_REPORTS_INDEX_OPTIONS',
|
|
263
|
+
migrationId: null,
|
|
264
|
+
},
|
|
265
|
+
entries: {
|
|
266
|
+
name: 'materialized_tenant_prep_time_entries',
|
|
267
|
+
schemaVersion: 1,
|
|
268
|
+
budgetBytes: DOCUMENT_BUDGET,
|
|
269
|
+
enforced: false,
|
|
270
|
+
validatorFile: 'materialized_tenant_prep_time_entries.bson',
|
|
271
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_PREP_TIME_ENTRIES_INDEX_OPTIONS',
|
|
272
|
+
migrationId: null,
|
|
273
|
+
},
|
|
274
|
+
sideCollections: [FLAT_ROWS, FLAT_SCOPES],
|
|
275
|
+
reportScopes: [...MATERIALIZED_REPORTS_1.MATERIALIZED_PREP_TIME_REPORT_SCOPES],
|
|
276
|
+
entryScopes: [...MATERIALIZED_REPORTS_1.MATERIALIZED_PREP_TIME_ITEM_SCOPES],
|
|
277
|
+
entryStorage: REPORT_ENTRY_STORAGE.ONE_PER_SCOPE,
|
|
278
|
+
entrySplit: REPORT_ENTRY_SPLIT.NONE,
|
|
279
|
+
maxReportScope: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
|
|
280
|
+
maxEntryScope: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
|
|
281
|
+
projections: [REPORT_PROJECTION.FLAT_DRILLDOWN],
|
|
282
|
+
budgets: {
|
|
283
|
+
materialized_tenant_prep_time_reports: DOCUMENT_BUDGET,
|
|
284
|
+
materialized_tenant_prep_time_entries: DOCUMENT_BUDGET,
|
|
285
|
+
materialized_report_drilldown_rows: DOCUMENT_BUDGET,
|
|
286
|
+
materialized_report_drilldown_scopes: DOCUMENT_BUDGET,
|
|
287
|
+
},
|
|
288
|
+
retention: [],
|
|
289
|
+
writeGuard: REPORT_WRITE_GUARD.WATERMARK,
|
|
290
|
+
liveSource: REPORT_LIVE_SOURCE.RAW,
|
|
291
|
+
historicalLens: REPORT_HISTORICAL_LENS.COUNTER_ROWS,
|
|
292
|
+
completeness: { summary: 'NONE', details: 'FLAT_PROJECTION' },
|
|
293
|
+
filters: [
|
|
294
|
+
...CLIENT_KEY_FILTERS,
|
|
295
|
+
{ id: 'DETAILS_VIEW', kind: 'REQUEST', mode: 'SERVER', appliesTo: 'DETAILS' },
|
|
296
|
+
{ id: 'LATE_ONLY', kind: 'REQUEST', mode: 'SERVER', appliesTo: 'DETAILS' },
|
|
297
|
+
{ id: 'ITEM_ID', kind: 'REQUEST', mode: 'SERVER', appliesTo: 'DETAILS' },
|
|
298
|
+
{
|
|
299
|
+
id: 'EXCLUDE_CANCELLED',
|
|
300
|
+
kind: 'REQUEST',
|
|
301
|
+
mode: 'SERVER',
|
|
302
|
+
appliesTo: 'DETAILS',
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
cursor: REPORT_CURSOR_KIND.SIGNED_QUERY,
|
|
306
|
+
adapters: {
|
|
307
|
+
writer: 'materializePrepTimeReport',
|
|
308
|
+
live: 'getLiveTenantPrepTimeReports',
|
|
309
|
+
historical: 'getMaterializedTenantPrepTimeReports',
|
|
310
|
+
details: 'getMaterializedPrepTimeDetailsPage',
|
|
311
|
+
},
|
|
312
|
+
owner: 'reporting-platform',
|
|
313
|
+
notes: [
|
|
314
|
+
'Coverage-first counters: MEASURED/UNMEASURED anchor split and target provenance.',
|
|
315
|
+
'No hour scope; entries are one document per scope, not pages.',
|
|
316
|
+
'Item reads are capped at 31 effective days at the route.',
|
|
317
|
+
],
|
|
318
|
+
};
|
|
319
|
+
const DELIVERY_DEFINITION = {
|
|
320
|
+
key: report_contract_1.REPORT_KEY_ENUM.DELIVERY,
|
|
321
|
+
segment: 'delivery',
|
|
322
|
+
reportType: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DELIVERY_REPORTS,
|
|
323
|
+
capabilities: { live: true, historical: true, details: true },
|
|
324
|
+
status: REPORT_DEFINITION_STATUS.PRODUCTION,
|
|
325
|
+
report: {
|
|
326
|
+
name: 'materialized_tenant_delivery_reports',
|
|
327
|
+
schemaVersion: 2,
|
|
328
|
+
budgetBytes: MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_REPORT_MAX_BSON_BYTES,
|
|
329
|
+
enforced: true,
|
|
330
|
+
validatorFile: 'materialized_tenant_delivery_reports.bson',
|
|
331
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_DELIVERY_REPORTS_INDEX_OPTIONS',
|
|
332
|
+
migrationId: 'delivery-page-index-2026-10-27',
|
|
333
|
+
},
|
|
334
|
+
entries: {
|
|
335
|
+
name: 'materialized_tenant_delivery_entries',
|
|
336
|
+
schemaVersion: 3,
|
|
337
|
+
budgetBytes: MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_ENTRY_MAX_BSON_BYTES,
|
|
338
|
+
enforced: true,
|
|
339
|
+
validatorFile: 'materialized_tenant_delivery_entries.bson',
|
|
340
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_DELIVERY_ENTRIES_INDEX_OPTIONS',
|
|
341
|
+
migrationId: 'delivery-page-index-2026-10-27',
|
|
342
|
+
},
|
|
343
|
+
sideCollections: [
|
|
344
|
+
{
|
|
345
|
+
name: 'materialized_tenant_delivery_geo_cells',
|
|
346
|
+
schemaVersion: 1,
|
|
347
|
+
budgetBytes: MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_GEO_CELL_MAX_BSON_BYTES,
|
|
348
|
+
enforced: true,
|
|
349
|
+
validatorFile: 'materialized_tenant_delivery_geo_cells.bson',
|
|
350
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_DELIVERY_GEO_CELLS_INDEX_OPTIONS',
|
|
351
|
+
migrationId: 'delivery-page-index-2026-10-27',
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
name: 'materialized_tenant_delivery_geo_scopes',
|
|
355
|
+
schemaVersion: 1,
|
|
356
|
+
budgetBytes: GEO_SCOPE_BUDGET,
|
|
357
|
+
enforced: false,
|
|
358
|
+
validatorFile: 'materialized_tenant_delivery_geo_scopes.bson',
|
|
359
|
+
indexOwner: 'toolkit:MATERIALIZED_TENANT_DELIVERY_GEO_SCOPES_INDEX_OPTIONS',
|
|
360
|
+
migrationId: 'delivery-page-index-2026-10-27',
|
|
361
|
+
},
|
|
362
|
+
FLAT_ROWS,
|
|
363
|
+
FLAT_SCOPES,
|
|
364
|
+
],
|
|
365
|
+
reportScopes: [...MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_REPORT_SCOPES],
|
|
366
|
+
entryScopes: [...MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_ENTRY_SCOPES],
|
|
367
|
+
entryStorage: REPORT_ENTRY_STORAGE.PAGE_PER_SOURCE_DAY,
|
|
368
|
+
entrySplit: REPORT_ENTRY_SPLIT.DETERMINISTIC_SUBPAGES,
|
|
369
|
+
maxReportScope: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
|
|
370
|
+
maxEntryScope: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
|
|
371
|
+
projections: [REPORT_PROJECTION.FLAT_DRILLDOWN, REPORT_PROJECTION.DELIVERY_GEO],
|
|
372
|
+
budgets: {
|
|
373
|
+
materialized_tenant_delivery_reports: MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_REPORT_MAX_BSON_BYTES,
|
|
374
|
+
materialized_tenant_delivery_entries: MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_ENTRY_MAX_BSON_BYTES,
|
|
375
|
+
materialized_tenant_delivery_geo_cells: MATERIALIZED_REPORTS_1.MATERIALIZED_DELIVERY_GEO_CELL_MAX_BSON_BYTES,
|
|
376
|
+
materialized_tenant_delivery_geo_scopes: GEO_SCOPE_BUDGET,
|
|
377
|
+
materialized_report_drilldown_rows: DOCUMENT_BUDGET,
|
|
378
|
+
materialized_report_drilldown_scopes: DOCUMENT_BUDGET,
|
|
379
|
+
},
|
|
380
|
+
retention: [
|
|
381
|
+
{
|
|
382
|
+
collection: 'materialized_tenant_delivery_geo_cells',
|
|
383
|
+
unit: REPORT_RETENTION_UNIT.DAY,
|
|
384
|
+
amount: 90,
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
collection: 'materialized_tenant_delivery_geo_cells',
|
|
388
|
+
unit: REPORT_RETENTION_UNIT.MONTH,
|
|
389
|
+
amount: 24,
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
writeGuard: REPORT_WRITE_GUARD.WATERMARK,
|
|
393
|
+
liveSource: REPORT_LIVE_SOURCE.RAW,
|
|
394
|
+
historicalLens: REPORT_HISTORICAL_LENS.COUNTER_ROWS,
|
|
395
|
+
completeness: { summary: 'NONE', details: 'FLAT_PROJECTION' },
|
|
396
|
+
filters: [
|
|
397
|
+
{
|
|
398
|
+
id: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
|
|
399
|
+
kind: 'KEY_COMPONENT',
|
|
400
|
+
mode: 'SERVER',
|
|
401
|
+
appliesTo: 'BOTH',
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
id: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
|
|
405
|
+
kind: 'KEY_COMPONENT',
|
|
406
|
+
mode: 'SERVER',
|
|
407
|
+
appliesTo: 'BOTH',
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
id: MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_KEY_FILTER_ENUM.CITY,
|
|
411
|
+
kind: 'KEY_COMPONENT',
|
|
412
|
+
mode: 'SERVER',
|
|
413
|
+
appliesTo: 'BOTH',
|
|
414
|
+
},
|
|
415
|
+
{ id: 'RIDER_ID', kind: 'ROW', mode: 'SERVER', appliesTo: 'BOTH' },
|
|
416
|
+
{ id: 'DETAILS_VIEW', kind: 'REQUEST', mode: 'SERVER', appliesTo: 'DETAILS' },
|
|
417
|
+
],
|
|
418
|
+
cursor: REPORT_CURSOR_KIND.KEYSET_STRUCTURED,
|
|
419
|
+
adapters: {
|
|
420
|
+
writer: 'materializeDeliveryReport',
|
|
421
|
+
live: 'getLiveTenantDeliveryReports',
|
|
422
|
+
historical: 'getMaterializedTenantDeliveryReports',
|
|
423
|
+
details: 'getMaterializedDeliveryDetailsPage',
|
|
424
|
+
},
|
|
425
|
+
owner: 'reporting-platform',
|
|
426
|
+
notes: [
|
|
427
|
+
'Separate H3 geo collection and cap metadata; live geo is computed in memory.',
|
|
428
|
+
'Cross-day completion re-materializes the prior ORDER day within the same transaction.',
|
|
429
|
+
'Page entries split deterministically into #N sub-pages.',
|
|
430
|
+
'Historical totals do not pin schema_version today (baseline debt).',
|
|
431
|
+
],
|
|
432
|
+
};
|
|
433
|
+
exports.REPORT_DEFINITIONS = {
|
|
434
|
+
[OVERVIEW_DEFINITION.key]: OVERVIEW_DEFINITION,
|
|
435
|
+
[DISCOUNTS_DEFINITION.key]: DISCOUNTS_DEFINITION,
|
|
436
|
+
[PREP_TIME_DEFINITION.key]: PREP_TIME_DEFINITION,
|
|
437
|
+
[DELIVERY_DEFINITION.key]: DELIVERY_DEFINITION,
|
|
438
|
+
};
|
|
439
|
+
exports.PRODUCTION_REPORT_DEFINITIONS = [
|
|
440
|
+
OVERVIEW_DEFINITION,
|
|
441
|
+
DISCOUNTS_DEFINITION,
|
|
442
|
+
PREP_TIME_DEFINITION,
|
|
443
|
+
DELIVERY_DEFINITION,
|
|
444
|
+
];
|
|
445
|
+
exports.REPORT_REGISTRY_EXEMPTIONS = {
|
|
446
|
+
[report_contract_1.REPORT_KEY_ENUM.CASH_IN_OUT]: {
|
|
447
|
+
key: report_contract_1.REPORT_KEY_ENUM.CASH_IN_OUT,
|
|
448
|
+
status: REPORT_DEFINITION_STATUS.READ_ONLY,
|
|
449
|
+
reason: 'Read adapters exist but there is no production END_TENANT_DAY writer.',
|
|
450
|
+
},
|
|
451
|
+
[report_contract_1.REPORT_KEY_ENUM.SALES_COMPARISON]: {
|
|
452
|
+
key: report_contract_1.REPORT_KEY_ENUM.SALES_COMPARISON,
|
|
453
|
+
status: REPORT_DEFINITION_STATUS.READ_ONLY,
|
|
454
|
+
reason: 'Read adapters exist but there is no production END_TENANT_DAY writer.',
|
|
455
|
+
},
|
|
456
|
+
[report_contract_1.REPORT_KEY_ENUM.HOURLY_COMPARISON]: {
|
|
457
|
+
key: report_contract_1.REPORT_KEY_ENUM.HOURLY_COMPARISON,
|
|
458
|
+
status: REPORT_DEFINITION_STATUS.READ_ONLY,
|
|
459
|
+
reason: 'Read adapters exist but there is no production END_TENANT_DAY writer.',
|
|
460
|
+
},
|
|
461
|
+
[report_contract_1.REPORT_KEY_ENUM.PAYMENTS_COMPARISON]: {
|
|
462
|
+
key: report_contract_1.REPORT_KEY_ENUM.PAYMENTS_COMPARISON,
|
|
463
|
+
status: REPORT_DEFINITION_STATUS.READ_ONLY,
|
|
464
|
+
reason: 'Read adapters exist but there is no production END_TENANT_DAY writer.',
|
|
465
|
+
},
|
|
466
|
+
[report_contract_1.REPORT_KEY_ENUM.CREDIT_BILLS]: {
|
|
467
|
+
key: report_contract_1.REPORT_KEY_ENUM.CREDIT_BILLS,
|
|
468
|
+
status: REPORT_DEFINITION_STATUS.READ_ONLY,
|
|
469
|
+
reason: 'Historical-only ledger; no live read adapter.',
|
|
470
|
+
},
|
|
471
|
+
[report_contract_1.REPORT_KEY_ENUM.ITERATIONS]: {
|
|
472
|
+
key: report_contract_1.REPORT_KEY_ENUM.ITERATIONS,
|
|
473
|
+
status: REPORT_DEFINITION_STATUS.READ_ONLY,
|
|
474
|
+
reason: 'Shared history read, not a report family.',
|
|
475
|
+
},
|
|
476
|
+
[report_contract_1.REPORT_KEY_ENUM.SUMMARY]: {
|
|
477
|
+
key: report_contract_1.REPORT_KEY_ENUM.SUMMARY,
|
|
478
|
+
status: REPORT_DEFINITION_STATUS.PLANNED,
|
|
479
|
+
reason: 'No implementation.',
|
|
480
|
+
},
|
|
481
|
+
[report_contract_1.REPORT_KEY_ENUM.X_REPORT]: {
|
|
482
|
+
key: report_contract_1.REPORT_KEY_ENUM.X_REPORT,
|
|
483
|
+
status: REPORT_DEFINITION_STATUS.PLANNED,
|
|
484
|
+
reason: 'No implementation.',
|
|
485
|
+
},
|
|
486
|
+
[report_contract_1.REPORT_KEY_ENUM.Z_REPORT]: {
|
|
487
|
+
key: report_contract_1.REPORT_KEY_ENUM.Z_REPORT,
|
|
488
|
+
status: REPORT_DEFINITION_STATUS.PLANNED,
|
|
489
|
+
reason: 'No implementation.',
|
|
490
|
+
},
|
|
491
|
+
[report_contract_1.REPORT_KEY_ENUM.ITEMS]: {
|
|
492
|
+
key: report_contract_1.REPORT_KEY_ENUM.ITEMS,
|
|
493
|
+
status: REPORT_DEFINITION_STATUS.PLANNED,
|
|
494
|
+
reason: 'No implementation.',
|
|
495
|
+
},
|
|
496
|
+
[report_contract_1.REPORT_KEY_ENUM.ITEMS_COMPARISON]: {
|
|
497
|
+
key: report_contract_1.REPORT_KEY_ENUM.ITEMS_COMPARISON,
|
|
498
|
+
status: REPORT_DEFINITION_STATUS.PLANNED,
|
|
499
|
+
reason: 'No implementation.',
|
|
500
|
+
},
|
|
501
|
+
[report_contract_1.REPORT_KEY_ENUM.VOID_ITEMS]: {
|
|
502
|
+
key: report_contract_1.REPORT_KEY_ENUM.VOID_ITEMS,
|
|
503
|
+
status: REPORT_DEFINITION_STATUS.PLANNED,
|
|
504
|
+
reason: 'No implementation.',
|
|
505
|
+
},
|
|
506
|
+
[report_contract_1.REPORT_KEY_ENUM.REVIEWS_RATINGS]: {
|
|
507
|
+
key: report_contract_1.REPORT_KEY_ENUM.REVIEWS_RATINGS,
|
|
508
|
+
status: REPORT_DEFINITION_STATUS.PLANNED,
|
|
509
|
+
reason: 'No implementation.',
|
|
510
|
+
},
|
|
511
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./definition"), exports);
|
|
18
|
+
__exportStar(require("./registry"), exports);
|
|
19
|
+
__exportStar(require("./validate-report-registry"), exports);
|
|
20
|
+
__exportStar(require("./lifecycle"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IReportDefinition } from '../definition';
|
|
2
|
+
/** PHASE 2 — per-collection budget lookup + assertion. */
|
|
3
|
+
export type TReportBudgetKind = 'report' | 'entries' | 'side';
|
|
4
|
+
export declare function getReportCollectionBudget(definition: Pick<IReportDefinition, 'budgets' | 'report' | 'entries' | 'sideCollections'>, kind: TReportBudgetKind, collectionName?: string): number | null;
|
|
5
|
+
export declare function assertReportDocumentBudget(definition: Pick<IReportDefinition, 'key' | 'budgets' | 'report' | 'entries' | 'sideCollections'>, kind: TReportBudgetKind, document: unknown, options?: {
|
|
6
|
+
collectionName?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
}): void;
|