@mastra/libsql 1.17.0-alpha.1 → 1.17.0-alpha.3
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 +47 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/factory-storage.d.ts +1 -0
- package/dist/storage/factory-storage.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -13674,6 +13674,20 @@ var LibSQLFactoryStorage = class extends FactoryStorage {
|
|
|
13674
13674
|
async initStorage() {
|
|
13675
13675
|
await this.#client.execute("SELECT 1");
|
|
13676
13676
|
}
|
|
13677
|
+
async withTransaction(fn) {
|
|
13678
|
+
if (this.#config.url.includes(":memory:")) return fn(this.ops);
|
|
13679
|
+
const transaction = await this.#client.transaction("write");
|
|
13680
|
+
try {
|
|
13681
|
+
const result = await fn(new LibSQLFactoryStorageOps(transaction, this.#schemas));
|
|
13682
|
+
await transaction.commit();
|
|
13683
|
+
return result;
|
|
13684
|
+
} catch (error) {
|
|
13685
|
+
await transaction.rollback();
|
|
13686
|
+
throw error;
|
|
13687
|
+
} finally {
|
|
13688
|
+
transaction.close();
|
|
13689
|
+
}
|
|
13690
|
+
}
|
|
13677
13691
|
async ensureCollections(schemas) {
|
|
13678
13692
|
for (const schema of schemas) {
|
|
13679
13693
|
await this.#ensureCollection(schema);
|