@objectstack/driver-memory 3.2.9 → 3.3.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 +7 -0
- package/dist/index.d.mts +54 -20
- package/dist/index.d.ts +54 -20
- package/dist/index.js +62 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/in-memory-strategy.ts +47 -0
- package/src/index.ts +2 -0
- package/src/memory-driver.ts +40 -15
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/driver-memory@3.
|
|
2
|
+
> @objectstack/driver-memory@3.3.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[32m54.07 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m107.73 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 179ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m55.80 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m107.79 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 182ms
|
|
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 17342ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m15.57 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m15.57 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { QueryAST, DriverOptions, QueryInput, Cube, AnalyticsQuery } from '@objectstack/spec/data';
|
|
2
|
+
import { IDataDriver, IAnalyticsService, AnalyticsResult, CubeMeta, AnalyticsStrategy, AnalyticsQuery as AnalyticsQuery$1, StrategyContext } from '@objectstack/spec/contracts';
|
|
3
|
+
import { Logger } from '@objectstack/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Persistence adapter interface.
|
|
@@ -65,10 +65,10 @@ interface InMemoryDriverConfig {
|
|
|
65
65
|
*
|
|
66
66
|
* Reference: objectql/packages/drivers/memory
|
|
67
67
|
*/
|
|
68
|
-
declare class InMemoryDriver implements
|
|
69
|
-
name
|
|
68
|
+
declare class InMemoryDriver implements IDataDriver {
|
|
69
|
+
readonly name = "com.objectstack.driver.memory";
|
|
70
70
|
type: string;
|
|
71
|
-
version
|
|
71
|
+
readonly version = "1.0.0";
|
|
72
72
|
private config;
|
|
73
73
|
private logger;
|
|
74
74
|
private idCounters;
|
|
@@ -76,20 +76,37 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
76
76
|
private persistenceAdapter;
|
|
77
77
|
constructor(config?: InMemoryDriverConfig);
|
|
78
78
|
install(ctx: any): void;
|
|
79
|
-
supports: {
|
|
79
|
+
readonly supports: {
|
|
80
|
+
create: boolean;
|
|
81
|
+
read: boolean;
|
|
82
|
+
update: boolean;
|
|
83
|
+
delete: boolean;
|
|
84
|
+
bulkCreate: boolean;
|
|
85
|
+
bulkUpdate: boolean;
|
|
86
|
+
bulkDelete: boolean;
|
|
80
87
|
transactions: boolean;
|
|
88
|
+
savepoints: boolean;
|
|
81
89
|
queryFilters: boolean;
|
|
82
90
|
queryAggregations: boolean;
|
|
83
91
|
querySorting: boolean;
|
|
84
92
|
queryPagination: boolean;
|
|
85
93
|
queryWindowFunctions: boolean;
|
|
86
94
|
querySubqueries: boolean;
|
|
95
|
+
queryCTE: boolean;
|
|
87
96
|
joins: boolean;
|
|
88
97
|
fullTextSearch: boolean;
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
jsonQuery: boolean;
|
|
99
|
+
geospatialQuery: boolean;
|
|
100
|
+
streaming: boolean;
|
|
91
101
|
jsonFields: boolean;
|
|
92
102
|
arrayFields: boolean;
|
|
103
|
+
vectorSearch: boolean;
|
|
104
|
+
schemaSync: boolean;
|
|
105
|
+
migrations: boolean;
|
|
106
|
+
indexes: boolean;
|
|
107
|
+
connectionPooling: boolean;
|
|
108
|
+
preparedStatements: boolean;
|
|
109
|
+
queryCache: boolean;
|
|
93
110
|
};
|
|
94
111
|
/**
|
|
95
112
|
* The "Database": A map of TableName -> Array of Records
|
|
@@ -99,9 +116,9 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
99
116
|
disconnect(): Promise<void>;
|
|
100
117
|
checkHealth(): Promise<boolean>;
|
|
101
118
|
execute(command: any, params?: any[]): Promise<null>;
|
|
102
|
-
find(object: string, query:
|
|
103
|
-
findStream(object: string, query:
|
|
104
|
-
findOne(object: string, query:
|
|
119
|
+
find(object: string, query: QueryAST, options?: DriverOptions): Promise<any[]>;
|
|
120
|
+
findStream(object: string, query: QueryAST, options?: DriverOptions): AsyncGenerator<any, void, unknown>;
|
|
121
|
+
findOne(object: string, query: QueryAST, options?: DriverOptions): Promise<any>;
|
|
105
122
|
create(object: string, data: Record<string, any>, options?: DriverOptions): Promise<{
|
|
106
123
|
created_at: any;
|
|
107
124
|
updated_at: any;
|
|
@@ -110,18 +127,14 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
110
127
|
update(object: string, id: string | number, data: Record<string, any>, options?: DriverOptions): Promise<any>;
|
|
111
128
|
upsert(object: string, data: Record<string, any>, conflictKeys?: string[], options?: DriverOptions): Promise<any>;
|
|
112
129
|
delete(object: string, id: string | number, options?: DriverOptions): Promise<boolean>;
|
|
113
|
-
count(object: string, query?:
|
|
130
|
+
count(object: string, query?: QueryAST, options?: DriverOptions): Promise<number>;
|
|
114
131
|
bulkCreate(object: string, dataArray: Record<string, any>[], options?: DriverOptions): Promise<{
|
|
115
132
|
created_at: any;
|
|
116
133
|
updated_at: any;
|
|
117
134
|
id: any;
|
|
118
135
|
}[]>;
|
|
119
|
-
updateMany(object: string, query:
|
|
120
|
-
|
|
121
|
-
}>;
|
|
122
|
-
deleteMany(object: string, query: QueryInput, options?: DriverOptions): Promise<{
|
|
123
|
-
count: number;
|
|
124
|
-
}>;
|
|
136
|
+
updateMany(object: string, query: QueryAST, data: Record<string, any>, options?: DriverOptions): Promise<number>;
|
|
137
|
+
deleteMany(object: string, query: QueryAST, options?: DriverOptions): Promise<number>;
|
|
125
138
|
bulkUpdate(object: string, updates: {
|
|
126
139
|
id: string | number;
|
|
127
140
|
data: Record<string, any>;
|
|
@@ -393,10 +406,31 @@ declare class MemoryAnalyticsService implements IAnalyticsService {
|
|
|
393
406
|
private generateSqlFromPipeline;
|
|
394
407
|
}
|
|
395
408
|
|
|
409
|
+
/**
|
|
410
|
+
* InMemoryStrategy — Priority 3
|
|
411
|
+
*
|
|
412
|
+
* Delegates to an existing `IAnalyticsService` instance that was registered
|
|
413
|
+
* as a fallback (typically `MemoryAnalyticsService` from this package).
|
|
414
|
+
*
|
|
415
|
+
* This is the lowest-priority strategy, used in:
|
|
416
|
+
* - `dev` / `test` environments
|
|
417
|
+
* - Any runtime where the backing driver is in-memory
|
|
418
|
+
*/
|
|
419
|
+
declare class InMemoryStrategy implements AnalyticsStrategy {
|
|
420
|
+
readonly name = "InMemoryStrategy";
|
|
421
|
+
readonly priority = 30;
|
|
422
|
+
canHandle(query: AnalyticsQuery$1, ctx: StrategyContext): boolean;
|
|
423
|
+
execute(query: AnalyticsQuery$1, ctx: StrategyContext): Promise<AnalyticsResult>;
|
|
424
|
+
generateSql(query: AnalyticsQuery$1, ctx: StrategyContext): Promise<{
|
|
425
|
+
sql: string;
|
|
426
|
+
params: unknown[];
|
|
427
|
+
}>;
|
|
428
|
+
}
|
|
429
|
+
|
|
396
430
|
declare const _default: {
|
|
397
431
|
id: string;
|
|
398
432
|
version: string;
|
|
399
433
|
onEnable: (context: any) => Promise<void>;
|
|
400
434
|
};
|
|
401
435
|
|
|
402
|
-
export { FileSystemPersistenceAdapter, InMemoryDriver, type InMemoryDriverConfig, LocalStoragePersistenceAdapter, type MemoryAnalyticsConfig, MemoryAnalyticsService, type PersistenceAdapterInterface, _default as default };
|
|
436
|
+
export { FileSystemPersistenceAdapter, InMemoryDriver, type InMemoryDriverConfig, InMemoryStrategy, LocalStoragePersistenceAdapter, type MemoryAnalyticsConfig, MemoryAnalyticsService, type PersistenceAdapterInterface, _default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { QueryAST, DriverOptions, QueryInput, Cube, AnalyticsQuery } from '@objectstack/spec/data';
|
|
2
|
+
import { IDataDriver, IAnalyticsService, AnalyticsResult, CubeMeta, AnalyticsStrategy, AnalyticsQuery as AnalyticsQuery$1, StrategyContext } from '@objectstack/spec/contracts';
|
|
3
|
+
import { Logger } from '@objectstack/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Persistence adapter interface.
|
|
@@ -65,10 +65,10 @@ interface InMemoryDriverConfig {
|
|
|
65
65
|
*
|
|
66
66
|
* Reference: objectql/packages/drivers/memory
|
|
67
67
|
*/
|
|
68
|
-
declare class InMemoryDriver implements
|
|
69
|
-
name
|
|
68
|
+
declare class InMemoryDriver implements IDataDriver {
|
|
69
|
+
readonly name = "com.objectstack.driver.memory";
|
|
70
70
|
type: string;
|
|
71
|
-
version
|
|
71
|
+
readonly version = "1.0.0";
|
|
72
72
|
private config;
|
|
73
73
|
private logger;
|
|
74
74
|
private idCounters;
|
|
@@ -76,20 +76,37 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
76
76
|
private persistenceAdapter;
|
|
77
77
|
constructor(config?: InMemoryDriverConfig);
|
|
78
78
|
install(ctx: any): void;
|
|
79
|
-
supports: {
|
|
79
|
+
readonly supports: {
|
|
80
|
+
create: boolean;
|
|
81
|
+
read: boolean;
|
|
82
|
+
update: boolean;
|
|
83
|
+
delete: boolean;
|
|
84
|
+
bulkCreate: boolean;
|
|
85
|
+
bulkUpdate: boolean;
|
|
86
|
+
bulkDelete: boolean;
|
|
80
87
|
transactions: boolean;
|
|
88
|
+
savepoints: boolean;
|
|
81
89
|
queryFilters: boolean;
|
|
82
90
|
queryAggregations: boolean;
|
|
83
91
|
querySorting: boolean;
|
|
84
92
|
queryPagination: boolean;
|
|
85
93
|
queryWindowFunctions: boolean;
|
|
86
94
|
querySubqueries: boolean;
|
|
95
|
+
queryCTE: boolean;
|
|
87
96
|
joins: boolean;
|
|
88
97
|
fullTextSearch: boolean;
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
jsonQuery: boolean;
|
|
99
|
+
geospatialQuery: boolean;
|
|
100
|
+
streaming: boolean;
|
|
91
101
|
jsonFields: boolean;
|
|
92
102
|
arrayFields: boolean;
|
|
103
|
+
vectorSearch: boolean;
|
|
104
|
+
schemaSync: boolean;
|
|
105
|
+
migrations: boolean;
|
|
106
|
+
indexes: boolean;
|
|
107
|
+
connectionPooling: boolean;
|
|
108
|
+
preparedStatements: boolean;
|
|
109
|
+
queryCache: boolean;
|
|
93
110
|
};
|
|
94
111
|
/**
|
|
95
112
|
* The "Database": A map of TableName -> Array of Records
|
|
@@ -99,9 +116,9 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
99
116
|
disconnect(): Promise<void>;
|
|
100
117
|
checkHealth(): Promise<boolean>;
|
|
101
118
|
execute(command: any, params?: any[]): Promise<null>;
|
|
102
|
-
find(object: string, query:
|
|
103
|
-
findStream(object: string, query:
|
|
104
|
-
findOne(object: string, query:
|
|
119
|
+
find(object: string, query: QueryAST, options?: DriverOptions): Promise<any[]>;
|
|
120
|
+
findStream(object: string, query: QueryAST, options?: DriverOptions): AsyncGenerator<any, void, unknown>;
|
|
121
|
+
findOne(object: string, query: QueryAST, options?: DriverOptions): Promise<any>;
|
|
105
122
|
create(object: string, data: Record<string, any>, options?: DriverOptions): Promise<{
|
|
106
123
|
created_at: any;
|
|
107
124
|
updated_at: any;
|
|
@@ -110,18 +127,14 @@ declare class InMemoryDriver implements DriverInterface {
|
|
|
110
127
|
update(object: string, id: string | number, data: Record<string, any>, options?: DriverOptions): Promise<any>;
|
|
111
128
|
upsert(object: string, data: Record<string, any>, conflictKeys?: string[], options?: DriverOptions): Promise<any>;
|
|
112
129
|
delete(object: string, id: string | number, options?: DriverOptions): Promise<boolean>;
|
|
113
|
-
count(object: string, query?:
|
|
130
|
+
count(object: string, query?: QueryAST, options?: DriverOptions): Promise<number>;
|
|
114
131
|
bulkCreate(object: string, dataArray: Record<string, any>[], options?: DriverOptions): Promise<{
|
|
115
132
|
created_at: any;
|
|
116
133
|
updated_at: any;
|
|
117
134
|
id: any;
|
|
118
135
|
}[]>;
|
|
119
|
-
updateMany(object: string, query:
|
|
120
|
-
|
|
121
|
-
}>;
|
|
122
|
-
deleteMany(object: string, query: QueryInput, options?: DriverOptions): Promise<{
|
|
123
|
-
count: number;
|
|
124
|
-
}>;
|
|
136
|
+
updateMany(object: string, query: QueryAST, data: Record<string, any>, options?: DriverOptions): Promise<number>;
|
|
137
|
+
deleteMany(object: string, query: QueryAST, options?: DriverOptions): Promise<number>;
|
|
125
138
|
bulkUpdate(object: string, updates: {
|
|
126
139
|
id: string | number;
|
|
127
140
|
data: Record<string, any>;
|
|
@@ -393,10 +406,31 @@ declare class MemoryAnalyticsService implements IAnalyticsService {
|
|
|
393
406
|
private generateSqlFromPipeline;
|
|
394
407
|
}
|
|
395
408
|
|
|
409
|
+
/**
|
|
410
|
+
* InMemoryStrategy — Priority 3
|
|
411
|
+
*
|
|
412
|
+
* Delegates to an existing `IAnalyticsService` instance that was registered
|
|
413
|
+
* as a fallback (typically `MemoryAnalyticsService` from this package).
|
|
414
|
+
*
|
|
415
|
+
* This is the lowest-priority strategy, used in:
|
|
416
|
+
* - `dev` / `test` environments
|
|
417
|
+
* - Any runtime where the backing driver is in-memory
|
|
418
|
+
*/
|
|
419
|
+
declare class InMemoryStrategy implements AnalyticsStrategy {
|
|
420
|
+
readonly name = "InMemoryStrategy";
|
|
421
|
+
readonly priority = 30;
|
|
422
|
+
canHandle(query: AnalyticsQuery$1, ctx: StrategyContext): boolean;
|
|
423
|
+
execute(query: AnalyticsQuery$1, ctx: StrategyContext): Promise<AnalyticsResult>;
|
|
424
|
+
generateSql(query: AnalyticsQuery$1, ctx: StrategyContext): Promise<{
|
|
425
|
+
sql: string;
|
|
426
|
+
params: unknown[];
|
|
427
|
+
}>;
|
|
428
|
+
}
|
|
429
|
+
|
|
396
430
|
declare const _default: {
|
|
397
431
|
id: string;
|
|
398
432
|
version: string;
|
|
399
433
|
onEnable: (context: any) => Promise<void>;
|
|
400
434
|
};
|
|
401
435
|
|
|
402
|
-
export { FileSystemPersistenceAdapter, InMemoryDriver, type InMemoryDriverConfig, LocalStoragePersistenceAdapter, type MemoryAnalyticsConfig, MemoryAnalyticsService, type PersistenceAdapterInterface, _default as default };
|
|
436
|
+
export { FileSystemPersistenceAdapter, InMemoryDriver, type InMemoryDriverConfig, InMemoryStrategy, LocalStoragePersistenceAdapter, type MemoryAnalyticsConfig, MemoryAnalyticsService, type PersistenceAdapterInterface, _default as default };
|
package/dist/index.js
CHANGED
|
@@ -182,6 +182,7 @@ var index_exports = {};
|
|
|
182
182
|
__export(index_exports, {
|
|
183
183
|
FileSystemPersistenceAdapter: () => FileSystemPersistenceAdapter,
|
|
184
184
|
InMemoryDriver: () => InMemoryDriver,
|
|
185
|
+
InMemoryStrategy: () => InMemoryStrategy,
|
|
185
186
|
LocalStoragePersistenceAdapter: () => LocalStoragePersistenceAdapter,
|
|
186
187
|
MemoryAnalyticsService: () => MemoryAnalyticsService,
|
|
187
188
|
default: () => index_default
|
|
@@ -208,9 +209,19 @@ var _InMemoryDriver = class _InMemoryDriver {
|
|
|
208
209
|
this.transactions = /* @__PURE__ */ new Map();
|
|
209
210
|
this.persistenceAdapter = null;
|
|
210
211
|
this.supports = {
|
|
212
|
+
// Basic CRUD Operations
|
|
213
|
+
create: true,
|
|
214
|
+
read: true,
|
|
215
|
+
update: true,
|
|
216
|
+
delete: true,
|
|
217
|
+
// Bulk Operations
|
|
218
|
+
bulkCreate: true,
|
|
219
|
+
bulkUpdate: true,
|
|
220
|
+
bulkDelete: true,
|
|
211
221
|
// Transaction & Connection Management
|
|
212
222
|
transactions: true,
|
|
213
223
|
// Snapshot-based transactions
|
|
224
|
+
savepoints: false,
|
|
214
225
|
// Query Operations
|
|
215
226
|
queryFilters: true,
|
|
216
227
|
// Implemented via memory-matcher
|
|
@@ -224,19 +235,31 @@ var _InMemoryDriver = class _InMemoryDriver {
|
|
|
224
235
|
// @planned: Window functions (ROW_NUMBER, RANK, etc.)
|
|
225
236
|
querySubqueries: false,
|
|
226
237
|
// @planned: Subquery execution
|
|
238
|
+
queryCTE: false,
|
|
227
239
|
joins: false,
|
|
228
240
|
// @planned: In-memory join operations
|
|
229
241
|
// Advanced Features
|
|
230
242
|
fullTextSearch: false,
|
|
231
243
|
// @planned: Text tokenization + matching
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
//
|
|
244
|
+
jsonQuery: false,
|
|
245
|
+
geospatialQuery: false,
|
|
246
|
+
streaming: true,
|
|
247
|
+
// Implemented via findStream()
|
|
236
248
|
jsonFields: true,
|
|
237
249
|
// Native JS object support
|
|
238
|
-
arrayFields: true
|
|
250
|
+
arrayFields: true,
|
|
239
251
|
// Native JS array support
|
|
252
|
+
vectorSearch: false,
|
|
253
|
+
// @planned: Cosine similarity search
|
|
254
|
+
// Schema Management
|
|
255
|
+
schemaSync: true,
|
|
256
|
+
// Implemented via syncSchema()
|
|
257
|
+
migrations: false,
|
|
258
|
+
indexes: false,
|
|
259
|
+
// Performance & Optimization
|
|
260
|
+
connectionPooling: false,
|
|
261
|
+
preparedStatements: false,
|
|
262
|
+
queryCache: false
|
|
240
263
|
};
|
|
241
264
|
/**
|
|
242
265
|
* The "Database": A map of TableName -> Array of Records
|
|
@@ -498,7 +521,7 @@ var _InMemoryDriver = class _InMemoryDriver {
|
|
|
498
521
|
}
|
|
499
522
|
if (count > 0) this.markDirty();
|
|
500
523
|
this.logger.debug("UpdateMany completed", { object, count });
|
|
501
|
-
return
|
|
524
|
+
return count;
|
|
502
525
|
}
|
|
503
526
|
async deleteMany(object, query, options) {
|
|
504
527
|
this.logger.debug("DeleteMany operation", { object, query });
|
|
@@ -520,7 +543,7 @@ var _InMemoryDriver = class _InMemoryDriver {
|
|
|
520
543
|
const count = initialLength - this.db[object].length;
|
|
521
544
|
if (count > 0) this.markDirty();
|
|
522
545
|
this.logger.debug("DeleteMany completed", { object, count });
|
|
523
|
-
return
|
|
546
|
+
return count;
|
|
524
547
|
}
|
|
525
548
|
// Compatibility aliases
|
|
526
549
|
async bulkUpdate(object, updates, options) {
|
|
@@ -1523,6 +1546,37 @@ ${stages}`;
|
|
|
1523
1546
|
}
|
|
1524
1547
|
};
|
|
1525
1548
|
|
|
1549
|
+
// src/in-memory-strategy.ts
|
|
1550
|
+
var InMemoryStrategy = class {
|
|
1551
|
+
constructor() {
|
|
1552
|
+
this.name = "InMemoryStrategy";
|
|
1553
|
+
this.priority = 30;
|
|
1554
|
+
}
|
|
1555
|
+
canHandle(query, ctx) {
|
|
1556
|
+
if (!query.cube) return false;
|
|
1557
|
+
if (ctx.fallbackService) return true;
|
|
1558
|
+
const caps = ctx.queryCapabilities(query.cube);
|
|
1559
|
+
return caps.inMemory;
|
|
1560
|
+
}
|
|
1561
|
+
async execute(query, ctx) {
|
|
1562
|
+
if (!ctx.fallbackService) {
|
|
1563
|
+
throw new Error(
|
|
1564
|
+
`[InMemoryStrategy] No fallback analytics service available for cube "${query.cube}". Register a MemoryAnalyticsService or configure a driver with analytics support.`
|
|
1565
|
+
);
|
|
1566
|
+
}
|
|
1567
|
+
return ctx.fallbackService.query(query);
|
|
1568
|
+
}
|
|
1569
|
+
async generateSql(query, ctx) {
|
|
1570
|
+
if (ctx.fallbackService?.generateSql) {
|
|
1571
|
+
return ctx.fallbackService.generateSql(query);
|
|
1572
|
+
}
|
|
1573
|
+
return {
|
|
1574
|
+
sql: `-- InMemoryStrategy: SQL generation not supported for cube "${query.cube}"`,
|
|
1575
|
+
params: []
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1526
1580
|
// src/index.ts
|
|
1527
1581
|
var index_default = {
|
|
1528
1582
|
id: "com.objectstack.driver.memory",
|
|
@@ -1543,6 +1597,7 @@ var index_default = {
|
|
|
1543
1597
|
0 && (module.exports = {
|
|
1544
1598
|
FileSystemPersistenceAdapter,
|
|
1545
1599
|
InMemoryDriver,
|
|
1600
|
+
InMemoryStrategy,
|
|
1546
1601
|
LocalStoragePersistenceAdapter,
|
|
1547
1602
|
MemoryAnalyticsService
|
|
1548
1603
|
});
|