@deepagents/text2sql 7.6.0 → 7.7.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 +17 -13
- package/dist/index.js.map +2 -2
- package/dist/lib/checkpoint.d.ts +1 -1
- package/dist/lib/checkpoint.d.ts.map +1 -1
- package/dist/lib/sql-command.d.ts +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -1369,6 +1369,7 @@ function errorMessage(error) {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
1371
|
// packages/text2sql/src/lib/checkpoint.ts
|
|
1372
|
+
import { Lock } from "@zukhruf/async";
|
|
1372
1373
|
import { durableWrite } from "@zukhruf/fs";
|
|
1373
1374
|
import { hash as hash2 } from "node:crypto";
|
|
1374
1375
|
import { existsSync as existsSync2, readFileSync } from "node:fs";
|
|
@@ -1392,7 +1393,7 @@ var Checkpoint = class _Checkpoint {
|
|
|
1392
1393
|
path;
|
|
1393
1394
|
configHash;
|
|
1394
1395
|
#clock;
|
|
1395
|
-
#writes =
|
|
1396
|
+
#writes = new Lock();
|
|
1396
1397
|
#changes = 0;
|
|
1397
1398
|
#writtenChanges = 0;
|
|
1398
1399
|
constructor(path6, configHash, clock, points) {
|
|
@@ -1499,18 +1500,21 @@ var Checkpoint = class _Checkpoint {
|
|
|
1499
1500
|
*/
|
|
1500
1501
|
save() {
|
|
1501
1502
|
this.#changes += 1;
|
|
1502
|
-
return this.#writes(
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1503
|
+
return this.#writes.run(
|
|
1504
|
+
async () => {
|
|
1505
|
+
const changes = this.#changes;
|
|
1506
|
+
if (changes === this.#writtenChanges) return;
|
|
1507
|
+
const file = {
|
|
1508
|
+
configHash: this.configHash,
|
|
1509
|
+
points: this.points
|
|
1510
|
+
};
|
|
1511
|
+
await durableWrite(this.path, JSON.stringify(file, null, 2), {
|
|
1512
|
+
clock: this.#clock
|
|
1513
|
+
});
|
|
1514
|
+
this.#writtenChanges = changes;
|
|
1515
|
+
},
|
|
1516
|
+
{ signal: void 0 }
|
|
1517
|
+
);
|
|
1514
1518
|
}
|
|
1515
1519
|
};
|
|
1516
1520
|
function jsonDigest(value) {
|