@objectstack/driver-memory 0.3.3 → 0.4.2
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
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @objectstack/driver-memory
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Unify all package versions to 0.4.2
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @objectstack/spec@0.4.2
|
|
10
|
+
|
|
11
|
+
## 0.4.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Version synchronization and dependency updates
|
|
16
|
+
|
|
17
|
+
- Synchronized plugin-msw version to 0.4.1
|
|
18
|
+
- Updated runtime peer dependency versions to ^0.4.1
|
|
19
|
+
- Fixed internal dependency version mismatches
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @objectstack/spec@0.4.1
|
|
23
|
+
|
|
24
|
+
## 0.4.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- Release version 0.4.0
|
|
29
|
+
|
|
3
30
|
## 0.3.3
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryInput } from '@objectstack/spec/data';
|
|
2
|
-
import { DriverInterface, DriverOptions } from '@objectstack/spec/
|
|
2
|
+
import { DriverInterface, DriverOptions } from '@objectstack/spec/system';
|
|
3
3
|
/**
|
|
4
4
|
* Example: In-Memory Driver
|
|
5
5
|
*
|
|
@@ -39,18 +39,18 @@ export declare class InMemoryDriver implements DriverInterface {
|
|
|
39
39
|
findStream(object: string, query: QueryInput, options?: DriverOptions): AsyncGenerator<any, void, unknown>;
|
|
40
40
|
findOne(object: string, query: QueryInput, options?: DriverOptions): Promise<any>;
|
|
41
41
|
create(object: string, data: Record<string, any>, options?: DriverOptions): Promise<{
|
|
42
|
-
created_at:
|
|
43
|
-
updated_at:
|
|
44
|
-
id:
|
|
42
|
+
created_at: any;
|
|
43
|
+
updated_at: any;
|
|
44
|
+
id: any;
|
|
45
45
|
}>;
|
|
46
46
|
update(object: string, id: string | number, data: Record<string, any>, options?: DriverOptions): Promise<any>;
|
|
47
47
|
upsert(object: string, data: Record<string, any>, conflictKeys?: string[], options?: DriverOptions): Promise<any>;
|
|
48
48
|
delete(object: string, id: string | number, options?: DriverOptions): Promise<boolean>;
|
|
49
49
|
count(object: string, query?: QueryInput, options?: DriverOptions): Promise<number>;
|
|
50
50
|
bulkCreate(object: string, dataArray: Record<string, any>[], options?: DriverOptions): Promise<{
|
|
51
|
-
created_at:
|
|
52
|
-
updated_at:
|
|
53
|
-
id:
|
|
51
|
+
created_at: any;
|
|
52
|
+
updated_at: any;
|
|
53
|
+
id: any;
|
|
54
54
|
}[]>;
|
|
55
55
|
bulkUpdate(object: string, updates: {
|
|
56
56
|
id: string | number;
|
|
@@ -85,10 +85,10 @@ export class InMemoryDriver {
|
|
|
85
85
|
const table = this.getTable(object);
|
|
86
86
|
// COMPATIBILITY: Driver must return 'id' as string
|
|
87
87
|
const newRecord = {
|
|
88
|
-
id: this.generateId(),
|
|
88
|
+
id: data.id || this.generateId(),
|
|
89
89
|
...data,
|
|
90
|
-
created_at: new Date(),
|
|
91
|
-
updated_at: new Date(),
|
|
90
|
+
created_at: data.created_at || new Date(),
|
|
91
|
+
updated_at: data.updated_at || new Date(),
|
|
92
92
|
};
|
|
93
93
|
table.push(newRecord);
|
|
94
94
|
return newRecord;
|
package/objectstack.config.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/driver-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.2",
|
|
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.4.2"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"typescript": "^5.0.0"
|
package/src/memory-driver.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryAST, QueryInput } from '@objectstack/spec/data';
|
|
2
|
-
import { DriverInterface, DriverOptions } from '@objectstack/spec/
|
|
2
|
+
import { DriverInterface, DriverOptions } from '@objectstack/spec/system';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Example: In-Memory Driver
|
|
@@ -110,10 +110,10 @@ export class InMemoryDriver implements DriverInterface {
|
|
|
110
110
|
|
|
111
111
|
// COMPATIBILITY: Driver must return 'id' as string
|
|
112
112
|
const newRecord = {
|
|
113
|
-
id: this.generateId(),
|
|
113
|
+
id: data.id || this.generateId(),
|
|
114
114
|
...data,
|
|
115
|
-
created_at: new Date(),
|
|
116
|
-
updated_at: new Date(),
|
|
115
|
+
created_at: data.created_at || new Date(),
|
|
116
|
+
updated_at: data.updated_at || new Date(),
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
table.push(newRecord);
|