@openclaw/fs-safe 0.17.0 → 0.18.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/CHANGELOG.md +43 -0
- package/dist/absolute-path.d.ts +0 -1
- package/dist/advanced.d.ts +0 -1
- package/dist/archive-crc32.d.ts +0 -1
- package/dist/archive-deadline.d.ts +0 -1
- package/dist/archive-durability.d.ts +0 -1
- package/dist/archive-entry.d.ts +0 -1
- package/dist/archive-errors.d.ts +0 -1
- package/dist/archive-gzip-tail.d.ts +0 -1
- package/dist/archive-input.d.ts +0 -1
- package/dist/archive-kind.d.ts +0 -1
- package/dist/archive-limits.d.ts +0 -1
- package/dist/archive-merge.d.ts +2 -4
- package/dist/archive-merge.js +14 -4
- package/dist/archive-native.d.ts +3 -15
- package/dist/archive-native.js +46 -71
- package/dist/archive-options.d.ts +7 -2
- package/dist/archive-parser-errors.d.ts +0 -1
- package/dist/archive-plan.d.ts +10 -1
- package/dist/archive-plan.js +31 -21
- package/dist/archive-policy.d.ts +0 -1
- package/dist/archive-read.d.ts +0 -1
- package/dist/archive-staging.d.ts +0 -1
- package/dist/archive-tar-inspect.d.ts +0 -1
- package/dist/archive-tar-stream.d.ts +0 -1
- package/dist/archive-tar-wasm.d.ts +0 -1
- package/dist/archive-tar.d.ts +0 -1
- package/dist/archive-zip-admission.d.ts +0 -1
- package/dist/archive-zip-count.d.ts +0 -1
- package/dist/archive-zip-directory.d.ts +0 -1
- package/dist/archive-zip-entry.d.ts +0 -1
- package/dist/archive-zip-integrity.d.ts +0 -1
- package/dist/archive-zip-loader.d.ts +0 -1
- package/dist/archive-zip-manifest.d.ts +0 -1
- package/dist/archive-zip-names.d.ts +0 -1
- package/dist/archive-zip-preflight.d.ts +0 -1
- package/dist/archive.d.ts +0 -1
- package/dist/archive.js +87 -164
- package/dist/async-lock.d.ts +0 -1
- package/dist/atomic.d.ts +0 -1
- package/dist/bounded-read-stream.d.ts +0 -1
- package/dist/bounded-read.d.ts +0 -1
- package/dist/byte-budget.d.ts +0 -1
- package/dist/byte-view.d.ts +0 -1
- package/dist/clone-metadata.d.ts +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/containment.d.ts +0 -1
- package/dist/copy-file-input.d.ts +0 -1
- package/dist/copy-policy.d.ts +0 -1
- package/dist/copy-publication.d.ts +0 -1
- package/dist/copy-tree-portable.d.ts +0 -1
- package/dist/copy-tree-portable.js +9 -6
- package/dist/copy.d.ts +0 -1
- package/dist/copy.js +5 -5
- package/dist/create-directory.d.ts +0 -2
- package/dist/create-directory.js +3 -22
- package/dist/create-file-async.d.ts +0 -1
- package/dist/create-file.d.ts +0 -1
- package/dist/create-file.js +3 -14
- package/dist/create-owned-file.d.ts +0 -1
- package/dist/create.d.ts +1 -2
- package/dist/create.js +1 -1
- package/dist/creation-darwin.d.ts +0 -1
- package/dist/creation-file-state.d.ts +0 -1
- package/dist/creation-path.d.ts +2 -1
- package/dist/creation-path.js +12 -0
- package/dist/creation-permissions.d.ts +0 -1
- package/dist/creation-permissions.js +28 -38
- package/dist/deny-mutations.d.ts +2 -3
- package/dist/deny-mutations.js +55 -35
- package/dist/device-path.d.ts +0 -1
- package/dist/directory-durability.d.ts +0 -1
- package/dist/directory-entry-path.d.ts +0 -1
- package/dist/directory-guard.d.ts +2 -7
- package/dist/directory-guard.js +25 -56
- package/dist/directory-mode-node.d.ts +0 -1
- package/dist/directory-mode-owner.d.ts +0 -1
- package/dist/directory-receipt.d.ts +0 -1
- package/dist/durability.d.ts +0 -1
- package/dist/effective-uid.d.ts +0 -1
- package/dist/error-detail.d.ts +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/file-cleanup.d.ts +0 -1
- package/dist/file-contents.d.ts +0 -1
- package/dist/file-handle-transfer.d.ts +0 -1
- package/dist/file-hash.d.ts +0 -1
- package/dist/file-hash.js +170 -66
- package/dist/file-identity.d.ts +0 -1
- package/dist/file-lock-sync-acquisition.d.ts +22 -0
- package/dist/file-lock-sync-acquisition.js +98 -0
- package/dist/file-lock-sync-admission.d.ts +0 -2
- package/dist/file-lock-sync-admission.js +9 -48
- package/dist/file-lock-sync-root-acquire.d.ts +0 -1
- package/dist/file-lock-sync-root-acquire.js +32 -98
- package/dist/file-lock-sync-root-arbitration.d.ts +0 -1
- package/dist/file-lock-sync-root-held.d.ts +0 -1
- package/dist/file-lock-sync-root-io.d.ts +0 -1
- package/dist/file-lock-sync-root-mutation.d.ts +4 -5
- package/dist/file-lock-sync-root-mutation.js +7 -9
- package/dist/file-lock-sync-root-options.d.ts +0 -1
- package/dist/file-lock-sync-root-registration.d.ts +0 -1
- package/dist/file-lock-sync-root.d.ts +1 -2
- package/dist/file-lock-sync-root.js +14 -87
- package/dist/file-lock-sync-stale-admission.d.ts +2 -7
- package/dist/file-lock-sync-stale-admission.js +21 -23
- package/dist/file-lock-sync.d.ts +0 -1
- package/dist/file-lock-sync.js +38 -117
- package/dist/file-lock.d.ts +0 -1
- package/dist/file-observation.d.ts +0 -1
- package/dist/file-store-boundary.d.ts +0 -2
- package/dist/file-store-boundary.js +6 -26
- package/dist/file-store-copy-source.d.ts +1 -2
- package/dist/file-store-copy-source.js +1 -1
- package/dist/file-store-limit.d.ts +1 -2
- package/dist/file-store-limit.js +2 -3
- package/dist/file-store-path.d.ts +0 -1
- package/dist/file-store-prune.d.ts +0 -1
- package/dist/file-store-sync-directory.d.ts +0 -1
- package/dist/file-store-sync-directory.js +194 -231
- package/dist/file-store-sync-write.d.ts +0 -1
- package/dist/file-store-sync-write.js +16 -26
- package/dist/file-store.d.ts +0 -1
- package/dist/file-store.js +3 -4
- package/dist/file-sync.d.ts +0 -1
- package/dist/filename.d.ts +0 -1
- package/dist/filename.js +1 -7
- package/dist/fs.d.ts +0 -1
- package/dist/guarded-mkdir.d.ts +0 -1
- package/dist/guarded-mutation.d.ts +0 -7
- package/dist/guarded-mutation.js +6 -11
- package/dist/guest-dispatch-python.d.ts +0 -1
- package/dist/guest-dispatch-python.js +41 -90
- package/dist/guest-native-python.d.ts +0 -1
- package/dist/guest.d.ts +0 -1
- package/dist/home-dir.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/install-path.d.ts +0 -1
- package/dist/json-document-store.d.ts +0 -1
- package/dist/json-durable-queue-directory.d.ts +13 -1
- package/dist/json-durable-queue-directory.js +134 -0
- package/dist/json-durable-queue-ownership.d.ts +0 -1
- package/dist/json-durable-queue-ownership.js +42 -61
- package/dist/json-durable-queue-read.d.ts +0 -1
- package/dist/json-durable-queue-read.js +6 -6
- package/dist/json-durable-queue.d.ts +0 -1
- package/dist/json-durable-queue.js +7 -130
- package/dist/json-store.d.ts +0 -1
- package/dist/json-stringify.d.ts +0 -1
- package/dist/json.d.ts +0 -1
- package/dist/json.js +6 -15
- package/dist/local-file-access.d.ts +0 -1
- package/dist/local-file-access.js +3 -10
- package/dist/local-file-descriptor.d.ts +0 -1
- package/dist/local-roots.d.ts +0 -1
- package/dist/lock-config.d.ts +0 -1
- package/dist/move-path-cleanup.d.ts +0 -1
- package/dist/move-path-stage.d.ts +0 -1
- package/dist/move-path.d.ts +0 -1
- package/dist/mutation-authority.d.ts +0 -1
- package/dist/native-binding.d.ts +0 -1
- package/dist/native-config.d.ts +0 -1
- package/dist/native-directory-observation.d.ts +0 -1
- package/dist/native-fallback-warning.d.ts +0 -1
- package/dist/native-operations.d.ts +1 -5
- package/dist/native-operations.js +2 -6
- package/dist/native-parent-admission.d.ts +0 -1
- package/dist/native-pinned-write-windows.d.ts +0 -1
- package/dist/native-pinned-write.d.ts +0 -1
- package/dist/native-pinned-write.js +4 -10
- package/dist/native-policy-directory-observation.d.ts +0 -1
- package/dist/native-policy-parent-windows.d.ts +0 -1
- package/dist/native-rename-outcome.d.ts +0 -1
- package/dist/native-staged-file.d.ts +15 -3
- package/dist/native-staged-file.js +55 -63
- package/dist/native.d.ts +0 -1
- package/dist/opened-file-failure.d.ts +0 -1
- package/dist/opened-realpath.d.ts +0 -1
- package/dist/output.d.ts +0 -1
- package/dist/overwrite-file-handle.d.ts +0 -1
- package/dist/owner-dacl.d.ts +0 -1
- package/dist/path-case.d.ts +0 -1
- package/dist/path-policy.d.ts +0 -1
- package/dist/path-prefix.d.ts +0 -1
- package/dist/path-scope-lexical.d.ts +0 -1
- package/dist/path-segment-route.d.ts +0 -1
- package/dist/path-suffix-aliases.d.ts +0 -1
- package/dist/path.d.ts +0 -1
- package/dist/permission-exec.d.ts +0 -1
- package/dist/permission-exec.js +19 -25
- package/dist/permissions-public.d.ts +0 -1
- package/dist/permissions-windows.d.ts +2 -10
- package/dist/permissions-windows.js +10 -30
- package/dist/permissions.d.ts +0 -1
- package/dist/permissions.js +8 -16
- package/dist/pinned-mutation-admission.d.ts +0 -1
- package/dist/pinned-mutation-observation.d.ts +0 -1
- package/dist/pinned-mutation-shared-route.d.ts +0 -1
- package/dist/pinned-open.d.ts +1 -1
- package/dist/pinned-open.js +1 -1
- package/dist/pinned-operation.d.ts +0 -1
- package/dist/pinned-write-input.d.ts +0 -1
- package/dist/pinned-write-mode.d.ts +0 -1
- package/dist/pinned-write-staged.d.ts +0 -1
- package/dist/pinned-write-types.d.ts +9 -21
- package/dist/pinned-write.d.ts +0 -1
- package/dist/positional-read.d.ts +0 -1
- package/dist/private-directory.d.ts +0 -1
- package/dist/private-producer-handoff-sync.d.ts +0 -1
- package/dist/private-producer-handoff-sync.js +9 -51
- package/dist/private-producer-handoff.d.ts +20 -1
- package/dist/private-producer-handoff.js +69 -46
- package/dist/private-temp-workspace.d.ts +0 -1
- package/dist/private-temp-workspace.js +11 -36
- package/dist/publish-copy-stage.d.ts +0 -1
- package/dist/publish-file-failure.d.ts +0 -1
- package/dist/publish-file.d.ts +0 -1
- package/dist/read-open-flags.d.ts +0 -1
- package/dist/read-opened-file.d.ts +0 -1
- package/dist/realpath.d.ts +0 -1
- package/dist/recursive-mkdir-path.d.ts +0 -1
- package/dist/regular-file.d.ts +0 -1
- package/dist/regular-file.js +77 -139
- package/dist/replace-directory.d.ts +0 -1
- package/dist/replace-file-copy-fallback.d.ts +0 -1
- package/dist/replace-file-copy-fallback.js +14 -3
- package/dist/replace-file-copy-source.d.ts +0 -1
- package/dist/replace-file-copy-source.js +6 -1
- package/dist/replace-file-descriptor.d.ts +0 -1
- package/dist/replace-file-descriptor.js +6 -1
- package/dist/replace-file-mode.d.ts +0 -1
- package/dist/replace-file-rename-policy.d.ts +0 -1
- package/dist/replace-file-temp-owner.d.ts +12 -13
- package/dist/replace-file-temp-owner.js +66 -85
- package/dist/replace-file.d.ts +0 -1
- package/dist/retained-directory-replacement.d.ts +0 -1
- package/dist/root-boundary.d.ts +0 -1
- package/dist/root-context.d.ts +0 -1
- package/dist/root-create-input.d.ts +0 -1
- package/dist/root-directory-creation.d.ts +0 -1
- package/dist/root-directory-list.d.ts +0 -1
- package/dist/root-directory.d.ts +0 -1
- package/dist/root-entries.d.ts +0 -1
- package/dist/root-errors.d.ts +0 -1
- package/dist/root-file-final-admission.d.ts +0 -1
- package/dist/root-file.d.ts +0 -1
- package/dist/root-impl.d.ts +2 -10
- package/dist/root-impl.js +114 -91
- package/dist/root-move-noreplace.d.ts +0 -1
- package/dist/root-move-preflight.d.ts +0 -1
- package/dist/root-observed-path.d.ts +0 -1
- package/dist/root-options.d.ts +0 -1
- package/dist/root-path-errors.d.ts +0 -1
- package/dist/root-path-existing.d.ts +3 -1
- package/dist/root-path-existing.js +39 -18
- package/dist/root-path-observation.d.ts +0 -1
- package/dist/root-path-stat.d.ts +0 -1
- package/dist/root-path.d.ts +0 -1
- package/dist/root-path.js +60 -188
- package/dist/root-paths-lexical.d.ts +0 -1
- package/dist/root-paths.d.ts +0 -1
- package/dist/root-read-admission.d.ts +0 -1
- package/dist/root-read-admission.js +31 -44
- package/dist/root-remove-identity.d.ts +0 -1
- package/dist/root-remove-receipt.d.ts +0 -1
- package/dist/root-remove.d.ts +0 -1
- package/dist/root-symlink-policy.d.ts +0 -1
- package/dist/root-walk.d.ts +0 -1
- package/dist/root-write-admission.d.ts +0 -1
- package/dist/root-write-compatibility.d.ts +0 -1
- package/dist/root-write-complete-parent.d.ts +0 -1
- package/dist/root-write-lock-binding.d.ts +0 -1
- package/dist/root-write-mode.d.ts +0 -1
- package/dist/root-write-publication.d.ts +0 -1
- package/dist/root-write-verification.d.ts +0 -1
- package/dist/root.d.ts +0 -1
- package/dist/safe-path-segment.d.ts +1 -2
- package/dist/safe-path-segment.js +2 -5
- package/dist/secret-file.d.ts +0 -1
- package/dist/secret-file.js +7 -17
- package/dist/secret-read-async.d.ts +0 -1
- package/dist/secret-read-async.js +5 -5
- package/dist/secret-read-policy.d.ts +0 -1
- package/dist/secret.d.ts +0 -1
- package/dist/secure-file-windows.d.ts +0 -6
- package/dist/secure-file-windows.js +13 -28
- package/dist/secure-file.d.ts +0 -1
- package/dist/secure-file.js +9 -9
- package/dist/secure-temp-dir.d.ts +0 -1
- package/dist/secure-temp-repair.d.ts +0 -1
- package/dist/sibling-staged-file.d.ts +0 -1
- package/dist/sibling-staged-file.js +32 -39
- package/dist/sibling-temp.d.ts +0 -1
- package/dist/sidecar-lock-acquire.d.ts +1 -2
- package/dist/sidecar-lock-acquire.js +31 -52
- package/dist/sidecar-lock-admission-context.d.ts +0 -1
- package/dist/sidecar-lock-admission-parser.d.ts +0 -1
- package/dist/sidecar-lock-admission.d.ts +1 -5
- package/dist/sidecar-lock-admission.js +1 -7
- package/dist/sidecar-lock-handle.d.ts +0 -1
- package/dist/sidecar-lock-policy.d.ts +3 -1
- package/dist/sidecar-lock-policy.js +16 -0
- package/dist/sidecar-lock-reclaim.d.ts +0 -1
- package/dist/sidecar-lock-registration.d.ts +13 -0
- package/dist/sidecar-lock-registration.js +47 -0
- package/dist/sidecar-lock-root.d.ts +0 -1
- package/dist/sidecar-lock-stale-admission.d.ts +0 -1
- package/dist/sidecar-lock-target.d.ts +0 -1
- package/dist/sidecar-lock-types.d.ts +0 -1
- package/dist/sidecar-lock.d.ts +0 -1
- package/dist/sidecar-lock.js +16 -83
- package/dist/staged-directory.d.ts +0 -1
- package/dist/staged-file-settlement.d.ts +0 -1
- package/dist/staged-file-types.d.ts +0 -1
- package/dist/standalone-publication-path.d.ts +0 -1
- package/dist/stat-observation.d.ts +0 -1
- package/dist/store.d.ts +0 -1
- package/dist/strict-file-identity.d.ts +0 -1
- package/dist/string-coerce.d.ts +0 -1
- package/dist/suppressed-error.d.ts +0 -1
- package/dist/symlink-parents.d.ts +0 -1
- package/dist/temp-cleanup.d.ts +0 -1
- package/dist/temp-target.d.ts +0 -1
- package/dist/temp-target.js +7 -46
- package/dist/temp-workspace-admission.d.ts +0 -8
- package/dist/temp-workspace-admission.js +0 -4
- package/dist/temp-workspace-child-admission.d.ts +0 -4
- package/dist/temp-workspace-child-admission.js +0 -12
- package/dist/temp-workspace-descriptor.d.ts +0 -6
- package/dist/temp-workspace-descriptor.js +0 -2
- package/dist/temp-workspace-identity.d.ts +0 -1
- package/dist/temp-workspace-owner.d.ts +1 -1
- package/dist/temp-workspace-owner.js +45 -22
- package/dist/temp-workspace-permissions.d.ts +0 -1
- package/dist/temp-workspace-types.d.ts +0 -1
- package/dist/temp.d.ts +0 -1
- package/dist/test-hooks.d.ts +0 -1
- package/dist/text-atomic.d.ts +0 -1
- package/dist/timing.d.ts +0 -1
- package/dist/trash.d.ts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/unicode-path.d.ts +0 -1
- package/dist/walk.d.ts +0 -1
- package/dist/windows-command.d.ts +0 -1
- package/dist/windows-owner.d.ts +0 -1
- package/dist/windows-owner.js +4 -1
- package/dist/windows-path-alias.d.ts +0 -1
- package/dist/windows-path-alias.js +7 -43
- package/dist/windows-path-syntax.d.ts +5 -0
- package/dist/windows-path-syntax.js +21 -0
- package/dist/windows-security-command.d.ts +0 -1
- package/dist/windows-security-facts.d.ts +0 -1
- package/dist/write-file-handle.d.ts +0 -1
- package/dist/write-open-flags.d.ts +0 -1
- package/dist/write-queue.d.ts +0 -1
- package/docs/atomic.md +14 -0
- package/docs/copy.md +2 -0
- package/docs/mutation-policy-proof.md +6 -4
- package/docs/permissions.md +6 -0
- package/docs/root.md +10 -0
- package/docs/secret-file.md +4 -0
- package/docs/writing.md +9 -3
- package/package.json +8 -9
- package/dist/absolute-path.d.ts.map +0 -1
- package/dist/advanced.d.ts.map +0 -1
- package/dist/archive-crc32.d.ts.map +0 -1
- package/dist/archive-deadline.d.ts.map +0 -1
- package/dist/archive-durability.d.ts.map +0 -1
- package/dist/archive-entry.d.ts.map +0 -1
- package/dist/archive-errors.d.ts.map +0 -1
- package/dist/archive-gzip-tail.d.ts.map +0 -1
- package/dist/archive-input.d.ts.map +0 -1
- package/dist/archive-kind.d.ts.map +0 -1
- package/dist/archive-limits.d.ts.map +0 -1
- package/dist/archive-merge.d.ts.map +0 -1
- package/dist/archive-native.d.ts.map +0 -1
- package/dist/archive-options.d.ts.map +0 -1
- package/dist/archive-parser-errors.d.ts.map +0 -1
- package/dist/archive-plan.d.ts.map +0 -1
- package/dist/archive-policy.d.ts.map +0 -1
- package/dist/archive-read.d.ts.map +0 -1
- package/dist/archive-staging.d.ts.map +0 -1
- package/dist/archive-tar-inspect.d.ts.map +0 -1
- package/dist/archive-tar-stream.d.ts.map +0 -1
- package/dist/archive-tar-wasm.d.ts.map +0 -1
- package/dist/archive-tar.d.ts.map +0 -1
- package/dist/archive-zip-admission.d.ts.map +0 -1
- package/dist/archive-zip-count.d.ts.map +0 -1
- package/dist/archive-zip-directory.d.ts.map +0 -1
- package/dist/archive-zip-entry.d.ts.map +0 -1
- package/dist/archive-zip-integrity.d.ts.map +0 -1
- package/dist/archive-zip-loader.d.ts.map +0 -1
- package/dist/archive-zip-manifest.d.ts.map +0 -1
- package/dist/archive-zip-names.d.ts.map +0 -1
- package/dist/archive-zip-preflight.d.ts.map +0 -1
- package/dist/archive.d.ts.map +0 -1
- package/dist/async-lock.d.ts.map +0 -1
- package/dist/atomic.d.ts.map +0 -1
- package/dist/bounded-read-stream.d.ts.map +0 -1
- package/dist/bounded-read.d.ts.map +0 -1
- package/dist/byte-budget.d.ts.map +0 -1
- package/dist/byte-view.d.ts.map +0 -1
- package/dist/clone-metadata.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/containment.d.ts.map +0 -1
- package/dist/copy-file-input.d.ts.map +0 -1
- package/dist/copy-policy.d.ts.map +0 -1
- package/dist/copy-publication.d.ts.map +0 -1
- package/dist/copy-tree-portable.d.ts.map +0 -1
- package/dist/copy.d.ts.map +0 -1
- package/dist/create-directory.d.ts.map +0 -1
- package/dist/create-file-async.d.ts.map +0 -1
- package/dist/create-file.d.ts.map +0 -1
- package/dist/create-owned-file.d.ts.map +0 -1
- package/dist/create.d.ts.map +0 -1
- package/dist/creation-darwin.d.ts.map +0 -1
- package/dist/creation-file-state.d.ts.map +0 -1
- package/dist/creation-path.d.ts.map +0 -1
- package/dist/creation-permissions.d.ts.map +0 -1
- package/dist/deny-mutations.d.ts.map +0 -1
- package/dist/device-path.d.ts.map +0 -1
- package/dist/directory-durability.d.ts.map +0 -1
- package/dist/directory-entry-path.d.ts.map +0 -1
- package/dist/directory-guard.d.ts.map +0 -1
- package/dist/directory-mode-node.d.ts.map +0 -1
- package/dist/directory-mode-owner.d.ts.map +0 -1
- package/dist/directory-receipt.d.ts.map +0 -1
- package/dist/durability.d.ts.map +0 -1
- package/dist/effective-uid.d.ts.map +0 -1
- package/dist/error-detail.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/file-cleanup.d.ts.map +0 -1
- package/dist/file-contents.d.ts.map +0 -1
- package/dist/file-handle-transfer.d.ts.map +0 -1
- package/dist/file-hash.d.ts.map +0 -1
- package/dist/file-identity.d.ts.map +0 -1
- package/dist/file-lock-sync-admission.d.ts.map +0 -1
- package/dist/file-lock-sync-root-acquire.d.ts.map +0 -1
- package/dist/file-lock-sync-root-arbitration.d.ts.map +0 -1
- package/dist/file-lock-sync-root-held.d.ts.map +0 -1
- package/dist/file-lock-sync-root-io.d.ts.map +0 -1
- package/dist/file-lock-sync-root-mutation.d.ts.map +0 -1
- package/dist/file-lock-sync-root-options.d.ts.map +0 -1
- package/dist/file-lock-sync-root-registration.d.ts.map +0 -1
- package/dist/file-lock-sync-root.d.ts.map +0 -1
- package/dist/file-lock-sync-stale-admission.d.ts.map +0 -1
- package/dist/file-lock-sync.d.ts.map +0 -1
- package/dist/file-lock.d.ts.map +0 -1
- package/dist/file-observation.d.ts.map +0 -1
- package/dist/file-store-boundary.d.ts.map +0 -1
- package/dist/file-store-copy-source.d.ts.map +0 -1
- package/dist/file-store-limit.d.ts.map +0 -1
- package/dist/file-store-path.d.ts.map +0 -1
- package/dist/file-store-prune.d.ts.map +0 -1
- package/dist/file-store-sync-directory.d.ts.map +0 -1
- package/dist/file-store-sync-write.d.ts.map +0 -1
- package/dist/file-store.d.ts.map +0 -1
- package/dist/file-sync.d.ts.map +0 -1
- package/dist/filename.d.ts.map +0 -1
- package/dist/fs.d.ts.map +0 -1
- package/dist/guarded-mkdir.d.ts.map +0 -1
- package/dist/guarded-mutation.d.ts.map +0 -1
- package/dist/guest-dispatch-python.d.ts.map +0 -1
- package/dist/guest-native-python.d.ts.map +0 -1
- package/dist/guest.d.ts.map +0 -1
- package/dist/home-dir.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/install-path.d.ts.map +0 -1
- package/dist/json-document-store.d.ts.map +0 -1
- package/dist/json-durable-queue-directory.d.ts.map +0 -1
- package/dist/json-durable-queue-ownership.d.ts.map +0 -1
- package/dist/json-durable-queue-paths.d.ts +0 -11
- package/dist/json-durable-queue-paths.d.ts.map +0 -1
- package/dist/json-durable-queue-paths.js +0 -20
- package/dist/json-durable-queue-read.d.ts.map +0 -1
- package/dist/json-durable-queue.d.ts.map +0 -1
- package/dist/json-store.d.ts.map +0 -1
- package/dist/json-stringify.d.ts.map +0 -1
- package/dist/json.d.ts.map +0 -1
- package/dist/local-file-access.d.ts.map +0 -1
- package/dist/local-file-descriptor.d.ts.map +0 -1
- package/dist/local-roots.d.ts.map +0 -1
- package/dist/lock-config.d.ts.map +0 -1
- package/dist/move-path-cleanup.d.ts.map +0 -1
- package/dist/move-path-stage.d.ts.map +0 -1
- package/dist/move-path.d.ts.map +0 -1
- package/dist/mutation-authority.d.ts.map +0 -1
- package/dist/native-binding.d.ts.map +0 -1
- package/dist/native-config.d.ts.map +0 -1
- package/dist/native-directory-observation.d.ts.map +0 -1
- package/dist/native-fallback-warning.d.ts.map +0 -1
- package/dist/native-operations.d.ts.map +0 -1
- package/dist/native-parent-admission.d.ts.map +0 -1
- package/dist/native-pinned-write-windows.d.ts.map +0 -1
- package/dist/native-pinned-write.d.ts.map +0 -1
- package/dist/native-policy-directory-observation.d.ts.map +0 -1
- package/dist/native-policy-parent-windows.d.ts.map +0 -1
- package/dist/native-rename-outcome.d.ts.map +0 -1
- package/dist/native-staged-file.d.ts.map +0 -1
- package/dist/native.d.ts.map +0 -1
- package/dist/opened-file-failure.d.ts.map +0 -1
- package/dist/opened-realpath.d.ts.map +0 -1
- package/dist/output.d.ts.map +0 -1
- package/dist/overwrite-file-handle.d.ts.map +0 -1
- package/dist/owner-dacl.d.ts.map +0 -1
- package/dist/path-case.d.ts.map +0 -1
- package/dist/path-policy.d.ts.map +0 -1
- package/dist/path-prefix.d.ts.map +0 -1
- package/dist/path-scope-lexical.d.ts.map +0 -1
- package/dist/path-segment-route.d.ts.map +0 -1
- package/dist/path-suffix-aliases.d.ts.map +0 -1
- package/dist/path.d.ts.map +0 -1
- package/dist/permission-exec.d.ts.map +0 -1
- package/dist/permissions-public.d.ts.map +0 -1
- package/dist/permissions-windows.d.ts.map +0 -1
- package/dist/permissions.d.ts.map +0 -1
- package/dist/pinned-mutation-admission.d.ts.map +0 -1
- package/dist/pinned-mutation-observation.d.ts.map +0 -1
- package/dist/pinned-mutation-shared-route.d.ts.map +0 -1
- package/dist/pinned-open.d.ts.map +0 -1
- package/dist/pinned-operation.d.ts.map +0 -1
- package/dist/pinned-write-input.d.ts.map +0 -1
- package/dist/pinned-write-mode.d.ts.map +0 -1
- package/dist/pinned-write-staged.d.ts.map +0 -1
- package/dist/pinned-write-types.d.ts.map +0 -1
- package/dist/pinned-write.d.ts.map +0 -1
- package/dist/positional-read.d.ts.map +0 -1
- package/dist/private-directory.d.ts.map +0 -1
- package/dist/private-producer-handoff-sync.d.ts.map +0 -1
- package/dist/private-producer-handoff.d.ts.map +0 -1
- package/dist/private-temp-workspace.d.ts.map +0 -1
- package/dist/publish-copy-stage.d.ts.map +0 -1
- package/dist/publish-file-failure.d.ts.map +0 -1
- package/dist/publish-file.d.ts.map +0 -1
- package/dist/read-open-flags.d.ts.map +0 -1
- package/dist/read-opened-file.d.ts.map +0 -1
- package/dist/realpath.d.ts.map +0 -1
- package/dist/recursive-mkdir-path.d.ts.map +0 -1
- package/dist/regular-file.d.ts.map +0 -1
- package/dist/replace-directory.d.ts.map +0 -1
- package/dist/replace-file-copy-fallback.d.ts.map +0 -1
- package/dist/replace-file-copy-source.d.ts.map +0 -1
- package/dist/replace-file-descriptor.d.ts.map +0 -1
- package/dist/replace-file-mode.d.ts.map +0 -1
- package/dist/replace-file-rename-policy.d.ts.map +0 -1
- package/dist/replace-file-temp-owner.d.ts.map +0 -1
- package/dist/replace-file.d.ts.map +0 -1
- package/dist/retained-directory-replacement.d.ts.map +0 -1
- package/dist/root-boundary.d.ts.map +0 -1
- package/dist/root-context.d.ts.map +0 -1
- package/dist/root-create-input.d.ts.map +0 -1
- package/dist/root-directory-creation.d.ts.map +0 -1
- package/dist/root-directory-list.d.ts.map +0 -1
- package/dist/root-directory.d.ts.map +0 -1
- package/dist/root-entries.d.ts.map +0 -1
- package/dist/root-errors.d.ts.map +0 -1
- package/dist/root-file-final-admission.d.ts.map +0 -1
- package/dist/root-file.d.ts.map +0 -1
- package/dist/root-impl.d.ts.map +0 -1
- package/dist/root-move-noreplace.d.ts.map +0 -1
- package/dist/root-move-preflight.d.ts.map +0 -1
- package/dist/root-observed-path.d.ts.map +0 -1
- package/dist/root-options.d.ts.map +0 -1
- package/dist/root-path-errors.d.ts.map +0 -1
- package/dist/root-path-existing.d.ts.map +0 -1
- package/dist/root-path-observation.d.ts.map +0 -1
- package/dist/root-path-stat.d.ts.map +0 -1
- package/dist/root-path-symlink.d.ts +0 -7
- package/dist/root-path-symlink.d.ts.map +0 -1
- package/dist/root-path-symlink.js +0 -55
- package/dist/root-path.d.ts.map +0 -1
- package/dist/root-paths-lexical.d.ts.map +0 -1
- package/dist/root-paths.d.ts.map +0 -1
- package/dist/root-read-admission.d.ts.map +0 -1
- package/dist/root-remove-identity.d.ts.map +0 -1
- package/dist/root-remove-receipt.d.ts.map +0 -1
- package/dist/root-remove.d.ts.map +0 -1
- package/dist/root-symlink-policy.d.ts.map +0 -1
- package/dist/root-walk.d.ts.map +0 -1
- package/dist/root-write-admission.d.ts.map +0 -1
- package/dist/root-write-compatibility.d.ts.map +0 -1
- package/dist/root-write-complete-parent.d.ts.map +0 -1
- package/dist/root-write-lock-binding.d.ts.map +0 -1
- package/dist/root-write-mode.d.ts.map +0 -1
- package/dist/root-write-publication.d.ts.map +0 -1
- package/dist/root-write-verification.d.ts.map +0 -1
- package/dist/root.d.ts.map +0 -1
- package/dist/safe-path-segment.d.ts.map +0 -1
- package/dist/secret-file.d.ts.map +0 -1
- package/dist/secret-read-async.d.ts.map +0 -1
- package/dist/secret-read-policy.d.ts.map +0 -1
- package/dist/secret.d.ts.map +0 -1
- package/dist/secure-file-windows.d.ts.map +0 -1
- package/dist/secure-file.d.ts.map +0 -1
- package/dist/secure-temp-dir.d.ts.map +0 -1
- package/dist/secure-temp-repair.d.ts.map +0 -1
- package/dist/sibling-staged-file.d.ts.map +0 -1
- package/dist/sibling-temp.d.ts.map +0 -1
- package/dist/sidecar-lock-acquire.d.ts.map +0 -1
- package/dist/sidecar-lock-admission-context.d.ts.map +0 -1
- package/dist/sidecar-lock-admission-parser.d.ts.map +0 -1
- package/dist/sidecar-lock-admission.d.ts.map +0 -1
- package/dist/sidecar-lock-handle.d.ts.map +0 -1
- package/dist/sidecar-lock-policy.d.ts.map +0 -1
- package/dist/sidecar-lock-reclaim.d.ts.map +0 -1
- package/dist/sidecar-lock-root.d.ts.map +0 -1
- package/dist/sidecar-lock-stale-admission.d.ts.map +0 -1
- package/dist/sidecar-lock-target.d.ts.map +0 -1
- package/dist/sidecar-lock-types.d.ts.map +0 -1
- package/dist/sidecar-lock.d.ts.map +0 -1
- package/dist/staged-directory.d.ts.map +0 -1
- package/dist/staged-file-settlement.d.ts.map +0 -1
- package/dist/staged-file-types.d.ts.map +0 -1
- package/dist/standalone-publication-path.d.ts.map +0 -1
- package/dist/stat-observation.d.ts.map +0 -1
- package/dist/store.d.ts.map +0 -1
- package/dist/strict-file-identity.d.ts.map +0 -1
- package/dist/string-coerce.d.ts.map +0 -1
- package/dist/suppressed-error.d.ts.map +0 -1
- package/dist/symlink-parents.d.ts.map +0 -1
- package/dist/temp-cleanup.d.ts.map +0 -1
- package/dist/temp-target.d.ts.map +0 -1
- package/dist/temp-workspace-admission.d.ts.map +0 -1
- package/dist/temp-workspace-child-admission.d.ts.map +0 -1
- package/dist/temp-workspace-descriptor.d.ts.map +0 -1
- package/dist/temp-workspace-identity.d.ts.map +0 -1
- package/dist/temp-workspace-owner.d.ts.map +0 -1
- package/dist/temp-workspace-permissions.d.ts.map +0 -1
- package/dist/temp-workspace-types.d.ts.map +0 -1
- package/dist/temp.d.ts.map +0 -1
- package/dist/test-hooks.d.ts.map +0 -1
- package/dist/text-atomic.d.ts.map +0 -1
- package/dist/timing.d.ts.map +0 -1
- package/dist/trash.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/unicode-path.d.ts.map +0 -1
- package/dist/walk.d.ts.map +0 -1
- package/dist/windows-command.d.ts.map +0 -1
- package/dist/windows-owner.d.ts.map +0 -1
- package/dist/windows-path-alias.d.ts.map +0 -1
- package/dist/windows-security-command.d.ts.map +0 -1
- package/dist/windows-security-facts.d.ts.map +0 -1
- package/dist/write-file-handle.d.ts.map +0 -1
- package/dist/write-open-flags.d.ts.map +0 -1
- package/dist/write-queue.d.ts.map +0 -1
|
@@ -28,116 +28,6 @@ function inspectStoreDirectory(params) {
|
|
|
28
28
|
return stat;
|
|
29
29
|
}, params.expected);
|
|
30
30
|
}
|
|
31
|
-
function observeStoreDirectory(params) {
|
|
32
|
-
return {
|
|
33
|
-
dir: params.dir,
|
|
34
|
-
stat: inspectStoreDirectory(params),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function inspectReceiptCurrent(receipt, messagePrefix, root) {
|
|
38
|
-
try {
|
|
39
|
-
const stat = inspectStoreDirectory({
|
|
40
|
-
dir: receipt.dir,
|
|
41
|
-
expected: receipt.stat,
|
|
42
|
-
messagePrefix,
|
|
43
|
-
root,
|
|
44
|
-
});
|
|
45
|
-
if (stat.dev !== receipt.stat.dev || stat.ino !== receipt.stat.ino) {
|
|
46
|
-
throw changedStoreDirectory(messagePrefix);
|
|
47
|
-
}
|
|
48
|
-
return stat;
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
if (error instanceof FsSafeError && error.code === "outside-workspace")
|
|
52
|
-
throw error;
|
|
53
|
-
throw changedStoreDirectory(messagePrefix, error);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function assertRootCurrent(rootReceipt, rootReal, messagePrefix) {
|
|
57
|
-
const stat = inspectReceiptCurrent(rootReceipt, messagePrefix, true);
|
|
58
|
-
try {
|
|
59
|
-
if (storeDirectoryRealPath(rootReceipt.dir) !== rootReal) {
|
|
60
|
-
throw changedStoreDirectory(messagePrefix);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
if (error instanceof FsSafeError && error.code === "outside-workspace")
|
|
65
|
-
throw error;
|
|
66
|
-
throw changedStoreDirectory(messagePrefix, error);
|
|
67
|
-
}
|
|
68
|
-
return stat;
|
|
69
|
-
}
|
|
70
|
-
function assertAdmittedEdgeCurrent(receipts, rootReal, messagePrefix) {
|
|
71
|
-
const rootReceipt = receipts[0];
|
|
72
|
-
const targetIndex = receipts.length - 1;
|
|
73
|
-
const targetReceipt = receipts[targetIndex];
|
|
74
|
-
if (!rootReceipt || !targetReceipt) {
|
|
75
|
-
throw new FsSafeError("helper-failed", "store directory receipt is missing");
|
|
76
|
-
}
|
|
77
|
-
const rootStat = rootReal === undefined
|
|
78
|
-
? inspectReceiptCurrent(rootReceipt, messagePrefix, true)
|
|
79
|
-
: assertRootCurrent(rootReceipt, rootReal, messagePrefix);
|
|
80
|
-
if (targetIndex === 0)
|
|
81
|
-
return rootStat;
|
|
82
|
-
const parent = receipts[targetIndex - 1];
|
|
83
|
-
if (!parent)
|
|
84
|
-
throw new FsSafeError("helper-failed", "store directory receipt is missing");
|
|
85
|
-
if (targetIndex > 1)
|
|
86
|
-
inspectReceiptCurrent(parent, messagePrefix, false);
|
|
87
|
-
const targetStat = inspectReceiptCurrent(targetReceipt, messagePrefix, false);
|
|
88
|
-
if (path.dirname(targetReceipt.dir) !== parent.dir) {
|
|
89
|
-
throw changedStoreDirectory(messagePrefix);
|
|
90
|
-
}
|
|
91
|
-
return targetStat;
|
|
92
|
-
}
|
|
93
|
-
function assertModeTargetCurrent(receipts, rootReal, messagePrefix) {
|
|
94
|
-
const root = receipts[0];
|
|
95
|
-
const target = receipts.at(-1);
|
|
96
|
-
if (!root || !target)
|
|
97
|
-
throw new FsSafeError("helper-failed", "store directory receipt is missing");
|
|
98
|
-
// The target's canonical observation shares the exact identity fence. Keep
|
|
99
|
-
// the trailing root canonical check: an ancestor relocation can retain IDs.
|
|
100
|
-
assertAdmittedEdgeCurrent(receipts, undefined, messagePrefix);
|
|
101
|
-
let targetReal;
|
|
102
|
-
try {
|
|
103
|
-
targetReal = storeDirectoryRealPath(target.dir);
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
throw changedStoreDirectory(messagePrefix, error);
|
|
107
|
-
}
|
|
108
|
-
if (target === root ? targetReal !== rootReal : !isPathInside(rootReal, targetReal)) {
|
|
109
|
-
throw changedStoreDirectory(messagePrefix);
|
|
110
|
-
}
|
|
111
|
-
return assertAdmittedEdgeCurrent(receipts, rootReal, messagePrefix);
|
|
112
|
-
}
|
|
113
|
-
function assertReceiptChain(receipts, rootReal, messagePrefix) {
|
|
114
|
-
const rootReceipt = receipts[0];
|
|
115
|
-
const finalReceipt = receipts.at(-1);
|
|
116
|
-
if (!rootReceipt || !finalReceipt) {
|
|
117
|
-
throw new FsSafeError("helper-failed", "store directory receipt is missing");
|
|
118
|
-
}
|
|
119
|
-
assertRootCurrent(rootReceipt, rootReal, messagePrefix);
|
|
120
|
-
let finalStat = rootReceipt.stat;
|
|
121
|
-
for (const [index, receipt] of receipts.entries()) {
|
|
122
|
-
if (index === 0)
|
|
123
|
-
continue;
|
|
124
|
-
finalStat = inspectReceiptCurrent(receipt, messagePrefix, false);
|
|
125
|
-
}
|
|
126
|
-
let finalReal;
|
|
127
|
-
try {
|
|
128
|
-
finalReal = storeDirectoryRealPath(finalReceipt.dir);
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
throw changedStoreDirectory(messagePrefix, error);
|
|
132
|
-
}
|
|
133
|
-
if (!isPathInside(rootReal, finalReal))
|
|
134
|
-
throw changedStoreDirectory(messagePrefix);
|
|
135
|
-
assertRootCurrent(rootReceipt, rootReal, messagePrefix);
|
|
136
|
-
if (finalReceipt !== rootReceipt) {
|
|
137
|
-
finalStat = inspectReceiptCurrent(finalReceipt, messagePrefix, false);
|
|
138
|
-
}
|
|
139
|
-
return { finalReal, finalStat };
|
|
140
|
-
}
|
|
141
31
|
function directoryOpenFlags() {
|
|
142
32
|
const { O_DIRECTORY, O_NOFOLLOW, O_NONBLOCK, O_RDONLY } = fs.constants;
|
|
143
33
|
if ([O_DIRECTORY, O_NOFOLLOW, O_NONBLOCK, O_RDONLY]
|
|
@@ -169,106 +59,209 @@ function hasErrorCode(error, code) {
|
|
|
169
59
|
}
|
|
170
60
|
return false;
|
|
171
61
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
62
|
+
class StoreDirectoryChain {
|
|
63
|
+
messagePrefix;
|
|
64
|
+
receipts = [];
|
|
65
|
+
rootReal;
|
|
66
|
+
constructor(rootDir, messagePrefix) {
|
|
67
|
+
this.messagePrefix = messagePrefix;
|
|
68
|
+
this.observe(rootDir);
|
|
69
|
+
this.rootReal = storeDirectoryRealPath(rootDir);
|
|
70
|
+
}
|
|
71
|
+
observe(dir) {
|
|
72
|
+
this.receipts.push({
|
|
73
|
+
dir,
|
|
74
|
+
stat: inspectStoreDirectory({
|
|
75
|
+
dir,
|
|
76
|
+
messagePrefix: this.messagePrefix,
|
|
77
|
+
root: this.receipts.length === 0,
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
179
80
|
}
|
|
180
|
-
|
|
181
|
-
if (searchFlags !== undefined) {
|
|
81
|
+
inspectReceipt(receipt, root = false) {
|
|
182
82
|
try {
|
|
183
|
-
|
|
83
|
+
const stat = inspectStoreDirectory({
|
|
84
|
+
dir: receipt.dir,
|
|
85
|
+
expected: receipt.stat,
|
|
86
|
+
messagePrefix: this.messagePrefix,
|
|
87
|
+
root,
|
|
88
|
+
});
|
|
89
|
+
if (stat.dev !== receipt.stat.dev || stat.ino !== receipt.stat.ino) {
|
|
90
|
+
throw changedStoreDirectory(this.messagePrefix);
|
|
91
|
+
}
|
|
92
|
+
return stat;
|
|
184
93
|
}
|
|
185
|
-
catch (
|
|
186
|
-
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (error instanceof FsSafeError && error.code === "outside-workspace")
|
|
96
|
+
throw error;
|
|
97
|
+
throw changedStoreDirectory(this.messagePrefix, error);
|
|
187
98
|
}
|
|
188
99
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return BigInt(mode & 0o7777);
|
|
202
|
-
}
|
|
203
|
-
function inspectOpenedStoreDirectory(descriptor, receipt, messagePrefix) {
|
|
204
|
-
try {
|
|
205
|
-
const stat = inspectFileIdentitySync(() => fs.fstatSync(descriptor, { bigint: true }), receipt.stat);
|
|
206
|
-
if (!stat.isDirectory() || stat.isSymbolicLink()) {
|
|
207
|
-
throw changedStoreDirectory(messagePrefix);
|
|
100
|
+
assertRoot() {
|
|
101
|
+
const root = this.receipts[0];
|
|
102
|
+
const stat = this.inspectReceipt(root, true);
|
|
103
|
+
try {
|
|
104
|
+
if (storeDirectoryRealPath(root.dir) !== this.rootReal) {
|
|
105
|
+
throw changedStoreDirectory(this.messagePrefix);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
if (error instanceof FsSafeError && error.code === "outside-workspace")
|
|
110
|
+
throw error;
|
|
111
|
+
throw changedStoreDirectory(this.messagePrefix, error);
|
|
208
112
|
}
|
|
209
113
|
return stat;
|
|
210
114
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
// Identity can remain stable while permissions change after the first receipt.
|
|
225
|
-
if (process.platform === "win32" || (current.mode & 4095n) === requestedMode) {
|
|
226
|
-
return { ...receipt, stat: current };
|
|
115
|
+
assertEdge(canonicalRoot = true) {
|
|
116
|
+
const targetIndex = this.receipts.length - 1;
|
|
117
|
+
const rootStat = canonicalRoot
|
|
118
|
+
? this.assertRoot() : this.inspectReceipt(this.receipts[0], true);
|
|
119
|
+
if (targetIndex === 0)
|
|
120
|
+
return rootStat;
|
|
121
|
+
const parent = this.receipts[targetIndex - 1];
|
|
122
|
+
if (targetIndex > 1)
|
|
123
|
+
this.inspectReceipt(parent);
|
|
124
|
+
const target = this.receipts[targetIndex];
|
|
125
|
+
const targetStat = this.inspectReceipt(target);
|
|
126
|
+
if (path.dirname(target.dir) !== parent.dir) {
|
|
127
|
+
throw changedStoreDirectory(this.messagePrefix);
|
|
227
128
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
let operationError;
|
|
240
|
-
try {
|
|
241
|
-
const opened = inspectOpenedStoreDirectory(descriptor, receipt, params.messagePrefix);
|
|
242
|
-
assertModeTargetCurrent(params.receipts, params.rootReal, params.messagePrefix);
|
|
243
|
-
if ((opened.mode & 4095n) !== requestedMode) {
|
|
244
|
-
fs.fchmodSync(descriptor, Number(requestedMode));
|
|
129
|
+
return targetStat;
|
|
130
|
+
}
|
|
131
|
+
assertModeTarget() {
|
|
132
|
+
const root = this.receipts[0];
|
|
133
|
+
const target = this.receipts.at(-1);
|
|
134
|
+
// The target's canonical observation shares the exact identity fence. Keep
|
|
135
|
+
// the trailing root canonical check: an ancestor relocation can retain IDs.
|
|
136
|
+
this.assertEdge(false);
|
|
137
|
+
let targetReal;
|
|
138
|
+
try {
|
|
139
|
+
targetReal = storeDirectoryRealPath(target.dir);
|
|
245
140
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if ((finalized.mode & 4095n) !== requestedMode ||
|
|
249
|
-
(pathname.mode & 4095n) !== requestedMode) {
|
|
250
|
-
throw new FsSafeError("insecure-permissions", `${params.messagePrefix} directory mode could not be finalized`);
|
|
141
|
+
catch (error) {
|
|
142
|
+
throw changedStoreDirectory(this.messagePrefix, error);
|
|
251
143
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
144
|
+
if (target === root ? targetReal !== this.rootReal : !isPathInside(this.rootReal, targetReal)) {
|
|
145
|
+
throw changedStoreDirectory(this.messagePrefix);
|
|
146
|
+
}
|
|
147
|
+
return this.assertEdge();
|
|
148
|
+
}
|
|
149
|
+
finish(dir) {
|
|
150
|
+
const root = this.receipts[0];
|
|
151
|
+
const target = this.receipts.at(-1);
|
|
152
|
+
this.assertRoot();
|
|
153
|
+
let finalStat = root.stat;
|
|
154
|
+
for (const [index, receipt] of this.receipts.entries()) {
|
|
155
|
+
if (index === 0)
|
|
156
|
+
continue;
|
|
157
|
+
finalStat = this.inspectReceipt(receipt);
|
|
158
|
+
}
|
|
159
|
+
let finalReal;
|
|
160
|
+
try {
|
|
161
|
+
finalReal = storeDirectoryRealPath(target.dir);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
throw changedStoreDirectory(this.messagePrefix, error);
|
|
165
|
+
}
|
|
166
|
+
if (!isPathInside(this.rootReal, finalReal))
|
|
167
|
+
throw changedStoreDirectory(this.messagePrefix);
|
|
168
|
+
this.assertRoot();
|
|
169
|
+
if (target !== root)
|
|
170
|
+
finalStat = this.inspectReceipt(target);
|
|
171
|
+
return { dir, realPath: finalReal, exactStat: finalStat };
|
|
172
|
+
}
|
|
173
|
+
openForMode(receipt) {
|
|
174
|
+
let openError;
|
|
175
|
+
try {
|
|
176
|
+
return fs.openSync(pathForWindowsFilesystem(receipt.dir), directoryOpenFlags());
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
openError = error;
|
|
180
|
+
}
|
|
181
|
+
const searchFlags = hasErrorCode(openError, "EACCES") ? directorySearchFlags() : undefined;
|
|
182
|
+
if (searchFlags !== undefined) {
|
|
183
|
+
try {
|
|
184
|
+
return fs.openSync(pathForWindowsFilesystem(receipt.dir), searchFlags);
|
|
185
|
+
}
|
|
186
|
+
catch (searchError) {
|
|
187
|
+
openError = createSuppressedError(searchError, openError, "ordinary and search-only directory opens both failed");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
this.assertModeTarget();
|
|
192
|
+
}
|
|
193
|
+
catch (boundaryError) {
|
|
194
|
+
throw changedStoreDirectory(this.messagePrefix, createSuppressedError(boundaryError, openError, "directory acquisition and boundary revalidation both failed"));
|
|
195
|
+
}
|
|
196
|
+
if (hasErrorCode(openError, "EACCES")) {
|
|
197
|
+
throw new FsSafeError("permission-unverified", `${this.messagePrefix} directory cannot be safely mode-repaired through a Node descriptor`, { cause: openError });
|
|
198
|
+
}
|
|
199
|
+
throw openError;
|
|
257
200
|
}
|
|
258
|
-
|
|
259
|
-
|
|
201
|
+
inspectOpened(descriptor, receipt) {
|
|
202
|
+
try {
|
|
203
|
+
const stat = inspectFileIdentitySync(() => fs.fstatSync(descriptor, { bigint: true }), receipt.stat);
|
|
204
|
+
if (!stat.isDirectory() || stat.isSymbolicLink()) {
|
|
205
|
+
throw changedStoreDirectory(this.messagePrefix);
|
|
206
|
+
}
|
|
207
|
+
return stat;
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
if (error instanceof FsSafeError && error.code === "outside-workspace")
|
|
211
|
+
throw error;
|
|
212
|
+
throw changedStoreDirectory(this.messagePrefix, error);
|
|
213
|
+
}
|
|
260
214
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
215
|
+
finalizeMode(mode) {
|
|
216
|
+
const receipt = this.receipts.at(-1);
|
|
217
|
+
const requestedMode = BigInt(mode & 0o7777);
|
|
218
|
+
if ((receipt.stat.mode & 4095n) === requestedMode || process.platform === "win32") {
|
|
219
|
+
const current = this.assertEdge();
|
|
220
|
+
// Identity can remain stable while permissions change after the first receipt.
|
|
221
|
+
if (process.platform === "win32" || (current.mode & 4095n) === requestedMode) {
|
|
222
|
+
this.receipts[this.receipts.length - 1] = { ...receipt, stat: current };
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Repair owns the stronger pre/post mode-target fence below, including an
|
|
227
|
+
// admission check on acquisition failure; no earlier admission is needed.
|
|
228
|
+
const descriptor = this.openForMode(receipt);
|
|
229
|
+
let finalStat;
|
|
230
|
+
let operationFailed = false;
|
|
231
|
+
let operationError;
|
|
232
|
+
try {
|
|
233
|
+
const opened = this.inspectOpened(descriptor, receipt);
|
|
234
|
+
this.assertModeTarget();
|
|
235
|
+
if ((opened.mode & 4095n) !== requestedMode) {
|
|
236
|
+
fs.fchmodSync(descriptor, Number(requestedMode));
|
|
237
|
+
}
|
|
238
|
+
const finalized = this.inspectOpened(descriptor, receipt);
|
|
239
|
+
const pathname = this.assertModeTarget();
|
|
240
|
+
if ((finalized.mode & 4095n) !== requestedMode ||
|
|
241
|
+
(pathname.mode & 4095n) !== requestedMode) {
|
|
242
|
+
throw new FsSafeError("insecure-permissions", `${this.messagePrefix} directory mode could not be finalized`);
|
|
243
|
+
}
|
|
244
|
+
finalStat = pathname;
|
|
264
245
|
}
|
|
265
|
-
|
|
246
|
+
catch (error) {
|
|
247
|
+
operationFailed = true;
|
|
248
|
+
operationError = error;
|
|
249
|
+
}
|
|
250
|
+
try {
|
|
251
|
+
fs.closeSync(descriptor);
|
|
252
|
+
}
|
|
253
|
+
catch (closeError) {
|
|
254
|
+
if (operationFailed) {
|
|
255
|
+
throw createSuppressedError(closeError, operationError, "store directory finalization and close both failed");
|
|
256
|
+
}
|
|
257
|
+
throw closeError;
|
|
258
|
+
}
|
|
259
|
+
if (operationFailed)
|
|
260
|
+
throw operationError;
|
|
261
|
+
if (!finalStat)
|
|
262
|
+
throw new FsSafeError("helper-failed", "store directory mode receipt is missing");
|
|
263
|
+
this.receipts[this.receipts.length - 1] = { ...receipt, stat: finalStat };
|
|
266
264
|
}
|
|
267
|
-
if (operationFailed)
|
|
268
|
-
throw operationError;
|
|
269
|
-
if (!finalStat)
|
|
270
|
-
throw new FsSafeError("helper-failed", "store directory mode receipt is missing");
|
|
271
|
-
return { ...receipt, stat: finalStat };
|
|
272
265
|
}
|
|
273
266
|
export function ensureSyncStoreDirectory(params) {
|
|
274
267
|
assertNoWindowsPathAlias(params.rootDir, "filesystem", "store root uses a Windows filesystem namespace alias");
|
|
@@ -282,53 +275,23 @@ export function ensureSyncStoreDirectory(params) {
|
|
|
282
275
|
throw new FsSafeError("outside-workspace", "file path escapes store root");
|
|
283
276
|
}
|
|
284
277
|
fs.mkdirSync(recursiveMkdirPath(pathForWindowsFilesystem(rootDir)), { recursive: true, mode: params.mode });
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
messagePrefix: params.messagePrefix,
|
|
288
|
-
root: true,
|
|
289
|
-
})];
|
|
290
|
-
const rootReal = storeDirectoryRealPath(rootDir);
|
|
291
|
-
receipts[0] = finalizeDirectoryMode({
|
|
292
|
-
receipts,
|
|
293
|
-
rootReal,
|
|
294
|
-
mode: params.mode,
|
|
295
|
-
messagePrefix: params.messagePrefix,
|
|
296
|
-
});
|
|
278
|
+
const chain = new StoreDirectoryChain(rootDir, params.messagePrefix);
|
|
279
|
+
chain.finalizeMode(params.mode);
|
|
297
280
|
let current = rootDir;
|
|
298
281
|
for (const segment of relative.split(path.sep).filter(Boolean)) {
|
|
299
282
|
current = path.join(current, segment);
|
|
300
|
-
let receipt;
|
|
301
283
|
try {
|
|
302
|
-
|
|
303
|
-
dir: current,
|
|
304
|
-
messagePrefix: params.messagePrefix,
|
|
305
|
-
root: false,
|
|
306
|
-
});
|
|
284
|
+
chain.observe(current);
|
|
307
285
|
}
|
|
308
286
|
catch (error) {
|
|
309
287
|
if (error.code !== "ENOENT")
|
|
310
288
|
throw error;
|
|
311
289
|
fs.mkdirSync(pathForWindowsFilesystem(current), { mode: params.mode });
|
|
312
|
-
|
|
313
|
-
dir: current,
|
|
314
|
-
messagePrefix: params.messagePrefix,
|
|
315
|
-
root: false,
|
|
316
|
-
});
|
|
290
|
+
chain.observe(current);
|
|
317
291
|
}
|
|
318
|
-
|
|
319
|
-
receipts[receipts.length - 1] = finalizeDirectoryMode({
|
|
320
|
-
receipts,
|
|
321
|
-
rootReal,
|
|
322
|
-
mode: params.mode,
|
|
323
|
-
messagePrefix: params.messagePrefix,
|
|
324
|
-
});
|
|
292
|
+
chain.finalizeMode(params.mode);
|
|
325
293
|
}
|
|
326
|
-
|
|
327
|
-
return {
|
|
328
|
-
dir,
|
|
329
|
-
realPath: finalChain.finalReal,
|
|
330
|
-
exactStat: finalChain.finalStat,
|
|
331
|
-
};
|
|
294
|
+
return chain.finish(dir);
|
|
332
295
|
}
|
|
333
296
|
export function assertSyncStoreDirectoryReceipt(receipt) {
|
|
334
297
|
try {
|
|
@@ -4,21 +4,14 @@ import path from "node:path";
|
|
|
4
4
|
import { syncDirectorySync } from "./directory-durability.js";
|
|
5
5
|
import { createDirectoryReceiptFromIdentity } from "./directory-receipt.js";
|
|
6
6
|
import { FsSafeError } from "./errors.js";
|
|
7
|
-
import {
|
|
7
|
+
import { ensureParentSync, ensureStoreDirectorySync, } from "./file-store-boundary.js";
|
|
8
|
+
import { assertSyncStoreDirectoryReceipt } from "./file-store-sync-directory.js";
|
|
8
9
|
import { isPathInside } from "./path.js";
|
|
9
10
|
import { resolveReadOpenFlags } from "./read-open-flags.js";
|
|
10
11
|
import { writeTempFileSync } from "./replace-file-descriptor.js";
|
|
11
12
|
import { SyncAtomicTempOwner } from "./replace-file-temp-owner.js";
|
|
12
13
|
import { inspectFileIdentitySync } from "./strict-file-identity.js";
|
|
13
14
|
import { getFsSafeTestHooks } from "./test-hooks.js";
|
|
14
|
-
function ensurePrivateDirectorySync(rootDir, targetDir, mode) {
|
|
15
|
-
return ensureStoreDirectorySync({
|
|
16
|
-
rootDir,
|
|
17
|
-
targetDir,
|
|
18
|
-
mode,
|
|
19
|
-
messagePrefix: "private store",
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
15
|
function verifyStoreFile(fd, expected, filePath) {
|
|
23
16
|
const assertFile = (stat, allowUnknown = false) => {
|
|
24
17
|
const unknown = allowUnknown && process.platform === "win32" && (stat.dev === 0n || stat.ino === 0n);
|
|
@@ -55,7 +48,12 @@ export function writeFileSyncAtomic(params) {
|
|
|
55
48
|
}
|
|
56
49
|
let parentGuard;
|
|
57
50
|
if (params.privateMode) {
|
|
58
|
-
parentGuard =
|
|
51
|
+
parentGuard = ensureStoreDirectorySync({
|
|
52
|
+
rootDir: params.rootDir,
|
|
53
|
+
targetDir: path.dirname(filePath),
|
|
54
|
+
mode: params.dirMode,
|
|
55
|
+
messagePrefix: "private store",
|
|
56
|
+
});
|
|
59
57
|
try {
|
|
60
58
|
const stat = fs.lstatSync(filePath);
|
|
61
59
|
if (stat.isSymbolicLink() || !stat.isFile()) {
|
|
@@ -75,14 +73,12 @@ export function writeFileSyncAtomic(params) {
|
|
|
75
73
|
mode: params.dirMode,
|
|
76
74
|
});
|
|
77
75
|
}
|
|
78
|
-
const tempPath = path.join(parentGuard
|
|
76
|
+
const tempPath = path.join(parentGuard.dir, `.fs-safe-${process.pid}-${randomUUID()}.tmp`);
|
|
79
77
|
const owner = new SyncAtomicTempOwner(tempPath);
|
|
80
78
|
let originalFailure;
|
|
81
79
|
try {
|
|
82
80
|
getFsSafeTestHooks()?.beforeFileStoreSyncPrivateWrite?.(filePath);
|
|
83
|
-
|
|
84
|
-
assertSyncDirectoryGuard(parentGuard);
|
|
85
|
-
}
|
|
81
|
+
assertSyncStoreDirectoryReceipt(parentGuard);
|
|
86
82
|
owner.start();
|
|
87
83
|
const temp = writeTempFileSync({
|
|
88
84
|
fsModule: fs, tempPath, content: params.content, mode: params.mode, sync: false,
|
|
@@ -101,14 +97,10 @@ export function writeFileSyncAtomic(params) {
|
|
|
101
97
|
if (params.durable)
|
|
102
98
|
fs.fsyncSync(temp.fd);
|
|
103
99
|
verifyStoreFile(temp.fd, owner.identity, tempPath);
|
|
104
|
-
|
|
105
|
-
assertSyncDirectoryGuard(parentGuard);
|
|
106
|
-
}
|
|
100
|
+
assertSyncStoreDirectoryReceipt(parentGuard);
|
|
107
101
|
fs.renameSync(tempPath, filePath);
|
|
108
102
|
owner.markRenamed();
|
|
109
|
-
|
|
110
|
-
assertSyncDirectoryGuard(parentGuard);
|
|
111
|
-
}
|
|
103
|
+
assertSyncStoreDirectoryReceipt(parentGuard);
|
|
112
104
|
try {
|
|
113
105
|
verifyStoreFile(temp.fd, owner.identity, filePath);
|
|
114
106
|
}
|
|
@@ -120,13 +112,11 @@ export function writeFileSyncAtomic(params) {
|
|
|
120
112
|
cause: error instanceof Error ? error : undefined,
|
|
121
113
|
});
|
|
122
114
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
syncDirectorySync(createDirectoryReceiptFromIdentity(parentGuard.dir, parentGuard.realPath, parentGuard.exactStat), { label: "store parent" });
|
|
127
|
-
}
|
|
128
|
-
assertSyncDirectoryGuard(parentGuard);
|
|
115
|
+
assertSyncStoreDirectoryReceipt(parentGuard);
|
|
116
|
+
if (params.durable) {
|
|
117
|
+
syncDirectorySync(createDirectoryReceiptFromIdentity(parentGuard.dir, parentGuard.realPath, parentGuard.exactStat), { label: "store parent" });
|
|
129
118
|
}
|
|
119
|
+
assertSyncStoreDirectoryReceipt(parentGuard);
|
|
130
120
|
return filePath;
|
|
131
121
|
}
|
|
132
122
|
catch (error) {
|
package/dist/file-store.d.ts
CHANGED
package/dist/file-store.js
CHANGED
|
@@ -74,18 +74,17 @@ async function copyIntoRoot(params) {
|
|
|
74
74
|
throw new FsSafeError("not-file", "source path is not a file");
|
|
75
75
|
}
|
|
76
76
|
assertFileStoreMaxBytes(sourceStat.size, params.maxBytes);
|
|
77
|
-
const dirMode = params.dirMode ?? 0o700;
|
|
78
77
|
const scopedRoot = await openWritableStoreRoot({
|
|
79
78
|
rootDir: params.rootDir,
|
|
80
|
-
dirMode,
|
|
79
|
+
dirMode: params.dirMode,
|
|
81
80
|
maxBytes: params.maxBytes,
|
|
82
81
|
});
|
|
83
|
-
await ensureParentInRoot(scopedRoot, relativePath, dirMode);
|
|
82
|
+
await ensureParentInRoot(scopedRoot, relativePath, params.dirMode);
|
|
84
83
|
await scopedRoot.copyIn(relativePath, params.sourcePath, {
|
|
85
84
|
durable: params.durable,
|
|
86
85
|
maxBytes: params.maxBytes,
|
|
87
86
|
mkdir: false,
|
|
88
|
-
mode: params.mode
|
|
87
|
+
mode: params.mode,
|
|
89
88
|
});
|
|
90
89
|
return destination;
|
|
91
90
|
}
|
package/dist/file-sync.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ import fs from "node:fs";
|
|
|
2
2
|
import type { FileHandle } from "node:fs/promises";
|
|
3
3
|
export declare function syncFileBestEffort(handle: Pick<FileHandle, "sync">): Promise<void>;
|
|
4
4
|
export declare function syncFileBestEffortSync(fd: number, fsModule?: Pick<typeof fs, "fsyncSync">): void;
|
|
5
|
-
//# sourceMappingURL=file-sync.d.ts.map
|
package/dist/filename.d.ts
CHANGED
package/dist/filename.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { WINDOWS_RESERVED_DEVICE_NAMES } from "./device-path.js";
|
|
3
3
|
import { maxNormalizedUtf8Bytes } from "./unicode-path.js";
|
|
4
|
+
import { hasWindowsDrivePrefix } from "./windows-path-syntax.js";
|
|
4
5
|
const INVALID_FILE_NAME_CHARACTERS = /[\u0000-\u001f\u007f-\u009f<>:"/\\|?*]/g;
|
|
5
6
|
const HAS_INVALID_FILE_NAME_CHARACTER = /[\u0000-\u001f\u007f-\u009f<>:"/\\|?*]/;
|
|
6
7
|
const HAS_RETAINED_FILE_NAME_CHARACTER = /[^\u0000-\u001f\u007f-\u009f<>:"/\\|?*\s]/;
|
|
@@ -53,13 +54,6 @@ function isBoundedSanitizedFileName(fileName, trimmedFileName) {
|
|
|
53
54
|
!HAS_INVALID_FILE_NAME_CHARACTER.test(fileName) &&
|
|
54
55
|
suffixWindowsReservedDeviceName(fileName) === fileName;
|
|
55
56
|
}
|
|
56
|
-
function hasWindowsDrivePrefix(value) {
|
|
57
|
-
if (value.length < 2 || value.charCodeAt(1) !== 0x3a)
|
|
58
|
-
return false;
|
|
59
|
-
const firstCodeUnit = value.charCodeAt(0);
|
|
60
|
-
return (firstCodeUnit >= 0x41 && firstCodeUnit <= 0x5a) ||
|
|
61
|
-
(firstCodeUnit >= 0x61 && firstCodeUnit <= 0x7a);
|
|
62
|
-
}
|
|
63
57
|
function normalizedFileNameBytes(value) {
|
|
64
58
|
return maxNormalizedUtf8Bytes(value, true);
|
|
65
59
|
}
|
package/dist/fs.d.ts
CHANGED
package/dist/guarded-mkdir.d.ts
CHANGED
|
@@ -13,21 +13,15 @@ export declare function guardedRename(params: {
|
|
|
13
13
|
onRenamed?: () => void;
|
|
14
14
|
from: string;
|
|
15
15
|
to: string;
|
|
16
|
-
targetRoot?: string;
|
|
17
|
-
verifyAfter?: boolean;
|
|
18
16
|
}): Promise<void>;
|
|
19
17
|
export declare function guardedRenameSync(params: {
|
|
20
18
|
from: string;
|
|
21
19
|
to: string;
|
|
22
|
-
targetRoot?: string;
|
|
23
|
-
verifyAfter?: boolean;
|
|
24
20
|
}): void;
|
|
25
21
|
export declare function guardedRm(params: {
|
|
26
22
|
target: string;
|
|
27
23
|
assertBeforeMutation?: () => void;
|
|
28
24
|
recursive?: boolean;
|
|
29
|
-
force?: boolean;
|
|
30
|
-
verifyAfter?: boolean;
|
|
31
25
|
}): Promise<void>;
|
|
32
26
|
export declare function guardedRmSync(params: {
|
|
33
27
|
target: string;
|
|
@@ -36,4 +30,3 @@ export declare function guardedRmSync(params: {
|
|
|
36
30
|
force?: boolean;
|
|
37
31
|
verifyAfter?: boolean;
|
|
38
32
|
}): void;
|
|
39
|
-
//# sourceMappingURL=guarded-mutation.d.ts.map
|