@objectstack/driver-memory 1.0.2 → 1.0.5
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 +22 -0
- package/CHANGELOG.md +28 -0
- package/dist/{memory-driver.d.ts → index.d.mts} +11 -4
- package/dist/index.d.ts +81 -4
- package/dist/index.js +530 -23
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +507 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/memory-driver.d.ts.map +0 -1
- package/dist/memory-driver.js +0 -404
- package/dist/memory-driver.test.d.ts +0 -2
- package/dist/memory-driver.test.d.ts.map +0 -1
- package/dist/memory-driver.test.js +0 -93
- package/dist/memory-matcher.d.ts +0 -19
- package/dist/memory-matcher.d.ts.map +0 -1
- package/dist/memory-matcher.js +0 -160
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
// src/memory-driver.ts
|
|
2
|
+
import { createLogger } from "@objectstack/core";
|
|
3
|
+
|
|
4
|
+
// src/memory-matcher.ts
|
|
5
|
+
function match(record, filter) {
|
|
6
|
+
if (!filter || Object.keys(filter).length === 0) return true;
|
|
7
|
+
if (Array.isArray(filter.$and)) {
|
|
8
|
+
if (!filter.$and.every((f) => match(record, f))) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(filter.$or)) {
|
|
13
|
+
if (!filter.$or.some((f) => match(record, f))) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (filter.$not) {
|
|
18
|
+
if (match(record, filter.$not)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
for (const key of Object.keys(filter)) {
|
|
23
|
+
if (key.startsWith("$")) continue;
|
|
24
|
+
const condition = filter[key];
|
|
25
|
+
const value = getValueByPath(record, key);
|
|
26
|
+
if (!checkCondition(value, condition)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
function getValueByPath(obj, path) {
|
|
33
|
+
if (!path.includes(".")) return obj[path];
|
|
34
|
+
return path.split(".").reduce((o, i) => o ? o[i] : void 0, obj);
|
|
35
|
+
}
|
|
36
|
+
function checkCondition(value, condition) {
|
|
37
|
+
if (typeof condition !== "object" || condition === null || condition instanceof Date || Array.isArray(condition)) {
|
|
38
|
+
return value == condition;
|
|
39
|
+
}
|
|
40
|
+
const keys = Object.keys(condition);
|
|
41
|
+
const isOperatorObject = keys.some((k) => k.startsWith("$"));
|
|
42
|
+
if (!isOperatorObject) {
|
|
43
|
+
return JSON.stringify(value) === JSON.stringify(condition);
|
|
44
|
+
}
|
|
45
|
+
for (const op of keys) {
|
|
46
|
+
const target = condition[op];
|
|
47
|
+
if (value === void 0 && op !== "$exists" && op !== "$ne") {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
switch (op) {
|
|
51
|
+
case "$eq":
|
|
52
|
+
if (value != target) return false;
|
|
53
|
+
break;
|
|
54
|
+
case "$ne":
|
|
55
|
+
if (value == target) return false;
|
|
56
|
+
break;
|
|
57
|
+
// Numeric / Date
|
|
58
|
+
case "$gt":
|
|
59
|
+
if (!(value > target)) return false;
|
|
60
|
+
break;
|
|
61
|
+
case "$gte":
|
|
62
|
+
if (!(value >= target)) return false;
|
|
63
|
+
break;
|
|
64
|
+
case "$lt":
|
|
65
|
+
if (!(value < target)) return false;
|
|
66
|
+
break;
|
|
67
|
+
case "$lte":
|
|
68
|
+
if (!(value <= target)) return false;
|
|
69
|
+
break;
|
|
70
|
+
case "$between":
|
|
71
|
+
if (Array.isArray(target) && (value < target[0] || value > target[1])) return false;
|
|
72
|
+
break;
|
|
73
|
+
// Sets
|
|
74
|
+
case "$in":
|
|
75
|
+
if (!Array.isArray(target) || !target.includes(value)) return false;
|
|
76
|
+
break;
|
|
77
|
+
case "$nin":
|
|
78
|
+
if (Array.isArray(target) && target.includes(value)) return false;
|
|
79
|
+
break;
|
|
80
|
+
// Existence
|
|
81
|
+
case "$exists":
|
|
82
|
+
const exists = value !== void 0 && value !== null;
|
|
83
|
+
if (exists !== !!target) return false;
|
|
84
|
+
break;
|
|
85
|
+
// Strings
|
|
86
|
+
case "$contains":
|
|
87
|
+
if (typeof value !== "string" || !value.includes(target)) return false;
|
|
88
|
+
break;
|
|
89
|
+
case "$startsWith":
|
|
90
|
+
if (typeof value !== "string" || !value.startsWith(target)) return false;
|
|
91
|
+
break;
|
|
92
|
+
case "$endsWith":
|
|
93
|
+
if (typeof value !== "string" || !value.endsWith(target)) return false;
|
|
94
|
+
break;
|
|
95
|
+
case "$regex":
|
|
96
|
+
try {
|
|
97
|
+
const re = new RegExp(target, condition.$options || "");
|
|
98
|
+
if (!re.test(String(value))) return false;
|
|
99
|
+
} catch (e) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
default:
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/memory-driver.ts
|
|
111
|
+
var InMemoryDriver = class {
|
|
112
|
+
constructor(config) {
|
|
113
|
+
this.name = "in-memory-driver";
|
|
114
|
+
this.version = "0.0.1";
|
|
115
|
+
this.supports = {
|
|
116
|
+
// Transaction & Connection Management
|
|
117
|
+
transactions: false,
|
|
118
|
+
// Query Operations
|
|
119
|
+
queryFilters: true,
|
|
120
|
+
// Implemented via memory-matcher
|
|
121
|
+
queryAggregations: true,
|
|
122
|
+
// Implemented
|
|
123
|
+
querySorting: true,
|
|
124
|
+
// Implemented via JS sort
|
|
125
|
+
queryPagination: true,
|
|
126
|
+
// Implemented
|
|
127
|
+
queryWindowFunctions: false,
|
|
128
|
+
// TODO: Not implemented
|
|
129
|
+
querySubqueries: false,
|
|
130
|
+
// TODO: Not implemented
|
|
131
|
+
joins: false,
|
|
132
|
+
// TODO: Not implemented
|
|
133
|
+
// Advanced Features
|
|
134
|
+
fullTextSearch: false,
|
|
135
|
+
// TODO: Not implemented
|
|
136
|
+
vectorSearch: false,
|
|
137
|
+
// TODO: Not implemented
|
|
138
|
+
geoSpatial: false,
|
|
139
|
+
// TODO: Not implemented
|
|
140
|
+
jsonFields: true,
|
|
141
|
+
// Native JS object support
|
|
142
|
+
arrayFields: true
|
|
143
|
+
// Native JS array support
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* The "Database": A map of TableName -> Array of Records
|
|
147
|
+
*/
|
|
148
|
+
this.db = {};
|
|
149
|
+
this.config = config || {};
|
|
150
|
+
this.logger = config?.logger || createLogger({ level: "info", format: "pretty" });
|
|
151
|
+
this.logger.debug("InMemory driver instance created", { config: this.config });
|
|
152
|
+
}
|
|
153
|
+
// Duck-typed RuntimePlugin hook
|
|
154
|
+
install(ctx) {
|
|
155
|
+
this.logger.debug("Installing InMemory driver via plugin hook");
|
|
156
|
+
if (ctx.engine && ctx.engine.ql && typeof ctx.engine.ql.registerDriver === "function") {
|
|
157
|
+
ctx.engine.ql.registerDriver(this);
|
|
158
|
+
this.logger.info("InMemory driver registered with ObjectQL engine");
|
|
159
|
+
} else {
|
|
160
|
+
this.logger.warn("Could not register driver - ObjectQL engine not found in context");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// ===================================
|
|
164
|
+
// Lifecycle
|
|
165
|
+
// ===================================
|
|
166
|
+
async connect() {
|
|
167
|
+
this.logger.info("InMemory Database Connected (Virtual)");
|
|
168
|
+
}
|
|
169
|
+
async disconnect() {
|
|
170
|
+
const tableCount = Object.keys(this.db).length;
|
|
171
|
+
const recordCount = Object.values(this.db).reduce((sum, table) => sum + table.length, 0);
|
|
172
|
+
this.db = {};
|
|
173
|
+
this.logger.info("InMemory Database Disconnected & Cleared", {
|
|
174
|
+
tableCount,
|
|
175
|
+
recordCount
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
async checkHealth() {
|
|
179
|
+
this.logger.debug("Health check performed", {
|
|
180
|
+
tableCount: Object.keys(this.db).length,
|
|
181
|
+
status: "healthy"
|
|
182
|
+
});
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
// ===================================
|
|
186
|
+
// Execution
|
|
187
|
+
// ===================================
|
|
188
|
+
async execute(command, params) {
|
|
189
|
+
this.logger.warn("Raw execution not supported in InMemory driver", { command });
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
// ===================================
|
|
193
|
+
// CRUD
|
|
194
|
+
// ===================================
|
|
195
|
+
async find(object, query, options) {
|
|
196
|
+
this.logger.debug("Find operation", { object, query });
|
|
197
|
+
const table = this.getTable(object);
|
|
198
|
+
let results = table;
|
|
199
|
+
if (query.where) {
|
|
200
|
+
results = results.filter((record) => match(record, query.where));
|
|
201
|
+
}
|
|
202
|
+
if (query.groupBy || query.aggregations && query.aggregations.length > 0) {
|
|
203
|
+
results = this.performAggregation(results, query);
|
|
204
|
+
}
|
|
205
|
+
if (query.orderBy) {
|
|
206
|
+
const sortFields = Array.isArray(query.orderBy) ? query.orderBy : [query.orderBy];
|
|
207
|
+
results.sort((a, b) => {
|
|
208
|
+
for (const { field, order } of sortFields) {
|
|
209
|
+
const valA = getValueByPath(a, field);
|
|
210
|
+
const valB = getValueByPath(b, field);
|
|
211
|
+
if (valA === valB) continue;
|
|
212
|
+
const comparison = valA > valB ? 1 : -1;
|
|
213
|
+
return order === "desc" ? -comparison : comparison;
|
|
214
|
+
}
|
|
215
|
+
return 0;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (query.offset) {
|
|
219
|
+
results = results.slice(query.offset);
|
|
220
|
+
}
|
|
221
|
+
if (query.limit) {
|
|
222
|
+
results = results.slice(0, query.limit);
|
|
223
|
+
}
|
|
224
|
+
this.logger.debug("Find completed", { object, resultCount: results.length });
|
|
225
|
+
return results;
|
|
226
|
+
}
|
|
227
|
+
async *findStream(object, query, options) {
|
|
228
|
+
this.logger.debug("FindStream operation", { object });
|
|
229
|
+
const results = await this.find(object, query, options);
|
|
230
|
+
for (const record of results) {
|
|
231
|
+
yield record;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async findOne(object, query, options) {
|
|
235
|
+
this.logger.debug("FindOne operation", { object, query });
|
|
236
|
+
const results = await this.find(object, { ...query, limit: 1 }, options);
|
|
237
|
+
const result = results[0] || null;
|
|
238
|
+
this.logger.debug("FindOne completed", { object, found: !!result });
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
async create(object, data, options) {
|
|
242
|
+
this.logger.debug("Create operation", { object, hasData: !!data });
|
|
243
|
+
const table = this.getTable(object);
|
|
244
|
+
const newRecord = {
|
|
245
|
+
id: data.id || this.generateId(),
|
|
246
|
+
...data,
|
|
247
|
+
created_at: data.created_at || /* @__PURE__ */ new Date(),
|
|
248
|
+
updated_at: data.updated_at || /* @__PURE__ */ new Date()
|
|
249
|
+
};
|
|
250
|
+
table.push(newRecord);
|
|
251
|
+
this.logger.debug("Record created", { object, id: newRecord.id, tableSize: table.length });
|
|
252
|
+
return newRecord;
|
|
253
|
+
}
|
|
254
|
+
async update(object, id, data, options) {
|
|
255
|
+
this.logger.debug("Update operation", { object, id });
|
|
256
|
+
const table = this.getTable(object);
|
|
257
|
+
const index = table.findIndex((r) => r.id == id);
|
|
258
|
+
if (index === -1) {
|
|
259
|
+
this.logger.warn("Record not found for update", { object, id });
|
|
260
|
+
throw new Error(`Record with ID ${id} not found in ${object}`);
|
|
261
|
+
}
|
|
262
|
+
const updatedRecord = {
|
|
263
|
+
...table[index],
|
|
264
|
+
...data,
|
|
265
|
+
updated_at: /* @__PURE__ */ new Date()
|
|
266
|
+
};
|
|
267
|
+
table[index] = updatedRecord;
|
|
268
|
+
this.logger.debug("Record updated", { object, id });
|
|
269
|
+
return updatedRecord;
|
|
270
|
+
}
|
|
271
|
+
async upsert(object, data, conflictKeys, options) {
|
|
272
|
+
this.logger.debug("Upsert operation", { object, conflictKeys });
|
|
273
|
+
const table = this.getTable(object);
|
|
274
|
+
let existingRecord = null;
|
|
275
|
+
if (data.id) {
|
|
276
|
+
existingRecord = table.find((r) => r.id === data.id);
|
|
277
|
+
} else if (conflictKeys && conflictKeys.length > 0) {
|
|
278
|
+
existingRecord = table.find((r) => conflictKeys.every((key) => r[key] === data[key]));
|
|
279
|
+
}
|
|
280
|
+
if (existingRecord) {
|
|
281
|
+
this.logger.debug("Record exists, updating", { object, id: existingRecord.id });
|
|
282
|
+
return this.update(object, existingRecord.id, data, options);
|
|
283
|
+
} else {
|
|
284
|
+
this.logger.debug("Record does not exist, creating", { object });
|
|
285
|
+
return this.create(object, data, options);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
async delete(object, id, options) {
|
|
289
|
+
this.logger.debug("Delete operation", { object, id });
|
|
290
|
+
const table = this.getTable(object);
|
|
291
|
+
const index = table.findIndex((r) => r.id == id);
|
|
292
|
+
if (index === -1) {
|
|
293
|
+
this.logger.warn("Record not found for deletion", { object, id });
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
table.splice(index, 1);
|
|
297
|
+
this.logger.debug("Record deleted", { object, id, tableSize: table.length });
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
async count(object, query, options) {
|
|
301
|
+
let results = this.getTable(object);
|
|
302
|
+
if (query?.where) {
|
|
303
|
+
results = results.filter((record) => match(record, query.where));
|
|
304
|
+
}
|
|
305
|
+
const count = results.length;
|
|
306
|
+
this.logger.debug("Count operation", { object, count });
|
|
307
|
+
return count;
|
|
308
|
+
}
|
|
309
|
+
// ===================================
|
|
310
|
+
// Bulk Operations
|
|
311
|
+
// ===================================
|
|
312
|
+
async bulkCreate(object, dataArray, options) {
|
|
313
|
+
this.logger.debug("BulkCreate operation", { object, count: dataArray.length });
|
|
314
|
+
const results = await Promise.all(dataArray.map((data) => this.create(object, data, options)));
|
|
315
|
+
this.logger.debug("BulkCreate completed", { object, count: results.length });
|
|
316
|
+
return results;
|
|
317
|
+
}
|
|
318
|
+
async updateMany(object, query, data, options) {
|
|
319
|
+
this.logger.debug("UpdateMany operation", { object, query });
|
|
320
|
+
const table = this.getTable(object);
|
|
321
|
+
let targetRecords = table;
|
|
322
|
+
if (query && query.where) {
|
|
323
|
+
targetRecords = targetRecords.filter((r) => match(r, query.where));
|
|
324
|
+
}
|
|
325
|
+
const count = targetRecords.length;
|
|
326
|
+
for (const record of targetRecords) {
|
|
327
|
+
const index = table.findIndex((r) => r.id === record.id);
|
|
328
|
+
if (index !== -1) {
|
|
329
|
+
const updated = {
|
|
330
|
+
...table[index],
|
|
331
|
+
...data,
|
|
332
|
+
updated_at: /* @__PURE__ */ new Date()
|
|
333
|
+
};
|
|
334
|
+
table[index] = updated;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
this.logger.debug("UpdateMany completed", { object, count });
|
|
338
|
+
return { count };
|
|
339
|
+
}
|
|
340
|
+
async deleteMany(object, query, options) {
|
|
341
|
+
this.logger.debug("DeleteMany operation", { object, query });
|
|
342
|
+
const table = this.getTable(object);
|
|
343
|
+
const initialLength = table.length;
|
|
344
|
+
const remaining = table.filter((r) => {
|
|
345
|
+
if (!query || !query.where) return false;
|
|
346
|
+
const matches = match(r, query.where);
|
|
347
|
+
return !matches;
|
|
348
|
+
});
|
|
349
|
+
this.db[object] = remaining;
|
|
350
|
+
const count = initialLength - remaining.length;
|
|
351
|
+
this.logger.debug("DeleteMany completed", { object, count });
|
|
352
|
+
return { count };
|
|
353
|
+
}
|
|
354
|
+
// Compatibility aliases
|
|
355
|
+
async bulkUpdate(object, updates, options) {
|
|
356
|
+
this.logger.debug("BulkUpdate operation", { object, count: updates.length });
|
|
357
|
+
const results = await Promise.all(updates.map((u) => this.update(object, u.id, u.data, options)));
|
|
358
|
+
this.logger.debug("BulkUpdate completed", { object, count: results.length });
|
|
359
|
+
return results;
|
|
360
|
+
}
|
|
361
|
+
async bulkDelete(object, ids, options) {
|
|
362
|
+
this.logger.debug("BulkDelete operation", { object, count: ids.length });
|
|
363
|
+
await Promise.all(ids.map((id) => this.delete(object, id, options)));
|
|
364
|
+
this.logger.debug("BulkDelete completed", { object, count: ids.length });
|
|
365
|
+
}
|
|
366
|
+
// ===================================
|
|
367
|
+
// Schema & Transactions
|
|
368
|
+
// ===================================
|
|
369
|
+
async syncSchema(object, schema, options) {
|
|
370
|
+
if (!this.db[object]) {
|
|
371
|
+
this.db[object] = [];
|
|
372
|
+
this.logger.info("Created in-memory table", { object });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async dropTable(object, options) {
|
|
376
|
+
if (this.db[object]) {
|
|
377
|
+
const recordCount = this.db[object].length;
|
|
378
|
+
delete this.db[object];
|
|
379
|
+
this.logger.info("Dropped in-memory table", { object, recordCount });
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
async beginTransaction() {
|
|
383
|
+
throw new Error("Transactions not supported in InMemoryDriver");
|
|
384
|
+
}
|
|
385
|
+
async commit() {
|
|
386
|
+
}
|
|
387
|
+
async rollback() {
|
|
388
|
+
}
|
|
389
|
+
// ===================================
|
|
390
|
+
// Aggregation Logic
|
|
391
|
+
// ===================================
|
|
392
|
+
performAggregation(records, query) {
|
|
393
|
+
const { groupBy, aggregations } = query;
|
|
394
|
+
const groups = /* @__PURE__ */ new Map();
|
|
395
|
+
if (groupBy && groupBy.length > 0) {
|
|
396
|
+
for (const record of records) {
|
|
397
|
+
const keyParts = groupBy.map((field) => {
|
|
398
|
+
const val = getValueByPath(record, field);
|
|
399
|
+
return val === void 0 || val === null ? "null" : String(val);
|
|
400
|
+
});
|
|
401
|
+
const key = JSON.stringify(keyParts);
|
|
402
|
+
if (!groups.has(key)) {
|
|
403
|
+
groups.set(key, []);
|
|
404
|
+
}
|
|
405
|
+
groups.get(key).push(record);
|
|
406
|
+
}
|
|
407
|
+
} else {
|
|
408
|
+
if (aggregations && aggregations.length > 0) {
|
|
409
|
+
groups.set("all", records);
|
|
410
|
+
} else {
|
|
411
|
+
groups.set("all", records);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
const resultRows = [];
|
|
415
|
+
for (const [key, groupRecords] of groups.entries()) {
|
|
416
|
+
const row = {};
|
|
417
|
+
if (groupBy && groupBy.length > 0) {
|
|
418
|
+
if (groupRecords.length > 0) {
|
|
419
|
+
const firstRecord = groupRecords[0];
|
|
420
|
+
for (const field of groupBy) {
|
|
421
|
+
this.setValueByPath(row, field, getValueByPath(firstRecord, field));
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (aggregations) {
|
|
426
|
+
for (const agg of aggregations) {
|
|
427
|
+
const value = this.computeAggregate(groupRecords, agg);
|
|
428
|
+
row[agg.alias] = value;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
resultRows.push(row);
|
|
432
|
+
}
|
|
433
|
+
return resultRows;
|
|
434
|
+
}
|
|
435
|
+
computeAggregate(records, agg) {
|
|
436
|
+
const { function: func, field } = agg;
|
|
437
|
+
const values = field ? records.map((r) => getValueByPath(r, field)) : [];
|
|
438
|
+
switch (func) {
|
|
439
|
+
case "count":
|
|
440
|
+
if (!field || field === "*") return records.length;
|
|
441
|
+
return values.filter((v) => v !== null && v !== void 0).length;
|
|
442
|
+
case "sum":
|
|
443
|
+
case "avg": {
|
|
444
|
+
const nums = values.filter((v) => typeof v === "number");
|
|
445
|
+
const sum = nums.reduce((a, b) => a + b, 0);
|
|
446
|
+
if (func === "sum") return sum;
|
|
447
|
+
return nums.length > 0 ? sum / nums.length : null;
|
|
448
|
+
}
|
|
449
|
+
case "min": {
|
|
450
|
+
const valid = values.filter((v) => v !== null && v !== void 0);
|
|
451
|
+
if (valid.length === 0) return null;
|
|
452
|
+
return valid.reduce((min, v) => v < min ? v : min, valid[0]);
|
|
453
|
+
}
|
|
454
|
+
case "max": {
|
|
455
|
+
const valid = values.filter((v) => v !== null && v !== void 0);
|
|
456
|
+
if (valid.length === 0) return null;
|
|
457
|
+
return valid.reduce((max, v) => v > max ? v : max, valid[0]);
|
|
458
|
+
}
|
|
459
|
+
default:
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
setValueByPath(obj, path, value) {
|
|
464
|
+
const parts = path.split(".");
|
|
465
|
+
let current = obj;
|
|
466
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
467
|
+
const part = parts[i];
|
|
468
|
+
if (!current[part]) current[part] = {};
|
|
469
|
+
current = current[part];
|
|
470
|
+
}
|
|
471
|
+
current[parts[parts.length - 1]] = value;
|
|
472
|
+
}
|
|
473
|
+
// ===================================
|
|
474
|
+
// Helpers
|
|
475
|
+
// ===================================
|
|
476
|
+
getTable(name) {
|
|
477
|
+
if (!this.db[name]) {
|
|
478
|
+
this.db[name] = [];
|
|
479
|
+
}
|
|
480
|
+
return this.db[name];
|
|
481
|
+
}
|
|
482
|
+
generateId() {
|
|
483
|
+
return Math.random().toString(36).substring(2, 15);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
// src/index.ts
|
|
488
|
+
var index_default = {
|
|
489
|
+
id: "com.objectstack.driver.memory",
|
|
490
|
+
version: "1.0.0",
|
|
491
|
+
onEnable: async (context) => {
|
|
492
|
+
const { logger, config, drivers } = context;
|
|
493
|
+
logger.info("[Memory Driver] Initializing...");
|
|
494
|
+
if (drivers) {
|
|
495
|
+
const driver = new InMemoryDriver(config);
|
|
496
|
+
drivers.register(driver);
|
|
497
|
+
logger.info(`[Memory Driver] Registered driver: ${driver.name}`);
|
|
498
|
+
} else {
|
|
499
|
+
logger.warn("[Memory Driver] No driver registry found in context.");
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
export {
|
|
504
|
+
InMemoryDriver,
|
|
505
|
+
index_default as default
|
|
506
|
+
};
|
|
507
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/memory-driver.ts","../src/memory-matcher.ts","../src/index.ts"],"sourcesContent":["import { QueryAST, QueryInput } from '@objectstack/spec/data';\nimport { DriverOptions } from '@objectstack/spec/data';\nimport { DriverInterface, Logger, createLogger } from '@objectstack/core';\nimport { match, getValueByPath } from './memory-matcher.js';\n\n/**\n * Example: In-Memory Driver\n * \n * A minimal reference implementation of the ObjectStack Driver Protocol.\n * This driver stores data in a simple JavaScript object (Heap).\n */\nexport class InMemoryDriver implements DriverInterface {\n name = 'in-memory-driver';\n version = '0.0.1';\n private config: any;\n private logger: Logger;\n\n constructor(config?: any) {\n this.config = config || {};\n this.logger = config?.logger || createLogger({ level: 'info', format: 'pretty' });\n this.logger.debug('InMemory driver instance created', { config: this.config });\n }\n\n // Duck-typed RuntimePlugin hook\n install(ctx: any) {\n this.logger.debug('Installing InMemory driver via plugin hook');\n if (ctx.engine && ctx.engine.ql && typeof ctx.engine.ql.registerDriver === 'function') {\n ctx.engine.ql.registerDriver(this);\n this.logger.info('InMemory driver registered with ObjectQL engine');\n } else {\n this.logger.warn('Could not register driver - ObjectQL engine not found in context');\n }\n }\n \n supports = {\n // Transaction & Connection Management\n transactions: false, \n \n // Query Operations\n queryFilters: true, // Implemented via memory-matcher\n queryAggregations: true, // Implemented\n querySorting: true, // Implemented via JS sort\n queryPagination: true, // Implemented\n queryWindowFunctions: false, // TODO: Not implemented\n querySubqueries: false, // TODO: Not implemented\n joins: false, // TODO: Not implemented\n \n // Advanced Features\n fullTextSearch: false, // TODO: Not implemented\n vectorSearch: false, // TODO: Not implemented\n geoSpatial: false, // TODO: Not implemented\n jsonFields: true, // Native JS object support\n arrayFields: true, // Native JS array support\n };\n\n /**\n * The \"Database\": A map of TableName -> Array of Records\n */\n private db: Record<string, any[]> = {};\n\n // ===================================\n // Lifecycle\n // ===================================\n\n async connect() {\n this.logger.info('InMemory Database Connected (Virtual)');\n }\n\n async disconnect() {\n const tableCount = Object.keys(this.db).length;\n const recordCount = Object.values(this.db).reduce((sum, table) => sum + table.length, 0);\n \n this.db = {};\n this.logger.info('InMemory Database Disconnected & Cleared', { \n tableCount, \n recordCount \n });\n }\n\n async checkHealth() {\n this.logger.debug('Health check performed', { \n tableCount: Object.keys(this.db).length,\n status: 'healthy' \n });\n return true; \n }\n\n // ===================================\n // Execution\n // ===================================\n\n async execute(command: any, params?: any[]) {\n this.logger.warn('Raw execution not supported in InMemory driver', { command });\n return null;\n }\n\n // ===================================\n // CRUD\n // ===================================\n\n async find(object: string, query: QueryInput, options?: DriverOptions) {\n this.logger.debug('Find operation', { object, query });\n \n const table = this.getTable(object);\n let results = table;\n\n // 1. Filter\n if (query.where) {\n results = results.filter(record => match(record, query.where));\n }\n\n // 1.5 Aggregation & Grouping\n if (query.groupBy || (query.aggregations && query.aggregations.length > 0)) {\n results = this.performAggregation(results, query);\n }\n\n // 2. Sort\n if (query.orderBy) {\n // Normalize sort to array\n const sortFields = Array.isArray(query.orderBy) ? query.orderBy : [query.orderBy];\n \n results.sort((a, b) => {\n for (const { field, order } of sortFields) {\n const valA = getValueByPath(a, field);\n const valB = getValueByPath(b, field);\n \n if (valA === valB) continue;\n \n const comparison = valA > valB ? 1 : -1;\n return order === 'desc' ? -comparison : comparison;\n }\n return 0;\n });\n }\n\n // 3. Pagination (Offset)\n if (query.offset) {\n results = results.slice(query.offset);\n }\n\n // 4. Pagination (Limit)\n if (query.limit) {\n results = results.slice(0, query.limit);\n }\n\n this.logger.debug('Find completed', { object, resultCount: results.length });\n return results;\n }\n\n async *findStream(object: string, query: QueryInput, options?: DriverOptions) {\n this.logger.debug('FindStream operation', { object });\n \n const results = await this.find(object, query, options);\n for (const record of results) {\n yield record;\n }\n }\n\n async findOne(object: string, query: QueryInput, options?: DriverOptions) {\n this.logger.debug('FindOne operation', { object, query });\n \n const results = await this.find(object, { ...query, limit: 1 }, options);\n const result = results[0] || null;\n \n this.logger.debug('FindOne completed', { object, found: !!result });\n return result;\n }\n\n async create(object: string, data: Record<string, any>, options?: DriverOptions) {\n this.logger.debug('Create operation', { object, hasData: !!data });\n \n const table = this.getTable(object);\n \n // COMPATIBILITY: Driver must return 'id' as string\n const newRecord = {\n id: data.id || this.generateId(),\n ...data,\n created_at: data.created_at || new Date(),\n updated_at: data.updated_at || new Date(),\n };\n\n table.push(newRecord);\n this.logger.debug('Record created', { object, id: newRecord.id, tableSize: table.length });\n return newRecord;\n }\n\n async update(object: string, id: string | number, data: Record<string, any>, options?: DriverOptions) {\n this.logger.debug('Update operation', { object, id });\n \n const table = this.getTable(object);\n const index = table.findIndex(r => r.id == id);\n \n if (index === -1) {\n this.logger.warn('Record not found for update', { object, id });\n throw new Error(`Record with ID ${id} not found in ${object}`);\n }\n\n const updatedRecord = {\n ...table[index],\n ...data,\n updated_at: new Date()\n };\n \n table[index] = updatedRecord;\n this.logger.debug('Record updated', { object, id });\n return updatedRecord;\n }\n\n async upsert(object: string, data: Record<string, any>, conflictKeys?: string[], options?: DriverOptions) {\n this.logger.debug('Upsert operation', { object, conflictKeys });\n \n const table = this.getTable(object);\n let existingRecord: any = null;\n\n if (data.id) {\n existingRecord = table.find(r => r.id === data.id);\n } else if (conflictKeys && conflictKeys.length > 0) {\n existingRecord = table.find(r => conflictKeys.every(key => r[key] === data[key]));\n }\n\n if (existingRecord) {\n this.logger.debug('Record exists, updating', { object, id: existingRecord.id });\n return this.update(object, existingRecord.id, data, options);\n } else {\n this.logger.debug('Record does not exist, creating', { object });\n return this.create(object, data, options);\n }\n }\n\n async delete(object: string, id: string | number, options?: DriverOptions) {\n this.logger.debug('Delete operation', { object, id });\n \n const table = this.getTable(object);\n const index = table.findIndex(r => r.id == id);\n \n if (index === -1) {\n this.logger.warn('Record not found for deletion', { object, id });\n return false;\n }\n\n table.splice(index, 1);\n this.logger.debug('Record deleted', { object, id, tableSize: table.length });\n return true;\n }\n\n async count(object: string, query?: QueryInput, options?: DriverOptions) {\n let results = this.getTable(object);\n if (query?.where) {\n results = results.filter(record => match(record, query.where));\n }\n const count = results.length;\n this.logger.debug('Count operation', { object, count });\n return count;\n }\n\n // ===================================\n // Bulk Operations\n // ===================================\n\n async bulkCreate(object: string, dataArray: Record<string, any>[], options?: DriverOptions) {\n this.logger.debug('BulkCreate operation', { object, count: dataArray.length });\n const results = await Promise.all(dataArray.map(data => this.create(object, data, options)));\n this.logger.debug('BulkCreate completed', { object, count: results.length });\n return results;\n }\n \n async updateMany(object: string, query: QueryInput, data: Record<string, any>, options?: DriverOptions) {\n this.logger.debug('UpdateMany operation', { object, query });\n \n const table = this.getTable(object);\n let targetRecords = table;\n \n if (query && query.where) {\n targetRecords = targetRecords.filter(r => match(r, query.where));\n }\n \n const count = targetRecords.length;\n \n // Update each record\n for (const record of targetRecords) {\n // Find index in original table\n const index = table.findIndex(r => r.id === record.id);\n if (index !== -1) {\n const updated = {\n ...table[index],\n ...data,\n updated_at: new Date()\n };\n table[index] = updated;\n }\n }\n \n this.logger.debug('UpdateMany completed', { object, count });\n return { count };\n }\n\n async deleteMany(object: string, query: QueryInput, options?: DriverOptions) {\n this.logger.debug('DeleteMany operation', { object, query });\n \n const table = this.getTable(object);\n const initialLength = table.length;\n \n // Filter IN PLACE or create new array?\n // Creating new array is safer for now.\n \n const remaining = table.filter(r => {\n if (!query || !query.where) return false; // Delete all? No, standard safety implies explicit empty filter for delete all.\n // Wait, normally deleteMany({}) deletes all.\n // Let's assume if query passed, use it.\n const matches = match(r, query.where);\n return !matches; // Keep if it DOES NOT match\n });\n \n this.db[object] = remaining;\n const count = initialLength - remaining.length;\n \n this.logger.debug('DeleteMany completed', { object, count });\n return { count };\n }\n\n // Compatibility aliases\n async bulkUpdate(object: string, updates: { id: string | number, data: Record<string, any> }[], options?: DriverOptions) {\n this.logger.debug('BulkUpdate operation', { object, count: updates.length });\n const results = await Promise.all(updates.map(u => this.update(object, u.id, u.data, options)));\n this.logger.debug('BulkUpdate completed', { object, count: results.length });\n return results;\n }\n\n async bulkDelete(object: string, ids: (string | number)[], options?: DriverOptions) {\n this.logger.debug('BulkDelete operation', { object, count: ids.length });\n await Promise.all(ids.map(id => this.delete(object, id, options)));\n this.logger.debug('BulkDelete completed', { object, count: ids.length });\n }\n\n // ===================================\n // Schema & Transactions\n // ===================================\n\n async syncSchema(object: string, schema: any, options?: DriverOptions) {\n if (!this.db[object]) {\n this.db[object] = [];\n this.logger.info('Created in-memory table', { object });\n }\n }\n\n async dropTable(object: string, options?: DriverOptions) {\n if (this.db[object]) {\n const recordCount = this.db[object].length;\n delete this.db[object];\n this.logger.info('Dropped in-memory table', { object, recordCount });\n }\n }\n\n async beginTransaction() {\n throw new Error('Transactions not supported in InMemoryDriver');\n }\n\n async commit() { /* No-op */ }\n async rollback() { /* No-op */ }\n\n // ===================================\n // Aggregation Logic\n // ===================================\n\n private performAggregation(records: any[], query: QueryInput): any[] {\n const { groupBy, aggregations } = query;\n const groups: Map<string, any[]> = new Map();\n\n // 1. Group records\n if (groupBy && groupBy.length > 0) {\n for (const record of records) {\n // Create a composite key from group values\n const keyParts = groupBy.map(field => {\n const val = getValueByPath(record, field);\n return val === undefined || val === null ? 'null' : String(val);\n });\n const key = JSON.stringify(keyParts);\n \n if (!groups.has(key)) {\n groups.set(key, []);\n }\n groups.get(key)!.push(record);\n }\n } else {\n // No grouping -> Single group containing all records\n // If aggregation is requested without group by, it runs on whole set (even if empty)\n if (aggregations && aggregations.length > 0) {\n groups.set('all', records);\n } else {\n // Should not be here if performAggregation called correctly\n groups.set('all', records);\n }\n }\n\n // 2. Compute aggregates for each group\n const resultRows: any[] = [];\n \n for (const [key, groupRecords] of groups.entries()) {\n const row: any = {};\n \n // A. Add Group fields to row (if groupBy exists)\n if (groupBy && groupBy.length > 0) {\n if (groupRecords.length > 0) {\n const firstRecord = groupRecords[0];\n for (const field of groupBy) {\n this.setValueByPath(row, field, getValueByPath(firstRecord, field));\n }\n }\n }\n \n // B. Compute Aggregations\n if (aggregations) {\n for (const agg of aggregations) {\n const value = this.computeAggregate(groupRecords, agg);\n row[agg.alias] = value;\n }\n }\n \n resultRows.push(row);\n }\n \n return resultRows;\n }\n \n private computeAggregate(records: any[], agg: any): any {\n const { function: func, field } = agg;\n \n const values = field ? records.map(r => getValueByPath(r, field)) : [];\n \n switch (func) {\n case 'count':\n if (!field || field === '*') return records.length;\n return values.filter(v => v !== null && v !== undefined).length;\n \n case 'sum':\n case 'avg': {\n const nums = values.filter(v => typeof v === 'number');\n const sum = nums.reduce((a, b) => a + b, 0);\n if (func === 'sum') return sum;\n return nums.length > 0 ? sum / nums.length : null;\n }\n \n case 'min': {\n // Handle comparable values\n const valid = values.filter(v => v !== null && v !== undefined);\n if (valid.length === 0) return null;\n // Works for numbers and strings\n return valid.reduce((min, v) => (v < min ? v : min), valid[0]);\n }\n\n case 'max': {\n const valid = values.filter(v => v !== null && v !== undefined);\n if (valid.length === 0) return null;\n return valid.reduce((max, v) => (v > max ? v : max), valid[0]);\n }\n\n default:\n return null;\n }\n }\n\n private setValueByPath(obj: any, path: string, value: any) {\n const parts = path.split('.');\n let current = obj;\n for (let i = 0; i < parts.length - 1; i++) {\n const part = parts[i];\n if (!current[part]) current[part] = {};\n current = current[part];\n }\n current[parts[parts.length - 1]] = value;\n }\n\n // ===================================\n // Helpers\n // ===================================\n\n private getTable(name: string) {\n if (!this.db[name]) {\n this.db[name] = [];\n }\n return this.db[name];\n }\n\n private generateId() {\n return Math.random().toString(36).substring(2, 15);\n }\n}\n","\n/**\n * Simple In-Memory Query Matcher\n * \n * Implements a subset of the ObjectStack Filter Protocol (MongoDB-compatible)\n * for evaluating conditions against in-memory JavaScript objects.\n */\n\ntype RecordType = Record<string, any>;\n\n/**\n * matches - Check if a record matches a filter criteria\n * @param record The data record to check\n * @param filter The filter condition (where clause)\n */\nexport function match(record: RecordType, filter: any): boolean {\n if (!filter || Object.keys(filter).length === 0) return true;\n \n // 1. Handle Top-Level Logical Operators ($and, $or, $not)\n // These usually appear at the root or nested.\n \n // $and: [ { ... }, { ... } ]\n if (Array.isArray(filter.$and)) {\n if (!filter.$and.every((f: any) => match(record, f))) {\n return false;\n }\n }\n \n // $or: [ { ... }, { ... } ]\n if (Array.isArray(filter.$or)) {\n if (!filter.$or.some((f: any) => match(record, f))) {\n return false;\n }\n }\n \n // $not: { ... }\n if (filter.$not) {\n if (match(record, filter.$not)) {\n return false;\n }\n }\n \n // 2. Iterate over field constraints\n for (const key of Object.keys(filter)) {\n // Skip logical operators we already handled (or future ones)\n if (key.startsWith('$')) continue;\n \n const condition = filter[key];\n const value = getValueByPath(record, key);\n \n if (!checkCondition(value, condition)) {\n return false;\n }\n }\n \n return true;\n}\n\n/**\n * Access nested properties via dot-notation (e.g. \"user.name\")\n */\nexport function getValueByPath(obj: any, path: string): any {\n if (!path.includes('.')) return obj[path];\n return path.split('.').reduce((o, i) => (o ? o[i] : undefined), obj);\n}\n\n/**\n * Evaluate a specific condition against a value\n */\nfunction checkCondition(value: any, condition: any): boolean {\n // Case A: Implicit Equality (e.g. status: 'active')\n // If condition is a primitive or Date/Array (exact match), treat as equality.\n if (\n typeof condition !== 'object' || \n condition === null || \n condition instanceof Date ||\n Array.isArray(condition)\n ) {\n // Loose equality to handle undefined/null mismatch or string/number coercion if desired.\n // But stick to == for JS loose equality which is often convenient in weakly typed queries.\n return value == condition;\n }\n \n // Case B: Operator Object (e.g. { $gt: 10, $lt: 20 })\n const keys = Object.keys(condition);\n const isOperatorObject = keys.some(k => k.startsWith('$'));\n \n if (!isOperatorObject) {\n // It's just a nested object comparison or implicit equality against an object\n // Simplistic check:\n return JSON.stringify(value) === JSON.stringify(condition);\n }\n\n // Iterate operators\n for (const op of keys) {\n const target = condition[op];\n \n // Handle undefined values\n if (value === undefined && op !== '$exists' && op !== '$ne') {\n return false; \n }\n\n switch (op) {\n case '$eq': \n if (value != target) return false; \n break;\n case '$ne': \n if (value == target) return false; \n break;\n \n // Numeric / Date\n case '$gt': \n if (!(value > target)) return false; \n break;\n case '$gte': \n if (!(value >= target)) return false; \n break;\n case '$lt': \n if (!(value < target)) return false; \n break;\n case '$lte': \n if (!(value <= target)) return false; \n break;\n case '$between':\n // target should be [min, max]\n if (Array.isArray(target) && (value < target[0] || value > target[1])) return false;\n break;\n\n // Sets\n case '$in': \n if (!Array.isArray(target) || !target.includes(value)) return false; \n break;\n case '$nin': \n if (Array.isArray(target) && target.includes(value)) return false; \n break;\n \n // Existence\n case '$exists':\n const exists = value !== undefined && value !== null;\n if (exists !== !!target) return false;\n break;\n\n // Strings\n case '$contains': \n if (typeof value !== 'string' || !value.includes(target)) return false; \n break;\n case '$startsWith': \n if (typeof value !== 'string' || !value.startsWith(target)) return false; \n break;\n case '$endsWith': \n if (typeof value !== 'string' || !value.endsWith(target)) return false; \n break;\n case '$regex':\n try {\n const re = new RegExp(target, condition.$options || '');\n if (!re.test(String(value))) return false;\n } catch (e) { return false; }\n break;\n\n default: \n // Unknown operator, ignore or fail. Ignoring safe for optional features.\n break;\n }\n }\n \n return true;\n}\n","import { InMemoryDriver } from './memory-driver.js';\n\nexport { InMemoryDriver }; // Export class for direct usage\n\n// Note: In a real environment, you would import these from @objectstack/spec\n// But distinct PluginDefinition interface might not be strictly defined in schema yet, \n// usually it mimics the Manifest structure + runtime hooks.\n\n// For this example, we define a basic shape if not available, or use \"any\" to bypass strictness for the demo.\n// In plugin-bi it imported: import { PluginDefinition, PluginContextData } from '@objectstack/spec';\n\n// Let's rely on the environment being set up like plugin-bi.\n// If types are missing, this is just an example file.\n\nexport default {\n id: 'com.objectstack.driver.memory',\n version: '1.0.0',\n\n onEnable: async (context: any) => {\n const { logger, config, drivers } = context;\n logger.info('[Memory Driver] Initializing...');\n\n // Simulate driver registration\n // This assumes the runtime exposes a 'drivers' registry\n if (drivers) {\n const driver = new InMemoryDriver(config); // Pass config to driver\n drivers.register(driver);\n logger.info(`[Memory Driver] Registered driver: ${driver.name}`);\n } else {\n logger.warn('[Memory Driver] No driver registry found in context.');\n }\n }\n};\n"],"mappings":";AAEA,SAAkC,oBAAoB;;;ACa/C,SAAS,MAAM,QAAo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,IAAI,EAAG,SAAQ,IAAI,IAAI,CAAC;AACrC,gBAAU,QAAQ,IAAI;AAAA,IAC1B;AACA,YAAQ,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA,EAMQ,SAAS,MAAc;AAC7B,QAAI,CAAC,KAAK,GAAG,IAAI,GAAG;AAClB,WAAK,GAAG,IAAI,IAAI,CAAC;AAAA,IACnB;AACA,WAAO,KAAK,GAAG,IAAI;AAAA,EACrB;AAAA,EAEQ,aAAa;AACnB,WAAO,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,GAAG,EAAE;AAAA,EACnD;AACF;;;AExdA,IAAO,gBAAQ;AAAA,EACb,IAAI;AAAA,EACJ,SAAS;AAAA,EAET,UAAU,OAAO,YAAiB;AAChC,UAAM,EAAE,QAAQ,QAAQ,QAAQ,IAAI;AACpC,WAAO,KAAK,iCAAiC;AAI7C,QAAI,SAAS;AACV,YAAM,SAAS,IAAI,eAAe,MAAM;AACxC,cAAQ,SAAS,MAAM;AACvB,aAAO,KAAK,sCAAsC,OAAO,IAAI,EAAE;AAAA,IAClE,OAAO;AACJ,aAAO,KAAK,sDAAsD;AAAA,IACrE;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/driver-memory",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "In-Memory Driver for ObjectStack (Reference Implementation)",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@objectstack/core": "1.0.
|
|
10
|
-
"@objectstack/spec": "1.0.
|
|
9
|
+
"@objectstack/core": "1.0.5",
|
|
10
|
+
"@objectstack/spec": "1.0.5"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"typescript": "^5.0.0",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@types/node": "^25.1.0"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "
|
|
18
|
+
"build": "tsup --config ../../../tsup.config.ts",
|
|
19
19
|
"dev": "tsc -w",
|
|
20
20
|
"test": "vitest run"
|
|
21
21
|
}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,CAAC;;;;wBAgBE,GAAG;;AAJ/B,wBAkBE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-driver.d.ts","sourceRoot":"","sources":["../src/memory-driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAwB,MAAM,mBAAmB,CAAC;AAG1E;;;;;GAKG;AACH,qBAAa,cAAe,YAAW,eAAe;IACpD,IAAI,SAAsB;IAC1B,OAAO,SAAW;IAClB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,CAAC,EAAE,GAAG;IAOxB,OAAO,CAAC,GAAG,EAAE,GAAG;IAUhB,QAAQ;;;;;;;;;;;;;;MAmBN;IAEF;;OAEG;IACH,OAAO,CAAC,EAAE,CAA6B;IAMjC,OAAO;IAIP,UAAU;IAWV,WAAW;IAYX,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE;IASpC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CA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