@objectstack/driver-memory 2.0.6 → 3.0.0
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +20 -0
- package/dist/index.d.mts +165 -12
- package/dist/index.d.ts +165 -12
- package/dist/index.js +742 -159
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +740 -158
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
- package/src/index.ts +4 -12
- package/src/memory-analytics.test.ts +346 -0
- package/src/memory-analytics.ts +518 -0
- package/src/memory-driver.test.ts +473 -1
- package/src/memory-driver.ts +416 -85
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/driver-memory@
|
|
2
|
+
> @objectstack/driver-memory@3.0.0 build /home/runner/work/spec/spec/packages/plugins/driver-memory
|
|
3
3
|
> tsup --config ../../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
16
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
17
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m36.64 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m77.34 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 93ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m37.79 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m77.38 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 98ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 10279ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m8.39 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m8.39 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @objectstack/driver-memory
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Release v3.0.0 — unified version bump for all ObjectStack packages.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @objectstack/spec@3.0.0
|
|
13
|
+
- @objectstack/core@3.0.0
|
|
14
|
+
|
|
15
|
+
## 2.0.7
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @objectstack/spec@2.0.7
|
|
21
|
+
- @objectstack/core@2.0.7
|
|
22
|
+
|
|
3
23
|
## 2.0.6
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
import { QueryInput, DriverOptions } from '@objectstack/spec/data';
|
|
2
|
-
import { DriverInterface } from '@objectstack/core';
|
|
1
|
+
import { QueryInput, DriverOptions, Cube, AnalyticsQuery } from '@objectstack/spec/data';
|
|
2
|
+
import { DriverInterface, Logger } from '@objectstack/core';
|
|
3
|
+
import { IAnalyticsService, AnalyticsResult, CubeMeta } from '@objectstack/spec/contracts';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Configuration options for the InMemory driver.
|
|
7
|
+
* Aligned with @objectstack/spec MemoryConfigSchema.
|
|
8
|
+
*/
|
|
9
|
+
interface InMemoryDriverConfig {
|
|
10
|
+
/** Optional: Initial data to populate the store */
|
|
11
|
+
initialData?: Record<string, Record<string, unknown>[]>;
|
|
12
|
+
/** Optional: Enable strict mode (throw on missing records) */
|
|
13
|
+
strictMode?: boolean;
|
|
14
|
+
/** Optional: Logger instance */
|
|
15
|
+
logger?: Logger;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* In-Memory Driver for ObjectStack
|
|
6
19
|
*
|
|
7
|
-
* A
|
|
8
|
-
*
|
|
20
|
+
* A production-ready implementation of the ObjectStack Driver Protocol
|
|
21
|
+
* powered by Mingo — a MongoDB-compatible query and aggregation engine.
|
|
22
|
+
*
|
|
23
|
+
* Features:
|
|
24
|
+
* - MongoDB-compatible query engine (Mingo) for filtering, projection, aggregation
|
|
25
|
+
* - Full CRUD and bulk operations
|
|
26
|
+
* - Aggregation pipeline support ($match, $group, $sort, $project, $unwind, etc.)
|
|
27
|
+
* - Snapshot-based transactions (begin/commit/rollback)
|
|
28
|
+
* - Field projection and distinct values
|
|
29
|
+
* - Strict mode and initial data loading
|
|
30
|
+
*
|
|
31
|
+
* Reference: objectql/packages/drivers/memory
|
|
9
32
|
*/
|
|
10
33
|
declare class InMemoryDriver implements DriverInterface {
|
|
11
34
|
name: string;
|
|
@@ -13,7 +36,9 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
13
36
|
version: string;
|
|
14
37
|
private config;
|
|
15
38
|
private logger;
|
|
16
|
-
|
|
39
|
+
private idCounters;
|
|
40
|
+
private transactions;
|
|
41
|
+
constructor(config?: InMemoryDriverConfig);
|
|
17
42
|
install(ctx: any): void;
|
|
18
43
|
supports: {
|
|
19
44
|
transactions: boolean;
|
|
@@ -66,22 +91,150 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
66
91
|
data: Record<string, any>;
|
|
67
92
|
}[], options?: DriverOptions): Promise<any[]>;
|
|
68
93
|
bulkDelete(object: string, ids: (string | number)[], options?: DriverOptions): Promise<void>;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
commit(): Promise<void>;
|
|
73
|
-
rollback(): Promise<void>;
|
|
94
|
+
beginTransaction(): Promise<{
|
|
95
|
+
id: string;
|
|
96
|
+
}>;
|
|
97
|
+
commit(txHandle?: unknown): Promise<void>;
|
|
98
|
+
rollback(txHandle?: unknown): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Remove all data from the store.
|
|
101
|
+
*/
|
|
102
|
+
clear(): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Get total number of records across all tables.
|
|
105
|
+
*/
|
|
106
|
+
getSize(): number;
|
|
107
|
+
/**
|
|
108
|
+
* Get distinct values for a field, optionally filtered.
|
|
109
|
+
*/
|
|
110
|
+
distinct(object: string, field: string, query?: QueryInput): Promise<any[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Execute a MongoDB-style aggregation pipeline using Mingo.
|
|
113
|
+
*
|
|
114
|
+
* Supports all standard MongoDB pipeline stages:
|
|
115
|
+
* - $match, $group, $sort, $project, $unwind, $limit, $skip
|
|
116
|
+
* - $addFields, $replaceRoot, $lookup (limited), $count
|
|
117
|
+
* - Accumulator operators: $sum, $avg, $min, $max, $first, $last, $push, $addToSet
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* // Group by status and count
|
|
121
|
+
* const results = await driver.aggregate('orders', [
|
|
122
|
+
* { $match: { status: 'completed' } },
|
|
123
|
+
* { $group: { _id: '$customer', totalAmount: { $sum: '$amount' } } }
|
|
124
|
+
* ]);
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* // Calculate average with filter
|
|
128
|
+
* const results = await driver.aggregate('products', [
|
|
129
|
+
* { $match: { category: 'electronics' } },
|
|
130
|
+
* { $group: { _id: null, avgPrice: { $avg: '$price' } } }
|
|
131
|
+
* ]);
|
|
132
|
+
*/
|
|
133
|
+
aggregate(object: string, pipeline: Record<string, any>[], options?: DriverOptions): Promise<any[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Convert ObjectQL filter format to MongoDB query format for Mingo.
|
|
136
|
+
*
|
|
137
|
+
* Supports:
|
|
138
|
+
* 1. AST Comparison Node: { type: 'comparison', field, operator, value }
|
|
139
|
+
* 2. AST Logical Node: { type: 'logical', operator: 'and'|'or', conditions: [...] }
|
|
140
|
+
* 3. Legacy Array Format: [['field', 'op', value], 'and', ['field2', 'op', value2]]
|
|
141
|
+
* 4. MongoDB Format: { field: value } or { field: { $eq: value } } (passthrough)
|
|
142
|
+
*/
|
|
143
|
+
private convertToMongoQuery;
|
|
144
|
+
/**
|
|
145
|
+
* Convert a single ObjectQL condition to MongoDB operator format.
|
|
146
|
+
*/
|
|
147
|
+
private convertConditionToMongo;
|
|
148
|
+
/**
|
|
149
|
+
* Escape special regex characters for safe literal matching.
|
|
150
|
+
*/
|
|
151
|
+
private escapeRegex;
|
|
74
152
|
private performAggregation;
|
|
75
153
|
private computeAggregate;
|
|
76
154
|
private setValueByPath;
|
|
155
|
+
syncSchema(object: string, schema: any, options?: DriverOptions): Promise<void>;
|
|
156
|
+
dropTable(object: string, options?: DriverOptions): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Apply manual sorting (Mingo sort has CJS build issues).
|
|
159
|
+
*/
|
|
160
|
+
private applySort;
|
|
161
|
+
/**
|
|
162
|
+
* Project specific fields from a record.
|
|
163
|
+
*/
|
|
164
|
+
private projectFields;
|
|
77
165
|
private getTable;
|
|
78
166
|
private generateId;
|
|
79
167
|
}
|
|
80
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Configuration for MemoryAnalyticsService
|
|
171
|
+
*/
|
|
172
|
+
interface MemoryAnalyticsConfig {
|
|
173
|
+
/** The data driver instance to use for queries */
|
|
174
|
+
driver: InMemoryDriver;
|
|
175
|
+
/** Cube definitions for the semantic layer */
|
|
176
|
+
cubes: Cube[];
|
|
177
|
+
/** Optional logger */
|
|
178
|
+
logger?: Logger;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Memory-Based Analytics Service
|
|
182
|
+
*
|
|
183
|
+
* Implements IAnalyticsService using InMemoryDriver's aggregation capabilities.
|
|
184
|
+
* Provides a semantic layer (Cubes, Metrics, Dimensions) on top of in-memory data.
|
|
185
|
+
*
|
|
186
|
+
* Features:
|
|
187
|
+
* - Cube-based semantic modeling
|
|
188
|
+
* - Measure calculations (count, sum, avg, min, max, count_distinct)
|
|
189
|
+
* - Dimension grouping
|
|
190
|
+
* - Filter support
|
|
191
|
+
* - Time dimension handling
|
|
192
|
+
* - SQL generation (for debugging/transparency)
|
|
193
|
+
*
|
|
194
|
+
* This implementation is suitable for:
|
|
195
|
+
* - Development and testing
|
|
196
|
+
* - Local-first analytics
|
|
197
|
+
* - Small to medium datasets
|
|
198
|
+
* - Prototyping BI applications
|
|
199
|
+
*/
|
|
200
|
+
declare class MemoryAnalyticsService implements IAnalyticsService {
|
|
201
|
+
private driver;
|
|
202
|
+
private cubes;
|
|
203
|
+
private logger;
|
|
204
|
+
constructor(config: MemoryAnalyticsConfig);
|
|
205
|
+
/**
|
|
206
|
+
* Execute an analytical query using the memory driver's aggregation pipeline
|
|
207
|
+
*/
|
|
208
|
+
query(query: AnalyticsQuery): Promise<AnalyticsResult>;
|
|
209
|
+
/**
|
|
210
|
+
* Get available cube metadata for discovery
|
|
211
|
+
*/
|
|
212
|
+
getMeta(cubeName?: string): Promise<CubeMeta[]>;
|
|
213
|
+
/**
|
|
214
|
+
* Generate SQL representation for debugging/transparency
|
|
215
|
+
*/
|
|
216
|
+
generateSql(query: AnalyticsQuery): Promise<{
|
|
217
|
+
sql: string;
|
|
218
|
+
params: unknown[];
|
|
219
|
+
}>;
|
|
220
|
+
private resolveFieldPath;
|
|
221
|
+
private resolveMeasure;
|
|
222
|
+
private resolveDimension;
|
|
223
|
+
private getShortName;
|
|
224
|
+
private buildAggregator;
|
|
225
|
+
private measureTypeToFieldType;
|
|
226
|
+
private convertOperatorToMongo;
|
|
227
|
+
private operatorToSql;
|
|
228
|
+
private measureToSql;
|
|
229
|
+
private extractTableName;
|
|
230
|
+
private parseDateRangeString;
|
|
231
|
+
private generateSqlFromPipeline;
|
|
232
|
+
}
|
|
233
|
+
|
|
81
234
|
declare const _default: {
|
|
82
235
|
id: string;
|
|
83
236
|
version: string;
|
|
84
237
|
onEnable: (context: any) => Promise<void>;
|
|
85
238
|
};
|
|
86
239
|
|
|
87
|
-
export { InMemoryDriver, _default as default };
|
|
240
|
+
export { InMemoryDriver, type InMemoryDriverConfig, type MemoryAnalyticsConfig, MemoryAnalyticsService, _default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
import { QueryInput, DriverOptions } from '@objectstack/spec/data';
|
|
2
|
-
import { DriverInterface } from '@objectstack/core';
|
|
1
|
+
import { QueryInput, DriverOptions, Cube, AnalyticsQuery } from '@objectstack/spec/data';
|
|
2
|
+
import { DriverInterface, Logger } from '@objectstack/core';
|
|
3
|
+
import { IAnalyticsService, AnalyticsResult, CubeMeta } from '@objectstack/spec/contracts';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Configuration options for the InMemory driver.
|
|
7
|
+
* Aligned with @objectstack/spec MemoryConfigSchema.
|
|
8
|
+
*/
|
|
9
|
+
interface InMemoryDriverConfig {
|
|
10
|
+
/** Optional: Initial data to populate the store */
|
|
11
|
+
initialData?: Record<string, Record<string, unknown>[]>;
|
|
12
|
+
/** Optional: Enable strict mode (throw on missing records) */
|
|
13
|
+
strictMode?: boolean;
|
|
14
|
+
/** Optional: Logger instance */
|
|
15
|
+
logger?: Logger;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* In-Memory Driver for ObjectStack
|
|
6
19
|
*
|
|
7
|
-
* A
|
|
8
|
-
*
|
|
20
|
+
* A production-ready implementation of the ObjectStack Driver Protocol
|
|
21
|
+
* powered by Mingo — a MongoDB-compatible query and aggregation engine.
|
|
22
|
+
*
|
|
23
|
+
* Features:
|
|
24
|
+
* - MongoDB-compatible query engine (Mingo) for filtering, projection, aggregation
|
|
25
|
+
* - Full CRUD and bulk operations
|
|
26
|
+
* - Aggregation pipeline support ($match, $group, $sort, $project, $unwind, etc.)
|
|
27
|
+
* - Snapshot-based transactions (begin/commit/rollback)
|
|
28
|
+
* - Field projection and distinct values
|
|
29
|
+
* - Strict mode and initial data loading
|
|
30
|
+
*
|
|
31
|
+
* Reference: objectql/packages/drivers/memory
|
|
9
32
|
*/
|
|
10
33
|
declare class InMemoryDriver implements DriverInterface {
|
|
11
34
|
name: string;
|
|
@@ -13,7 +36,9 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
13
36
|
version: string;
|
|
14
37
|
private config;
|
|
15
38
|
private logger;
|
|
16
|
-
|
|
39
|
+
private idCounters;
|
|
40
|
+
private transactions;
|
|
41
|
+
constructor(config?: InMemoryDriverConfig);
|
|
17
42
|
install(ctx: any): void;
|
|
18
43
|
supports: {
|
|
19
44
|
transactions: boolean;
|
|
@@ -66,22 +91,150 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
66
91
|
data: Record<string, any>;
|
|
67
92
|
}[], options?: DriverOptions): Promise<any[]>;
|
|
68
93
|
bulkDelete(object: string, ids: (string | number)[], options?: DriverOptions): Promise<void>;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
commit(): Promise<void>;
|
|
73
|
-
rollback(): Promise<void>;
|
|
94
|
+
beginTransaction(): Promise<{
|
|
95
|
+
id: string;
|
|
96
|
+
}>;
|
|
97
|
+
commit(txHandle?: unknown): Promise<void>;
|
|
98
|
+
rollback(txHandle?: unknown): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Remove all data from the store.
|
|
101
|
+
*/
|
|
102
|
+
clear(): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Get total number of records across all tables.
|
|
105
|
+
*/
|
|
106
|
+
getSize(): number;
|
|
107
|
+
/**
|
|
108
|
+
* Get distinct values for a field, optionally filtered.
|
|
109
|
+
*/
|
|
110
|
+
distinct(object: string, field: string, query?: QueryInput): Promise<any[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Execute a MongoDB-style aggregation pipeline using Mingo.
|
|
113
|
+
*
|
|
114
|
+
* Supports all standard MongoDB pipeline stages:
|
|
115
|
+
* - $match, $group, $sort, $project, $unwind, $limit, $skip
|
|
116
|
+
* - $addFields, $replaceRoot, $lookup (limited), $count
|
|
117
|
+
* - Accumulator operators: $sum, $avg, $min, $max, $first, $last, $push, $addToSet
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* // Group by status and count
|
|
121
|
+
* const results = await driver.aggregate('orders', [
|
|
122
|
+
* { $match: { status: 'completed' } },
|
|
123
|
+
* { $group: { _id: '$customer', totalAmount: { $sum: '$amount' } } }
|
|
124
|
+
* ]);
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* // Calculate average with filter
|
|
128
|
+
* const results = await driver.aggregate('products', [
|
|
129
|
+
* { $match: { category: 'electronics' } },
|
|
130
|
+
* { $group: { _id: null, avgPrice: { $avg: '$price' } } }
|
|
131
|
+
* ]);
|
|
132
|
+
*/
|
|
133
|
+
aggregate(object: string, pipeline: Record<string, any>[], options?: DriverOptions): Promise<any[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Convert ObjectQL filter format to MongoDB query format for Mingo.
|
|
136
|
+
*
|
|
137
|
+
* Supports:
|
|
138
|
+
* 1. AST Comparison Node: { type: 'comparison', field, operator, value }
|
|
139
|
+
* 2. AST Logical Node: { type: 'logical', operator: 'and'|'or', conditions: [...] }
|
|
140
|
+
* 3. Legacy Array Format: [['field', 'op', value], 'and', ['field2', 'op', value2]]
|
|
141
|
+
* 4. MongoDB Format: { field: value } or { field: { $eq: value } } (passthrough)
|
|
142
|
+
*/
|
|
143
|
+
private convertToMongoQuery;
|
|
144
|
+
/**
|
|
145
|
+
* Convert a single ObjectQL condition to MongoDB operator format.
|
|
146
|
+
*/
|
|
147
|
+
private convertConditionToMongo;
|
|
148
|
+
/**
|
|
149
|
+
* Escape special regex characters for safe literal matching.
|
|
150
|
+
*/
|
|
151
|
+
private escapeRegex;
|
|
74
152
|
private performAggregation;
|
|
75
153
|
private computeAggregate;
|
|
76
154
|
private setValueByPath;
|
|
155
|
+
syncSchema(object: string, schema: any, options?: DriverOptions): Promise<void>;
|
|
156
|
+
dropTable(object: string, options?: DriverOptions): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Apply manual sorting (Mingo sort has CJS build issues).
|
|
159
|
+
*/
|
|
160
|
+
private applySort;
|
|
161
|
+
/**
|
|
162
|
+
* Project specific fields from a record.
|
|
163
|
+
*/
|
|
164
|
+
private projectFields;
|
|
77
165
|
private getTable;
|
|
78
166
|
private generateId;
|
|
79
167
|
}
|
|
80
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Configuration for MemoryAnalyticsService
|
|
171
|
+
*/
|
|
172
|
+
interface MemoryAnalyticsConfig {
|
|
173
|
+
/** The data driver instance to use for queries */
|
|
174
|
+
driver: InMemoryDriver;
|
|
175
|
+
/** Cube definitions for the semantic layer */
|
|
176
|
+
cubes: Cube[];
|
|
177
|
+
/** Optional logger */
|
|
178
|
+
logger?: Logger;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Memory-Based Analytics Service
|
|
182
|
+
*
|
|
183
|
+
* Implements IAnalyticsService using InMemoryDriver's aggregation capabilities.
|
|
184
|
+
* Provides a semantic layer (Cubes, Metrics, Dimensions) on top of in-memory data.
|
|
185
|
+
*
|
|
186
|
+
* Features:
|
|
187
|
+
* - Cube-based semantic modeling
|
|
188
|
+
* - Measure calculations (count, sum, avg, min, max, count_distinct)
|
|
189
|
+
* - Dimension grouping
|
|
190
|
+
* - Filter support
|
|
191
|
+
* - Time dimension handling
|
|
192
|
+
* - SQL generation (for debugging/transparency)
|
|
193
|
+
*
|
|
194
|
+
* This implementation is suitable for:
|
|
195
|
+
* - Development and testing
|
|
196
|
+
* - Local-first analytics
|
|
197
|
+
* - Small to medium datasets
|
|
198
|
+
* - Prototyping BI applications
|
|
199
|
+
*/
|
|
200
|
+
declare class MemoryAnalyticsService implements IAnalyticsService {
|
|
201
|
+
private driver;
|
|
202
|
+
private cubes;
|
|
203
|
+
private logger;
|
|
204
|
+
constructor(config: MemoryAnalyticsConfig);
|
|
205
|
+
/**
|
|
206
|
+
* Execute an analytical query using the memory driver's aggregation pipeline
|
|
207
|
+
*/
|
|
208
|
+
query(query: AnalyticsQuery): Promise<AnalyticsResult>;
|
|
209
|
+
/**
|
|
210
|
+
* Get available cube metadata for discovery
|
|
211
|
+
*/
|
|
212
|
+
getMeta(cubeName?: string): Promise<CubeMeta[]>;
|
|
213
|
+
/**
|
|
214
|
+
* Generate SQL representation for debugging/transparency
|
|
215
|
+
*/
|
|
216
|
+
generateSql(query: AnalyticsQuery): Promise<{
|
|
217
|
+
sql: string;
|
|
218
|
+
params: unknown[];
|
|
219
|
+
}>;
|
|
220
|
+
private resolveFieldPath;
|
|
221
|
+
private resolveMeasure;
|
|
222
|
+
private resolveDimension;
|
|
223
|
+
private getShortName;
|
|
224
|
+
private buildAggregator;
|
|
225
|
+
private measureTypeToFieldType;
|
|
226
|
+
private convertOperatorToMongo;
|
|
227
|
+
private operatorToSql;
|
|
228
|
+
private measureToSql;
|
|
229
|
+
private extractTableName;
|
|
230
|
+
private parseDateRangeString;
|
|
231
|
+
private generateSqlFromPipeline;
|
|
232
|
+
}
|
|
233
|
+
|
|
81
234
|
declare const _default: {
|
|
82
235
|
id: string;
|
|
83
236
|
version: string;
|
|
84
237
|
onEnable: (context: any) => Promise<void>;
|
|
85
238
|
};
|
|
86
239
|
|
|
87
|
-
export { InMemoryDriver, _default as default };
|
|
240
|
+
export { InMemoryDriver, type InMemoryDriverConfig, type MemoryAnalyticsConfig, MemoryAnalyticsService, _default as default };
|