@happyvertical/smrt-reports 0.51.32 → 0.51.34
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/dist/__tests__/helpers/consumer-report-collection.d.ts +5 -0
- package/dist/__tests__/helpers/consumer-report-collection.d.ts.map +1 -0
- package/dist/adapter.d.ts +318 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/aggregate.d.ts +3 -25
- package/dist/aggregate.d.ts.map +1 -0
- package/dist/compiler.d.ts +7 -78
- package/dist/compiler.d.ts.map +1 -0
- package/dist/decorators.d.ts +37 -90
- package/dist/decorators.d.ts.map +1 -0
- package/dist/index.d.ts +16 -1276
- package/dist/index.d.ts.map +1 -0
- package/dist/lifecycle.d.ts +124 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/manifest.json +1 -1
- package/dist/refresh.d.ts +8 -106
- package/dist/refresh.d.ts.map +1 -0
- package/dist/report.d.ts +38 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/scheduler.d.ts +136 -164
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +4 -4
- package/dist/state.d.ts +84 -108
- package/dist/state.d.ts.map +1 -0
- package/dist/types.d.ts +86 -114
- package/dist/types.d.ts.map +1 -0
- package/dist/views.d.ts +269 -0
- package/dist/views.d.ts.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const REPORT_TABLE = "usage_daily_reports";
|
|
2
|
+
export declare function registerConsumerReportCollection(): void;
|
|
3
|
+
/** An unrelated class that names the report's table: still a conflict. */
|
|
4
|
+
export declare function registerUnrelatedTableClaimant(): void;
|
|
5
|
+
//# sourceMappingURL=consumer-report-collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer-report-collection.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/consumer-report-collection.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAgBlD,wBAAgB,gCAAgC,IAAI,IAAI,CAgCvD;AAED,0EAA0E;AAC1E,wBAAgB,8BAA8B,IAAI,IAAI,CAgBrD"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { type SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
+
import type { DataQueryFieldDescriptor, DataQueryFilter, DataQueryRequest, DataQueryResult, DataQuerySchema } from '@happyvertical/smrt-types';
|
|
3
|
+
import { type ReportLifecycleOptions, type ReportLifecycleSnapshot } from './lifecycle.js';
|
|
4
|
+
import type { ReportAggregateFn, ReportTimeBucketUnit } from './types.js';
|
|
5
|
+
/** Presentation and policy metadata understood by the report adapter. */
|
|
6
|
+
export type ReportColumnSensitivity = 'public' | 'personal' | 'sensitive' | 'secret';
|
|
7
|
+
export type ReportColumnCapability = 'read' | 'project' | 'filter' | 'sort' | 'facet' | 'group' | 'aggregate';
|
|
8
|
+
export type ReportColumnKind = 'identity' | 'group' | 'bucket' | 'aggregate';
|
|
9
|
+
/**
|
|
10
|
+
* Source-query clause a field belongs to. The materialized read executor
|
|
11
|
+
* applies both kinds through its tenant-scoped collection, but consumers use
|
|
12
|
+
* this declaration to keep dimensions/periods (WHERE) distinct from measures
|
|
13
|
+
* (HAVING) when constructing drilldowns, saved views, or a live query.
|
|
14
|
+
*/
|
|
15
|
+
export type ReportFilterScope = 'where' | 'having';
|
|
16
|
+
export interface ReportColumnDescriptor extends DataQueryFieldDescriptor {
|
|
17
|
+
/** Stable output column id (never a property path). */
|
|
18
|
+
id: string;
|
|
19
|
+
fieldName: string;
|
|
20
|
+
label: string;
|
|
21
|
+
kind: ReportColumnKind;
|
|
22
|
+
filterScope: ReportFilterScope;
|
|
23
|
+
/** Capabilities available from this adapter revision. */
|
|
24
|
+
capabilities: ReportColumnCapability[];
|
|
25
|
+
format?: string;
|
|
26
|
+
sensitivity?: ReportColumnSensitivity;
|
|
27
|
+
sourceColumn?: string;
|
|
28
|
+
bucket?: ReportTimeBucketUnit;
|
|
29
|
+
aggregate?: ReportAggregateFn;
|
|
30
|
+
distinct?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface ReportRefreshDescriptor {
|
|
33
|
+
mode: 'rebuild' | 'incremental';
|
|
34
|
+
/**
|
|
35
|
+
* Whether the report configuration lets a registered SmrtReportCollection
|
|
36
|
+
* synchronously refresh a stale read. Generic collection reads stay
|
|
37
|
+
* read-only and report unknown freshness until the lifecycle adapter runs.
|
|
38
|
+
*/
|
|
39
|
+
mayRefreshOnRead: boolean;
|
|
40
|
+
ttlMs?: number;
|
|
41
|
+
triggers: Array<'manual' | 'schedule' | 'change' | 'ttl' | 'job'>;
|
|
42
|
+
/** Declared only; the lifecycle adapter owns authorization, audit, and run state. */
|
|
43
|
+
action: ReportRefreshActionDescriptor;
|
|
44
|
+
}
|
|
45
|
+
/** A report-wide lifecycle action, never a mutation performed by this adapter. */
|
|
46
|
+
export interface ReportRefreshActionDescriptor {
|
|
47
|
+
id: 'refresh';
|
|
48
|
+
label: 'Refresh report';
|
|
49
|
+
scope: 'surface';
|
|
50
|
+
phases: Array<'preview' | 'apply'>;
|
|
51
|
+
requiresPermission: true;
|
|
52
|
+
requiredPermission: string;
|
|
53
|
+
auditRequired: true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The report-owned, transport-neutral descriptor. Consumers can map `schema`
|
|
57
|
+
* to the canonical data-query runtime and `columns` to their presentation
|
|
58
|
+
* contract without importing smrt-ui or a report domain class.
|
|
59
|
+
*/
|
|
60
|
+
export interface ReportAdapterDescriptor {
|
|
61
|
+
version: 1;
|
|
62
|
+
resourceId: string;
|
|
63
|
+
reportClassName: string;
|
|
64
|
+
sourceClassName: string;
|
|
65
|
+
tenantScoped: boolean;
|
|
66
|
+
tenantField?: string;
|
|
67
|
+
identityField: 'id';
|
|
68
|
+
columns: ReportColumnDescriptor[];
|
|
69
|
+
schema: DataQuerySchema;
|
|
70
|
+
queryExecution: ReportQueryExecutionDescriptor;
|
|
71
|
+
dataTable: ReportDataTableDescriptor;
|
|
72
|
+
drilldown: ReportDrilldownDescriptor;
|
|
73
|
+
refresh: ReportRefreshDescriptor;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Delivery choices for the same bounded report query. They never add
|
|
77
|
+
* authority: a host owns visible state and background-job execution.
|
|
78
|
+
*/
|
|
79
|
+
export type ReportQueryExecutionMode = 'visible' | 'background' | 'silent';
|
|
80
|
+
export interface ReportQueryExecutionDescriptor {
|
|
81
|
+
modes: ReportQueryExecutionMode[];
|
|
82
|
+
/** The caller may apply the returned rows to an already-authorized surface. */
|
|
83
|
+
visible: {
|
|
84
|
+
delivery: 'result';
|
|
85
|
+
};
|
|
86
|
+
/** A host queues the authority-free task and returns no materialized rows yet. */
|
|
87
|
+
background: {
|
|
88
|
+
delivery: 'queued';
|
|
89
|
+
requiresHost: true;
|
|
90
|
+
};
|
|
91
|
+
/** The caller receives rows but the adapter makes no visible-surface change. */
|
|
92
|
+
silent: {
|
|
93
|
+
delivery: 'result';
|
|
94
|
+
mutatesVisibleSurface: false;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The exact bounded request a background host may persist. Tenant, principal,
|
|
99
|
+
* collection, database, and display state deliberately remain with that host.
|
|
100
|
+
*/
|
|
101
|
+
export interface ReportBackgroundQueryTask {
|
|
102
|
+
version: 1;
|
|
103
|
+
execution: 'background';
|
|
104
|
+
resourceId: string;
|
|
105
|
+
reportClassName: string;
|
|
106
|
+
request: DataQueryRequest;
|
|
107
|
+
inherits: Array<'principal' | 'tenant' | 'report-definition' | 'field-policy'>;
|
|
108
|
+
}
|
|
109
|
+
/** Queuing a background query returns a handle, never rows from another scope. */
|
|
110
|
+
export interface ReportBackgroundQueryResult {
|
|
111
|
+
version: 1;
|
|
112
|
+
execution: 'background';
|
|
113
|
+
status: 'queued';
|
|
114
|
+
taskId: string;
|
|
115
|
+
queryFingerprint: string;
|
|
116
|
+
}
|
|
117
|
+
/** One row value that can safely constrain a source-record drilldown. */
|
|
118
|
+
export interface ReportDrilldownFieldDescriptor {
|
|
119
|
+
/** Stable report column id; never a display label. */
|
|
120
|
+
id: string;
|
|
121
|
+
/** Declared source field/column chosen by report metadata, not caller input. */
|
|
122
|
+
sourceColumn: string;
|
|
123
|
+
kind: 'group' | 'bucket';
|
|
124
|
+
/** A bucket stays declarative so the source adapter preserves report timezone semantics. */
|
|
125
|
+
bucket?: ReportTimeBucketUnit;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Declarative source-query handoff for a report row. No client can supply a
|
|
129
|
+
* principal, tenant, report definition, or arbitrary source field here.
|
|
130
|
+
*/
|
|
131
|
+
export interface ReportDrilldownDescriptor {
|
|
132
|
+
id: 'drilldown';
|
|
133
|
+
sourceClassName: string;
|
|
134
|
+
fields: ReportDrilldownFieldDescriptor[];
|
|
135
|
+
inherits: Array<'principal' | 'tenant' | 'report-definition' | 'field-policy'>;
|
|
136
|
+
}
|
|
137
|
+
export interface ReportDrilldownConstraint {
|
|
138
|
+
id: string;
|
|
139
|
+
sourceColumn: string;
|
|
140
|
+
kind: 'group' | 'bucket';
|
|
141
|
+
value: unknown;
|
|
142
|
+
bucket?: ReportTimeBucketUnit;
|
|
143
|
+
}
|
|
144
|
+
/** A server adapter uses this authority-free handoff to execute a source drilldown. */
|
|
145
|
+
export interface ReportDrilldownQuery {
|
|
146
|
+
version: 1;
|
|
147
|
+
resourceId: string;
|
|
148
|
+
reportClassName: string;
|
|
149
|
+
sourceClassName: string;
|
|
150
|
+
constraints: ReportDrilldownConstraint[];
|
|
151
|
+
inherits: Array<'principal' | 'tenant' | 'report-definition' | 'field-policy'>;
|
|
152
|
+
}
|
|
153
|
+
/** Structural DataTable view hints; deliberately not a smrt-ui dependency. */
|
|
154
|
+
export interface ReportDataTableHeaderPathSegment {
|
|
155
|
+
/** Stable group identity within a header level. */
|
|
156
|
+
id: string;
|
|
157
|
+
/** Human-readable grouped-header label. */
|
|
158
|
+
label: string;
|
|
159
|
+
}
|
|
160
|
+
/** Responsive metadata that maps directly to a consumer's table contract. */
|
|
161
|
+
export interface ReportDataTableColumnResponsive {
|
|
162
|
+
/** Higher values make a column more important during responsive collapse. */
|
|
163
|
+
priority?: number;
|
|
164
|
+
/** Keep key dimensions reachable during responsive collapse. */
|
|
165
|
+
keepVisible?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* A rendering instruction for a raw materialized value. Formatting is never
|
|
169
|
+
* applied to a query row, so sorting, export, and agent consumers retain it.
|
|
170
|
+
*/
|
|
171
|
+
export type ReportDataTableValueFormat = 'text' | 'date' | 'datetime' | 'percentage' | 'count' | 'money' | 'number';
|
|
172
|
+
export type ReportDataTableColumnRole = 'data' | 'status' | 'action';
|
|
173
|
+
export interface ReportDataTableColumn {
|
|
174
|
+
id: string;
|
|
175
|
+
label: string;
|
|
176
|
+
accessor: string;
|
|
177
|
+
sortable: boolean;
|
|
178
|
+
searchable: false;
|
|
179
|
+
filterable: boolean;
|
|
180
|
+
/** Group ancestry for consumers with multi-level table headers. */
|
|
181
|
+
headerPath: ReportDataTableHeaderPathSegment[];
|
|
182
|
+
/** Consumer-side display instruction; materialized rows remain raw. */
|
|
183
|
+
valueFormat: ReportDataTableValueFormat;
|
|
184
|
+
/** The default alignment for the formatted display value. */
|
|
185
|
+
align: 'left' | 'right';
|
|
186
|
+
/** Generic semantic role for status/action columns introduced by later slices. */
|
|
187
|
+
role: ReportDataTableColumnRole;
|
|
188
|
+
responsive: ReportDataTableColumnResponsive;
|
|
189
|
+
}
|
|
190
|
+
export type ReportDataTableStructuralRowKind = 'summary' | 'subtotal' | 'aggregate' | 'footer';
|
|
191
|
+
/** Input supplied by a report consumer that computes a summary or subtotal. */
|
|
192
|
+
export interface ReportDataTableStructuralRowInput {
|
|
193
|
+
id: string;
|
|
194
|
+
kind: ReportDataTableStructuralRowKind;
|
|
195
|
+
label: string;
|
|
196
|
+
/** Raw values keyed by the adapter's stable column id. */
|
|
197
|
+
values?: Readonly<Record<string, unknown>>;
|
|
198
|
+
/** Column that renders this row's accessible row header. */
|
|
199
|
+
labelColumnId?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Structural rows are intentionally separate from materialized data rows.
|
|
203
|
+
* Consumers pass them to their DataTable's structural-row slot/prop, never its
|
|
204
|
+
* selectable data collection.
|
|
205
|
+
*/
|
|
206
|
+
export interface ReportDataTableStructuralRow extends ReportDataTableStructuralRowInput {
|
|
207
|
+
selection: 'excluded';
|
|
208
|
+
actions: 'excluded';
|
|
209
|
+
}
|
|
210
|
+
/** Per-column presentation overrides owned by the consuming report surface. */
|
|
211
|
+
export interface ReportDataTableColumnOverride {
|
|
212
|
+
label?: string;
|
|
213
|
+
headerPath?: readonly ReportDataTableHeaderPathSegment[];
|
|
214
|
+
valueFormat?: ReportDataTableValueFormat;
|
|
215
|
+
align?: 'left' | 'right';
|
|
216
|
+
role?: ReportDataTableColumnRole;
|
|
217
|
+
responsive?: ReportDataTableColumnResponsive;
|
|
218
|
+
}
|
|
219
|
+
export interface ReportDataTablePresentationOptions {
|
|
220
|
+
/** Overrides are keyed by stable adapter column id, not display labels. */
|
|
221
|
+
columns?: Readonly<Record<string, ReportDataTableColumnOverride>>;
|
|
222
|
+
/** Summary/subtotal rows remain structural rather than materialized data rows. */
|
|
223
|
+
structuralRows?: readonly ReportDataTableStructuralRowInput[];
|
|
224
|
+
}
|
|
225
|
+
export interface ReportDataTableDescriptor {
|
|
226
|
+
rowKey: 'id';
|
|
227
|
+
manualPagination: true;
|
|
228
|
+
manualSorting: true;
|
|
229
|
+
enableFiltering: true;
|
|
230
|
+
enableSearch: false;
|
|
231
|
+
columns: ReportDataTableColumn[];
|
|
232
|
+
structuralRows: ReportDataTableStructuralRow[];
|
|
233
|
+
}
|
|
234
|
+
export interface ReportAdapterOptions {
|
|
235
|
+
/** Scope used only to make a stable resource id; it is not authority. */
|
|
236
|
+
tenantScope?: 'current' | 'global' | 'tenant';
|
|
237
|
+
/** Permission that a lifecycle action host must require before refresh. */
|
|
238
|
+
refreshPermission?: string;
|
|
239
|
+
/** Consumer-owned presentational preferences; they never affect query rows. */
|
|
240
|
+
dataTable?: ReportDataTablePresentationOptions;
|
|
241
|
+
}
|
|
242
|
+
interface ReportQueryCommonOptions {
|
|
243
|
+
/** Injected collection seam for tests and application-owned adapters. */
|
|
244
|
+
collection?: {
|
|
245
|
+
list(options: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
|
|
246
|
+
count(options?: Record<string, unknown>): Promise<number>;
|
|
247
|
+
facets?(options: Record<string, unknown>): Promise<Array<{
|
|
248
|
+
field: string;
|
|
249
|
+
values: Array<{
|
|
250
|
+
value: string | number | boolean | null;
|
|
251
|
+
count: number;
|
|
252
|
+
}>;
|
|
253
|
+
}>>;
|
|
254
|
+
};
|
|
255
|
+
db?: import('@happyvertical/sql').DatabaseInterface;
|
|
256
|
+
/**
|
|
257
|
+
* Consumer-owned descriptor preferences. They contribute to the stable
|
|
258
|
+
* resource identity and must match the catalog used to select this report.
|
|
259
|
+
*/
|
|
260
|
+
adapter?: ReportAdapterOptions;
|
|
261
|
+
/**
|
|
262
|
+
* Opt in to a tenant-safe lifecycle snapshot alongside this materialized
|
|
263
|
+
* read. It never makes a generic read mutate.
|
|
264
|
+
*/
|
|
265
|
+
lifecycle?: Omit<ReportLifecycleOptions, 'db'>;
|
|
266
|
+
}
|
|
267
|
+
/** Visible is the default; silent has identical data authority but no UI intent. */
|
|
268
|
+
export interface ReportQueryOptions extends ReportQueryCommonOptions {
|
|
269
|
+
execution?: 'visible' | 'silent';
|
|
270
|
+
}
|
|
271
|
+
/** Background execution is possible only through an application-owned queue host. */
|
|
272
|
+
export interface ReportBackgroundQueryOptions extends ReportQueryCommonOptions {
|
|
273
|
+
execution: 'background';
|
|
274
|
+
enqueueBackgroundQuery(task: ReportBackgroundQueryTask): Promise<{
|
|
275
|
+
taskId: string;
|
|
276
|
+
}>;
|
|
277
|
+
}
|
|
278
|
+
/** Lifecycle context attached only when a caller explicitly opts in. */
|
|
279
|
+
export interface ReportMaterializedReadLifecycle {
|
|
280
|
+
snapshot: ReportLifecycleSnapshot;
|
|
281
|
+
/** Whether this collection read appears to have completed a TTL refresh. */
|
|
282
|
+
read: 'current' | 'stale' | 'refresh-triggered';
|
|
283
|
+
}
|
|
284
|
+
export interface ReportDataQueryResult extends DataQueryResult {
|
|
285
|
+
/** Delivery intent only; the adapter never mutates a visible surface. */
|
|
286
|
+
execution: 'visible' | 'silent';
|
|
287
|
+
reportLifecycle?: ReportMaterializedReadLifecycle;
|
|
288
|
+
}
|
|
289
|
+
export declare function buildReportAdapterDescriptor(reportCtor: new (...args: any[]) => SmrtObject, options?: ReportAdapterOptions): Promise<ReportAdapterDescriptor>;
|
|
290
|
+
/**
|
|
291
|
+
* Bind a materialized report row to its declared source dimensions. This is a
|
|
292
|
+
* query handoff, not an executor: an authenticated source adapter must apply
|
|
293
|
+
* the inherited principal, tenant, definition, and field policy before it
|
|
294
|
+
* reads source records.
|
|
295
|
+
*/
|
|
296
|
+
export declare function buildReportDrilldownQuery(reportCtor: new (...args: any[]) => SmrtObject, row: Readonly<Record<string, unknown>>, options?: ReportAdapterOptions): Promise<ReportDrilldownQuery>;
|
|
297
|
+
/**
|
|
298
|
+
* Split the declared filter language by report semantics for consumers that
|
|
299
|
+
* construct a live source query. Mixed AND expressions are represented as two
|
|
300
|
+
* independent clauses; mixed OR/NOT expressions are rejected because moving
|
|
301
|
+
* either half across WHERE/HAVING would change their meaning.
|
|
302
|
+
*/
|
|
303
|
+
export declare function splitReportFilterScopes(descriptor: ReportAdapterDescriptor, filter: DataQueryFilter | undefined): {
|
|
304
|
+
where?: DataQueryFilter;
|
|
305
|
+
having?: DataQueryFilter;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Execute bounded materialized report reads through the canonical query
|
|
309
|
+
* envelope. Every predicate is an adapter-declared field/operator pair; the
|
|
310
|
+
* collection converts it to parameterized SQL and applies tenant interceptors
|
|
311
|
+
* to list, count, and facet reads alike.
|
|
312
|
+
*/
|
|
313
|
+
export declare function queryReportMaterializedRows(reportCtor: new (...args: any[]) => SmrtObject, input: unknown, options: ReportBackgroundQueryOptions): Promise<ReportBackgroundQueryResult>;
|
|
314
|
+
export declare function queryReportMaterializedRows(reportCtor: new (...args: any[]) => SmrtObject, input: unknown, options?: ReportQueryOptions): Promise<ReportDataQueryResult>;
|
|
315
|
+
/** Read the already-materialized primary key; never use a display/page index. */
|
|
316
|
+
export declare function reportMaterializedRowKey(row: Record<string, unknown>): string;
|
|
317
|
+
export {};
|
|
318
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAEV,wBAAwB,EACxB,eAAe,EAGf,gBAAgB,EAChB,eAAe,EACf,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,iBAAiB,EAIjB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB,yEAAyE;AACzE,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,UAAU,GACV,WAAW,GACX,QAAQ,CAAC;AAEb,MAAM,MAAM,sBAAsB,GAC9B,MAAM,GACN,SAAS,GACT,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,GACP,WAAW,CAAC;AAEhB,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEnD,MAAM,WAA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,OAAO,CAAC,uBAAuB,CAAC,CA0DlC;AAUD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,EAC9C,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACtC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,oBAAoB,CAAC,CAyB/B;AA+JD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,uBAAuB,EACnC,MAAM,EAAE,eAAe,GAAG,SAAS,GAClC;IAAE,KAAK,CAAC,EAAE,eAAe,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,CAiFvD;AA6ED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,EAC9C,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACxC,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,EAC9C,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAsLlC,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAM7E"}
|
package/dist/aggregate.d.ts
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { AggregateSpec } from '@happyvertical/sql';
|
|
5
|
-
import { AggregateTimeBucketUnit } from '@happyvertical/sql';
|
|
6
|
-
import { bucketExpr } from '@happyvertical/sql';
|
|
7
|
-
import { buildAggregate } from '@happyvertical/sql';
|
|
8
|
-
|
|
9
|
-
export { AggregateBuildResult }
|
|
10
|
-
|
|
11
|
-
export { AggregateFunction }
|
|
12
|
-
export { AggregateFunction as ReportAggregateFn }
|
|
13
|
-
|
|
14
|
-
export { AggregateSelectExpr }
|
|
15
|
-
|
|
16
|
-
export { AggregateSpec }
|
|
17
|
-
|
|
18
|
-
export { AggregateTimeBucketUnit }
|
|
19
|
-
export { AggregateTimeBucketUnit as ReportTimeBucketUnit }
|
|
20
|
-
|
|
21
|
-
export { bucketExpr }
|
|
22
|
-
|
|
23
|
-
export { buildAggregate }
|
|
24
|
-
|
|
25
|
-
export { }
|
|
1
|
+
export type { AggregateBuildResult, AggregateFunction, AggregateFunction as ReportAggregateFn, AggregateSelectExpr, AggregateSpec, AggregateTimeBucketUnit, AggregateTimeBucketUnit as ReportTimeBucketUnit, } from '@happyvertical/sql';
|
|
2
|
+
export { bucketExpr, buildAggregate, } from '@happyvertical/sql';
|
|
3
|
+
//# sourceMappingURL=aggregate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../src/aggregate.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,IAAI,iBAAiB,EACtC,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,uBAAuB,IAAI,oBAAoB,GAChD,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,cAAc,GACf,MAAM,oBAAoB,CAAC"}
|
package/dist/compiler.d.ts
CHANGED
|
@@ -1,78 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AggregateSpec } from '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare function compileReportDefinition(definition: ReportDefinition): AggregateSpec;
|
|
10
|
-
|
|
11
|
-
export declare function compileReportSpec(reportCtor: new (...args: any[]) => SmrtObject): Promise<AggregateSpec>;
|
|
12
|
-
|
|
13
|
-
export declare function getReportGroupingColumns(definition: Pick<ReportDefinition, 'fields'>): string[];
|
|
14
|
-
|
|
15
|
-
declare interface ReportAggregateFieldMetadata {
|
|
16
|
-
kind: 'aggregate';
|
|
17
|
-
fn: ReportAggregateFn;
|
|
18
|
-
column?: string;
|
|
19
|
-
distinct?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare type ReportAggregateFn = AggregateFunction;
|
|
23
|
-
|
|
24
|
-
declare interface ReportBucketFieldMetadata {
|
|
25
|
-
kind: 'bucket';
|
|
26
|
-
unit: ReportTimeBucketUnit;
|
|
27
|
-
sourceColumn: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
declare interface ReportDefinition {
|
|
31
|
-
reportClassName: string;
|
|
32
|
-
sourceClassName: string;
|
|
33
|
-
sourceTable: string;
|
|
34
|
-
fields: ReportFieldDefinition[];
|
|
35
|
-
where?: WhereClause;
|
|
36
|
-
having?: WhereClause;
|
|
37
|
-
refresh?: ReportRefreshConfig;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare interface ReportFieldDefinition {
|
|
41
|
-
fieldName: string;
|
|
42
|
-
columnName?: string;
|
|
43
|
-
type?: string;
|
|
44
|
-
report?: ReportFieldMetadata;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare type ReportFieldMetadata = ReportGroupFieldMetadata | ReportBucketFieldMetadata | ReportAggregateFieldMetadata;
|
|
48
|
-
|
|
49
|
-
declare interface ReportGroupFieldMetadata {
|
|
50
|
-
kind: 'group';
|
|
51
|
-
sourceColumn?: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
declare interface ReportRefreshConfig {
|
|
55
|
-
mode?: ReportRefreshMode;
|
|
56
|
-
schedule?: string;
|
|
57
|
-
onChange?: ReportSource[];
|
|
58
|
-
/**
|
|
59
|
-
* Milliseconds before collection reads trigger a synchronous refresh.
|
|
60
|
-
*
|
|
61
|
-
* TTL refresh checks add a read-time MAX(refreshedAt) query, and stale reads
|
|
62
|
-
* perform the refresh before returning list/get results.
|
|
63
|
-
*/
|
|
64
|
-
ttl?: number;
|
|
65
|
-
manual?: boolean;
|
|
66
|
-
watermarkColumn?: string;
|
|
67
|
-
softDeleteColumn?: string;
|
|
68
|
-
fullRebuildSchedule?: string;
|
|
69
|
-
tenantFanout?: boolean;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare type ReportRefreshMode = 'rebuild' | 'incremental';
|
|
73
|
-
|
|
74
|
-
declare type ReportSource = string | (new (...args: any[]) => SmrtObject) | (abstract new (...args: any[]) => SmrtObject);
|
|
75
|
-
|
|
76
|
-
declare type ReportTimeBucketUnit = AggregateTimeBucketUnit;
|
|
77
|
-
|
|
78
|
-
export { }
|
|
1
|
+
import { type SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
+
import type { AggregateSpec, ReportDefinition } from './types.js';
|
|
3
|
+
export declare function buildReportDefinition(reportCtor: new (...args: any[]) => SmrtObject): Promise<ReportDefinition>;
|
|
4
|
+
export declare function getReportGroupingColumns(definition: Pick<ReportDefinition, 'fields'>): string[];
|
|
5
|
+
export declare function compileReportDefinition(definition: ReportDefinition): AggregateSpec;
|
|
6
|
+
export declare function compileReportSpec(reportCtor: new (...args: any[]) => SmrtObject): Promise<AggregateSpec>;
|
|
7
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAI3E,OAAO,KAAK,EAEV,aAAa,EACb,gBAAgB,EAKjB,MAAM,YAAY,CAAC;AAiJpB,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,GAC7C,OAAO,CAAC,gBAAgB,CAAC,CAqC3B;AAoBD,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAC3C,MAAM,EAAE,CAQV;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,gBAAgB,GAC3B,aAAa,CAyDf;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,GAC7C,OAAO,CAAC,aAAa,CAAC,CAExB"}
|
package/dist/decorators.d.ts
CHANGED
|
@@ -1,90 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
export declare
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export declare const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export declare function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export declare const min: (column?: string, options?: {
|
|
40
|
-
distinct?: boolean;
|
|
41
|
-
}) => PropertyDecorator;
|
|
42
|
-
|
|
43
|
-
export declare const minute: (sourceColumn: string) => PropertyDecorator;
|
|
44
|
-
|
|
45
|
-
export declare const month: (sourceColumn: string) => PropertyDecorator;
|
|
46
|
-
|
|
47
|
-
export declare const quarter: (sourceColumn: string) => PropertyDecorator;
|
|
48
|
-
|
|
49
|
-
export declare function report(options: ReportOptions): <T extends abstract new (...args: any[]) => any>(ctor: T) => T;
|
|
50
|
-
|
|
51
|
-
declare type ReportAggregateFn = AggregateFunction;
|
|
52
|
-
|
|
53
|
-
declare interface ReportOptions {
|
|
54
|
-
source: ReportSource;
|
|
55
|
-
where?: WhereClause;
|
|
56
|
-
having?: WhereClause;
|
|
57
|
-
refresh?: ReportRefreshConfig;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare interface ReportRefreshConfig {
|
|
61
|
-
mode?: ReportRefreshMode;
|
|
62
|
-
schedule?: string;
|
|
63
|
-
onChange?: ReportSource[];
|
|
64
|
-
/**
|
|
65
|
-
* Milliseconds before collection reads trigger a synchronous refresh.
|
|
66
|
-
*
|
|
67
|
-
* TTL refresh checks add a read-time MAX(refreshedAt) query, and stale reads
|
|
68
|
-
* perform the refresh before returning list/get results.
|
|
69
|
-
*/
|
|
70
|
-
ttl?: number;
|
|
71
|
-
manual?: boolean;
|
|
72
|
-
watermarkColumn?: string;
|
|
73
|
-
softDeleteColumn?: string;
|
|
74
|
-
fullRebuildSchedule?: string;
|
|
75
|
-
tenantFanout?: boolean;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare type ReportRefreshMode = 'rebuild' | 'incremental';
|
|
79
|
-
|
|
80
|
-
declare type ReportSource = string | (new (...args: any[]) => SmrtObject) | (abstract new (...args: any[]) => SmrtObject);
|
|
81
|
-
|
|
82
|
-
export declare const sum: (column?: string, options?: {
|
|
83
|
-
distinct?: boolean;
|
|
84
|
-
}) => PropertyDecorator;
|
|
85
|
-
|
|
86
|
-
export declare const week: (sourceColumn: string) => PropertyDecorator;
|
|
87
|
-
|
|
88
|
-
export declare const year: (sourceColumn: string) => PropertyDecorator;
|
|
89
|
-
|
|
90
|
-
export { }
|
|
1
|
+
import type { ReportAggregateFn, ReportOptions } from './types.js';
|
|
2
|
+
export declare function report(options: ReportOptions): <T extends abstract new (...args: any[]) => any>(ctor: T) => T;
|
|
3
|
+
export declare function getRuntimeReportOptions(ctor: Function): ReportOptions | undefined;
|
|
4
|
+
export declare function groupBy(sourceColumn?: string): PropertyDecorator;
|
|
5
|
+
export declare const minute: (sourceColumn: string) => PropertyDecorator;
|
|
6
|
+
export declare const hour: (sourceColumn: string) => PropertyDecorator;
|
|
7
|
+
export declare const day: (sourceColumn: string) => PropertyDecorator;
|
|
8
|
+
export declare const week: (sourceColumn: string) => PropertyDecorator;
|
|
9
|
+
export declare const month: (sourceColumn: string) => PropertyDecorator;
|
|
10
|
+
export declare const quarter: (sourceColumn: string) => PropertyDecorator;
|
|
11
|
+
export declare const year: (sourceColumn: string) => PropertyDecorator;
|
|
12
|
+
export interface AggregateDecoratorOptions {
|
|
13
|
+
fn: ReportAggregateFn;
|
|
14
|
+
column?: string;
|
|
15
|
+
distinct?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function aggregate(options: AggregateDecoratorOptions): PropertyDecorator;
|
|
18
|
+
export declare const sum: (column?: string, options?: {
|
|
19
|
+
distinct?: boolean;
|
|
20
|
+
}) => PropertyDecorator;
|
|
21
|
+
export declare const avg: (column?: string, options?: {
|
|
22
|
+
distinct?: boolean;
|
|
23
|
+
}) => PropertyDecorator;
|
|
24
|
+
export declare const min: (column?: string, options?: {
|
|
25
|
+
distinct?: boolean;
|
|
26
|
+
}) => PropertyDecorator;
|
|
27
|
+
export declare const max: (column?: string, options?: {
|
|
28
|
+
distinct?: boolean;
|
|
29
|
+
}) => PropertyDecorator;
|
|
30
|
+
export declare function count(): PropertyDecorator;
|
|
31
|
+
export declare function count(column: string, options?: {
|
|
32
|
+
distinct?: boolean;
|
|
33
|
+
}): PropertyDecorator;
|
|
34
|
+
export declare function count(options: {
|
|
35
|
+
distinct?: boolean;
|
|
36
|
+
}): PropertyDecorator;
|
|
37
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,iBAAiB,EAGjB,aAAa,EAEd,MAAM,YAAY,CAAC;AAIpB,wBAAgB,MAA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