@sinoia/hubdoc-tools 1.8.2 → 1.8.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/cli.js +42 -12
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -732813,6 +732813,34 @@ var HubdocFs = class {
|
|
|
732813
732813
|
async uploadUpdate(node) {
|
|
732814
732814
|
await this.uploadNode(node, "update");
|
|
732815
732815
|
}
|
|
732816
|
+
/**
|
|
732817
|
+
* If `node` has unpushed writes, upload them now and clear the dirty flag.
|
|
732818
|
+
* Called from `flush` / `fsync` / `release` so that `close(fd)` (or an
|
|
732819
|
+
* explicit `fsync(fd)`) in userspace blocks until the server has the new
|
|
732820
|
+
* bytes — makes read-after-write via the API (from another process, or
|
|
732821
|
+
* from the same one after close()) immediately consistent.
|
|
732822
|
+
*
|
|
732823
|
+
* The FUSE contract:
|
|
732824
|
+
* - `flush` fires on every `close(2)` in userspace (once per close, even
|
|
732825
|
+
* for dup'd fds).
|
|
732826
|
+
* - `release` fires only after the last reference to the file is dropped
|
|
732827
|
+
* by the kernel — potentially long after `close(2)` returned.
|
|
732828
|
+
* So `flush` (not `release`) is where the upload has to happen for the
|
|
732829
|
+
* close→read-back sequence to be reliable.
|
|
732830
|
+
*/
|
|
732831
|
+
async flushDirty(node) {
|
|
732832
|
+
if (!node.dirty) return;
|
|
732833
|
+
if (this.opts.readOnly) return;
|
|
732834
|
+
if (node.localOnly) {
|
|
732835
|
+
node.dirty = false;
|
|
732836
|
+
node.mtime = /* @__PURE__ */ new Date();
|
|
732837
|
+
return;
|
|
732838
|
+
}
|
|
732839
|
+
if (node.isNew || !node.id) await this.uploadNew(node);
|
|
732840
|
+
else await this.uploadUpdate(node);
|
|
732841
|
+
node.dirty = false;
|
|
732842
|
+
node.mtime = /* @__PURE__ */ new Date();
|
|
732843
|
+
}
|
|
732816
732844
|
invalidateParent(p3) {
|
|
732817
732845
|
const parent = this.nodes.get(parentPath(p3));
|
|
732818
732846
|
if (parent) parent.loadedAt = 0;
|
|
@@ -732956,19 +732984,21 @@ var HubdocFs = class {
|
|
|
732956
732984
|
await import_fs_extra32.default.close(h3.localFd);
|
|
732957
732985
|
} catch {
|
|
732958
732986
|
}
|
|
732959
|
-
|
|
732960
|
-
|
|
732961
|
-
|
|
732962
|
-
|
|
732963
|
-
|
|
732964
|
-
|
|
732965
|
-
|
|
732966
|
-
|
|
732967
|
-
|
|
732987
|
+
await this.flushDirty(h3.node);
|
|
732988
|
+
cb(0);
|
|
732989
|
+
}),
|
|
732990
|
+
flush: wrap(async (_p, fd, cb) => {
|
|
732991
|
+
const h3 = this.handles.get(fd);
|
|
732992
|
+
if (!h3) return cb(0);
|
|
732993
|
+
await this.flushDirty(h3.node);
|
|
732994
|
+
cb(0);
|
|
732995
|
+
}),
|
|
732996
|
+
fsync: wrap(async (_p, fd, _datasync, cb) => {
|
|
732997
|
+
const h3 = this.handles.get(fd);
|
|
732998
|
+
if (!h3) return cb(0);
|
|
732999
|
+
await this.flushDirty(h3.node);
|
|
732968
733000
|
cb(0);
|
|
732969
733001
|
}),
|
|
732970
|
-
flush: (_p, _fd, cb) => cb(0),
|
|
732971
|
-
fsync: (_p, _fd, _datasync, cb) => cb(0),
|
|
732972
733002
|
unlink: wrap(async (p3, cb) => {
|
|
732973
733003
|
if (ro) return cb(Fuse.EACCES);
|
|
732974
733004
|
const node = await this.resolve(p3);
|
|
@@ -733926,7 +733956,7 @@ async function handlePermissionsShow(id, opts) {
|
|
|
733926
733956
|
// apps/cli/cli.ts
|
|
733927
733957
|
var getVersion = () => {
|
|
733928
733958
|
try {
|
|
733929
|
-
if (true) return "1.8.
|
|
733959
|
+
if (true) return "1.8.3";
|
|
733930
733960
|
} catch {
|
|
733931
733961
|
}
|
|
733932
733962
|
for (const candidate of [
|