@objectstack/driver-memory 0.1.0 → 0.2.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/CHANGELOG.md +29 -0
- package/dist/src/memory-driver.d.ts +7 -0
- package/dist/src/memory-driver.js +20 -4
- package/package.json +2 -2
- package/src/memory-driver.ts +23 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @objectstack/driver-memory
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Initial release of ObjectStack Protocol & Specification packages
|
|
8
|
+
|
|
9
|
+
This is the first public release of the ObjectStack ecosystem, providing:
|
|
10
|
+
|
|
11
|
+
- Core protocol definitions and TypeScript types
|
|
12
|
+
- ObjectQL query language and runtime
|
|
13
|
+
- Memory driver for in-memory data storage
|
|
14
|
+
- Client library for interacting with ObjectStack
|
|
15
|
+
- Hono server plugin for REST API endpoints
|
|
16
|
+
- Complete JSON schema generation for all specifications
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @objectstack/spec@0.2.0
|
|
22
|
+
|
|
23
|
+
## 0.1.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Remove debug logs from registry and protocol modules
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @objectstack/spec@0.1.2
|
|
@@ -8,8 +8,15 @@ import { DriverInterface, DriverOptions, QueryInput } from '@objectstack/spec';
|
|
|
8
8
|
export declare class InMemoryDriver implements DriverInterface {
|
|
9
9
|
name: string;
|
|
10
10
|
version: string;
|
|
11
|
+
install(ctx: any): void;
|
|
11
12
|
supports: {
|
|
12
13
|
transactions: boolean;
|
|
14
|
+
queryFilters: boolean;
|
|
15
|
+
queryAggregations: boolean;
|
|
16
|
+
querySorting: boolean;
|
|
17
|
+
queryPagination: boolean;
|
|
18
|
+
queryWindowFunctions: boolean;
|
|
19
|
+
querySubqueries: boolean;
|
|
13
20
|
joins: boolean;
|
|
14
21
|
fullTextSearch: boolean;
|
|
15
22
|
jsonFields: boolean;
|
|
@@ -12,17 +12,32 @@ class InMemoryDriver {
|
|
|
12
12
|
this.name = 'in-memory-driver';
|
|
13
13
|
this.version = '0.0.1';
|
|
14
14
|
this.supports = {
|
|
15
|
+
// Transaction & Connection Management
|
|
15
16
|
transactions: false,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// Query Operations
|
|
18
|
+
queryFilters: false, // TODO: Not implemented - basic find() doesn't handle filters
|
|
19
|
+
queryAggregations: false, // TODO: Not implemented - count() only returns total
|
|
20
|
+
querySorting: false, // TODO: Not implemented - find() doesn't handle sorting
|
|
21
|
+
queryPagination: true, // Basic pagination via 'top' is implemented
|
|
22
|
+
queryWindowFunctions: false, // TODO: Not implemented
|
|
23
|
+
querySubqueries: false, // TODO: Not implemented
|
|
24
|
+
joins: false, // TODO: Not implemented
|
|
25
|
+
// Advanced Features
|
|
26
|
+
fullTextSearch: false, // TODO: Not implemented
|
|
27
|
+
jsonFields: true, // Native JS object support
|
|
28
|
+
arrayFields: true, // Native JS array support
|
|
20
29
|
};
|
|
21
30
|
/**
|
|
22
31
|
* The "Database": A map of TableName -> Array of Records
|
|
23
32
|
*/
|
|
24
33
|
this.db = {};
|
|
25
34
|
}
|
|
35
|
+
// Duck-typed RuntimePlugin hook
|
|
36
|
+
install(ctx) {
|
|
37
|
+
if (ctx.engine && ctx.engine.ql && typeof ctx.engine.ql.registerDriver === 'function') {
|
|
38
|
+
ctx.engine.ql.registerDriver(this);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
26
41
|
// ===================================
|
|
27
42
|
// Lifecycle
|
|
28
43
|
// ===================================
|
|
@@ -62,6 +77,7 @@ class InMemoryDriver {
|
|
|
62
77
|
}
|
|
63
78
|
async create(object, data, options) {
|
|
64
79
|
const table = this.getTable(object);
|
|
80
|
+
// COMPATIBILITY: Driver must return 'id' as string
|
|
65
81
|
const newRecord = {
|
|
66
82
|
id: this.generateId(),
|
|
67
83
|
...data,
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/driver-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "In-Memory Driver for ObjectStack (Reference Implementation)",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@objectstack/spec": "0.
|
|
8
|
+
"@objectstack/spec": "0.2.0"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"typescript": "^5.0.0"
|
package/src/memory-driver.ts
CHANGED
|
@@ -14,13 +14,31 @@ import {
|
|
|
14
14
|
export class InMemoryDriver implements DriverInterface {
|
|
15
15
|
name = 'in-memory-driver';
|
|
16
16
|
version = '0.0.1';
|
|
17
|
+
|
|
18
|
+
// Duck-typed RuntimePlugin hook
|
|
19
|
+
install(ctx: any) {
|
|
20
|
+
if (ctx.engine && ctx.engine.ql && typeof ctx.engine.ql.registerDriver === 'function') {
|
|
21
|
+
ctx.engine.ql.registerDriver(this);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
17
24
|
|
|
18
25
|
supports = {
|
|
26
|
+
// Transaction & Connection Management
|
|
19
27
|
transactions: false,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
|
|
29
|
+
// Query Operations
|
|
30
|
+
queryFilters: false, // TODO: Not implemented - basic find() doesn't handle filters
|
|
31
|
+
queryAggregations: false, // TODO: Not implemented - count() only returns total
|
|
32
|
+
querySorting: false, // TODO: Not implemented - find() doesn't handle sorting
|
|
33
|
+
queryPagination: true, // Basic pagination via 'top' is implemented
|
|
34
|
+
queryWindowFunctions: false, // TODO: Not implemented
|
|
35
|
+
querySubqueries: false, // TODO: Not implemented
|
|
36
|
+
joins: false, // TODO: Not implemented
|
|
37
|
+
|
|
38
|
+
// Advanced Features
|
|
39
|
+
fullTextSearch: false, // TODO: Not implemented
|
|
40
|
+
jsonFields: true, // Native JS object support
|
|
41
|
+
arrayFields: true, // Native JS array support
|
|
24
42
|
};
|
|
25
43
|
|
|
26
44
|
/**
|
|
@@ -80,6 +98,7 @@ export class InMemoryDriver implements DriverInterface {
|
|
|
80
98
|
async create(object: string, data: Record<string, any>, options?: DriverOptions) {
|
|
81
99
|
const table = this.getTable(object);
|
|
82
100
|
|
|
101
|
+
// COMPATIBILITY: Driver must return 'id' as string
|
|
83
102
|
const newRecord = {
|
|
84
103
|
id: this.generateId(),
|
|
85
104
|
...data,
|