@objectstack/driver-memory 3.2.9 → 3.3.1

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/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,32 @@ 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
- vectorSearch: false,
200
- // @planned: Cosine similarity search
201
- geoSpatial: false,
202
- // @planned: Distance/within calculations
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
+ batchSchemaSync: false,
224
+ migrations: false,
225
+ indexes: false,
226
+ // Performance & Optimization
227
+ connectionPooling: false,
228
+ preparedStatements: false,
229
+ queryCache: false
207
230
  };
208
231
  /**
209
232
  * The "Database": A map of TableName -> Array of Records
@@ -465,7 +488,7 @@ var _InMemoryDriver = class _InMemoryDriver {
465
488
  }
466
489
  if (count > 0) this.markDirty();
467
490
  this.logger.debug("UpdateMany completed", { object, count });
468
- return { count };
491
+ return count;
469
492
  }
470
493
  async deleteMany(object, query, options) {
471
494
  this.logger.debug("DeleteMany operation", { object, query });
@@ -487,7 +510,7 @@ var _InMemoryDriver = class _InMemoryDriver {
487
510
  const count = initialLength - this.db[object].length;
488
511
  if (count > 0) this.markDirty();
489
512
  this.logger.debug("DeleteMany completed", { object, count });
490
- return { count };
513
+ return count;
491
514
  }
492
515
  // Compatibility aliases
493
516
  async bulkUpdate(object, updates, options) {
@@ -1490,6 +1513,37 @@ ${stages}`;
1490
1513
  }
1491
1514
  };
1492
1515
 
1516
+ // src/in-memory-strategy.ts
1517
+ var InMemoryStrategy = class {
1518
+ constructor() {
1519
+ this.name = "InMemoryStrategy";
1520
+ this.priority = 30;
1521
+ }
1522
+ canHandle(query, ctx) {
1523
+ if (!query.cube) return false;
1524
+ if (ctx.fallbackService) return true;
1525
+ const caps = ctx.queryCapabilities(query.cube);
1526
+ return caps.inMemory;
1527
+ }
1528
+ async execute(query, ctx) {
1529
+ if (!ctx.fallbackService) {
1530
+ throw new Error(
1531
+ `[InMemoryStrategy] No fallback analytics service available for cube "${query.cube}". Register a MemoryAnalyticsService or configure a driver with analytics support.`
1532
+ );
1533
+ }
1534
+ return ctx.fallbackService.query(query);
1535
+ }
1536
+ async generateSql(query, ctx) {
1537
+ if (ctx.fallbackService?.generateSql) {
1538
+ return ctx.fallbackService.generateSql(query);
1539
+ }
1540
+ return {
1541
+ sql: `-- InMemoryStrategy: SQL generation not supported for cube "${query.cube}"`,
1542
+ params: []
1543
+ };
1544
+ }
1545
+ };
1546
+
1493
1547
  // src/index.ts
1494
1548
  var index_default = {
1495
1549
  id: "com.objectstack.driver.memory",
@@ -1509,6 +1563,7 @@ var index_default = {
1509
1563
  export {
1510
1564
  FileSystemPersistenceAdapter,
1511
1565
  InMemoryDriver,
1566
+ InMemoryStrategy,
1512
1567
  LocalStoragePersistenceAdapter,
1513
1568
  MemoryAnalyticsService,
1514
1569
  index_default as default