@objectstack/driver-memory 3.2.8 → 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 +14 -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/dist/index.mjs
CHANGED
|
@@ -175,9 +175,19 @@ var _InMemoryDriver = class _InMemoryDriver {
|
|
|
175
175
|
this.transactions = /* @__PURE__ */ new Map();
|
|
176
176
|
this.persistenceAdapter = null;
|
|
177
177
|
this.supports = {
|
|
178
|
+
// Basic CRUD Operations
|
|
179
|
+
create: true,
|
|
180
|
+
read: true,
|
|
181
|
+
update: true,
|
|
182
|
+
delete: true,
|
|
183
|
+
// Bulk Operations
|
|
184
|
+
bulkCreate: true,
|
|
185
|
+
bulkUpdate: true,
|
|
186
|
+
bulkDelete: true,
|
|
178
187
|
// Transaction & Connection Management
|
|
179
188
|
transactions: true,
|
|
180
189
|
// Snapshot-based transactions
|
|
190
|
+
savepoints: false,
|
|
181
191
|
// Query Operations
|
|
182
192
|
queryFilters: true,
|
|
183
193
|
// Implemented via memory-matcher
|
|
@@ -191,19 +201,31 @@ var _InMemoryDriver = class _InMemoryDriver {
|
|
|
191
201
|
// @planned: Window functions (ROW_NUMBER, RANK, etc.)
|
|
192
202
|
querySubqueries: false,
|
|
193
203
|
// @planned: Subquery execution
|
|
204
|
+
queryCTE: false,
|
|
194
205
|
joins: false,
|
|
195
206
|
// @planned: In-memory join operations
|
|
196
207
|
// Advanced Features
|
|
197
208
|
fullTextSearch: false,
|
|
198
209
|
// @planned: Text tokenization + matching
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
//
|
|
210
|
+
jsonQuery: false,
|
|
211
|
+
geospatialQuery: false,
|
|
212
|
+
streaming: true,
|
|
213
|
+
// Implemented via findStream()
|
|
203
214
|
jsonFields: true,
|
|
204
215
|
// Native JS object support
|
|
205
|
-
arrayFields: true
|
|
216
|
+
arrayFields: true,
|
|
206
217
|
// Native JS array support
|
|
218
|
+
vectorSearch: false,
|
|
219
|
+
// @planned: Cosine similarity search
|
|
220
|
+
// Schema Management
|
|
221
|
+
schemaSync: true,
|
|
222
|
+
// Implemented via syncSchema()
|
|
223
|
+
migrations: false,
|
|
224
|
+
indexes: false,
|
|
225
|
+
// Performance & Optimization
|
|
226
|
+
connectionPooling: false,
|
|
227
|
+
preparedStatements: false,
|
|
228
|
+
queryCache: false
|
|
207
229
|
};
|
|
208
230
|
/**
|
|
209
231
|
* The "Database": A map of TableName -> Array of Records
|
|
@@ -465,7 +487,7 @@ var _InMemoryDriver = class _InMemoryDriver {
|
|
|
465
487
|
}
|
|
466
488
|
if (count > 0) this.markDirty();
|
|
467
489
|
this.logger.debug("UpdateMany completed", { object, count });
|
|
468
|
-
return
|
|
490
|
+
return count;
|
|
469
491
|
}
|
|
470
492
|
async deleteMany(object, query, options) {
|
|
471
493
|
this.logger.debug("DeleteMany operation", { object, query });
|
|
@@ -487,7 +509,7 @@ var _InMemoryDriver = class _InMemoryDriver {
|
|
|
487
509
|
const count = initialLength - this.db[object].length;
|
|
488
510
|
if (count > 0) this.markDirty();
|
|
489
511
|
this.logger.debug("DeleteMany completed", { object, count });
|
|
490
|
-
return
|
|
512
|
+
return count;
|
|
491
513
|
}
|
|
492
514
|
// Compatibility aliases
|
|
493
515
|
async bulkUpdate(object, updates, options) {
|
|
@@ -1490,6 +1512,37 @@ ${stages}`;
|
|
|
1490
1512
|
}
|
|
1491
1513
|
};
|
|
1492
1514
|
|
|
1515
|
+
// src/in-memory-strategy.ts
|
|
1516
|
+
var InMemoryStrategy = class {
|
|
1517
|
+
constructor() {
|
|
1518
|
+
this.name = "InMemoryStrategy";
|
|
1519
|
+
this.priority = 30;
|
|
1520
|
+
}
|
|
1521
|
+
canHandle(query, ctx) {
|
|
1522
|
+
if (!query.cube) return false;
|
|
1523
|
+
if (ctx.fallbackService) return true;
|
|
1524
|
+
const caps = ctx.queryCapabilities(query.cube);
|
|
1525
|
+
return caps.inMemory;
|
|
1526
|
+
}
|
|
1527
|
+
async execute(query, ctx) {
|
|
1528
|
+
if (!ctx.fallbackService) {
|
|
1529
|
+
throw new Error(
|
|
1530
|
+
`[InMemoryStrategy] No fallback analytics service available for cube "${query.cube}". Register a MemoryAnalyticsService or configure a driver with analytics support.`
|
|
1531
|
+
);
|
|
1532
|
+
}
|
|
1533
|
+
return ctx.fallbackService.query(query);
|
|
1534
|
+
}
|
|
1535
|
+
async generateSql(query, ctx) {
|
|
1536
|
+
if (ctx.fallbackService?.generateSql) {
|
|
1537
|
+
return ctx.fallbackService.generateSql(query);
|
|
1538
|
+
}
|
|
1539
|
+
return {
|
|
1540
|
+
sql: `-- InMemoryStrategy: SQL generation not supported for cube "${query.cube}"`,
|
|
1541
|
+
params: []
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
|
|
1493
1546
|
// src/index.ts
|
|
1494
1547
|
var index_default = {
|
|
1495
1548
|
id: "com.objectstack.driver.memory",
|
|
@@ -1509,6 +1562,7 @@ var index_default = {
|
|
|
1509
1562
|
export {
|
|
1510
1563
|
FileSystemPersistenceAdapter,
|
|
1511
1564
|
InMemoryDriver,
|
|
1565
|
+
InMemoryStrategy,
|
|
1512
1566
|
LocalStoragePersistenceAdapter,
|
|
1513
1567
|
MemoryAnalyticsService,
|
|
1514
1568
|
index_default as default
|