@zukhruf/sqlite-data-version 0.3.38 → 0.3.39
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/README.md +1 -0
- package/dist/last-write.d.ts.map +1 -1
- package/dist/last-write.js +5 -3
- package/dist/last-write.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ console.log(`The owner last wrote at ${written.toISOString()}`);
|
|
|
78
78
|
- The owner writes through the file and its WAL (`-wal`). The last write is the later of their modification times.
|
|
79
79
|
- The shared-memory index (`-shm`) does not count. A read-only reader writes it too, so its time can be later than the last write of the owner.
|
|
80
80
|
- The owner can remove the WAL when it closes. Then the last write is the time of the file.
|
|
81
|
+
- An empty WAL does not count. A reader that opens the database after the owner removed the WAL makes a new empty WAL, and that WAL has the time of the read. An empty WAL holds no data that the file does not hold.
|
|
81
82
|
- The function reads only the file system. It does not open the database.
|
|
82
83
|
- The macOS privacy controls do not stop it. They stop a process that has no access from reading the file, but not from reading the times of the file.
|
|
83
84
|
|
package/dist/last-write.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"last-write.d.ts","sourceRoot":"","sources":["../src/last-write.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"last-write.d.ts","sourceRoot":"","sources":["../src/last-write.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAa1D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAgB3E"}
|
package/dist/last-write.js
CHANGED
|
@@ -6,12 +6,14 @@ const unreadable = new Set(['ENOENT', 'EACCES']);
|
|
|
6
6
|
// The owner writes a database through its file and its WAL, so the later of
|
|
7
7
|
// their times is when it last wrote. A reader writes the shared-memory index
|
|
8
8
|
// (-shm) too, so its time does not count. The owner may remove the WAL when
|
|
9
|
-
// it closes
|
|
9
|
+
// it closes, and a reader that opens the database then makes an empty one,
|
|
10
|
+
// timed as it reads; an empty WAL holds nothing the file does not, so only a
|
|
11
|
+
// WAL with frames counts.
|
|
10
12
|
export function lastWrite(path, unavailable) {
|
|
11
13
|
try {
|
|
12
14
|
const file = statSync(path).mtimeMs;
|
|
13
|
-
const wal = statSync(`${path}-wal`, { throwIfNoEntry: false })
|
|
14
|
-
return new Date(Math.max(file, wal));
|
|
15
|
+
const wal = statSync(`${path}-wal`, { throwIfNoEntry: false });
|
|
16
|
+
return new Date(wal !== undefined && wal.size > 0 ? Math.max(file, wal.mtimeMs) : file);
|
|
15
17
|
}
|
|
16
18
|
catch (cause) {
|
|
17
19
|
if (cause instanceof Error &&
|
package/dist/last-write.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"last-write.js","sourceRoot":"","sources":["../src/last-write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,2EAA2E;AAC3E,8EAA8E;AAC9E,mDAAmD;AACnD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjD,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"last-write.js","sourceRoot":"","sources":["../src/last-write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,2EAA2E;AAC3E,8EAA8E;AAC9E,mDAAmD;AACnD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjD,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAC7E,0BAA0B;AAC1B,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,WAA6B;IACnE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;QACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,IAAI,MAAM,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/D,OAAO,IAAI,IAAI,CACb,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CACvE,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IACE,KAAK,YAAY,KAAK;YACtB,MAAM,IAAI,KAAK;YACf,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAElC,MAAM,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zukhruf/sqlite-data-version",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.39",
|
|
4
4
|
"description": "The data version of a SQLite database that another process owns and writes. It polls PRAGMA data_version on its own read-only connection, which changes on each commit by another connection, also while the owner keeps the file open.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|