@h-ai/ai 0.1.0-alpha.71 → 0.1.0-alpha.73
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 +11 -6
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -9547,7 +9547,7 @@ var VecdbAIVectorStore = class {
|
|
|
9547
9547
|
function createDbStoreProvider(deps) {
|
|
9548
9548
|
const { sql, jsonOps, vecdb: vecdbDep } = deps;
|
|
9549
9549
|
const dbType = deps.dbType ?? "sqlite";
|
|
9550
|
-
const relStores =
|
|
9550
|
+
const relStores = /* @__PURE__ */ new Map();
|
|
9551
9551
|
return {
|
|
9552
9552
|
name: "db",
|
|
9553
9553
|
get stateScope() {
|
|
@@ -9557,7 +9557,9 @@ function createDbStoreProvider(deps) {
|
|
|
9557
9557
|
},
|
|
9558
9558
|
createRelStore(name, options) {
|
|
9559
9559
|
const store = new ReldbAIRelStore(sql, name, jsonOps, dbType, options);
|
|
9560
|
-
relStores.
|
|
9560
|
+
const stores = relStores.get(name) ?? [];
|
|
9561
|
+
stores.push(store);
|
|
9562
|
+
relStores.set(name, stores);
|
|
9561
9563
|
return store;
|
|
9562
9564
|
},
|
|
9563
9565
|
createVectorStore(name) {
|
|
@@ -9581,17 +9583,20 @@ function createDbStoreProvider(deps) {
|
|
|
9581
9583
|
});
|
|
9582
9584
|
},
|
|
9583
9585
|
async initialize() {
|
|
9584
|
-
if (relStores.
|
|
9585
|
-
const results = await Promise.allSettled(relStores.map((
|
|
9586
|
+
if (relStores.size > 0) {
|
|
9587
|
+
const results = await Promise.allSettled([...relStores.values()].map(async (stores) => {
|
|
9588
|
+
for (const store of stores)
|
|
9589
|
+
await store.createTable();
|
|
9590
|
+
}));
|
|
9586
9591
|
for (const result of results) {
|
|
9587
9592
|
if (result.status === "rejected")
|
|
9588
9593
|
throw result.reason;
|
|
9589
9594
|
}
|
|
9590
|
-
logger31.debug("DB store provider initialized", { tableCount: relStores.
|
|
9595
|
+
logger31.debug("DB store provider initialized", { tableCount: relStores.size });
|
|
9591
9596
|
}
|
|
9592
9597
|
},
|
|
9593
9598
|
async close() {
|
|
9594
|
-
relStores.
|
|
9599
|
+
relStores.clear();
|
|
9595
9600
|
}
|
|
9596
9601
|
};
|
|
9597
9602
|
}
|