@olivia-db/mastra 0.1.3 → 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/dist/index.js +9 -15
- package/package.json +2 -2
- package/src/index.ts +8 -13
package/dist/index.js
CHANGED
|
@@ -100,22 +100,16 @@ export class OliviaDBMemoryStorage extends InMemoryMemory {
|
|
|
100
100
|
for (const t of TABLES) {
|
|
101
101
|
const m = this.map(t);
|
|
102
102
|
m.clear();
|
|
103
|
-
|
|
104
|
-
for (
|
|
105
|
-
const
|
|
106
|
-
for (const
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (typeof d === "string")
|
|
111
|
-
v[f] = new Date(d);
|
|
112
|
-
}
|
|
113
|
-
m.set(it.key, v);
|
|
114
|
-
this.seen.set(`${t}\u0000${it.key}`, { json: JSON.stringify(it.value), version: it.version });
|
|
103
|
+
// Every row, in pages followed by the server's cursors.
|
|
104
|
+
for await (const it of this.client.iterStateList([...this.root, t])) {
|
|
105
|
+
const v = { ...it.value };
|
|
106
|
+
for (const f of DATE_FIELDS) {
|
|
107
|
+
const d = v[f];
|
|
108
|
+
if (typeof d === "string")
|
|
109
|
+
v[f] = new Date(d);
|
|
115
110
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
after = page[page.length - 1].key;
|
|
111
|
+
m.set(it.key, v);
|
|
112
|
+
this.seen.set(`${t}\u0000${it.key}`, { json: JSON.stringify(it.value), version: it.version });
|
|
119
113
|
}
|
|
120
114
|
}
|
|
121
115
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olivia-db/mastra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Mastra memory storage backed by OliviaDB",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"test": "node --test --test-force-exit test/*.test.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@olivia-db/client": "0.
|
|
35
|
+
"@olivia-db/client": "0.2.0",
|
|
36
36
|
"@mastra/core": "1.86.0",
|
|
37
37
|
"@mastra/memory": "1.41.3"
|
|
38
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -109,20 +109,15 @@ export class OliviaDBMemoryStorage extends InMemoryMemory {
|
|
|
109
109
|
for (const t of TABLES) {
|
|
110
110
|
const m = this.map(t);
|
|
111
111
|
m.clear();
|
|
112
|
-
|
|
113
|
-
for (
|
|
114
|
-
const
|
|
115
|
-
for (const
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const d = v[f];
|
|
119
|
-
if (typeof d === "string") v[f] = new Date(d);
|
|
120
|
-
}
|
|
121
|
-
m.set(it.key, v);
|
|
122
|
-
this.seen.set(`${t}\u0000${it.key}`, { json: JSON.stringify(it.value), version: it.version });
|
|
112
|
+
// Every row, in pages followed by the server's cursors.
|
|
113
|
+
for await (const it of this.client.iterStateList([...this.root, t])) {
|
|
114
|
+
const v: Row = { ...(it.value as Row) };
|
|
115
|
+
for (const f of DATE_FIELDS) {
|
|
116
|
+
const d = v[f];
|
|
117
|
+
if (typeof d === "string") v[f] = new Date(d);
|
|
123
118
|
}
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
m.set(it.key, v);
|
|
120
|
+
this.seen.set(`${t}\u0000${it.key}`, { json: JSON.stringify(it.value), version: it.version });
|
|
126
121
|
}
|
|
127
122
|
}
|
|
128
123
|
}
|